/* ==========================================================================
   PistonType — vintage motorsport poster theme
   ========================================================================== */

/* Fonts are served from this site (OFL licensed, see /fonts/OFL-LICENSE.txt):
   no visitor data goes to a third-party font service. */
@font-face { font-family: 'Alfa Slab One'; src: url('/fonts/AlfaSlabOne-Regular.ttf') format('truetype'); font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: 'Barlow Condensed'; src: url('/fonts/BarlowCondensed-Medium.ttf') format('truetype'); font-weight: 500; font-style: normal; font-display: swap; }
@font-face { font-family: 'Barlow Condensed'; src: url('/fonts/BarlowCondensed-SemiBold.ttf') format('truetype'); font-weight: 600; font-style: normal; font-display: swap; }
@font-face { font-family: 'Barlow Condensed'; src: url('/fonts/BarlowCondensed-Bold.ttf') format('truetype'); font-weight: 700; font-style: normal; font-display: swap; }
@font-face { font-family: 'Barlow Condensed'; src: url('/fonts/BarlowCondensed-ExtraBold.ttf') format('truetype'); font-weight: 800; font-style: normal; font-display: swap; }
@font-face { font-family: 'Barlow'; src: url('/fonts/Barlow-Regular.ttf') format('truetype'); font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: 'Barlow'; src: url('/fonts/Barlow-Medium.ttf') format('truetype'); font-weight: 500; font-style: normal; font-display: swap; }
@font-face { font-family: 'Barlow'; src: url('/fonts/Barlow-SemiBold.ttf') format('truetype'); font-weight: 600; font-style: normal; font-display: swap; }
@font-face { font-family: 'Barlow'; src: url('/fonts/Barlow-Bold.ttf') format('truetype'); font-weight: 700; font-style: normal; font-display: swap; }
@font-face { font-family: 'Courier Prime'; src: url('/fonts/CourierPrime-Regular.ttf') format('truetype'); font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: 'Courier Prime'; src: url('/fonts/CourierPrime-Bold.ttf') format('truetype'); font-weight: 700; font-style: normal; font-display: swap; }

:root {
  --paper: #f1e6cc;
  --paper-light: #fbf5e6;
  --paper-dark: #e3d2aa;
  --ink: #1d1915;
  --ink-2: #3a322b;
  --muted: #74624f;
  --red: #d0202e;
  --red-dark: #9e1420;
  --green: #0f5a43;
  --green-dark: #093b2c;
  --mustard: #f0a818;
  --mustard-dark: #c78608;
  --blue: #8fc3e6;
  --orange: #f26a1b;
  --silver: #b9b4aa;
  --bronze: #b8743a;
  --cream: #f4ead5;
  --asphalt: #2c2a2d;

  --font-display: 'Alfa Slab One', 'Rockwell', Georgia, serif;
  --font-cond: 'Barlow Condensed', 'Arial Narrow', sans-serif;
  --font-body: 'Barlow', system-ui, sans-serif;
  --font-type: 'Courier Prime', 'Courier New', monospace;

  --radius: 8px;
  --shadow: 5px 5px 0 var(--ink);
  --shadow-sm: 3px 3px 0 var(--ink);
  --border: 2.5px solid var(--ink);
  --car-w: 128px;
  --noise: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .35 0 0 0 0 .25 0 0 0 0 .12 0 0 0 .13 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  color-scheme: light;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; }
html { scroll-behavior: smooth; }

body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--noise), radial-gradient(120% 80% at 50% 0%, var(--paper-light), var(--paper) 55%, var(--paper-dark));
  background-attachment: fixed;
  color: var(--ink);
  font: 500 17px/1.5 var(--font-body);
}

h1, h2, h3 { margin: 0; line-height: 1.1; font-family: var(--font-display); font-weight: 400; letter-spacing: .01em; }
p { margin: 0 0 .75rem; }
a { color: inherit; }
.muted { color: var(--muted); }
.small { font-size: .9rem; }
.lead { font-size: 1.1rem; font-weight: 600; }
.center { text-align: center; }

/* ---------- header / footer ---------- */

.site-header {
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  padding: .7rem max(1rem, calc((100% - 1140px) / 2));
  background: var(--ink); color: var(--cream);
}
.logo { display: flex; align-items: center; gap: .65rem; text-decoration: none; }
.logo-mark { width: 44px; height: 44px; flex: none; transition: transform .6s; }
.logo:hover .logo-mark { transform: rotate(-90deg); }
.logo-words { display: grid; line-height: 1; }
.logo-title { font-family: var(--font-display); font-size: 1.35rem; text-transform: uppercase; letter-spacing: .03em; }
.logo-kicker {
  font-family: var(--font-cond); font-weight: 700; font-size: .78rem; letter-spacing: .38em;
  text-transform: uppercase; color: var(--mustard);
}

.checker-strip {
  height: 14px; flex: none;
  background: conic-gradient(var(--ink) 25%, var(--cream) 0 50%, var(--ink) 0 75%, var(--cream) 0) 0 0 / 14px 14px;
  border-bottom: 2px solid var(--ink);
}
.site-footer { margin-top: auto; text-align: center; }
.site-footer .checker-strip { border-bottom: 0; border-top: 2px solid var(--ink); }
.site-footer p {
  margin: 0; padding: 1rem; background: var(--ink); color: var(--cream);
  font-family: var(--font-cond); font-weight: 600; letter-spacing: .2em; text-transform: uppercase; font-size: .85rem;
}

.lang-select {
  appearance: none; min-width: 168px; max-width: 48vw; padding: .45rem 2.4rem .45rem .9rem; border-radius: 999px;
  border: 2px solid var(--cream); background: transparent; color: var(--cream);
  font: 700 .95rem var(--font-cond); letter-spacing: .05em; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' fill='none' stroke='%23f4ead5' stroke-width='2'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right .7rem center; background-size: 11px;
}
.lang-select option { color: var(--ink); background: var(--paper-light); }
.header-tools { display: flex; align-items: center; gap: .6rem; }
.settings-btn {
  display: grid; place-items: center; width: 42px; height: 42px; border-radius: 50%; cursor: pointer;
  border: 2px solid var(--cream); background: transparent; color: var(--cream); transition: transform .3s, background .2s;
}
.settings-btn:hover { background: rgba(244, 234, 213, .12); transform: rotate(45deg); }

