:root {
  --accent: #ff3df0;
  --accent2: #27e8ff;
  --good: #4dffb5;
  --bad: #ff4d7a;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body {
  height: 100%; overflow: hidden; background: #02010a;
  font-family: Rajdhani, "Segoe UI", system-ui, sans-serif; color: #fff;
  user-select: none; -webkit-user-select: none;
}
body { display: flex; align-items: center; justify-content: center; }

#stage {
  position: relative; width: 960px; height: 720px; font-size: 16px;
  overflow: hidden; background: #000;
  box-shadow: 0 0 60px rgba(120, 60, 255, .25), 0 0 0 1px rgba(255, 255, 255, .06);
}
#game { display: block; width: 100%; height: 100%; touch-action: none; }
#stage.playing #game { cursor: none; }

#btn-pause {
  position: absolute; top: .85em; right: .25em; width: 1.6em; height: 1.9em;
  display: none; align-items: center; justify-content: center;
  font-size: .9em; color: #fff; background: rgba(255, 255, 255, .08);
  border: 1px solid rgba(255, 255, 255, .25); border-radius: .35em; cursor: pointer;
}
#btn-pause.on { display: flex; }
#btn-pause:hover { background: rgba(255, 255, 255, .2); }

/* ---------- Écrans ---------- */
.screen {
  position: absolute; inset: 0; display: none;
  flex-direction: column; align-items: center; justify-content: center; gap: 1.1em;
  padding: 2em; text-align: center;
}
.screen.on { display: flex; animation: pop .28s ease-out; }
.screen.dim { background: rgba(3, 2, 12, .72); backdrop-filter: blur(4px); }
.screen.wide { background: rgba(3, 2, 12, .86); justify-content: flex-start; padding: 1.1em 2em 1.2em; gap: .7em; }
.screen.wide h2 { font-size: 2em; }
.screen.wide > .btn { padding: .6em 1em; }
@keyframes pop { from { opacity: 0; transform: scale(.97); } to { opacity: 1; transform: none; } }

