/* ============================================================================================
   Kerbside Karting — UI styles (canvas, overlay layering, menus, HUD, results)
   ============================================================================================ */
:root {
  --display: 'Lilita One', 'Arial Black', Impact, sans-serif;
  --body: 'Nunito', 'Segoe UI', system-ui, sans-serif;
  --ink: #14122b;
  --gold: #ffd23f;
  --orange: #ff8a1f;
  --red: #ff4757;
  --blue: #2f8bff;
  --cyan: #3de0ff;
  --panel: rgba(16, 20, 48, 0.72);
  --panel-solid: #161a3a;
  --outline: 0 3px 0 var(--ink), 0 -2px 0 var(--ink), 3px 0 0 var(--ink), -3px 0 0 var(--ink), 2px 2px 0 var(--ink), -2px 2px 0 var(--ink), 2px -2px 0 var(--ink), -2px -2px 0 var(--ink);
  --ui-scale: 1;
}

* { box-sizing: border-box; }
html, body {
  margin: 0; padding: 0; width: 100%; height: 100%; overflow: hidden;
  background: #0b1020; color: #fff;
  font-family: var(--body);
  user-select: none; -webkit-user-select: none;
  -webkit-font-smoothing: antialiased;
}
#game-root { position: fixed; inset: 0; overflow: hidden; }
#game-canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; outline: none; }
#ui-root { position: absolute; inset: 0; pointer-events: none; z-index: 2; overflow: hidden; }

button { font: inherit; color: inherit; }
.hidden { display: none !important; }

