/*
 * Tilt Racers overlays, on top of /ds/ and /gamekit/gamekit.css. Logical
 * properties throughout, so the layout mirrors for Hebrew (RTL).
 */

/* Miniature look: a soft vignette over the diorama (spec §11.2, no DOF pass). */
#overlay::before {
  content: ''; position: absolute; inset: 0; pointer-events: none;
  background: radial-gradient(ellipse 72% 68% at 50% 52%, transparent 55%, rgb(8 6 14 / 0.42) 100%);
}
#overlay [hidden] { display: none !important; }

:root {
  --tr-glass: color-mix(in oklab, #0c0e16 72%, transparent);
  --tr-glass-strong: color-mix(in oklab, #0c0e16 88%, transparent);
  --tr-line: color-mix(in oklab, #ffffff 14%, transparent);
  --tr-orange: #ff8a3d;
  --tr-sun: #ffc24b;
  --tr-pad: clamp(16px, 2.4vw, 40px);
}

.tr-dot { display: inline-block; inline-size: .8em; block-size: .8em; border-radius: 50%; background: var(--c, #fff); box-shadow: 0 0 0 2px rgb(0 0 0 / .35), 0 0 12px var(--c, #fff); flex: none; }

/* ---- title ----------------------------------------------------------------- */
/* The kit's join card sits on the start side; the logo and the menu take the end side. */
.tr-title { position: absolute; inset-block: var(--safe-y, 5vh) calc(var(--safe-y, 5vh) + 2.4rem); inset-inline-end: var(--safe-x, 5vw); inline-size: min(36rem, 40vw);
  display: flex; flex-direction: column; justify-content: space-between; gap: clamp(10px, 3vh, 28px); pointer-events: none; }
.tr-title.is-attract { inset-inline: var(--safe-x, 5vw); inline-size: auto; }
.tr-logo { text-align: end; }
.is-attract .tr-logo { text-align: start; }
.tr-logo__kicker { display: inline-block; padding: 6px 14px; border-radius: 99px; background: var(--tr-glass); border: 1px solid var(--tr-line); font-size: clamp(12px, min(1.05vw, 2.2vh), 18px); font-weight: 600; color: var(--tr-sun); backdrop-filter: blur(6px); }
.tr-logo__title { margin: clamp(4px, 1.2vh, 12px) 0 0; padding-block: .04em .16em; font-size: clamp(34px, min(6.6vw, 12.5vh), 128px); line-height: 1; font-weight: 900; letter-spacing: -.04em;
  background: linear-gradient(175deg, #ffffff 16%, #ffe7a8 42%, var(--tr-sun) 60%, var(--tr-orange) 86%); -webkit-background-clip: text; background-clip: text; color: transparent;
  filter: drop-shadow(0 .05em 0 rgb(132 44 12 / .7)) drop-shadow(0 .14em .2em rgb(0 0 0 / .45)); }
.is-attract .tr-logo__title { font-size: clamp(48px, min(9vw, 17vh), 170px); }
.tr-logo__tag { margin: 0; font-size: clamp(15px, min(1.5vw, 3.2vh), 28px); font-weight: 600; color: #fff; text-shadow: 0 2px 12px rgb(0 0 0 / .7); }
.tr-title__side { display: flex; flex-direction: column; gap: clamp(6px, 1.4vh, 12px); }
.tr-menu { display: flex; flex-direction: column; gap: clamp(5px, 1.1vh, 10px); }
.tr-menu__item { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-block-size: clamp(36px, 7vh, 64px); padding: 0 clamp(14px, 1.6vw, 26px); border-radius: clamp(12px, 2vh, 18px);
  border: 1px solid var(--tr-line); background: var(--tr-glass); color: #fff; font: inherit; font-size: clamp(14px, min(1.45vw, 3.3vh), 26px); font-weight: 700; cursor: pointer; text-align: start; pointer-events: auto;
  backdrop-filter: blur(10px); transition: transform var(--dur-1, .12s) var(--ease-out, ease), background var(--dur-1, .12s), box-shadow var(--dur-2, .22s); }
.tr-menu__value { font-weight: 600; color: var(--tr-sun); }
.tr-menu__item--start { min-block-size: clamp(44px, 9vh, 84px); background: linear-gradient(135deg, var(--tr-orange), #ff4f7e); border-color: rgb(255 255 255 / .25); font-size: clamp(18px, min(1.9vw, 4.2vh), 34px); font-weight: 800;
  box-shadow: 0 .6em 1.6em -.6em rgb(255 90 60 / .8), inset 0 1px 0 rgb(255 255 255 / .35); }
.tr-menu__go { inline-size: 1.1em; block-size: 1.1em; border-radius: 50%; background: #fff; position: relative; flex: none; }
.tr-menu__go::after { content: ''; position: absolute; inset: 0; margin: auto; inline-size: 0; block-size: 0; translate: 12% 0;
  border-block: .26em solid transparent; border-inline-start: .4em solid #ff5f6d; }
[dir="rtl"] .tr-menu__go::after { translate: -12% 0; }
.tr-menu__item:is(:focus, :focus-visible, .is-focused) { outline: none; transform: scale(1.03); box-shadow: 0 0 0 3px var(--focus, #5cf7d2), 0 0 30px -4px var(--focus, #5cf7d2); }
.tr-menu__item:hover { background: color-mix(in oklab, #1f2436 80%, transparent); }
.tr-menu__item--start:hover { background: linear-gradient(135deg, #ff9a52, #ff6f98); }
.tr-title__hint { align-self: flex-end; margin: 0; padding: 6px 16px; border-radius: 99px; background: var(--tr-glass); font-size: clamp(13px, min(1.15vw, 2.6vh), 20px); font-weight: 600; color: var(--text-muted, #b9bfd6); backdrop-filter: blur(6px); }
.tr-title__hint.is-ready { color: #0d1a14; background: color-mix(in oklab, var(--mint-400, #2ef2c2) 92%, transparent); }

/* ---- race HUD -------------------------------------------------------------- */
.tr-hud { position: absolute; inset: 0; pointer-events: none; }
.tr-tower { position: absolute; inset-block-start: var(--tr-pad); inset-inline-start: var(--tr-pad); margin: 0; padding: 0; list-style: none; inline-size: 300px; }
.tr-tower__row { position: absolute; inset-inline: 0; inset-block-start: 0; block-size: 38px; display: grid; grid-template-columns: 34px 14px 1fr auto; grid-template-rows: 1fr 4px; column-gap: 10px; align-items: center;
  padding-inline: 10px 14px; border-radius: 12px; background: var(--tr-glass); border-inline-start: 4px solid var(--c); font-size: 17px; font-weight: 600; backdrop-filter: blur(6px);
  transition: transform .45s var(--ease-spring, ease); }
.tr-tower__row.is-human { background: var(--tr-glass-strong); }
.tr-tower__pos { grid-row: 1 / 3; font-size: 22px; font-weight: 800; font-variant-numeric: tabular-nums; text-align: center; }
.tr-tower__row .tr-dot { grid-row: 1 / 3; }
.tr-tower__name { grid-row: 1 / 3; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tr-tower__info { grid-row: 1 / 3; font-size: 14px; font-weight: 500; color: var(--text-muted, #bfc4da); font-variant-numeric: tabular-nums; direction: ltr; }
.tr-tower__boost { position: absolute; inset-inline: 10px; inset-block-end: 3px; block-size: 3px; border-radius: 3px; background: rgb(255 255 255 / .12); overflow: hidden; }
.tr-tower__boost-fill { position: absolute; inset: 0; background: var(--c); transform-origin: left center; transform: scaleX(0); }
[dir="rtl"] .tr-tower__boost-fill { transform-origin: right center; }
.tr-tower__row.is-boost-ready .tr-tower__boost-fill { background: var(--tr-sun); box-shadow: 0 0 10px var(--tr-sun); }
.tr-hud__top { position: absolute; inset-block-start: var(--tr-pad); inset-inline: 0; display: flex; flex-direction: column; align-items: center; gap: 4px; }
.tr-lap { padding: 8px 22px; border-radius: 16px; background: var(--tr-glass-strong); font-size: clamp(22px, 2vw, 34px); font-weight: 800; letter-spacing: .01em; }
.tr-clock { padding: 3px 12px; border-radius: 10px; background: var(--tr-glass); font-family: var(--font-mono, monospace); font-size: 16px; direction: ltr; }
.tr-minimap { position: absolute; inset-block-end: var(--tr-pad); inset-inline-end: var(--tr-pad); inline-size: 220px; block-size: 170px; border-radius: 20px; background: var(--tr-glass); border: 1px solid var(--tr-line); backdrop-filter: blur(6px); }
.tr-tag { position: absolute; inset: 0 auto auto 0; padding: 3px 10px; border-radius: 99px; background: var(--c); color: #0b0c14; font-size: 14px; font-weight: 700; white-space: nowrap; translate: -50% -100%; box-shadow: 0 4px 14px rgb(0 0 0 / .4); }
.tr-arrow { position: absolute; inset: 0 auto auto 0; inline-size: 0; block-size: 0; border-block: 12px solid transparent; border-inline-start: 22px solid var(--c); translate: -50% -50%; filter: drop-shadow(0 2px 6px rgb(0 0 0 / .6)); }
[dir="rtl"] .tr-arrow { border-inline-start: none; border-inline-end: 22px solid var(--c); }

/* ---- countdown ---------------------------------------------------- */
.tr-count { position: absolute; inset: 0; display: grid; place-content: center; pointer-events: none; font-size: clamp(120px, 20vw, 320px); font-weight: 800; color: #fff; opacity: 0;
  text-shadow: 0 10px 0 rgb(150 40 20 / .6), 0 30px 60px rgb(0 0 0 / .5); }
.tr-count.is-on { animation: tr-count .9s var(--ease-out, ease) forwards; }
.tr-count.is-go { color: #4dff7a; text-shadow: 0 10px 0 rgb(10 90 40 / .7), 0 0 80px rgb(77 255 122 / .6); }
@keyframes tr-count { 0% { opacity: 0; transform: scale(2.2); } 25% { opacity: 1; transform: scale(1); } 75% { opacity: 1; } 100% { opacity: 0; transform: scale(.9); } }

/* Controls art: a phone held sideways, rocking like a wheel, thumbs pulsing. */
.tr-art { display: grid; place-items: center; block-size: 170px; margin-block-start: 8px; }
.tr-art__phone { position: relative; inline-size: 230px; block-size: 112px; border-radius: 22px; border: 5px solid #e8eaf2; background: linear-gradient(135deg, #1f2436, #10131d);
  box-shadow: 0 12px 30px rgb(0 0 0 / .4); animation: tr-steer 2.4s ease-in-out infinite; }
.tr-art__thumb { position: absolute; inset-block-end: 14px; inline-size: 52px; block-size: 52px; border-radius: 50%; animation: tr-thumb 1.2s ease-in-out infinite; }
.tr-art__thumb--l { inset-inline-start: 14px; background: radial-gradient(circle, #ff5c8a 40%, transparent 42%), rgb(255 92 138 / .25); }
.tr-art__thumb--r { inset-inline-end: 14px; background: radial-gradient(circle, #2ef2c2 40%, transparent 42%), rgb(46 242 194 / .25); animation-delay: .6s; }
[dir="rtl"] .tr-art__thumb--l { inset-inline-start: auto; inset-inline-end: 14px; }
[dir="rtl"] .tr-art__thumb--r { inset-inline-end: auto; inset-inline-start: 14px; }
@keyframes tr-steer { 0%, 100% { transform: rotate(-24deg); } 50% { transform: rotate(24deg); } }
@keyframes tr-thumb { 0%, 100% { transform: scale(.85); } 50% { transform: scale(1.05); } }

/* ---- benchmark readout --------------------------------------------------------- */
.tr-bench { position: absolute; inset-block-end: 10px; inset-inline-start: 10px; margin: 0; padding: 10px 14px; border-radius: 12px; background: var(--tr-glass-strong); font: 13px/1.4 var(--font-mono, monospace); direction: ltr; text-align: left; }

/* Title sizes above scale with the viewport height, so the menu fits a 1080p TV
   WebView at DPR 2 (960×540 CSS px). Very short viewports (640×360) also drop
   the secondary logo lines. */
@media (max-height: 420px) {
  .tr-logo__kicker, .tr-logo__tag { display: none; }
  .tr-logo__title { margin-block-start: 0; }
}

/* Small viewports (and low-resolution TV browsers): tighter cards. */
@media (max-height: 560px) {
  .tr-art { block-size: 110px; }
  .tr-art__phone { inline-size: 160px; block-size: 80px; }
  .tr-art__thumb { inline-size: 36px; block-size: 36px; inset-block-end: 10px; }
}

@media (prefers-reduced-motion: reduce) {
  .tr-art__phone, .tr-art__thumb { animation: none; }
}
