/* ==========================================================================
   GamePic Matcher — local-first game image review & rename workspace
   ========================================================================== */

:root {
  --ink: #0f172a;
  --ink-2: #1e293b;
  --ink-3: #334155;
  --muted: #64748b;
  --muted-2: #94a3b8;
  --line: #e5eaf2;
  --line-strong: #cbd5e1;
  --bg: #f4f7fc;
  --card: #ffffff;

  --indigo: #4f46e5;
  --indigo-2: #6366f1;
  --indigo-3: #818cf8;
  --indigo-soft: #eef2ff;
  --cyan: #0891b2;
  --cyan-soft: #ecfeff;
  --green: #059669;
  --green-soft: #ecfdf5;
  --amber: #d97706;
  --amber-soft: #fffbeb;
  --red: #dc2626;
  --red-soft: #fef2f2;
  --violet: #7c3aed;
  --violet-soft: #f5f3ff;
  --slate-soft: #f1f5f9;

  --shadow-sm: 0 1px 2px rgba(15, 23, 42, .05), 0 2px 8px rgba(15, 23, 42, .04);
  --shadow-md: 0 2px 4px rgba(15, 23, 42, .04), 0 16px 32px -12px rgba(15, 23, 42, .16);
  --shadow-lg: 0 24px 60px -20px rgba(15, 23, 42, .3);

  --radius-sm: 10px;
  --radius: 16px;
  --radius-lg: 22px;
  --radius-xl: 30px;

  --font: "Segoe UI", "Microsoft YaHei UI", "Microsoft YaHei", "PingFang SC",
    "Hiragino Sans GB", "Noto Sans SC", system-ui, -apple-system, sans-serif;
  --mono: "Cascadia Code", "SFMono-Regular", Consolas, "Liberation Mono", monospace;
}

* { box-sizing: border-box; }

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(1100px 460px at 12% -10%, rgba(99, 102, 241, .10), transparent 62%),
    radial-gradient(900px 420px at 92% 2%, rgba(6, 182, 212, .08), transparent 58%),
    var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

body.modal-open { overflow: hidden; }

::selection { background: #c7d2fe; color: #1e1b4b; }

h1, h2, h3, h4, p { margin: 0; }
button, input, select, textarea { font: inherit; }
button { color: inherit; }
a { color: inherit; }
img { max-width: 100%; }

.svg-sprite {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
}

svg {
  width: 20px;
  height: 20px;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* ---------- Shared primitives ------------------------------------------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 40px;
  padding: 9px 16px;
  border: 1px solid transparent;
  border-radius: 11px;
  background: transparent;
  color: var(--ink-2);
  font-weight: 650;
  font-size: 13.5px;
  line-height: 1.2;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  transition: background .18s ease, border-color .18s ease, color .18s ease,
    box-shadow .18s ease, transform .18s ease;
}
.btn svg { width: 17px; height: 17px; }
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn:disabled {
  opacity: .5;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.btn-primary {
  background: linear-gradient(135deg, #4f46e5, #6366f1 55%, #0891b2 145%);
  color: #fff;
  box-shadow: 0 10px 20px -10px rgba(79, 70, 229, .75);
}
.btn-primary:hover:not(:disabled) {
  box-shadow: 0 15px 28px -12px rgba(79, 70, 229, .85);
  filter: brightness(1.04);
}

.btn-ghost {
  background: #fff;
  border-color: var(--line);
  color: var(--ink-3);
}
.btn-ghost:hover:not(:disabled) { border-color: #c7d2fe; color: var(--indigo); }

.btn-dark-ghost {
  background: rgba(255, 255, 255, .06);
  border-color: rgba(255, 255, 255, .18);
  color: #e2e8f0;
  backdrop-filter: blur(8px);
}
.btn-dark-ghost:hover:not(:disabled) {
  background: rgba(255, 255, 255, .12);
  border-color: rgba(255, 255, 255, .32);
}

.btn-sm { min-height: 34px; padding: 7px 12px; font-size: 12.5px; border-radius: 9px; }
.btn-lg { min-height: 48px; padding: 12px 22px; font-size: 14.5px; border-radius: 13px; }
.btn-block { width: 100%; }

.btn.is-busy { pointer-events: none; opacity: .7; }

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  padding: 0;
  border: 1px solid transparent;
  border-radius: 10px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  transition: .18s ease;
}
.icon-btn svg { width: 18px; height: 18px; }
.icon-btn:hover { background: var(--slate-soft); color: var(--ink); }
.icon-btn.danger:hover { background: var(--red-soft); color: var(--red); }

.text-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 2px;
  border: 0;
  background: none;
  color: var(--indigo);
  font-size: 12.5px;
  font-weight: 650;
  cursor: pointer;
  border-radius: 6px;
}
.text-btn svg { width: 15px; height: 15px; }
.text-btn:hover { color: #3730a3; text-decoration: underline; text-underline-offset: 3px; }
.danger-text { color: var(--red); }
.danger-text:hover { color: #991b1b; }

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 10.5px;
  font-weight: 750;
  letter-spacing: .18em;
  text-transform: uppercase;
  color: #a5b4fc;
}
.eyebrow.dark { color: var(--indigo); }
.eyebrow-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #22d3ee;
  box-shadow: 0 0 0 4px rgba(34, 211, 238, .15);
}
.eyebrow.dark .eyebrow-dot { background: var(--indigo); box-shadow: 0 0 0 4px rgba(79, 70, 229, .12); }

.tone-slate { color: #475569; background: #f1f5f9; }
.tone-indigo { color: var(--indigo); background: var(--indigo-soft); }
.tone-cyan { color: var(--cyan); background: var(--cyan-soft); }
.tone-green { color: var(--green); background: var(--green-soft); }
.tone-amber { color: var(--amber); background: var(--amber-soft); }

/* ---------- Top bar ------------------------------------------------------ */

.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  border-bottom: 1px solid rgba(226, 232, 240, .8);
  background: rgba(255, 255, 255, .82);
  backdrop-filter: blur(18px) saturate(160%);
}
.topbar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  max-width: 1280px;
  height: 66px;
  margin: 0 auto;
  padding: 0 26px;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  text-decoration: none;
}
.brand-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border-radius: 12px;
  background: linear-gradient(135deg, #4f46e5, #0e7490 125%);
  color: #fff;
  box-shadow: 0 8px 16px -8px rgba(79, 70, 229, .9);
}
.brand-mark svg { width: 21px; height: 21px; }
.brand-mark.small { width: 26px; height: 26px; border-radius: 8px; }
.brand-mark.small svg { width: 15px; height: 15px; }
.brand-copy { display: flex; flex-direction: column; line-height: 1.2; }
.brand-copy strong { font-size: 15.5px; letter-spacing: -.01em; }
.brand-copy small {
  margin-top: 3px;
  color: var(--muted-2);
  font-size: 10px;
  font-weight: 650;
  letter-spacing: .1em;
}
.topbar-actions { display: flex; align-items: center; gap: 10px; }
.privacy-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border: 1px solid #bbf7d0;
  border-radius: 999px;
  background: #f0fdf4;
  color: #15803d;
  font-size: 11.5px;
  font-weight: 650;
  white-space: nowrap;
}
.privacy-chip svg { width: 14px; height: 14px; }

