:root {
  --bg: #3b3228;
  --surface: #534636;
  --border: #645240;
  --text: #d0c8c6;
  --muted: #b8afad;
  --primary: #beb55b;
  --secondary: #cb6077;
  --accent: #8ab3b5;
  --ink: #2c261f;
  --surface-deep: #463b2f;
  --line-soft: rgba(138, 179, 181, .11);
  --glow-pink: rgba(203, 96, 119, .18);
  --glow-cyan: rgba(138, 179, 181, .16);
}

* { box-sizing: border-box; }
html { color-scheme: dark; scroll-behavior: smooth; }
body {
  margin: 0;
  min-width: 320px;
  color: var(--text);
  background-color: var(--bg);
  background-image:
    linear-gradient(var(--line-soft) 1px, transparent 1px),
    linear-gradient(90deg, var(--line-soft) 1px, transparent 1px),
    radial-gradient(circle at 15% 15%, var(--glow-pink), transparent 32rem),
    radial-gradient(circle at 90% 60%, var(--glow-cyan), transparent 38rem);
  background-size: 32px 32px, 32px 32px, auto, auto;
  font-family: "Avenir Next", "Trebuchet MS", system-ui, sans-serif;
  line-height: 1.5;
}

button, input { font: inherit; }
button { min-height: 44px; }
button:focus-visible, input:focus-visible, a:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 3px;
}
.site-header, main, footer { width: min(1120px, calc(100% - 36px)); margin-inline: auto; }
.site-header {
  min-height: 84px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border);
}
.brand { display: flex; gap: 12px; align-items: center; color: var(--text); text-decoration: none; font-weight: 800; letter-spacing: -.02em; }
.brand-mark { display: grid; place-items: center; min-width: 54px; height: 34px; color: var(--ink); background: var(--primary); border: 2px solid var(--ink); border-radius: 45% 55% 48% 52%; font-size: 12px; letter-spacing: 5px; padding-left: 5px; }
.draft-label, .eyebrow { color: var(--accent); font: 700 12px/1.2 ui-monospace, SFMono-Regular, Consolas, monospace; letter-spacing: .16em; }
.intro { padding: 72px 0 44px; max-width: 850px; }
.intro h1 { margin: 8px 0 14px; max-width: 780px; font-size: clamp(44px, 7vw, 80px); line-height: .96; letter-spacing: -.06em; color: var(--text); }
.intro > p:last-child { margin: 0; max-width: 650px; color: var(--muted); font-size: clamp(17px, 2vw, 21px); }
.eyebrow { margin: 0 0 8px; }

.workbench { display: grid; grid-template-columns: minmax(0, 560px) minmax(320px, 1fr); gap: 32px; align-items: start; }
.result-wrap { position: sticky; top: 18px; filter: drop-shadow(-14px 16px 28px rgba(0,0,0,.22)); }
.tuber-card { display: block; width: 100%; height: auto; aspect-ratio: 4 / 5; border-radius: 24px; }
.tuber-card.is-rolling { animation: settle 220ms ease-out; }
@keyframes settle { 0% { transform: scale(1, 1); } 45% { transform: scale(.97, 1.025) rotate(-.4deg); } 100% { transform: scale(1); } }