.logo {
  font-family: Orbitron, sans-serif; font-weight: 900; line-height: .95;
  font-size: 5.6em; letter-spacing: .04em; display: flex; flex-direction: column;
  filter: drop-shadow(0 0 .25em rgba(255, 61, 240, .7));
}
.logo span {
  background: linear-gradient(180deg, #fff 10%, #ffe45c 38%, #ff3df0 62%, #5b2bff 100%);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.logo span:last-child {
  font-size: .62em; letter-spacing: .34em; margin-left: .34em;
  background: linear-gradient(180deg, #fff 10%, #27e8ff 60%, #2b6bff 100%);
  -webkit-background-clip: text; background-clip: text;
}
.sub { font-size: 1.15em; font-weight: 600; letter-spacing: .12em; color: rgba(255, 255, 255, .8); text-transform: uppercase; }
.help { font-size: .9em; color: rgba(255, 255, 255, .55); letter-spacing: .04em; }
.best { font-family: Orbitron, sans-serif; font-size: .95em; color: #ffd66b; min-height: 1.2em; }
.big { font-family: Orbitron, sans-serif; font-weight: 900; font-size: 3.6em; text-shadow: 0 0 .4em var(--accent2); }

h2 {
  font-family: Orbitron, sans-serif; font-weight: 900; font-size: 2.6em; letter-spacing: .12em;
  text-transform: uppercase; text-shadow: 0 0 .5em var(--accent);
}
h2.bad { text-shadow: 0 0 .5em var(--bad); }
h2.good { text-shadow: 0 0 .5em var(--good); }

.btns { display: flex; flex-direction: column; gap: .65em; align-items: center; }
.btn {
  font-family: Orbitron, sans-serif; font-weight: 700; font-size: 1.05em; letter-spacing: .14em; text-transform: uppercase;
  width: 21em; padding: .8em 1em; color: #fff; cursor: pointer;
  background: rgba(10, 8, 30, .7); border: .12em solid var(--accent2); border-radius: .5em;
  box-shadow: 0 0 .9em rgba(39, 232, 255, .25), inset 0 0 .9em rgba(39, 232, 255, .12);
  transition: transform .12s, box-shadow .12s, background .12s;
}
.btn:hover { transform: translateY(-.1em) scale(1.02); background: rgba(39, 232, 255, .16); box-shadow: 0 0 1.6em rgba(39, 232, 255, .55), inset 0 0 1em rgba(39, 232, 255, .25); }
.btn:active { transform: scale(.98); }
.btn.primary { border-color: var(--accent); background: linear-gradient(90deg, rgba(255, 61, 240, .35), rgba(91, 43, 255, .35)); box-shadow: 0 0 1.2em rgba(255, 61, 240, .45), inset 0 0 1em rgba(255, 61, 240, .2); }
.btn.primary:hover { box-shadow: 0 0 2em rgba(255, 61, 240, .8), inset 0 0 1.2em rgba(255, 61, 240, .35); }

.opts { display: flex; flex-wrap: wrap; justify-content: center; gap: .5em; max-width: 46em; }
.chip {
  font-family: Rajdhani, sans-serif; font-weight: 700; font-size: .95em; letter-spacing: .08em; text-transform: uppercase;
  padding: .4em 1em; color: rgba(255, 255, 255, .85); background: rgba(255, 255, 255, .07);
  border: 1px solid rgba(255, 255, 255, .25); border-radius: 2em; cursor: pointer;
}
.chip:hover { background: rgba(255, 255, 255, .18); }

/* ---------- Sélection des tableaux ---------- */
#worlds { display: grid; grid-template-columns: repeat(3, 1fr); gap: .9em; width: 100%; max-width: 54em; }
.world {
  padding: .9em 1em 1em; border-radius: .7em; text-align: left;
  background: linear-gradient(160deg, color-mix(in srgb, var(--c) 22%, #05040f), #05040f 70%);
  border: 1px solid color-mix(in srgb, var(--c) 60%, transparent);
  box-shadow: 0 0 1.2em color-mix(in srgb, var(--c) 22%, transparent);
}
.world h3 { font-family: Orbitron, sans-serif; font-size: 1.1em; letter-spacing: .06em; color: var(--c2); }
.world p { font-size: .88em; color: rgba(255, 255, 255, .6); margin: .15em 0 .7em; }
.lvls { display: flex; gap: .4em; }
.lvls button {
  flex: 1; height: 2.5em; font-family: Orbitron, sans-serif; font-weight: 800; font-size: 1em; color: #fff; cursor: pointer;
  background: color-mix(in srgb, var(--c) 28%, transparent); border: 1px solid var(--c); border-radius: .4em;
  transition: transform .1s, background .1s;
}
.lvls button:hover:not(:disabled) { transform: translateY(-.12em); background: color-mix(in srgb, var(--c) 60%, transparent); }
.lvls button.boss { border-color: #ff4d7a; color: #ffd0da; }
.lvls button:disabled { opacity: .28; cursor: not-allowed; border-style: dashed; }

/* ---------- Codex ---------- */
.codex { font-size: .9em; width: 100%; max-width: 62em; text-align: left; overflow: auto; flex: 1; min-height: 0; padding-right: .3em; }
.codex h4 { font-family: Orbitron, sans-serif; font-size: .95em; letter-spacing: .14em; text-transform: uppercase; margin: .2em 0 .45em; }
.codex h4 small { font-family: Rajdhani, sans-serif; letter-spacing: .02em; text-transform: none; opacity: .7; }
.codex h4.good { color: var(--good); } .codex h4.bad { color: var(--bad); }
.pwlist { display: grid; grid-template-columns: repeat(3, 1fr); gap: .3em; margin-bottom: .6em; }
.pwlist.four { grid-template-columns: repeat(4, 1fr); }
.pw { display: flex; align-items: center; gap: .6em; padding: .22em .55em; border-radius: .4em; background: rgba(255, 255, 255, .05); border-left: .2em solid var(--good); }
.pw.bad { border-left-color: var(--bad); }
.pw.brick { border-left-color: rgba(255, 255, 255, .3); }
.pw .ic { font-size: 1.25em; width: 1.5em; text-align: center; flex: none; font-family: "Segoe UI Emoji", "Apple Color Emoji", "Noto Color Emoji", sans-serif; }
.pw canvas.ic { width: 2.6em; height: auto; }
.pw b { font-size: .95em; letter-spacing: .04em; display: block; line-height: 1.1; }
.pw small { font-size: .82em; color: rgba(255, 255, 255, .62); line-height: 1.1; display: block; }
.codex::-webkit-scrollbar { width: .4em; }
.codex::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, .25); border-radius: 1em; }