/* ---------- settings dialog ---------- */
.prefs {
  width: min(440px, calc(100% - 2rem)); padding: 0; border: var(--border); border-radius: var(--radius);
  background: var(--paper-light); color: var(--ink); box-shadow: var(--shadow);
}
.prefs::backdrop { background: rgba(29, 25, 21, .55); }
.prefs-body { display: grid; gap: 1.1rem; padding: 1.4rem; }
.prefs-title { font-size: 1.6rem; text-transform: uppercase; padding-bottom: .6rem; border-bottom: var(--border); }
.prefs-group { display: grid; gap: .7rem; }
.prefs-section { margin: 0; font: 800 .85rem var(--font-cond); letter-spacing: .16em; text-transform: uppercase; color: var(--muted); }
.prefs-row { display: grid; grid-template-columns: 6.5rem 1fr 3.4rem; align-items: center; gap: .7rem; font: 700 1rem var(--font-cond); letter-spacing: .06em; text-transform: uppercase; }
.prefs-row output { font: 700 .95rem var(--font-type); text-align: right; }
.prefs-row input[type=range] {
  appearance: none; height: 12px; border-radius: 999px; border: 2px solid var(--ink); cursor: pointer;
  background: linear-gradient(90deg, var(--red) var(--fill, 50%), #fffaf0 var(--fill, 50%));
}
.prefs-row input[type=range]::-webkit-slider-thumb {
  appearance: none; width: 22px; height: 22px; border-radius: 50%; background: var(--mustard); border: 2px solid var(--ink); box-shadow: 2px 2px 0 var(--ink);
}
.prefs-row input[type=range]::-moz-range-thumb { width: 20px; height: 20px; border-radius: 50%; background: var(--mustard); border: 2px solid var(--ink); }
.prefs-check { display: flex; align-items: center; gap: .6rem; font-weight: 600; cursor: pointer; }
.prefs-check input { width: 20px; height: 20px; accent-color: var(--red); }
.prefs .btn { justify-self: end; }

.banner {
  position: sticky; top: 0; z-index: 20; padding: .6rem 1rem; text-align: center;
  background: repeating-linear-gradient(-45deg, var(--red) 0 18px, var(--red-dark) 18px 36px);
  color: var(--cream); font: 700 1rem var(--font-cond); letter-spacing: .08em; text-transform: uppercase;
}

/* ---------- layout ---------- */

.container { width: 100%; max-width: 1140px; margin: 0 auto; padding: 1.5rem 1rem 3rem; display: grid; gap: 2rem; }
.container > section { display: grid; gap: 1.25rem; min-width: 0; }

.card {
  background: var(--paper-light); border: var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 1.4rem; min-width: 0;
}
.card-title { font-size: 1.35rem; text-transform: uppercase; margin-bottom: 1rem; }
.card-lead { margin-bottom: 1.1rem; }

.step { gap: 1rem !important; }
.step-title { display: flex; align-items: center; gap: .75rem; font-size: clamp(1.5rem, 3.5vw, 2rem); text-transform: uppercase; }
.step-no, .roundel {
  display: inline-grid; place-items: center; flex: none;
  width: 2.6rem; height: 2.6rem; border-radius: 50%;
  background: var(--cream); border: var(--border); box-shadow: inset 0 0 0 3px var(--cream), inset 0 0 0 5px var(--ink);
  font: 400 1.25rem/1 var(--font-display); color: var(--ink);
}
.step-no { background: var(--red); color: var(--cream); box-shadow: inset 0 0 0 3px var(--red), inset 0 0 0 5px var(--cream); }
.roundel-sm { width: 2rem; height: 2rem; font-size: .95rem; box-shadow: none; }
.roundel-lg { width: 5rem; height: 5rem; font-size: 2.5rem; margin: 0 auto .75rem; }
.roundel-red { background: var(--red); color: var(--cream); box-shadow: inset 0 0 0 4px var(--red), inset 0 0 0 7px var(--cream); }

/* ---------- hero poster ---------- */

.hero {
  position: relative; overflow: hidden; text-align: center; justify-items: center;
  padding: 2.75rem 1.25rem 7.5rem; gap: .9rem !important;
  border: var(--border); border-radius: var(--radius); box-shadow: var(--shadow);
  color: var(--cream);
  background:
    var(--noise),
    repeating-conic-gradient(from -90deg at 50% 115%, rgba(0, 0, 0, .1) 0 4.5deg, transparent 4.5deg 9deg),
    radial-gradient(90% 90% at 50% 100%, #e5303d, var(--red) 55%, var(--red-dark));
}
.hero-kicker {
  display: inline-flex; align-items: center; gap: .6rem; margin: 0;
  padding: .3rem 1rem; background: var(--ink); color: var(--mustard);
  font: 700 .95rem var(--font-cond); letter-spacing: .25em; text-transform: uppercase;
  clip-path: polygon(0 0, 100% 0, calc(100% - 10px) 50%, 100% 100%, 0 100%, 10px 50%);
  padding-inline: 1.6rem;
}
.hero-title {
  font-size: clamp(2.8rem, 10vw, 6.2rem); text-transform: uppercase; line-height: .95;
  color: var(--cream); letter-spacing: .01em;
  text-shadow: 3px 3px 0 var(--ink), 6px 6px 0 var(--mustard), 9px 9px 0 var(--ink);
  transform: skewX(-6deg);
}
.hero-tagline {
  margin: .5rem 0 .6rem; font: 700 clamp(1.1rem, 2.6vw, 1.45rem) var(--font-cond);
  letter-spacing: .12em; text-transform: uppercase;
}
.hero-road {
  position: absolute; left: 0; right: 0; bottom: 0; height: 74px;
  background:
    linear-gradient(90deg, transparent 0 50%, var(--cream) 50%) 0 50% / 56px 4px repeat-x,
    var(--noise), var(--asphalt);
  border-top: 8px solid transparent;
  border-image: repeating-linear-gradient(90deg, var(--cream) 0 24px, var(--red-dark) 24px 48px) 8;
}
.hero-car { position: absolute; bottom: 6px; width: 190px; left: -220px; animation: drive-by 7.5s linear infinite; }
.hero-car::before {
  content: ''; position: absolute; right: 92%; top: 30%; width: 140px; height: 40%;
  background: repeating-linear-gradient(180deg, rgba(244, 234, 213, .55) 0 2px, transparent 2px 8px);
  -webkit-mask-image: linear-gradient(90deg, transparent, #000); mask-image: linear-gradient(90deg, transparent, #000);
}
@keyframes drive-by { to { left: calc(100% + 40px); } }

/* ---------- buttons ---------- */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .45rem;
  padding: .6rem 1.2rem; border: var(--border); border-radius: var(--radius);
  background: var(--paper-light); color: var(--ink); box-shadow: var(--shadow-sm);
  font: 800 1.05rem/1.1 var(--font-cond); letter-spacing: .08em; text-transform: uppercase;
  text-decoration: none; cursor: pointer; transition: transform .08s, box-shadow .08s, filter .15s;
}
.btn:hover { transform: translate(-1px, -1px); box-shadow: 4px 4px 0 var(--ink); }
.btn:active { transform: translate(2px, 2px); box-shadow: 1px 1px 0 var(--ink); }
.btn:focus-visible { outline: 3px solid var(--mustard); outline-offset: 3px; }
.btn-red { background: var(--red); color: var(--cream); }
.btn-green { background: var(--green); color: var(--cream); }
.btn-mustard { background: var(--mustard); color: var(--ink); }
.btn-ghost { background: transparent; box-shadow: none; }
.btn-ghost:hover { background: rgba(29, 25, 21, .06); box-shadow: none; transform: none; }
.btn-small { padding: .4rem .8rem; font-size: .9rem; }
.btn-lg { padding: .8rem 1.6rem; font-size: 1.2rem; }
.btn-xl { padding: 1rem 2.4rem; font-size: 1.5rem; letter-spacing: .12em; }
.btn-block { width: 100%; }

/* ---------- form controls ---------- */

.field { display: grid; gap: .35rem; }
.field-label { font: 700 .85rem var(--font-cond); letter-spacing: .14em; text-transform: uppercase; color: var(--muted); }
.input {
  width: 100%; padding: .6rem .8rem; border: var(--border); border-radius: 6px;
  background: #fffaf0; color: var(--ink); font: 600 1rem var(--font-body);
}
.input:focus { outline: 3px solid var(--mustard); outline-offset: 1px; }
.input:disabled { background: var(--paper); color: var(--muted); }
select.input {
  appearance: none; padding-right: 2.2rem; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' fill='none' stroke='%231d1915' stroke-width='2.2'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right .8rem center; background-size: 12px;
}
.input-lg { font: 700 1.35rem var(--font-cond); letter-spacing: .04em; padding: .75rem 1rem; }
.input-small { width: 5.5rem; display: inline-block; }
.input-row { display: flex; gap: .6rem; }
.input-row .input { flex: 1; min-width: 0; }
.code-input { font: 400 1.25rem var(--font-display); letter-spacing: .3em; text-transform: uppercase; }
.error { color: var(--red); margin: .6rem 0 0; font-weight: 700; }

/* ---------- home: mode cards ---------- */

.mode-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 1.5rem; }
.mode-card {
  display: flex; flex-direction: column; overflow: hidden;
  background: var(--paper-light); border: var(--border); border-radius: var(--radius); box-shadow: var(--shadow);
}
.mode-head {
  display: flex; align-items: center; gap: .9rem; padding: 1.1rem 1.4rem;
  color: var(--cream); border-bottom: var(--border);
  background: var(--noise), repeating-linear-gradient(-45deg, rgba(0, 0, 0, .08) 0 10px, transparent 10px 20px), var(--c);
}
.mode-head h3, .mode-head h1 { font-size: 1.6rem; text-transform: uppercase; text-shadow: 2px 2px 0 var(--ink); }
.mode-red { --c: var(--red); }
.mode-green { --c: var(--green); }
.mode-icon { width: 46px; height: 46px; flex: none; color: var(--ink); filter: drop-shadow(2px 2px 0 var(--ink)); }
.mode-body { display: flex; flex-direction: column; gap: .8rem; padding: 1.4rem; flex: 1; }
.mode-body > p { flex: 1; margin: 0; }
.join-form { display: grid; gap: .45rem; margin-top: .4rem; padding-top: 1rem; border-top: 2px dashed var(--ink-2); }

/* ---------- garage ---------- */

/* Platform on the left (stays in view while scrolling), options on the right. */
.garage { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); gap: 1.5rem; align-items: start; }
.garage-stage {
  position: sticky; top: 1rem; display: grid; place-items: end center;
  min-height: clamp(300px, 34vw, 440px); padding: 3.6rem 1rem 1.6rem;
  border: var(--border); border-radius: var(--radius); overflow: hidden;
  background:
    var(--noise),
    linear-gradient(180deg, transparent 80%, rgba(29, 25, 21, .2) 80%),
    repeating-conic-gradient(from -90deg at 50% 100%, var(--mustard) 0 5deg, #f6c757 5deg 10deg);
}

/* The car stands on a platform, seen from the side. */
.garage-platform { position: relative; width: min(90%, 560px); margin-bottom: 2.4rem; }
.garage-platform::after {
  content: ''; position: absolute; left: 4%; right: 4%; bottom: -2.6rem; height: 3.4rem; z-index: 0;
  border-radius: 50%; background: radial-gradient(closest-side, #3a322b, var(--ink));
  box-shadow: 0 0 0 5px var(--cream), 0 0 0 8px var(--ink), 0 14px 18px rgba(0, 0, 0, .25);
}
.garage-preview { position: relative; z-index: 1; }

/* The driver stands on the floor in front of the platform. */
.garage-driver {
  position: absolute; z-index: 2; left: 6%; bottom: .6rem;
  width: clamp(120px, 14vw, 200px); transition: opacity .25s, transform .25s;
  animation: idle-bob 2.6s ease-in-out infinite;
}
.garage-driver .drv-arm-r { animation: wave .7s ease-in-out infinite alternate; }
.driver-hidden .garage-driver { opacity: 0; transform: translateY(16px); animation: none; pointer-events: none; }

.garage-random, .garage-hide-driver { position: absolute; top: .7rem; z-index: 3; }
.garage-random { right: .7rem; }
.garage-hide-driver { left: .7rem; padding: .4rem .55rem; }
.garage-hide-driver .eye-slash { opacity: 0; }
.garage-hide-driver[aria-pressed="true"] { background: var(--ink); color: var(--cream); }
.garage-hide-driver[aria-pressed="true"] .eye-slash { opacity: 1; }
@keyframes idle-bob { 50% { transform: translateY(-3px); } }
@keyframes wave { from { transform: rotate(-14deg); } to { transform: rotate(12deg); } }

.tabs { display: flex; gap: .3rem; flex-wrap: wrap; border-bottom: var(--border); padding-left: .3rem; }
.tab {
  margin-bottom: -2.5px; padding: .5rem .85rem; border: var(--border); border-bottom: 0;
  border-radius: 8px 8px 0 0; background: var(--paper-dark); color: var(--ink-2);
  font: 800 .92rem var(--font-cond); letter-spacing: .08em; text-transform: uppercase; cursor: pointer;
}
.tab:hover { background: var(--paper); }
.tab.is-active { background: var(--red); color: var(--cream); padding-bottom: calc(.5rem + 2.5px); }
.tab:disabled { opacity: .4; cursor: not-allowed; background: var(--paper-dark); }
.garage-note { margin-top: 1rem; }
/* The second row reuses the folder-tab look of the first. */
.subtabs { margin-top: .9rem; }
.tab-body { padding-top: .9rem; }

.garage-section + .garage-section { margin-top: 1.1rem; }
.garage-section-title {
  margin: 0 0 .55rem; font: 800 .85rem var(--font-cond); letter-spacing: .16em; text-transform: uppercase; color: var(--muted);
  display: flex; align-items: center; gap: .6rem;
}
.garage-section-title::after { content: ''; flex: 1; border-top: 2px dashed rgba(29, 25, 21, .25); }

.option-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(112px, 1fr)); gap: .65rem; }
.option-grid-driver { grid-template-columns: repeat(auto-fill, minmax(82px, 1fr)); }
.option-grid-wheel { grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); }
.option {
  display: grid; gap: .25rem; justify-items: center; align-content: start; padding: .55rem .4rem .45rem;
  border: 2px solid var(--ink); border-radius: 6px; background: #fffaf0; color: var(--ink);
  box-shadow: 2px 2px 0 var(--ink); cursor: pointer; transition: transform .08s, box-shadow .08s;
}
.option:hover { transform: translate(-1px, -1px); box-shadow: 3px 3px 0 var(--ink); }
.option.is-active { background: var(--mustard); box-shadow: inset 0 0 0 2px var(--ink), 2px 2px 0 var(--ink); }
.option-art { width: 100%; }
.option-driver .option-art { width: 44px; }
.option-wheel .option-art { width: 58px; }
.option-label { font: 700 .8rem/1.15 var(--font-cond); letter-spacing: .06em; text-transform: uppercase; text-align: center; }
.number-field { display: inline-flex; align-items: center; gap: .6rem; margin-top: 1rem; font: 700 1rem var(--font-cond); letter-spacing: .1em; text-transform: uppercase; }

