:root {
  --bg: #0f1015;
  --surface: #181a22;
  --surface-2: #222531;
  --line: #2d3040;
  --text: #f3efe6;
  --muted: #a3a2ad;
  --accent: #e8c873;
  --accent-ink: #1a1407;
  --danger: #ff7a6b;
  --radius: 14px;
  --card-r: 4.8% / 3.4%;
  --safe-b: env(safe-area-inset-bottom, 0px);
  /* Futura PT from Adobe Fonts (kit txq4xvu); built-in Futura, then Jost, if Adobe can't be reached */
  --display: "futura-pt", Futura, Jost, "Century Gothic", sans-serif;
  --body: "futura-pt", Futura, Jost, "Century Gothic", sans-serif;
}
body[data-type="Plains"]   { --accent: #f1dc9a; --accent-ink: #2a2208; }
body[data-type="Island"]   { --accent: #6fb6f2; --accent-ink: #04182a; }
body[data-type="Swamp"]    { --accent: #b9a3d6; --accent-ink: #1b1027; }
body[data-type="Mountain"] { --accent: #ff8a65; --accent-ink: #2b0d04; }
body[data-type="Forest"]   { --accent: #7fd18c; --accent-ink: #072010; }

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 16px/1.45 var(--body);
  -webkit-tap-highlight-color: transparent;
  transition: background-color .4s;
}
button { font: inherit; color: inherit; cursor: pointer; }
img { display: block; max-width: 100%; }
h1, h2, h3 { font-family: var(--display); font-weight: 700; line-height: 1.1; margin: 0; }

.wrap { max-width: 760px; margin: 0 auto; padding: 0 16px; }
.screen { padding-bottom: calc(160px + var(--safe-b)); animation: fade .16s ease; }
@keyframes fade { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 50px; padding: 0 22px; border-radius: 999px; border: 0;
  background: var(--accent); color: var(--accent-ink); font-weight: 700; font-size: 16px;
  text-decoration: none; transition: transform .1s, opacity .2s;
}
.btn:active { transform: scale(.97); }
.btn[disabled] { opacity: .35; pointer-events: none; }
.btn.ghost { background: transparent; color: var(--text); box-shadow: inset 0 0 0 1.5px var(--line); }
.btn.block { width: 100%; }
.btn .soon { font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase;
  background: var(--surface-2); color: var(--muted); padding: 3px 8px; border-radius: 99px; }
.link { background: none; border: 0; color: var(--muted); padding: 10px 4px; font-weight: 600; }

/* ---------- home ---------- */
.home { min-height: 100svh; display: flex; flex-direction: column; justify-content: center; padding-top: 32px; padding-bottom: 40px; }
.fan { position: relative; height: min(56vw, 270px); margin: 8px auto 44px; width: 100%; max-width: 440px; }
.fan img {
  position: absolute; left: 50%; bottom: 0; width: 38%; border-radius: var(--card-r);
  box-shadow: 0 18px 40px rgba(0,0,0,.55); transform-origin: 50% 120%;
  transition: transform .6s cubic-bezier(.2,.8,.2,1);
}
.home h1 { font-size: clamp(34px, 9vw, 52px); text-align: center; }
.home h1 em { font-style: normal; color: var(--accent); }
.home p.lede { color: var(--muted); text-align: center; margin: 12px auto 28px; max-width: 30em; }
.home .actions { display: grid; gap: 12px; max-width: 420px; margin: 0 auto; width: 100%; }
.home .peek { justify-self: center; margin-top: 4px; font-size: 13px; font-weight: 500; text-decoration: underline; text-underline-offset: 3px; text-decoration-color: rgba(163,162,173,.5); }
.home .peek:hover, .home .peek:focus-visible { color: var(--text); text-decoration-color: currentColor; }
.pips { display: flex; justify-content: center; gap: 10px; margin: 0 0 14px; }
.pips img { width: 22px; height: 22px; }
.fine { color: #6f6e78; font-size: 11.5px; text-align: center; margin-top: 36px; line-height: 1.5; }
.fine a { color: inherit; }

/* ---------- top bar & progress ---------- */
.top { position: sticky; top: 0; z-index: 5; background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); padding: 10px 0 12px; }
.progress { display: flex; gap: 4px; margin-bottom: 12px; }
.progress span { flex: 1; height: 4px; border-radius: 4px; background: var(--surface-2); overflow: hidden; position: relative; }
.progress span.done { background: var(--accent); opacity: .55; }
.progress span.now { background: var(--accent); }
.progress span i { position: absolute; inset: 0; background: var(--accent); transform-origin: left; }
.head { display: flex; align-items: center; gap: 12px; }
.head .sym { width: 36px; height: 36px; flex: none; filter: drop-shadow(0 2px 6px rgba(0,0,0,.4)); }
.head h2 { font-size: 26px; }
.head .eyebrow { font-size: 12px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--accent); }
.instr { color: var(--muted); margin: 10px 0 0; font-size: 15px; }
.instr b { color: var(--text); }

/* ---------- selection grid ---------- */
.grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; margin-top: 6px; }
@media (min-width: 520px) { .grid { grid-template-columns: repeat(3, 1fr); } }
@media (min-width: 760px) { .grid { grid-template-columns: repeat(4, 1fr); } }
.tile { position: relative; border: 0; padding: 0; background: none; border-radius: var(--card-r);
  transition: transform .15s; aspect-ratio: 488 / 680; }
.tile img { width: 100%; height: 100%; object-fit: cover; border-radius: var(--card-r); background: var(--surface);
  transition: filter .2s, opacity .2s; }
.tile::after { content: ""; position: absolute; inset: -4px; border-radius: 7% / 5%;
  box-shadow: 0 0 0 3px var(--accent); opacity: 0; transition: opacity .15s; pointer-events: none; }
.tile.on::after { opacity: 1; }
.tile.on { transform: scale(.96); }
.grid.full .tile:not(.on) img { opacity: .45; }
.tile .badge { position: absolute; top: 6px; left: 6px; width: 32px; height: 32px; border-radius: 50%;
  background: var(--accent); color: var(--accent-ink); font-weight: 800; display: grid; place-items: center;
  font-size: 16px; transform: scale(0); transition: transform .2s cubic-bezier(.3,1.6,.5,1);
  box-shadow: 0 2px 8px rgba(0,0,0,.5); }
.tile.on .badge { transform: scale(1); }
.zoom { position: absolute; bottom: 6px; right: 6px; width: 36px; height: 36px; border-radius: 50%; border: 0;
  background: rgba(10,10,14,.72); display: grid; place-items: center; backdrop-filter: blur(4px); }
.zoom svg { width: 18px; height: 18px; }
.shake { animation: shake .35s; }
@keyframes shake { 25% { transform: translateX(-5px);} 75% { transform: translateX(5px);} }

/* ---------- bottom action bar ---------- */
.bar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 6;
  background: linear-gradient(to top, var(--bg) 70%, transparent); padding: 22px 0 calc(14px + var(--safe-b)); }
.bar .wrap { display: flex; align-items: center; gap: 10px; }
.bar .picks { display: flex; gap: 5px; flex: 1; min-width: 0; }
.bar .picks .slot { width: 30px; aspect-ratio: 488/680; border-radius: 3px; background: var(--surface-2);
  box-shadow: inset 0 0 0 1px var(--line); overflow: hidden; flex: none; }
.bar .picks .slot img { width: 100%; height: 100%; object-fit: cover; }
.bar .picks .slot.req { box-shadow: inset 0 0 0 1px var(--accent); }
.bar .btn { flex: none; }

/* ---------- ranking ---------- */
.ranklist { list-style: none; margin: 8px 0 0; padding: 0; display: grid; gap: 10px; }
.rankrow { display: flex; align-items: center; gap: 12px; background: var(--surface); border-radius: var(--radius);
  padding: 10px; box-shadow: inset 0 0 0 1px var(--line); touch-action: pan-y; user-select: none; -webkit-user-select: none; }
.rankrow .num { font-family: var(--display); font-size: 30px; width: 30px; text-align: center; color: var(--accent); flex: none; }
.rankrow img { width: 72px; border-radius: var(--card-r); flex: none; }
.rankrow:first-child img { width: 92px; }
.rankrow .meta { flex: 1; min-width: 0; font-size: 13.5px; color: var(--muted); }
.rankrow .meta b { display: block; color: var(--text); font-size: 15px; }
.rankrow .moves { display: grid; gap: 6px; flex: none; }
.rankrow .moves button { width: 40px; height: 36px; border-radius: 10px; border: 0; background: var(--surface-2); display: grid; place-items: center; }
.rankrow .moves button[disabled] { opacity: .25; }
.rankrow .handle { width: 28px; flex: none; color: var(--muted); display: grid; place-items: center; cursor: grab; touch-action: none; height: 60px; }
.sortable-ghost { opacity: .3; }
.sortable-chosen { box-shadow: inset 0 0 0 2px var(--accent), 0 10px 30px rgba(0,0,0,.5); }

/* ---------- style rating ---------- */
.style-hero { display: flex; justify-content: center; margin: 4px 0 10px; }
.style-hero button { border: 0; padding: 0; background: none; width: min(62vw, 300px); }
.style-hero img { width: 100%; border-radius: var(--card-r); box-shadow: 0 16px 40px rgba(0,0,0,.6); }
.strip { display: flex; gap: 8px; overflow-x: auto; padding: 6px 2px 10px; scroll-snap-type: x mandatory; scrollbar-width: none; }
.strip::-webkit-scrollbar { display: none; }
.strip button { flex: none; border: 0; padding: 0; background: none; width: 64px; scroll-snap-align: start; }
.strip img { border-radius: var(--card-r); }
.strip button.rep img { box-shadow: 0 0 0 2px var(--accent); }
.style-meta { text-align: center; }
.style-meta h3 { font-size: 22px; }
.style-meta p { color: var(--muted); margin: 4px 0 0; font-size: 14px; }
.scale { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; margin-top: 14px; }
.scale button { aspect-ratio: 1; border-radius: 12px; border: 0; background: var(--surface-2); font-weight: 800; font-size: 18px;
  box-shadow: inset 0 0 0 1px var(--line); transition: transform .1s, background .15s; }
.scale button:active { transform: scale(.92); }
.scale button.on { background: var(--accent); color: var(--accent-ink); box-shadow: none; }
.scale-ends { display: flex; justify-content: space-between; font-size: 12px; color: var(--muted); margin-top: 6px; }
.scale-pick { text-align: center; min-height: 22px; margin-top: 8px; font-weight: 600; color: var(--accent); }

/* ---------- done / results ---------- */
.center { text-align: center; }
.done-hero { display: flex; justify-content: center; margin: 40px 0 24px; }
.done-hero img { width: 18%; max-width: 92px; border-radius: var(--card-r); margin: 0 -2%; box-shadow: 0 10px 24px rgba(0,0,0,.5); }
.done-hero img:nth-child(odd) { transform: translateY(10px) rotate(-4deg); }
.done-hero img:nth-child(even) { transform: rotate(4deg); }
.stack { display: grid; gap: 12px; max-width: 420px; margin: 26px auto 0; }

.res-section { margin-top: 30px; }
.res-section h3 { font-size: 22px; display: flex; align-items: center; gap: 8px; margin-bottom: 12px; }
.res-section h3 img { width: 22px; }
.podium { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; align-items: end; }
.podium figure { margin: 0; position: relative; }
.podium figure img { border-radius: var(--card-r); }
.podium figcaption { font-size: 11px; color: var(--muted); text-align: center; margin-top: 4px; line-height: 1.25; }
.podium .place { position: absolute; top: -8px; left: -4px; width: 24px; height: 24px; border-radius: 50%; background: var(--accent);
  color: var(--accent-ink); font-weight: 800; font-size: 13px; display: grid; place-items: center; }
.bars { display: grid; gap: 8px; }
.barrow { display: grid; grid-template-columns: 46px 1fr; gap: 10px; align-items: center; }
.barrow img { border-radius: var(--card-r); }
.barrow .label { font-size: 13px; display: flex; justify-content: space-between; gap: 8px; }
.barrow .label span:last-child { color: var(--muted); white-space: nowrap; }
.barrow .track { height: 8px; background: var(--surface-2); border-radius: 8px; margin-top: 5px; overflow: hidden; }
.barrow .track i { display: block; height: 100%; background: var(--accent); border-radius: 8px; }
.note-box.nudge { display: flex; align-items: center; gap: 12px; color: var(--text); }
.note-box.nudge span { flex: 1; }
.note-box.nudge .btn { flex: none; padding: 10px 16px; font-size: 14px; }
.note-box { background: var(--surface); border-radius: var(--radius); padding: 12px 14px; color: var(--muted); font-size: 14px; margin-top: 16px; box-shadow: inset 0 0 0 1px var(--line); }
.spinner { width: 40px; height: 40px; border-radius: 50%; border: 3px solid var(--surface-2); border-top-color: var(--accent);
  margin: 80px auto 16px; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- lightbox ---------- */
.lightbox { position: fixed; inset: 0; z-index: 20; background: rgba(6,6,9,.94); display: flex; flex-direction: column;
  align-items: center; justify-content: center; padding: 16px 16px calc(16px + var(--safe-b)); animation: fade .2s; }
.lightbox[hidden] { display: none; }
.lightbox .lb-img { width: min(88vw, 62vh, 480px); border-radius: var(--card-r); box-shadow: 0 20px 60px rgba(0,0,0,.7); touch-action: pan-y; }
.lightbox .cap { color: var(--muted); font-size: 13px; text-align: center; margin: 12px 0; }
.lightbox .cap b { color: var(--text); }
.lightbox .lb-row { display: flex; gap: 10px; align-items: center; }
.lightbox .nav { width: 50px; height: 50px; border-radius: 50%; border: 0; background: var(--surface-2); font-size: 22px; }
.lightbox .close { position: absolute; top: calc(10px + env(safe-area-inset-top, 0px)); right: 12px; width: 44px; height: 44px; border-radius: 50%;
  border: 0; background: var(--surface-2); font-size: 22px; }

.toast { position: fixed; left: 50%; bottom: calc(96px + var(--safe-b)); transform: translateX(-50%); z-index: 30;
  background: var(--text); color: var(--bg); padding: 10px 16px; border-radius: 99px; font-weight: 600; font-size: 14px;
  box-shadow: 0 8px 24px rgba(0,0,0,.4); max-width: calc(100vw - 32px); text-align: center; }

@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }
.fine .owner { color: var(--muted); font-weight: 600; font-size: 12.5px; }
.bar .skiprow { justify-content: center; padding-top: 2px; }
.bar .skiprow .link { font-weight: 500; font-size: 14px; padding: 6px 12px; text-decoration: underline; text-underline-offset: 3px; }

/* Room for Netlify's "Powered by Netlify" badge (bottom-right, ~52px tall) when it's present */
body.has-badge .bar { padding-bottom: calc(66px + var(--safe-b)); }
body.has-badge .screen { padding-bottom: calc(212px + var(--safe-b)); }
body.has-badge .toast { bottom: calc(150px + var(--safe-b)); }
body.has-badge .lightbox { padding-bottom: calc(68px + var(--safe-b)); }
body.has-badge .home { padding-bottom: 80px; }

/* Share my top 3 */
.share-img { max-height: 62vh; max-width: 88vw; width: auto; border-radius: 12px; box-shadow: 0 20px 60px rgba(0,0,0,.7); }
.share-actions { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; margin-top: 18px; }
.share-actions .btn { min-width: 130px; }