/* ---------------------------------------------------------------- generic buttons */
.btn {
  pointer-events: auto; cursor: pointer;
  font-family: var(--display); font-size: 26px; letter-spacing: 1px;
  color: #fff; text-shadow: 0 2px 0 rgba(0,0,0,0.35);
  padding: 12px 28px; min-width: 200px;
  border: 3px solid rgba(255,255,255,0.9); border-radius: 16px;
  background: linear-gradient(180deg, #4a5bd8 0%, #2c35a0 100%);
  box-shadow: 0 6px 0 #161b5c, 0 10px 20px rgba(0,0,0,0.35);
  transition: transform 0.12s ease, box-shadow 0.12s ease, background 0.15s, filter 0.15s;
}
.btn.primary { background: linear-gradient(180deg, #ffcf3a 0%, #ff8a1f 100%); color: #fff; box-shadow: 0 6px 0 #b24a00, 0 10px 20px rgba(0,0,0,0.35); }
.btn:hover, .btn.focus { transform: translateY(-3px) scale(1.04); filter: brightness(1.12); }
.btn.focus { outline: 4px solid #fff; outline-offset: 3px; animation: focusGlow 1s ease-in-out infinite alternate; }
.btn:active { transform: translateY(3px); box-shadow: 0 2px 0 #161b5c; }
@keyframes focusGlow { from { box-shadow: 0 6px 0 rgba(0,0,0,0.45), 0 0 0 rgba(255,210,63,0); } to { box-shadow: 0 6px 0 rgba(0,0,0,0.45), 0 0 26px rgba(255,210,63,0.85); } }

/* ---------------------------------------------------------------- screens */
.screen {
  position: absolute; inset: 0; opacity: 0; visibility: hidden; pointer-events: none;
  transition: opacity 0.35s ease, visibility 0s linear 0.35s;
}
.screen.active { opacity: 1; visibility: visible; pointer-events: auto; transition: opacity 0.35s ease; }

/* ---- intro card */
.intro-card {
  position: absolute; left: 0; bottom: 14vh; padding: 16px 60px 16px 40px; opacity: 0;
  background: linear-gradient(90deg, rgba(255,71,87,0.95), rgba(255,138,31,0.9) 80%, rgba(255,138,31,0));
  clip-path: polygon(0 0, 100% 0, 94% 100%, 0 100%);
  transform: translateX(-110%);
}
.intro-card.show { animation: introCard 4s cubic-bezier(.2,1,.3,1) forwards; }
@keyframes introCard {
  0% { transform: translateX(-110%); opacity: 1; }
  12%, 85% { transform: translateX(0); opacity: 1; }
  100% { transform: translateX(-10%); opacity: 0; }
}
.ic-sub { font-family: var(--display); font-size: 20px; letter-spacing: 2px; opacity: 0.95; }
.ic-name { font-family: var(--display); font-size: clamp(36px, 5vw, 64px); line-height: 1; text-shadow: 0 4px 0 rgba(0,0,0,0.35); }
.ic-skip { font-weight: 900; font-size: 12px; letter-spacing: 2px; opacity: 0.8; margin-top: 6px; }

/* ================================================================ HUD */
.hud { position: absolute; inset: 0; pointer-events: none; font-family: var(--display); color: #fff; }
.hud.shake { animation: shake 0.45s ease; }
@keyframes shake { 15% { transform: translate(-7px, 3px); } 30% { transform: translate(6px, -4px); } 50% { transform: translate(-4px, 2px); } 70% { transform: translate(3px, -1px); } }

.hud-tl { position: absolute; top: 18px; left: 24px; }
.hud-lap { display: flex; align-items: baseline; gap: 6px; text-shadow: var(--outline); transform-origin: left center; }
.hud-lap .lbl { font-size: 26px; color: #bfe6ff; }
.hud-lap .val { font-size: 60px; line-height: 1; }
.hud-lap .of { font-size: 34px; opacity: 0.9; }
.hud-lap.final .val { color: var(--gold); }
.hud-lap.pulse { animation: lapPulse 0.6s ease; }
@keyframes lapPulse { 30% { transform: scale(1.3); color: var(--gold); } }
.hud-timer {
  font-family: var(--body); font-weight: 900; font-size: 28px; font-variant-numeric: tabular-nums; letter-spacing: 1px;
  text-shadow: var(--outline); margin-top: 2px;
}
.hud-splits { margin-top: 4px; font-family: var(--body); font-weight: 900; font-size: 15px; font-variant-numeric: tabular-nums; }
.split { text-shadow: 0 2px 0 var(--ink), 0 0 3px var(--ink); opacity: 0.92; animation: splitIn 0.35s ease both; }
.split span { display: inline-block; width: 28px; color: #9fd3ff; }
.split.best { color: #8dff9a; }
@keyframes splitIn { from { opacity: 0; transform: translateX(-20px); } }
.hud-lappop {
  position: absolute; top: 120px; left: 24px; font-family: var(--body); font-weight: 900; font-size: 26px; color: var(--gold);
  text-shadow: var(--outline); opacity: 0;
}
.hud-lappop.show { animation: lapPop 2.2s ease forwards; }
@keyframes lapPop { 0% { opacity: 0; transform: translateY(10px); } 10%, 80% { opacity: 1; transform: none; } 100% { opacity: 0; } }

/* item slot */
.hud-item { position: absolute; top: 16px; left: 50%; transform: translateX(-50%); display: flex; flex-direction: column; align-items: center; }
.item-slot {
  position: relative; width: 112px; height: 112px; border-radius: 28px;
  background: radial-gradient(circle at 50% 35%, rgba(90,110,220,0.85), rgba(20,24,70,0.88));
  border: 5px solid #fff;
  box-shadow: 0 0 0 4px var(--ink), 0 8px 18px rgba(0,0,0,0.45), inset 0 -8px 16px rgba(0,0,0,0.35), inset 0 6px 10px rgba(255,255,255,0.18);
  display: flex; align-items: center; justify-content: center;
}
.item-slot::after { content: ''; position: absolute; inset: 6px; border-radius: 20px; border: 2px dashed rgba(255,255,255,0.18); }
.item-slot.filled { animation: slotGlow 1.4s ease-in-out infinite alternate; }
@keyframes slotGlow { to { box-shadow: 0 0 0 4px var(--ink), 0 0 26px rgba(255,220,90,0.75), inset 0 -8px 16px rgba(0,0,0,0.35); } }
.item-slot.spinning .item-img { animation: rouletteJitter 0.14s linear infinite; filter: blur(0.6px) brightness(1.1); }
@keyframes rouletteJitter { 0% { transform: translateY(-10px) scale(0.9); } 100% { transform: translateY(10px) scale(0.9); } }
.item-slot.got { animation: gotPop 0.4s cubic-bezier(.3,1.8,.5,1); }
@keyframes gotPop { 0% { transform: scale(0.7); } 60% { transform: scale(1.18); } 100% { transform: scale(1); } }
.item-img { width: 84px; height: 84px; image-rendering: auto; filter: drop-shadow(0 4px 2px rgba(0,0,0,0.4)); }
.item-count {
  position: absolute; right: -14px; bottom: -12px; font-size: 32px; color: var(--gold); text-shadow: var(--outline);
}
.hud-gun { margin-top: 8px; display: flex; align-items: center; gap: 8px; padding: 4px 10px; border-radius: 10px; background: rgba(10,12,40,0.55); font-family: var(--body); font-weight: 900; font-size: 11px; letter-spacing: 1px; }
.hud-gun[hidden] { display: none; }
.hud-gun i { width: 90px; height: 9px; border-radius: 5px; background: rgba(255,255,255,0.15); overflow: hidden; position: relative; }
.hud-gun i::after { content: ''; position: absolute; inset: 0; width: calc(var(--f, 1) * 100%); background: var(--orange); }
.hud-gun.ready i::after { background: #ff5cc8; box-shadow: 0 0 10px #ff5cc8; }
.item-hint { margin-top: 6px; font-family: var(--body); font-weight: 900; font-size: 11px; letter-spacing: 1px; padding: 2px 8px; border-radius: 8px; background: rgba(0,0,0,0.45); transition: opacity 0.2s; opacity: 0; }

/* standings */
.hud-standings { position: absolute; right: 18px; top: 18px; display: flex; flex-direction: column; gap: 3px; }
.st-row {
  display: flex; align-items: center; gap: 7px; height: 25px; padding: 0 12px 0 6px; border-radius: 13px;
  background: rgba(10,12,40,0.55); font-family: var(--body); font-weight: 900; font-size: 13px;
  transition: background 0.2s, transform 0.2s;
}
.st-row.me { background: linear-gradient(90deg, rgba(255,210,63,0.95), rgba(255,138,31,0.9)); color: var(--ink); transform: translateX(-8px); }
.st-row.out { opacity: 0.35; text-decoration: line-through; }
.st-pos { width: 16px; text-align: center; font-family: var(--display); font-size: 15px; }
.st-chip { width: 14px; height: 14px; border-radius: 50%; border: 2px solid #fff; }
.st-name { min-width: 56px; }

/* minimap */
.hud-minimap {
  position: absolute; left: 16px; bottom: 16px; width: clamp(150px, 24vmin, 240px); height: clamp(150px, 24vmin, 240px);
  border-radius: 24px; background: radial-gradient(circle, rgba(10,14,40,0.45), rgba(10,14,40,0.2) 70%, rgba(10,14,40,0));
}
.hud-minimap canvas { width: 100%; height: 100%; display: block; }

/* speedo + place */
.hud-br { position: absolute; right: 22px; bottom: 10px; display: flex; align-items: flex-end; gap: 6px; }
.hud-speedo { position: relative; width: clamp(120px, 17vmin, 160px); height: clamp(120px, 17vmin, 160px); margin-bottom: 18px; border-radius: 50%; transition: filter 0.2s; }
.hud-speedo.boost { filter: drop-shadow(0 0 14px rgba(255,160,40,0.9)); }
.hud-speedo canvas { width: 100%; height: 100%; }
.speed-val { position: absolute; left: 0; right: 0; top: 36%; text-align: center; font-size: clamp(30px, 4.4vmin, 42px); line-height: 1; text-shadow: var(--outline); }
.speed-unit { position: absolute; left: 0; right: 0; top: 64%; text-align: center; font-family: var(--body); font-weight: 900; font-size: 12px; opacity: 0.85; text-shadow: 0 1px 2px #000; }
.drift-pill {
  position: absolute; left: 50%; bottom: -14px; transform: translateX(-50%) scale(0.6); opacity: 0;
  padding: 3px 12px; border-radius: 10px; font-size: 15px; letter-spacing: 1px; background: #d8dbe8; color: var(--ink);
  border: 2px solid #fff; transition: transform 0.15s cubic-bezier(.3,1.8,.5,1), opacity 0.15s;
}
.drift-pill.show { opacity: 1; transform: translateX(-50%) scale(1); }
.drift-pill.lvl1 { background: #3aa0ff; color: #fff; box-shadow: 0 0 14px #3aa0ff; }
.drift-pill.lvl2 { background: #ff8a1f; color: #fff; box-shadow: 0 0 16px #ff8a1f; }
.drift-pill.lvl3 { background: #b34dff; color: #fff; box-shadow: 0 0 20px #d07bff; animation: ultra 0.25s linear infinite alternate; }
@keyframes ultra { to { filter: brightness(1.35); } }
.hud-place { --pc: #fff; display: flex; align-items: flex-start; line-height: 0.85; color: var(--pc); transform-origin: 70% 80%; }
.hud-place .num {
  font-size: clamp(90px, 16vmin, 150px);
  -webkit-text-stroke: 9px var(--ink); paint-order: stroke fill;
  text-shadow: 0 7px 0 var(--ink), 0 10px 20px rgba(0,0,0,0.4);
}
.hud-place .suf {
  font-size: clamp(34px, 6vmin, 56px); margin-top: 6px;
  -webkit-text-stroke: 6px var(--ink); paint-order: stroke fill; text-shadow: 0 4px 0 var(--ink);
}
.hud-place.bump { animation: placeBump 0.45s cubic-bezier(.3,1.8,.5,1); }
@keyframes placeBump { 0% { transform: scale(1.45) rotate(-6deg); } 100% { transform: none; } }

/* countdown */
.hud-countdown {
  position: absolute; left: 0; right: 0; top: 30%; text-align: center; font-size: clamp(120px, 26vmin, 260px); line-height: 1;
  -webkit-text-stroke: 12px var(--ink); paint-order: stroke fill; text-shadow: 0 12px 0 var(--ink), 0 0 60px rgba(255,255,255,0.4);
  opacity: 0; pointer-events: none;
}
.hud-countdown.show { animation: cdPop 0.95s cubic-bezier(.2,1.6,.4,1) forwards; }
.hud-countdown.n3 { color: #ff4757; } .hud-countdown.n2 { color: #ffa21f; } .hud-countdown.n1 { color: #ffe23f; }
.hud-countdown.go { color: #4dff7c; animation: goPop 1.1s cubic-bezier(.2,1.6,.4,1) forwards; }
@keyframes cdPop { 0% { opacity: 0; transform: scale(2.6); } 25% { opacity: 1; transform: scale(1); } 75% { opacity: 1; transform: scale(1); } 100% { opacity: 0; transform: scale(0.6); } }
@keyframes goPop { 0% { opacity: 0; transform: scale(0.3) rotate(-10deg); } 25% { opacity: 1; transform: scale(1.15) rotate(3deg); } 70% { opacity: 1; transform: scale(1.1); } 100% { opacity: 0; transform: scale(2.2); } }

/* banners */
.hud-banner {
  position: absolute; left: 0; right: 0; top: 24%; text-align: center; font-size: clamp(56px, 10vmin, 110px);
  color: var(--gold); -webkit-text-stroke: 9px var(--ink); paint-order: stroke fill; text-shadow: 0 8px 0 var(--ink);
  opacity: 0; font-style: italic;
}
.hud-banner.show { animation: bannerSweep 2.8s cubic-bezier(.2,.9,.3,1) forwards; }
.hud-banner.final { background: linear-gradient(90deg, rgba(255,71,87,0), rgba(255,71,87,0.85) 20%, rgba(255,71,87,0.85) 80%, rgba(255,71,87,0)); padding: 10px 0; }
.hud-banner.act { font-size: clamp(34px, 6.5vmin, 68px); padding: 12px 0; background: linear-gradient(90deg, rgba(20,10,20,0), rgba(20,10,20,0.78) 20%, rgba(20,10,20,0.78) 80%, rgba(20,10,20,0)); }
/* duel gap to the boss, under the standings */
.hud-duel { position: absolute; right: 18px; top: 78px; display: flex; align-items: baseline; gap: 8px; padding: 4px 12px; border-radius: 13px; background: rgba(10,12,40,0.55); font-family: var(--body); font-weight: 900; font-size: 13px; font-variant-numeric: tabular-nums; }
.hud-duel b { font-family: var(--display); font-weight: normal; font-size: 20px; text-shadow: var(--outline); }
.hud-duel.lead b { color: #8dff9a; } .hud-duel.trail b { color: #ff6b6b; }
.hud-duel[hidden] { display: none; }
@keyframes bannerSweep {
  0% { opacity: 1; transform: translateX(100vw) skewX(-12deg); }
  15% { transform: translateX(-2vw) skewX(-12deg); }
  22%, 78% { opacity: 1; transform: translateX(0) skewX(-8deg); }
  100% { opacity: 0; transform: translateX(-100vw) skewX(-12deg); }
}
.hud-wrongway {
  position: absolute; left: 50%; top: 22%; transform: translateX(-50%); display: none; flex-direction: column; align-items: center; gap: 4px;
  padding: 14px 34px 12px; border-radius: 20px; background: rgba(200,20,40,0.88); border: 5px solid #fff;
  box-shadow: 0 0 0 5px var(--ink), 0 0 40px rgba(255,40,60,0.7);
}
.hud-wrongway.show { display: flex; animation: wwBlink 0.6s steps(2, jump-none) infinite; }
@keyframes wwBlink { 50% { opacity: 0.45; } }
.ww-text { font-size: clamp(40px, 7vmin, 64px); text-shadow: 0 4px 0 var(--ink); letter-spacing: 2px; }
.ww-arrow { width: 0; height: 0; border-left: 30px solid transparent; border-right: 30px solid transparent; border-bottom: 34px solid #fff; transform: rotate(180deg); animation: wwArrow 0.6s ease-in-out infinite alternate; }
@keyframes wwArrow { to { transform: rotate(180deg) translateY(-6px); } }

.hud-flash { position: absolute; inset: 0; pointer-events: none; opacity: 0; background: radial-gradient(circle, #fffde0 0%, #fff27a 60%, #ffd23f 100%); z-index: 5; }
.hud-flash.flash { animation: flash 0.75s ease-out; }
.hud-flash.flash-soft { animation: flashSoft 0.5s ease-out; }
@keyframes flash { 0% { opacity: 0.95; } 15% { opacity: 0.4; } 25% { opacity: 0.85; } 100% { opacity: 0; } }
@keyframes flashSoft { 0% { opacity: 0.45; } 100% { opacity: 0; } }

.hud-finish { position: absolute; left: 0; right: 0; top: 20%; text-align: center; opacity: 0; }
.hud-finish.show { animation: finishIn 0.7s cubic-bezier(.2,1.6,.4,1) forwards; }
@keyframes finishIn { from { opacity: 0; transform: scale(3) rotate(8deg); } to { opacity: 1; transform: none; } }
.fin-title {
  display: inline-block; font-size: clamp(80px, 15vmin, 160px); font-style: italic; padding: 0 40px;
  color: #fff; -webkit-text-stroke: 10px var(--ink); paint-order: stroke fill; text-shadow: 0 10px 0 var(--ink);
  background:
    repeating-conic-gradient(rgba(0,0,0,0.85) 0 25%, rgba(255,255,255,0.85) 0 50%) 0 0 / 40px 40px;
  border: 6px solid #fff; border-radius: 20px; box-shadow: 0 0 0 6px var(--ink), 0 20px 40px rgba(0,0,0,0.45);
  transform: skewX(-8deg);
}
.fin-place { font-size: clamp(60px, 11vmin, 120px); margin-top: 18px; -webkit-text-stroke: 8px var(--ink); paint-order: stroke fill; text-shadow: 0 8px 0 var(--ink); }
.fin-place small { font-size: 0.45em; vertical-align: top; }

/* toast */
.toast { position: absolute; left: 50%; bottom: 24px; transform: translateX(-50%); padding: 8px 20px; border-radius: 20px; background: rgba(0,0,0,0.7);
  font-family: var(--display); font-size: 18px; letter-spacing: 1px; opacity: 0; z-index: 20; }
.toast.show { animation: toast 1.6s ease forwards; }
@keyframes toast { 0% { opacity: 0; transform: translate(-50%, 20px); } 15%, 75% { opacity: 1; transform: translate(-50%, 0); } 100% { opacity: 0; } }

/* ================================================================ results */
.results {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; pointer-events: auto; z-index: 10;
  background: radial-gradient(ellipse at center, rgba(20,24,70,0.55), rgba(6,8,24,0.85));
  opacity: 0; transition: opacity 0.4s ease;
}
.results.show { opacity: 1; }
.res-panel {
  width: min(780px, 94vw); max-height: 94vh; display: flex; flex-direction: column; align-items: stretch; gap: 8px;
  padding: 16px 24px 18px; border-radius: 28px; background: linear-gradient(180deg, rgba(44,52,140,0.96), rgba(18,20,58,0.96));
  border: 5px solid #fff; box-shadow: 0 0 0 5px var(--ink), 0 30px 60px rgba(0,0,0,0.55);
  transform: translateY(40px) scale(0.92); transition: transform 0.5s cubic-bezier(.2,1.5,.4,1);
}
.results.show .res-panel { transform: none; }
.res-title { text-align: center; font-family: var(--display); font-size: clamp(40px, 7vmin, 66px); line-height: 1; color: var(--gold); text-shadow: 0 5px 0 var(--ink); transform: skewX(-8deg); }
.res-sub { text-align: center; font-weight: 900; font-size: 13px; letter-spacing: 2px; opacity: 0.8; margin-bottom: 4px; }
.res-table { display: flex; flex-direction: column; gap: 4px; min-height: 0; }
.res-row {
  display: grid; grid-template-columns: 70px 50px 1fr auto 110px; align-items: center; gap: 12px;
  padding: 4px 14px 4px 8px; border-radius: 14px; background: rgba(255,255,255,0.08);
  animation: rowIn 0.45s cubic-bezier(.2,1.4,.4,1) both; animation-delay: var(--d);
}
@keyframes rowIn { from { opacity: 0; transform: translateX(60px); } to { opacity: 1; transform: none; } }
.res-row.me { background: linear-gradient(90deg, rgba(255,210,63,0.95), rgba(255,138,31,0.92)); color: var(--ink); box-shadow: 0 0 20px rgba(255,190,50,0.5); }
.res-row.me .res-place { -webkit-text-stroke: 5px var(--ink); }
.res-place { font-family: var(--display); font-size: 36px; line-height: 1; text-align: center; -webkit-text-stroke: 5px var(--ink); paint-order: stroke fill; }
.res-place small { font-size: 0.45em; vertical-align: top; }
.res-portrait { width: 46px; height: 46px; border-radius: 12px; overflow: hidden; border: 3px solid #fff; background: var(--kc); display: flex; align-items: center; justify-content: center; font-family: var(--display); font-size: 24px; }
.res-portrait img { width: 100%; height: 100%; object-fit: cover; }
.res-name { font-family: var(--display); font-size: 24px; }
.res-name em { font-style: normal; font-size: 12px; padding: 2px 7px; border-radius: 6px; background: var(--ink); color: var(--gold); vertical-align: middle; margin-left: 6px; }
.res-best { font-weight: 900; font-size: 12px; opacity: 0.75; font-variant-numeric: tabular-nums; }
.res-time { font-weight: 900; font-size: 22px; text-align: right; font-variant-numeric: tabular-nums; }
.res-buttons { display: flex; justify-content: center; gap: 18px; margin-top: 12px; flex-wrap: wrap; }

/* ================================================================ responsive */
@media (max-width: 900px) {
  .select-screen { padding: 14px; background: rgba(12,14,44,0.78); }
  .sel-body { flex-direction: column; }
  .sel-grid { width: 100%; grid-template-columns: repeat(4, minmax(0, 1fr)); grid-auto-rows: auto; }
  .card { grid-template-columns: 1fr; text-align: center; }
  .card-portrait { grid-row: auto; margin: 0 auto 4px; width: 52px; height: 52px; }
  .card-stats { display: none; }
  .sel-side { width: 100%; flex-direction: row; flex-wrap: wrap; }
  .preview { flex: 1 1 260px; }
  .opts { flex: 1 1 260px; }
  .controls-help { display: none; }
  .hud-standings { display: none; }
  .item-slot { width: 88px; height: 88px; border-radius: 22px; }
  .item-img { width: 64px; height: 64px; }
  .hud-lap .val { font-size: 44px; }
  .hud-timer { font-size: 22px; }
  .res-row { grid-template-columns: 54px 40px 1fr 90px; }
  .res-best { display: none; }
  .res-name { font-size: 18px; }
  .btn { min-width: 150px; font-size: 20px; }
}
@media (max-height: 640px) {
  .controls-help { display: none; }
  .pv-portrait { width: 84px; height: 84px; }
  .pv-name { font-size: 30px; }
  .card { padding: 5px; }
  .res-row { padding: 2px 10px 2px 6px; }
  .res-place { font-size: 28px; }
  .res-portrait { width: 36px; height: 36px; }
}
@media (prefers-reduced-motion: reduce) {
  .logo, .press-start, .btn.focus, .item-slot.filled { animation: none !important; }
}

/* ---- showroom (the canvas underneath takes drag / wheel, so only the controls catch the pointer) */
.showroom-screen { display: flex; flex-direction: column; justify-content: space-between; padding: 22px 28px 18px; }
.showroom-screen.active { pointer-events: none; }
.showroom-screen .sel-back, .sr-arrow { pointer-events: auto; }
.sel-hdr-btns { display: flex; gap: 10px; }
.sr-bar { display: flex; align-items: center; justify-content: center; gap: 24px; margin-top: auto; }
.sr-info { min-width: 260px; padding: 12px 20px; border-radius: 20px; background: var(--panel); border: 3px solid rgba(255,255,255,0.22); }
.sr-arrow { font-size: 34px; cursor: pointer; padding: 6px 14px; border-radius: 14px; background: rgba(0,0,0,0.35); }
.sr-arrow:hover { background: rgba(255,255,255,0.15); }
.sr-help { text-align: center; font-weight: 900; font-size: 12px; letter-spacing: 1px; opacity: 0.7; margin-top: 12px; }

/* ================================================================ career overworld */
.ow-hud { position: absolute; inset: 0; pointer-events: none; z-index: 8; font-family: var(--body); color: #fff; }
.ow-area { position: absolute; left: 50%; top: 9%; transform: translateX(-50%); font-family: var(--display); font-size: clamp(28px, 5vw, 56px);
  text-shadow: var(--outline); letter-spacing: 1px; opacity: 0; white-space: nowrap; }
.ow-area.show { animation: owFade 3.2s ease forwards; }
.ow-news { position: absolute; left: 50%; top: 20%; transform: translateX(-50%); padding: 10px 22px; border-radius: 16px; background: rgba(20, 16, 4, 0.78);
  border: 2px solid var(--gold); color: var(--gold); font-family: var(--display); font-size: 20px; opacity: 0; max-width: 90vw; text-align: center; }
.ow-news.show { animation: owFade 4.5s ease forwards; }
@keyframes owFade { 0% { opacity: 0; transform: translate(-50%, 12px); } 12%, 80% { opacity: 1; transform: translate(-50%, 0); } 100% { opacity: 0; } }
.ow-prompt { position: absolute; left: 50%; bottom: 7%; transform: translate(-50%, 20px); min-width: 300px; padding: 14px 26px; border-radius: 20px;
  background: var(--panel); border: 2px solid rgba(255,255,255,0.25); display: flex; flex-direction: column; align-items: center; gap: 2px;
  opacity: 0; transition: opacity 0.2s, transform 0.2s; }
.ow-prompt.show { opacity: 1; transform: translate(-50%, 0); }
.ow-prompt b { font-family: var(--display); font-size: 30px; text-shadow: var(--outline); }
.ow-prompt span { font-size: 16px; opacity: 0.9; }
.ow-prompt small { font-size: 14px; color: var(--gold); }
.ow-prompt em { margin-top: 6px; font-style: normal; font-family: var(--display); font-size: 17px; color: var(--cyan); }
.ow-prompt em.locked { color: var(--red); }
.library-location { position: absolute; top: 28px; left: 32px; color: #f3e5c4; font: 22px Georgia, serif; letter-spacing: 1px; padding: 12px 20px; background: rgba(35, 45, 33, 0.85); border: 1px solid #b79a60; }
.library-hud .ow-prompt { background: rgba(30, 43, 33, 0.94); border: 1px solid #b79a60; border-radius: 5px; color: #f1e2c0; text-align: center; }
.library-hud .ow-prompt b { font: 26px Georgia, serif; text-shadow: none; }
.library-hud .ow-prompt em { font: 16px Georgia, serif; color: #d1b274; }
.library-panel { position: absolute; inset: 6% 10%; z-index: 15; overflow-y: auto; pointer-events: auto; user-select: text; background: #eee2c5; color: #352c20; border: 5px solid #634c2f; box-shadow: 0 0 0 1px #bd9a55, 0 24px 90px #0009; font: 18px/1.75 Georgia, serif; }
.library-panel[hidden] { display: none; }
.library-panel header { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 14px 26px; background: #1b3d31; color: #ead7a1; letter-spacing: 2px; }
.library-panel button { cursor: pointer; font: inherit; color: inherit; border: 1px solid #ad965c; background: transparent; padding: 7px 14px; }
.library-panel button:focus-visible, .library-panel input:focus-visible { outline: 3px solid #ac7830; outline-offset: 2px; }
.library-panel button:hover, .library-panel button[aria-pressed="true"] { background: #d7c69a; color: #243d30; }
.library-panel nav { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; padding: 16px 26px; border-bottom: 1px solid #c1ad7d; }
.library-panel nav small { margin-left: auto; color: #6b6049; }
.library-reading { display: grid; grid-template-columns: minmax(180px, 28%) 1fr; min-height: 330px; }
.library-reading aside { display: flex; flex-direction: column; gap: 9px; padding: 22px; border-right: 1px solid #c1ad7d; background: #e3d5b4; }
.library-reading aside button { text-align: left; line-height: 1.5; }
.library-panel small { display: block; font-size: 13px; }
.library-panel article { padding: 28px 40px; max-width: 850px; }
.library-panel h1 { margin: 0 0 8px; font-size: clamp(26px, 3vw, 42px); font-weight: normal; line-height: 1.2; }
.library-panel p { margin: 16px 0; }
.library-byline { font-style: italic; color: #6b6049; }
.library-page { margin-top: 38px; color: #786d55; font-size: 13px; border-top: 1px solid #c1ad7d; padding-top: 14px; }
.library-panel footer { padding: 14px 26px; background: #e0d1ac; color: #6b6049; font-size: 14px; }
.library-search { display: flex; align-items: center; gap: 18px; padding: 12px 26px; font-size: 15px; }
.library-search input { flex: 1; min-width: 0; padding: 10px; border: 1px solid #ac965e; color: #352c20; background: #fbf4e1; font: inherit; }
@media (max-width: 700px) { .library-panel { inset: 3%; font-size: 16px; } .library-reading { grid-template-columns: 1fr; } .library-reading aside { flex-direction: row; overflow-x: auto; border-right: 0; } .library-reading aside button { min-width: 160px; } .library-panel article { padding: 22px; } .library-panel header { letter-spacing: 0; padding: 10px; } .library-location { top: 15px; left: 15px; font-size: 16px; } }
.ow-turbo { position: absolute; right: 28px; bottom: 28px; display: none; align-items: center; gap: 10px; padding: 8px 14px; border-radius: 14px; background: var(--panel);
  font-family: var(--display); font-size: 18px; }
.ow-turbo.on { display: flex; }
.ow-turbo i { width: 120px; height: 12px; border-radius: 6px; background: rgba(255,255,255,0.15); overflow: hidden; position: relative; }
.ow-turbo i::after { content: ''; position: absolute; inset: 0; width: calc(var(--f, 1) * 100%); background: var(--orange); }
.ow-turbo.ready i::after { background: var(--cyan); box-shadow: 0 0 10px var(--cyan); }
.ow-flash { position: absolute; inset: 0; background: #d9c6ff; opacity: 0; }
.ow-flash.go { animation: owFlash 0.9s ease-out; }
@keyframes owFlash { 0% { opacity: 0.95; } 100% { opacity: 0; } }

/* fishing off Old Sal's pier */
.fish-hud { position: absolute; inset: 0; pointer-events: none; z-index: 8; font-family: var(--body); color: #fff; }
.fish-hud kbd { display: inline-block; padding: 1px 8px; border-radius: 6px; background: rgba(255,255,255,0.16); border-bottom: 2px solid rgba(0,0,0,0.4); font: inherit; font-family: var(--display); }
.fish-log { position: absolute; right: 28px; top: 24px; padding: 10px 18px; border-radius: 16px; background: var(--panel); text-align: right; display: flex; flex-direction: column; }
.fish-log b { font-family: var(--display); font-size: 30px; line-height: 1; color: var(--gold); display: inline; }
.fish-log span { font-size: 13px; opacity: 0.8; }
.fish-hint { position: absolute; left: 50%; bottom: 4%; transform: translateX(-50%); width: max-content; max-width: 94%; text-align: center; font-weight: 800; font-size: 16px; line-height: 1.6; text-shadow: 0 2px 6px rgba(0,0,0,0.7); }
.fish-talk { position: absolute; left: 28px; bottom: 11%; max-width: min(520px, 80vw); display: flex; gap: 14px; align-items: flex-start; padding: 14px 20px; border-radius: 20px;
  background: rgba(24, 20, 8, 0.86); border: 2px solid var(--gold); opacity: 0; transform: translateY(16px); transition: opacity 0.25s, transform 0.25s; }
.fish-talk.show { opacity: 1; transform: none; }
.fish-talk > i { font-style: normal; font-size: 44px; line-height: 1; filter: drop-shadow(0 3px 0 var(--ink)); }
.fish-talk b { font-family: var(--display); color: var(--gold); font-size: 18px; }
.fish-talk p { margin: 2px 0 0; font-size: 17px; font-weight: 700; line-height: 1.35; }
.fish-talk em { display: none; font-style: normal; font-family: var(--display); color: var(--cyan); font-size: 14px; margin-top: 6px; animation: fishBlink 1s steps(2) infinite; }
.fish-talk.wait em { display: block; }
.fish-power { position: absolute; left: 50%; bottom: 12%; transform: translateX(-50%); display: none; align-items: center; gap: 12px; padding: 10px 16px; border-radius: 16px; background: var(--panel); font-family: var(--display); font-size: 20px; }
.fish-power.show { display: flex; }
.fish-power div { width: 260px; height: 16px; border-radius: 8px; overflow: hidden; background: rgba(255,255,255,0.12); }
.fish-power i { display: block; height: 100%; background: linear-gradient(90deg, var(--cyan), var(--gold) 70%, var(--orange)); }
.fish-bite { position: absolute; left: 50%; top: 26%; transform: translateX(-50%) scale(0); font-family: var(--display); font-size: 120px; color: var(--gold); text-shadow: var(--outline); }
.fish-bite.show { animation: fishPop 0.35s cubic-bezier(.2,1.8,.4,1) forwards, fishShake 0.12s 0.35s linear infinite; }
.fish-reel { position: absolute; right: 16%; top: 50%; transform: translateY(-50%); display: none; gap: 10px; padding: 12px; border-radius: 18px; background: var(--panel); border: 2px solid rgba(255,255,255,0.25); }
.fish-reel.show { display: flex; }
.fr-track { position: relative; width: 46px; height: min(360px, 52vh); border-radius: 12px; background: linear-gradient(#0e3a5c, #06192b); overflow: hidden; }
.fr-zone { position: absolute; left: 3px; right: 3px; border-radius: 9px; background: rgba(90, 220, 120, 0.45); border: 2px solid #5adc78; transition: background 0.15s; }
.fr-zone.on { background: rgba(120, 255, 150, 0.7); box-shadow: 0 0 14px #5adc78; }
.fr-fish { position: absolute; left: 50%; transform: translateX(-50%); font-size: 26px; line-height: 28px; filter: drop-shadow(0 2px 0 var(--ink)); }
.fr-prog { position: relative; width: 12px; border-radius: 6px; background: rgba(255,255,255,0.12); overflow: hidden; }
.fr-prog i { position: absolute; left: 0; right: 0; bottom: 0; background: linear-gradient(0deg, var(--red), var(--gold) 50%, #5adc78); }
.fish-card { position: absolute; left: 50%; top: 46%; transform: translate(-50%, -50%) scale(0.6); opacity: 0; display: flex; flex-direction: column; align-items: center; gap: 4px;
  width: min(380px, 86vw); padding: 26px 26px 18px; border-radius: 26px; background: var(--panel-solid); border: 3px solid rgba(255,255,255,0.3); text-align: center; overflow: hidden; }
.fish-card.show { opacity: 1; transform: translate(-50%, -50%) scale(1); transition: transform 0.35s cubic-bezier(.2,1.6,.4,1), opacity 0.2s; }
.fish-card[data-tier="1"] { border-color: var(--cyan); }
.fish-card[data-tier="2"] { border-color: #b77bff; box-shadow: 0 0 40px rgba(183,123,255,0.5); }
.fish-card[data-tier="3"] { border-color: var(--gold); box-shadow: 0 0 60px rgba(255,210,63,0.6); }
.fc-burst { position: absolute; left: 50%; top: 72px; width: 360px; height: 360px; margin: -180px 0 0 -180px; opacity: 0.1;
  background: repeating-conic-gradient(#fff 0 10deg, transparent 10deg 20deg); border-radius: 50%; animation: fishSpin 12s linear infinite; }
.fc-icon { position: relative; font-size: 84px; line-height: 1.1; filter: drop-shadow(0 4px 0 var(--ink)); }
.fish-card.show .fc-icon { animation: fishIconPop 0.5s 0.1s cubic-bezier(.2,1.8,.4,1) both; }
.fc-tier { position: relative; font-weight: 900; letter-spacing: 3px; text-transform: uppercase; font-size: 12px; opacity: 0.8; }
.fish-card[data-tier="1"] .fc-tier { color: var(--cyan); opacity: 1; }
.fish-card[data-tier="2"] .fc-tier { color: #c9a0ff; opacity: 1; }
.fish-card[data-tier="3"] .fc-tier { color: var(--gold); opacity: 1; }
.fc-name { position: relative; font-family: var(--display); font-size: 30px; text-shadow: var(--outline); }
.fc-kg { position: relative; font-family: var(--display); color: var(--gold); font-size: 18px; }
.fc-text { position: relative; margin: 6px 0 4px; font-size: 15px; font-weight: 700; opacity: 0.9; line-height: 1.35; }
.fc-new { position: absolute; right: -34px; top: 18px; transform: rotate(35deg); width: 140px; padding: 3px 0; background: var(--red); font-family: var(--display); text-decoration: none; font-size: 15px; }
.fish-card em { position: relative; font-style: normal; font-family: var(--display); color: var(--cyan); font-size: 15px; animation: fishBlink 1s steps(2) infinite; }
@keyframes fishPop { from { transform: translateX(-50%) scale(0); } to { transform: translateX(-50%) scale(1); } }
@keyframes fishIconPop { from { transform: scale(0) rotate(-30deg); } to { transform: scale(1) rotate(0); } }
@keyframes fishShake { 0%, 100% { margin-left: -4px; } 50% { margin-left: 4px; } }
@keyframes fishSpin { to { transform: rotate(360deg); } }
@keyframes fishBlink { 50% { opacity: 0.35; } }

/* story films (cutscenes/*.html) */
.cutscene { position: fixed; inset: 0; z-index: 1000; background: #000; cursor: pointer; }
.cutscene iframe { width: 100%; height: 100%; border: 0; display: block; pointer-events: none; }
.cutscene video { width: 100%; height: 100%; object-fit: contain; display: block; pointer-events: none; }
.cutscene .cs-skip { position: absolute; right: 24px; bottom: 18px; font: 800 12px/1 'Nunito', sans-serif; letter-spacing: 3px; color: rgba(255,255,255,.45); }

/* South Meadows chess: the game page sits over the seated view of the table (see enterChess in main.js) */
.chess-frame { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; z-index: 9; pointer-events: auto; color-scheme: dark; background: transparent;
  animation: chess-in 0.5s ease both; }
@keyframes chess-in { from { opacity: 0; } }

/* ================================================================ Mirage Park */
.fair-ticket { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; background: rgba(20, 10, 4, 0.35); pointer-events: auto; }
.fair-ticket[hidden] { display: none; }
.ft-booth { position: relative; width: min(460px, 92vw); padding: 64px 26px 26px; border-radius: 18px 18px 12px 12px; background: #fbf1dc;
  border: 6px solid #8a5a36; box-shadow: 0 18px 50px rgba(0,0,0,0.5), inset 0 0 0 4px #c8283a; animation: ftIn 0.28s cubic-bezier(.2,1.4,.4,1); }
@keyframes ftIn { from { transform: translateY(30px) scale(0.92); opacity: 0; } }
.ft-awning { position: absolute; left: -14px; right: -14px; top: -18px; height: 46px; border-radius: 10px 10px 0 0;
  background: repeating-linear-gradient(90deg, #c8283a 0 34px, #fbf1dc 34px 68px); }
.ft-awning::after { content: ''; position: absolute; left: 0; right: 0; bottom: -14px; height: 14px;
  background: radial-gradient(circle at 17px 0, #c8283a 16px, transparent 17px) 0 0 / 68px 14px repeat-x, radial-gradient(circle at 17px 0, #fbf1dc 16px, transparent 17px) 34px 0 / 68px 14px repeat-x; }
.ft-sign { position: absolute; left: 50%; top: 10px; transform: translate(-50%, -50%); padding: 6px 22px; border-radius: 10px; background: #1f4f8a; border: 3px solid var(--gold);
  font-family: var(--display); font-size: 28px; letter-spacing: 2px; color: #ffe08a; text-shadow: 0 3px 0 #0c2244; white-space: nowrap; }
.ft-window { padding: 8px; border-radius: 10px; background: #8a5a36; }
.ft-glass { padding: 18px 20px; border-radius: 6px; background: linear-gradient(160deg, #eaf6ff, #c6e2f5); color: #2a1a10; text-align: center; display: flex; flex-direction: column; gap: 12px; }
.ft-say { margin: 0; font-style: italic; font-weight: 700; font-size: 16px; }
.ft-ticket { position: relative; margin: 0 auto; padding: 10px 72px 10px 18px; border-radius: 6px; background: #ffcf5a; border: 2px dashed #b8242a; transform: rotate(-2deg);
  display: flex; flex-direction: column; align-items: flex-start; box-shadow: 0 4px 0 rgba(0,0,0,0.15); }
.ft-ticket b { font-family: var(--display); font-size: 24px; color: #b8242a; letter-spacing: 2px; }
.ft-ticket span { font-size: 11px; font-weight: 900; letter-spacing: 1px; }
.ft-ticket i { position: absolute; right: 12px; top: 50%; transform: translateY(-50%); font-style: normal; font-family: var(--display); font-size: 28px; color: #2a1a10; }
.ft-wallet { font-weight: 800; }
.ft-wallet b { font-family: var(--display); font-size: 20px; color: #2a6a3c; }
.ft-btns { display: flex; gap: 10px; justify-content: center; }
.ft-btns button { font-family: var(--display); font-size: 20px; padding: 10px 20px; border-radius: 12px; border: 0; cursor: pointer; box-shadow: 0 4px 0 rgba(0,0,0,0.25); }
.ft-pay { background: #2a9e5a; color: #fff; }
.ft-pay:disabled { background: #9aa0a6; cursor: not-allowed; }
.ft-no { background: #fff; color: #2a1a10; }
.ft-btns button:not(:disabled):hover { filter: brightness(1.1); transform: translateY(-1px); }
.ft-glass small { font-size: 12px; font-weight: 800; opacity: 0.6; letter-spacing: 1px; }

.fair-cash { position: absolute; right: 28px; top: 24px; padding: 8px 18px; border-radius: 16px; background: var(--panel); display: flex; flex-direction: column; align-items: flex-end; }
.fair-cash span { font-size: 12px; font-weight: 900; letter-spacing: 2px; opacity: 0.75; }
.fair-cash b { font-family: var(--display); font-size: 30px; line-height: 1; color: var(--gold); }
.fair-panel { position: absolute; left: 50%; top: 22px; transform: translateX(-50%); display: none; gap: 12px; }
.fair-panel.show { display: flex; }
.fair-panel > div { min-width: 110px; padding: 8px 16px; border-radius: 16px; background: var(--panel); border: 2px solid rgba(255,255,255,0.2); text-align: center; display: flex; flex-direction: column; }
.fair-panel b { font-family: var(--display); font-size: 34px; line-height: 1.05; text-shadow: var(--outline); letter-spacing: 1px; }
.fair-panel b.small { font-size: 22px; color: var(--gold); }
.fair-panel span { font-size: 11px; font-weight: 900; letter-spacing: 2px; opacity: 0.8; }
.fair-msg { position: absolute; left: 50%; top: 40%; transform: translate(-50%, -50%) scale(0.9); padding: 20px 36px; border-radius: 24px; background: rgba(16, 20, 48, 0.85);
  border: 3px solid var(--gold); text-align: center; display: flex; flex-direction: column; align-items: center; gap: 4px; opacity: 0; transition: opacity 0.2s, transform 0.2s; }
.fair-msg.show { opacity: 1; transform: translate(-50%, -50%) scale(1); }
.fair-msg span { font-family: var(--display); font-size: 18px; letter-spacing: 2px; color: var(--cyan); }
.fair-msg b { font-family: var(--display); font-size: 72px; line-height: 1; color: var(--gold); text-shadow: var(--outline); }
.fair-msg b.small { font-size: 28px; color: #fff; }
.fair-msg em { font-style: normal; font-weight: 800; font-size: 17px; }
.fair-msg i { font-style: normal; font-family: var(--display); font-size: 22px; color: var(--red); animation: lapPulse 0.8s infinite; }
.fair-msg small { margin-top: 8px; font-weight: 900; font-size: 13px; letter-spacing: 1px; opacity: 0.8; }
.fair-help { position: absolute; left: 50%; bottom: 3%; transform: translateX(-50%); padding: 6px 16px; border-radius: 12px; background: rgba(0,0,0,0.45);
  width: max-content; max-width: 94%; box-sizing: border-box; text-align: center; line-height: 1.6; font-weight: 800; font-size: 13px; letter-spacing: 1px; opacity: 0; transition: opacity 0.3s; }
.fair-help.show { opacity: 1; }
.fair-cross { position: absolute; width: 46px; height: 46px; margin: -23px 0 0 -23px; border: 3px solid #fff; border-radius: 50%; display: none;
  box-shadow: 0 0 0 2px rgba(0,0,0,0.5), inset 0 0 0 2px rgba(0,0,0,0.5); }
.fair-cross::before, .fair-cross::after { content: ''; position: absolute; left: 50%; top: 50%; background: #ff3b3b; transform: translate(-50%, -50%); }
.fair-cross::before { width: 62px; height: 3px; } .fair-cross::after { width: 3px; height: 62px; }
.fair-cross.show { display: block; }
.fair-meter { position: absolute; right: 12%; top: 50%; width: 38px; height: 46vh; transform: translateY(-50%); border-radius: 19px; border: 4px solid #fff; display: none;
  background: linear-gradient(to top, #2a9e5a, #f6c431 55%, #ff8a1f 80%, #e8413a); box-shadow: 0 0 0 3px rgba(0,0,0,0.4); overflow: hidden; }
.fair-meter.show { display: block; }
.fair-meter i { position: absolute; left: 0; right: 0; top: 0; height: calc((1 - var(--f, 0)) * 100%); background: rgba(10, 12, 30, 0.82); }
.fair-meter b { position: absolute; left: -4px; right: -4px; bottom: calc(var(--f, 0) * 100%); height: 6px; margin-bottom: -3px; background: #fff; box-shadow: 0 0 10px #fff; }
.fair-flash { position: absolute; inset: 0; background: #fff8e0; opacity: 0; }
.fair-flash.go { animation: fairFlash 0.18s ease-out; }
@keyframes fairFlash { 0% { opacity: 0.55; } 100% { opacity: 0; } }
.fair-fade { position: absolute; inset: 0; background: #07060c; opacity: 0; }
.fair-toast.show { animation: owFade 2.6s ease forwards; }

/* Career file status: only shown when something needs the player's attention */
.cinema-source { position: fixed; left: -1500px; top: 0; width: 1280px; height: 720px; border: 0; pointer-events: none; }
.cinema-hud { position: absolute; inset: 0; pointer-events: none; color: #f3ddb0; font-family: var(--body, 'Barlow', sans-serif); }
.cinema-hud [hidden] { display: none !important; }
.cinema-status { position: absolute; top: 20px; left: 24px; display: flex; flex-direction: column; gap: 6px; padding: 12px 18px; background: #211919eb; border-radius: 4px; }
.cinema-status b { font: 24px Georgia, serif; }
.cinema-status span { font-size: 14px; font-variant-numeric: tabular-nums; }
.cinema-help { position: absolute; top: 24px; right: 24px; background: #211919eb; padding: 10px 14px; font-size: 13px; border-radius: 4px; }
.cinema-prompt { position: absolute; bottom: 24px; left: 50%; transform: translateX(-50%); width: max-content; max-width: calc(100% - 32px); padding: 10px 18px; text-align: center; background: #211919eb; border-radius: 4px; font-size: 15px; }
.cinema-prompt:empty { display: none; }
.cinema-controls { position: absolute; bottom: 24px; left: 50%; transform: translateX(-50%); width: max-content; max-width: calc(100% - 32px); display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 8px; }
.cinema-controls .cinema-prompt { position: static; transform: none; max-width: 100%; box-sizing: border-box; }
.cinema-controls button { min-height: 44px; padding: 10px 18px; border: 0; border-radius: 4px; background: #ebc98a; color: #241a1a; font: 700 15px var(--body, 'Barlow', sans-serif); cursor: pointer; pointer-events: auto; }
.cinema-controls button:hover { background: #ffe1a9; }
.cinema-controls button:active { background: #d7ad6a; }
.cinema-controls button:focus-visible { outline: 3px solid #fff3d6; outline-offset: 3px; }
.cinema-movie { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; background: #000; }
.cinema-fullscreen .cinema-status { display: none; }
.cinema-office { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); width: min(450px, calc(100% - 32px)); max-height: calc(100% - 32px); overflow: auto; box-sizing: border-box; padding: 24px 28px; background: #241a1a; box-shadow: 0 12px 38px #080403b3; border-radius: 6px; pointer-events: auto; }
.cinema-office h1 { margin: 0 0 14px; font: 32px Georgia, serif; color: #ffe5b1; }
.cinema-office p { margin: 12px 0; line-height: 1.5; font-size: 15px; }
.cinema-wallet { font-variant-numeric: tabular-nums; }
.cinema-schedule { padding: 0; margin: 20px 0; list-style: none; }
.cinema-schedule li { display: flex; justify-content: space-between; gap: 16px; padding: 10px 0; border-bottom: 1px solid #624c36; }
.cinema-schedule li:first-child { color: #ffce81; }
.cinema-schedule time { font-variant-numeric: tabular-nums; }
.cinema-office button { display: block; width: 100%; margin-top: 12px; padding: 12px 16px; border: 0; border-radius: 4px; font: 700 16px var(--body, 'Barlow', sans-serif); background: #ebc98a; color: #241a1a; cursor: pointer; }
.cinema-office button:hover { background: #ffe1a9; }
.cinema-office button[data-close] { background: #493333; color: #f3ddb0; }
.cinema-office button[data-close]:hover { background: #60423e; }
.cinema-office button:disabled { background: #625044; color: #e3cda9; cursor: default; }
.cinema-office button:focus-visible { outline: 3px solid #fff3d6; outline-offset: 3px; }
.cinema-office ::selection { background: #ebc98a; color: #241a1a; }
.cinema-office { scrollbar-color: #b59455 #241a1a; }
.cinema-watching .cinema-status { opacity: 0.65; }
.cinema-watching .cinema-help { display: none; }
@media (max-width: 640px) { .cinema-status { top: 12px; left: 12px; right: 12px; } .cinema-status b { font-size: 20px; } .cinema-help { top: 91px; left: 12px; right: auto; font-size: 12px; } .cinema-office { padding: 18px 20px; } .cinema-prompt { font-size: 13px; width: calc(100% - 64px); } }

/* Results fit the viewport, including eight racers on a short landscape display. */
@media (max-width: 600px) {
  .res-panel { padding: 14px 12px; border-radius: 18px; gap: 6px; }
  .res-title { font-size: clamp(28px,7vw,42px); }
  .res-sub { font-size: 10px; letter-spacing: 1px; }
  .res-row { grid-template-columns: 32px 32px minmax(0,1fr) 66px; gap: 6px; padding: 3px 6px; }
  .res-place { font-size: 25px; -webkit-text-stroke-width: 3px; }
  .res-portrait { width: 32px; height: 32px; border-width: 2px; }
  .res-name { font-size: 16px; }
  .res-name em { font-size: 9px; margin-left: 2px; padding: 2px 3px; }
  .res-time { font-size: 15px; }
  .res-buttons { gap: 10px; margin-top: 6px; }
  .res-buttons .btn { min-width: 0; flex: 1; padding: 10px 8px; font-size: 17px; }
}
@media (max-height: 600px) and (min-width: 601px) {
  .res-panel { width: min(960px,94vw); padding: 12px 16px; border-radius: 18px; }
  .res-title { font-size: 32px; }
  .res-sub { font-size: 10px; }
  .res-table:has(.res-row:nth-child(5)) { display: grid; grid-template-columns: 1fr 1fr; grid-auto-flow: column; grid-template-rows: repeat(4,auto); gap: 6px 14px; }
  .res-row { grid-template-columns: 32px 32px minmax(0,1fr) 66px; gap: 6px; padding: 3px 6px; }
  .res-best { display: none; }
  .res-place { font-size: 25px; }
  .res-portrait { width: 32px; height: 32px; }
  .res-name { font-size: 17px; }
  .res-time { font-size: 15px; }
  .res-buttons { margin-top: 4px; }
  .res-buttons .btn { padding: 8px 16px; font-size: 18px; }
}
