/* ZEDLINE — interface (mobile paysage d'abord) */
@font-face { font-family: 'Unbounded'; src: url(../assets/fonts/unbounded-latin-500-normal.woff2) format('woff2'); font-weight: 500; font-display: swap; }
@font-face { font-family: 'Unbounded'; src: url(../assets/fonts/unbounded-latin-700-normal.woff2) format('woff2'); font-weight: 700; font-display: swap; }
@font-face { font-family: 'Unbounded'; src: url(../assets/fonts/unbounded-latin-900-normal.woff2) format('woff2'); font-weight: 900; font-display: swap; }
@font-face { font-family: 'Space Grotesk'; src: url(../assets/fonts/space-grotesk-latin-400-normal.woff2) format('woff2'); font-weight: 400; font-display: swap; }
@font-face { font-family: 'Space Grotesk'; src: url(../assets/fonts/space-grotesk-latin-500-normal.woff2) format('woff2'); font-weight: 500; font-display: swap; }
@font-face { font-family: 'Space Grotesk'; src: url(../assets/fonts/space-grotesk-latin-700-normal.woff2) format('woff2'); font-weight: 700; font-display: swap; }

:root {
  --cyan: #19F0FF; --magenta: #FF2BD6; --yellow: #FFE14D; --night: #0B0820; --abyss: #1A1140;
  --white: #F3F1FF; --red: #FF2E4D; --mint: #52FF9A;
  --muted: rgba(243, 241, 255, 0.62); --line: rgba(243, 241, 255, 0.12);
  --glass: rgba(18, 11, 44, 0.72); --glass-2: rgba(30, 20, 70, 0.55);
  --grad: linear-gradient(90deg, var(--cyan), var(--magenta));
  --display: 'Unbounded', system-ui, sans-serif; --body: 'Space Grotesk', system-ui, sans-serif;
  color-scheme: dark;
  --sl: env(safe-area-inset-left, 0px); --sr: env(safe-area-inset-right, 0px);
  --st: env(safe-area-inset-top, 0px); --sb: env(safe-area-inset-bottom, 0px);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; background: var(--night); color: var(--white); font-family: var(--body); overflow: hidden; overscroll-behavior: none; }
body { user-select: none; -webkit-user-select: none; touch-action: none; -webkit-touch-callout: none; }
button { font: inherit; color: inherit; }
#gl { position: fixed; inset: 0; width: 100%; height: 100%; display: block; }
.hidden { display: none !important; }

/* ---------- écrans ---------- */
#ui { position: fixed; inset: 0; pointer-events: none; z-index: 10; }
#ui > .screen { pointer-events: auto; }
.screen {
  position: absolute; inset: 0; display: flex; flex-direction: column;
  padding: calc(14px + var(--st)) calc(18px + var(--sr)) calc(14px + var(--sb)) calc(18px + var(--sl));
  animation: screenIn .35s cubic-bezier(.2, .8, .2, 1);
  overflow-y: auto; touch-action: pan-y;
}
.screen.dim { background: radial-gradient(ellipse at 50% 40%, rgba(26, 17, 64, .55), rgba(11, 8, 32, .88)); }
@keyframes screenIn { from { opacity: 0; transform: translateY(10px) scale(.99); } to { opacity: 1; transform: none; } }
.topbar { display: flex; align-items: center; gap: 12px; min-height: 48px; }
.topbar h2 { margin: 0; font-family: var(--display); font-weight: 900; font-size: clamp(18px, 3.2vw, 28px); letter-spacing: .04em; }
.topbar .spacer { flex: 1; }
.eyebrow { font-family: var(--display); font-size: 11px; letter-spacing: .28em; color: var(--cyan); text-transform: uppercase; }
.muted { color: var(--muted); }