.console { position: relative; padding: 26px; background: color-mix(in srgb, var(--surface) 94%, transparent); border: 1px solid var(--border); box-shadow: 12px 12px 0 rgba(44,38,31,.38), 0 0 36px var(--glow-cyan); }
.console::before { content: ""; position: absolute; inset: 9px; border: 1px solid rgba(190,181,91,.16); pointer-events: none; }
.console-head { display: flex; justify-content: space-between; align-items: start; position: relative; }
.console h2, .rules h2 { margin: 0; font-size: 28px; line-height: 1.1; letter-spacing: -.03em; }
.status-light { width: 12px; height: 12px; margin-top: 8px; border-radius: 50%; background: var(--primary); box-shadow: 0 0 14px var(--primary); }
.primary-action, .actions button { border: 1px solid var(--border); cursor: pointer; font-weight: 800; }
.primary-action { position: relative; width: 100%; margin: 24px 0; color: var(--ink); background: var(--primary); border-color: var(--primary); box-shadow: 5px 5px 0 var(--ink); }
.primary-action:hover { filter: brightness(1.08); transform: translate(-1px, -1px); }
.primary-action:active { transform: translate(3px, 3px); box-shadow: 2px 2px 0 var(--ink); }
.fields { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; position: relative; }
fieldset { min-width: 0; margin: 0; padding: 0; border: 0; }
legend { width: 100%; margin-bottom: 8px; color: var(--muted); font: 700 11px/1.2 ui-monospace, SFMono-Regular, Consolas, monospace; letter-spacing: .12em; text-transform: uppercase; }
.wide-field { grid-column: 1 / -1; }
.option-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; }
.wide-field .option-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.option { position: relative; }
.option input { position: absolute; opacity: 0; pointer-events: none; }
.option label { min-height: 44px; padding: 8px 9px; display: flex; gap: 7px; align-items: center; justify-content: center; text-align: center; color: var(--text); background: var(--surface-deep); border: 1px solid var(--border); border-radius: 2px; cursor: pointer; font-size: 12px; line-height: 1.15; }
.option input:checked + label { color: var(--ink); background: var(--accent); border-color: var(--accent); font-weight: 800; box-shadow: inset 0 0 0 2px var(--ink); }
.option input:checked + label::before { content: "✓"; font-weight: 900; }
.option input:focus-visible + label { outline: 3px solid var(--accent); outline-offset: 2px; }
.swatch-dot { width: 13px; height: 13px; flex: 0 0 auto; border-radius: 50%; border: 1px solid var(--ink); background: var(--swatch); }
.actions { position: relative; display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 24px; }
.actions button { color: var(--text); background: var(--surface-deep); }
.actions button:first-child { grid-column: 1 / -1; color: var(--ink); background: var(--accent); border-color: var(--accent); }
.actions button:hover { border-color: var(--primary); }
.status { min-height: 24px; margin: 12px 0 0; color: var(--primary); font-size: 13px; }
.fallback { display: inline-block; margin-top: 12px; color: var(--accent); }

.rules { margin-top: 80px; padding: 36px; display: grid; grid-template-columns: 1fr 1.25fr; gap: 42px; background: var(--surface-deep); border: 1px solid var(--border); }
.rules ol { list-style: none; padding: 0; margin: 0; }
.rules li { padding: 14px 0; border-bottom: 1px solid var(--border); font-size: 16px; }
.rules li:first-child { padding-top: 0; }
.rules li span { margin-right: 14px; color: var(--secondary); font: 700 13px ui-monospace, monospace; }
footer { padding: 34px 0; margin-top: 48px; display: flex; justify-content: space-between; color: var(--muted); border-top: 1px solid var(--border); font: 700 11px ui-monospace, monospace; letter-spacing: .12em; }

@media (max-width: 860px) {
  .workbench { grid-template-columns: 1fr; }
  .result-wrap { position: static; width: min(100%, 560px); margin-inline: auto; }
  .console { width: min(100%, 560px); margin-inline: auto; }
}
@media (max-width: 540px) {
  .site-header, main, footer { width: min(100% - 22px, 1120px); }
  .draft-label { display: none; }
  .intro { padding: 48px 4px 30px; }
  .intro h1 { font-size: clamp(40px, 14vw, 60px); }
  .console { padding: 22px 16px; box-shadow: 6px 7px 0 rgba(44,38,31,.38); }
  .fields { grid-template-columns: 1fr; }
  .wide-field { grid-column: auto; }
  .wide-field .option-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .rules { margin-top: 56px; padding: 26px 20px; grid-template-columns: 1fr; gap: 28px; }
  footer { gap: 16px; flex-direction: column; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .tuber-card.is-rolling { animation: none; }
  *, *::before, *::after { transition-duration: .01ms !important; }
}
