:root {
  --bg: #fdf6ec;
  --surface: #ffffff;
  --ink: #2b2118;
  --muted: #7a6a5c;
  --line: #eadfce;
  --accent: #e8483b;
  --accent-ink: #ffffff;
  --good: #2f9e5b;
  --bad: #d64545;
  --vintage: #b7791f;
  --modern: #7c4ddb;
  --promo: #2b7bd6;
  --shadow: 0 12px 34px rgba(80, 50, 20, .14);
  --radius: 16px;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #1b1714;
    --surface: #26211d;
    --ink: #f4ece2;
    --muted: #a89888;
    --line: #3a322b;
    --vintage: #e0a44a;
    --modern: #a487f0;
    --promo: #6aa8ee;
    --shadow: 0 12px 34px rgba(0, 0, 0, .45);
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.5 Inter, system-ui, sans-serif;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
}
button { font: inherit; color: inherit; cursor: pointer; }
h1, h2, .logo, .mode-title, .btn, .price-display, .vs, .duel-q, .hud, .verdict { font-family: Fredoka, system-ui, sans-serif; }
[hidden] { display: none !important; }

/* Top bar */
.topbar {
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
  padding: 14px 24px; max-width: 1320px; width: 100%; margin: 0 auto;
}
.logo { background: none; border: 0; font-size: 26px; font-weight: 700; padding: 0; text-decoration: none; color: inherit; }
.logo span { color: var(--accent); }
.nav { display: flex; align-items: center; gap: 18px; }
.nav a { color: var(--muted); font-weight: 600; font-size: 14px; text-decoration: none; }
.nav a:hover { color: var(--accent); }
.currency { display: flex; background: var(--surface); border: 1px solid var(--line); border-radius: 999px; padding: 3px; }
.currency button { border: 0; background: none; padding: 6px 12px; border-radius: 999px; font-size: 13px; font-weight: 600; color: var(--muted); }
.currency button.on { background: var(--ink); color: var(--bg); }

main { flex: 1; width: 100%; max-width: 1320px; margin: 0 auto; padding: 8px 24px 32px; }
footer { text-align: center; color: var(--muted); font-size: 12px; padding: 12px 16px 18px; }

