/* ── Mini Art Salon · v2 ──────────────────────────────────────────────────────
   A clean, dark, OpenRouter-flavored design system shared by index.html,
   gallery.html, and piece.html. Type is Inter; numbers are tabular monospace.
   Everything is anonymous — no piece titles, no outside source links. */

:root {
  --bg:          #f7f7f8;
  --bg-soft:     #ffffff;
  --panel:       #ffffff;
  --panel-2:     #f1f1f4;
  --panel-hover: #ececef;
  --border:      rgba(13,13,18,.10);
  --border-2:    rgba(13,13,18,.16);

  --text:        #18181d;
  --text-dim:    #56565f;
  --text-faint:  #8a8a94;

  --accent:      #6d5efc;
  --accent-2:    #3d8bff;
  --accent-soft: rgba(109,94,252,.08);
  --accent-line: rgba(109,94,252,.24);
  --good:        #14b87f;
  --warn:        #e0a400;
  --bad:         #e0483f;

  --radius:      16px;
  --radius-sm:   10px;
  --mono:        ui-monospace, "SF Mono", "JetBrains Mono", "Cascadia Code", Menlo, Consolas, monospace;
  --sans:        "Inter", -apple-system, "Segoe UI", system-ui, sans-serif;
  --shadow:      0 1px 2px rgba(13,13,18,.04), 0 10px 30px rgba(13,13,18,.06);
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  font-family: var(--sans);
  color: var(--text);
  background: var(--bg);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  /* soft violet glow up top, like the OpenRouter hero */
  background-image:
    radial-gradient(900px 520px at 50% -8%, rgba(109,94,252,.10), transparent 60%),
    radial-gradient(700px 460px at 88% 4%, rgba(61,139,255,.07), transparent 55%);
  background-repeat: no-repeat;
  min-height: 100vh;
}

