/* FUAH! IT'S MY SPOT! — identité visuelle inspirée de la signalisation routière :
   plaques bleues à liseré blanc, panneaux directionnels, ticket de parking imprimé,
   et un gros « FUAH! » rouge quand on se fait piquer sa place. */
:root {
  --sign: #1f5ad6;
  --sign-deep: #12398f;
  --sign-soft: #2c6ae6;
  --green: #138a5e;
  --green-deep: #0b5c3e;
  --cream: #fff4dd;
  --ink: #232842;
  --hazard: #ffc83d;
  --brake: #ff4f5e;
  --mint: #47ffd1;
  --gold: #ffd23d;
  --silver: #cfd6e6;
  --bronze: #e09a5e;
  --font: 'Overpass', 'Segoe UI', system-ui, sans-serif;
  --mono: 'Overpass Mono', ui-monospace, 'SFMono-Regular', Menlo, monospace;
  --rim: inset 0 0 0 4px var(--sign), inset 0 0 0 7px #fff;
  --safe-t: env(safe-area-inset-top, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: #cbbbe8; }
body { font-family: var(--font); color: var(--ink); -webkit-font-smoothing: antialiased; user-select: none; -webkit-tap-highlight-color: transparent; }
button { font: inherit; color: inherit; cursor: pointer; border: 0; background: none; }
button:disabled { cursor: not-allowed; opacity: .5; }
:focus-visible { outline: 3px solid var(--hazard); outline-offset: 3px; }
kbd { font: 800 .78em var(--font); background: #fff; color: var(--sign); border-radius: 5px; padding: .1em .45em; box-shadow: 0 2px 0 rgba(0,0,0,.25); }

#gl { position: fixed; inset: 0; width: 100vw; height: 100vh; display: block; }
#vignette { position: fixed; inset: 0; pointer-events: none; background: radial-gradient(ellipse at 50% 45%, transparent 55%, rgba(40, 20, 90, .28) 100%); }
#ui { position: fixed; inset: 0; pointer-events: none; }
#ui > * { pointer-events: auto; }

/* ------------------------------------------------------------- Écrans */
.screen { position: fixed; inset: 0; display: none; pointer-events: auto; }
.screen.active { display: block; }
body[data-screen='game'] #ui > .screen { display: none; }
#screen-title { background: linear-gradient(90deg, rgba(18, 26, 80, .5), rgba(18, 26, 80, 0) 48%); }
#screen-profile, #screen-solo, #screen-multi, #screen-room, #screen-boards {
  background: linear-gradient(90deg, rgba(18, 26, 80, .55), rgba(18, 26, 80, .1) 60%);
}

/* ------------------------------------------------------------- Poteau de signalisation */
.signpost { position: absolute; left: clamp(20px, 6vw, 110px); top: calc(5vh + var(--safe-t)); width: min(420px, 86vw); bottom: 0; display: flex; flex-direction: column; align-items: flex-start; }
.pole { position: absolute; left: 62px; top: 120px; bottom: -10px; width: 16px; z-index: -1; border-radius: 8px 8px 0 0;
  background: linear-gradient(90deg, #a9a6b8, #f4f2fa 40%, #c9c6d6 70%, #8f8ca0); box-shadow: 6px 0 12px rgba(20, 20, 60, .25); }
.psign { width: 140px; height: 140px; background: #fff; border-radius: 24px; padding: 7px; box-shadow: 0 14px 30px rgba(15, 25, 80, .35); transform-origin: 50% 100%;
  animation: drop-in .9s cubic-bezier(.2, 1.4, .4, 1) both; }
.psign { position: relative; }
.psign span { display: grid; place-items: center; width: 100%; height: 100%; background: var(--sign); border-radius: 18px; color: #fff; font: 900 112px/1 var(--font); padding-top: 14px; }
.psign em { position: absolute; right: -18px; top: -18px; width: 56px; height: 56px; border-radius: 50%; background: var(--brake); color: #fff; display: grid; place-items: center;
  font: italic 900 38px/1 var(--font); padding-top: 5px; box-shadow: 0 0 0 5px #fff, 0 8px 18px rgba(120, 10, 30, .35); animation: honk 2.6s 1.2s ease-in-out infinite; }
.wordmark { margin: 18px 0 22px; line-height: .86; animation: fade-up .7s .25s both; }
.wordmark span { display: block; font-style: italic; font-weight: 900; letter-spacing: -.035em; }
.w-fuah { font-size: clamp(64px, 9.5vw, 116px); color: var(--brake); -webkit-text-stroke: 5px #fff; paint-order: stroke fill;
  text-shadow: 0 6px 0 #9b1527, 0 14px 30px rgba(120, 10, 30, .45); transform: rotate(-4deg); transform-origin: 0 100%; }
.w-spot { font-size: clamp(30px, 4.3vw, 52px); color: #fff; margin-top: 6px; text-shadow: 0 4px 0 var(--sign-deep), 0 10px 26px rgba(10, 20, 70, .45); }
.arrows { display: flex; flex-direction: column; gap: 14px; width: 100%; }

.arrow-sign { position: relative; display: block; text-align: left; padding: 16px 64px 16px 24px; color: #fff; isolation: isolate; max-width: 400px;
  animation: swing-in .7s cubic-bezier(.2, 1.2, .4, 1) both; transform-origin: 70px 50%; transition: transform .18s ease; }
.arrow-sign:nth-child(1) { animation-delay: .35s; }
.arrow-sign:nth-child(2) { animation-delay: .45s; }
.arrow-sign:nth-child(3) { animation-delay: .55s; }
.arrow-sign:nth-child(4) { animation-delay: .65s; }
.arrow-sign::before, .arrow-sign::after { content: ''; position: absolute; z-index: -1; clip-path: polygon(0 0, calc(100% - 30px) 0, 100% 50%, calc(100% - 30px) 100%, 0 100%); }
.arrow-sign::before { inset: 0; background: #fff; border-radius: 12px 0 0 12px; filter: drop-shadow(0 8px 0 rgba(0, 0, 0, .2)); }
.arrow-sign::after { inset: 5px; background: var(--sign); clip-path: polygon(0 0, calc(100% - 27px) 0, 100% 50%, calc(100% - 27px) 100%, 0 100%); border-radius: 8px 0 0 8px; }
.arrow-sign.alt::after { background: var(--green); }
.arrow-sign span { display: block; font: 900 clamp(22px, 2.4vw, 28px)/1.1 var(--font); letter-spacing: -.01em; }
.arrow-sign small { display: block; font-weight: 600; font-size: 14px; opacity: .85; margin-top: 3px; }
.arrow-sign:hover { transform: translateX(10px); }
.arrow-sign:active { transform: translateX(14px) scale(.98); }

.me-chip { position: absolute; right: 22px; top: calc(22px + var(--safe-t)); display: flex; align-items: center; gap: 12px; padding: 8px 18px 8px 8px;
  background: #fff; border-radius: 40px; box-shadow: 0 8px 22px rgba(15, 25, 80, .3); text-align: left; animation: fade-up .6s .8s both; }
.me-chip .av { display: grid; place-items: center; width: 46px; height: 46px; border-radius: 50%; font-size: 26px; background: var(--c); box-shadow: inset 0 0 0 3px rgba(255,255,255,.7); }
.me-chip strong { display: block; font-weight: 900; font-size: 17px; }
.me-chip small { color: #6a6f8c; font-weight: 600; }
.keys-help { position: absolute; right: 22px; bottom: calc(22px + var(--safe-b)); display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; max-width: 54vw; animation: fade-up .6s 1s both; }
.keys-help span { background: rgba(255, 255, 255, .86); padding: 6px 12px; border-radius: 20px; font-size: 13px; font-weight: 600; color: var(--ink); }

/* ------------------------------------------------------------- Panneaux */
.panel { position: absolute; left: clamp(14px, 4vw, 70px); top: calc(24px + var(--safe-t)); bottom: 24px; width: min(480px, calc(100vw - 28px)); overflow-y: auto;
  background: var(--sign); color: #fff; border-radius: 22px; padding: 22px 24px 28px; box-shadow: var(--rim), 0 12px 0 var(--sign-deep), 0 24px 50px rgba(10, 20, 70, .4);
  animation: panel-in .45s cubic-bezier(.2, 1.1, .4, 1) both; scrollbar-width: thin; scrollbar-color: rgba(255,255,255,.4) transparent; }
.panel.small { position: relative; left: auto; top: auto; bottom: auto; width: min(400px, 92vw); }
.panel-head { display: flex; align-items: center; gap: 14px; margin-bottom: 18px; }
.panel h2 { margin: 0; font: 900 30px/1 var(--font); letter-spacing: -.02em; }
.panel h3 { margin: 0 0 6px; font: 900 21px/1.1 var(--font); }
.panel .sub { margin: 22px 0 10px; font-size: 17px; opacity: .9; }
.panel p { margin: 0 0 14px; line-height: 1.45; font-size: 15px; opacity: .92; max-width: 60ch; }
.back { padding: 8px 14px 8px 12px; border-radius: 10px; background: rgba(255, 255, 255, .14); font-weight: 800; font-size: 14px; }
.back::before { content: '‹ '; font-weight: 900; }
.back:hover { background: rgba(255, 255, 255, .25); }

.field { display: block; margin: 0 0 18px; }
.field > span { display: block; font-weight: 800; font-size: 14px; margin-bottom: 8px; opacity: .9; }
input[type='text'], input:not([type]), .field input:not([type='range']):not([type='color']), .join-row input {
  width: 100%; font: 800 20px var(--font); color: var(--ink); background: var(--cream); border: 0; border-radius: 12px; padding: 12px 14px; box-shadow: inset 0 3px 0 rgba(0, 0, 0, .12); user-select: text; }
input[type='range'] { width: 100%; accent-color: var(--hazard); }

.go { display: block; width: 100%; margin-top: 16px; padding: 16px 20px; border-radius: 14px; background: var(--hazard); color: var(--ink); font: 900 20px var(--font);
  box-shadow: 0 6px 0 #c48f0a, 0 12px 20px rgba(0, 0, 0, .2); transition: transform .12s, box-shadow .12s; }
.go:hover:not(:disabled) { transform: translateY(-2px); box-shadow: 0 8px 0 #c48f0a, 0 16px 24px rgba(0, 0, 0, .22); }
.go:active:not(:disabled) { transform: translateY(4px); box-shadow: 0 2px 0 #c48f0a; }
.btn { padding: 11px 16px; border-radius: 12px; background: rgba(255, 255, 255, .14); color: #fff; font-weight: 800; box-shadow: inset 0 0 0 2px rgba(255, 255, 255, .5); }
.btn:hover:not(:disabled) { background: rgba(255, 255, 255, .24); }
.btn.on { background: #fff; color: var(--sign); }
.btn.danger { display: block; width: 100%; margin-top: 12px; box-shadow: inset 0 0 0 2px rgba(255, 140, 150, .8); }
.panel .hint { font-size: 14px; opacity: .85; margin-top: 14px; }

.seg-row { display: grid; grid-template-columns: 74px 1fr; align-items: center; gap: 10px; margin: 10px 0; }
.seg-row > span { font-weight: 800; font-size: 14px; opacity: .9; }
.seg { display: flex; flex-wrap: wrap; gap: 4px; background: rgba(0, 0, 0, .16); padding: 4px; border-radius: 12px; }
.seg button { flex: 1 1 auto; padding: 8px 10px; border-radius: 9px; font-weight: 800; font-size: 14px; color: #fff; line-height: 1.1; }
.seg button small { display: block; font-size: 11px; opacity: .7; font-weight: 700; }
.seg button:hover { background: rgba(255, 255, 255, .12); }
.seg button.on { background: #fff; color: var(--sign); box-shadow: 0 3px 0 rgba(0, 0, 0, .18); }
.seg.locked { opacity: .65; }
.seg.locked button { cursor: default; }
.seg.tabs { margin-bottom: 12px; }
.toggle { display: flex; align-items: center; gap: 10px; margin: 14px 0 4px; font-weight: 700; font-size: 14px; }
.toggle input { width: 20px; height: 20px; accent-color: var(--hazard); }

/* Profil */
.grid-avatars { display: grid; grid-template-columns: repeat(8, 1fr); gap: 6px; }
.grid-avatars button { aspect-ratio: 1; font-size: 24px; border-radius: 12px; background: rgba(255, 255, 255, .1); transition: transform .12s; }
.grid-avatars button:hover { transform: scale(1.12); }
.grid-avatars button[aria-checked='true'] { background: #fff; box-shadow: 0 0 0 3px var(--hazard); transform: scale(1.08); }
.swatches { display: flex; flex-wrap: wrap; gap: 9px; }
.swatches button, .swatches .custom { width: 36px; height: 36px; border-radius: 50%; background: var(--c); box-shadow: inset 0 0 0 3px rgba(255, 255, 255, .65); transition: transform .12s; }
.swatches button[aria-checked='true'] { transform: scale(1.18); box-shadow: inset 0 0 0 3px #fff, 0 0 0 3px var(--hazard); }
.swatches .custom { position: relative; display: grid; place-items: center; background: conic-gradient(#ff4f5e, #ffc83d, #7bd34f, #29b6f6, #7a5cff, #ff5fa2, #ff4f5e); cursor: pointer; }
.swatches .custom input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.swatches .custom span { font-weight: 900; color: #fff; text-shadow: 0 1px 3px rgba(0, 0, 0, .5); pointer-events: none; }
.cars { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.cars button { text-align: left; padding: 12px; border-radius: 14px; background: rgba(255, 255, 255, .1); box-shadow: inset 0 0 0 2px rgba(255, 255, 255, .18); }
.cars button[aria-checked='true'] { background: #fff; color: var(--ink); box-shadow: 0 0 0 3px var(--hazard); }
.cars strong { display: block; font: 900 19px var(--font); }
.cars small { display: block; font-size: 12.5px; line-height: 1.3; opacity: .8; margin: 3px 0 8px; min-height: 2.6em; }
.bars span { display: grid; grid-template-columns: 76px 1fr; align-items: center; gap: 6px; margin-top: 3px; }
.bars em { font-style: normal; font-size: 11px; font-weight: 700; opacity: .75; }
.bars i { height: 6px; border-radius: 3px; background: linear-gradient(90deg, var(--hazard) calc(var(--v) * 20%), rgba(127, 127, 160, .3) 0); }
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-top: 6px; }
.stats > div { background: rgba(0, 0, 0, .16); border-radius: 12px; padding: 10px 8px; text-align: center; }
.stats b { display: block; font: 900 24px var(--font); }
.stats span { font-size: 11.5px; font-weight: 700; opacity: .8; }
.stats .medals { grid-column: 1 / -1; display: flex; justify-content: center; gap: 18px; }
.stats .wide { grid-column: 1 / -1; }
.rules { background: var(--cream); color: var(--ink); border-radius: 16px; padding: 14px 16px 6px; margin-bottom: 18px; box-shadow: inset 0 0 0 3px var(--brake); }
.rules h3 { color: var(--brake); font-style: italic; }
.rules ol { margin: 6px 0 8px; padding-left: 20px; font-size: 14px; line-height: 1.45; }
.rules li { margin-bottom: 4px; }
.room-plan { background: rgba(0, 0, 0, .18); border-radius: 14px; padding: 12px 14px; margin-bottom: 14px; font-size: 14px; line-height: 1.45; }
.room-plan b { font-size: 17px; }
.room-plan span { display: block; color: #ffb3bb; font-weight: 800; margin-top: 2px; }
.medals span, .medal-row span, .hud-medals span, .mode-best span { display: inline-flex; align-items: center; gap: 6px; font-weight: 900; }
.medals span::before, .medal-row span:not(.pb)::before, .hud-medals span::before, .mode-best span::before, .dot::before {
  content: ''; width: 14px; height: 14px; border-radius: 50%; background: var(--m); box-shadow: inset 0 -2px 0 rgba(0, 0, 0, .2), 0 0 0 2px #fff; }
.m-gold { --m: var(--gold); } .m-silver { --m: var(--silver); } .m-bronze { --m: var(--bronze); }

.preview { position: absolute; left: calc(clamp(14px, 4vw, 70px) + min(480px, calc(100vw - 28px)) + 20px); right: 20px; top: 0; bottom: 0; }
.preview canvas { width: 100%; height: 100%; display: block; }
.preview-name { position: absolute; left: 50%; bottom: 9vh; transform: translateX(-50%); background: #fff; padding: 10px 22px; border-radius: 30px; font: 900 22px var(--font); white-space: nowrap; box-shadow: 0 10px 24px rgba(15, 25, 80, .3); }
.preview-name em { font-style: normal; color: var(--sign); margin-left: 6px; }

/* Solo */
.mode-card { background: rgba(255, 255, 255, .09); border-radius: 16px; padding: 16px; margin-bottom: 14px; box-shadow: inset 0 0 0 2px rgba(255, 255, 255, .16); }
.mode-card.daily { background: linear-gradient(135deg, rgba(255, 200, 61, .22), rgba(255, 255, 255, .06)); }
.mode-best { font-size: 14px; margin-bottom: 4px; }
.medal-row { display: flex; flex-wrap: wrap; gap: 14px; margin-top: 12px; font-size: 14px; }
.medal-row .pb { color: var(--hazard); }

/* Multijoueur */
.join-row { display: flex; gap: 10px; }
.join-row input { text-transform: uppercase; letter-spacing: .3em; font-family: var(--mono); text-align: center; }
.join-row .btn { flex: none; }
.room-list, .room-players, .board-rows { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.room-list li, .room-players li { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 14px; background: rgba(255, 255, 255, .1); }
.room-list li > div, .room-players li > div { flex: 1; min-width: 0; }
.room-list strong, .room-players strong { display: block; font-weight: 900; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.room-list small, .room-players small { font-size: 12.5px; opacity: .8; }
.room-list .av, .room-players .av { font-size: 26px; }
.room-list .count { font-weight: 900; }
.room-list .empty, .board-rows .empty { background: none; padding: 8px 0; opacity: .8; font-size: 14px; }
.room-code { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 16px; border-radius: 16px; background: var(--cream); color: var(--ink); margin-bottom: 16px; }
.room-code small { display: block; font-weight: 800; font-size: 12px; color: #6a6f8c; }
.room-code strong { font: 700 40px/1 var(--mono); letter-spacing: .18em; color: var(--sign); }
.room-code .btn { color: var(--sign); box-shadow: inset 0 0 0 2px var(--sign); background: #fff; font-size: 13px; }
.room-players li { box-shadow: inset 5px 0 0 var(--c); }
.room-players li.me { background: rgba(255, 255, 255, .2); }
.room-players .state { font-size: 12px; font-weight: 900; padding: 5px 10px; border-radius: 20px; background: rgba(0, 0, 0, .2); }
.room-players .state.ready { background: #7bd34f; color: var(--ink); }
.room-players .state.host { background: var(--hazard); color: var(--ink); }
.room-players .slot { justify-content: center; opacity: .6; font-size: 14px; font-weight: 700; background: none; box-shadow: inset 0 0 0 2px rgba(255, 255, 255, .25); border-radius: 14px; }
#room-settings { margin-top: 16px; }
.room-actions { display: flex; gap: 10px; align-items: stretch; margin-top: 10px; }
.room-actions .btn { flex: 1; margin-top: 16px; font-size: 17px; }
.room-actions .go { flex: 1; }

/* Classements */
.board-rows li { display: grid; grid-template-columns: 30px 38px 1fr 18px auto; align-items: center; gap: 8px; padding: 9px 12px; border-radius: 12px; background: rgba(255, 255, 255, .08); font-weight: 700; }
.board-rows li:nth-child(-n+3) { background: rgba(255, 255, 255, .16); }
.board-rows li.me { background: #fff; color: var(--ink); }
.board-rows .rk { font: 900 18px var(--font); text-align: center; }
.board-rows .av { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; background: var(--c); font-size: 19px; }
.board-rows .nm { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.board-rows .tm { font: 700 16px var(--mono); }
.board-rows .sc { grid-column: 3 / -1; font-size: 12px; opacity: .7; margin-top: -6px; }
.dot { display: inline-flex; }
.dot.none::before { content: ''; }

/* ------------------------------------------------------------- Ticket de résultats */
#screen-results { display: none; place-items: center; background: rgba(20, 24, 70, .35); }
#screen-results.active { display: grid; }
.ticket { position: relative; width: min(430px, 92vw); max-height: calc(100vh - 40px); overflow-y: auto; background: var(--cream); color: var(--ink); font-family: var(--mono);
  padding: 30px 26px 24px; transform: rotate(-1.2deg); filter: drop-shadow(0 22px 36px rgba(15, 20, 60, .45));
  -webkit-mask: radial-gradient(circle 7px at 50% 0, transparent 98%, #000) top / 20px 51% repeat-x, radial-gradient(circle 7px at 50% 100%, transparent 98%, #000) bottom / 20px 51% repeat-x;
  mask: radial-gradient(circle 7px at 50% 0, transparent 98%, #000) top / 20px 51% repeat-x, radial-gradient(circle 7px at 50% 100%, transparent 98%, #000) bottom / 20px 51% repeat-x;
  animation: print 0.9s cubic-bezier(.2, .9, .3, 1) both; }
.t-head { display: flex; align-items: center; gap: 12px; padding-bottom: 14px; border-bottom: 2px dashed #c9bda2; }
.t-p { display: grid; place-items: center; width: 48px; height: 48px; border-radius: 10px; background: var(--sign); color: #fff; font: 900 36px var(--font); padding-top: 6px; box-shadow: 0 0 0 3px var(--cream), 0 0 0 5px var(--sign); }
.t-head strong { display: block; font: italic 900 20px/1.1 var(--font); white-space: nowrap; }
.t-head small { font-size: 12px; color: #7a7360; }
.t-date { margin-left: auto; text-align: right; }
.t-body { padding: 14px 0; }
.t-line { display: flex; justify-content: space-between; gap: 12px; padding: 5px 0; font-size: 14.5px; }
.t-line span { color: #6b6553; }
.t-line.neg b { color: #d3263c; }
.t-sep { border-top: 2px dashed #c9bda2; margin: 10px 0; }
.t-total { display: flex; justify-content: space-between; align-items: baseline; padding: 10px 0; border-top: 3px double var(--ink); border-bottom: 3px double var(--ink); margin: 8px 0 14px; }
.t-total b { font: 700 36px var(--mono); }
.t-medal { display: flex; align-items: center; gap: 14px; padding: 12px; border-radius: 12px; background: #fff; margin-bottom: 12px; font-family: var(--font); }
.t-medal i { flex: none; width: 58px; height: 58px; border-radius: 50%; background: radial-gradient(circle at 35% 30%, #fff8, transparent 40%), var(--m, #ddd); box-shadow: inset 0 -5px 0 rgba(0, 0, 0, .18), 0 0 0 4px #fff, 0 0 0 6px var(--m, #ddd); animation: medal 1s .6s cubic-bezier(.2, 1.6, .4, 1) both; }
.t-medal.gold { --m: var(--gold); } .t-medal.silver { --m: var(--silver); } .t-medal.bronze { --m: var(--bronze); }
.t-medal.none i { background: repeating-linear-gradient(45deg, #ddd 0 6px, #eee 6px 12px); }
.t-medal strong { display: block; font-weight: 900; font-size: 19px; }
.t-medal small { font-size: 12.5px; color: #6b6553; }
.t-stamp { display: inline-block; margin: 6px 0 4px; padding: 6px 12px; border: 3px solid var(--brake); color: var(--brake); border-radius: 8px; font: 900 18px var(--font); transform: rotate(-6deg); animation: stamp .5s 1.1s cubic-bezier(.2, 1.6, .4, 1) both; }
.t-podium { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.t-podium li { position: relative; display: grid; grid-template-columns: 24px 34px 1fr auto auto; gap: 8px; align-items: center; padding: 8px; border-radius: 10px; box-shadow: inset 4px 0 0 var(--c); }
.t-podium li.loser { background: #ffe1e4; }
.t-podium .pts { display: flex; flex-direction: column; font-size: 11.5px; color: #6b6553; text-align: right; }
.t-podium .pts em { font-style: normal; }
.t-fuah { position: absolute; right: 4px; top: -4px; padding: 2px 8px; border: 3px solid var(--brake); border-radius: 8px; color: var(--brake); font: italic 900 20px var(--font);
  transform: rotate(-10deg); background: rgba(255, 244, 221, .92); animation: stamp .5s 1.1s cubic-bezier(.2, 1.6, .4, 1) both; }
.t-legend { font-size: 11.5px; color: #6b6553; line-height: 1.4; margin: 10px 0 4px; }
.t-podium li:first-child { background: #fff; }
.t-podium li.me { outline: 2px dashed var(--sign); }
.t-podium .rk { font: 900 20px var(--font); text-align: center; }
.t-podium .av { font-size: 26px; text-align: center; }
.t-podium .nm { font: 900 16px var(--font); }
.t-podium .nm small { display: block; font: 500 12px var(--mono); color: #6b6553; }
.t-podium .sc { font: 700 18px var(--mono); }
.t-actions { display: flex; flex-direction: column; gap: 8px; font-family: var(--font); }
.t-actions .btn { color: var(--sign); box-shadow: inset 0 0 0 2px var(--sign); background: #fff; }
.t-barcode { height: 44px; margin-top: 18px; background: repeating-linear-gradient(90deg, var(--ink) 0 2px, transparent 2px 4px, var(--ink) 4px 7px, transparent 7px 8px, var(--ink) 8px 9px, transparent 9px 12px); opacity: .85; }

/* ------------------------------------------------------------- HUD */
#hud { position: fixed; inset: 0; display: none; pointer-events: none; }
#hud.on { display: block; }
#hud button { pointer-events: auto; }
.hud-tl { position: absolute; left: 16px; top: calc(16px + var(--safe-t)); background: var(--sign); color: #fff; border-radius: 18px; padding: 12px 18px 14px; box-shadow: var(--rim), 0 8px 0 var(--sign-deep), 0 14px 30px rgba(10, 20, 70, .35); min-width: 210px; }
.hud-mode { font-weight: 800; font-size: 13px; opacity: .85; }
.hud-time { display: flex; align-items: baseline; gap: 8px; }
.hud-time span { font: 900 42px/1.05 var(--font); font-variant-numeric: tabular-nums; letter-spacing: -.02em; }
.hud-time em { font-style: normal; font-weight: 900; color: #ffb3bb; }
.hud-pips { display: flex; gap: 5px; margin: 6px 0 8px; }
.hud-pips i { width: 26px; height: 26px; border-radius: 6px; background: rgba(255, 255, 255, .15); box-shadow: inset 0 0 0 2px rgba(255, 255, 255, .35); display: grid; place-items: center; transition: transform .3s cubic-bezier(.2, 1.8, .4, 1); }
.hud-pips i::after { content: 'P'; font: 900 15px var(--font); color: rgba(255, 255, 255, .45); padding-top: 3px; font-style: normal; }
.hud-pips i.on { background: var(--c, var(--hazard)); box-shadow: inset 0 0 0 2px #fff; transform: scale(1.1); }
.hud-pips i.on::after { color: #fff; }
.hud-dmg { font-weight: 800; font-size: 14px; }
.hud-dmg span { font: 900 22px var(--font); font-variant-numeric: tabular-nums; display: inline-block; }
.hud-dmg em { font-style: normal; opacity: .8; }
.hud-dmg span.hit { animation: bump-down .5s; }

.hud-spots { position: absolute; left: 50%; top: calc(16px + var(--safe-t)); transform: translateX(-50%); display: flex; align-items: center; gap: 12px;
  background: #fff; color: var(--ink); padding: 8px 18px 8px 10px; border-radius: 18px; box-shadow: 0 10px 26px rgba(10, 20, 70, .3); }
.hud-spots strong { display: grid; place-items: center; min-width: 54px; height: 54px; padding: 4px 8px 0; border-radius: 12px; background: var(--sign); color: #fff;
  font: 900 34px/1 var(--font); box-shadow: inset 0 0 0 3px var(--sign), inset 0 0 0 5px #fff; }
.hud-spots span { display: block; font-weight: 900; font-size: 16px; }
.hud-spots small { display: block; font-weight: 700; font-size: 12.5px; color: #6a6f8c; }
.hud-spots.last strong { background: var(--brake); box-shadow: inset 0 0 0 3px var(--brake), inset 0 0 0 5px #fff; animation: honk 1.4s infinite; }
.hud-spots.pulse { animation: spots-pulse .9s cubic-bezier(.2, 1.6, .4, 1); }
.hud-medals { display: flex; gap: 12px; margin-top: 6px; font-size: 13px; }
.hud-medals:empty { display: none; }

.hud-board { position: absolute; left: 16px; top: calc(220px + var(--safe-t)); list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 5px; width: 240px; }
#hud.solo .hud-board { display: none; }
.hud-board li { display: grid; grid-template-columns: 16px 24px 1fr auto; grid-template-areas: 'rk av nm sc' 'rk av pk pk'; align-items: center; column-gap: 6px; background: rgba(255, 255, 255, .9); border-radius: 12px; padding: 5px 10px; box-shadow: inset 4px 0 0 var(--c); font-size: 13px; }
.hud-board li.me { background: #fff; box-shadow: inset 4px 0 0 var(--c), 0 0 0 2px var(--c); }
.hud-board li.done { opacity: .75; }
.hud-board b { grid-area: rk; font-weight: 900; }
.hud-board .av { grid-area: av; font-size: 18px; }
.hud-board .nm { grid-area: nm; font-weight: 800; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hud-board .sc { grid-area: sc; font-weight: 800; font-variant-numeric: tabular-nums; color: #5a607c; }
.hud-board .pk { grid-area: pk; display: flex; gap: 3px; }
.hud-board .pk i { width: 14px; height: 6px; border-radius: 3px; background: #d7d9e6; }
.hud-board .pk i.on { background: var(--c); }

.hud-map { position: absolute; right: 16px; top: calc(16px + var(--safe-t)); padding: 6px; background: #fff; border-radius: 14px; box-shadow: 0 10px 26px rgba(10, 20, 70, .35); }
.hud-map canvas { display: block; border-radius: 9px; }
.feed { position: absolute; right: 16px; top: calc(200px + var(--safe-t)); width: 280px; display: flex; flex-direction: column; gap: 6px; align-items: flex-end; }
.feed-item { background: rgba(255, 255, 255, .92); padding: 7px 12px; border-radius: 12px; font-size: 13.5px; font-weight: 600; box-shadow: 0 4px 12px rgba(0, 0, 0, .12); animation: slide-l .3s both; transition: opacity .5s, transform .5s; }
.feed-item.bad { background: #ffe1e4; }
.feed-item.info { background: #fff4c9; }
.feed-item.good { background: #dcf8d0; }
.feed-item.out { opacity: 0; transform: translateX(20px); }

.hud-bottom { position: absolute; left: 50%; bottom: calc(18px + var(--safe-b)); transform: translateX(-50%); display: flex; align-items: center; gap: 14px; }
.radar-btn { position: relative; width: 70px; height: 70px; border-radius: 50%; color: var(--ink); display: grid; place-items: center; align-content: center;
  background: conic-gradient(var(--mint) calc(var(--p, 1) * 360deg), rgba(255, 255, 255, .5) 0); box-shadow: 0 8px 18px rgba(10, 20, 70, .35); }
.radar-btn::before { content: ''; position: absolute; inset: 5px; border-radius: 50%; background: #fff; }
.radar-btn b, .radar-btn span { position: relative; }
.radar-btn b { font: 900 22px/1 var(--font); }
.radar-btn span { font-size: 11px; font-weight: 800; }
.radar-btn.ready { animation: ping 1.8s infinite; }
.emotes { display: flex; gap: 6px; background: rgba(255, 255, 255, .85); padding: 6px; border-radius: 16px; box-shadow: 0 8px 18px rgba(10, 20, 70, .25); }
.emotes button { position: relative; font-size: 22px; width: 44px; height: 44px; border-radius: 12px; }
.emotes button:hover { background: #eef0fb; }
.emotes kbd { position: absolute; left: 2px; top: 2px; font-size: 9px; padding: 0 3px; }

.park-meter { position: absolute; left: 50%; top: 60%; transform: translate(-50%, -50%) scale(.6); opacity: 0; transition: opacity .2s, transform .25s; text-align: center; }
.park-meter.on { opacity: 1; transform: translate(-50%, -50%) scale(1); }
.park-meter .ring { width: 74px; height: 74px; margin: 0 auto 6px; border-radius: 50%; display: grid; place-items: center;
  background: conic-gradient(var(--mint) calc(var(--p, 0) * 360deg), rgba(255, 255, 255, .35) 0); box-shadow: 0 6px 16px rgba(10, 20, 70, .3); }
.park-meter .ring i { width: 58px; height: 58px; border-radius: 12px; background: var(--sign); color: #fff; font: 900 38px var(--font); font-style: normal; display: grid; place-items: center; padding-top: 6px; box-shadow: inset 0 0 0 3px var(--sign), inset 0 0 0 5px #fff; }
.park-meter span { display: inline-block; background: #fff; padding: 5px 12px; border-radius: 20px; font-weight: 900; font-size: 14px; }

.banner { position: absolute; left: 50%; top: 30%; transform: translate(-50%, -50%) scale(.5); opacity: 0; text-align: center; pointer-events: none; transition: opacity .2s; }
.banner.show { opacity: 1; animation: banner .6s cubic-bezier(.2, 1.6, .4, 1) both; }
.banner strong { display: block; font: italic 900 clamp(44px, 7vw, 84px)/1 var(--font); color: #fff; letter-spacing: -.03em; -webkit-text-stroke: 3px var(--sign); paint-order: stroke fill; text-shadow: 0 6px 0 var(--sign-deep), 0 14px 30px rgba(10, 20, 70, .4); }
.banner.good strong { -webkit-text-stroke-color: var(--green); text-shadow: 0 6px 0 var(--green-deep), 0 14px 30px rgba(10, 60, 40, .4); }
.banner.fuah strong { font-size: clamp(70px, 12vw, 150px); color: var(--brake); -webkit-text-stroke: 6px #fff; text-shadow: 0 8px 0 #9b1527, 0 18px 40px rgba(120, 10, 30, .5); }
.banner.fuah.show { animation: fuah .7s cubic-bezier(.2, 1.8, .4, 1) both; }
.banner.fuah span { background: var(--brake); color: #fff; }
.banner span { display: inline-block; margin-top: 10px; background: #fff; padding: 6px 16px; border-radius: 20px; font-weight: 900; font-size: 18px; }

.toast { position: fixed; left: 50%; top: calc(18px + var(--safe-t)); transform: translate(-50%, -220%); opacity: 0; background: #fff; color: var(--ink); padding: 10px 20px; border-radius: 30px; font-weight: 800; box-shadow: 0 10px 24px rgba(10, 20, 70, .3); transition: transform .3s cubic-bezier(.2, 1.4, .4, 1); z-index: 50; pointer-events: none; max-width: 90vw; text-align: center; }
.toast.show { transform: translate(-50%, 0); opacity: 1; }
.toast.bad { background: var(--brake); color: #fff; }
.toast.warn { background: var(--hazard); }
body.in-game .toast { top: calc(96px + var(--safe-t)); }

.lights { position: absolute; left: 50%; top: 32%; transform: translate(-50%, -50%) scale(.6); opacity: 0; display: flex; flex-direction: column; gap: 10px; padding: 14px; background: #2a2e44; border-radius: 26px; box-shadow: 0 0 0 5px #fff, 0 18px 40px rgba(0, 0, 0, .4); transition: opacity .2s, transform .3s cubic-bezier(.2, 1.6, .4, 1); }
.lights.show { opacity: 1; transform: translate(-50%, -50%) scale(1); }
.lights i { width: 62px; height: 62px; border-radius: 50%; background: #444a66; box-shadow: inset 0 -5px 0 rgba(0, 0, 0, .3); transition: background .15s, box-shadow .15s; }
.lights.s3 i:nth-child(1), .lights.s2 i:nth-child(1), .lights.s1 i:nth-child(1) { background: #ff4f5e; box-shadow: 0 0 30px #ff4f5e; }
.lights.s2 i:nth-child(2), .lights.s1 i:nth-child(2) { background: #ffc83d; box-shadow: 0 0 30px #ffc83d; }
.lights.s1 i:nth-child(3) { background: #ffc83d; box-shadow: 0 0 30px #ffc83d; }
.lights.s0 i:nth-child(3) { background: #3ee08a; box-shadow: 0 0 40px #3ee08a; }

#float-layer { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.float { position: absolute; left: 0; top: 0; font: italic 900 30px var(--font); color: #fff; -webkit-text-stroke: 5px var(--ink); paint-order: stroke fill; white-space: nowrap; }
.float.gain { color: #b4ff8a; -webkit-text-stroke-color: var(--green-deep); font-size: 40px; }
.float.loss { color: #fff; -webkit-text-stroke-color: #c41c33; }
.float.other { font-size: 24px; -webkit-text-stroke-color: var(--sign); }

/* Tactile */
.touch { display: none; }
@media (pointer: coarse) {
  .touch { display: block; }
  .touch .pad { position: absolute; bottom: calc(20px + var(--safe-b)); display: flex; gap: 12px; }
  .touch .pad.left { left: 18px; }
  .touch .pad.right { right: 18px; align-items: flex-end; }
  .touch button { width: 78px; height: 78px; border-radius: 22px; background: rgba(255, 255, 255, .78); font-size: 28px; font-weight: 900; color: var(--sign); box-shadow: 0 6px 14px rgba(10, 20, 70, .3); touch-action: none; }
  .touch button.on { background: var(--hazard); transform: scale(.95); }
  .touch .hb { width: 70px; height: 56px; font-size: 14px; }
  .touch .pause-btn { position: absolute; left: 50%; top: calc(14px + var(--safe-t)); transform: translateX(-50%); width: 44px; height: 44px; font-size: 16px; }
  .hud-bottom { bottom: calc(118px + var(--safe-b)); }
  .emotes kbd, .keys-help { display: none; }
  .hud-board { display: none; }
}

/* Pause & connexion */
.overlay { position: fixed; inset: 0; display: none; place-items: center; background: rgba(20, 24, 70, .45); backdrop-filter: blur(4px); z-index: 40; }
.overlay.show { display: grid; }
.overlay .panel h2 { margin-bottom: 8px; }
.conn { position: fixed; left: 50%; bottom: 20px; transform: translate(-50%, 200%); background: var(--brake); color: #fff; padding: 10px 20px; border-radius: 30px; font-weight: 800; transition: transform .3s; z-index: 60; }
.conn.show { transform: translate(-50%, 0); }

/* ------------------------------------------------------------- Responsive */
@media (max-width: 860px) {
  .preview { left: 0; right: 0; top: auto; height: 34vh; bottom: 0; pointer-events: none; }
  #screen-profile .panel { bottom: 34vh; }
  .hud-tl { min-width: 0; padding: 10px 14px; }
  .hud-time span { font-size: 30px; }
  .hud-pips i { width: 20px; height: 20px; }
  .feed { display: none; }
  .hud-spots { top: auto; bottom: calc(100px + var(--safe-b)); padding: 6px 12px 6px 6px; }
  .hud-spots strong { min-width: 42px; height: 42px; font-size: 26px; }
  .keys-help { display: none; }
  .grid-avatars { grid-template-columns: repeat(6, 1fr); }
  .stats { grid-template-columns: repeat(2, 1fr); }
}
@media (max-height: 820px) {
  .psign { width: 104px; height: 104px; border-radius: 20px; }
  .psign span { font-size: 82px; border-radius: 15px; }
  .psign em { width: 44px; height: 44px; font-size: 30px; right: -14px; top: -14px; }
  .pole { left: 46px; top: 100px; }
  .wordmark { margin: 12px 0 16px; }
  .w-fuah { font-size: clamp(56px, 8vw, 88px); }
  .w-spot { font-size: clamp(26px, 3.4vw, 40px); }
  .arrows { gap: 10px; }
  .arrow-sign { padding: 12px 60px 12px 22px; }
}
@media (max-height: 640px) {
  .psign { width: 96px; height: 96px; }
  .psign span { font-size: 76px; }
  .pole { left: 40px; top: 90px; }
  .wordmark { margin: 10px 0 12px; font-size: 52px; }
  .arrow-sign { padding: 10px 56px 10px 20px; }
  .arrow-sign small { display: none; }
}

/* ------------------------------------------------------------- Animations */
@keyframes drop-in { from { transform: translateY(-120%) rotate(-8deg); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes swing-in { from { transform: rotate(-24deg) translateX(-30px); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes fade-up { from { transform: translateY(16px); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes panel-in { from { transform: translateX(-30px); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes slide-l { from { transform: translateX(30px); opacity: 0; } }
@keyframes print { from { transform: translateY(-40px) rotate(-1.2deg); clip-path: inset(0 0 100% 0); } to { transform: rotate(-1.2deg); clip-path: inset(0 0 0 0); } }
@keyframes medal { from { transform: scale(0) rotate(-90deg); } to { transform: none; } }
@keyframes stamp { from { transform: scale(2.4) rotate(-6deg); opacity: 0; } to { transform: rotate(-6deg); opacity: 1; } }
@keyframes banner { from { transform: translate(-50%, -50%) scale(.4) rotate(-6deg); } to { transform: translate(-50%, -50%) scale(1) rotate(-2deg); } }
@keyframes bump-up { 40% { transform: scale(1.35); color: #b4ff8a; } }
@keyframes bump-down { 40% { transform: scale(1.3) translateX(-4px); color: #ffb3bb; } }
@keyframes honk { 0%, 86%, 100% { transform: none; } 90% { transform: scale(1.18) rotate(-8deg); } 94% { transform: scale(1.1) rotate(6deg); } }
@keyframes spots-pulse { 40% { transform: translateX(-50%) scale(1.15); } }
@keyframes fuah { 0% { transform: translate(-50%, -50%) scale(.3) rotate(-14deg); } 60% { transform: translate(-50%, -50%) scale(1.12) rotate(4deg); } 100% { transform: translate(-50%, -50%) scale(1) rotate(-3deg); } }
@keyframes ping { 0%, 100% { box-shadow: 0 8px 18px rgba(10, 20, 70, .35), 0 0 0 0 rgba(71, 255, 209, .6); } 60% { box-shadow: 0 8px 18px rgba(10, 20, 70, .35), 0 0 0 14px rgba(71, 255, 209, 0); } }

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