.color-row { display: grid; gap: .45rem; margin-bottom: 1.1rem; }
.color-label { font: 800 .85rem var(--font-cond); letter-spacing: .16em; text-transform: uppercase; color: var(--muted); }
.swatches { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }
.swatch {
  width: 34px; height: 34px; padding: 0; border-radius: 50%; cursor: pointer;
  border: 2px solid var(--ink); background: var(--c); box-shadow: inset 0 0 0 2px rgba(255, 255, 255, .35);
  transition: transform .1s;
}
.swatch:hover { transform: scale(1.1); }
.swatch.is-active { outline: 3px solid var(--red); outline-offset: 2px; }
.swatch-divider { width: 2px; height: 26px; margin: 0 .15rem; background: var(--ink); opacity: .25; }
.swatch-palette {
  position: relative; display: inline-flex; align-items: center; gap: .45rem; padding: 3px .8rem 3px 3px;
  border: 2px solid var(--ink); border-radius: 999px; background: #fffaf0; box-shadow: 2px 2px 0 var(--ink); cursor: pointer;
}
.swatch-palette::before {
  content: ''; width: 28px; height: 28px; border-radius: 50%; border: 2px solid var(--ink);
  background:
    radial-gradient(circle, var(--c) 0 36%, transparent 38%),
    conic-gradient(#d0202e, #f0a818, #f4e04d, #3d9a5b, #8fc3e6, #1f4e9c, #6b2d5c, #d0202e);
}
.swatch-palette.is-active { outline: 3px solid var(--red); outline-offset: 2px; }
.swatch-palette input { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; border: 0; padding: 0; }
.swatch-palette-label { font: 800 .82rem var(--font-cond); letter-spacing: .12em; text-transform: uppercase; }

/* Driver figure details shared by the garage and the podium */
.driver-svg { display: block; width: 100%; height: auto; overflow: visible; }
.drv-scarf { transform-origin: 36px 28px; animation: flutter .45s ease-in-out infinite alternate; }
@keyframes flutter { from { transform: rotate(-6deg) scaleX(.92); } to { transform: rotate(5deg) scaleX(1.05); } }

/* ---------- cars ---------- */

.car { position: relative; }
.car-svg { display: block; width: 100%; height: auto; overflow: visible; }
.car-svg.is-ghost { opacity: .5; filter: grayscale(.6) sepia(.4); }
.wheel-spin { transform-box: fill-box; transform-origin: center; }
.car.moving .wheel-spin { animation: spin .32s linear infinite; }
.car-exhaust { opacity: 0; transition: opacity .2s; transform-box: fill-box; transform-origin: right center; }
.car.boost .car-exhaust { opacity: 1; animation: flicker .12s ease-in-out infinite alternate; }
.car-neon { animation: glow 1.6s ease-in-out infinite alternate; }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes flicker { from { transform: scaleX(.75); } to { transform: scaleX(1.1); } }
@keyframes glow { from { opacity: .65; } to { opacity: 1; } }

/* ---------- lobby ---------- */

.lobby { display: grid; gap: 1.5rem; grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr); align-items: start; }
.lobby-side { display: grid; gap: 1.5rem; }