/* Home */
.hero { display: grid; grid-template-columns: 1.1fr 1fr; gap: 40px; align-items: center; min-height: calc(100vh - 330px); }
h1 { font-size: clamp(34px, 5vw, 60px); margin: 0 0 12px; line-height: 1.05; }
.lede { color: var(--muted); margin: 0 0 32px; font-size: 18px; }
.modes { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.mode {
  display: flex; flex-direction: column; align-items: flex-start; gap: 6px; text-align: left;
  background: var(--surface); border: 2px solid var(--line); border-radius: var(--radius);
  padding: 22px; box-shadow: var(--shadow); transition: transform .15s, border-color .15s;
}
.mode:hover { transform: translateY(-4px); border-color: var(--accent); }
.mode-emoji { font-size: 36px; }
.mode-title { font-size: 22px; font-weight: 600; }
.mode-desc { color: var(--muted); font-size: 14px; }
.mode-best { font-size: 13px; font-weight: 600; color: var(--accent); min-height: 1.5em; }

.fan { position: relative; height: min(56vh, 520px); }
.fan img {
  position: absolute; top: 50%; left: 50%; height: 88%; aspect-ratio: 600 / 825;
  border-radius: 4.5% / 3.3%; box-shadow: var(--shadow); transition: transform .3s;
}
.fan img:nth-child(1) { transform: translate(-95%, -50%) rotate(-12deg); }
.fan img:nth-child(2) { transform: translate(-50%, -54%); z-index: 1; }
.fan img:nth-child(3) { transform: translate(-5%, -50%) rotate(12deg); }
.fan:hover img:nth-child(1) { transform: translate(-110%, -50%) rotate(-16deg); }
.fan:hover img:nth-child(3) { transform: translate(10%, -50%) rotate(16deg); }

.strip { margin: 28px -24px 0; overflow: hidden; mask-image: linear-gradient(90deg, transparent, #000 8%, #000 92%, transparent); }
.strip-track { display: flex; gap: 14px; width: max-content; animation: scroll 80s linear infinite; }
.strip img { height: 150px; aspect-ratio: 600 / 825; border-radius: 6px; box-shadow: 0 4px 12px rgba(0, 0, 0, .15); }
@keyframes scroll { to { transform: translateX(-50%); } }
@media (prefers-reduced-motion: reduce) { .strip-track { animation: none; } }

/* Shared */
.hud { display: flex; justify-content: space-between; align-items: center; gap: 12px; font-size: 20px; font-weight: 600; margin-bottom: 18px; color: var(--muted); }
.hud b { color: var(--ink); }
.dots { display: flex; gap: 6px; }
.dots i { width: 10px; height: 10px; border-radius: 50%; background: var(--line); }
.dots i.done { background: var(--accent); }
.dots i.now { background: var(--ink); }
.card-frame {
  margin: 0; aspect-ratio: 600 / 825; width: 100%;
  border-radius: 4.5% / 3.3%; overflow: hidden;
  background: linear-gradient(110deg, var(--line) 30%, var(--surface) 50%, var(--line) 70%) 0 0 / 300% 100%;
  animation: shimmer 1.4s linear infinite;
  box-shadow: var(--shadow);
}
.card-frame.loaded { animation: none; background: none; }
.card-frame img { width: 100%; height: 100%; display: block; opacity: 0; transition: opacity .25s; }
.card-frame.loaded img { opacity: 1; }
@keyframes shimmer { to { background-position: -300% 0; } }
.meta { color: var(--muted); font-size: 15px; margin: 0; }
.btn {
  border: 2px solid var(--line); background: var(--surface); border-radius: 999px;
  padding: 13px 28px; font-size: 19px; font-weight: 600;
}
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn:active { transform: scale(.97); }
.row { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }
.badges { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.badge { font-size: 12px; font-weight: 600; padding: 3px 10px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); color: var(--muted); }
.badge.vintage { color: var(--vintage); border-color: currentColor; }
.badge.modern { color: var(--modern); border-color: currentColor; }
.badge.promo { color: var(--promo); border-color: currentColor; }

/* Guess mode */
.guess-layout { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 64px; align-items: center; justify-content: center; }
.card-frame.big { height: min(calc(100vh - 200px), 760px); width: auto; }
.guess-panel { max-width: 620px; }
.guess-panel h2 { font-size: clamp(34px, 4vw, 52px); margin: 0; line-height: 1.1; }
.guess-panel .meta { margin: 6px 0 32px; }
.ask { margin: 0 0 4px; color: var(--muted); font-weight: 600; }
.price-display {
  display: flex; align-items: baseline; gap: 4px;
  font-size: clamp(56px, 7vw, 84px); font-weight: 700; margin-bottom: 14px; line-height: 1.1;
}
.price-display input {
  font: inherit; color: inherit; background: none; border: 0; border-bottom: 4px dashed var(--line);
  width: 6ch; field-sizing: content; min-width: 2ch; outline: none;
}
.price-display input:focus { border-bottom-color: var(--accent); }
#g-slider { width: 100%; accent-color: var(--accent); height: 32px; }
.ticks { display: flex; justify-content: space-between; color: var(--muted); font-size: 13px; margin: 0 2px 28px; }
#g-input .btn, #g-next { width: 100%; }
.verdict { font-size: 40px; font-weight: 700; margin: 0 0 18px; }
.compare { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-bottom: 28px; }
.compare div { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 16px 12px; text-align: center; }
.compare small { display: block; color: var(--muted); }
.compare strong { font-family: Fredoka, sans-serif; font-size: 30px; }
.compare .actual { color: var(--accent); }

/* Duel mode */
.duel-q { color: var(--ink); font-size: 26px; }
.duel-layout { display: grid; grid-template-columns: 1fr 140px 1fr; gap: 16px; align-items: center; }
.duel-card {
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  background: none; border: 0; padding: 10px; border-radius: var(--radius); transition: transform .15s;
}
.duel-card .card-frame {
  height: min(calc(100vh - 330px), 680px); width: auto; max-width: 100%;
  outline: 5px solid transparent; outline-offset: 5px; transition: outline-color .2s;
}
.duel-card:not(:disabled):hover { transform: translateY(-6px); }
.duel-card:disabled { cursor: default; }
.duel-card.win .card-frame { outline-color: var(--good); }
.duel-card.lose .card-frame { outline-color: var(--bad); opacity: .8; }
.d-name { font-weight: 600; font-size: 18px; margin-top: 10px; }
.d-price { font-family: Fredoka, sans-serif; font-size: 38px; font-weight: 700; min-height: 1.3em; line-height: 1.2; }
.duel-card.win .d-price { color: var(--good); }
.vs-col { display: flex; flex-direction: column; align-items: center; gap: 18px; }
.vs { font-size: 34px; font-weight: 700; color: var(--muted); }
#d-next { padding: 12px 22px; white-space: nowrap; }
.duel-hint { text-align: center; color: var(--muted); font-size: 13px; margin: 6px 0 0; }

/* Results */
#results { text-align: center; padding-top: 2vh; }
.recap { list-style: none; padding: 0; margin: 0 auto 28px; max-width: 1000px; display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 10px; text-align: left; }
.recap li {
  display: grid; grid-template-columns: 56px 1fr auto; gap: 12px; align-items: center;
  background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 8px 12px;
}
.recap img { width: 56px; border-radius: 3px; }
.recap .r-name { font-weight: 600; }
.recap .r-detail { font-size: 13px; color: var(--muted); }
.recap .r-pts { font-family: Fredoka, sans-serif; font-weight: 700; font-size: 20px; }

.pop { animation: pop .35s ease-out; }
@keyframes pop { 0% { transform: scale(.85); opacity: 0; } 100% { transform: scale(1); opacity: 1; } }

@media (max-width: 900px) {
  .hero { grid-template-columns: 1fr; min-height: 0; }
  .fan { display: none; }
  .guess-layout { grid-template-columns: 1fr; gap: 20px; }
  .card-frame.big { height: auto; width: min(70vw, 320px); margin: 0 auto; }
  .guess-panel { text-align: center; margin: 0 auto; }
  .badges { justify-content: center; }
  .price-display { justify-content: center; }
  .duel-layout { grid-template-columns: 1fr 70px 1fr; gap: 6px; }
  .duel-card .card-frame { height: auto; width: 100%; }
  .duel-q { display: none; }
}
@media (max-width: 600px) {
  .topbar { padding: 12px 16px; }
  main { padding: 8px 16px 32px; }
  .logo { font-size: 20px; }
  .nav { gap: 10px; }
  .nav a { font-size: 12px; }
  .currency button { padding: 5px 8px; font-size: 11px; }
  .modes { grid-template-columns: 1fr; }
  .strip { margin: 24px -16px 0; }
  .strip img { height: 110px; }
  .d-price { font-size: 22px; }
  .d-name { font-size: 14px; }
  .vs { font-size: 20px; }
  #d-next { padding: 8px 12px; font-size: 15px; }
  .compare strong { font-size: 20px; }
  .verdict { font-size: 30px; }
  .dots { display: none; }
}

/* Phones: keyboard tip is useless on touch, and the top bar needs two lines */
@media (hover: none) { .duel-hint { display: none; } }
@media (max-width: 480px) {
  .topbar { flex-wrap: wrap; row-gap: 8px; padding: 12px 16px; }
  .nav { width: 100%; justify-content: space-between; }
  .nav a, .currency button { white-space: nowrap; }
}
/* Phones: room for the OctoGus home button in the top-left corner */
@media (max-width: 768px) { .topbar { padding-left: 58px; } }