/* ---------- Page & hero -------------------------------------------------- */

.page {
  max-width: 1280px;
  margin: 0 auto;
  padding: 26px 26px 64px;
}

.hero {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(320px, .85fr);
  gap: 28px;
  padding: 54px 56px 82px;
  overflow: hidden;
  border-radius: var(--radius-xl);
  background:
    radial-gradient(720px 360px at 82% 8%, rgba(8, 145, 178, .32), transparent 60%),
    radial-gradient(620px 380px at 8% 100%, rgba(99, 102, 241, .3), transparent 62%),
    linear-gradient(135deg, #080f20 0%, #101b35 52%, #0a2330 100%);
  color: #fff;
  box-shadow: var(--shadow-lg);
}
.hero::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(148, 163, 184, .08) 1px, transparent 1px),
    linear-gradient(90deg, rgba(148, 163, 184, .08) 1px, transparent 1px);
  background-size: 46px 46px;
  mask-image: radial-gradient(ellipse at 60% 20%, #000 10%, transparent 72%);
  opacity: .55;
}
.hero::after {
  content: "";
  position: absolute;
  width: 300px;
  height: 300px;
  right: -80px;
  bottom: -140px;
  border-radius: 50%;
  border: 1px solid rgba(103, 232, 249, .2);
  box-shadow: 0 0 0 54px rgba(103, 232, 249, .035), 0 0 0 108px rgba(103, 232, 249, .025);
}
.hero-copy { position: relative; z-index: 1; }
.hero h1 {
  margin: 18px 0 0;
  font-size: clamp(34px, 4.1vw, 54px);
  line-height: 1.13;
  font-weight: 800;
  letter-spacing: -.045em;
}
.gradient-text {
  background: linear-gradient(100deg, #c7d2fe 4%, #67e8f9 58%, #a7f3d0 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.hero-lead {
  max-width: 590px;
  margin-top: 18px;
  color: #b8c4d9;
  font-size: 15px;
  line-height: 1.8;
}
.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 27px;
}
.flow-line {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 34px;
  color: #94a3b8;
  font-size: 11px;
  font-weight: 650;
  letter-spacing: .04em;
}
.flow-line span { display: inline-flex; align-items: center; gap: 5px; white-space: nowrap; }
.flow-line b {
  color: #67e8f9;
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 700;
}
.flow-line i {
  width: 22px;
  height: 1px;
  background: linear-gradient(90deg, rgba(148, 163, 184, .5), rgba(148, 163, 184, .08));
}

.hero-visual {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 330px;
}
.visual-glow {
  position: absolute;
  width: 280px;
  height: 280px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(99, 102, 241, .5), transparent 65%);
  filter: blur(28px);
}
.match-card {
  position: relative;
  width: min(348px, 100%);
  padding: 20px;
  border: 1px solid rgba(255, 255, 255, .45);
  border-radius: 20px;
  background: rgba(255, 255, 255, .97);
  color: var(--ink);
  box-shadow: 0 30px 60px -20px rgba(0, 0, 0, .55);
  transform: rotate(-2.2deg);
  animation: cardIn .8s cubic-bezier(.2, .8, .2, 1) both;
}
@keyframes cardIn {
  from { opacity: 0; transform: translateY(18px) rotate(-4deg) scale(.97); }
  to { opacity: 1; transform: translateY(0) rotate(-2.2deg) scale(1); }
}
.match-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 12px;
  border-bottom: 1px dashed var(--line);
}
.mini-label { color: var(--muted-2); font-family: var(--mono); font-size: 9.5px; font-weight: 700; letter-spacing: .13em; }
.mini-status {
  padding: 3px 8px;
  border-radius: 999px;
  background: var(--green-soft);
  color: var(--green);
  font-size: 10px;
  font-weight: 700;
}
.file-demo { display: flex; gap: 14px; padding: 16px 0 14px; }
.demo-thumb {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 68px;
  height: 84px;
  flex: none;
  border-radius: 11px;
  background: linear-gradient(145deg, #1e1b4b, #0e7490);
  color: rgba(255, 255, 255, .75);
}
.demo-thumb svg { width: 26px; height: 26px; }
.demo-thumb span {
  position: absolute;
  right: 5px;
  bottom: 5px;
  padding: 1px 5px;
  border-radius: 4px;
  background: #fff;
  color: var(--indigo);
  font-family: var(--mono);
  font-size: 8.5px;
  font-weight: 800;
}
.demo-names { display: flex; min-width: 0; flex-direction: column; gap: 3px; }
.demo-names small { color: var(--muted-2); font-size: 9.5px; font-weight: 700; letter-spacing: .06em; }
.demo-names strong {
  overflow: hidden;
  color: var(--ink-2);
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.demo-names .demo-arrow { color: var(--indigo-3); font-size: 13px; line-height: 1; }
.demo-names .demo-target { color: var(--indigo); font-family: var(--mono); font-size: 14px; }
.demo-checks { display: flex; flex-wrap: wrap; gap: 6px; padding-top: 12px; border-top: 1px dashed var(--line); }
.demo-check {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 7px;
  border-radius: 6px;
  background: #f8fafc;
  color: #475569;
  font-size: 9.5px;
  font-weight: 650;
}
.demo-check svg { width: 11px; height: 11px; color: var(--green); }

.float-chip {
  position: absolute;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 11px;
  border: 1px solid rgba(255, 255, 255, .16);
  border-radius: 999px;
  background: rgba(15, 23, 42, .72);
  color: #e2e8f0;
  font-size: 10.5px;
  font-weight: 650;
  backdrop-filter: blur(10px);
  box-shadow: 0 12px 24px -12px rgba(0, 0, 0, .8);
}
.float-chip svg { width: 14px; height: 14px; color: #67e8f9; }
.float-chip-a { top: 24px; left: -6px; animation: floatA 5s ease-in-out infinite; }
.float-chip-b { right: -4px; bottom: 34px; animation: floatB 6s ease-in-out infinite; }
@keyframes floatA { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-7px); } }
@keyframes floatB { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(6px); } }