.ticket {
  position: relative; display: grid; justify-items: center; gap: .55rem; padding: 1.4rem 1.5rem 1.5rem;
  background: var(--noise), var(--mustard); border: var(--border); border-radius: var(--radius); box-shadow: var(--shadow);
  text-align: center;
  -webkit-mask: radial-gradient(circle 13px at 0 50%, transparent 98%, #000) left / 51% 100% no-repeat,
                radial-gradient(circle 13px at 100% 50%, transparent 98%, #000) right / 51% 100% no-repeat;
          mask: radial-gradient(circle 13px at 0 50%, transparent 98%, #000) left / 51% 100% no-repeat,
                radial-gradient(circle 13px at 100% 50%, transparent 98%, #000) right / 51% 100% no-repeat;
}
.ticket::before { content: ''; position: absolute; inset: 8px; border: 2px dashed var(--ink); border-radius: 4px; pointer-events: none; }
.ticket-label { font: 800 .9rem var(--font-cond); letter-spacing: .3em; text-transform: uppercase; }
.room-code { font: 400 clamp(2.2rem, 7vw, 3rem)/1 var(--font-display); letter-spacing: .16em; padding-left: .16em; text-shadow: 2px 2px 0 var(--cream); }
.ticket .btn { position: relative; }

.grid-card { background: var(--noise), var(--asphalt); color: var(--cream); }
.grid-card .card-title { color: var(--cream); }
.grid-slots { list-style: none; margin: 0; padding: 0 0 1.75rem; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem 1.25rem; }
.slot {
  position: relative; display: grid; justify-items: center; gap: .3rem; padding: 1.6rem .75rem .9rem;
  border: 3px solid var(--cream); border-bottom: 0; min-height: 150px; align-content: end;
}
.slot:nth-child(even) { transform: translateY(1.75rem); }
.slot-no {
  position: absolute; top: .45rem; left: .55rem;
  font: 800 1.1rem var(--font-cond); letter-spacing: .08em; color: var(--mustard);
}
.slot-car { width: min(100%, 150px); }
.slot-name { font: 800 1.15rem var(--font-cond); letter-spacing: .06em; text-transform: uppercase; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.slot.is-me { border-color: var(--mustard); }
.slot.is-me .slot-name { color: var(--mustard); }
.slot.is-empty { border-style: dashed; border-color: rgba(244, 234, 213, .35); place-items: center; align-content: center; }
.slot-empty { font: 700 .95rem var(--font-cond); letter-spacing: .2em; text-transform: uppercase; color: rgba(244, 234, 213, .5); }
.badges { display: flex; gap: .3rem; flex-wrap: wrap; justify-content: center; }
.badge {
  padding: .1rem .5rem; border-radius: 3px; background: var(--cream); color: var(--ink);
  font: 800 .72rem var(--font-cond); letter-spacing: .14em; text-transform: uppercase;
}
.badge-host { background: var(--red); color: var(--cream); }
.badge-offline { background: var(--mustard); color: var(--ink); }
.slot.is-offline .slot-car, .slot.is-offline .slot-name { opacity: .4; }

.settings { display: grid; gap: .9rem; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); margin-bottom: .75rem; }
.lobby-actions { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 1rem; align-items: center; justify-content: center; margin-top: .5rem; }
.lobby-actions p { margin: 0; }

.spinner {
  width: 54px; height: 54px; margin: .5rem auto 1rem; border-radius: 50%;
  border: 6px solid var(--ink); border-top-color: var(--red); border-right-color: var(--mustard);
  animation: spin .8s linear infinite;
}
.notice {
  margin: 0; padding: .8rem 1.1rem; border: 2px dashed var(--ink-2); border-radius: 6px;
  background: rgba(255, 250, 240, .7); text-align: center; font-weight: 600;
}
.notice-ok {
  border: var(--border); background: var(--green); color: var(--cream);
  font: 800 1.2rem var(--font-cond); letter-spacing: .15em; text-transform: uppercase;
}

/* ---------- race header ---------- */

.race-head { display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap; }
.chips { display: flex; flex-wrap: wrap; gap: .45rem; }
.chip {
  padding: .3rem .75rem; border: 2px solid var(--ink); border-radius: 999px; background: var(--paper-light);
  font: 800 .85rem var(--font-cond); letter-spacing: .1em; text-transform: uppercase;
}
.chip:nth-child(2) { background: var(--mustard); }
.chip:nth-child(3) { background: var(--red); color: var(--cream); }
.chrono {
  display: flex; align-items: center; gap: .75rem; padding: .35rem .5rem .35rem 1rem;
  background: var(--ink); color: var(--cream); border-radius: var(--radius); box-shadow: var(--shadow-sm);
}
.chrono-label { font: 700 .78rem var(--font-cond); letter-spacing: .2em; text-transform: uppercase; }
.chrono-value {
  min-width: 5ch; padding: .1rem .6rem; border-radius: 4px; background: #000;
  font: 700 1.8rem var(--font-type); color: var(--mustard); text-align: center;
  text-shadow: 0 0 8px rgba(240, 168, 24, .6);
}

/* ---------- track ---------- */

.track {
  position: relative; border: var(--border); border-radius: var(--radius); box-shadow: var(--shadow);
  overflow: hidden; background: var(--noise), var(--asphalt); color: var(--cream);
  padding: 12px 0;
}
.track::before, .track::after {
  content: ''; position: absolute; left: 0; right: 0; height: 12px; z-index: 1;
  background: repeating-linear-gradient(90deg, var(--red) 0 28px, var(--cream) 28px 56px);
}
.track::before { top: 0; border-bottom: 2px solid var(--ink); }
.track::after { bottom: 0; border-top: 2px solid var(--ink); }
.lane { position: relative; display: grid; grid-template-columns: 170px minmax(0, 1fr); align-items: stretch; }
.lane + .lane .lane-road::before {
  content: ''; position: absolute; top: -1.5px; left: 0; right: 0; height: 3px;
  background: linear-gradient(90deg, rgba(244, 234, 213, .55) 0 50%, transparent 50%) 0 0 / 44px 3px repeat-x;
}
.lane-label {
  display: grid; grid-template-columns: auto 1fr; column-gap: .6rem; align-items: center; align-content: center;
  padding: .45rem .8rem; background: rgba(0, 0, 0, .35); border-right: 3px solid var(--cream);
}
.lane-rank {
  grid-row: span 2; display: grid; place-items: center; width: 2.1rem; height: 2.1rem; border-radius: 50%;
  background: var(--cream); color: var(--ink); border: 2px solid var(--ink);
  box-shadow: inset 0 0 0 2px var(--cream), inset 0 0 0 3.5px var(--ink);
  font: 400 1rem var(--font-display);
}
.lane-nick { font: 800 1.05rem var(--font-cond); letter-spacing: .06em; text-transform: uppercase; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lane-wpm { font: 700 .8rem var(--font-type); color: rgba(244, 234, 213, .7); }
.lane.is-me .lane-label { background: rgba(240, 168, 24, .2); }
.lane.is-me .lane-rank { background: var(--mustard); box-shadow: inset 0 0 0 2px var(--mustard), inset 0 0 0 3.5px var(--ink); }
.lane.is-me .lane-nick { color: var(--mustard); }
.lane.is-ghost .lane-nick { font-style: italic; color: rgba(244, 234, 213, .6); }
.lane.is-done .lane-rank { background: var(--green); color: var(--cream); }
.lane.is-left { opacity: .4; }

.lane-road { position: relative; height: 76px; margin-right: 18px; }
.lane-road .car {
  position: absolute; bottom: 6px; width: var(--car-w);
  left: calc(var(--p, 0) * (100% - var(--car-w)));
  will-change: left;
}
.lane-road .car.moving::before {
  content: ''; position: absolute; right: 94%; top: 28%; width: 70px; height: 42%;
  background: repeating-linear-gradient(180deg, rgba(244, 234, 213, .45) 0 2px, transparent 2px 7px);
  -webkit-mask-image: linear-gradient(90deg, transparent, #000); mask-image: linear-gradient(90deg, transparent, #000);
}
.finish {
  position: absolute; top: 0; bottom: 0; right: -18px; width: 18px;
  background: conic-gradient(var(--cream) 25%, var(--ink) 0 50%, var(--cream) 0 75%, var(--ink) 0) 0 0 / 9px 9px;
  border-left: 2px solid var(--ink);
}

/* ---------- dashboard ---------- */

#race-panel { display: grid; gap: 1.25rem; }
.dash {
  display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 1rem;
  padding: 1rem 1.5rem; border: var(--border); border-radius: 18px; box-shadow: var(--shadow);
  background:
    var(--noise),
    repeating-linear-gradient(90deg, rgba(255, 255, 255, .03) 0 3px, transparent 3px 6px),
    linear-gradient(180deg, #4a3226, #2b1c15);
}
.dial {
  justify-self: center; display: grid; place-items: center; align-content: center;
  width: 118px; height: 118px; border-radius: 50%;
  background: radial-gradient(circle at 50% 35%, #fffaf0, var(--cream) 60%, var(--paper-dark));
  border: 3px solid var(--ink); box-shadow: 0 0 0 5px #b9b4aa, 0 0 0 7px var(--ink);
}
.dial-value { font: 400 1.65rem/1 var(--font-display); }
.dial-label { margin-top: .3rem; font: 800 .7rem var(--font-cond); letter-spacing: .16em; text-transform: uppercase; color: var(--muted); }

.gauge { position: relative; width: min(300px, 46vw); }
.gauge svg { display: block; width: 100%; height: auto; overflow: visible; }
.gauge-face { fill: var(--cream); stroke: #b9b4aa; stroke-width: 6; paint-order: stroke; filter: drop-shadow(0 0 0 var(--ink)); }
.gauge-red { fill: none; stroke: var(--red); stroke-width: 7; }
.gauge-ticks { stroke: var(--ink); }
.gauge-ticks text { stroke: none; fill: var(--ink); font: 700 12px var(--font-cond); }
.gauge-needle { fill: var(--red); stroke: var(--ink); stroke-width: 1; transform-box: view-box; transform-origin: 100px 100px; transform: rotate(-90deg); transition: transform .35s cubic-bezier(.3, 1.4, .5, 1); }
.gauge-cap { fill: var(--ink); stroke: #b9b4aa; stroke-width: 2.5; }
.gauge-readout { position: absolute; left: 0; right: 0; bottom: 12%; display: flex; justify-content: center; align-items: baseline; gap: .3rem; pointer-events: none; }
.gauge-value { font: 400 1.5rem var(--font-display); color: var(--ink); background: var(--cream); padding: 0 .3rem; border-radius: 4px; }
.gauge-label { font: 800 .75rem var(--font-cond); letter-spacing: .14em; color: var(--muted); }

/* ---------- typing sheet ---------- */

.typing-wrap { position: relative; }
.typing { position: relative; }
.typing-text {
  --lh: 2.3em;
  position: relative; height: calc(var(--lh) * var(--lines, 3) + 2.4rem); overflow: hidden;
  padding: 1.2rem 1.5rem 1.2rem 3.2rem;
  font: 400 clamp(1.1rem, 2.7vw, 1.5rem)/var(--lh) var(--font-type);
  color: rgba(29, 25, 21, .45);
  background-color: #fffaf0;
  background-image:
    linear-gradient(90deg, transparent 2.2rem, rgba(208, 32, 46, .45) 2.2rem 2.35rem, transparent 2.35rem),
    repeating-linear-gradient(180deg, transparent 0 calc(var(--lh) - 1px), rgba(31, 78, 156, .18) calc(var(--lh) - 1px) var(--lh));
  background-origin: padding-box, content-box;
  background-attachment: local;
  border: var(--border); border-radius: var(--radius); box-shadow: var(--shadow); cursor: text;
  scroll-behavior: smooth;
}
.typing-text.is-live { box-shadow: var(--shadow), 0 0 0 4px var(--mustard); }

/* One box per word; letters get their state as they are typed. */
.typing-text .word { position: relative; display: inline-block; height: var(--lh); margin-right: .55em; padding: 0 .12em; border-radius: 4px; white-space: nowrap; }
.typing-text .word.active { background: rgba(240, 168, 24, .22); color: rgba(29, 25, 21, .6); }
.typing-text .l.ok { color: var(--green); }
.typing-text .l.bad { color: var(--red); }
.typing-text .l.extra { color: var(--red-dark); opacity: .75; }
.typing-text .l.missing { color: rgba(29, 25, 21, .28); }
.typing-text .word.is-ok .l { color: var(--green); }
.typing-text .word.is-resumed .l { color: rgba(29, 25, 21, .3); }
.typing-text .word.is-bad { text-decoration: underline wavy var(--red) 2px; text-underline-offset: 7px; }
/* Caret: before the next letter, or after the word once it is fully typed. */
.typing-text .l.cur { box-shadow: inset 2px 0 0 var(--ink); animation: caret 1s steps(1) infinite; }
.typing-text .word.over::after {
  content: ''; position: absolute; right: .04em; top: 22%; bottom: 22%; width: 2px; background: var(--ink);
  animation: caret-bar 1s steps(1) infinite;
}
@keyframes caret { 50% { box-shadow: inset 2px 0 0 transparent; } }
@keyframes caret-bar { 50% { opacity: 0; } }
.typing-input { position: absolute; opacity: 0; pointer-events: none; width: 1px; height: 1px; top: 0; left: 0; }
.typing-hint {
  position: absolute; inset: 0; display: grid; place-items: center; cursor: pointer; border-radius: var(--radius);
  background: rgba(241, 230, 204, .82); font: 800 1.2rem var(--font-cond); letter-spacing: .12em; text-transform: uppercase;
}
@keyframes shake { 25% { transform: translateX(-2px); } 75% { transform: translateX(2px); } }

/* ---------- start lights ---------- */

.countdown {
  position: absolute; inset: 0; z-index: 5; display: grid; place-content: center; justify-items: center; gap: .8rem;
  border-radius: var(--radius); background: rgba(241, 230, 204, .9);
}
.lights { display: flex; gap: 1rem; padding: .8rem 1.2rem; background: var(--ink); border-radius: 999px; box-shadow: var(--shadow-sm); }
.lights span {
  width: 54px; height: 54px; border-radius: 50%; border: 3px solid #000;
  background: radial-gradient(circle at 35% 35%, #5a1a1a, #2a0b0b); transition: background .1s, box-shadow .1s;
}
.lights span.on { background: radial-gradient(circle at 35% 35%, #ff8a8a, var(--red) 55%, var(--red-dark)); box-shadow: 0 0 22px 4px rgba(208, 32, 46, .75); }
.countdown.is-go .lights span { background: radial-gradient(circle at 35% 35%, #9dffc8, #1fbf6a 55%, #0b6b3a); box-shadow: 0 0 22px 4px rgba(31, 191, 106, .75); }
.countdown-label { font: 400 3rem/1 var(--font-display); color: var(--red); text-shadow: 2px 2px 0 var(--ink); text-transform: uppercase; }
.countdown.is-go .countdown-label { color: var(--green); }

/* ---------- results ---------- */

.results-card { display: grid; gap: 1.25rem; }
.results-title { display: flex; align-items: center; justify-content: center; gap: .8rem; font-size: clamp(1.6rem, 4vw, 2.2rem); text-transform: uppercase; }
.flag-mini {
  width: 34px; height: 24px; border: 2px solid var(--ink);
  background: conic-gradient(var(--ink) 25%, var(--cream) 0 50%, var(--ink) 0 75%, var(--cream) 0) 0 0 / 11px 11px;
}

.podium {
  position: relative; display: flex; justify-content: center; align-items: flex-end; gap: .5rem;
  min-height: 340px; padding: 1.5rem .5rem 0; overflow: hidden; border-bottom: var(--border);
  background: repeating-conic-gradient(from -90deg at 50% 100%, rgba(240, 168, 24, .16) 0 5deg, transparent 5deg 10deg);
}
.pod-col { flex: 1 1 0; max-width: 200px; min-width: 0; display: flex; flex-direction: column; align-items: center; }
.pod-stage { position: relative; width: 100%; display: flex; flex-direction: column; align-items: center; }
.pod-driver { position: relative; z-index: 2; width: 40%; max-width: 72px; margin-bottom: -14%; }
.pod-car { position: relative; z-index: 1; width: 100%; max-width: 170px; }
.pod-block {
  width: 100%; display: grid; justify-items: center; align-content: start; gap: .1rem; padding: .45rem .3rem 0;
  border: var(--border); border-bottom: 0; border-radius: 6px 6px 0 0; background: var(--noise), var(--c);
}
.pod-rank { font: 400 2.3rem/1 var(--font-display); text-shadow: 2px 2px 0 rgba(255, 255, 255, .5); }
.pod-nick { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font: 800 1.05rem var(--font-cond); letter-spacing: .05em; text-transform: uppercase; }
.pod-wpm { font: 700 .85rem var(--font-type); }
.pod-r1 { --c: var(--mustard); } .pod-r1 .pod-block { height: 150px; }
.pod-r2 { --c: var(--silver); } .pod-r2 .pod-block { height: 115px; }
.pod-r3 { --c: var(--bronze); } .pod-r3 .pod-block { height: 85px; }
.pod-r4 { --c: var(--paper-dark); } .pod-r4 .pod-block { height: 60px; }
.pod-col.is-me .pod-nick { color: var(--red); }
.pod-fx { position: absolute; left: -15%; right: -15%; top: -70px; height: 380px; pointer-events: none; z-index: 3; }

/* Champion: jumps with the trophy, confetti, revving car */
.mood-champion .pod-driver { animation: jump .9s ease-in-out infinite; }
.mood-champion .drv-arm-l { animation: cheer .45s ease-in-out infinite alternate; }
.mood-champion .drv-arm-r { animation: cheer .45s ease-in-out infinite alternate-reverse; }
.mood-champion .pod-car { animation: rev .3s ease-in-out infinite alternate; }
.confetti {
  position: absolute; top: 0; left: var(--x); width: 7px; height: 11px; background: var(--c);
  border: 1px solid rgba(0, 0, 0, .25); opacity: 0; animation: fall 2.6s linear infinite; animation-delay: var(--d);
}
@keyframes jump { 0%, 100% { transform: translateY(0); } 45% { transform: translateY(-20px); } }
@keyframes cheer { from { transform: rotate(-9deg); } to { transform: rotate(9deg); } }
@keyframes rev { from { transform: translateY(0); } to { transform: translateY(-2px); } }
@keyframes fall {
  0% { opacity: 1; transform: translateY(0) rotate(var(--r)); }
  100% { opacity: 1; transform: translateY(380px) rotate(calc(var(--r) + 720deg)); }
}

/* Happy: waves and hops */
.mood-happy .pod-driver { animation: hop 1.3s ease-in-out infinite; }
.mood-happy .drv-arm-r { animation: wave .55s ease-in-out infinite alternate; }
.sparkle { position: absolute; color: var(--mustard); font-size: 1.3rem; text-shadow: 1px 1px 0 var(--ink); animation: twinkle 1.4s ease-in-out infinite; }
.sparkle:nth-child(1) { left: 28%; top: 70px; }
.sparkle:nth-child(2) { right: 26%; top: 100px; animation-delay: .7s; }
@keyframes hop { 0%, 60%, 100% { transform: translateY(0); } 30% { transform: translateY(-8px); } }
@keyframes twinkle { 0%, 100% { opacity: 0; transform: scale(.5); } 50% { opacity: 1; transform: scale(1.2); } }

/* Last place: head down, rain cloud, smoking engine */
.mood-sad .drv-head { animation: sigh 3s ease-in-out infinite; }
.mood-sad .pod-driver { animation: sway 3s ease-in-out infinite; }
.mood-sad .pod-car .car-svg { filter: saturate(.55) brightness(.92); }
.cloud {
  position: absolute; left: 50%; top: 58px; width: 58px; height: 20px; margin-left: -29px;
  background: #8a8f99; border: 2px solid var(--ink); border-radius: 20px; animation: drift 3s ease-in-out infinite;
}
.cloud::before, .cloud::after { content: ''; position: absolute; background: #8a8f99; border: 2px solid var(--ink); border-bottom: 0; border-radius: 50% 50% 0 0; }
.cloud::before { width: 24px; height: 14px; left: 8px; top: -12px; }
.cloud::after { width: 20px; height: 11px; left: 28px; top: -9px; }
.drop { position: absolute; top: 20px; width: 3px; height: 9px; border-radius: 2px; background: #5fa8d3; animation: rain .8s linear infinite; }
.drop:nth-child(1) { left: 12px; }
.drop:nth-child(2) { left: 27px; animation-delay: .27s; }
.drop:nth-child(3) { left: 42px; animation-delay: .53s; }
.smoke { position: absolute; right: 14%; top: 34%; width: 12px; height: 12px; border-radius: 50%; background: rgba(110, 110, 110, .65); animation: smoke 2.4s ease-out infinite; }
.smoke:nth-of-type(2) { animation-delay: .8s; }
.smoke:nth-of-type(3) { animation-delay: 1.6s; }
@keyframes sigh { 0%, 100% { transform: rotate(14deg) translateY(1px); } 50% { transform: rotate(22deg) translateY(2.5px); } }
@keyframes sway { 0%, 100% { transform: rotate(-2deg); } 50% { transform: rotate(2deg); } }
@keyframes drift { 50% { transform: translateX(5px); } }
@keyframes rain { from { transform: translateY(0); opacity: 1; } to { transform: translateY(34px); opacity: 0; } }
@keyframes smoke { from { transform: translate(0, 0) scale(.6); opacity: .85; } to { transform: translate(-12px, -52px) scale(2.2); opacity: 0; } }

.table-wrap { overflow-x: auto; }
.results { width: 100%; border-collapse: collapse; }
.results th, .results td { padding: .6rem .7rem; text-align: left; }
.results th { background: var(--ink); color: var(--cream); font: 700 .8rem var(--font-cond); letter-spacing: .14em; text-transform: uppercase; }
.results td { border-bottom: 2px dashed rgba(29, 25, 21, .25); font-weight: 600; }
.results .num { text-align: right; font-family: var(--font-type); font-weight: 700; white-space: nowrap; }
.results tr.is-me td { background: rgba(240, 168, 24, .22); }
.cell-rank { width: 3.5rem; }
.result-player { display: flex; align-items: center; gap: .7rem; }
.result-player .player-car { width: 76px; flex: none; }
.result-nick { font: 800 1.05rem var(--font-cond); letter-spacing: .05em; text-transform: uppercase; }

.results-card.center { justify-items: center; }
.results-card.center p { margin: 0; }
.record-badge {
  display: inline-flex; align-items: center; gap: .5rem; padding: .55rem 1.4rem;
  background: var(--mustard); border: var(--border); box-shadow: var(--shadow-sm);
  font: 400 1.4rem var(--font-display); text-transform: uppercase;
  clip-path: polygon(0 0, 100% 0, calc(100% - 14px) 50%, 100% 100%, 0 100%, 14px 50%);
  padding-inline: 2rem; animation: pop .6s ease-out 3;
}
@keyframes pop { from { transform: scale(1.12); } to { transform: scale(1); } }
.plaques { display: flex; flex-wrap: wrap; justify-content: center; gap: 1rem; }
.plaque {
  display: grid; justify-items: center; min-width: 140px; padding: .9rem 1.2rem;
  background: var(--ink); color: var(--cream); border-radius: var(--radius); box-shadow: 4px 4px 0 var(--red);
}
.plaque-value { font: 400 2.3rem/1.1 var(--font-display); color: var(--mustard); }
.plaque-label { font: 800 .78rem var(--font-cond); letter-spacing: .18em; text-transform: uppercase; }
.up { color: var(--green); }
.down { color: var(--red); }
.setup { max-width: 760px; width: 100%; margin: 0 auto; }

/* ---------- footer links, notice, legal page ---------- */

.footer-links {
  display: flex; flex-wrap: wrap; justify-content: center; gap: .3rem 1.4rem; padding: .9rem 1rem .2rem;
  background: var(--ink);
}
.footer-links a {
  color: var(--cream); text-decoration: none; opacity: .8;
  font: 700 .85rem var(--font-cond); letter-spacing: .14em; text-transform: uppercase;
}
.footer-links a:hover { opacity: 1; color: var(--mustard); }
.footer-brand { color: var(--mustard); white-space: nowrap; }

.notice-bar {
  position: fixed; z-index: 40; left: 50%; bottom: 1rem; transform: translateX(-50%);
  width: min(720px, calc(100% - 2rem)); display: flex; align-items: center; gap: 1rem; padding: .8rem 1rem;
  background: var(--ink); color: var(--cream); border: 2px solid var(--cream); border-radius: var(--radius);
  box-shadow: 4px 4px 0 var(--red);
}
.notice-bar p { margin: 0; flex: 1; font-size: .95rem; }
.notice-bar a { color: var(--mustard); font-weight: 700; }

.prefs-help { margin: 0; font-size: .92rem; color: var(--ink-2); }
.prefs-help a { color: var(--red); font-weight: 700; }
.prefs-delete { justify-self: start; }

.legal-page { max-width: 900px; }
.legal { display: grid; gap: 1.5rem; }
.legal-head { display: grid; gap: .6rem; }
.legal-head h1 { font-size: clamp(2rem, 6vw, 3rem); text-transform: uppercase; color: var(--red); text-shadow: 3px 3px 0 var(--ink); }
.legal-updated { margin: 0; font: 700 .9rem var(--font-cond); letter-spacing: .14em; text-transform: uppercase; color: var(--muted); }
.legal-toc { display: flex; flex-wrap: wrap; gap: .5rem; }
.legal-toc a {
  padding: .35rem .85rem; border: 2px solid var(--ink); border-radius: 999px; background: var(--paper-light);
  color: var(--ink); text-decoration: none; box-shadow: 2px 2px 0 var(--ink);
  font: 800 .85rem var(--font-cond); letter-spacing: .08em; text-transform: uppercase;
}
.legal-toc a:hover { background: var(--mustard); }
.legal-summary { padding: 1.2rem 1.4rem; border: var(--border); border-radius: var(--radius); background: var(--mustard); box-shadow: var(--shadow); }
.legal-summary h2 { font-size: 1.3rem; text-transform: uppercase; margin-bottom: .6rem; }
.legal-summary ul { margin: 0; padding-left: 1.2rem; display: grid; gap: .35rem; }
.legal-section {
  scroll-margin-top: 1rem; padding: 1.4rem; border: var(--border); border-radius: var(--radius);
  background: var(--paper-light); box-shadow: var(--shadow); line-height: 1.6;
}
.legal-section h2 { font-size: clamp(1.3rem, 3.5vw, 1.7rem); text-transform: uppercase; padding-bottom: .6rem; margin-bottom: 1rem; border-bottom: var(--border); }
.legal-section h3 { margin: 1.3rem 0 .5rem; font: 800 1.1rem var(--font-cond); letter-spacing: .08em; text-transform: uppercase; color: var(--red); }
.legal-section ul, .legal-section ol { padding-left: 1.3rem; display: grid; gap: .3rem; }
.legal-section a { color: var(--red); font-weight: 700; }
.legal-alpha { list-style: lower-alpha; }
.legal-note { padding: .7rem 1rem; border-left: 4px solid var(--mustard); background: rgba(240, 168, 24, .12); font-size: .95rem; }
.legal-table { width: 100%; border-collapse: collapse; font-size: .92rem; min-width: 560px; }
.legal-table th { background: var(--ink); color: var(--cream); text-align: left; padding: .55rem .7rem; font: 700 .8rem var(--font-cond); letter-spacing: .12em; text-transform: uppercase; }
.legal-table td { padding: .6rem .7rem; vertical-align: top; border-bottom: 2px dashed rgba(29, 25, 21, .2); }
.legal-table code { font: 700 .85rem var(--font-type); white-space: nowrap; }

/* ---------- small screens ---------- */

@media (max-width: 860px) {
  .garage, .lobby { grid-template-columns: minmax(0, 1fr); }
  .garage-stage { position: relative; top: 0; }
  .garage-driver { width: clamp(116px, 22vw, 200px); }
  .garage-stage { min-height: clamp(300px, 46vw, 420px); }
}

@media (max-width: 640px) {
  .notice-bar { flex-direction: column; align-items: stretch; text-align: center; bottom: .5rem; }
  .legal-section { padding: 1.1rem; }
  :root { --car-w: 92px; --shadow: 4px 4px 0 var(--ink); }
  body { font-size: 16px; }
  .container { gap: 1.5rem; padding-top: 1rem; }
  .card { padding: 1.1rem; }
  .logo-title { font-size: 1.1rem; }
  .logo-mark { width: 36px; height: 36px; }
  .hero { padding: 2rem 1rem 6.5rem; }
  .hero-car { width: 150px; }
  .lane { grid-template-columns: minmax(0, 1fr); }
  .lane-label {
    grid-template-columns: auto minmax(0, 1fr) auto; padding: .3rem .6rem;
    border-right: 0; border-bottom: 2px solid rgba(244, 234, 213, .25);
  }
  .lane-rank { grid-row: auto; width: 1.6rem; height: 1.6rem; font-size: .8rem; }
  .lane-road { height: 58px; }
  .dash { grid-template-columns: 1fr 1fr; padding: 1rem; }
  .dash .gauge { grid-column: 1 / -1; grid-row: 1; justify-self: center; width: min(280px, 100%); }
  .dial { width: 96px; height: 96px; }
  .dial-value { font-size: 1.3rem; }
  .lights span { width: 40px; height: 40px; }
  .countdown-label { font-size: 2.2rem; }
  .grid-slots { gap: .75rem; }
  .slot { min-height: 120px; padding: 1.5rem .4rem .6rem; }
  .slot-name { font-size: 1rem; }
  .input-row { flex-wrap: wrap; }
  .input-row .btn { flex: 1; }
  .btn-xl { width: 100%; }
  .garage-stage { min-height: 250px; padding-top: 3.4rem; }
  .garage-platform { width: 94%; margin-bottom: 2rem; }
  .garage-driver { left: 3%; width: 116px; }
  .lang-select { min-width: 0; }
  .podium { min-height: 260px; gap: .3rem; padding-inline: .2rem; }
  .pod-rank { font-size: 1.7rem; }
  .pod-nick { font-size: .85rem; }
  .pod-wpm { font-size: .72rem; }
  .pod-r1 .pod-block { height: 110px; }
  .pod-r2 .pod-block { height: 84px; }
  .pod-r3 .pod-block { height: 64px; }
  .pod-r4 .pod-block { height: 48px; }
  .result-player .player-car { width: 56px; }
  .plaque { min-width: 120px; }
}

/* "Reduce motion" comes from the site's own settings, not the OS setting. */
.reduce-motion *, .reduce-motion *::before, .reduce-motion *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
.reduce-motion .hero-car { left: 50%; transform: translateX(-50%); }
