/* Parking Pro. Logical properties, so RTL and LTR share one file; the lot and the pedals stay LTR.
   The script sets the root height, --lw (lot width when the screen is wide) and --pad (pedal height). */
:root {
    --bg: #0d1022; --surface: #171b36; --surface2: #20254a; --border: #2c3260; --text: #eef0ff; --muted: #a3a8d1;
    --accent: #ffb020; --accent2: #ffd24a; --ink: #1a1300; --ok: #4ade80; --bad: #ff6b6b; --blue: #38bdf8; --rev: #ff7a59;
    --font: system-ui, "Segoe UI", Tahoma, "Noto Sans Arabic", "Noto Sans", Arial, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); font-family: var(--font); overflow: hidden; }
body { -webkit-tap-highlight-color: transparent; user-select: none; -webkit-user-select: none; -webkit-text-size-adjust: 100%; }
button { font: inherit; color: inherit; margin: 0; }
h2, h3, p, ul, ol { margin: 0; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
[hidden] { display: none !important; }
svg { display: block; }

/* ---------- the frame: head / lot / dashboard / pedals ---------- */
.game {
    position: relative; isolation: isolate; overflow: hidden; margin-inline: auto; padding: 8px; max-inline-size: 536px;
    display: grid; gap: 8px;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    grid-template-rows: 48px minmax(0, 1fr) 52px var(--pad, 108px);
    grid-template-areas: "hud hud" "stage stage" "dash dash" "steer pedals";
    --glow: #1c2a52;
}
.game::before {
    content: ""; position: absolute; inset: 0; z-index: -1; pointer-events: none;
    background: radial-gradient(70% 70% at 50% 0%, var(--glow), transparent 72%), var(--bg);
}
.game[data-theme="school"] { --glow: #1d3f34; }
.game[data-theme="mall"] { --glow: #2a2d4a; }
.game[data-theme="sea"] { --glow: #4a3320; }
.game[data-theme="night"] { --glow: #1a2260; }
.game[data-theme="storm"] { --glow: #1e3346; }
.game.fill { max-inline-size: 576px; }
.game.swap { grid-template-areas: "hud hud" "stage stage" "dash dash" "pedals steer"; }
/* steering stays under the left thumb whatever the language: RTL flips the columns, so the names flip back */
[dir="rtl"] .game:not(.swap):not(.wide):not(.nodash):not([data-screen="home"]) { grid-template-areas: "hud hud" "stage stage" "dash dash" "pedals steer"; }
[dir="rtl"] .game.swap:not(.wide):not(.nodash):not([data-screen="home"]) { grid-template-areas: "hud hud" "stage stage" "dash dash" "steer pedals"; }
.game.nodash { grid-template-rows: 48px minmax(0, 1fr) var(--pad, 108px); grid-template-areas: "hud hud" "stage stage" "steer pedals"; }
.game.nodash.swap { grid-template-areas: "hud hud" "stage stage" "pedals steer"; }
[dir="rtl"] .game.nodash:not(.swap):not(.wide):not([data-screen="home"]) { grid-template-areas: "hud hud" "stage stage" "pedals steer"; }
[dir="rtl"] .game.nodash.swap:not(.wide):not([data-screen="home"]) { grid-template-areas: "hud hud" "stage stage" "steer pedals"; }
.game.nodash .dash { display: none; }
.game.keys { grid-template-rows: 48px minmax(0, 1fr) 100px; grid-template-areas: "hud hud" "stage stage" "dash dash"; }
.game.keys .pads { display: none; }

.game.wide {
    max-inline-size: none;
    grid-template-columns: minmax(0, 1fr) var(--lw, 420px) minmax(0, 1fr);
    grid-template-rows: auto minmax(0, 1fr) auto;
    grid-template-areas: "hud stage dash" "gap stage dash" "steer stage pedals";
}
.game.wide.swap { grid-template-areas: "hud stage dash" "gap stage dash" "pedals stage steer"; }
[dir="rtl"] .game.wide:not(.swap):not([data-screen="home"]) { grid-template-areas: "hud stage dash" "gap stage dash" "pedals stage steer"; }
[dir="rtl"] .game.wide.swap:not([data-screen="home"]) { grid-template-areas: "hud stage dash" "gap stage dash" "steer stage pedals"; }
.game.wide.keys .dash { grid-row: 1 / -1; }

.game[data-screen="home"] { grid-template-rows: 48px minmax(0, 1fr) auto auto; grid-template-areas: "brand brand" "stage stage" "menu menu" "menu2 menu2"; }
.game.wide[data-screen="home"] {
    grid-template-columns: var(--lw, 420px) minmax(0, 440px); grid-template-rows: auto auto minmax(0, 1fr);
    grid-template-areas: "stage brand" "stage menu" "stage menu2"; justify-content: center; column-gap: 18px;
}
.game[data-screen="home"] .hud, .game[data-screen="home"] .dash, .game[data-screen="home"] .pads,
.game[data-screen="play"] .brand, .game[data-screen="play"] .menu, .game[data-screen="play"] .menu2, .game[data-screen="play"] .tapplay { display: none; }

/* ---------- head ---------- */
.hud { grid-area: hud; display: flex; align-items: stretch; gap: 8px; min-inline-size: 0; }
.hud-btns { display: flex; gap: 6px; flex: none; }
.icon {
    flex: none; inline-size: 46px; block-size: 46px; padding: 0; border-radius: 13px; cursor: pointer;
    background: linear-gradient(#232955, #171b3a); border: 1px solid var(--border); display: grid; place-items: center; box-shadow: 0 3px 0 #090b1a;
}
.icon:active { transform: translateY(2px); box-shadow: 0 1px 0 #090b1a; }
.icon svg { inline-size: 22px; block-size: 22px; }
.icon[aria-pressed="false"] { color: #6c72a3; }
#hint.on { background: var(--accent2); border-color: #fff3c4; color: var(--ink); }
#hint.pulse { animation: pp-pulse 1s ease-in-out infinite; }
.chip { background: var(--surface); border: 1px solid var(--border); border-radius: 13px; min-inline-size: 0; }
.chip.lvl { flex: 1; display: flex; flex-direction: column; justify-content: center; padding-inline: 11px; line-height: 1.2; }
.chip.lvl .k { font-size: .68rem; color: var(--muted); white-space: nowrap; }
.chip.lvl b { font-size: .95rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chip.clock { position: relative; overflow: hidden; display: flex; align-items: center; justify-content: space-between; gap: 8px; padding-inline: 10px; min-inline-size: 118px; }
.chip.clock b { font-size: 1.25rem; font-variant-numeric: tabular-nums; font-weight: 800; }
.pips { display: flex; align-items: center; gap: 1px; color: var(--accent2); font-weight: 800; font-size: .95rem; font-variant-numeric: tabular-nums; }
.pips i { color: #3a4070; font-style: normal; transition: color .2s, transform .2s; }
.pips i.on { color: var(--accent2); }
.pips svg { inline-size: 15px; block-size: 15px; }
.bar { position: absolute; inset-inline: 0; inset-block-end: 0; block-size: 4px; background: #0b0e1e; }
.bar > i { display: block; block-size: 100%; background: linear-gradient(90deg, var(--accent), var(--accent2)); transform-origin: 0 50%; will-change: transform; }
[dir="rtl"] .bar > i { transform-origin: 100% 50%; }
.chip.clock[data-mode="rush"] .bar > i { background: linear-gradient(90deg, #ff7a3d, #ffd24a); }
.chip.clock[data-mode="daily"] .bar > i { background: linear-gradient(90deg, #38bdf8, #a78bfa); }
.chip.clock[data-mode="daily"] .pips i.on { color: var(--ok); }
.chip.clock.low { border-color: var(--bad); animation: pp-low .5s ease-in-out infinite alternate; }
.chip.clock.low b { color: var(--bad); }

.wide .hud { flex-direction: column; align-items: stretch; }
.wide .hud-btns { justify-content: flex-start; }
.wide .chip.lvl { flex: none; padding-block: 8px; }
.wide .chip.clock { flex-wrap: wrap; padding-block: 8px 12px; min-inline-size: 0; }
.wide .chip.clock b { font-size: 1.7rem; line-height: 1; }

/* ---------- the lot ---------- */
.stage { grid-area: stage; display: grid; place-items: center; min-inline-size: 0; min-block-size: 0; }
.lot { position: relative; overflow: hidden; border-radius: 14px; box-shadow: 0 0 0 2px rgba(255, 255, 255, .07), 0 10px 26px rgba(0, 0, 0, .5); background: #1a1d2c; }
.lot canvas { display: block; inline-size: 100%; block-size: 100%; }
.tint, .flash { position: absolute; inset: 0; pointer-events: none; }
.flash { opacity: 0; background: radial-gradient(circle at 50% 50%, rgba(255, 255, 255, .9), rgba(255, 120, 80, .55)); }

.banner { position: absolute; inset-inline: 8px; inset-block-end: 10px; display: flex; justify-content: center; pointer-events: none; opacity: 0; transform: translateY(6px); transition: opacity .2s, transform .2s; }
.banner.on { opacity: 1; transform: none; }
.banner span { background: rgba(8, 10, 24, .86); border: 1px solid rgba(255, 255, 255, .16); border-radius: 999px; padding: 7px 15px; font-size: .86rem; font-weight: 700; text-align: center; line-height: 1.35; }
.banner.bad span { background: #7a1d24; border-color: var(--bad); }
.banner.ok span { background: #0f5a30; border-color: var(--ok); }

.intro { position: absolute; inset-inline: 8px; inset-block-start: 30%; display: grid; justify-items: center; gap: 5px; text-align: center; pointer-events: none; opacity: 0; transform: translateY(10px) scale(.95); transition: opacity .3s, transform .3s; }
.intro.on { opacity: 1; transform: none; }
.intro small { font-size: .76rem; font-weight: 700; color: var(--accent2); background: rgba(8, 10, 24, .78); padding: 3px 11px; border-radius: 999px; }
.intro b { font-size: clamp(1.3rem, 6.4vw, 2rem); font-weight: 900; line-height: 1.15; text-shadow: 0 2px 0 rgba(0, 0, 0, .55), 0 0 18px rgba(0, 0, 0, .6); }
.intro em { font-style: normal; font-size: .84rem; font-weight: 800; background: var(--accent); color: var(--ink); padding: 3px 13px; border-radius: 999px; }

/* Captain Zizo talks over the dashboard (upright) or in the side column (wide), never over the lot */
.coach { grid-area: dash; z-index: 5; align-self: end; min-inline-size: 0; display: flex; align-items: flex-end; gap: 8px; pointer-events: none; opacity: 0; transform: translateY(8px); transition: opacity .25s, transform .25s; }
.coach.on { opacity: 1; transform: none; }
.game.wide .coach { grid-area: gap; flex-wrap: wrap; align-items: flex-start; }
.game.wide.keys .coach { align-self: start; }
.game.nodash:not(.wide) .coach { grid-area: stage; align-self: start; align-items: flex-start; margin: 8px; }
.game[data-screen="home"] .coach { display: none; }
.face { flex: none; display: block; inline-size: 46px; block-size: 46px; border-radius: 50%; overflow: hidden; background: #ffe1a8; border: 2px solid #fff; box-shadow: 0 3px 8px rgba(0, 0, 0, .4); }
.face svg { inline-size: 100%; block-size: 100%; }
.coach p { flex: 1 1 150px; min-inline-size: 0; background: #fff; color: #1b1d33; border-radius: 14px; border-end-start-radius: 4px; padding: 7px 11px; font-size: .84rem; line-height: 1.4; font-weight: 600; box-shadow: 0 4px 12px rgba(0, 0, 0, .45); }
.game.wide .coach p { border-end-start-radius: 14px; border-start-start-radius: 4px; }
.coach p b { display: block; font-size: .68rem; color: #b96a00; }

.tapplay { position: absolute; inset: 0; inline-size: 100%; padding: 0; border: 0; cursor: pointer; background: linear-gradient(transparent 62%, rgba(8, 10, 24, .5)); display: flex; align-items: flex-start; justify-content: flex-start; }
.tapplay span { margin: 9px; background: rgba(8, 10, 24, .78); border: 1px solid rgba(255, 255, 255, .16); border-radius: 999px; padding: 3px 11px; font-size: .72rem; font-weight: 700; color: var(--accent2); }

/* ---------- dashboard ---------- */
.dash {
    grid-area: dash; min-inline-size: 0; min-block-size: 0; overflow: hidden;
    display: grid; grid-template-columns: minmax(0, 1fr) auto auto; grid-template-areas: "obj goals row" "note note row"; align-items: center; column-gap: 10px; row-gap: 1px;
    background: var(--surface); border: 1px solid var(--border); border-radius: 13px; padding: 4px 10px;
}
.d-obj { grid-area: obj; display: flex; align-items: center; gap: 8px; min-inline-size: 0; font-weight: 700; font-size: .88rem; line-height: 1.25; }
.o-ic { flex: none; inline-size: 30px; block-size: 30px; border-radius: 9px; display: grid; place-items: center; font-style: normal; font-weight: 900; background: var(--ok); color: #04200f; }
.o-ic.rev { background: var(--rev); color: #2a0b00; }
.o-ic.any { background: #2f6df0; color: #fff; font-family: Arial, sans-serif; }
.o-ic svg { inline-size: 18px; block-size: 18px; }
.d-row { grid-area: row; display: flex; align-items: center; gap: 8px; }
.d-gear { display: flex; gap: 2px; padding: 3px; border-radius: 9px; background: #0b0e1e; }
.d-gear i { inline-size: 18px; block-size: 20px; display: grid; place-items: center; border-radius: 5px; font-style: normal; font-size: .7rem; font-weight: 800; color: #4a5080; font-family: Arial, sans-serif; }
.d-gear[data-g="P"] i:nth-child(1), .d-gear[data-g="N"] i:nth-child(3) { background: #e8ebff; color: #10142b; }
.d-gear[data-g="R"] i:nth-child(2) { background: var(--rev); color: #2a0b00; }
.d-gear[data-g="D"] i:nth-child(4) { background: var(--ok); color: #04200f; }
.d-sense { inline-size: 52px; color: #8f96c8; }
.d-sense path { stroke: #2c3260; transition: stroke .1s; }
.d-sense[data-f="1"] .f1, .d-sense[data-f="2"] .f1, .d-sense[data-f="3"] .f1, .d-sense[data-r="1"] .r1, .d-sense[data-r="2"] .r1, .d-sense[data-r="3"] .r1 { stroke: var(--ok); }
.d-sense[data-f="2"] .f2, .d-sense[data-f="3"] .f2, .d-sense[data-r="2"] .r2, .d-sense[data-r="3"] .r2 { stroke: var(--accent); }
.d-sense[data-f="3"] .f3, .d-sense[data-r="3"] .r3 { stroke: var(--bad); }
.d-goals { grid-area: goals; display: none; min-inline-size: 0; }
.goal { display: flex; align-items: center; gap: 8px; font-size: .8rem; line-height: 1.3; }
.gs { flex: none; display: inline-flex; align-items: center; justify-content: center; gap: 1px; min-inline-size: 18px; color: var(--accent2); font-weight: 800; }
.gs i { color: #3a4070; font-style: normal; }
.gs i.on { color: var(--accent2); }
.gs svg { inline-size: 12px; block-size: 12px; }
.goal.lost { opacity: .42; text-decoration: line-through; }
.goal.ok { color: var(--muted); }
.goal.ok .gs { color: var(--ok); }
.goal.now { font-weight: 800; color: var(--accent2); }
.goal.best { justify-content: space-between; color: var(--muted); border-block-start: 1px solid var(--border); padding-block-start: 6px; }
.goal.best b { color: var(--text); font-variant-numeric: tabular-nums; }
.stat2 { display: flex; flex-direction: column; align-items: center; line-height: 1.15; }
.stat2 b { font-size: 1rem; font-variant-numeric: tabular-nums; direction: ltr; unicode-bidi: isolate; }
.stat2 span { font-size: .62rem; color: var(--muted); white-space: nowrap; }
.stat2.hot b { color: #ff9a4d; }
.d-note { grid-area: note; font-size: .68rem; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.d-note:empty { display: none; }
.d-keys { display: none; }
kbd { display: inline-block; background: #0b0e1e; border: 1px solid var(--border); border-block-end-width: 2px; border-radius: 6px; padding: 1px 6px; font: inherit; font-size: .72rem; font-weight: 700; color: var(--text); white-space: nowrap; direction: ltr; }

/* upright phone in a clocked mode: the count matters more than the gear */
.game[data-mode="rush"]:not(.wide):not(.keys) .d-goals { display: flex; gap: 12px; }
.game[data-mode="rush"]:not(.wide):not(.keys) .d-gear { display: none; }
.game[data-mode="rush"]:not(.wide):not(.keys) .d-obj span { display: none; }
/* keyboard, narrow window: no pedals, so the dashboard gets a second line for the goals */
.game.keys:not(.wide) .dash { grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "obj row" "goals goals" "note note"; padding: 8px 12px; align-content: space-between; }
.game.keys:not(.wide) .d-goals { display: flex; flex-wrap: wrap; gap: 3px 14px; }
.game.keys:not(.wide) .goal.best { border: 0; padding: 0; gap: 6px; }
/* wide: a real side panel */
.wide .dash { display: flex; flex-direction: column; align-items: stretch; gap: 10px; padding: 12px; align-self: start; max-block-size: 100%; }
.wide .d-row { justify-content: space-between; }
.wide .d-goals { display: flex; flex-direction: column; gap: 6px; }
.wide.game[data-mode="rush"] .d-goals { flex-direction: row; justify-content: space-around; }
.wide .d-note { white-space: normal; font-size: .72rem; line-height: 1.4; }
.wide.keys .d-keys { display: flex; flex-wrap: wrap; gap: 6px 12px; border-block-start: 1px solid var(--border); padding-block-start: 10px; }
.d-keys span, .keys2 span { display: inline-flex; align-items: center; gap: 6px; font-size: .72rem; color: var(--muted); }
.wide.short .dash { gap: 7px; padding: 9px 10px; }
.wide.short .goal { font-size: .74rem; }
.wide.short .goal.best { display: none; }

/* ---------- pedals ---------- */
.pads { display: flex; gap: 6px; min-inline-size: 0; min-block-size: 0; touch-action: none; }
.pads.steer { grid-area: steer; }
.pads.pedals { grid-area: pedals; }
.pad {
    flex: 1; min-inline-size: 0; padding: 0; border-radius: 16px; cursor: pointer; touch-action: none; display: grid; place-items: center;
    border: 1px solid #3a4180; background: linear-gradient(#2a3166, #181c3c); color: var(--text); box-shadow: 0 4px 0 #080a18;
}
.pad svg { inline-size: 40%; max-inline-size: 46px; block-size: auto; aspect-ratio: 1; stroke-width: 2.6; }
.pad.on { transform: translateY(3px); box-shadow: 0 1px 0 #080a18; filter: brightness(1.25); }
.pad.gas { flex: 1.15; background: linear-gradient(#3fd27a, #1f9a4f); border-color: #7ef0aa; color: #04200f; }
.pad.rev { background: linear-gradient(#ff8f6b, #d8502c); border-color: #ffb9a3; color: #2a0b00; }
.pad.small { flex: 0 0 40px; block-size: 46px; align-self: center; border-radius: 13px; }
.pad.small svg { inline-size: 20px; }
.pad.pulse { animation: pp-pulse 1s ease-in-out infinite; }
.wide .steer { block-size: var(--pad, 108px); align-self: end; }
.wide .pedals { flex-wrap: wrap; align-content: flex-end; align-self: end; }
.wide .pedals .pad { block-size: var(--pad, 108px); }
.wide .pedals .pad.small { order: -1; flex: 0 0 100%; block-size: 34px; }

/* ---------- home ---------- */
.brand { grid-area: brand; display: flex; align-items: center; gap: 8px; min-inline-size: 0; }
.logo { flex: 1; display: flex; align-items: center; gap: 9px; min-inline-size: 0; }
.logo b { font-size: 1.3rem; font-weight: 900; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.psign { flex: none; inline-size: 36px; block-size: 36px; border-radius: 10px; display: grid; place-items: center; background: #2166e8; color: #fff; border: 2px solid #fff; font: 900 1.25rem Arial, sans-serif; box-shadow: 0 3px 0 rgba(0, 0, 0, .4); }
.pill { flex: none; direction: ltr; display: inline-flex; align-items: center; gap: 4px; background: var(--surface); border: 1px solid var(--border); border-radius: 999px; padding: 6px 11px; font-size: .88rem; color: var(--accent2); font-variant-numeric: tabular-nums; }
.pill svg { inline-size: 15px; block-size: 15px; }
.pill b { color: var(--text); }
.pill span { color: var(--muted); font-size: .74rem; }
.aud { display: flex; gap: 6px; flex: none; }
.menu { grid-area: menu; display: grid; gap: 8px; min-inline-size: 0; }
.menu2 { grid-area: menu2; display: grid; gap: 8px; min-inline-size: 0; min-block-size: 0; align-content: start; overflow-y: auto; }

.btn {
    position: relative; display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-block-size: 48px; padding: 8px 18px; cursor: pointer; overflow: hidden;
    border: 0; border-radius: 14px; background: linear-gradient(#ffd24a, #ffa514); color: var(--ink); font-weight: 800; font-size: 1rem; box-shadow: 0 4px 0 #a86400;
}
.btn:active { transform: translateY(3px); box-shadow: 0 1px 0 #a86400; }
.btn svg { flex: none; inline-size: 20px; block-size: 20px; }
.btn.ghost { background: var(--surface2); color: var(--text); box-shadow: 0 4px 0 #0b0d1e, inset 0 0 0 1px #3a4180; font-weight: 700; }
.btn.ghost:active { box-shadow: 0 1px 0 #0b0d1e, inset 0 0 0 1px #3a4180; }
.btn:disabled { opacity: .7; cursor: default; }
.btn.big { min-block-size: 60px; font-size: 1.2rem; border-radius: 17px; }
.btn.big svg { inline-size: 26px; block-size: 26px; }
.btn.big::after { content: ""; position: absolute; inset-block: 0; inline-size: 40%; left: -60%; background: linear-gradient(100deg, transparent, rgba(255, 255, 255, .55), transparent); animation: pp-shine 3.2s ease-in-out infinite; }

.tiles { display: grid; gap: 8px; }
.tiles.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.tiles.four { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.tile {
    display: grid; grid-template-columns: auto minmax(0, 1fr); grid-template-areas: "i b" "i s"; column-gap: 10px; align-items: center; min-inline-size: 0;
    padding: 10px 12px; border-radius: 14px; border: 1px solid var(--border); background: var(--surface); cursor: pointer; text-align: start; box-shadow: 0 3px 0 #090b1a;
}
.tile:active { transform: translateY(2px); box-shadow: 0 1px 0 #090b1a; }
.tile i { grid-area: i; inline-size: 38px; block-size: 38px; border-radius: 12px; display: grid; place-items: center; background: #2a3166; color: var(--accent2); }
.tile i svg { inline-size: 21px; block-size: 21px; }
.tile b { grid-area: b; align-self: end; font-size: .96rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tile span { grid-area: s; align-self: start; font-size: .72rem; line-height: 1.3; color: #c3c7e6; overflow: hidden; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; }
.tile.rush { background: linear-gradient(135deg, #6a2a14, #2b1733); border-color: #b85a30; }
.tile.rush i { background: #ff7a3d; color: #2a0d00; }
.tile.daily { background: linear-gradient(135deg, #163a6b, #1c1945); border-color: #3378c4; }
.tile.daily i { background: var(--blue); color: #04202e; }
.tile.locked { background: var(--surface); border-color: var(--border); cursor: default; box-shadow: none; }
.tile.locked i { background: #1d2140; color: #7178a8; }
.tile.locked b { color: #9aa0c8; }
.tiles.four .tile { grid-template-columns: minmax(0, 1fr); grid-template-areas: "i" "b" "s"; justify-items: center; text-align: center; padding: 8px 4px; row-gap: 1px; }
.tiles.four .tile i { inline-size: 32px; block-size: 32px; border-radius: 10px; margin-block-end: 3px; }
.tiles.four .tile i svg { inline-size: 18px; block-size: 18px; }
.tiles.four .tile b { font-size: .78rem; max-inline-size: 100%; }
.tiles.four .tile span { font-size: .66rem; max-inline-size: 100%; }
.nextcar { display: flex; align-items: center; gap: 10px; inline-size: 100%; padding: 5px 12px; border-radius: 14px; border: 1px dashed #4a5196; background: #12152d; cursor: pointer; text-align: start; }
.nc-car { flex: none; }
.nc-car canvas { display: block; inline-size: 78px; block-size: auto; filter: brightness(.5); }
.nc-txt { flex: 1; min-inline-size: 0; display: grid; }
.nc-txt b { font-size: .86rem; }
.nc-txt span { font-size: .72rem; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nextcar > svg { flex: none; inline-size: 16px; block-size: 16px; color: #7178a8; }
.note { font-size: .8rem; color: var(--muted); line-height: 1.45; text-align: center; }
.note b { color: var(--text); }
.note.guest { font-size: .72rem; }
.note.ok { color: var(--ok); display: flex; align-items: center; justify-content: center; gap: 6px; font-weight: 700; }
.note.ok svg { flex: none; inline-size: 16px; block-size: 16px; }
.note.bad { color: var(--bad); }
.note.unlock { background: rgba(74, 222, 128, .12); border: 1px solid rgba(74, 222, 128, .4); border-radius: 10px; padding: 6px 10px; animation: pp-pop .5s .9s both; }
.short .note.guest { display: none; }
.short .tiles.four .tile { padding-block: 5px; }
.short .nextcar { padding-block: 2px; }
.short .btn.big { min-block-size: 50px; }

/* ---------- pages and cards ---------- */
.sheet { position: absolute; inset: 0; z-index: 20; display: none; overflow-y: auto; overscroll-behavior: contain; background: var(--bg); }
.sheet.on { display: block; }
.sheet.cardy.on { display: grid; place-items: center; padding: 10px; background: rgba(7, 9, 22, .76); }
.sheet.cardy.solid.on { background: radial-gradient(120% 80% at 50% 0%, #26306a, #0d1022 75%); }
.sh-head { position: sticky; inset-block-start: 0; z-index: 2; display: flex; align-items: center; gap: 10px; padding: 8px; background: var(--bg); border-block-end: 1px solid var(--border); }
.sh-head h2 { flex: 1; min-inline-size: 0; font-size: 1.15rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sh-x:empty { display: none; }
[dir="rtl"] .back svg { transform: scaleX(-1); }

.card {
    position: relative; inline-size: min(100%, 400px); max-block-size: 100%; overflow-y: auto; display: grid; gap: 10px; justify-items: stretch; text-align: center;
    padding: 16px; border-radius: 20px; background: linear-gradient(#1d2248, #141834); border: 1px solid #3b4280; box-shadow: 0 18px 44px rgba(0, 0, 0, .55);
    animation: pp-card .3s cubic-bezier(.2, .9, .3, 1.2) both;
}
.card h2 { font-size: 1.4rem; line-height: 1.2; }
.card .sub { color: var(--muted); font-size: .86rem; margin-block-start: -6px; }
.card > .face { justify-self: center; inline-size: 60px; block-size: 60px; }
.col { display: grid; gap: 9px; }
.actions { display: flex; flex-wrap: wrap; gap: 9px; margin-block-start: 2px; }
.actions .btn { flex: 1 1 40%; padding-inline: 10px; }
.actions .btn:first-child:not(.ghost) { flex-basis: 100%; min-block-size: 54px; font-size: 1.1rem; }
.row { display: flex; align-items: center; justify-content: space-between; gap: 10px; inline-size: 100%; min-block-size: 58px; padding: 6px 12px; border-radius: 13px; border: 1px solid var(--border); background: var(--surface); text-align: start; font-size: .92rem; }
button.row { cursor: pointer; }
.aud-row { background: #12152d; }
.sw2 { position: relative; flex: none; inline-size: 48px; block-size: 28px; border-radius: 999px; background: #2c3260; transition: background .15s; }
.sw2::after { content: ""; position: absolute; inset-block-start: 3px; inset-inline-start: 3px; inline-size: 22px; block-size: 22px; border-radius: 50%; background: #fff; transition: inset-inline-start .15s; }
.tog[aria-pressed="true"] .sw2 { background: var(--ok); }
.tog[aria-pressed="true"] .sw2::after { inset-inline-start: 23px; }

.mi { justify-self: center; inline-size: 58px; block-size: 58px; border-radius: 18px; display: grid; place-items: center; background: #ff7a3d; color: #2a0d00; box-shadow: 0 4px 0 rgba(0, 0, 0, .35); }
.mi svg { inline-size: 32px; block-size: 32px; }
.card.daily .mi { background: var(--blue); color: #04202e; }
.card.modec.rush { border-color: #b85a30; background: linear-gradient(#3b1d22, #161834); }
.card.modec.daily { border-color: #3378c4; background: linear-gradient(#17305c, #141834); }
.rules { list-style: none; padding: 0; display: grid; gap: 6px; text-align: start; font-size: .88rem; line-height: 1.45; }
.rules li { position: relative; padding-inline-start: 18px; }
.rules li::before { content: ""; position: absolute; inset-inline-start: 2px; inset-block-start: .55em; inline-size: 8px; block-size: 8px; border-radius: 50%; background: var(--accent2); }
.bestline { font-size: .84rem; color: var(--muted); display: flex; align-items: center; justify-content: center; gap: 6px; flex-wrap: wrap; }
.bestline.mine { color: var(--text); font-weight: 700; }
.three { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.th { position: relative; display: block; overflow: hidden; border-radius: 9px; aspect-ratio: 480 / 520; background: #10142b; }
.th canvas { display: block; inline-size: 100%; block-size: 100%; }
.th b { position: absolute; z-index: 1; inset-block-start: 4px; inset-inline-start: 4px; min-inline-size: 21px; block-size: 21px; padding-inline: 4px; border-radius: 7px; display: grid; place-items: center; background: rgba(8, 10, 24, .82); font-size: .72rem; }
.medal { flex: none; display: inline-grid; place-items: center; inline-size: 24px; block-size: 24px; border-radius: 50%; background: #2c3260; color: #7178a8; font-style: normal; }
.medal svg { inline-size: 62%; block-size: 62%; }
.medal.m1 { background: #c27a3e; color: #3a1c05; }
.medal.m2 { background: #d4d9e6; color: #2a2f45; }
.medal.m3 { background: var(--accent2); color: #4a3200; }
.medal.big { justify-self: center; inline-size: 78px; block-size: 78px; border: 4px solid rgba(255, 255, 255, .5); box-shadow: 0 5px 0 rgba(0, 0, 0, .35); animation: pp-pop .5s .15s both; }

.stars { display: flex; justify-content: center; gap: 6px; }
.stars span { color: #2f3566; transform: scale(.82); transition: color .1s; }
.stars span:nth-child(2) { margin-block-start: -8px; }
.stars svg { inline-size: 46px; block-size: 46px; }
.stars span.on { color: var(--accent2); animation: pp-star .45s cubic-bezier(.2, .9, .3, 1.5) both; filter: drop-shadow(0 3px 0 rgba(0, 0, 0, .35)); }
.card .big { font-size: 2.9rem; font-weight: 900; line-height: 1; font-variant-numeric: tabular-nums; color: #fff; }
.card .big small { font-size: 1.1rem; color: var(--muted); margin-inline-start: 3px; }
.card .big.landed { animation: pp-pop .35s both; color: var(--accent2); }
#ribbon { min-block-size: 0; }
#ribbon:empty { display: none; }
.badge.best { display: inline-block; background: linear-gradient(#ff5d8f, #d6336c); color: #fff; font-weight: 800; font-size: .84rem; padding: 4px 14px; border-radius: 999px; animation: pp-pop .5s both; }
.bars { display: grid; gap: 5px; }
.brow { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr) 54px; align-items: center; gap: 8px; font-size: .8rem; }
.brow > span { text-align: start; color: #c3c7e6; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.brow > i { display: block; block-size: 8px; border-radius: 999px; background: #0b0e1e; overflow: hidden; }
.brow > i > i { display: block; block-size: 100%; inline-size: var(--w); border-radius: 999px; background: linear-gradient(90deg, var(--accent), var(--accent2)); animation: pp-grow .9s .2s cubic-bezier(.2, .8, .2, 1) both; transform-origin: 0 50%; }
[dir="rtl"] .brow > i > i { transform-origin: 100% 50%; }
.brow > b { text-align: end; font-variant-numeric: tabular-nums; direction: ltr; }
.goals3 { list-style: none; padding: 8px 10px; display: grid; gap: 5px; border-radius: 12px; background: #10142b; text-align: start; }
.goals3 li { display: flex; align-items: center; gap: 8px; font-size: .8rem; }
.goals3 li > span:nth-child(2) { flex: 1; }
.goals3 li > i { flex: none; }
.goals3 li > i svg { inline-size: 16px; block-size: 16px; }
.goals3 li.ok > i { color: var(--ok); }
.goals3 li.no { color: #8088b8; }
.goals3 li.no > i { color: #5a6194; }
.trio { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.trio > div { display: grid; gap: 1px; padding: 8px 4px; border-radius: 12px; background: #10142b; }
.trio b { font-size: 1.2rem; font-variant-numeric: tabular-nums; }
.trio span { font-size: .7rem; color: var(--muted); }
#note:empty { display: none; }
#note { display: grid; gap: 8px; justify-items: center; }
.short .card { padding: 12px 14px; gap: 7px; }
.short .card.res > .face, .short .card.res .goals3 { display: none; }
.short .stars svg { inline-size: 36px; block-size: 36px; }
.short .card .big { font-size: 2.2rem; }
.short .card h2 { font-size: 1.2rem; }
.short .medal.big, .short .mi { inline-size: 46px; block-size: 46px; }
.short .card.modec { inline-size: min(100%, 620px); grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: center; }
.short .card.modec > .mi, .short .card.modec > h2, .short .card.modec > .actions { grid-column: 1 / -1; }
.short .card.modec > h2 { margin-block-start: -4px; }
.short .card.pausec { inline-size: min(100%, 560px); }
.short .card.pausec .col { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.short .card.res { inline-size: min(100%, 520px); }

/* ---------- levels ---------- */
.lv-wrap { display: grid; gap: 12px; padding: 10px 8px 18px; max-inline-size: 940px; margin-inline: auto; }
.dist { overflow: hidden; border-radius: 16px; border: 1px solid var(--border); background: var(--surface); }
.dist > header { display: flex; align-items: baseline; gap: 8px; padding: 9px 12px; background: linear-gradient(90deg, #2c6a43, #1b2038); }
[dir="rtl"] .dist > header { background: linear-gradient(270deg, #2c6a43, #1b2038); }
.dist.t-mall > header { background-image: linear-gradient(90deg, #555a78, #1b2038); }
.dist.t-sea > header { background-image: linear-gradient(90deg, #b3703a, #1b2038); }
.dist.t-night > header { background-image: linear-gradient(90deg, #2a3ea8, #1b2038); }
.dist.t-storm > header { background-image: linear-gradient(90deg, #2c6f8a, #1b2038); }
[dir="rtl"] .dist.t-mall > header { background-image: linear-gradient(270deg, #555a78, #1b2038); }
[dir="rtl"] .dist.t-sea > header { background-image: linear-gradient(270deg, #b3703a, #1b2038); }
[dir="rtl"] .dist.t-night > header { background-image: linear-gradient(270deg, #2a3ea8, #1b2038); }
[dir="rtl"] .dist.t-storm > header { background-image: linear-gradient(270deg, #2c6f8a, #1b2038); }
.dist > header b { font-size: 1rem; white-space: nowrap; }
.dist > header span { flex: 1; min-inline-size: 0; font-size: .74rem; color: #d5d8f2; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dist > header em { flex: none; display: inline-flex; align-items: center; gap: 3px; font-style: normal; font-weight: 800; font-size: .84rem; color: var(--accent2); }
.dist > header em svg { inline-size: 14px; block-size: 14px; }
.dist.locked > header { filter: grayscale(.9); }
.lv-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; padding: 8px; }
.wide .lv-grid { grid-template-columns: repeat(6, minmax(0, 1fr)); }
.lv { display: grid; gap: 3px; min-inline-size: 0; padding: 5px 5px 6px; border-radius: 12px; border: 1px solid var(--border); background: #10142b; cursor: pointer; text-align: center; }
.lv:active:not(:disabled) { transform: translateY(2px); }
.lv .nm { font-size: .72rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lv .st { display: flex; justify-content: center; gap: 1px; min-block-size: 15px; }
.lv .st i { color: #3a4070; }
.lv .st i.on { color: var(--accent2); }
.lv .st svg { inline-size: 14px; block-size: 14px; }
.lv .st > svg { color: #6c72a3; }
.lv.done { border-color: #46508f; }
.lv.next { border-color: var(--accent); animation: pp-next 1.4s ease-in-out infinite; }
.lv:disabled { cursor: default; }
.lv:disabled .th { opacity: .32; }
.lv:disabled .nm { color: #6c72a3; }

/* ---------- garage ---------- */
.gar { display: grid; gap: 10px; padding: 10px 8px 18px; max-inline-size: 940px; margin-inline: auto; }
.wide .gar { grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr); align-items: start; }
.gar-top { display: grid; justify-items: center; gap: 4px; padding: 4px 10px 12px; border-radius: 16px; border: 1px solid var(--border); background: radial-gradient(120% 90% at 50% 0%, #2a3268, #12152c); }
#gar-cv { display: block; inline-size: min(100%, 360px); block-size: auto; aspect-ratio: 640 / 340; }
.gar-top.locked #gar-cv { opacity: .3; }
.gar-info { display: grid; justify-items: center; gap: 9px; inline-size: 100%; }
.gar-info h3 { font-size: 1.2rem; }
.gar-info .btn { min-inline-size: 180px; }
.swatches { display: flex; flex-wrap: wrap; justify-content: center; gap: 9px; }
.sw { inline-size: 34px; block-size: 34px; padding: 0; border-radius: 50%; background: var(--c); border: 2px solid rgba(255, 255, 255, .3); cursor: pointer; }
.sw.on { border-color: #fff; box-shadow: 0 0 0 3px var(--accent); }
.need { display: flex; align-items: center; gap: 7px; color: var(--accent2); font-size: .88rem; font-weight: 700; padding: 8px 0; }
.need svg { flex: none; inline-size: 17px; block-size: 17px; }
.gar-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(98px, 1fr)); gap: 8px; }
.gcar { position: relative; display: grid; justify-items: center; gap: 1px; min-inline-size: 0; padding: 6px 4px 7px; border-radius: 13px; border: 1px solid var(--border); background: var(--surface); cursor: pointer; }
.gcar canvas { display: block; inline-size: 100%; max-inline-size: 112px; block-size: auto; }
.gcar b { font-size: .74rem; max-inline-size: 100%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.gcar.locked canvas { opacity: .28; }
.gcar.locked b { color: #8088b8; }
.gcar > i { position: absolute; inset-block-start: 6px; inset-inline-end: 6px; color: #8088b8; }
.gcar > i svg { inline-size: 14px; block-size: 14px; }
.gcar.sel { border-color: var(--accent); background: #232955; box-shadow: 0 0 0 2px rgba(255, 176, 32, .3); }
.gcar.mine::after { content: ""; position: absolute; inset-block-start: 7px; inset-inline-start: 7px; inline-size: 9px; block-size: 9px; border-radius: 50%; background: var(--ok); }

/* ---------- trophies and settings ---------- */
.tro { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 8px; padding: 10px 8px 18px; max-inline-size: 940px; margin-inline: auto; }
.tr { display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 13px; border: 1px solid var(--border); background: var(--surface); }
.tr > i { flex: none; inline-size: 38px; block-size: 38px; border-radius: 50%; display: grid; place-items: center; background: #10142b; color: #6c72a3; }
.tr > i svg { inline-size: 19px; block-size: 19px; }
.tr b { display: block; font-size: .88rem; color: #b3b8dc; }
.tr span { display: block; font-size: .74rem; color: var(--muted); line-height: 1.35; }
.tr.on { border-color: #9a7614; background: linear-gradient(135deg, #3d2e08, #1b1d38); }
.tr.on > i { background: var(--accent2); color: #4a3200; }
.tr.on b { color: #fff; }
.set { display: grid; gap: 8px; padding: 10px 8px 18px; max-inline-size: 560px; margin-inline: auto; }
.how { padding: 12px; border-radius: 13px; border: 1px solid var(--border); background: var(--surface); }
.how h3 { font-size: 1rem; margin-block-end: 7px; }
.how ol { padding-inline-start: 20px; display: grid; gap: 5px; font-size: .86rem; line-height: 1.5; color: #d5d8f2; }
.keys2 { display: none; flex-wrap: wrap; gap: 7px 14px; margin-block-start: 11px; padding-block-start: 11px; border-block-start: 1px solid var(--border); }
.keys .keys2 { display: flex; }

/* ---------- prizes ---------- */
.toasts { position: absolute; z-index: 40; inset-block-start: 8px; inset-inline: 8px; display: grid; justify-items: center; gap: 6px; pointer-events: none; }
.toast { display: flex; align-items: center; gap: 9px; max-inline-size: 100%; padding: 7px 15px 7px 8px; border-radius: 999px; background: linear-gradient(#fff6d6, #ffd24a); color: #3a2600; font-weight: 800; font-size: .86rem; box-shadow: 0 6px 18px rgba(0, 0, 0, .5); animation: pp-toast .4s cubic-bezier(.2, .9, .3, 1.3) both; }
.toast i { flex: none; inline-size: 30px; block-size: 30px; border-radius: 50%; display: grid; place-items: center; background: #3a2600; color: var(--accent2); }
.toast i svg { inline-size: 17px; block-size: 17px; }
.toast.car { background: linear-gradient(#e2f5ff, #7fd3fb); color: #04202e; }
.toast.car i { background: #04202e; color: #7fd3fb; }
.toast.out { opacity: 0; transform: translateY(-10px); transition: opacity .3s, transform .3s; }
.pp-confetti { position: absolute; inset: 0; z-index: 3; overflow: hidden; pointer-events: none; }
.pp-confetti i { position: absolute; inset-block-start: -14px; left: var(--x); inline-size: 8px; block-size: 13px; border-radius: 2px; animation: pp-fall var(--d) var(--w) cubic-bezier(.3, .2, .6, 1) both; }

@keyframes pp-pulse { 0%, 100% { box-shadow: 0 0 0 0 rgba(255, 210, 74, .75), 0 4px 0 #080a18; } 55% { box-shadow: 0 0 0 9px rgba(255, 210, 74, 0), 0 4px 0 #080a18; } }
@keyframes pp-next { 0%, 100% { box-shadow: 0 0 0 0 rgba(255, 210, 74, .7); } 55% { box-shadow: 0 0 0 7px rgba(255, 210, 74, 0); } }
@keyframes pp-low { from { background-color: var(--surface); } to { background-color: #4a1620; } }
@keyframes pp-shine { 0%, 55% { transform: translateX(0); } 100% { transform: translateX(520%); } }
@keyframes pp-card { from { opacity: 0; transform: translateY(14px) scale(.94); } to { opacity: 1; transform: none; } }
@keyframes pp-pop { 0% { transform: scale(.6); opacity: 0; } 60% { transform: scale(1.12); opacity: 1; } 100% { transform: none; opacity: 1; } }
@keyframes pp-star { 0% { transform: scale(.3) rotate(-30deg); } 100% { transform: scale(1) rotate(0); } }
@keyframes pp-grow { from { transform: scaleX(0); } to { transform: none; } }
@keyframes pp-toast { from { opacity: 0; transform: translateY(-16px) scale(.9); } to { opacity: 1; transform: none; } }
@keyframes pp-fall { from { transform: translate3d(0, 0, 0) rotate(0); opacity: 1; } to { transform: translate3d(var(--s), 105vh, 0) rotate(var(--r)); opacity: .85; } }

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
