:root { --safe-top: env(safe-area-inset-top, 0px); color-scheme: dark; }
html, body { margin: 0; height: 100%; overflow: hidden; background: #1d2530; }
body { font-family: system-ui, sans-serif; color: #fff; -webkit-user-select: none; user-select: none; }
#view { position: fixed; inset: 0; width: 100%; height: 100%; touch-action: none; display: block; }
#snd {
  position: fixed; z-index: 2; left: 50%; transform: translateX(-50%); top: calc(8px + var(--safe-top));
  font-size: 18px; line-height: 1; padding: 6px 9px; border: 0; border-radius: 999px; background: rgba(0, 0, 0, .35); cursor: pointer;
}
#menu {
  position: fixed; z-index: 2; left: calc(50% + 28px); top: calc(8px + var(--safe-top));
  font-size: 16px; line-height: 1; padding: 7px 10px; border: 0; border-radius: 999px; background: rgba(0, 0, 0, .35); color: #fff; cursor: pointer;
}
#menu[hidden] { display: none; }

/* ---- portrait only on phones ---- */
/* A touch screen, sideways, and short: a phone on its side (a tablet in
   landscape is taller than this and still plays). */
#rotate { display: none; }
@media (orientation: landscape) and (pointer: coarse) and (max-height: 540px) {
  #rotate {
    display: flex; position: fixed; inset: 0; z-index: 10; flex-direction: column; align-items: center; justify-content: center;
    gap: 10px; background: #1d2530; color: #dfe7ef; font-weight: 700; text-align: center;
  }
  #rotate .phone { font-size: 56px; animation: turn 1.6s ease-in-out infinite; }
  @keyframes turn { 0%, 30% { transform: rotate(-90deg); } 60%, 100% { transform: rotate(0deg); } }
}

