/* Tokens first: every colour, radius and shadow is named once here. */
:root {
  color-scheme: light dark;
  --bg: light-dark(#f5f5f2, #111113);
  --card: light-dark(#ffffff, #1b1b1f);
  --line: light-dark(#e2e2dc, #2d2d34);
  --text: light-dark(#17171a, #f1f1ee);
  --muted: light-dark(#6c6c75, #9a9aa5);
  --accent: light-dark(#c2410c, #ff9a52);
  --accent-deep: light-dark(#9a3412, #ffb27a);
  --on-accent: light-dark(#ffffff, #111113);
  --soft: light-dark(#fdeee4, #3a2518);
  --good: light-dark(#d9f2e1, #173d27);
  --near: light-dark(#eef7f0, #1b2a21);
  --far: light-dark(#fde3e0, #47201c);
  --bad: light-dark(#b42318, #ff8a7d);
  --scrim: rgb(0 0 0 / 0.45);
  --shadow: 0 1px 2px rgb(0 0 0 / 0.06), 0 4px 14px rgb(0 0 0 / 0.06);
  --radius: 12px;
  --gap: 14px;
  --bar: 56px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.45 system-ui, -apple-system, "Segoe UI", sans-serif;
  -webkit-text-size-adjust: 100%;
}

main {
  display: flex;
  flex-direction: column;
  gap: var(--gap);
  max-width: 560px;
  margin: 0 auto;
  padding: 20px 16px calc(40px + env(safe-area-inset-bottom));
}

h1, h2, p, ul, ol { margin: 0; }
h1 { font-size: 30px; line-height: 1.15; letter-spacing: -0.02em; }
h2 { font-size: 18px; }
small, em { color: var(--muted); font-size: 11px; font-style: normal; font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; }

.lede { font-size: 18px; color: var(--muted); }
.note { color: var(--muted); font-size: 14px; }
.center { text-align: center; }
.eyebrow { color: var(--accent); font-size: 13px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; margin-bottom: -8px; }
.error { color: var(--bad); font-size: 14px; }
.code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-weight: 700; letter-spacing: 0.12em; }
.code.big { font-size: 34px; line-height: 1; }

/* ── building blocks ── */

.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); }
.stack { display: flex; flex-direction: column; gap: 10px; }
.row { display: flex; gap: 8px; }
.row > input, .grow { flex: 1; min-width: 0; }
input.code { text-transform: uppercase; }
.or { color: var(--muted); font-size: 13px; text-align: center; }
label { font-weight: 600; }

input, button { font: inherit; color: inherit; border-radius: var(--radius); }
input { width: 100%; min-height: 48px; padding: 0 14px; background: var(--bg); border: 1px solid var(--line); }
input:focus-visible, button:focus-visible, a:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* One button, four voices: primary (the next step), soft (a second option), ghost (quiet), danger (confirm). */
button {
  min-height: 48px; padding: 0 18px;
  background: var(--card); border: 1px solid var(--line);
  font-weight: 650; cursor: pointer;
  transition: background 0.12s, transform 0.06s, border-color 0.12s;
}
button:active:not(:disabled) { transform: scale(0.98); }
button:disabled { opacity: 0.5; cursor: default; }
button.primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); box-shadow: var(--shadow); }
button.primary:hover:not(:disabled) { background: var(--accent-deep); border-color: var(--accent-deep); }
button.soft { background: var(--soft); border-color: transparent; color: var(--accent); }
button.ghost { min-height: 36px; padding: 0 10px; background: none; border-color: transparent; color: var(--accent); font-size: 14px; }
button.ghost:hover:not(:disabled) { background: var(--soft); }
button.danger { min-height: 36px; padding: 0 12px; background: var(--far); border-color: transparent; color: var(--bad); font-size: 14px; }
main > button.ghost, main > button.danger { align-self: center; }

.chip { padding: 5px 10px; background: var(--soft); color: var(--accent); border-radius: 8px; font-size: 14px; }

/* ── top bar and slide-out menu ── */

.bar { display: flex; align-items: center; gap: 12px; }
header.bar {
  position: sticky; top: 0; z-index: 5;
  height: var(--bar); padding: 0 8px 0 16px;
  background: color-mix(in srgb, var(--bg) 86%, transparent);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}
.logo { display: flex; align-items: center; gap: 9px; margin-right: auto; color: var(--text); font-weight: 800; font-size: 18px; letter-spacing: -0.02em; text-decoration: none; }
.logo b { display: grid; place-items: center; width: 30px; height: 30px; background: var(--accent); color: var(--on-accent); border-radius: 8px; font-size: 14px; letter-spacing: 0; }

.burger { display: grid; gap: 5px; align-content: center; width: 44px; min-height: 44px; padding: 0 11px; background: none; border-color: transparent; }
.burger:hover { background: var(--soft); }
.burger i { height: 2px; background: var(--text); border-radius: 2px; }

.scrim { position: fixed; inset: 0; z-index: 10; background: var(--scrim); }
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; z-index: 11;
  display: flex; flex-direction: column; gap: 22px;
  width: min(340px, 88vw); padding: 0 16px calc(24px + env(safe-area-inset-bottom));
  background: var(--card); border-left: 1px solid var(--line);
  overflow-y: auto;
}
.drawer.slide { animation: slide 0.18s ease-out; }
@keyframes slide { from { transform: translateX(100%); } }
@media (prefers-reduced-motion: reduce) { .drawer.slide { animation: none; } button { transition: none; } }
.drawer > .bar { height: var(--bar); margin: 0 -8px 0 0; justify-content: space-between; }
.drawer section { display: flex; flex-direction: column; gap: 10px; }
.drawer section + section { padding-top: 22px; border-top: 1px solid var(--line); }
.drawer p { color: var(--muted); font-size: 14px; }
.drawer p.code { color: var(--text); }

.people { display: flex; flex-direction: column; padding: 0; list-style: none; }
.people li { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 4px 8px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.people li:last-child { border-bottom: 0; }
.people span { display: flex; align-items: center; gap: 6px; font-weight: 600; }
.people .row { gap: 2px; }

/* ── the table ── */

.roster { display: flex; flex-wrap: wrap; gap: 6px; padding: 0; list-style: none; }
.roster li { display: flex; align-items: center; gap: 6px; padding: 6px 10px; background: var(--card); border: 1px solid var(--line); border-radius: 8px; font-size: 14px; }
.blueprint b { color: var(--accent); }
.chip.wallet { background: var(--good); color: var(--text); font-weight: 700; font-variant-numeric: tabular-nums; }

/* Pictures. The box is sized before the image arrives, so nothing shifts. */
.art { display: block; object-fit: cover; background: var(--soft); }
.art.tile { display: grid; place-items: center; line-height: 1; }
.art.painting { animation: painting 1.4s ease-in-out infinite alternate; }
@keyframes painting { to { opacity: 0.45; } }
.art.feature { width: 100%; aspect-ratio: 16 / 10; border-radius: 8px; font-size: 80px; }
.art.feature.square { aspect-ratio: 1; }
.art.thumb { flex: none; width: 30px; height: 30px; border-radius: 6px; font-size: 16px; }

/* ── the auction ── */

.lot { display: flex; flex-direction: column; gap: 6px; text-align: center; border-color: var(--accent); }
/* Kept short so the bid controls stay on the first screen of a phone. */
.lot .art.feature { aspect-ratio: 2 / 1; }
.lot strong { font-size: 28px; line-height: 1.2; letter-spacing: -0.01em; overflow-wrap: anywhere; }

.ladder { display: flex; flex-direction: column; gap: 4px; padding: 0; list-style: none; }
.ladder li { display: flex; justify-content: space-between; gap: 12px; padding: 9px 12px; background: var(--card); border: 1px solid var(--line); border-radius: 8px; }
.ladder b { font-variant-numeric: tabular-nums; }
.ladder li.out { color: var(--muted); }
.ladder li.out b { font-weight: 500; }
.ladder li.top { background: var(--good); border-color: transparent; }
.ladder li.up { border-color: var(--accent); }
.ladder li.up b { color: var(--accent); font-weight: 600; }

.mine { border-color: var(--accent); }
.stepper { display: flex; align-items: center; gap: 10px; }
.stepper button { width: 56px; font-size: 24px; }
.stepper output { flex: 1; text-align: center; font-size: 34px; font-weight: 800; font-variant-numeric: tabular-nums; }
.who { display: flex; flex-wrap: wrap; gap: 6px; }
.pill { min-height: 40px; padding: 0 12px; font-size: 14px; }
.pill.on { background: var(--soft); border-color: var(--accent); color: var(--accent); }

.last { display: flex; flex-direction: column; gap: 2px; padding: 10px 12px; background: var(--soft); border-radius: 8px; font-size: 14px; }

/* ── builds ── */

.build.me { border-color: var(--accent); }
.build .bar, .creation .bar { justify-content: space-between; }
.parts { display: flex; flex-direction: column; gap: 4px; margin-top: 10px; padding: 0; list-style: none; }
.part { display: flex; align-items: center; gap: 10px; min-height: 38px; padding: 4px 8px; background: var(--bg); border-radius: 8px; font-size: 14px; }
.part span { flex: 1; overflow-wrap: anywhere; }
.part.empty { border: 1px dashed var(--line); background: none; color: var(--muted); }
.part.dumped { background: var(--far); }

.creation { display: flex; flex-direction: column; gap: 8px; }
.creation.won { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent); }
.creation .parts { margin-top: 0; }

/* ── stages and announcements ── */

.stage { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: -4px; }
.chip.hot { background: var(--accent); color: var(--on-accent); font-weight: 700; }
.pulse { animation: pulse 0.9s ease-in-out infinite alternate; }
@keyframes pulse { to { transform: scale(1.06); } }

.lot.enter { animation: enter 0.35s cubic-bezier(0.2, 0.9, 0.3, 1.2); }
@keyframes enter { from { opacity: 0; transform: translateY(18px) scale(0.96); } }

.easel { width: 96px; height: 96px; margin: 0 auto; border-radius: 50%; font-size: 48px; }
.meter { height: 8px; background: var(--line); border-radius: 4px; overflow: hidden; }
.meter i { display: block; height: 100%; background: var(--accent); border-radius: 4px; transition: width 0.6s ease; }

.banner {
  position: fixed; left: 50%; top: calc(var(--bar) + 12px); z-index: 20;
  display: none; flex-direction: column; gap: 2px;
  width: min(520px, calc(100vw - 24px)); padding: 14px 18px;
  background: var(--accent); color: var(--on-accent);
  border-radius: var(--radius); box-shadow: 0 10px 30px rgb(0 0 0 / 0.3);
  text-align: center; pointer-events: none; translate: -50% 0;
}
.banner.show { display: flex; animation: banner 3.2s ease both; }
.banner strong { font-size: 19px; line-height: 1.25; }
.banner span { font-size: 14px; opacity: 0.9; }
@keyframes banner {
  0% { opacity: 0; transform: translateY(-16px) scale(0.94); }
  8% { opacity: 1; transform: translateY(0) scale(1.03); }
  13% { transform: scale(1); }
  88% { opacity: 1; transform: translateY(0); }
  100% { opacity: 0; transform: translateY(-10px); }
}
@media (prefers-reduced-motion: reduce) {
  .pulse, .lot.enter, .art.painting { animation: none; }
  .banner.show { animation: none; }
}
