/* Simon Arcade — esthétique néon synthwave reprise du jeu */
:root {
  --bg: #0a041e;
  --bg-2: #1a0838;
  --panel: rgba(20, 8, 48, 0.78);
  --line: rgba(255, 40, 200, 0.35);
  --text: #eae6ff;
  --muted: #a69cc9;
  --red: #ff2659;
  --cyan: #00d9ff;
  --yellow: #ffe626;
  --green: #26ff80;
  --pink: #ff1ea0;
  --gold: #ffd933;
  --pixel: 'Press Start 2P', monospace;
  --ui: 'Rajdhani', 'Segoe UI', sans-serif;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  min-height: 100vh;
  background: linear-gradient(180deg, var(--bg) 0%, var(--bg-2) 65%, #2d0846 100%) fixed;
  color: var(--text);
  font-family: var(--ui);
  font-size: 18px;
  line-height: 1.6;
  overflow-x: hidden;
}

/* Grille rétro en perspective */
body::before {
  content: '';
  position: fixed;
  left: -50%; right: -50%; bottom: 0;
  height: 45vh;
  background-image:
    linear-gradient(var(--line) 1px, transparent 1px),
    linear-gradient(90deg, var(--line) 1px, transparent 1px);
  background-size: 60px 40px;
  transform: perspective(400px) rotateX(60deg);
  transform-origin: bottom;
  mask-image: linear-gradient(to top, black 10%, transparent 90%);
  animation: grid-scroll 3s linear infinite;
  z-index: -1;
  pointer-events: none;
}
@keyframes grid-scroll { to { background-position: 0 40px; } }

/* Scanlines */
body::after {
  content: '';
  position: fixed; inset: 0;
  background: repeating-linear-gradient(0deg, rgba(0,0,0,0.18) 0 1px, transparent 1px 3px);
  pointer-events: none;
  z-index: 100;
}

a { color: var(--cyan); }

h1, h2, h3 { font-family: var(--pixel); line-height: 1.4; font-weight: 400; }
h1 { font-size: clamp(1.6rem, 5vw, 3.2rem); }
h2 { font-size: clamp(1rem, 2.6vw, 1.5rem); color: var(--cyan); text-shadow: 0 0 12px rgba(0,217,255,0.6); }
h3 { font-size: 0.9rem; color: var(--yellow); }

.wrap { width: min(1100px, 100% - 32px); margin: 0 auto; }

/* ---------- Navigation ---------- */
.nav {
  position: sticky; top: 0; z-index: 50;
  background: rgba(10, 4, 30, 0.85);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}
.nav .wrap { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 12px 0; flex-wrap: wrap; }
.logo { font-family: var(--pixel); font-size: 0.9rem; color: var(--text); text-decoration: none; display: flex; align-items: center; gap: 10px; }
.logo-wheel { width: 28px; height: 28px; border-radius: 50%; background: conic-gradient(var(--red) 0 25%, var(--cyan) 0 50%, var(--yellow) 0 75%, var(--green) 0); transform: rotate(-45deg); box-shadow: 0 0 12px rgba(255,30,160,0.6); }
.nav ul { list-style: none; display: flex; gap: 6px; margin: 0; padding: 0; flex-wrap: wrap; }
.nav a.link { font-family: var(--pixel); font-size: 0.6rem; color: var(--muted); text-decoration: none; padding: 8px 10px; border: 1px solid transparent; border-radius: 4px; }
.nav a.link:hover, .nav a.link.active { color: var(--text); border-color: var(--pink); box-shadow: 0 0 10px rgba(255,30,160,0.4); }
.nav a.link.live { color: var(--red); }
.nav a.link.live::before { content: '● '; animation: blink 1s steps(2) infinite; }
@keyframes blink { 50% { opacity: 0; } }

/* ---------- Composants ---------- */
.panel {
  background: var(--panel);
  border: 2px solid var(--line);
  border-radius: 10px;
  padding: 24px;
  box-shadow: 0 0 30px rgba(255, 30, 160, 0.12), inset 0 0 30px rgba(0, 217, 255, 0.04);
}

.btn {
  display: inline-block;
  font-family: var(--pixel);
  font-size: 0.7rem;
  padding: 14px 20px;
  border: 2px solid var(--cyan);
  border-radius: 6px;
  background: transparent;
  color: var(--cyan);
  text-decoration: none;
  cursor: pointer;
  transition: transform 0.08s, box-shadow 0.15s, background 0.15s;
}
.btn:hover { background: rgba(0,217,255,0.12); box-shadow: 0 0 18px rgba(0,217,255,0.5); }
.btn:active { transform: scale(0.95); }
.btn.primary { border-color: var(--pink); color: #fff; background: var(--pink); box-shadow: 0 0 18px rgba(255,30,160,0.6); }
.btn.primary:hover { background: #ff4fb6; }
.btn:disabled { opacity: 0.35; cursor: not-allowed; box-shadow: none; }

.tag { display: inline-block; font-family: var(--pixel); font-size: 0.55rem; padding: 4px 8px; border-radius: 4px; border: 1px solid currentColor; }

.grid { display: grid; gap: 20px; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }

section { padding: 56px 0; }

footer { padding: 40px 0; text-align: center; color: var(--muted); font-size: 0.9rem; border-top: 1px solid var(--line); margin-top: 40px; }

/* ---------- Accueil ---------- */
.hero { display: grid; grid-template-columns: 1.2fr 1fr; align-items: center; gap: 32px; padding: 64px 0 32px; }
.hero h1 { margin: 0 0 16px; }
.hero h1 .l1 { color: var(--cyan); text-shadow: 4px 4px 0 var(--pink); display: block; }
.hero h1 .l2 { color: #fff; text-shadow: 4px 4px 0 var(--pink); display: block; }
.hero p.lead { font-size: 1.25rem; color: var(--muted); max-width: 520px; }
.hero .actions { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 24px; }

/* Roue animée (même palette que WheelController) */
.wheel-wrap { position: relative; width: min(380px, 80vw); aspect-ratio: 1; margin: 0 auto; }
.wheel { position: absolute; inset: 0; animation: wheel-twist 8s cubic-bezier(.6,-0.3,.4,1.3) infinite; }
.wheel .q { position: absolute; width: 50%; height: 50%; border: 6px solid var(--bg); transition: filter 0.1s, transform 0.1s; }
.wheel .q.up    { top: 0; left: 0;  border-radius: 100% 0 0 0; background: #99263f; }
.wheel .q.right { top: 0; right: 0; border-radius: 0 100% 0 0; background: #05407f; }
.wheel .q.down  { bottom: 0; right: 0; border-radius: 0 0 100% 0; background: #a67a00; }
.wheel .q.left  { bottom: 0; left: 0; border-radius: 0 0 0 100%; background: #0a8033; }
.wheel .q.lit.up    { background: var(--red);    box-shadow: 0 0 40px var(--red); }
.wheel .q.lit.right { background: var(--cyan);   box-shadow: 0 0 40px var(--cyan); }
.wheel .q.lit.down  { background: var(--yellow); box-shadow: 0 0 40px var(--yellow); }
.wheel .q.lit.left  { background: var(--green);  box-shadow: 0 0 40px var(--green); }
.wheel .q.lit { transform: scale(1.06); z-index: 1; }
.wheel-wrap .hub { position: absolute; inset: 32%; border-radius: 50%; background: var(--bg); border: 4px solid #fff; display: grid; place-items: center; font-family: var(--pixel); font-size: 0.7rem; color: var(--cyan); text-align: center; z-index: 2; }
@keyframes wheel-twist {
  0%, 30% { transform: rotate(45deg); }
  40%, 65% { transform: rotate(135deg); }
  75%, 100% { transform: rotate(405deg); }
}

.mode-card { border-left: 4px solid var(--c, var(--cyan)); }
.mode-card h3 { color: var(--c, var(--cyan)); margin-top: 0; }
.mode-card .tag { color: var(--c); }

.facts { list-style: none; padding: 0; margin: 0; }
.facts li { padding: 6px 0; border-bottom: 1px solid rgba(255,255,255,0.06); }
.facts strong { color: var(--cyan); }

.steps { counter-reset: step; list-style: none; padding: 0; }
.steps li { counter-increment: step; position: relative; padding-left: 56px; margin-bottom: 18px; }
.steps li::before { content: counter(step); position: absolute; left: 0; top: 0; width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; font-family: var(--pixel); font-size: 0.8rem; background: var(--pink); color: #fff; box-shadow: 0 0 12px var(--pink); }

.controls { display: flex; flex-wrap: wrap; gap: 12px; }
.key { font-family: var(--pixel); font-size: 0.6rem; padding: 8px 10px; border-radius: 6px; border: 2px solid var(--muted); border-bottom-width: 5px; }

/* ---------- Lore ---------- */
.lore-chapter { display: grid; grid-template-columns: 90px 1fr; gap: 24px; margin-bottom: 32px; }
.lore-chapter .num { font-family: var(--pixel); font-size: 2rem; color: var(--pink); text-shadow: 0 0 16px var(--pink); }
.character { text-align: center; }
.character .avatar { width: 96px; height: 96px; margin: 0 auto 12px; border-radius: 50%; display: grid; place-items: center; font-family: var(--pixel); font-size: 1.6rem; color: var(--bg); background: var(--c); box-shadow: 0 0 24px var(--c); }
.character h3 { color: var(--c); }

/* ---------- Blog ---------- */
.post { margin-bottom: 28px; }
.post .meta { color: var(--muted); font-size: 0.9rem; margin-bottom: 8px; }
.post h2 { margin: 0 0 8px; }
.post img { max-width: 100%; border-radius: 8px; }
.post code { background: rgba(0,217,255,0.1); padding: 1px 6px; border-radius: 4px; color: var(--cyan); }

/* ---------- Leaderboard ---------- */
.tabs { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 20px; }
.tabs button { font-family: var(--pixel); font-size: 0.55rem; padding: 10px 12px; background: transparent; color: var(--c); border: 2px solid var(--c); border-radius: 6px; cursor: pointer; opacity: 0.55; }
.tabs button.active { opacity: 1; background: color-mix(in srgb, var(--c) 18%, transparent); box-shadow: 0 0 14px var(--c); }
table.board { width: 100%; border-collapse: collapse; font-family: var(--pixel); font-size: 0.75rem; }
table.board th { text-align: left; color: var(--muted); font-weight: 400; padding: 10px 8px; border-bottom: 2px solid var(--line); font-size: 0.55rem; }
table.board td { padding: 14px 8px; border-bottom: 1px solid rgba(255,255,255,0.06); }
table.board td.score { text-align: right; color: var(--gold); }
table.board th.score { text-align: right; }
table.board tr.rank-1 td { color: var(--gold); text-shadow: 0 0 10px var(--gold); }
table.board tr.rank-2 td:first-child { color: #d6d6ff; }
table.board tr.rank-3 td:first-child { color: #ff9d5c; }
table.board tr.fresh { animation: fresh 2.5s ease-out; }
@keyframes fresh { 0%, 30% { background: rgba(255,30,160,0.45); } 100% { background: transparent; } }
.empty { text-align: center; color: var(--muted); padding: 30px; font-family: var(--pixel); font-size: 0.6rem; }

/* ---------- Live ---------- */
.live-layout { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.status-dot { display: inline-block; width: 12px; height: 12px; border-radius: 50%; background: #555; margin-right: 8px; vertical-align: middle; }
.status-dot.on { background: var(--green); box-shadow: 0 0 10px var(--green); animation: blink 1.2s steps(2) infinite; }
.stat-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin: 18px 0; }
.stat { text-align: center; padding: 14px 8px; border: 1px solid var(--line); border-radius: 8px; }
.stat .v { font-family: var(--pixel); font-size: 1.1rem; color: var(--gold); display: block; margin-top: 6px; }
.stat .k { font-size: 0.8rem; color: var(--muted); text-transform: uppercase; letter-spacing: 1px; }

.gauge { height: 26px; border: 2px solid var(--pink); border-radius: 6px; overflow: hidden; position: relative; margin: 10px 0 18px; }
.gauge .fill { height: 100%; width: 0; background: linear-gradient(90deg, var(--pink), var(--yellow)); box-shadow: 0 0 18px var(--pink); transition: width 0.6s ease-out; }
.gauge .label { position: absolute; inset: 0; display: grid; place-items: center; font-family: var(--pixel); font-size: 0.6rem; text-shadow: 0 0 4px #000; }

.sabotages { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.sab { font-family: var(--pixel); font-size: 0.6rem; padding: 18px 10px; border-radius: 8px; border: 2px solid var(--c); background: color-mix(in srgb, var(--c) 10%, transparent); color: #fff; cursor: pointer; transition: transform 0.08s, box-shadow 0.15s; }
.sab .ico { display: block; font-size: 1.6rem; margin-bottom: 8px; }
.sab .cost { display: block; margin-top: 8px; color: var(--c); }
.sab:hover:not(:disabled) { box-shadow: 0 0 20px var(--c); transform: translateY(-2px); }
.sab:active:not(:disabled) { transform: scale(0.94); }
.sab:disabled { opacity: 0.3; cursor: not-allowed; }

.nick-row { display: flex; gap: 10px; margin-bottom: 16px; align-items: center; flex-wrap: wrap; }
.nick-row input { flex: 1; min-width: 140px; font-family: var(--pixel); font-size: 0.7rem; padding: 12px; background: rgba(0,0,0,0.4); color: var(--text); border: 2px solid var(--cyan); border-radius: 6px; }

.toast { min-height: 1.6em; font-weight: 600; margin-top: 12px; }
.toast.err { color: var(--red); }
.toast.ok { color: var(--green); }

.feed { list-style: none; padding: 0; margin: 0; max-height: 360px; overflow-y: auto; }
.feed li { padding: 8px 10px; border-left: 3px solid var(--muted); margin-bottom: 6px; background: rgba(0,0,0,0.25); animation: slide-in 0.3s ease-out; }
.feed li.sabotage { border-color: var(--pink); }
.feed li.hit { border-color: var(--yellow); color: var(--yellow); }
.feed li.over { border-color: var(--red); }
.feed li.start { border-color: var(--green); }
.feed li.score { border-color: var(--gold); }
@keyframes slide-in { from { opacity: 0; transform: translateX(-12px); } }

.shake { animation: shake 0.35s; }
@keyframes shake { 20% { transform: translate(-6px, 2px); } 40% { transform: translate(5px, -3px); } 60% { transform: translate(-4px, 1px); } 80% { transform: translate(3px, -1px); } }

/* ---------- Responsive ---------- */
@media (max-width: 800px) {
  .hero, .live-layout { grid-template-columns: 1fr; }
  .lore-chapter { grid-template-columns: 1fr; gap: 4px; }
  .nav ul { width: 100%; justify-content: space-between; }
  .nav a.link { font-size: 0.5rem; padding: 6px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before { animation: none !important; transition: none !important; }
}