/* ---------- boutons ---------- */
.btn {
  position: relative; display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  min-height: 52px; padding: 0 22px; border-radius: 16px; border: 1px solid var(--line);
  background: var(--glass); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  font-family: var(--display); font-weight: 700; font-size: 15px; letter-spacing: .06em; text-transform: uppercase;
  cursor: pointer; transition: transform .12s, box-shadow .2s, border-color .2s, background .2s;
}
.btn:hover { border-color: rgba(25, 240, 255, .5); box-shadow: 0 0 24px rgba(25, 240, 255, .18); }
.btn:active { transform: scale(.97); }
.btn:focus-visible { outline: 2px solid var(--cyan); outline-offset: 3px; }
.btn.primary { background: linear-gradient(var(--abyss), var(--abyss)) padding-box, var(--grad) border-box; border: 2px solid transparent; box-shadow: 0 0 28px rgba(255, 43, 214, .25), inset 0 0 22px rgba(25, 240, 255, .12); }
.btn.primary:hover { box-shadow: 0 0 36px rgba(255, 43, 214, .4), inset 0 0 26px rgba(25, 240, 255, .2); }
.btn.solid { background: var(--grad); color: var(--night); border: 0; }
.btn.ghost { background: transparent; }
.btn.small { min-height: 40px; padding: 0 14px; font-size: 12px; border-radius: 12px; }
.btn.icon { width: 48px; padding: 0; border-radius: 14px; }
.btn.big { min-height: 64px; font-size: 18px; padding: 0 30px; }
.btn .sub { display: block; font-family: var(--body); font-weight: 500; font-size: 11px; letter-spacing: .02em; text-transform: none; color: var(--muted); }
.btn.col { flex-direction: column; gap: 2px; align-items: flex-start; text-align: left; }
.btn[disabled] { opacity: .45; pointer-events: none; }
.ico { width: 20px; height: 20px; flex: none; }

