:root {
  --paper: #f6f2ea;
  --ink: #1d1b18;
  --muted: #6f685d;
  --line: #e2dbcf;
  --board: #17150f;
  --board-2: #221f18;
  --flap: #ffc54d;
  --flap-dim: #8c7a52;
  --go: #39d98a;
  --accent: #e2462f;
  --gold: #d4a64a;
  --radius: 18px;
  --serif: 'Instrument Serif', Georgia, serif;
  --sans: 'DM Sans', system-ui, sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, monospace;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: #efe9df; color: var(--ink); font-family: var(--sans); }
#scene { position: fixed; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; }
a { color: inherit; }

.brand { position: fixed; top: 22px; left: 26px; display: flex; gap: 8px; align-items: baseline; z-index: 3; }
.brand-mark { font-family: var(--serif); font-size: 30px; text-decoration: none; letter-spacing: -0.01em; }
.brand-sub { font-family: var(--mono); font-size: 12px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }

/* Departures board */
.board {
  position: fixed; top: 24px; right: 24px; bottom: 24px; width: 380px; z-index: 3;
  display: flex; flex-direction: column; gap: 10px; padding: 20px 18px 14px;
  background: rgba(246, 242, 234, .94); backdrop-filter: blur(10px);
  border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: 0 18px 50px -20px rgba(60, 45, 20, .35);
}
.board-head { display: flex; justify-content: space-between; align-items: center; }
.board h1 { font-family: var(--serif); font-weight: 400; font-size: 34px; margin: 0; line-height: 1; }
.ghost-btn { font: 600 11px var(--mono); letter-spacing: .1em; text-transform: uppercase; background: transparent; border: 1px solid var(--line); border-radius: 999px; padding: 8px 12px; cursor: pointer; color: var(--ink); }
.ghost-btn:hover { border-color: var(--ink); }
.meter { height: 5px; background: var(--line); border-radius: 3px; overflow: hidden; }
#meter-fill { height: 100%; width: 0; background: var(--ink); transition: width 1.2s cubic-bezier(.2,.8,.2,1); }
.count { margin: 0; font: 11px var(--mono); letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.search { display: flex; align-items: center; gap: 8px; border: 1px solid var(--line); border-radius: 999px; padding: 7px 14px; background: #fff; }
.search svg { width: 16px; height: 16px; fill: none; stroke: var(--muted); stroke-width: 2; flex: none; }
.search input { border: 0; outline: 0; font: 15px var(--sans); width: 100%; background: transparent; color: var(--ink); }

.flap { flex: 1; min-height: 0; display: flex; flex-direction: column; background: var(--board); border-radius: 12px; padding: 10px 8px 6px; }
.cols, #rows li { display: grid; grid-template-columns: 34px 1fr 74px; gap: 8px; align-items: center; }
.cols { font: 600 10px var(--mono); letter-spacing: .14em; text-transform: uppercase; color: var(--flap-dim); padding: 0 8px 8px; border-bottom: 1px solid #2c281f; }
#rows { list-style: none; margin: 0; padding: 4px 0 0; overflow-y: auto; flex: 1; scrollbar-width: thin; scrollbar-color: #3a3428 transparent; }
#rows li { padding: 7px 8px; border-radius: 6px; cursor: pointer; font: 600 13px var(--mono); color: var(--flap); letter-spacing: .04em; }
#rows li:hover, #rows li.on { background: var(--board-2); }
#rows li.on { box-shadow: inset 2px 0 0 var(--flap); }
#rows .no { color: var(--flap-dim); }
#rows .nm { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-transform: uppercase; }
#rows .st { font-size: 10px; letter-spacing: .1em; color: var(--go); text-align: right; }
#rows li.first .st { color: var(--gold); }
#rows li.open .nm { color: #5d5340; }
#rows li.open .st { color: var(--flap); animation: blink 1.6s steps(2, start) infinite; }
@keyframes blink { 50% { opacity: .25; } }
.legend { display: flex; flex-direction: column; gap: 4px; font-size: 12.5px; color: var(--muted); padding: 0 4px; }
.legend span { display: flex; align-items: center; gap: 8px; }
.dot { width: 9px; height: 9px; border-radius: 50%; flex: none; }
.dot.first { background: var(--gold); }
.dot.open { border: 1.5px dashed var(--muted); }
.badge-first { display: inline-block; background: #f6ecd6; color: #7a5a17; border-radius: 999px; padding: 2px 8px; margin-right: 6px; letter-spacing: .08em; }
.hint { margin: 2px 0 0; text-align: center; font: 10px var(--mono); letter-spacing: .12em; text-transform: uppercase; color: var(--muted); }

/* Hover tooltip */
.tip { position: fixed; z-index: 4; pointer-events: none; transform: translate(-50%, -130%); background: var(--ink); color: #fff; border-radius: 999px; padding: 8px 14px; font: 500 14px var(--sans); white-space: nowrap; display: flex; gap: 8px; align-items: center; }
.tip i { width: 8px; height: 8px; border-radius: 50%; background: var(--go); }
.tip.open i { background: var(--flap); }
.tip.first i { background: var(--gold); }
.tip small { font: 11px var(--mono); opacity: .6; }

/* Detail card */
.card { position: fixed; left: 26px; top: 80px; width: 320px; z-index: 3; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; box-shadow: 0 18px 50px -20px rgba(60,45,20,.35); animation: rise .35s cubic-bezier(.2,.8,.2,1); }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } }
.card .close { position: absolute; top: 10px; right: 12px; border: 0; background: none; font-size: 22px; cursor: pointer; color: var(--muted); }
.card .logo { height: 76px; display: grid; place-items: center; background: var(--paper); border-radius: 12px; margin-bottom: 14px; padding: 12px; }
.card .logo img { max-width: 100%; max-height: 52px; object-fit: contain; }
.card .logo.fallback { font: 600 28px var(--serif); }
.eyebrow { margin: 0 0 4px; font: 600 11px var(--mono); letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.card h2 { margin: 0 0 6px; font: 400 28px/1.1 var(--serif); }
.card p { margin: 0 0 12px; font-size: 14px; line-height: 1.5; color: #3c382f; }
.card .visit { display: inline-flex; gap: 6px; font-weight: 600; font-size: 14px; text-decoration: none; border-bottom: 1.5px solid var(--ink); padding-bottom: 1px; margin-bottom: 14px; }
.card .claim { display: block; width: 100%; text-align: left; border: 1px dashed var(--line); background: var(--paper); border-radius: 12px; padding: 10px 12px; font: 13px var(--sans); color: var(--muted); cursor: pointer; }
.card .claim b { color: var(--ink); }
.card .board-now { width: 100%; border: 0; background: var(--ink); color: #fff; border-radius: 999px; padding: 12px; font: 600 15px var(--sans); cursor: pointer; }

/* CTA */
.cta { position: fixed; left: 26px; bottom: 26px; z-index: 3; display: flex; align-items: center; gap: 14px; padding: 7px 7px 7px 7px; border: 0; border-radius: 999px; background: var(--board); color: #fff; cursor: pointer; font-family: var(--sans); box-shadow: 0 14px 40px -14px rgba(0,0,0,.5); }
.cta-pill { display: flex; align-items: center; gap: 8px; background: #2a2720; border-radius: 999px; padding: 12px 16px; font: 600 12px var(--mono); letter-spacing: .12em; text-transform: uppercase; color: #d8d2c4; }
.cta-pill i { width: 8px; height: 8px; border-radius: 50%; background: var(--go); box-shadow: 0 0 0 4px rgba(57,217,138,.18); }
.cta-label { font-size: 18px; font-weight: 500; }
.cta-arrow { width: 46px; height: 46px; border-radius: 50%; background: #fff; color: var(--ink); display: grid; place-items: center; font-size: 22px; transition: transform .2s; }
.cta:hover .cta-arrow { transform: translateX(3px); }

/* Rent dialog */
dialog { border: 0; padding: 0; border-radius: 22px; width: min(460px, calc(100vw - 32px)); background: var(--paper); color: var(--ink); box-shadow: 0 40px 90px -30px rgba(0,0,0,.5); }
dialog::backdrop { background: rgba(30, 25, 15, .45); backdrop-filter: blur(3px); }
.rent { padding: 26px; position: relative; }
.rent .x { position: absolute; top: 14px; right: 16px; border: 0; background: none; font-size: 26px; cursor: pointer; color: var(--muted); }
.rent h2 { font: 400 38px/1 var(--serif); margin: 0 0 8px; }
.rent .lede { margin: 0 0 18px; color: #4a453b; line-height: 1.5; font-size: 15px; }
.billing { display: inline-flex; background: #e9e3d8; border-radius: 999px; padding: 4px; margin-bottom: 14px; }
.billing label { cursor: pointer; }
.billing input { position: absolute; opacity: 0; }
.billing span { display: block; padding: 7px 16px; border-radius: 999px; font: 600 13px var(--sans); color: var(--muted); }
.billing input:checked + span { background: #fff; color: var(--ink); box-shadow: 0 1px 3px rgba(0,0,0,.12); }
.billing input:focus-visible + span { outline: 2px solid var(--ink); }
.plan { display: flex; gap: 14px; align-items: flex-start; background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 14px; margin-bottom: 10px; }
.plan h3 { margin: 0 0 4px; font-size: 16px; }
.plan p { margin: 0; font-size: 13px; line-height: 1.45; color: var(--muted); }
.plan strong { margin-left: auto; font: 600 20px var(--sans); white-space: nowrap; }
.plan small { font-size: 12px; color: var(--muted); font-weight: 500; }
.plan.addon { cursor: pointer; }
.plan.addon input { margin-top: 3px; width: 18px; height: 18px; accent-color: var(--ink); flex: none; }
.plan.addon:has(input:checked) { border-color: var(--ink); }
.total { display: flex; justify-content: space-between; align-items: baseline; padding: 8px 2px 14px; font-size: 15px; }
.total strong { font-size: 22px; }
.buy { width: 100%; border: 0; border-radius: 999px; padding: 14px; font: 600 16px var(--sans); background: var(--ink); color: #fff; }
.buy:disabled { opacity: .55; cursor: not-allowed; }
.fine { font-size: 12.5px; color: var(--muted); margin: 12px 0 0; line-height: 1.5; }

.foot { position: fixed; bottom: 10px; right: 28px; z-index: 2; font: 10px var(--mono); letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.foot a { text-decoration: none; }

@media (max-width: 820px) {
  .brand { top: 14px; left: 16px; }
  .brand-mark { font-size: 24px; }
  .board { top: auto; left: 16px; right: 16px; bottom: 16px; width: auto; height: 44vh; padding: 14px 12px 10px; gap: 8px; }
  .board h1 { font-size: 26px; }
  .hint, .foot, .legend { display: none; }
  .cta { left: 16px; right: 16px; bottom: calc(44vh + 26px); justify-content: space-between; }
  .cta-label { font-size: 15px; }
  .cta-pill { padding: 10px 12px; font-size: 11px; }
  .cta-arrow { width: 40px; height: 40px; }
  .card { left: 16px; right: 16px; top: 56px; width: auto; }
  .card .logo { height: 56px; }
}
@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}
