/* 图传 · 样式 */
:root {
  --bg: #f5f6fb; --card: #fff; --text: #1a1d29; --muted: #6b7280; --line: #e6e8f0;
  --primary: #5b5bf6; --primary-2: #8b5cf6; --primary-soft: #eeeeff;
  --ok: #22c55e; --danger: #ef4444;
  --radius: 16px; --shadow: 0 10px 30px -12px rgba(30,34,90,.16), 0 2px 6px -2px rgba(30,34,90,.06);
  --shadow-lg: 0 30px 60px -20px rgba(30,34,90,.28); --ease: cubic-bezier(.2,.8,.2,1);
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #0f1118; --card: #171a24; --text: #eef0f6; --muted: #9aa0b3; --line: #262a38; --primary-soft: #23244a;
    --shadow: 0 10px 30px -12px rgba(0,0,0,.6); --shadow-lg: 0 30px 60px -20px rgba(0,0,0,.7); }
}
* { box-sizing: border-box; }
body {
  margin: 0; background: var(--bg); color: var(--text); line-height: 1.5; min-height: 100dvh;
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", "Segoe UI", Roboto, Arial, sans-serif;
}
a { color: var(--primary); text-decoration: none; }
img { display: block; max-width: 100%; }
button, input { font: inherit; color: inherit; }
button { cursor: pointer; }
kbd { font: inherit; font-size: .85em; padding: 1px 6px; border-radius: 6px; border: 1px solid var(--line); background: var(--card); }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.err { color: var(--danger); min-height: 1.2em; margin: 6px 0 0; font-size: .9rem; }
[hidden] { display: none !important; }