/* ---------- Stats -------------------------------------------------------- */

.stats {
  position: relative;
  z-index: 2;
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 13px;
  margin: -46px 18px 0;
}
.stat-card {
  display: flex;
  align-items: center;
  gap: 11px;
  min-width: 0;
  padding: 15px 15px 14px;
  border: 1px solid rgba(226, 232, 240, .9);
  border-radius: 15px;
  background: var(--card);
  box-shadow: var(--shadow-sm);
}
.stat-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  flex: none;
  border-radius: 11px;
}
.stat-icon svg { width: 19px; height: 19px; }
.stat-card > div { display: flex; min-width: 0; flex-direction: column; line-height: 1.1; }
.stat-card strong {
  font-size: 22px;
  font-weight: 800;
  letter-spacing: -.03em;
  font-variant-numeric: tabular-nums;
}
.stat-card small { margin-top: 4px; color: var(--muted); font-size: 10.5px; font-weight: 600; white-space: nowrap; }
.stat-note {
  margin-left: auto;
  color: var(--muted-2);
  font-size: 9.5px;
  font-weight: 650;
  text-align: right;
  white-space: nowrap;
}
.stat-card.is-hot .stat-note { color: var(--amber); }
.stat-card.is-good .stat-note { color: var(--green); }

/* ---------- Workspace ---------------------------------------------------- */

.workspace {
  display: grid;
  grid-template-columns: minmax(0, 1.55fr) minmax(336px, .85fr);
  gap: 20px;
  margin-top: 26px;
  scroll-margin-top: 84px;
}
.upload-column { display: flex; min-width: 0; flex-direction: column; gap: 20px; }
.control-column { position: sticky; top: 84px; display: flex; height: fit-content; flex-direction: column; gap: 20px; }

.panel {
  position: relative;
  min-width: 0;
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--card);
  box-shadow: var(--shadow-sm);
}
.panel-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 15px;
}
.step-title { display: flex; align-items: flex-start; gap: 11px; }
.step-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 27px;
  height: 27px;
  flex: none;
  margin-top: 1px;
  border-radius: 8px;
  background: var(--ink);
  color: #fff;
  font-family: var(--mono);
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: .03em;
}
.step-title h2 { font-size: 16px; font-weight: 750; letter-spacing: -.015em; }
.step-title p { margin-top: 3px; color: var(--muted); font-size: 11.5px; }
.panel-status {
  flex: none;
  padding: 4px 9px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #f8fafc;
  color: var(--muted-2);
  font-size: 10px;
  font-weight: 700;
  white-space: nowrap;
}
.panel-status.is-ready { border-color: #a7f3d0; background: #f0fdf4; color: var(--green); }
.panel-status.is-busy { border-color: #c7d2fe; background: var(--indigo-soft); color: var(--indigo); }

/* Dropzones */
.dropzone {
  position: relative;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 22px 20px;
  border: 1.5px dashed #c7d2e5;
  border-radius: 15px;
  background:
    radial-gradient(360px 140px at 8% 10%, rgba(99, 102, 241, .05), transparent 70%),
    #fbfcff;
  cursor: pointer;
  transition: border-color .18s ease, background .18s ease, transform .18s ease;
}
.dropzone:hover,
.dropzone:focus-visible {
  border-color: var(--indigo-3);
  background: #f8f9ff;
  outline: none;
}
.dropzone.dragover {
  border-color: var(--indigo);
  background: #f1f4ff;
  box-shadow: inset 0 0 0 3px rgba(99, 102, 241, .08);
}
.dropzone.is-busy { pointer-events: none; opacity: .72; }
.drop-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  flex: none;
  border-radius: 12px;
}
.drop-icon svg { width: 22px; height: 22px; }
.drop-copy { min-width: 0; }
.drop-copy strong { display: block; font-size: 13px; font-weight: 700; }
.drop-copy strong span { color: var(--indigo); text-decoration: underline; text-decoration-style: dotted; text-underline-offset: 3px; }
.drop-copy small { display: block; margin-top: 3px; color: var(--muted); font-size: 11px; line-height: 1.55; }
.drop-badge {
  margin-left: auto;
  padding: 4px 9px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  color: var(--muted-2);
  font-size: 9.5px;
  font-weight: 700;
  white-space: nowrap;
}
.dropzone-images { padding: 26px 20px; }
.drop-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-top: 8px; }
.drop-actions .text-btn { font-size: 11.5px; }
.drop-actions .text-btn svg { width: 13px; height: 13px; }
.format-pills { display: flex; flex-wrap: wrap; gap: 5px; margin-left: auto; }
.format-pills span {
  padding: 3px 6px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: #fff;
  color: var(--muted-2);
  font-family: var(--mono);
  font-size: 8.5px;
  font-weight: 700;
}
.dropzone-images .drop-icon { background: var(--cyan-soft); color: var(--cyan); }

/* Games summary */
.data-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 13px;
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fbfcff;
}
.summary-main { display: flex; min-width: 0; align-items: center; gap: 10px; }
.summary-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  flex: none;
  border-radius: 9px;
  background: var(--indigo-soft);
  color: var(--indigo);
}
.summary-icon svg { width: 17px; height: 17px; }
.summary-main div { display: flex; min-width: 0; flex-direction: column; line-height: 1.35; }
.summary-main strong { overflow: hidden; font-size: 12.5px; text-overflow: ellipsis; white-space: nowrap; }
.summary-main small { color: var(--muted-2); font-size: 10.5px; }
.summary-actions { display: flex; flex: none; align-items: center; gap: 3px; }

