:root {
  --bg: #07041a;
  --panel: rgba(18, 10, 42, 0.82);
  --panel-2: rgba(30, 18, 64, 0.9);
  --line: rgba(255, 255, 255, 0.12);
  --text: #f6f0ff;
  --muted: #b3a8d6;
  --pink: #ff4fa3;
  --pink-2: #ff9fd1;
  --cyan: #4fd8ff;
  --gold: #ffd36e;
  --green: #63e6be;
  --red: #ff5a7a;
  --radius: 14px;
  --font: "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
  --sa-t: env(safe-area-inset-top, 0px);
  --sa-b: env(safe-area-inset-bottom, 0px);
  --sa-l: env(safe-area-inset-left, 0px);
  --sa-r: env(safe-area-inset-right, 0px);
}

* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; overflow: hidden; background: var(--bg); color: var(--text); font-family: var(--font); }
body { overscroll-behavior: none; touch-action: none; user-select: none; -webkit-user-select: none; }

canvas#game { position: fixed; left: 0; right: 0; top: var(--nt-top, 0px); bottom: var(--nt-bottom, 0px); width: 100%; height: calc(100% - var(--nt-top, 0px) - var(--nt-bottom, 0px)); display: block; touch-action: none; }
#ui { position: fixed; left: 0; right: 0; top: var(--nt-top, 0px); bottom: var(--nt-bottom, 0px); pointer-events: none; z-index: 2; }
#ui > * { pointer-events: none; }
#ui button, #ui input, #ui select, #ui .modal, #ui .dialog, #ui .toast, #ui #minimap, #ui .portal-card, #ui .cine.title, #ui .phone { pointer-events: auto; }
.hidden { display: none !important; }

#presentation { position: relative; z-index: 3; height: 100%; overflow-y: auto; padding: 28px 18px 60px; max-width: 760px; margin: 0 auto; line-height: 1.6; color: #efe8ff; }
#presentation h1 { font-size: 28px; margin-bottom: 12px; color: #ffe2f1; }
#presentation h2 { font-size: 19px; margin: 22px 0 8px; color: #ffd1e8; }
#presentation ul { padding-left: 20px; }
#presentation a { color: var(--cyan); }
html.js #presentation { display: none; }