/* ---- title extras, sheets ---- */
.ghostbtn {
  font: inherit; font-size: 16px; font-weight: 800; letter-spacing: .06em; padding: 9px 18px; border: 2px solid #5a6b7c;
  border-radius: 12px; background: transparent; color: #dfe7ef; cursor: pointer;
}
.how a.link, .how .link { color: #9fb0c0; font-size: 13px; }
.sheet {
  position: fixed; inset: 0; z-index: 4; display: flex; align-items: center; justify-content: center; padding: 16px;
  background: rgba(8, 12, 18, .72); box-sizing: border-box;
}
.sheet[hidden] { display: none; }
.sheet .card {
  width: min(360px, 100%); background: #1f2730; border: 1px solid #33404e; border-radius: 16px; padding: 18px 16px;
  display: flex; flex-direction: column; gap: 10px; text-align: center; max-height: 90vh; overflow-y: auto;
}
.sheet h2 { margin: 0; color: #ffe066; letter-spacing: .1em; font-size: 20px; }
.big {
  font: inherit; font-size: 18px; font-weight: 800; letter-spacing: .08em; padding: 12px; border: 0; border-radius: 12px;
  background: #ffe066; color: #1d2530; cursor: pointer; box-shadow: 0 4px 0 #b8952a;
}
.opt { display: flex; align-items: center; gap: 10px; text-align: left; font-size: 15px; padding: 6px 4px; cursor: pointer; }
.opt input { width: 20px; height: 20px; accent-color: #ffe066; }
#delbox { border-top: 1px solid #33404e; padding-top: 8px; text-align: left; }
#delbox .danger { color: #ff8a80; border-color: #ff8a80; }
.tutcard { display: flex; flex-direction: column; align-items: center; gap: 8px; }
.tutcard .big-emoji { font-size: 54px; line-height: 1.1; }
.tutcard h3 { margin: 0; color: #fff; font-size: 20px; }
.tutcard p { margin: 0; color: #c9d4de; line-height: 1.5; }
.tutnav { justify-content: space-between; }
.tutnav .big { flex: 1; margin-left: 12px; }
.dots { display: flex; gap: 6px; justify-content: center; }
.dots i { width: 7px; height: 7px; border-radius: 50%; background: #3a4a5c; }
.dots i.on { background: #ffe066; }

/* ---- garage ---- */
#garage {
  position: fixed; inset: 0; z-index: 3; display: flex; flex-direction: column; background: #151b22;
  padding: calc(8px + var(--safe-top)) 0 10px; box-sizing: border-box;
}
#garage[hidden] { display: none; }
.gtop { display: flex; align-items: center; justify-content: space-between; padding: 0 12px 6px; }
.gtop b { letter-spacing: .15em; color: #ffe066; }
.gtop button { font: inherit; font-size: 16px; padding: 6px 12px; border: 0; border-radius: 10px; background: #26303c; color: #fff; cursor: pointer; }
#gview { width: 100%; height: 30vh; min-height: 170px; display: block; }
#gtabs { display: flex; gap: 4px; padding: 8px 12px 0; }
#gtabs button {
  flex: 1; font: inherit; font-weight: 700; padding: 9px 0; border: 0; border-radius: 10px 10px 0 0;
  background: #1f2730; color: #9fb0c0; cursor: pointer;
}
#gtabs button.on { background: #26303c; color: #fff; }
#gpane { flex: 1; overflow-y: auto; background: #26303c; margin: 0 12px; padding: 4px 12px 14px; border-radius: 0 0 12px 12px; }
#gpane h3 { margin: 12px 0 6px; font-size: 12px; letter-spacing: .1em; text-transform: uppercase; color: #9fb0c0; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.chip {
  font: inherit; font-size: 13px; padding: 7px 11px; border: 1px solid #3a4a5c; border-radius: 999px;
  background: #1a2129; color: #dfe7ef; cursor: pointer;
}
.chip.on { background: #ffe066; border-color: #ffe066; color: #1d2530; font-weight: 700; }
.chip.test { margin-top: 12px; }
.numval { min-width: 44px; text-align: center; font-weight: 800; font-size: 18px; }
.models { display: grid; grid-template-columns: repeat(auto-fill, minmax(72px, 1fr)); gap: 6px; padding-top: 10px; }
.model {
  display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 4px 2px 6px; border: 2px solid transparent;
  border-radius: 10px; background: #1a2129; color: #dfe7ef; font: inherit; font-size: 11px; cursor: pointer;
}
.model canvas { width: 45px; height: 72px; }
.model.on { border-color: #ffe066; }
.hue, .authform input.hue {   /* beats .authform input, which painted over the rainbow */
  width: 100%; height: 26px; -webkit-appearance: none; appearance: none; border-radius: 13px; outline: none; padding: 0; border: 0;
  background: linear-gradient(90deg, hsl(0 85% 55%), hsl(60 85% 55%), hsl(120 85% 55%), hsl(180 85% 55%), hsl(240 85% 55%), hsl(300 85% 55%), hsl(345 85% 55%));
}
.hue::-webkit-slider-thumb { -webkit-appearance: none; width: 28px; height: 28px; border-radius: 50%; background: #fff; border: 3px solid #1d2530; }
.hue::-moz-range-thumb { width: 24px; height: 24px; border-radius: 50%; background: #fff; border: 3px solid #1d2530; }
.palette { display: grid; grid-template-columns: repeat(8, 1fr); gap: 6px; }
.swatch { aspect-ratio: 1; border: 2px solid #3a4a5c; border-radius: 8px; background: #1a2129; color: #fff; font-size: 14px; cursor: pointer; }
.swatch.on { border-color: #fff; box-shadow: 0 0 0 2px #ffe066; }
canvas.livery { display: block; margin: 10px auto 0; width: 192px; height: 336px; touch-action: none; border-radius: 8px; cursor: crosshair; }
#gdrive {
  margin: 10px 12px 0; font: inherit; font-size: 18px; font-weight: 800; letter-spacing: .08em; padding: 12px; border: 0;
  border-radius: 12px; background: #ffe066; color: #1d2530; cursor: pointer; box-shadow: 0 4px 0 #b8952a;
}

#name[hidden] { display: none; }

/* ---- account + hub ---- */
.who { display: flex; align-items: center; justify-content: center; gap: 8px; flex-wrap: wrap; }
.lvl { font-weight: 800; color: #ffe066; }
.ctag { display: inline-block; padding: 1px 5px; border-radius: 5px; background: #3a4a5c; color: #fff; font-size: 11px; font-weight: 800; letter-spacing: .05em; }
.link { font: inherit; font-size: 13px; background: none; border: 0; color: #9fd3ff; text-decoration: underline; cursor: pointer; padding: 4px; }
.xpbar { height: 6px; border-radius: 3px; background: rgba(255,255,255,.12); overflow: hidden; margin: 6px 0 2px; }
.xpbar i { display: block; height: 100%; background: linear-gradient(90deg, #ffb21f, #ffe066); }
.xptext, .hint { font-size: 12px; color: #9fb0c0; }
.err { font-size: 13px; color: #ff8a80; margin-top: 4px; }
.authform { display: flex; flex-direction: column; gap: 6px; align-items: stretch; }
.authform input, .chatin {
  font: inherit; font-size: 15px; padding: 8px 10px; border-radius: 8px; border: 2px solid #3a4a5c; background: #0f151c; color: #fff;
  -webkit-user-select: text; user-select: text;
}
#hub { width: min(420px, 100%); text-align: left; }
#htabs { display: flex; gap: 4px; }
#htabs button {
  flex: 1; font: inherit; font-weight: 700; font-size: 13px; padding: 8px 0; border: 0; border-radius: 10px 10px 0 0;
  background: #1f2730; color: #9fb0c0; cursor: pointer;
}
#htabs button.on { background: #26303c; color: #fff; }
#hpane { background: #26303c; border-radius: 0 0 12px 12px; padding: 10px 12px 12px; min-height: 160px; }
#hpane h4 { margin: 10px 0 6px; font-size: 12px; letter-spacing: .1em; text-transform: uppercase; color: #9fb0c0; }
.chatlog { height: 190px; overflow-y: auto; font-size: 13px; line-height: 1.45; margin: 6px 0; overflow-wrap: anywhere; }
#gpane .chatlog { height: calc(100% - 64px); min-height: 160px; }
.chatlog .line .ctag { margin-right: 4px; font-size: 10px; }
.chatbar { display: flex; gap: 6px; }
.chatin { flex: 1; min-width: 0; font-size: 14px; padding: 7px 9px; }
.daily { padding: 8px 0; border-bottom: 1px solid #33404e; }
.daily .dt { font-weight: 700; } .daily .dx { float: right; margin-top: -19px; font-size: 12px; color: #ffe066; font-weight: 800; }
.daily.done .dt { color: #9fe88f; } .daily.done .dx { color: #9fe88f; }
ol.board { margin: 8px 0 0; padding-left: 1.8em; font-size: 14px; line-height: 1.6; }
ol.board li.mine { color: #ffe066; font-weight: 700; }
ol.board .ctag { font-size: 10px; }
.members { margin: 0 0 8px; padding-left: 1.2em; font-size: 14px; line-height: 1.5; }
.clubrow { display: flex; align-items: center; gap: 6px; padding: 5px 0; font-size: 14px; }
.clubrow span:nth-child(2) { flex: 1; }
.chip:disabled { opacity: .45; cursor: not-allowed; }
#htabs button { font-size: 12px; }
.awards { display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 6px; margin-top: 8px; }
.award { background: #1a2129; border: 1px solid #33404e; border-radius: 10px; padding: 7px 8px; text-align: center; opacity: .6; }
.award.got { opacity: 1; border-color: #ffe066; box-shadow: 0 0 0 1px #ffe06655 inset; }
.aicon { font-size: 22px; line-height: 1.2; filter: grayscale(1); }
.award.got .aicon { filter: none; }
.aname { font-weight: 800; font-size: 12px; }
.atext { font-size: 11px; color: #9fb0c0; min-height: 28px; }
.axp { font-size: 11px; font-weight: 800; color: #ffe066; margin-top: 3px; }
.award.got .axp { color: #9fe88f; }
.model.locked { opacity: .45; }
.model .lock { font-size: 10px; color: #ffe066; }
#title[hidden] { display: none; }
#top { margin: 0; padding: 0 0 0 1.6em; text-align: left; color: #dfe7ef; font-size: 14px; line-height: 1.5; }

/* ---- crash of the day ---- */
#cotd { width: min(420px, 100%); text-align: left; background: linear-gradient(180deg, #2b1a1a, #1f2730); border: 1px solid #5a2a2a;
  border-radius: 14px; padding: 10px 12px; box-sizing: border-box; }
#cotd:empty { display: none; }
#cotd h3 { margin: 0 0 4px; font-size: 14px; letter-spacing: .12em; color: #ff8a5c; }
#cotd .prize { font-size: 11px; color: #9fb0c0; margin-bottom: 6px; }
.crow { display: flex; align-items: center; gap: 8px; padding: 5px 0; border-top: 1px solid #ffffff10; font-size: 13px; }
.crow .rk { width: 22px; font-weight: 900; color: #ffd21f; }
.crow .who { flex: 1; justify-content: flex-start; gap: 5px; }
.crow .mh { color: #ff8a5c; font-weight: 800; font-size: 12px; }
.crow .why { color: #9fb0c0; font-size: 11px; }
.watch { font: inherit; font-size: 12px; font-weight: 800; padding: 5px 10px; border: 0; border-radius: 8px; background: #ff5a36; color: #fff; cursor: pointer; }
#vclose { position: fixed; z-index: 6; right: 12px; top: calc(10px + var(--safe-top)); font-size: 18px; width: 40px; height: 40px;
  border: 0; border-radius: 50%; background: rgba(0, 0, 0, .55); color: #fff; cursor: pointer; }
#vclose[hidden] { display: none; }
.newsbox { margin-top: 6px; padding: 8px 10px; border-radius: 10px; background: #2a2410; border: 1px solid #ffd21f66; font-size: 13px; }
.newsbox div { margin: 3px 0; }

/* ---- credits, champions, locked-but-buyable ---- */
.cr { font-weight: 800; color: #ffd21f; }
.chip.lockedchip { opacity: .7; border-style: dashed; }
.model.champ { border-color: #ffd21f55; background: linear-gradient(180deg, #2a2410, #1a2129); }
.model.champ .lock { color: #ffd21f; }
.numin { width: 64px; font: inherit; font-size: 18px; font-weight: 800; text-align: center; padding: 5px 6px; border-radius: 8px;
  border: 2px solid #3a4a5c; background: #0f151c; color: #fff; -webkit-user-select: text; user-select: text; }
.opt .vol { flex: 1; width: auto; height: 20px; accent-color: #ffe066; }
.tagprev { display: flex; align-items: center; gap: 8px; font-size: 13px; color: #9fb0c0; }
/* Calling card: the live preview, the background grid, the catchphrases. */
canvas.cardprev { display: block; width: 100%; aspect-ratio: 4 / 1; border-radius: 10px; }
.cardbgs { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
.cardbg { display: flex; flex-direction: column; gap: 3px; padding: 4px; border: 2px solid transparent; border-radius: 10px; background: #1a2129; color: #dfe7ef; font: inherit; font-size: 11px; cursor: pointer; }
.cardbg canvas { width: 100%; aspect-ratio: 4 / 1; border-radius: 6px; }
.cardbg.on { border-color: #ffe066; }
.cardbg.locked { opacity: .5; cursor: default; }
.phrases { display: flex; flex-wrap: wrap; gap: 6px; }
.aopens { font-size: 10px; color: #c9a0ff; margin-top: 3px; line-height: 1.3; }

/* ==== the front end ======================================================
   The live road runs behind it, darkened to the edges. One column: plate
   and settings, the wordmark, your car on a lit turntable, DRIVE, the dock. */
:root { --display: 'Saira Condensed', system-ui, sans-serif; --gold: #ffd23f; --gold2: #ff9f1c; --glass: rgba(16, 22, 32, .72); --line: rgba(255, 255, 255, .09); }
#title {
  position: fixed; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: space-between;
  gap: 8px; padding: calc(10px + var(--safe-top)) 16px calc(10px + env(safe-area-inset-bottom, 0px)); box-sizing: border-box;
  background: radial-gradient(ellipse 90% 60% at 50% 42%, rgba(8, 12, 20, .45), rgba(5, 8, 14, .94) 78%), linear-gradient(180deg, rgba(5, 8, 14, .7), transparent 22%, transparent 70%, rgba(5, 8, 14, .85));
  text-align: center; overflow-y: auto; overflow-x: hidden;
}
#title > * { flex-shrink: 0; width: min(440px, 100%); }
.tbar { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; min-height: 48px; }
.iconbtn {
  flex: none; width: 42px; height: 42px; display: grid; place-items: center; padding: 0; border-radius: 12px; cursor: pointer;
  background: var(--glass); border: 1px solid var(--line); color: #dfe7ef; font-size: 18px; -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
}
.iconbtn svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linejoin: round; }
#setbtn svg { fill: currentColor; stroke: none; }

/* -- the player plate (hub.renderAcct) -- */
#acct { flex: 1; min-width: 0; text-align: left; position: relative; }
.plate {
  display: flex; align-items: center; gap: 10px; padding: 6px 12px 6px 6px; border-radius: 14px; background: var(--glass); border: 1px solid var(--line);
  -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); max-width: 100%; box-sizing: border-box; width: max-content;
}
.plate .badge {
  flex: none; width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; font: 900 16px/1 var(--display);
  color: #1b1405; background: conic-gradient(var(--gold) calc(var(--xp, 0) * 1%), rgba(255, 255, 255, .15) 0); position: relative;
}
.plate .badge::after { content: ''; position: absolute; inset: 3px; border-radius: 50%; background: linear-gradient(160deg, #ffe28a, #f5a524); z-index: 0; }
.plate .badge span { position: relative; z-index: 1; }
.plate .pinfo { min-width: 0; flex: 1; }
.plate .pname { display: flex; align-items: center; gap: 6px; font: 800 17px/1.1 var(--display); letter-spacing: .03em; white-space: nowrap; overflow: hidden; }
.plate .pstats { display: flex; gap: 10px; font: 700 13px/1.3 var(--display); color: #b9c6d4; letter-spacing: .03em; white-space: nowrap; }
.plate .pstats b { color: var(--gold); font-weight: 800; }
.plate .link { font-size: 12px; padding: 0 0 0 4px; color: #8fa3b8; }
.plate.guest .pname { color: #cfd9e4; }
.signin { font: 800 14px/1 var(--display); letter-spacing: .08em; padding: 9px 14px; border: 0; border-radius: 10px; cursor: pointer; color: #1b1405; background: linear-gradient(180deg, #ffe28a, #f5a524); }
#acct .authform {
  position: absolute; left: 0; top: calc(100% + 6px); z-index: 5; width: min(320px, 86vw); padding: 12px; border-radius: 14px; box-sizing: border-box;
  background: #141b25; border: 1px solid var(--line); box-shadow: 0 18px 40px rgba(0, 0, 0, .55);
}
#acct .newsbox { position: absolute; left: 0; top: calc(100% + 6px); z-index: 5; width: min(320px, 86vw); box-sizing: border-box; }

/* -- the wordmark -- */
.brand { display: flex; flex-direction: column; align-items: center; gap: 2px; }
.logo {
  position: relative; font: italic 900 clamp(58px, 19vw, 92px)/.9 var(--display); letter-spacing: -.01em; transform: skewX(-8deg);
  filter: drop-shadow(0 6px 0 rgba(0, 0, 0, .45)) drop-shadow(0 0 22px rgba(255, 170, 40, .18));
}
.logo span {   /* padded past the italic lean: the gradient only paints inside the box, and it clipped the P */
  display: inline-block; -webkit-background-clip: text; background-clip: text; color: transparent; -webkit-text-stroke: 1.5px rgba(0, 0, 0, .55);
  padding: 0 .16em 0 .06em; margin: 0 -.12em 0 -.04em;
}
.logo .l1 { background-image: linear-gradient(180deg, #ffffff 0%, #dfe6ee 38%, #6d7c8f 50%, #c9d3de 62%, #ffffff 100%); }
.logo .l2 { background-image: linear-gradient(180deg, #fff3b0 0%, #ffd23f 40%, #e0620e 52%, #ff9f1c 64%, #ffe28a 100%); }
.logo::before {                               /* speed lines off the left */
  content: ''; position: absolute; right: 100%; top: 22%; width: 34vw; max-width: 150px; height: 56%; margin-right: 6px;
  background: repeating-linear-gradient(180deg, transparent 0 7px, rgba(255, 210, 63, .55) 7px 10px);
  -webkit-mask: linear-gradient(90deg, transparent, #000); mask: linear-gradient(90deg, transparent, #000);
}
.brand .tag { margin: 4px 0 0; font: 700 13px/1 var(--display); letter-spacing: .2em; text-transform: uppercase; color: #aebccb; white-space: nowrap; }
.live {
  display: inline-flex; align-items: center; gap: 7px; margin: 8px 0 0; padding: 4px 11px; border-radius: 999px; font: 700 13px/1.2 var(--display);
  letter-spacing: .12em; text-transform: uppercase; color: #bff5c4; background: rgba(40, 160, 70, .16); border: 1px solid rgba(120, 230, 140, .25);
}
.live::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: #54e36b; box-shadow: 0 0 8px #54e36b; animation: livepulse 1.6s ease-in-out infinite; }
@keyframes livepulse { 50% { opacity: .35; } }

/* -- the car on its turntable (drawn by game.js drawMyCar) -- */
.stage { display: flex; flex-direction: column; align-items: center; gap: 2px; }
#mycar { width: min(210px, 52vw); height: min(210px, 52vw); }
#carname { font: 800 15px/1 var(--display); letter-spacing: .22em; text-transform: uppercase; color: #dfe7ef; }
#carname small { display: block; margin-top: 4px; font-size: 11px; letter-spacing: .3em; color: #7f93a8; }

/* -- DRIVE -- */
.launch { display: flex; flex-direction: column; align-items: center; gap: 8px; }
#name {
  font: 700 18px/1 var(--display); letter-spacing: .08em; padding: 11px 14px; width: min(280px, 80vw); border-radius: 12px; border: 1px solid var(--line);
  background: var(--glass); color: #fff; text-align: center; -webkit-user-select: text; user-select: text; box-sizing: border-box;
}
#go {
  position: relative; overflow: hidden; width: min(300px, 86vw); padding: 12px 0 10px; border: 0; border-radius: 16px; cursor: pointer; color: #231500;
  background: linear-gradient(180deg, #fff1a6 0%, #ffd23f 45%, #ff9f1c 100%);
  box-shadow: 0 5px 0 #a8560b, 0 12px 30px rgba(255, 150, 30, .35), inset 0 1px 0 rgba(255, 255, 255, .7);
  transform: skewX(-6deg); transition: transform .12s, box-shadow .12s;
}
#go span { display: block; font: italic 900 34px/1 var(--display); letter-spacing: .14em; }
#go small { display: block; margin-top: 2px; font: 800 11px/1 var(--display); letter-spacing: .38em; text-transform: uppercase; opacity: .7; }
#go::after {                                  /* a shine that sweeps across now and then */
  content: ''; position: absolute; top: 0; bottom: 0; width: 40%; left: -60%;
  background: linear-gradient(100deg, transparent, rgba(255, 255, 255, .75), transparent); animation: shine 3.2s ease-in-out infinite;
}
@keyframes shine { 0%, 55% { left: -60%; } 100% { left: 130%; } }
#go:active { transform: skewX(-6deg) translateY(4px); box-shadow: 0 1px 0 #a8560b, 0 6px 16px rgba(255, 150, 30, .3); }

/* -- the dock -- */
.dock { display: grid; grid-template-columns: repeat(6, 1fr); gap: 8px; }
.dock .tile { grid-column: span 2; }                 /* three small tiles a row; the wide two share one */
.dock .tile {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; min-height: 58px; padding: 7px 4px; box-sizing: border-box;
  border-radius: 14px; border: 1px solid var(--line); background: var(--glass); color: #e8eef5; cursor: pointer; font: inherit; letter-spacing: normal;
  -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); transition: transform .1s, border-color .15s;
}
.dock .tile:active { transform: scale(.96); }
.dock .tile svg { width: 24px; height: 24px; fill: none; stroke: var(--gold); stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.dock .tile b { font: 800 12px/1 var(--display); letter-spacing: .12em; }
.dock .tile small { font: 600 11px/1.15 var(--display); letter-spacing: .05em; color: #8fa3b8; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dock .tile.wide {
  grid-column: span 3; display: grid; grid-template-columns: auto 1fr; grid-template-rows: auto auto; column-gap: 9px; row-gap: 3px; min-width: 0;
  align-content: center; justify-items: start; padding: 10px 12px; text-align: left;
}
.dock .tile.wide svg { grid-row: span 2; width: 30px; height: 30px; align-self: center; }
.dock .tile.wide b { font-size: 14px; letter-spacing: .06em; align-self: end; white-space: nowrap; }
.dock .tile.wide small { align-self: start; min-width: 0; width: 100%; }
#garagebtn.tile { border-color: rgba(255, 210, 63, .45); background: linear-gradient(135deg, rgba(255, 210, 63, .16), var(--glass) 60%); }
.dock .tile.hot { border-color: rgba(255, 110, 70, .45); background: linear-gradient(135deg, rgba(255, 90, 50, .2), var(--glass) 60%); }
.dock .tile.hot svg { stroke: #ff7a4d; }
.foot { margin: 0; font-size: 12px; color: #6f8296; }
.foot .link { font-size: 12px; color: #8fa3b8; }

/* -- the panel sheet: Crash of the Day, or the hub's tabs -- */
#title > #panel { position: fixed; inset: 0; z-index: 6; display: flex; align-items: flex-end; justify-content: center; background: rgba(3, 6, 10, .55); width: auto; }
#title > #panel[hidden] { display: none; }
.pcard {
  width: min(460px, 100%); max-height: 86%; display: flex; flex-direction: column; box-sizing: border-box;
  background: #121922; border: 1px solid var(--line); border-bottom: 0; border-radius: 20px 20px 0 0; box-shadow: 0 -20px 50px rgba(0, 0, 0, .5);
  animation: sheetup .22s cubic-bezier(.2, .8, .2, 1);
}
@keyframes sheetup { from { transform: translateY(40%); opacity: 0; } }
.phead { display: flex; align-items: center; justify-content: space-between; padding: 12px 12px 6px 18px; }
.phead b { font: italic 900 22px/1 var(--display); letter-spacing: .1em; color: var(--gold); }
.pbody { overflow-y: auto; padding: 0 12px calc(14px + env(safe-area-inset-bottom, 0px)); text-align: left; }
#panel #cotd, #panel #hub { width: 100%; }
#panel #cotd { border: 0; background: none; padding: 0; }
#panel #cotd h3 { display: none; }
#panel.cotd #hub, #panel:not(.cotd) #cotd { display: none; }

/* Short screens: tighten the stage before anything scrolls. */
@media (max-height: 800px) {
  #mycar { width: min(150px, 40vw); height: min(150px, 40vw); }
  .logo { font-size: clamp(48px, 15vw, 72px); }
  .dock .tile { min-height: 54px; }
}
/* The floating sound toggle sits where the plate is; Settings has sound on the title. */
body:has(#title:not([hidden])) #snd { display: none; }
/* Club territory: one row a biome -- its colour, name, holder, and your club's points against the lead. */
.terr { display: flex; flex-direction: column; gap: 4px; margin-top: 6px; }
.trow { display: grid; grid-template-columns: 10px 1fr auto auto; align-items: center; gap: 8px; padding: 6px 8px; border-radius: 8px; background: #1a2129; font-size: 13px; }
.trow.ours { box-shadow: inset 0 0 0 1px #ffe066; }
.tdot { width: 10px; height: 10px; border-radius: 50%; }
.tname { font-weight: 700; letter-spacing: .03em; }
.tfree { font-size: 11px; color: #6f8296; }
.tpts { font-size: 11px; color: #9fb0c0; min-width: 72px; text-align: right; }
/* The season's banner under the live pill (Halloween, Crashmas...). */
.season { margin: 6px 0 0; font: 800 13px/1 var(--display); letter-spacing: .14em; text-transform: uppercase; color: #ffd23f; text-shadow: 0 0 12px rgba(255, 160, 40, .45); }
.season[hidden] { display: none; }

/* -- club invites (09-29) -- */
.dock .tile { position: relative; }
.dock .tile.ping::after { content: ''; position: absolute; top: 7px; right: 9px; width: 9px; height: 9px; border-radius: 50%; background: #ff4d6d; box-shadow: 0 0 0 2px rgba(0,0,0,.35), 0 0 8px #ff4d6d; }
.invite { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; padding: 8px 10px; margin: 0 0 8px; border-radius: 10px; border: 1px solid #ffe066; background: rgba(255,224,102,.08); font-size: 14px; }
.invite span.who { flex: 1; min-width: 150px; text-align: left; }
.members li { display: flex; align-items: center; gap: 6px; }
.members li .kick { margin-left: auto; padding: 0 7px; line-height: 20px; border-radius: 6px; border: 1px solid #5a6878; background: none; color: #ff8a9a; cursor: pointer; font: inherit; font-size: 12px; }
.inviterow { display: flex; gap: 6px; margin: 4px 0 8px; }
.inviterow input { flex: 1; min-width: 0; }
.lockrow { display: flex; align-items: center; gap: 8px; margin: 6px 0; font-size: 14px; }