.field-preview {
  margin-top: 12px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 11px;
}
.field-preview table { width: 100%; border-collapse: collapse; font-size: 11px; }
.field-preview th,
.field-preview td {
  padding: 7px 9px;
  border-bottom: 1px solid #f1f5f9;
  text-align: left;
  white-space: nowrap;
}
.field-preview th { background: #f8fafc; color: var(--muted); font-size: 9.5px; font-weight: 700; letter-spacing: .03em; }
.field-preview tr:last-child td { border-bottom: 0; }
.field-preview .cell-id { color: var(--indigo); font-family: var(--mono); font-weight: 700; }
.field-preview .cell-muted { max-width: 170px; overflow: hidden; color: var(--muted); text-overflow: ellipsis; }

.panel-foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 14px;
  margin-top: 13px;
  padding-top: 12px;
  border-top: 1px dashed var(--line);
}

/* Upload gallery */
.upload-gallery-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin: 15px 0 9px;
}
.upload-gallery-head > div:first-child { display: flex; flex-direction: column; line-height: 1.3; }
.upload-gallery-head strong { font-size: 12.5px; }
.upload-gallery-head small { color: var(--muted-2); font-size: 10.5px; }
.gallery-actions { display: flex; align-items: center; gap: 10px; }
.upload-gallery {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 8px;
}
.upload-gallery:empty { display: none; }
.gallery-item {
  position: relative;
  min-width: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #f8fafc;
  aspect-ratio: 1 / 1;
}
.gallery-item img { width: 100%; height: 100%; object-fit: cover; display: block; }
.gallery-item .gallery-name {
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  padding: 11px 5px 4px;
  overflow: hidden;
  background: linear-gradient(transparent, rgba(2, 6, 23, .78));
  color: #fff;
  font-size: 8px;
  line-height: 1.2;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.gallery-remove {
  position: absolute;
  top: 3px;
  right: 3px;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 19px;
  height: 19px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: rgba(15, 23, 42, .68);
  color: #fff;
  cursor: pointer;
  opacity: 0;
  transition: opacity .15s ease, background .15s ease;
}
.gallery-remove svg { width: 11px; height: 11px; }
.gallery-item:hover .gallery-remove,
.gallery-remove:focus-visible { opacity: 1; }
.gallery-remove:hover { background: var(--red); }
.gallery-more {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 2px;
  border: 1px dashed var(--line-strong);
  border-radius: 9px;
  background: #f8fafc;
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
  aspect-ratio: 1 / 1;
}
.gallery-more b { font-size: 18px; color: var(--ink-3); }

/* ---------- Settings ----------------------------------------------------- */

.settings-panel { padding-bottom: 18px; }
.switch-row {
  display: flex;
  align-items: center;
  gap: 13px;
  padding: 12px 0;
  border-bottom: 1px solid #f1f5f9;
  cursor: pointer;
}
.switch-row:first-of-type { padding-top: 2px; }
.switch-copy { display: flex; min-width: 0; flex-direction: column; line-height: 1.4; }
.switch-copy strong { font-size: 12.5px; }
.switch-copy small { margin-top: 2px; color: var(--muted-2); font-size: 10.5px; }
.switch-row input {
  position: absolute;
  width: 0;
  height: 0;
  opacity: 0;
  pointer-events: none;
}
.switch-ui {
  position: relative;
  width: 40px;
  height: 22px;
  flex: none;
  margin-left: auto;
  border-radius: 999px;
  background: #d5dce8;
  transition: background .18s ease;
}
.switch-ui::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(15, 23, 42, .25);
  transition: transform .18s cubic-bezier(.3, .8, .3, 1);
}
.switch-row input:checked + .switch-ui { background: var(--indigo); }
.switch-row input:checked + .switch-ui::after { transform: translateX(18px); }
.switch-row input:focus-visible + .switch-ui { box-shadow: 0 0 0 3px rgba(99, 102, 241, .22); }

.setting-block { padding-top: 14px; }
.setting-block > label,
.setting-block > strong { display: block; margin-bottom: 6px; color: var(--ink-3); font-size: 11.5px; font-weight: 700; }
.setting-block select,
.setting-block input[type="text"],
.setting-block textarea {
  width: 100%;
  padding: 9px 10px;
  border: 1px solid var(--line-strong);
  border-radius: 9px;
  background: #fff;
  color: var(--ink-2);
  font-size: 12px;
  outline: none;
  transition: border-color .16s ease, box-shadow .16s ease;
}
.setting-block select:focus,
.setting-block input[type="text"]:focus,
.setting-block textarea:focus {
  border-color: var(--indigo-3);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, .12);
}
.setting-help { display: block; margin-top: 5px; color: var(--muted-2); font-size: 10px; line-height: 1.55; }

.template-row { display: flex; flex-direction: column; gap: 6px; }
.template-row input[type="text"] { font-family: var(--mono); font-size: 11.5px; letter-spacing: .01em; }
.template-tokens {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 7px;
}
.token-chip {
  padding: 2px 6px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: #f8fafc;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 9px;
  font-weight: 650;
  cursor: pointer;
}
.token-chip:hover { border-color: #c7d2fe; background: var(--indigo-soft); color: var(--indigo); }

.advanced-box {
  margin-top: 14px;
  padding: 10px 11px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fbfcff;
}
.advanced-box summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  color: var(--ink-3);
  font-size: 11.5px;
  font-weight: 650;
  cursor: pointer;
  list-style: none;
}
.advanced-box summary::-webkit-details-marker { display: none; }
.advanced-box summary span { display: inline-flex; align-items: center; gap: 6px; }
.advanced-box summary svg { width: 14px; height: 14px; color: var(--muted); }
.advanced-box summary .chev { transition: transform .18s ease; }
.advanced-box[open] summary .chev { transform: rotate(90deg); }
.advanced-box p { margin-top: 7px; color: var(--muted); font-size: 10.5px; line-height: 1.6; }
.advanced-box textarea { margin-top: 7px; resize: vertical; font-family: var(--mono); font-size: 10.5px; }

.privacy-note {
  display: flex;
  align-items: flex-start;
  gap: 7px;
  margin-top: 14px;
  padding: 9px 10px;
  border-radius: 9px;
  background: #f0fdf4;
  color: #166534;
  font-size: 10px;
  line-height: 1.55;
}
.privacy-note svg { width: 15px; height: 15px; margin-top: 1px; flex: none; }