html.js #presentation.ouvert { display: block; position: fixed; left: 0; right: 0; top: var(--nt-top, 0px); bottom: var(--nt-bottom, 0px); z-index: 40; max-width: none; margin: 0; padding: 28px max(18px, calc((100% - 760px) / 2)) 60px; background: rgba(7, 4, 26, 0.97); backdrop-filter: blur(6px); touch-action: pan-y; }
.pres-fermer { display: none; }
html.js #presentation.ouvert .pres-fermer { display: grid; place-items: center; position: sticky; top: 0; margin-left: auto; width: 40px; height: 40px; border-radius: 10px; background: rgba(255, 255, 255, 0.1); color: #fff; font-size: 18px; cursor: pointer; }
.pres-ariane { font-size: 13px; color: var(--muted); margin-bottom: 10px; }
#presentation details { margin: 8px 0; padding: 10px 14px; border-radius: 10px; background: rgba(255, 255, 255, 0.05); }
#presentation summary { font-weight: 800; cursor: pointer; }
#presentation details p { margin-top: 6px; color: #d9d0f2; }
.noscript { position: fixed; bottom: 0; left: 0; right: 0; padding: 12px; background: #2a1040; text-align: center; z-index: 4; }
button { font: inherit; color: inherit; border: 0; background: none; cursor: pointer; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 12px 20px; border-radius: 12px; font-weight: 800; font-size: 15px;
  background: rgba(255, 255, 255, 0.08); border: 1px solid var(--line);
  transition: transform .12s, background .2s, box-shadow .2s;
}
.btn:hover { background: rgba(255, 255, 255, 0.14); }
.btn:active { transform: scale(0.96); }
.btn.primary {
  background: linear-gradient(135deg, var(--pink), #b04bff); border-color: transparent;
  box-shadow: 0 6px 24px rgba(255, 79, 163, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.3);
}
.btn.primary:hover { box-shadow: 0 8px 32px rgba(255, 79, 163, 0.65), inset 0 1px 0 rgba(255, 255, 255, 0.3); }
.btn.ghost { background: transparent; }
.btn.big { padding: 15px 30px; font-size: 17px; }
.row { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; margin-top: 18px; }

.icon-btn {
  position: relative; width: 44px; height: 44px; border-radius: 12px;
  background: var(--panel); border: 1px solid var(--line); font-size: 20px;
  display: grid; place-items: center; backdrop-filter: blur(8px);
  transition: transform .12s;
}
.icon-btn:active { transform: scale(0.92); }
.badge {
  position: absolute; top: -5px; right: -5px; min-width: 20px; height: 20px; padding: 0 5px;
  border-radius: 10px; background: var(--red); color: #fff; font-size: 12px; font-weight: 900;
  display: grid; place-items: center; animation: pulse 1.2s infinite;
}

.hud-top {
  position: absolute; top: calc(10px + var(--sa-t)); left: calc(10px + var(--sa-l)); right: calc(10px + var(--sa-r));
  display: flex; justify-content: space-between; align-items: flex-start; gap: 10px;
}
.gauges { display: flex; flex-direction: column; gap: 6px; padding: 8px 10px; border-radius: var(--radius); background: var(--panel); border: 1px solid var(--line); backdrop-filter: blur(8px); }
.gauge { position: relative; display: flex; align-items: center; gap: 7px; }
.gauge .gi { font-size: 14px; width: 18px; text-align: center; }
.gauge .bar { width: clamp(70px, 18vw, 130px); height: 8px; border-radius: 5px; background: rgba(255, 255, 255, 0.1); overflow: hidden; }
.gauge .bar i { display: block; height: 100%; width: 50%; border-radius: 5px; transition: width .6s cubic-bezier(.2, .9, .3, 1.3); }
.gauge[data-g="coeur"] .bar i { background: linear-gradient(90deg, #ff4f81, #ff9fd1); box-shadow: 0 0 10px #ff4f81; }
.gauge[data-g="tete"] .bar i { background: linear-gradient(90deg, #4fd8ff, #a8ecff); box-shadow: 0 0 10px #4fd8ff; }
.gauge[data-g="ego"] .bar i { background: linear-gradient(90deg, #ffb020, #ffe27a); box-shadow: 0 0 10px #ffb020; }
.gauge.flash { animation: gflash .6s; }
.gfx { position: absolute; right: -8px; top: -6px; font-weight: 900; font-size: 13px; animation: rise 1.4s forwards; text-shadow: 0 0 8px currentColor; }
.gfx.up { color: var(--green); } .gfx.down { color: var(--red); }

.hud-right { display: flex; flex-direction: column; align-items: flex-end; gap: 8px; }
.counters { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.counter { padding: 7px 10px; border-radius: 10px; background: var(--panel); border: 1px solid var(--line); font-weight: 800; font-size: 14px; backdrop-filter: blur(8px); white-space: nowrap; }
.counter small { opacity: .6; font-size: 11px; margin-left: 1px; }
.counter.spark { color: var(--gold); }
.hud-btns { display: flex; gap: 6px; }

.objective {
  position: absolute; top: calc(118px + var(--sa-t)); left: 50%; transform: translateX(-50%);
  max-width: min(92vw, 520px); padding: 9px 16px; border-radius: 12px;
  background: linear-gradient(135deg, rgba(79, 216, 255, 0.18), rgba(18, 10, 42, 0.85)); border: 1px solid rgba(79, 216, 255, 0.45);
  font-weight: 700; font-size: 14px; display: flex; align-items: center; gap: 9px; backdrop-filter: blur(8px);
  box-shadow: 0 0 22px rgba(79, 216, 255, 0.2); text-align: left;
}
.objective.pop { animation: objpop .6s cubic-bezier(.2, .9, .3, 1.4); }
.obj-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--cyan); box-shadow: 0 0 10px var(--cyan); flex: none; animation: pulse 1.4s infinite; }

.shards { position: absolute; top: calc(162px + var(--sa-t)); left: 50%; transform: translateX(-50%); display: flex; gap: 5px; }
.shards i { width: 11px; height: 14px; clip-path: polygon(50% 0, 100% 35%, 70% 100%, 20% 80%, 0 30%); background: rgba(255, 255, 255, 0.15); }
.shards i.on { background: linear-gradient(135deg, #fff, var(--pink)); filter: drop-shadow(0 0 6px var(--pink)); }

.district-banner {
  position: absolute; top: 34%; left: 50%; transform: translate(-50%, -50%); text-align: center;
  opacity: 0; pointer-events: none; display: flex; flex-direction: column; align-items: center; gap: 2px;
}
.district-banner span { font-size: 42px; }
.district-banner b { font-size: clamp(22px, 5vw, 34px); font-weight: 900; color: #fff; text-shadow: 0 0 20px var(--c), 0 0 40px var(--c); letter-spacing: .5px; }
.district-banner small { color: var(--muted); font-weight: 700; }
.district-banner.show { animation: banner 2.8s ease forwards; }

.portal-card {
  position: absolute; left: 50%; bottom: calc(24px + var(--sa-b)); transform: translateX(-50%);
  display: flex; align-items: center; gap: 12px; padding: 10px 12px 10px 14px; border-radius: 16px;
  background: var(--panel-2); border: 1px solid var(--c); box-shadow: 0 0 30px color-mix(in srgb, var(--c) 45%, transparent);
  width: min(92vw, 440px); animation: slideup .35s cubic-bezier(.2, .9, .3, 1.3); backdrop-filter: blur(10px);
}
.pc-emoji { font-size: 32px; }
.pc-body { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.pc-body b { font-size: 15px; } .pc-body small { color: var(--muted); font-weight: 600; }

#minimap {
  position: absolute; right: calc(12px + var(--sa-r)); bottom: calc(108px + var(--sa-b)); width: 110px; height: 110px;
  border-radius: 50%; border: 2px solid rgba(255, 255, 255, 0.25); box-shadow: 0 0 20px rgba(0, 0, 0, 0.6), 0 0 14px rgba(255, 79, 163, 0.25);
  cursor: pointer;
}
#boost {
  position: absolute; right: calc(20px + var(--sa-r)); bottom: calc(24px + var(--sa-b)); width: 74px; height: 74px; border-radius: 50%;
  background: var(--panel-2); border: 2px solid var(--gold); overflow: hidden; display: grid; place-items: center;
  box-shadow: 0 0 24px rgba(255, 211, 110, 0.35); touch-action: none;
}
#boost span { position: relative; z-index: 1; font-size: 30px; }
#boost i { position: absolute; left: 0; right: 0; bottom: 0; height: 100%; background: linear-gradient(0deg, rgba(255, 176, 32, 0.55), rgba(255, 226, 122, 0.25)); transition: height .2s; }
#boost.on { transform: scale(0.94); box-shadow: 0 0 40px rgba(255, 211, 110, 0.8); }

#game-hud .icon-btn { position: absolute; top: calc(12px + var(--sa-t)); right: calc(12px + var(--sa-r)); pointer-events: auto; }

#race-hud { position: absolute; top: calc(118px + var(--sa-t)); left: 50%; transform: translateX(-50%); display: flex; flex-direction: column; align-items: center; gap: 4px; pointer-events: none; }
#race-hud .rh-time { font-size: 38px; font-weight: 900; font-variant-numeric: tabular-nums; text-shadow: 0 0 18px var(--cyan); }
#race-hud .rh-time.over { color: #ffd0d8; text-shadow: 0 0 18px var(--red); }
#race-hud .rh-cp { font-size: 13px; font-weight: 700; color: var(--muted); padding: 4px 10px; border-radius: 10px; background: var(--panel); }
#race-hud .btn { pointer-events: auto; padding: 6px 12px; font-size: 12px; margin-top: 2px; }
.medal { font-size: 72px; filter: drop-shadow(0 0 24px rgba(255, 211, 110, 0.6)); animation: starin .6s cubic-bezier(.2, .9, .3, 1.6); }
.stats div.hit { border: 1px solid var(--gold); background: rgba(255, 211, 110, 0.1); }
.drive-hint { position: absolute; left: 50%; bottom: calc(230px + var(--sa-b)); transform: translateX(-50%); padding: 10px 16px; border-radius: 12px; background: var(--panel); border: 1px solid var(--line); font-size: 13.5px; font-weight: 700; color: #e8defc; white-space: nowrap; animation: bob 2s ease-in-out infinite; }

#toasts { position: absolute; top: calc(10px + var(--sa-t)); left: 50%; transform: translateX(-50%); width: min(94vw, 420px); display: flex; flex-direction: column; gap: 8px; z-index: 30; }
.toast {
  display: flex; gap: 12px; align-items: center; padding: 11px 14px; border-radius: 14px;
  background: rgba(24, 14, 52, 0.96); border: 1px solid var(--line); box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
  animation: toastin .45s cubic-bezier(.2, .9, .3, 1.3); cursor: pointer;
}
.toast.out { animation: toastout .45s forwards; }
.toast b { font-size: 13px; display: block; } .toast p { font-size: 13px; color: var(--muted); line-height: 1.35; margin-top: 2px; }
.t-emoji { width: 40px; height: 40px; flex: none; border-radius: 12px; display: grid; place-items: center; font-size: 22px; background: color-mix(in srgb, var(--c, #ff4fa3) 25%, transparent); border: 1px solid var(--c, #ff4fa3); }
.toast.ach { border-color: var(--gold); } .t-emoji.ach { --c: #ffd36e; }
.toast.souvenir { border-color: var(--pink-2); }

.dialog {
  position: absolute; inset: 0; display: flex; align-items: flex-end; justify-content: center; gap: 10px; z-index: 20; cursor: pointer;
  padding: 0 2vw calc(18px + var(--sa-b)); --tx: 0;
  background: linear-gradient(0deg, rgba(5, 2, 16, 0.45), rgba(5, 2, 16, 0) 45%);
  animation: fade .25s;
}
.dialog > .portrait, .dialog > .bubble { animation: slideup .3s cubic-bezier(.2, .9, .3, 1.2); }
.dialog .portrait { flex: none; filter: drop-shadow(0 0 18px var(--c)); animation: bob 3s ease-in-out infinite; }
.dialog .portrait svg { width: clamp(78px, 20vw, 110px); height: auto; display: block; }
.dialog .bubble {
  position: relative; flex: 1; max-width: 560px; padding: 14px 18px 22px; border-radius: 18px; background: rgba(16, 9, 38, 0.95);
  border: 1.5px solid var(--c); box-shadow: 0 0 36px color-mix(in srgb, var(--c) 35%, transparent), 0 10px 40px rgba(0, 0, 0, 0.5);
  min-height: 92px;
}
.dialog .name { font-weight: 900; color: var(--c); font-size: 14px; letter-spacing: .5px; margin-bottom: 4px; text-transform: uppercase; }
.dialog .text { font-size: clamp(15px, 3.8vw, 17px); line-height: 1.5; font-weight: 600; }
.dialog .next { position: absolute; right: 14px; bottom: 6px; font-size: 12px; color: var(--c); opacity: 0; }
.dialog.done .next { opacity: 1; animation: bob 1s infinite; }
.dialog.narr .bubble { background: rgba(8, 4, 20, 0.9); border-color: rgba(182, 156, 255, 0.4); text-align: center; }
.dialog.narr .text { font-style: italic; color: #e3dcff; }
.dialog.choices { cursor: default; }
.choice-list { width: min(96vw, 680px); display: flex; flex-direction: column; gap: 8px; }
.choice {
  display: flex; justify-content: space-between; align-items: center; gap: 10px; text-align: left;
  padding: 14px 16px; border-radius: 14px; background: rgba(20, 11, 46, 0.96); border: 1.5px solid rgba(255, 159, 209, 0.5);
  font-weight: 700; font-size: 15px; line-height: 1.35; animation: slideup .3s backwards; transition: transform .12s, border-color .2s, background .2s;
}
.choice:nth-child(2) { animation-delay: .06s; } .choice:nth-child(3) { animation-delay: .12s; } .choice:nth-child(4) { animation-delay: .18s; }
.choice:hover { border-color: var(--pink); background: rgba(50, 20, 70, 0.96); transform: translateX(4px); }
.choice.locked { opacity: .5; cursor: not-allowed; border-style: dashed; }
.cfx { display: flex; gap: 4px; flex: none; }
.fx { font-size: 11px; padding: 2px 5px; border-radius: 6px; background: rgba(255, 255, 255, 0.08); }
.fx.up { color: var(--green); } .fx.down { color: var(--red); }
.why { font-size: 12px; color: var(--muted); flex: none; }

.modal {
  position: absolute; inset: 0; display: grid; place-items: center; padding: 16px; z-index: 25;
  background: rgba(5, 2, 16, 0.6); backdrop-filter: blur(6px); animation: fade .25s;
}
.modal-card {
  position: relative; width: min(94vw, 560px); max-height: calc(100dvh - 32px); overflow-y: auto; overscroll-behavior: contain; touch-action: pan-y;
  padding: 26px 22px 22px; border-radius: 22px; background: linear-gradient(160deg, rgba(34, 18, 70, 0.97), rgba(14, 8, 34, 0.97));
  border: 1px solid var(--line); box-shadow: 0 20px 80px rgba(0, 0, 0, 0.6), 0 0 60px rgba(255, 79, 163, 0.12);
  text-align: center; animation: pop .35s cubic-bezier(.2, .9, .3, 1.3);
}
.modal-card::-webkit-scrollbar { width: 6px; } .modal-card::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, 0.2); border-radius: 3px; }
.close { position: absolute; top: 12px; right: 12px; width: 36px; height: 36px; border-radius: 10px; background: rgba(255, 255, 255, 0.08); font-size: 16px; z-index: 2; }
.modal h2 { font-size: clamp(22px, 5vw, 28px); font-weight: 900; margin-bottom: 6px; }
.modal h3 { font-size: 14px; font-weight: 800; text-align: left; margin: 18px 0 8px; letter-spacing: .3px; }
.sub { color: var(--muted); font-weight: 600; font-size: 14px; line-height: 1.45; }
.hint { color: var(--muted); font-size: 12.5px; margin-top: 14px; line-height: 1.5; }

.dist-head { padding-bottom: 6px; }
.dist-emoji { font-size: 56px; filter: drop-shadow(0 0 20px var(--c)); animation: bob 3s ease-in-out infinite; }
.dist-head h2 { color: #fff; text-shadow: 0 0 18px var(--c); }
.dist-game { color: var(--c); font-weight: 900; margin-bottom: 8px; }
.dist-head p:last-child { color: var(--muted); font-size: 14px; line-height: 1.5; }
.levels { display: flex; flex-direction: column; gap: 8px; margin-top: 16px; }
.level {
  display: grid; grid-template-columns: 40px 1fr auto; grid-template-rows: auto auto; column-gap: 12px; align-items: center; text-align: left;
  padding: 12px 14px; border-radius: 14px; background: rgba(255, 255, 255, 0.05); border: 1px solid var(--line); transition: transform .12s, border-color .2s;
}
.level:not(.locked):hover { border-color: var(--pink); transform: translateY(-2px); }
.lv-num { grid-row: 1 / 3; width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; font-weight: 900; font-size: 18px; background: linear-gradient(135deg, var(--pink), #b04bff); }
.level.arcade .lv-num { background: linear-gradient(135deg, var(--cyan), #7b6cff); }
.lv-name { font-weight: 800; font-size: 15px; }
.lv-stars { grid-row: 1 / 3; font-size: 20px; letter-spacing: 1px; }
.lv-stars i { font-style: normal; color: rgba(255, 255, 255, 0.18); } .lv-stars i.on { color: var(--gold); text-shadow: 0 0 10px var(--gold); }
.lv-best { font-size: 12px; color: var(--muted); font-weight: 600; }
.level.locked { opacity: .45; cursor: not-allowed; }

.intro h2 { color: #fff; text-shadow: 0 0 18px var(--c); }
.intro .sub { margin-bottom: 14px; }
.howto { list-style: none; text-align: left; display: flex; flex-direction: column; gap: 8px; margin: 10px 0 16px; }
.howto li { padding: 10px 14px 10px 38px; border-radius: 12px; background: rgba(255, 255, 255, 0.05); position: relative; font-weight: 600; font-size: 14px; line-height: 1.4; }
.howto li::before { content: '✦'; position: absolute; left: 14px; color: var(--c); }
.thresholds { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; }
.thresholds span { padding: 6px 10px; border-radius: 10px; background: rgba(255, 211, 110, 0.1); color: var(--gold); font-weight: 800; font-size: 13px; }

.result .sub { margin-bottom: 4px; }
.big-stars { font-size: 56px; letter-spacing: 6px; margin: 6px 0; }
.big-stars i { font-style: normal; color: rgba(255, 255, 255, 0.15); display: inline-block; }
.big-stars i.on { color: var(--gold); text-shadow: 0 0 24px var(--gold); animation: starin .5s cubic-bezier(.2, .9, .3, 1.6) backwards; }
.score { font-size: 48px; font-weight: 900; text-shadow: 0 0 24px var(--c); }
.best { color: var(--muted); font-weight: 700; }
.stats { display: flex; gap: 8px; justify-content: center; margin: 14px 0 6px; flex-wrap: wrap; }
.stats div { flex: 1; min-width: 90px; padding: 10px; border-radius: 12px; background: rgba(255, 255, 255, 0.05); display: flex; flex-direction: column; gap: 2px; }
.stats small { color: var(--muted); font-size: 11px; font-weight: 700; } .stats b { font-size: 18px; }
.reward { color: var(--gold); font-weight: 900; font-size: 16px; margin-top: 8px; }

.pause-menu { display: flex; flex-direction: column; gap: 10px; align-items: stretch; }
.pause-menu .sub { margin-bottom: 6px; }
.menu-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 6px 0 8px; }
.tile { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 14px 6px; border-radius: 14px; background: rgba(255, 255, 255, 0.06); border: 1px solid var(--line); font-weight: 800; font-size: 13px; transition: transform .12s; }
.tile:hover { transform: translateY(-2px); border-color: var(--pink); }
.tile span { font-size: 26px; } .tile small { color: var(--muted); font-size: 11px; }

.daily { display: flex; align-items: center; gap: 12px; text-align: left; padding: 12px 14px; border-radius: 14px; background: linear-gradient(135deg, rgba(255, 211, 110, 0.16), rgba(255, 79, 163, 0.1)); border: 1px solid rgba(255, 211, 110, 0.5); margin-bottom: 4px; }
.daily span { font-size: 26px; } .daily b { display: block; font-size: 14px; } .daily small { color: var(--muted); font-size: 12.5px; }
.daily.done { opacity: .6; }

.phone-modal .modal-card { padding: 0; overflow: hidden; width: min(94vw, 400px); height: min(82dvh, 680px); display: flex; border-radius: 30px; border: 3px solid #2a1f4a; }
.phone { display: flex; flex-direction: column; width: 100%; text-align: left; }
.ph-head { display: flex; align-items: center; gap: 10px; padding: 18px 50px 14px 16px; border-bottom: 1px solid var(--line); background: rgba(0, 0, 0, 0.25); font-size: 16px; }
.back { font-size: 28px; line-height: 1; padding: 0 6px; }
.av { width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center; font-size: 20px; flex: none; background: color-mix(in srgb, var(--c) 25%, transparent); border: 1.5px solid var(--c); }
.ph-list { overflow-y: auto; flex: 1; }
.ph-row { display: flex; align-items: center; gap: 12px; width: 100%; padding: 13px 16px; text-align: left; border-bottom: 1px solid rgba(255, 255, 255, 0.05); }
.ph-row:hover { background: rgba(255, 255, 255, 0.04); }
.ph-mid { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.ph-mid small { color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dot { width: 10px; height: 10px; border-radius: 50%; background: var(--pink); box-shadow: 0 0 8px var(--pink); }
.empty { padding: 30px; color: var(--muted); text-align: center; }
.ph-thread { flex: 1; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 8px; touch-action: pan-y; }
.msg { max-width: 80%; padding: 10px 14px; border-radius: 18px 18px 18px 6px; background: #262050; font-size: 14.5px; line-height: 1.4; align-self: flex-start; animation: slideup .3s; }
.msg.me { align-self: flex-end; background: linear-gradient(135deg, var(--pink), #b04bff); border-radius: 18px 18px 6px 18px; }
.ph-replies { display: flex; flex-direction: column; gap: 6px; padding: 10px 12px 14px; border-top: 1px solid var(--line); }
.ph-replies:empty { display: none; }
.reply { padding: 11px 14px; border-radius: 14px; background: rgba(255, 79, 163, 0.12); border: 1px solid rgba(255, 79, 163, 0.5); font-weight: 700; font-size: 14px; text-align: left; }

.map-modal .modal-card { width: min(96vw, 720px); }
.map-wrap { position: relative; width: 100%; aspect-ratio: 1; margin-top: 10px; border-radius: 16px; overflow: hidden; background: #070520; }
#bigmap { width: 100%; height: 100%; display: block; image-rendering: pixelated; }
#map-pins { position: absolute; inset: 0; }
.pin { position: absolute; transform: translate(-50%, -50%); display: flex; flex-direction: column; align-items: center; padding: 4px 7px; border-radius: 10px; background: rgba(10, 6, 26, 0.85); border: 1.5px solid var(--c); box-shadow: 0 0 14px color-mix(in srgb, var(--c) 50%, transparent); transition: transform .12s; }
.pin:hover { transform: translate(-50%, -50%) scale(1.08); }
.pin span { font-size: 18px; } .pin b { font-size: 10.5px; white-space: nowrap; } .pin small { font-size: 9.5px; color: var(--gold); }
.pin.locked { opacity: .55; border-style: dashed; }

.shop { display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 8px; }
.item { display: flex; flex-direction: column; align-items: center; gap: 5px; padding: 12px 8px; border-radius: 14px; background: rgba(255, 255, 255, 0.05); border: 1.5px solid var(--line); transition: transform .12s; }
.item:hover { transform: translateY(-2px); }
.item i { width: 38px; height: 38px; border-radius: 50%; box-shadow: 0 0 16px rgba(255, 255, 255, 0.2); display: grid; place-items: center; font-style: normal; font-size: 24px; }
.item i.ico { box-shadow: none; }
.item b { font-size: 12.5px; } .item small { font-size: 11.5px; color: var(--gold); font-weight: 800; }
.item.own small { color: var(--muted); }
.item.sel { border-color: var(--pink); background: rgba(255, 79, 163, 0.12); } .item.sel small { color: var(--pink-2); }

.album { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.polaroid { padding: 8px 6px 10px; border-radius: 8px; background: rgba(255, 255, 255, 0.05); display: flex; flex-direction: column; align-items: center; gap: 4px; }
.polaroid span { font-size: 28px; width: 100%; aspect-ratio: 1; display: grid; place-items: center; background: rgba(0, 0, 0, 0.3); border-radius: 4px; }
.polaroid small { font-size: 10.5px; color: var(--muted); line-height: 1.2; }
.polaroid.got { background: #f4efff; cursor: pointer; } .polaroid.got small { color: #2a1f40; font-weight: 700; }
.polaroid.got span { background: #1d1633; }
.ach-list { display: flex; flex-direction: column; gap: 8px; margin-top: 12px; text-align: left; }
.ach { display: flex; gap: 12px; align-items: center; padding: 10px 12px; border-radius: 12px; background: rgba(255, 255, 255, 0.04); opacity: .55; }
.ach.got { opacity: 1; background: rgba(255, 211, 110, 0.08); border: 1px solid rgba(255, 211, 110, 0.3); }
.ach > span { font-size: 26px; width: 36px; text-align: center; }
.ach b { display: block; font-size: 14px; } .ach small { color: var(--muted); font-size: 12.5px; line-height: 1.4; }
.rel { display: flex; gap: 14px; align-items: center; padding: 10px; border-radius: 14px; background: rgba(255, 255, 255, 0.04); margin-top: 8px; text-align: left; }
.rel.unknown .portrait { filter: brightness(0) opacity(.5); }
.rel b { display: block; } .rel small { color: var(--muted); font-size: 12.5px; }
.hearts i { font-style: normal; color: rgba(255, 255, 255, 0.15); font-size: 16px; } .hearts i.on { color: var(--pink); text-shadow: 0 0 8px var(--pink); }
.set { display: flex; justify-content: space-between; align-items: center; gap: 14px; padding: 14px 4px; border-bottom: 1px solid var(--line); font-weight: 700; text-align: left; }
.set input[type=range] { width: 50%; accent-color: var(--pink); }
.set input[type=checkbox] { width: 22px; height: 22px; accent-color: var(--pink); }
.set select { background: #1c1238; color: var(--text); border: 1px solid var(--line); border-radius: 8px; padding: 6px 8px; font: inherit; }

.cine { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; z-index: 22; }
.shard-fx { background: radial-gradient(circle, rgba(255, 79, 163, 0.35), rgba(5, 2, 16, 0.75) 60%); animation: fade .3s; }
.shard-big { animation: shardin 1.2s cubic-bezier(.2, .9, .3, 1.3); filter: drop-shadow(0 0 40px #ff4fa3); }
.shard-big svg { animation: spin 5s linear infinite; }
.shard-fx h2 { font-size: 34px; font-weight: 900; margin-top: 14px; text-shadow: 0 0 20px var(--pink); }
.shard-fx p { color: var(--pink-2); font-weight: 700; }
.night-card { background: radial-gradient(circle at 50% 40%, #2a1050, #05020f 70%); animation: nightcard 3.6s forwards; }
.night-card .moon { width: 90px; height: 90px; border-radius: 50%; background: #ffe8f3; box-shadow: 0 0 60px #ff9fd1, inset -18px -8px 0 #e8c8e0; margin-bottom: 16px; animation: bob 3s ease-in-out infinite; }
.kicker { text-transform: uppercase; letter-spacing: 6px; color: var(--muted); font-weight: 800; font-size: 13px; }
.night-card h1 { font-size: 110px; font-weight: 900; line-height: 1; text-shadow: 0 0 40px var(--pink), 0 0 80px #b04bff; }
.night-card h2 { font-size: 26px; font-weight: 800; margin-top: 4px; }
.nc-open { display: flex; gap: 8px; margin-top: 18px; flex-wrap: wrap; justify-content: center; }
.nc-open span { padding: 7px 12px; border-radius: 10px; border: 1px solid var(--c); color: #fff; font-weight: 700; font-size: 14px; box-shadow: 0 0 16px color-mix(in srgb, var(--c) 40%, transparent); }
.ending-modal .modal-card { border-color: var(--c); }
.ending .end-emoji { font-size: 76px; filter: drop-shadow(0 0 30px var(--c)); animation: bob 3s ease-in-out infinite; }
.ending h2 { font-size: 34px; color: #fff; text-shadow: 0 0 24px var(--c); }
.end-text { font-size: 16px; line-height: 1.6; margin: 10px 0; font-weight: 600; color: #efe8ff; }
.end-gallery { display: flex; gap: 6px; justify-content: center; margin: 12px 0; }
.end-gallery span { width: 38px; height: 38px; border-radius: 10px; display: grid; place-items: center; font-size: 20px; background: rgba(255, 255, 255, 0.06); color: var(--muted); font-weight: 900; }
.end-gallery span.on { background: rgba(255, 79, 163, 0.18); border: 1px solid var(--pink); }

.cine.title { background: transparent; gap: 12px; padding: 20px; }
.logo { display: flex; flex-direction: column; align-items: center; line-height: .9; animation: flicker 5s infinite; }
.logo .l1 { font-size: clamp(38px, 9vw, 70px); font-weight: 300; letter-spacing: 16px; color: #cfe9ff; text-shadow: 0 0 10px #4fd8ff, 0 0 30px #4fd8ff, 0 0 60px #4fd8ff; margin-right: -16px; }
.logo .l2 { font-size: clamp(64px, 17vw, 136px); font-weight: 900; font-style: italic; color: #ffe2f1; text-shadow: 0 0 10px #ff4fa3, 0 0 30px #ff4fa3, 0 0 70px #ff4fa3, 0 0 120px #b04bff; }
.tagline { color: #ffd1e8; font-size: clamp(15px, 3.6vw, 19px); font-weight: 600; letter-spacing: .5px; margin-bottom: 20px; text-shadow: 0 0 12px rgba(255, 79, 163, 0.6); }
.title-btns { display: flex; flex-direction: column; gap: 10px; width: min(80vw, 300px); animation: slideup .6s .3s backwards; }
.title-foot { position: absolute; bottom: calc(16px + var(--sa-b)); color: var(--muted); font-size: 12px; font-weight: 600; line-height: 1.9; }
.title-foot a { color: #cfc4ee; text-decoration: none; pointer-events: auto; }
.title-foot a:hover { color: #fff; text-decoration: underline; }
#cine-text { position: absolute; left: 0; right: 0; bottom: 22%; display: flex; flex-direction: column; align-items: center; gap: 10px; z-index: 23; pointer-events: none; }
#cine-text p { font-size: clamp(17px, 4.2vw, 22px); font-weight: 700; color: #ffe2f1; text-shadow: 0 0 16px rgba(255, 79, 163, 0.8); animation: fadeup .9s backwards; padding: 0 20px; text-align: center; }
.gender .row .btn { min-width: 160px; }

@keyframes pulse { 50% { transform: scale(1.15); opacity: .8; } }
@keyframes rise { from { opacity: 1; transform: translateY(0); } to { opacity: 0; transform: translateY(-26px); } }
@keyframes gflash { 30% { filter: brightness(1.8); transform: scale(1.04); } }
@keyframes objpop { 0% { transform: translateX(-50%) scale(.8); opacity: 0; } 100% { transform: translateX(-50%) scale(1); opacity: 1; } }
@keyframes banner { 0% { opacity: 0; transform: translate(-50%, -30%) scale(.9); } 15%, 70% { opacity: 1; transform: translate(-50%, -50%) scale(1); } 100% { opacity: 0; transform: translate(-50%, -60%) scale(1.03); } }
@keyframes slideup { from { opacity: 0; transform: translate(var(--tx, -50%), 30px); } }
.choice, .msg, .title-btns { --tx: 0; }
@keyframes toastin { from { opacity: 0; transform: translateY(-20px) scale(.95); } }
@keyframes toastout { to { opacity: 0; transform: translateY(-20px) scale(.95); } }
@keyframes fade { from { opacity: 0; } }
@keyframes pop { from { opacity: 0; transform: scale(.9) translateY(20px); } }
@keyframes bob { 50% { transform: translateY(-5px); } }
@keyframes starin { from { transform: scale(0) rotate(-90deg); opacity: 0; } }
@keyframes shardin { from { transform: scale(0) rotate(-180deg); opacity: 0; } }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes nightcard { 0% { opacity: 0; } 12%, 85% { opacity: 1; } 100% { opacity: 0; } }
@keyframes fadeup { from { opacity: 0; transform: translateY(14px); } }
@keyframes flicker { 0%, 100% { opacity: 1; } 92% { opacity: 1; } 93% { opacity: .6; } 94% { opacity: 1; } 96% { opacity: .75; } 97% { opacity: 1; } }

@media (max-width: 520px) {
  .objective { top: calc(122px + var(--sa-t)); font-size: 13px; }
  .shards { top: calc(166px + var(--sa-t)); }
  #minimap { width: 92px; height: 92px; bottom: calc(106px + var(--sa-b)); }
  .album { grid-template-columns: repeat(3, 1fr); }
  .menu-grid { grid-template-columns: repeat(2, 1fr); }
  .portal-card { bottom: calc(110px + var(--sa-b)); }
}
@media (min-width: 900px) {
  #toasts { top: auto; bottom: calc(24px + var(--sa-b)); left: calc(16px + var(--sa-l)); transform: none; }
  .objective { top: calc(16px + var(--sa-t)); }
  .shards { top: calc(60px + var(--sa-t)); }
}
@media (max-height: 520px) {
  .drive-hint { bottom: calc(20px + var(--sa-b)); }
  .objective { top: calc(12px + var(--sa-t)); max-width: 44vw; }
  .shards { top: calc(58px + var(--sa-t)); }
}

@media (max-width: 360px) {
  .gauge .bar { width: 54px; }
  .counters { flex-wrap: nowrap; gap: 4px; }
  .counter { padding: 5px 7px; font-size: 12px; }
  .icon-btn { width: 38px; height: 38px; font-size: 18px; }
  .hud-btns { gap: 4px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; }
}