/* 背景 */
.bg-blobs { position: fixed; inset: 0; z-index: -1; overflow: hidden; pointer-events: none; }
.bg-blobs span { position: absolute; width: 46vmax; height: 46vmax; border-radius: 50%; filter: blur(80px); opacity: .3; animation: float 24s var(--ease) infinite alternate; }
.bg-blobs span:nth-child(1) { background: #c7c8ff; top: -20vmax; left: -10vmax; }
.bg-blobs span:nth-child(2) { background: #ffd6ec; bottom: -22vmax; right: -12vmax; animation-delay: -10s; }
@media (prefers-color-scheme: dark) { .bg-blobs span { opacity: .15; } }
@keyframes float { to { transform: translate3d(6vmax, 4vmax, 0) scale(1.1); } }

/* 布局 */
.container { width: min(1100px, 100% - 32px); margin: 0 auto; padding-bottom: 50px; }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 16px; width: min(1100px, 100% - 32px); margin: 0 auto; padding: 16px 0; }
.brand { display: inline-flex; align-items: center; gap: 10px; font-weight: 700; font-size: 1.15rem; color: var(--text); }
.brand-logo { display: inline-grid; place-items: center; width: 36px; height: 36px; border-radius: 11px; color: #fff; background: linear-gradient(135deg, var(--primary), var(--primary-2)); box-shadow: 0 6px 14px -6px rgba(91,91,246,.7); }
.brand-logo svg { width: 20px; height: 20px; }
.search { position: relative; width: min(320px, 50vw); }
.search svg { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); width: 16px; height: 16px; color: var(--muted); }
.search input { width: 100%; padding: 9px 12px 9px 36px; border-radius: 12px; border: 1px solid var(--line); background: var(--card); outline: none; transition: border-color .2s, box-shadow .2s; }
.search input:focus { border-color: var(--primary); box-shadow: 0 0 0 4px rgba(91,91,246,.12); }

/* 卡片 & 按钮 */
.card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); border: 1px solid var(--line); padding: 18px; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 9px 14px; border-radius: 10px; border: 1px solid transparent; font-weight: 600; font-size: .9rem; white-space: nowrap; transition: transform .15s var(--ease), box-shadow .2s, background .2s; user-select: none; }
.btn:active { transform: scale(.97); }
.btn-primary { color: #fff; background: linear-gradient(135deg, var(--primary), var(--primary-2)); box-shadow: 0 6px 14px -8px rgba(91,91,246,.8); }
.btn-primary:hover { box-shadow: 0 10px 20px -8px rgba(91,91,246,.9); transform: translateY(-1px); }
.btn-block { width: 100%; }
.icon-btn { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 10px; border: 0; background: transparent; color: var(--muted); transition: background .2s, color .2s; }
.icon-btn svg { width: 18px; height: 18px; }
.icon-btn:hover { background: var(--primary-soft); color: var(--primary); }
.icon-btn.danger:hover { background: #fee2e2; color: var(--danger); }
.link-btn { background: none; border: 0; color: var(--primary); padding: 4px 6px; font-size: .88rem; border-radius: 6px; }
.link-btn.danger { color: var(--danger); }
.input-group { display: flex; gap: 8px; }
.input-group input { flex: 1; min-width: 0; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--line); background: var(--bg); outline: none; font-family: ui-monospace, Menlo, Consolas, monospace; font-size: .88rem; }

/* 上传区 */
.dropzone { position: relative; border: 2px dashed #c9cbe6; border-radius: 14px; padding: 30px 20px; text-align: center; background: linear-gradient(180deg, rgba(91,91,246,.04), transparent); transition: border-color .2s, background .2s, transform .2s var(--ease); cursor: pointer; outline: none; }
@media (prefers-color-scheme: dark) { .dropzone { border-color: #3a3d55; } }
.dropzone:hover, .dropzone:focus-visible { border-color: var(--primary); background: var(--primary-soft); }
.dropzone.dragover { border-color: var(--primary); background: var(--primary-soft); transform: scale(1.01); animation: pulse 1.2s ease-in-out infinite; }
@keyframes pulse { 0%,100% { box-shadow: 0 0 0 0 rgba(91,91,246,.25); } 50% { box-shadow: 0 0 0 12px rgba(91,91,246,0); } }
.dz-icon { width: 56px; height: 56px; margin: 0 auto 10px; border-radius: 16px; display: grid; place-items: center; color: var(--primary); background: var(--primary-soft); transition: transform .3s var(--ease); }
.dz-icon svg { width: 28px; height: 28px; }
.dropzone:hover .dz-icon, .dropzone.dragover .dz-icon { transform: translateY(-4px) rotate(-4deg); }
.dz-text strong { color: var(--primary); }
.dz-hint { margin-top: 6px; color: var(--muted); font-size: .85rem; }
.note-field { display: flex; align-items: center; gap: 12px; margin-top: 14px; }
.note-field span { font-size: .9rem; color: var(--muted); font-weight: 600; white-space: nowrap; }
.note-field input { flex: 1; padding: 10px 14px; border-radius: 10px; border: 1px solid var(--line); background: var(--bg); outline: none; transition: border-color .2s, box-shadow .2s; }
.note-field input:focus { border-color: var(--primary); box-shadow: 0 0 0 4px rgba(91,91,246,.12); }

/* 图片库 */
.library { margin-top: 22px; }
.lib-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding: 0 4px 10px; }
.lib-head h2 { margin: 0; font-size: 1.1rem; }
.lib-head h2 .muted { font-size: .9rem; font-weight: 500; margin-left: 6px; }
.rows { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.row {
  display: grid; grid-template-columns: 64px minmax(160px, 1fr) minmax(280px, 1.3fr) auto; gap: 14px; align-items: center;
  padding: 10px 12px; border-radius: 14px; background: var(--card); border: 1px solid var(--line); box-shadow: var(--shadow);
  transition: transform .2s var(--ease), box-shadow .2s, opacity .25s;
}
.row:hover { transform: translateY(-1px); box-shadow: var(--shadow-lg); }
.row.removing { opacity: 0; transform: translateX(16px); }
.row-thumb { display: block; width: 64px; height: 64px; border-radius: 10px; overflow: hidden; background: var(--line); }
.row-thumb img { width: 100%; height: 100%; object-fit: cover; transition: transform .3s var(--ease); }
.row-thumb:hover img { transform: scale(1.08); }
.row-info { min-width: 0; }
.row-name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-note { display: inline-block; max-width: 100%; margin: 2px 0; padding: 1px 8px; border-radius: 6px; border: 0; background: var(--primary-soft); color: var(--primary); font-size: .82rem; text-align: left; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; cursor: pointer; }
.row-note.is-empty { background: transparent; color: var(--muted); opacity: 0; transition: opacity .2s; }
.row:hover .row-note.is-empty { opacity: .8; }
.row.uploading .row-note.is-empty { display: none; }
.row-meta { font-size: .8rem; color: var(--muted); }
.row-link { display: flex; gap: 8px; min-width: 0; }
.row-link input { flex: 1; min-width: 0; padding: 9px 12px; border-radius: 10px; border: 1px solid var(--line); background: var(--bg); outline: none; font-family: ui-monospace, Menlo, Consolas, monospace; font-size: .85rem; color: var(--text); }
.row-link input:focus { border-color: var(--primary); }
.row-actions { display: flex; gap: 2px; align-items: center; }
.bar { flex: 1; height: 8px; border-radius: 8px; background: var(--line); overflow: hidden; align-self: center; }
.bar i { display: block; height: 100%; width: 0; border-radius: 8px; background: linear-gradient(90deg, var(--primary), var(--primary-2)); transition: width .25s var(--ease); }
.row.error .bar i { background: var(--danger); width: 100% !important; }
.row.error .row-state { color: var(--danger); }
.empty { text-align: center; padding: 40px 0; }
@media (max-width: 760px) {
  .row { grid-template-columns: 56px 1fr auto; }
  .row-link { grid-column: 1 / -1; }
  .row-thumb { width: 56px; height: 56px; }
  .search { width: 160px; }
}

/* 弹窗 */
.modal { position: fixed; inset: 0; z-index: 60; display: grid; place-items: center; background: rgba(10,12,30,.45); backdrop-filter: blur(6px); animation: fadein .25s; padding: 16px; }
.modal-card { position: relative; width: min(400px, 100%); background: var(--card); border-radius: 20px; padding: 28px; text-align: center; box-shadow: var(--shadow-lg); display: flex; flex-direction: column; gap: 12px; align-items: stretch; animation: popin .35s var(--ease); }
.modal-card h3 { margin: 0; }
.modal-close { position: absolute; top: 10px; right: 10px; }
.modal-card canvas { width: 240px; height: 240px; margin: 4px auto 0; padding: 8px; background: #fff; border-radius: 12px; border: 1px solid var(--line); }
.qr-name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.modal-card input[type=password] { padding: 11px 14px; border-radius: 12px; border: 1px solid var(--line); background: var(--bg); outline: none; }
.modal-card input:focus { border-color: var(--primary); box-shadow: 0 0 0 4px rgba(91,91,246,.12); }
.modal-card p { margin: 0; }
.lock-ico { font-size: 2.2rem; }

/* toast */
.toast { position: fixed; left: 50%; bottom: 28px; transform: translate(-50%, 20px); opacity: 0; background: var(--text); color: var(--bg); padding: 10px 18px; border-radius: 12px; font-size: .92rem; z-index: 100; pointer-events: none; transition: all .3s var(--ease); box-shadow: var(--shadow-lg); max-width: 90vw; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* 动画 */
.anim-fadeup { animation: fadeup .5s var(--ease) both; }
.anim-pop { animation: popin .4s var(--ease) both; animation-delay: calc(var(--i, 0) * 35ms); }
.delay-1 { animation-delay: .08s; }
@keyframes fadeup { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
@keyframes popin { from { opacity: 0; transform: scale(.96) translateY(6px); } to { opacity: 1; transform: none; } }
@keyframes fadein { from { opacity: 0; } to { opacity: 1; } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; } }