/* ---------- menu principal ---------- */
.screen.menu { background: linear-gradient(90deg, rgba(11, 8, 32, .78), rgba(11, 8, 32, .25) 55%, rgba(11, 8, 32, .55)); }
.menu-wrap { flex: 1; display: grid; grid-template-columns: 1.1fr 1fr; align-items: center; gap: 24px; max-width: 1100px; width: 100%; margin: 0 auto; }
.brand-block { display: flex; flex-direction: column; gap: 14px; }
.brand-block img { width: min(100%, 520px); filter: drop-shadow(0 0 30px rgba(25, 240, 255, .25)); }
.tagline { font-family: var(--display); font-weight: 500; font-size: clamp(9px, 1.4vw, 14px); letter-spacing: .26em; color: var(--muted); white-space: nowrap; }
.menu-buttons { display: grid; gap: 10px; }
.menu-buttons .row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.menu-buttons .btn { width: 100%; justify-content: flex-start; }
.profile-chip { display: inline-flex; align-items: center; gap: 10px; padding: 6px 14px 6px 6px; border-radius: 999px; background: var(--glass); border: 1px solid var(--line); cursor: pointer; font-weight: 700; }
.profile-chip .cube { width: 28px; height: 28px; border-radius: 8px; box-shadow: 0 0 14px currentColor; }
.online-dot { width: 8px; height: 8px; border-radius: 50%; background: #666; display: inline-block; }
.online-dot.on { background: var(--mint); box-shadow: 0 0 10px var(--mint); }
.footer-line { display: flex; gap: 14px; justify-content: space-between; align-items: center; font-size: 12px; color: var(--muted); }

@media (max-aspect-ratio: 1/1) {
  .menu-wrap { grid-template-columns: 1fr; align-content: center; }
  .brand-block { align-items: center; text-align: center; }
}

/* ---------- sélection de niveau ---------- */
.levels { flex: 1; display: flex; gap: 14px; overflow-x: auto; scroll-snap-type: x mandatory; padding: 10px 4px 14px; align-items: stretch; touch-action: pan-x; scrollbar-width: none; }
.levels::-webkit-scrollbar { display: none; }
.lvl {
  position: relative; flex: 0 0 min(300px, 70vw); scroll-snap-align: center; border-radius: 22px; padding: 18px; overflow: hidden;
  background: linear-gradient(160deg, var(--c1), var(--c2) 70%); border: 1px solid rgba(255, 255, 255, .12);
  display: flex; flex-direction: column; gap: 8px; cursor: pointer; transition: transform .2s, box-shadow .2s; min-height: 220px; max-height: 440px;
}
.lvl .art { position: absolute; left: 0; right: 0; bottom: 0; width: 100%; height: 62%; opacity: .7; pointer-events: none; }
.lvl h3, .lvl .world { text-shadow: 0 1px 10px rgba(0, 0, 0, .85), 0 0 2px rgba(0, 0, 0, .9); }
.lvl::before { content: ''; position: absolute; inset: 0; background: repeating-linear-gradient(0deg, transparent 0 22px, rgba(255, 255, 255, .05) 22px 23px), linear-gradient(transparent 55%, rgba(0, 0, 0, .55)); pointer-events: none; }
.lvl > * { position: relative; }
.lvl:hover, .lvl.sel { transform: translateY(-4px); box-shadow: 0 10px 40px rgba(0, 0, 0, .5), 0 0 0 2px var(--c3); }
.lvl .num { font-family: var(--display); font-weight: 900; font-size: 54px; line-height: .9; color: transparent; -webkit-text-stroke: 1.5px var(--c3); opacity: .9; }
.lvl h3 { margin: 0; font-family: var(--display); font-weight: 900; font-size: 22px; letter-spacing: .03em; }
.lvl .world { font-size: 13px; color: rgba(255, 255, 255, .8); }
.lvl .meta { display: flex; flex-wrap: wrap; gap: 6px; margin-top: auto; }
.tag { font-size: 11px; font-weight: 700; padding: 4px 9px; border-radius: 999px; background: rgba(0, 0, 0, .35); border: 1px solid rgba(255, 255, 255, .14); letter-spacing: .04em; }
.stars { color: var(--yellow); letter-spacing: 2px; font-size: 14px; }
.bar { height: 6px; border-radius: 6px; background: rgba(0, 0, 0, .4); overflow: hidden; }
.bar > i { display: block; height: 100%; background: var(--grad); box-shadow: 0 0 10px var(--cyan); }
.coins { display: inline-flex; gap: 4px; }
.coin { width: 14px; height: 14px; border-radius: 50%; border: 2px solid rgba(255, 225, 77, .5); }
.coin.on { background: var(--yellow); box-shadow: 0 0 8px var(--yellow); border-color: var(--yellow); }
.level-actions { display: flex; gap: 10px; align-items: center; justify-content: center; flex-wrap: wrap; }

/* ---------- contrôles segmentés / formulaires ---------- */
.seg { display: inline-flex; padding: 4px; border-radius: 14px; background: var(--glass); border: 1px solid var(--line); gap: 4px; flex-wrap: wrap; }
.seg button { border: 0; background: transparent; padding: 9px 14px; border-radius: 10px; font-family: var(--display); font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; cursor: pointer; color: var(--muted); }
.seg button.on { background: var(--grad); color: var(--night); }
.panel { background: var(--glass); border: 1px solid var(--line); border-radius: 20px; padding: 18px; backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-size: 12px; color: var(--muted); letter-spacing: .06em; text-transform: uppercase; font-weight: 700; }
input[type=text] { width: 100%; height: 50px; border-radius: 14px; border: 1px solid var(--line); background: rgba(0, 0, 0, .3); color: var(--white); padding: 0 14px; font: 600 18px var(--body); outline: none; user-select: text; -webkit-user-select: text; }
input[type=text]:focus { border-color: var(--cyan); box-shadow: 0 0 0 3px rgba(25, 240, 255, .15); }
input.code { font-family: var(--display); font-size: 26px; letter-spacing: .4em; text-transform: uppercase; text-align: center; }
input[type=range] { width: 100%; accent-color: var(--cyan); }
.skins { display: flex; gap: 10px; flex-wrap: wrap; }
.skin { width: 46px; height: 46px; border-radius: 12px; border: 2px solid transparent; cursor: pointer; box-shadow: inset 0 0 0 3px rgba(0, 0, 0, .35); }
.skin.on { border-color: var(--white); box-shadow: 0 0 18px currentColor, inset 0 0 0 3px rgba(0, 0, 0, .35); }
.row-between { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
@media (max-aspect-ratio: 1/1) { .grid2 { grid-template-columns: 1fr; } }

/* ---------- salon / versus ---------- */
.room-code { font-family: var(--display); font-weight: 900; font-size: clamp(34px, 7vw, 56px); letter-spacing: .3em; background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; text-align: center; }
.vs-slots { display: grid; grid-template-columns: 1fr auto 1fr; gap: 14px; align-items: center; }
.slot { padding: 16px; border-radius: 18px; background: var(--glass-2); border: 1px solid var(--line); text-align: center; min-height: 92px; display: flex; flex-direction: column; justify-content: center; gap: 6px; }
.slot .name { font-family: var(--display); font-weight: 700; font-size: 16px; }
.slot.ready { border-color: var(--mint); box-shadow: 0 0 20px rgba(82, 255, 154, .25); }
.vs { font-family: var(--display); font-weight: 900; font-size: 26px; color: var(--magenta); text-shadow: 0 0 16px var(--magenta); }
.list { display: flex; flex-direction: column; gap: 8px; }
.list .item { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 14px; background: var(--glass-2); border: 1px solid var(--line); }

/* ---------- classement ---------- */
table.lb { width: 100%; border-collapse: collapse; font-size: 14px; }
table.lb th { text-align: left; font-size: 11px; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); padding: 8px 10px; border-bottom: 1px solid var(--line); }
table.lb td { padding: 10px; border-bottom: 1px solid rgba(255, 255, 255, .05); }
table.lb tr.me td { background: rgba(25, 240, 255, .08); }
table.lb .rank { font-family: var(--display); font-weight: 900; width: 46px; }
table.lb tr:nth-child(1) .rank { color: var(--yellow); }
table.lb tr:nth-child(2) .rank { color: #cfd6ff; }
table.lb tr:nth-child(3) .rank { color: #ff9f6b; }

/* ---------- résultats ---------- */
.result-title { font-family: var(--display); font-weight: 900; font-size: clamp(30px, 6vw, 56px); text-align: center; letter-spacing: .04em; margin: 4px 0; }
.result-title.win { background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; filter: drop-shadow(0 0 20px rgba(255, 43, 214, .4)); }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: 10px; }
.stat { padding: 12px; border-radius: 16px; background: var(--glass-2); border: 1px solid var(--line); text-align: center; }
.stat b { display: block; font-family: var(--display); font-size: 22px; }
.stat span { font-size: 11px; color: var(--muted); letter-spacing: .08em; text-transform: uppercase; }
.center-col { margin: auto; width: min(640px, 100%); display: flex; flex-direction: column; gap: 14px; }

/* ---------- HUD ---------- */
#hud { position: fixed; inset: 0; pointer-events: none; z-index: 5; font-family: var(--display); }
#hud .prog { position: absolute; top: calc(10px + var(--st)); left: 50%; transform: translateX(-50%); width: min(46vw, 520px); height: 8px; border-radius: 8px; background: rgba(0, 0, 0, .45); border: 1px solid rgba(255, 255, 255, .12); }
#hud .prog > i { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 8px; background: var(--grad); box-shadow: 0 0 12px var(--cyan); }
#hud .prog .mk { position: absolute; top: -5px; width: 4px; height: 16px; border-radius: 3px; transform: translateX(-2px); }
#hud .prog .mk.me { background: var(--cyan); box-shadow: 0 0 10px var(--cyan); }
#hud .prog .mk.op { background: var(--magenta); box-shadow: 0 0 10px var(--magenta); }
#hud .pct { position: absolute; top: calc(22px + var(--st)); left: 50%; transform: translateX(-50%); font-size: 13px; font-weight: 700; letter-spacing: .1em; text-shadow: 0 0 10px rgba(0, 0, 0, .8); }
#hud .att { position: absolute; top: calc(10px + var(--st)); left: calc(16px + var(--sl)); font-size: 13px; font-weight: 700; letter-spacing: .08em; opacity: .9; }
#hud .att small { display: block; font-family: var(--body); font-weight: 500; font-size: 11px; color: var(--muted); letter-spacing: .04em; }
#hud .pause { position: absolute; top: calc(8px + var(--st)); right: calc(12px + var(--sr)); pointer-events: auto; }
#hud .center { position: absolute; left: 0; right: 0; top: 34%; text-align: center; font-weight: 900; font-size: clamp(48px, 12vw, 120px); letter-spacing: .04em; text-shadow: 0 0 40px rgba(25, 240, 255, .6); animation: pop .5s cubic-bezier(.2, 1.6, .4, 1); }
#hud .banner { position: absolute; left: 0; right: 0; top: 22%; text-align: center; font-weight: 900; font-size: clamp(20px, 4.5vw, 44px); letter-spacing: .3em; animation: banner 1.6s ease forwards; }
#hud .banner small { display: block; font-family: var(--body); font-size: 13px; letter-spacing: .2em; font-weight: 700; color: var(--muted); }
@keyframes pop { from { transform: scale(1.8); opacity: 0; } to { transform: scale(1); opacity: 1; } }
@keyframes banner { 0% { opacity: 0; letter-spacing: 1em; } 15% { opacity: 1; letter-spacing: .3em; } 80% { opacity: 1; } 100% { opacity: 0; } }
#hud .pops { position: absolute; left: 0; right: 0; top: 64%; text-align: center; }
#hud .pop { display: inline-block; font-size: 15px; font-weight: 900; letter-spacing: .12em; color: var(--yellow); text-shadow: 0 0 12px rgba(255, 225, 77, .7); animation: floatUp .7s ease forwards; }
@keyframes floatUp { from { transform: translateY(8px); opacity: 0; } 25% { opacity: 1; } to { transform: translateY(-20px); opacity: 0; } }
#hud .attack { position: absolute; left: calc(16px + var(--sl)); bottom: calc(16px + var(--sb)); pointer-events: auto; display: flex; align-items: center; gap: 10px; }
#hud .attack .btn { min-height: 64px; min-width: 64px; border-radius: 20px; }
#hud .attack .btn.ready { animation: pulse 0.8s infinite alternate; border-color: var(--yellow); box-shadow: 0 0 26px rgba(255, 225, 77, .6); }
@keyframes pulse { to { transform: scale(1.06); } }
.pips { display: flex; gap: 5px; }
.pips i { width: 12px; height: 12px; border-radius: 3px; border: 2px solid rgba(255, 225, 77, .6); transform: rotate(45deg); }
.pips i.on { background: var(--yellow); box-shadow: 0 0 10px var(--yellow); }
#hud .opp { position: absolute; top: calc(36px + var(--st)); right: calc(16px + var(--sr)); font-size: 12px; font-weight: 700; color: var(--magenta); text-align: right; letter-spacing: .06em; }
#hud .hint { position: absolute; bottom: calc(18px + var(--sb)); left: 0; right: 0; text-align: center; font-family: var(--body); font-size: 13px; font-weight: 700; color: var(--muted); letter-spacing: .08em; animation: fadeHint 4s forwards; }
@keyframes fadeHint { 0%, 70% { opacity: 1; } 100% { opacity: 0; } }
#hud .alert { position: absolute; top: 40%; left: 0; right: 0; text-align: center; font-size: clamp(18px, 4vw, 34px); font-weight: 900; color: var(--red); text-shadow: 0 0 20px var(--red); letter-spacing: .2em; animation: banner 1.4s forwards; }

#fx-flash { position: fixed; inset: 0; background: white; opacity: 0; pointer-events: none; z-index: 4; mix-blend-mode: screen; }
#toast { position: fixed; left: 50%; bottom: calc(18px + var(--sb)); transform: translateX(-50%) translateY(30px); opacity: 0; z-index: 50; padding: 12px 18px; border-radius: 14px; background: var(--glass); border: 1px solid var(--line); backdrop-filter: blur(10px); font-weight: 700; font-size: 14px; transition: all .3s; pointer-events: none; max-width: 90vw; text-align: center; }
#toast.on { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ---------- splash ---------- */
.splash { align-items: center; justify-content: center; gap: 22px; text-align: center; cursor: pointer; }
.splash img { width: min(78vw, 620px); filter: drop-shadow(0 0 40px rgba(25, 240, 255, .35)); animation: breathe 3s ease-in-out infinite; }
@keyframes breathe { 50% { filter: drop-shadow(0 0 60px rgba(255, 43, 214, .45)); transform: scale(1.015); } }
.tap { font-family: var(--display); font-weight: 700; font-size: 14px; letter-spacing: .4em; animation: blink 1.4s infinite; }
@keyframes blink { 50% { opacity: .35; } }
.loader { width: min(60vw, 320px); height: 4px; border-radius: 4px; background: rgba(255, 255, 255, .1); overflow: hidden; }
.loader > i { display: block; height: 100%; width: 0; background: var(--grad); transition: width .2s; }

/* ---------- rotation ---------- */
#rotate { position: fixed; inset: 0; z-index: 100; background: var(--night); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 18px; text-align: center; padding: 24px; font-weight: 700; }
.rotate-phone { width: 54px; height: 92px; border: 3px solid var(--cyan); border-radius: 12px; box-shadow: 0 0 20px rgba(25, 240, 255, .4); animation: rot 2s ease-in-out infinite; }
@keyframes rot { 0%, 30% { transform: rotate(0); } 60%, 100% { transform: rotate(-90deg); } }

.kbd { display: inline-block; padding: 2px 7px; border-radius: 6px; border: 1px solid var(--line); background: rgba(0, 0, 0, .3); font-family: var(--body); font-weight: 700; font-size: 12px; }
.howto { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; }
.howto .panel h4 { margin: 0 0 6px; font-family: var(--display); font-size: 13px; letter-spacing: .08em; color: var(--cyan); }
.howto .panel p { margin: 0; font-size: 14px; color: var(--muted); line-height: 1.45; }