/* Process panel */
.process-panel {
  overflow: hidden;
  background:
    radial-gradient(280px 180px at 100% 0, rgba(99, 102, 241, .28), transparent 65%),
    linear-gradient(145deg, #0b1224, #101c38 62%, #0b2a35);
  border-color: #1e293b;
  color: #fff;
  box-shadow: var(--shadow-md);
}
.process-panel::after {
  content: "";
  position: absolute;
  right: -50px;
  bottom: -80px;
  width: 190px;
  height: 190px;
  border: 1px solid rgba(103, 232, 249, .16);
  border-radius: 50%;
  box-shadow: 0 0 0 34px rgba(103, 232, 249, .03), 0 0 0 68px rgba(103, 232, 249, .02);
  pointer-events: none;
}
.process-orbit {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  margin-bottom: 14px;
  border: 1px solid rgba(103, 232, 249, .25);
  border-radius: 13px;
  background: rgba(8, 145, 178, .16);
  color: #67e8f9;
}
.process-orbit svg { width: 21px; height: 21px; }
.process-panel h2 { position: relative; z-index: 1; font-size: 17px; letter-spacing: -.01em; }
.process-panel > p { position: relative; z-index: 1; min-height: 34px; margin-top: 5px; color: #94a3b8; font-size: 11.5px; line-height: 1.55; }
.process-panel .btn-primary {
  position: relative;
  z-index: 1;
  margin-top: 14px;
  background: linear-gradient(135deg, #6366f1, #4f46e5 55%, #0891b2 150%);
}
.process-panel .btn-primary.is-stop {
  background: linear-gradient(135deg, #f43f5e, #be123c);
  box-shadow: 0 10px 20px -10px rgba(244, 63, 94, .7);
}

.progress-wrap { position: relative; z-index: 1; margin-top: 14px; }
.progress-track {
  height: 7px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(148, 163, 184, .2);
}
.progress-track span {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #6366f1, #22d3ee);
  box-shadow: 0 0 12px rgba(34, 211, 238, .5);
  transition: width .3s ease;
}
.progress-copy {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 7px;
  color: #94a3b8;
  font-size: 10px;
}
.progress-copy span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.progress-copy b { color: #e2e8f0; font-family: var(--mono); font-size: 10px; }

.process-result {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  gap: 9px;
  margin-top: 14px;
  padding: 10px;
  border: 1px solid rgba(16, 185, 129, .25);
  border-radius: 10px;
  background: rgba(16, 185, 129, .1);
}
.result-check {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  flex: none;
  border-radius: 50%;
  background: rgba(16, 185, 129, .2);
  color: #6ee7b7;
}
.result-check svg { width: 14px; height: 14px; }
.process-result > div { display: flex; min-width: 0; flex-direction: column; line-height: 1.35; }
.process-result strong { font-size: 11px; color: #d1fae5; }
.process-result small { color: #94a3b8; font-size: 9.5px; }
.process-result .text-btn { margin-left: auto; color: #67e8f9; white-space: nowrap; font-size: 10px; }
.process-result .text-btn svg { width: 12px; height: 12px; }

/* ---------- Results ------------------------------------------------------ */

.results-panel {
  margin-top: 24px;
  padding: 26px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--card);
  box-shadow: var(--shadow-sm);
  scroll-margin-top: 84px;
}
.results-top {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
}
.results-top h2 { margin-top: 7px; font-size: 23px; font-weight: 800; letter-spacing: -.03em; }
.results-top p { max-width: 650px; margin-top: 5px; color: var(--muted); font-size: 12px; }
.results-actions { display: flex; flex: none; flex-wrap: wrap; gap: 9px; }

.results-banner {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 18px;
  padding: 10px 12px;
  border: 1px solid #bfdbfe;
  border-radius: 10px;
  background: #eff6ff;
  color: #1d4ed8;
  font-size: 11.5px;
}
.results-banner svg { width: 16px; height: 16px; flex: none; }
.results-banner span { min-width: 0; }
.results-banner.is-warn { border-color: #fde68a; background: #fffbeb; color: #b45309; }
.results-banner .text-btn { margin-left: auto; flex: none; color: inherit; font-size: 10.5px; }

.results-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-top: 16px;
}
.filter-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: #f8fafc;
}
.filter-tab {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 6px 10px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  font-size: 11px;
  font-weight: 650;
  cursor: pointer;
  transition: .16s ease;
}
.filter-tab b {
  padding: 1px 5px;
  border-radius: 999px;
  background: #e2e8f0;
  color: #475569;
  font-family: var(--mono);
  font-size: 9px;
  font-weight: 700;
}
.filter-tab:hover { color: var(--ink-2); }
.filter-tab.active {
  background: #fff;
  color: var(--indigo);
  box-shadow: 0 1px 3px rgba(15, 23, 42, .1);
}
.filter-tab.active b { background: var(--indigo-soft); color: var(--indigo); }

.search-box {
  display: flex;
  align-items: center;
  gap: 7px;
  width: min(280px, 100%);
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  transition: border-color .16s ease, box-shadow .16s ease;
}
.search-box:focus-within { border-color: var(--indigo-3); box-shadow: 0 0 0 3px rgba(99, 102, 241, .1); }
.search-box svg { width: 15px; height: 15px; color: var(--muted-2); }
.search-box input {
  width: 100%;
  min-height: 37px;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--ink-2);
  font-size: 11.5px;
  outline: none;
}

.table-shell {
  position: relative;
  margin-top: 12px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 13px;
}
.result-table {
  width: 100%;
  min-width: 900px;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 11.5px;
}
.result-table th {
  position: sticky;
  top: 0;
  z-index: 2;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  background: #f8fafc;
  color: var(--muted);
  font-size: 9.5px;
  font-weight: 750;
  letter-spacing: .04em;
  text-align: left;
  white-space: nowrap;
}
.result-table td {
  padding: 11px 12px;
  border-bottom: 1px solid #f1f5f9;
  vertical-align: middle;
}
.result-table tr:last-child td { border-bottom: 0; }
.result-table tbody tr { transition: background .14s ease; }
.result-table tbody tr:hover { background: #fbfcff; }
.result-table .col-image { width: 70px; }
.result-table .col-origin { width: 25%; }
.result-table .col-game { width: 19%; }
.result-table .col-lang { width: 10%; }
.result-table .col-name { width: 21%; }
.result-table .col-status { width: 12%; }
.result-table .col-action { width: 64px; }

.thumb-btn {
  position: relative;
  width: 50px;
  height: 50px;
  padding: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #f1f5f9;
  cursor: zoom-in;
}
.thumb-btn img { width: 100%; height: 100%; object-fit: cover; display: block; }
.thumb-lang {
  position: absolute;
  right: 2px;
  bottom: 2px;
  padding: 1px 3px;
  border-radius: 3px;
  background: rgba(15, 23, 42, .78);
  color: #fff;
  font-family: var(--mono);
  font-size: 7px;
  font-weight: 800;
  letter-spacing: .02em;
}

.file-cell { display: flex; min-width: 0; flex-direction: column; gap: 2px; }
.file-cell strong {
  display: block;
  max-width: 100%;
  overflow: hidden;
  color: var(--ink-2);
  font-size: 11.5px;
  font-weight: 650;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.file-cell small { color: var(--muted-2); font-size: 9.5px; }
.basis {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  width: fit-content;
  max-width: 100%;
  margin-top: 3px;
  padding: 2px 6px;
  overflow: hidden;
  border-radius: 5px;
  background: var(--indigo-soft);
  color: #4338ca;
  font-size: 8.5px;
  font-weight: 650;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.basis.is-id { background: #ecfeff; color: #0e7490; }
.basis.is-warn { background: #fffbeb; color: #b45309; }
.basis svg { width: 10px; height: 10px; }

.game-cell { display: flex; min-width: 0; flex-direction: column; gap: 2px; }
.game-line { display: flex; align-items: center; gap: 6px; min-width: 0; }
.id-chip {
  flex: none;
  padding: 1px 5px;
  border: 1px solid #c7d2fe;
  border-radius: 4px;
  background: var(--indigo-soft);
  color: var(--indigo);
  font-family: var(--mono);
  font-size: 8.5px;
  font-weight: 800;
}
.game-line strong {
  overflow: hidden;
  font-size: 11.5px;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.game-cell small { color: var(--muted-2); font-size: 9.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.game-cell .candidate-note { color: var(--amber); font-size: 9.5px; }
.game-empty { color: var(--muted-2); font-size: 10.5px; font-style: italic; }

.lang-wrap { display: flex; flex-direction: column; gap: 3px; align-items: flex-start; }
.lang-pill {
  display: inline-flex;
  align-items: center;
  padding: 2px 7px;
  border-radius: 999px;
  font-size: 9.5px;
  font-weight: 700;
  white-space: nowrap;
}
.lang-cn { background: #fef2f2; color: #b91c1c; }
.lang-en { background: #eff6ff; color: #1d4ed8; }
.lang-tw { background: #fdf4ff; color: #a21caf; }
.lang-ja { background: #fff7ed; color: #c2410c; }
.lang-ko { background: #f0fdf4; color: #15803d; }
.lang-other { background: var(--slate-soft); color: #475569; }
.lang-unknown { background: var(--slate-soft); color: var(--muted-2); }
.lang-wrap small { max-width: 100px; overflow: hidden; color: var(--muted-2); font-size: 8.5px; text-overflow: ellipsis; white-space: nowrap; }

.target-cell { display: flex; min-width: 0; flex-direction: column; gap: 3px; }
.target-input {
  width: 100%;
  min-height: 30px;
  padding: 5px 7px;
  border: 1px solid transparent;
  border-radius: 6px;
  background: #f8fafc;
  color: var(--ink-2);
  font-family: var(--mono);
  font-size: 10.5px;
  outline: none;
  transition: .16s ease;
}
.target-input:hover { border-color: var(--line); background: #fff; }
.target-input:focus { border-color: var(--indigo-3); background: #fff; box-shadow: 0 0 0 3px rgba(99, 102, 241, .1); }
.target-input::placeholder { color: var(--muted-2); font-family: var(--font); }
.target-input:disabled { color: var(--muted-2); background: #f8fafc; }
.target-note {
  overflow: hidden;
  color: var(--muted-2);
  font-size: 8.5px;
  line-height: 1.4;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.target-note.is-warn { color: var(--amber); }
.target-note.is-bad { color: var(--red); }

.status-wrap { display: flex; flex-direction: column; align-items: flex-start; gap: 3px; }
.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 7px;
  border-radius: 999px;
  font-size: 9.5px;
  font-weight: 700;
  white-space: nowrap;
}
.status-pill svg { width: 10px; height: 10px; }
.status-ready { background: var(--green-soft); color: var(--green); }
.status-review { background: var(--amber-soft); color: var(--amber); }
.status-duplicate { background: var(--violet-soft); color: var(--violet); }
.status-conflict { background: var(--red-soft); color: var(--red); }
.status-wrap small { max-width: 130px; overflow: hidden; color: var(--muted-2); font-size: 8.5px; line-height: 1.4; text-overflow: ellipsis; white-space: nowrap; }

.row-actions { display: flex; align-items: center; gap: 1px; }
.row-actions .icon-btn { width: 28px; height: 28px; border-radius: 7px; }
.row-actions .icon-btn svg { width: 14px; height: 14px; }
.row-actions .text-btn { font-size: 9.5px; white-space: nowrap; }

.empty-state {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 5px;
  padding: 44px 20px;
  text-align: center;
}
.empty-state > span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  margin-bottom: 4px;
  border-radius: 50%;
  background: var(--slate-soft);
  color: var(--muted-2);
}
.empty-state strong { font-size: 12.5px; }
.empty-state p { color: var(--muted-2); font-size: 10.5px; }

.results-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-top: 12px;
  color: var(--muted);
  font-size: 10.5px;
}
.pager { display: flex; align-items: center; gap: 8px; }
.pager span { min-width: 50px; text-align: center; font-family: var(--mono); font-size: 10px; }
.page-size { display: flex; align-items: center; gap: 5px; font-size: 10.5px; color: var(--muted); }.page-size select {
  font-family: var(--mono);
  font-size: 10.5px;
  padding: 4px 6px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--surface, #fff);
  color: var(--ink, #111);
  cursor: pointer;
}

/* ---------- Rules & footer ---------------------------------------------- */

.rules-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-top: 26px;
}
.rule-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255, 255, 255, .66);
}
.rule-item > span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  flex: none;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--indigo);
  font-family: var(--mono);
  font-size: 9px;
  font-weight: 800;
}
.rule-item strong { display: block; font-size: 11.5px; }
.rule-item p { margin-top: 3px; color: var(--muted); font-size: 10px; line-height: 1.6; }

.footer {
  border-top: 1px solid var(--line);
  background: rgba(255, 255, 255, .55);
}
.footer-inner {
  display: flex;
  align-items: center;
  gap: 14px;
  max-width: 1280px;
  margin: 0 auto;
  padding: 18px 26px;
  color: var(--muted);
  font-size: 10.5px;
}
.footer-inner > span { display: inline-flex; align-items: center; gap: 7px; color: var(--ink-3); font-weight: 700; }
.footer-inner p { margin: 0 auto 0 0; color: var(--muted-2); }
.footer-inner .text-btn { font-size: 10.5px; }

/* ---------- Toast -------------------------------------------------------- */

.toast-stack {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 100;
  display: flex;
  width: min(360px, calc(100vw - 36px));
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}
.toast {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  padding: 11px 13px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: #fff;
  color: var(--ink-2);
  box-shadow: var(--shadow-md);
  font-size: 11.5px;
  line-height: 1.5;
  pointer-events: auto;
  animation: toastIn .25s cubic-bezier(.2, .8, .2, 1) both;
}
.toast svg { width: 16px; height: 16px; margin-top: 1px; flex: none; }
.toast.toast-success { border-color: #bbf7d0; }
.toast.toast-success svg { color: var(--green); }
.toast.toast-error { border-color: #fecaca; }
.toast.toast-error svg { color: var(--red); }
.toast.toast-info { border-color: #bae6fd; }
.toast.toast-info svg { color: var(--cyan); }
.toast.is-out { animation: toastOut .22s ease forwards; }
@keyframes toastIn { from { opacity: 0; transform: translateY(8px) scale(.98); } to { opacity: 1; transform: none; } }
@keyframes toastOut { to { opacity: 0; transform: translateY(5px); } }

/* ---------- Modal -------------------------------------------------------- */

.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(2, 6, 23, .55);
  backdrop-filter: blur(6px);
  animation: fadeIn .18s ease both;
}
.modal-overlay[hidden] { display: none; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.modal {
  display: flex;
  width: min(900px, 100%);
  max-height: min(88vh, 860px);
  flex-direction: column;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, .5);
  border-radius: 20px;
  background: #fff;
  box-shadow: var(--shadow-lg);
  animation: modalIn .22s cubic-bezier(.2, .8, .2, 1) both;
}
@keyframes modalIn { from { opacity: 0; transform: translateY(12px) scale(.985); } to { opacity: 1; transform: none; } }
.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 17px 20px;
  border-bottom: 1px solid var(--line);
}
.modal-head h2 { font-size: 16px; font-weight: 750; letter-spacing: -.01em; }
.modal-body { overflow: auto; padding: 20px; }
.modal-body h3 { margin: 20px 0 7px; font-size: 13px; font-weight: 750; }
.modal-body h3:first-child { margin-top: 0; }
.modal-body p { color: var(--ink-3); font-size: 12px; line-height: 1.75; }
.modal-body ul,
.modal-body ol { margin: 7px 0 0; padding-left: 20px; color: var(--ink-3); font-size: 12px; line-height: 1.8; }
.modal-body li { margin: 3px 0; }
.modal-body code {
  padding: 1px 5px;
  border-radius: 4px;
  background: #f1f5f9;
  color: #4338ca;
  font-family: var(--mono);
  font-size: 10.5px;
}
.modal-body table { width: 100%; margin-top: 8px; border-collapse: collapse; font-size: 11.5px; }
.modal-body th,
.modal-body td { padding: 7px 9px; border: 1px solid var(--line); text-align: left; vertical-align: top; }
.modal-body th { background: #f8fafc; color: var(--muted); font-size: 10px; }
.modal-body .note-box {
  margin-top: 12px;
  padding: 10px 12px;
  border: 1px solid #fde68a;
  border-radius: 9px;
  background: #fffbeb;
  color: #92400e;
  font-size: 11px;
  line-height: 1.65;
}
.modal-body .note-box.blue { border-color: #bfdbfe; background: #eff6ff; color: #1e40af; }

/* Detail / editor modal */
.detail-grid {
  display: grid;
  grid-template-columns: minmax(240px, .85fr) minmax(0, 1.15fr);
  gap: 20px;
}
.detail-image {
  position: relative;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 13px;
  background:
    linear-gradient(45deg, #f1f5f9 25%, transparent 25%) 0 0 / 16px 16px,
    linear-gradient(45deg, transparent 75%, #f1f5f9 75%) 0 0 / 16px 16px,
    #fafcff;
}
.detail-image img { display: block; width: 100%; max-height: 380px; object-fit: contain; }
.detail-info { min-width: 0; }
.detail-info h3 { margin: 0 0 2px; font-size: 14px; word-break: break-all; }
.detail-info .muted { color: var(--muted-2); font-size: 10.5px; }
.detail-list { display: grid; grid-template-columns: 78px minmax(0, 1fr); gap: 5px 10px; margin-top: 12px; font-size: 11px; }
.detail-list dt { color: var(--muted-2); }
.detail-list dd { margin: 0; word-break: break-word; }
.ocr-box {
  margin-top: 12px;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #f8fafc;
}
.ocr-box label { display: block; color: var(--muted-2); font-size: 9.5px; font-weight: 700; letter-spacing: .04em; }
.ocr-box pre {
  max-height: 130px;
  margin: 5px 0 0;
  overflow: auto;
  color: var(--ink-3);
  font-family: var(--mono);
  font-size: 10px;
  line-height: 1.55;
  white-space: pre-wrap;
  word-break: break-word;
}
.detail-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }

.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 11px; }
.form-field { display: flex; min-width: 0; flex-direction: column; gap: 5px; }
.form-field.full { grid-column: 1 / -1; }
.form-field label { color: var(--muted); font-size: 10.5px; font-weight: 650; }
.form-field select,
.form-field input {
  width: 100%;
  min-height: 37px;
  padding: 8px 9px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: #fff;
  color: var(--ink-2);
  font-size: 11.5px;
  outline: none;
}
.form-field input { font-family: var(--mono); }
.form-field select:focus,
.form-field input:focus { border-color: var(--indigo-3); box-shadow: 0 0 0 3px rgba(99, 102, 241, .1); }
.form-hint { color: var(--muted-2); font-size: 9.5px; line-height: 1.5; }
.candidate-list { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.candidate-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 6px 9px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
  color: var(--ink-3);
  font-size: 10px;
  cursor: pointer;
  transition: .15s ease;
}
.candidate-btn:hover { border-color: #c7d2fe; background: var(--indigo-soft); color: var(--indigo); }
.candidate-btn b { color: var(--indigo); font-family: var(--mono); font-size: 9px; }
.editor-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}
.editor-actions .left { margin-right: auto; }

/* Help modal helpers */
.help-steps { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-top: 10px; }
.help-step { padding: 10px; border: 1px solid var(--line); border-radius: 9px; background: #fbfcff; }
.help-step b { display: block; color: var(--indigo); font-family: var(--mono); font-size: 9px; }
.help-step strong { display: block; margin-top: 3px; font-size: 11px; }
.help-step small { display: block; margin-top: 2px; color: var(--muted); font-size: 9.5px; line-height: 1.5; }

/* ---------- Responsive --------------------------------------------------- */

@media (max-width: 1120px) {
  .stats { grid-template-columns: repeat(3, minmax(0, 1fr)); margin-top: -38px; }
  .stat-card:nth-child(4),
  .stat-card:nth-child(5) { grid-column: span 1; }
  .workspace { grid-template-columns: 1fr; }
  .control-column { position: static; display: grid; grid-template-columns: 1fr 1fr; }
  .hero { grid-template-columns: 1fr 320px; padding: 46px 42px 74px; }
  .hero h1 { font-size: clamp(34px, 4.6vw, 46px); }
  .rules-strip { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 900px) {
  .page { padding: 20px 18px 52px; }
  .topbar-inner { padding: 0 18px; }
  .hero { grid-template-columns: 1fr; padding: 40px 34px 76px; }
  .hero-visual { display: none; }
  .hero h1 { font-size: clamp(32px, 6vw, 44px); }
  .hero-lead { max-width: 640px; }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); margin: -38px 10px 0; }
  .stat-card:nth-child(5) { grid-column: span 2; }
  .results-top { align-items: flex-start; flex-direction: column; }
  .results-actions { width: 100%; }
  .results-actions .btn { flex: 1; }
  .results-toolbar { align-items: stretch; flex-direction: column; }
  .search-box { width: 100%; }
  .filter-tabs { overflow-x: auto; flex-wrap: nowrap; }
  .filter-tab { flex: none; }
  .detail-grid { grid-template-columns: 1fr; }
  .detail-image img { max-height: 260px; }
  .help-steps { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 720px) {
  .privacy-chip { display: none; }
  .hero { padding: 33px 24px 72px; border-radius: 24px; }
  .hero-actions { flex-direction: column; align-items: stretch; }
  .hero-actions .btn { width: 100%; }
  .flow-line { gap: 7px; overflow-x: auto; padding-bottom: 2px; }
  .flow-line i { width: 12px; }
  .stats { margin-top: -34px; }
  .stat-card { padding: 12px; }
  .stat-icon { width: 34px; height: 34px; }
  .stat-card strong { font-size: 20px; }
  .stat-note { display: none; }
  .panel { padding: 18px; }
  .upload-gallery { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .format-pills { display: none; }
  .drop-badge { display: none; }
  .control-column { grid-template-columns: 1fr; }
  .results-panel { padding: 18px; }
  .results-foot { align-items: flex-start; flex-direction: column; }
  .pager { width: 100%; justify-content: space-between; }
  .footer-inner { flex-wrap: wrap; padding: 16px 18px; }
  .footer-inner p { width: 100%; order: 3; }
  .form-grid { grid-template-columns: 1fr; }
  .modal-overlay { padding: 12px; }
  .modal { max-height: 92vh; }
  .modal-head { padding: 14px 16px; }
  .modal-body { padding: 16px; }
  .rules-strip { grid-template-columns: 1fr; }
}

@media (max-width: 480px) {
  .page { padding: 14px 12px 44px; }
  .topbar-inner { height: 58px; padding: 0 13px; }
  .brand-copy small { display: none; }
  .topbar-actions .btn { padding: 7px 9px; }
  .topbar-actions .btn span { display: none; }
  .hero { padding: 28px 18px 68px; }
  .hero h1 { font-size: 31px; }
  .hero-lead { font-size: 13px; }
  .stats { gap: 8px; margin-left: 4px; margin-right: 4px; }
  .stat-card { gap: 8px; padding: 10px; }
  .stat-icon { width: 30px; height: 30px; border-radius: 8px; }
  .stat-icon svg { width: 15px; height: 15px; }
  .stat-card strong { font-size: 18px; }
  .stat-card small { font-size: 9px; }
  .panel { padding: 15px; border-radius: 17px; }
  .dropzone { padding: 17px 13px; }
  .drop-icon { width: 38px; height: 38px; }
  .drop-copy strong { font-size: 12px; }
  .drop-copy small { font-size: 10px; }
  .upload-gallery { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .panel-foot { gap: 10px; }
  .filter-tab { padding: 6px 8px; font-size: 10px; }
  .results-top h2 { font-size: 19px; }
  .results-actions { flex-direction: column; }
  .results-actions .btn { width: 100%; }
  .help-steps { grid-template-columns: 1fr; }
}

/* hidden 属性优先级修正 */
[hidden] { display: none !important; }

/* ---------- 视觉 AI 设置 ---------- */
.ai-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 10px 0; }
.ai-grid label { display: flex; flex-direction: column; gap: 4px; font-size: 11px; color: var(--muted); }
.ai-grid label.full { grid-column: 1 / -1; }
.ai-grid input {
  font-family: var(--mono); font-size: 11.5px; padding: 7px 9px;
  border: 1px solid var(--line); border-radius: 9px; background: var(--surface, #fff); color: var(--ink, #111);
}
.ai-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

/* AI 复核设置 */
.setting-block input[type=""password""] {
  width: 100%;
  padding: 9px 10px;
  border: 1px solid var(--line-strong);
  border-radius: 9px;
  background: #fff;
  color: var(--ink-2);
  font-size: 12px;
  outline: none;
  margin-bottom: 8px;
}
.setting-block input[type=""password""]:focus { border-color: var(--indigo-3); }
.ai-block input[type=""text""] { margin-bottom: 8px; }
.ai-actions { display: flex; gap: 8px; flex-wrap: wrap; margin: 2px 0 8px; }