a { color: var(--accent); text-decoration: none; }
a:hover { color: #a99dff; }

.wrap { max-width: 920px; margin: 0 auto; padding: 0 22px; }
.wrap.narrow { max-width: 680px; }

/* ── top nav ────────────────────────────────────────────────────────────── */
.nav {
  display: flex; align-items: center; justify-content: space-between;
  padding: 22px 0 14px; gap: 16px;
}
.brand { display: flex; align-items: center; gap: 11px; font-weight: 650;
  letter-spacing: -.01em; color: var(--text); font-size: 16px; }
.brand:hover { color: var(--text); }
.brand .dot {
  width: 26px; height: 26px; border-radius: 8px; flex: 0 0 auto;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  box-shadow: 0 0 0 1px var(--border-2), 0 6px 18px rgba(139,124,255,.35);
  position: relative;
}
.brand .dot::after {
  content: ""; position: absolute; inset: 7px;
  border-radius: 4px; background: rgba(255,255,255,.7);
}
.nav-links { display: flex; gap: 6px; align-items: center; }
.nav-links a {
  color: var(--text-dim); font-size: 14px; font-weight: 500;
  padding: 7px 12px; border-radius: 9px;
}
.nav-links a:hover { color: var(--text); background: var(--panel); }
.nav-links a.active { color: var(--text); background: var(--panel); }

/* ── hero ───────────────────────────────────────────────────────────────── */
.hero { text-align: center; padding: 40px 0 30px; }
.pill {
  display: inline-flex; align-items: center; gap: 8px;
  font-size: 12.5px; color: var(--text-dim); font-weight: 500;
  padding: 6px 13px; border: 1px solid var(--border);
  border-radius: 999px; background: rgba(255,255,255,.02);
  margin-bottom: 22px;
}
.pill .blink { width: 7px; height: 7px; border-radius: 50%; background: var(--good);
  box-shadow: 0 0 0 4px rgba(70,211,154,.18); }
h1 {
  font-size: clamp(30px, 5vw, 46px); line-height: 1.07; margin: 0 0 16px;
  letter-spacing: -.025em; font-weight: 680;
  background: linear-gradient(180deg, #18181d, #44444f);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.lede { font-size: 17px; color: var(--text-dim); max-width: 560px;
  margin: 0 auto; }
.page-title { font-size: 28px; letter-spacing: -.02em; margin: 6px 0 6px; }
.page-sub { color: var(--text-dim); margin: 0 0 26px; }

/* ── cards / panels ─────────────────────────────────────────────────────── */
.panel {
  background: linear-gradient(180deg, var(--panel), var(--bg-soft));
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 24px;
}
.panel + .panel { margin-top: 18px; }

/* ── form / dropzone ────────────────────────────────────────────────────── */
.label { display: block; font-size: 13px; font-weight: 600; color: var(--text-dim);
  margin: 0 0 9px; }

.drop {
  display: block;
  border: 1.5px dashed var(--border-2); border-radius: var(--radius-sm);
  padding: 34px 20px; text-align: center; cursor: pointer;
  transition: border-color .15s, background .15s; background: rgba(255,255,255,.015);
}
.drop:hover, .drop.over { border-color: var(--accent-line); background: var(--accent-soft); }
.drop .ico { font-size: 30px; opacity: .85; }
.drop .big { font-weight: 600; margin: 8px 0 3px; color: var(--text); }
.drop .small { font-size: 13px; color: var(--text-faint); }
.drop.has-image { padding: 16px; }
#preview { max-width: 100%; max-height: 260px; border-radius: 8px; display: none;
  margin: 0 auto; box-shadow: 0 8px 28px rgba(0,0,0,.4); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 9px;
  width: 100%; margin-top: 18px; cursor: pointer;
  font-family: var(--sans); font-size: 15.5px; font-weight: 600; color: #fff;
  padding: 14px 22px; border: 0; border-radius: 12px;
  background: linear-gradient(135deg, var(--accent), #6f78ff);
  box-shadow: 0 8px 24px rgba(139,124,255,.32), 0 1px 0 rgba(255,255,255,.18) inset;
  transition: transform .08s, box-shadow .15s, opacity .15s;
}
.btn:hover:not(:disabled) { transform: translateY(-1px); box-shadow: 0 12px 30px rgba(139,124,255,.42); }
.btn:active:not(:disabled) { transform: translateY(0); }
.btn:disabled { opacity: .42; cursor: default; box-shadow: none; }
.btn.ghost {
  width: auto; margin: 0; background: var(--panel-2); color: var(--text);
  box-shadow: 0 0 0 1px var(--border) inset; font-size: 14px; padding: 9px 16px;
}
.btn.ghost:hover:not(:disabled) { background: var(--panel-hover); transform: none; box-shadow: 0 0 0 1px var(--border-2) inset; }
.btn.ghost:disabled { opacity: .35; }

.status { color: var(--text-dim); font-size: 14px; margin: 12px 0 0; }
.err { color: var(--bad); }
.muted { color: var(--text-faint); font-size: 13px; }
.hidden { display: none !important; }

/* ── progress ───────────────────────────────────────────────────────────── */
.progress { text-align: center; padding: 38px 22px; }
.spinner {
  width: 34px; height: 34px; margin: 0 auto 18px; border-radius: 50%;
  border: 3px solid var(--border-2); border-top-color: var(--accent);
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.progress .msg { font-size: 16px; color: var(--text); font-weight: 500; }
.progress .sub { color: var(--text-faint); font-size: 13.5px; margin-top: 6px; }
.track { height: 6px; border-radius: 4px; background: var(--panel-2); margin: 20px auto 0;
  max-width: 320px; overflow: hidden; }
.track > i { display: block; height: 100%; border-radius: 4px;
  background: linear-gradient(90deg, var(--accent), var(--accent-2)); transition: width .4s; }

/* ── result hero ────────────────────────────────────────────────────────── */
.result-hero { display: flex; gap: 24px; flex-wrap: wrap; align-items: flex-start; }
.result-hero .art {
  width: 220px; max-width: 100%; border-radius: 12px; cursor: zoom-in;
  box-shadow: 0 10px 34px rgba(0,0,0,.5); object-fit: cover;
}
.result-hero .body { flex: 1 1 280px; min-width: 0; }
.score {
  font-family: var(--mono); font-size: 76px; line-height: .95; font-weight: 600;
  letter-spacing: -.03em;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.score sup { font-size: 26px; -webkit-text-fill-color: var(--text-dim); top: -.7em; }
.score-label { color: var(--text-dim); font-size: 14px; margin-top: 4px; }
.headline { font-size: 19px; font-weight: 600; margin: 0 0 4px; letter-spacing: -.01em; }
.subline { color: var(--text-faint); font-size: 13px; }

/* gradient percentile meter */
.meter { height: 10px; border-radius: 6px; position: relative; margin: 18px 0 8px;
  background: var(--panel-2); overflow: visible; }
.meter .grad { position: absolute; inset: 0; border-radius: 6px; opacity: .9;
  background: linear-gradient(90deg, #ff7a7a, #f6c454, #46d39a); }
.meter .mark { position: absolute; top: -5px; bottom: -5px; width: 4px; border-radius: 3px;
  background: #18181d; box-shadow: 0 0 0 2px #fff, 0 1px 6px rgba(13,13,18,.35); }

.feedback {
  background: var(--accent-soft); border: 1px solid var(--accent-line);
  border-radius: var(--radius-sm); padding: 15px 18px; margin: 20px 0; font-size: 14.5px;
}
.feedback b { color: #cfc7ff; }

/* ── stat row ───────────────────────────────────────────────────────────── */
.stats { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 14px; }
.stat { background: var(--panel-2); border: 1px solid var(--border); border-radius: 10px;
  padding: 9px 14px; }
.stat .k { font-size: 11px; color: var(--text-faint); text-transform: uppercase;
  letter-spacing: .06em; }
.stat .v { font-family: var(--mono); font-size: 17px; font-weight: 600; color: var(--text); }

/* ── comparison list (rounds) ───────────────────────────────────────────── */
.section-h { font-size: 17px; margin: 26px 0 4px; letter-spacing: -.01em; }
.cmp-list { margin-top: 12px; border-top: 1px solid var(--border); }
.cmp-entry { border-bottom: 1px solid var(--border); }
.cmp-row { display: flex; align-items: center; justify-content: space-between; gap: 14px;
  padding: 11px 2px 4px; font-size: 13.5px; }
.cmp-rationale { padding: 1px 2px 11px; font-size: 13px; line-height: 1.5;
  color: var(--text-dim); font-style: italic; }
.cmp-row .info { color: var(--text-dim); flex: 1 1 auto; min-width: 0; }
.cmp-row .info b { color: var(--text); font-variant-numeric: tabular-nums; }
.cmp-row .na { color: var(--bad); font-weight: 600; }
.cmp-row a { white-space: nowrap; font-weight: 500; }

/* ── gallery grid ───────────────────────────────────────────────────────── */
.toolbar { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.range-wrap { position: relative; height: 34px; margin: 6px 6px 2px; flex: 1 1 260px; }
.range-wrap input[type=range] { position: absolute; left: 0; top: 8px; width: 100%;
  margin: 0; background: none; pointer-events: none; -webkit-appearance: none; appearance: none; }
.range-wrap input[type=range]::-webkit-slider-thumb { -webkit-appearance: none; appearance: none;
  pointer-events: auto; height: 18px; width: 18px; border-radius: 50%;
  background: var(--accent); border: 2px solid #fff; box-shadow: 0 0 0 1px var(--border-2); cursor: pointer; }
.range-wrap input[type=range]::-moz-range-thumb { pointer-events: auto; height: 16px; width: 16px;
  border-radius: 50%; background: var(--accent); border: 2px solid #fff; cursor: pointer; }
.range-track { position: absolute; left: 0; right: 0; top: 15px; height: 5px; border-radius: 3px; background: var(--panel-2); }
.range-fill { position: absolute; top: 15px; height: 5px; border-radius: 3px;
  background: linear-gradient(90deg, var(--accent), var(--accent-2)); opacity: .8; }
.range-readout { font-size: 13.5px; color: var(--text-dim); font-weight: 500; }
.range-readout b { font-family: var(--mono); color: var(--text); }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 14px; margin-top: 18px; }
.tile {
  background: var(--panel); border: 1px solid var(--border); border-radius: 14px;
  overflow: hidden; transition: transform .12s, border-color .12s, box-shadow .12s;
}
.tile:hover { transform: translateY(-3px); border-color: var(--border-2);
  box-shadow: 0 12px 30px rgba(0,0,0,.45); }
.tile .thumb { width: 100%; aspect-ratio: 1/1; object-fit: cover; display: block;
  background: var(--panel-2); cursor: zoom-in; }
.tile .info { padding: 12px 13px 13px; }
.tile .rank-badge { font-size: 12px; color: var(--text-faint); }
.tile .pctl { font-family: var(--mono); font-size: 22px; font-weight: 600; color: var(--text);
  letter-spacing: -.02em; }
.tile .pctl sup { font-size: 12px; color: var(--text-faint); }
.tile .links { margin-top: 8px; display: flex; justify-content: space-between; align-items: center; }
.tile .links a { font-size: 12.5px; font-weight: 500; }

.pageinfo { color: var(--text-faint); font-size: 13px; }

/* ── piece page hero ────────────────────────────────────────────────────── */
.crumb { font-size: 13px; margin: 4px 0 18px; color: var(--text-faint); }

/* ── shared modal / lightbox / range bar (used by app.js) ───────────────── */
.zoomable { cursor: zoom-in; }

.sb-rng { display: flex; align-items: center; gap: 9px; flex: 0 0 auto; }
.sb-range-txt { font-family: var(--mono); font-size: 12px; color: var(--text-dim);
  min-width: 44px; text-align: right; }
.sb-pbar { position: relative; height: 9px; width: 108px; border-radius: 5px;
  background: var(--panel-2); flex: 0 0 auto; }
.sb-pbar .band { position: absolute; top: 0; bottom: 0; border-radius: 5px;
  background: linear-gradient(90deg, var(--warn), var(--good)); opacity: .65; }
.sb-pbar .you { position: absolute; top: -3px; bottom: -3px; width: 3px; border-radius: 2px;
  background: #18181d; box-shadow: 0 0 0 1.5px #fff; }

.sb-overlay { position: fixed; inset: 0; background: rgba(18,18,26,.42); z-index: 1100;
  display: none; align-items: flex-start; justify-content: center; padding: 34px 16px;
  overflow: auto; backdrop-filter: blur(4px); }
.sb-overlay.open { display: flex; }
.sb-box { background: var(--panel); border: 1px solid var(--border-2);
  border-radius: 16px; max-width: 720px; width: 100%; padding: 24px 26px;
  box-shadow: 0 24px 70px rgba(0,0,0,.6); }
.sb-box .sb-h2 { margin: 0 0 2px; font-size: 20px; letter-spacing: -.01em; }
.sb-box .close { float: right; background: none; border: 0; font-size: 26px; cursor: pointer;
  color: var(--text-faint); line-height: 1; }
.sb-box .close:hover { color: var(--text); }
.sb-muted { color: var(--text-faint); font-size: 13px; }
.sb-err { color: var(--bad); }
.sb-overall { background: var(--accent-soft); border: 1px solid var(--accent-line);
  border-radius: 10px; padding: 13px 16px; margin: 13px 0 18px; font-size: 14px; }
.sb-overall b { color: #cfc7ff; }
.sb-mem { display: flex; gap: 14px; border: 1px solid var(--border); border-radius: 12px;
  padding: 12px; margin-bottom: 10px; background: var(--bg-soft); }
.sb-mem img { width: 104px; height: 104px; object-fit: cover; border-radius: 8px;
  background: var(--panel-2); flex: 0 0 auto; cursor: zoom-in; }
.sb-mem .rk { font-size: 13px; color: var(--text-dim); }
.sb-mem .rk b { font-size: 15px; color: var(--text); }
.sb-mem .rat { font-size: 13px; color: var(--text-dim); font-style: italic; margin-top: 5px; }
.sb-mem.winner { box-shadow: inset 0 0 0 1.5px var(--accent-line); }
.sb-mem.current, .sb-mem.candidate { background: var(--accent-soft); }
.sb-tag { color: var(--accent); font-weight: 600; }

.sb-lightbox { position: fixed; inset: 0; background: rgba(2,2,4,.92); z-index: 2000;
  display: none; align-items: center; justify-content: center; flex-direction: column;
  padding: 24px; backdrop-filter: blur(6px); }
.sb-lightbox.open { display: flex; }
.sb-lightbox img { max-width: 90vw; max-height: 78vh; border-radius: 10px;
  box-shadow: 0 16px 60px rgba(0,0,0,.7); object-fit: contain; }
.sb-lightbox .cap { color: #d4d4dc; max-width: 640px; margin-top: 18px;
  text-align: center; font-size: 14.5px; line-height: 1.55; }
.sb-lightbox .cap b { color: #fff; }
.sb-lightbox .cap .pct { color: #b3a8ff; font-weight: 600; font-family: var(--mono); }
.sb-lightbox .cap .rat { font-style: italic; color: #c2c2cc; margin-top: 8px; }
.sb-lightbox .close { position: absolute; top: 16px; right: 24px; color: #fff;
  font-size: 36px; line-height: 1; cursor: pointer; opacity: .8; }
.sb-lightbox .close:hover { opacity: 1; }

/* ── footer ─────────────────────────────────────────────────────────────── */
.foot { text-align: center; color: var(--text-faint); font-size: 13px;
  padding: 40px 0 50px; }
.foot a { color: var(--text-dim); }

@media (max-width: 560px) {
  .score { font-size: 60px; }
  .result-hero .art { width: 100%; }

  /* Stack each round: the label gets its own line, then the range bar +
     "details" link share the line below it (avoids the cramped wrap). */
  .cmp-row { flex-wrap: wrap; row-gap: 8px; padding-bottom: 8px; }
  .cmp-row .info { flex: 1 1 100%; }
  .sb-rng { flex: 1 1 auto; }
  .sb-pbar { flex: 1 1 auto; width: auto; }
}
