@font-face {
  font-family: "Barlow Condensed";
  src: url("/barlow.woff2") format("woff2");
  font-weight: 700;
  font-display: swap;
}
@font-face {
  font-family: "Barlow Condensed";
  src: url("/barlow-ext.woff2") format("woff2");
  font-weight: 700;
  font-display: swap;
  unicode-range: U+0100-02FF, U+1D00-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
:root {
  color-scheme: dark;
  --paper: #111321;
  --card: #191c2e;
  --ink: #f2f1fb;
  --muted: #b2b7cf;
  --line: #36394f;
  --green: #242741;
  --red: #ef6a9b;
  --signal: #8eeefa;
  --heading: "Barlow Condensed", "Arial Narrow", Impact, sans-serif;
  --body: "Segoe UI", system-ui, sans-serif;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; background: var(--paper); color: var(--ink); font: 15px/1.5 var(--body); }
button, input, select { font: inherit; }
button { cursor: pointer; }
button:disabled { opacity: .48; cursor: default; }
:focus-visible { outline: 3px solid #f27ca7; outline-offset: 3px; }
a { color: inherit; }

.mast {
  height: 66px; display: flex; align-items: center; justify-content: space-between;
  padding-inline: clamp(15px, 4vw, 65px); border-bottom: 1px solid var(--line);
}
.wordmark { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; font: 700 25px/1 var(--heading); text-transform: uppercase; letter-spacing: .04em; }
.brand-icon { width: 32px; height: 30px; display: grid; place-items: center; background: var(--red); color: #fff7e8; transform: skew(-8deg); }
.brand-icon::before, .finish-mark {
  content: ""; display: inline-block; width: 20px; height: 14px;
  background: repeating-conic-gradient(currentColor 0% 25%, transparent 0% 50%) 0 0 / 8px 8px;
}
.mast-actions { display: flex; align-items: center; gap: 15px; }
.connection { font-size: 12px; font-weight: 600; color: var(--muted); white-space: nowrap; }
.connection i { display: inline-block; width: 7px; height: 7px; margin-right: 7px; border-radius: 50%; background: #8eeefa; }
.connection.off i { background: var(--red); }
button { min-height: 39px; border: 1px solid var(--line); background: var(--card); color: var(--ink); border-radius: 5px; padding: 7px 12px; font-weight: 650; }
button:not(:disabled):hover { border-color: #8c98c5; }
.quiet { background: transparent; }
.primary { background: var(--green); color: #fffaf0; border-color: var(--green); }
.primary:not(:disabled):hover { background: #35614f; border-color: #35614f; }

.welcome {
  max-width: 1660px; min-height: calc(100svh - 66px); margin: auto;
  display: grid; grid-template-columns: minmax(300px, 440px) minmax(0, 1fr);
  align-items: stretch; gap: clamp(24px, 5vw, 90px); padding: clamp(18px, 3vw, 43px) clamp(16px, 4vw, 65px);
}
.welcome-side { display: grid; align-content: center; padding-block: 12px; }
.welcome h1 {
  margin: 0 0 16px; font: 700 clamp(70px, 8.7vw, 132px)/.79 var(--heading);
  letter-spacing: -.032em; text-transform: uppercase;
}
.welcome h1 span { color: var(--red); }
.intro { margin: 6px 0 23px; max-width: 34ch; color: var(--muted); }
.welcome-photo {
  margin: 0; min-height: 390px; position: relative; overflow: hidden; isolation: isolate;
  background: #433c2b; border-radius: 7px; box-shadow: 0 5px 20px #23180919;
}
.welcome-photo img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: 57% 50%; }
.welcome-photo figcaption {
  position: absolute; right: 9px; bottom: 9px; color: #fff7e8; font-size: 10px;
  background: #181e18dc; padding: 3px 6px; border-radius: 2px;
}
.watch { position: absolute; bottom: 17px; left: 16px; background: var(--signal); border-color: var(--signal); box-shadow: 0 3px 16px #0005; }
.watch span { margin-right: 4px; }
#watch { width: min(655px, calc(100vw - 24px)); }
#watch-track { display: block; width: min(100%, 64svh); aspect-ratio: 1; margin: 12px auto; border-radius: 4px; background: #19182e; }
@media (max-width: 460px) { .watch { top: 8px; bottom: auto; left: 8px; min-height: 34px; padding: 5px 8px; font-size: 12px; } }
.setup { width: min(100%, 400px); }
.form-tabs { display: flex; border-bottom: 1px solid var(--line); margin-bottom: 14px; }
.tab { padding: 8px 12px 10px; margin-bottom: -1px; background: none; border: 0; border-bottom: 2px solid transparent; border-radius: 0; color: var(--muted); }
.tab.selected { border-bottom-color: var(--red); color: var(--ink); }
label { display: grid; gap: 5px; color: var(--muted); font-weight: 600; font-size: 13px; }
input, select { width: 100%; min-height: 42px; border: 1px solid #bdbca9; border-radius: 5px; background: var(--card); color: var(--ink); padding: 8px 10px; }
.setup form { display: grid; gap: 11px; }
.setup form button { margin-top: 3px; text-align: left; }
.setup-foot { margin: 11px 0 0; color: var(--muted); font-size: 12px; }
.setup-foot span { margin-inline: 4px; }

.table {
  --board-limit: max(520px, calc(100svh - 180px));
  max-width: min(1510px, calc(var(--board-limit) + 344px + 2 * clamp(14px, 3vw, 44px)));
  margin: auto; padding: 16px clamp(14px, 3vw, 44px) 28px;
}
.table-heading { display: flex; justify-content: space-between; align-items: end; gap: 10px; margin-bottom: 12px; }
.table-heading h1 { margin: 0; font: 700 clamp(31px, 4vw, 52px)/.9 var(--heading); text-transform: uppercase; }
.eyebrow { margin: 5px 0 0; color: var(--muted); font-size: 12px; font-weight: 650; }
.table-heading .quiet { font-size: 13px; }
.table-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(245px, 326px); align-items: start; gap: 17px; }
.board {
  container-type: inline-size; aspect-ratio: 1; display: grid; min-width: 0;
  grid-template: repeat(11, minmax(0, 1fr)) / repeat(11, minmax(0, 1fr)); gap: 3px;
  border: 1px solid #17392f; border-radius: 9px; padding: 6px; background: #234439;
  box-shadow: 0 4px 0 #17392f, 0 13px 26px #17271b27;
}
.infield { grid-area: 2 / 2 / 11 / 11; position: relative; overflow: hidden; isolation: isolate; background: #171b2d; border-radius: 3px; }
.infield canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
.track-caption {
  position: absolute; top: 12px; left: 12px; display: inline-flex; align-items: center; gap: 7px;
  background: #152b25; color: #fff9e6; padding: 5px 9px; border-radius: 3px; font: 700 clamp(13px, 2.8cqw, 20px)/1 var(--heading); letter-spacing: .06em; text-transform: uppercase;
}
.track-caption .finish-mark { width: 15px; height: 10px; color: var(--signal); background-size: 6px 6px; }
.dice { position: absolute; top: 10px; right: 10px; display: flex; gap: 4px; }
.die {
  display: grid; place-items: center; width: clamp(22px, 6cqw, 43px); aspect-ratio: 1;
  border-radius: 5px; background: #fff7e7; color: #1e3328; box-shadow: 0 3px 0 #877e66;
  font: clamp(18px, 5.7cqw, 40px)/1 var(--body);
}
.tile {
  min-width: 0; min-height: 0; position: relative; display: grid; align-content: start; gap: 2px; overflow: hidden;
  padding: 4px clamp(2px, .68cqw, 6px); border: 0; border-top: clamp(3px, .8cqw, 7px) solid var(--tile, #9ba99a); border-radius: 3px;
  background: #f6efda; color: #1b2c24; line-height: 1.04; text-align: left; box-shadow: inset 0 -2px #9e987d40;
}
.tile:not(:disabled):hover { border-color: var(--tile); background: #fff9e7; box-shadow: inset 0 0 0 2px #466458; }
.tile:focus-visible { z-index: 1; outline: 2px solid #a33228; outline-offset: -2px; }
.tile-name { font: 700 clamp(8px, 1.85cqw, 14px)/1 var(--heading); overflow-wrap: anywhere; }
.tile-price { color: #536155; font-size: clamp(6px, 1.3cqw, 10px); font-variant-numeric: tabular-nums; }
.tile.special { background: #e0e6cf; --tile: #a6b196; }
.tile.corner { background: #cbd7b7; --tile: #9cac82; }
.tile.start { background: #e4edab; --tile: #b0c45c; }
.tile.current { background: #fff2b8; box-shadow: inset 0 0 0 2px #aa3929; }
.markers { position: absolute; bottom: 3px; left: 3px; right: 12px; display: flex; flex-wrap: wrap; gap: 2px; pointer-events: none; }
.peg { display: inline-block; width: clamp(7px, 1.7cqw, 13px); height: clamp(7px, 1.7cqw, 13px); background: var(--peg); border: 1px solid #233c2d; border-radius: 50%; box-shadow: 0 1px 1px #17231855; }
.owner-mark { position: absolute; bottom: 4px; right: 3px; color: #203126; background: var(--owner); border-radius: 2px; padding-inline: 2px; font-size: 9px; font-weight: 800; line-height: 1.14; }
.owner-mark:empty { display: none; }

.side { display: grid; min-width: 0; gap: 11px; }
.panel { padding: 13px 15px; background: var(--card); border: 1px solid var(--line); border-radius: 7px; }
.panel h2 { margin: 0 0 8px; font: 700 27px/1 var(--heading); }
.panel p { margin: 0 0 10px; color: var(--muted); font-size: 13px; }
.panel p:last-child { margin-bottom: 0; }
.turn-panel { min-height: 118px; background: var(--green); color: var(--card); border-color: var(--green); border-top: 4px solid var(--signal); }
.turn-panel p { color: #e3e9d9; }
.turn-panel .primary { background: var(--signal); border-color: var(--signal); color: #1e2d21; }
.turn-panel .primary:not(:disabled):hover { background: #f1f8b5; border-color: #f1f8b5; }
.turn-panel :focus-visible { outline-color: var(--signal); }
.turn-panel details { margin: 9px 0 1px; }
.turn-panel summary { cursor: pointer; color: var(--signal); font-size: 13px; }
.turn-panel form { display: grid; gap: 7px; margin-top: 6px; }
.turn-panel label { color: #f2f2dd; }
.move-buttons { display: flex; flex-wrap: wrap; gap: 6px; }
.player-row { display: grid; grid-template-columns: 10px minmax(0, 1fr) auto; gap: 7px; align-items: center; border-top: 1px solid var(--line); padding: 6px 0; font-size: 13px; }
.player-row .peg { width: 10px; height: 10px; }
.player-row strong { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.player-row.active strong { color: var(--red); }
.player-row b { font-size: 12px; font-variant-numeric: tabular-nums; }
.player-row small { color: var(--muted); font-size: 11px; }
.player-row br { display: none; }
.journal ol { margin: 0; padding: 0; list-style: none; max-height: 169px; overflow: auto; }
.journal li { padding: 6px 0; border-top: 1px solid var(--line); font-size: 12px; color: var(--muted); }
.journal li:first-child { color: var(--ink); font-weight: 650; }
.leave { justify-self: start; }
.notice { position: fixed; z-index: 2; bottom: 14px; left: 50%; transform: translateX(-50%); width: max-content; max-width: calc(100% - 24px); margin: 0; background: #30364c; color: #f0f5ff; padding: 9px 14px; border-radius: 5px; box-shadow: 0 4px 17px #0004; }
dialog { max-width: min(610px, calc(100vw - 25px)); padding: 17px 21px; border: 1px solid var(--line); border-radius: 9px; background: var(--card); color: var(--ink); box-shadow: 0 18px 75px #0006; }
dialog::backdrop { background: #080816c9; }
.dialog-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.dialog-head h2 { margin: 0; font: 700 34px/1 var(--heading); }
.dialog-head button { font-size: 23px; line-height: 1; }

@media (max-width: 850px) {
  .table { max-width: none; }
  .table-grid { grid-template-columns: 1fr; }
  .side { grid-template-columns: 1fr 1fr; }
  .turn-panel { grid-column: 1 / -1; }
}
@media (max-width: 660px) {
  .welcome { min-height: 0; grid-template-columns: 1fr; gap: 12px; }
  .welcome-side { padding: 0; }
  .welcome h1 { font-size: clamp(61px, 16vw, 100px); }
  .welcome h1 br { display: none; }
  .welcome h1 span::before { content: " "; }
  .intro { margin-bottom: 14px; }
  .welcome-photo { grid-row: 1; min-height: 0; aspect-ratio: 2 / 1; }
  .welcome-photo img { object-position: 50% 43%; }
}
@media (max-width: 460px) {
  .mast { height: 55px; }
  .connection { display: none; }
  .table { padding-inline: 9px; padding-top: 12px; }
  .table-grid, .side { gap: 8px; }
  .board { gap: 2px; padding: 3px; }
  .tile { padding-top: 2px; }
  .tile-price { display: none; }
  .markers { left: 2px; bottom: 2px; }
  .owner-mark { bottom: 2px; right: 2px; font-size: 7px; padding-inline: 1px; }
  .panel { padding: 10px; }
  .track-caption { top: 7px; left: 7px; }
  .dice { top: 7px; right: 7px; }
}


.sound { display: inline-flex; align-items: center; gap: 6px; }
.sound::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: #837d70; }
.sound[aria-pressed="true"] { background: var(--green); color: var(--card); border-color: var(--green); }
.sound[aria-pressed="true"]::before { background: var(--signal); }
@media (max-width: 460px) {
  .mast-actions { gap: 6px; }
  .mast-actions button { padding-inline: 8px; font-size: 12px; }
  .wordmark { font-size: 20px; gap: 7px; }
}

.eras {
  display: flex; align-items: center; gap: 9px; margin: 0 0 18px;
  color: var(--muted); font-size: 12px; font-weight: 700; letter-spacing: .08em;
}
.eras span { width: 13px; height: 1px; background: var(--red); }
.welcome { grid-template-columns: minmax(305px, 420px) minmax(0, 1fr); }
.welcome h1 { transform: skew(-7deg); transform-origin: left bottom; line-height: .94; letter-spacing: -.013em; }
.welcome h1 span { color: var(--signal); }
.welcome-photo {
  background: #211a36; border: 1px solid #494762; border-radius: 4px;
  box-shadow: 0 17px 45px #0006; isolation: isolate;
}
.welcome-photo img { object-position: 50% 49%; }
.welcome-photo::after {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(180deg, #12102398, transparent 29%, transparent 66%, #0d102b99);
}
.welcome-photo .watch, .welcome-photo figcaption, .hero-car { z-index: 1; }
.hero-car {
  position: absolute; top: 18px; left: 20px; display: grid; gap: 2px;
  padding: 8px 13px; color: #f5f4ff; background: #131526df; border-left: 3px solid var(--red);
}
.hero-car span { color: #d4caed; font-size: 12px; font-weight: 650; }
.hero-car strong { font: 700 clamp(22px, 3vw, 42px)/1 var(--heading); text-transform: uppercase; }
.watch, .watch:not(:disabled):hover { color: #151725; }
.intro { max-width: 39ch; }
.primary { color: #10232c; background: var(--signal); border-color: var(--signal); }
.primary:not(:disabled):hover { color: #10232c; background: #b4fcff; border-color: #b4fcff; }
.tab.selected { border-bottom-color: var(--signal); }
input, select { border-color: #454762; }
.turn-panel { background: #22253c; border-color: #353952; border-top-color: var(--signal); }
.turn-panel p { color: #e2e4f2; }
.turn-panel label { color: #eef2fb; }
.turn-panel .primary { color: #121a26; }
.turn-panel .primary:not(:disabled):hover { background: #b4fcff; border-color: #b4fcff; }
.board { background: #30364d; border-color: #4b5068; box-shadow: 0 4px 0 #1d2037, 0 13px 28px #0005; }
.tile { background: #e6e5f0; color: #171c2c; }
.tile.special { background: #c9d0df; --tile: #8896ba; }
.tile.corner { background: #afb9d0; --tile: #788bb2; }
.tile.start { background: #aee4df; --tile: #5eece0; }
.tile.current { background: #fdeab8; box-shadow: inset 0 0 0 2px #ec673d; }
.tile:not(:disabled):hover { background: #fff8e8; }
.tile-price { color: #43516a; }
.track-caption { background: #111325e8; color: #edf5ff; }
.owner-mark { color: #171c2c; }
.player-row { grid-template-columns: 27px minmax(0, 1fr) auto; gap: 8px; }
.player-row.active strong { color: #ff94ba; }
.driver {
  display: grid; place-items: center; width: 27px; height: 27px;
  border-radius: 3px; color: #191a29; background: var(--peg);
  font: 700 16px/1 var(--heading);
}
.sound[aria-pressed="true"] { background: var(--signal); color: #152632; border-color: var(--signal); }
.sound[aria-pressed="true"]::before { background: #21574f; }
.car-portrait { margin: 0 0 9px; overflow: hidden; border: 1px solid #484967; border-top: 3px solid var(--stable); border-radius: 4px; background: #191a2c; }
.car-portrait canvas { display: block; width: 100%; height: auto; }
.car-portrait figcaption { display: flex; justify-content: space-between; gap: 6px; padding: 6px 8px; color: #d1d7ee; font-size: 11px; }
.car-portrait figcaption strong { color: #f5f4ff; }
.car-detail { width: min(530px, calc(100vw - 25px)); }
.car-detail .car-portrait { margin-top: 10px; }
#scenes { width: min(565px, calc(100vw - 24px)); }
.scene-list { display: grid; gap: 8px; margin: 15px 0; }
.scene-card {
  display: grid; grid-template-columns: minmax(0, 1fr) auto auto; align-items: center; gap: 4px 8px;
  padding: 8px 10px; background: #252840; border: 1px solid #454762; border-radius: 4px;
}
.scene-card span { grid-column: 1 / -1; color: var(--muted); font-size: 11px; }
.scene-card button { min-height: 31px; padding: 4px 7px; font-size: 12px; white-space: nowrap; }
.scene-card a { color: var(--signal); font-size: 11px; white-space: nowrap; }
#scene-player iframe { display: block; width: 100%; aspect-ratio: 16 / 9; border: 0; border-radius: 4px; background: #0a0b17; }
.soundboard h3 { margin-bottom: 7px; font-size: 13px; color: var(--muted); }
.soundboard button { margin: 0 4px 4px 0; }
@media (max-width: 660px) {
  .welcome { grid-template-columns: 1fr; }
  .welcome h1 { font-size: clamp(59px, 15vw, 100px); }
  .welcome-photo img { object-position: 48% 53%; }
  .hero-car { top: auto; bottom: 9px; left: 9px; padding: 4px 7px; }
  .hero-car span { font-size: 10px; }
  .hero-car strong { font-size: 19px; }
  .eras { margin-bottom: 10px; }
}
@media (max-width: 460px) {
  .mast-actions { gap: 4px; }
  .mast-actions button { padding-inline: 6px; }
  .wordmark { font-size: 18px; letter-spacing: 0; }
  .brand-icon { width: 26px; height: 25px; }
  .brand-icon::before { width: 16px; height: 12px; background-size: 7px 7px; }
}
