@import url('https://fonts.googleapis.com/css2?family=Fredoka:wght@500;600;700&family=Nunito:wght@400;600;800&display=swap');

:root {
  --bg-top:#16283F; --bg-mid:#0D1B2A; --bg-bot:#050814;
  --ink:#F1EFE7; --muted:#9BA6C0; --dim:#6E7994;
  --gold:#FFE29A; --gold-deep:#F4D35E;
  --cyan:#5EEAD4; --cyan-deep:#2DD4BF;
  --violet:#C4B5FD; --violet-deep:#A78BFA;
  --green:#86D99C; --green-deep:#4ADE80;
  --orange:#F6B17A; --orange-deep:#F2994A;
  --red:#FCA5A5; --red-deep:#F87171;
  --font-display:'Fredoka', sans-serif;
  --font-body:'Nunito', sans-serif;
}

* { margin:0; padding:0; box-sizing:border-box; -webkit-tap-highlight-color:transparent; user-select:none; }
html, body { width:100%; height:100%; overflow:hidden; touch-action:none; background:var(--bg-bot); }
body {
  font-family:var(--font-body);
  position:relative;
  background: radial-gradient(ellipse at 50% 0%, var(--bg-top) 0%, var(--bg-mid) 45%, var(--bg-bot) 100%);
  color:var(--ink);
}

#sky { position:absolute; inset:0; z-index:1; pointer-events:none; }
.star { position:absolute; width:2px; height:2px; background:#F1EFE7; border-radius:50%; animation:twinkle 3.5s ease-in-out infinite; }
@keyframes twinkle { 0%,100%{opacity:.15;} 50%{opacity:.9;} }

#treeline { position:absolute; bottom:0; left:0; width:100%; height:14vh; z-index:3; fill:#030509; pointer-events:none; }

.screen { position:absolute; inset:0; z-index:20; display:flex; flex-direction:column; align-items:center; justify-content:center; text-align:center; padding:40px; }
.hidden { display:none !important; }

.display-title { font-family:var(--font-display); font-weight:700; letter-spacing:.02em; }
.subtitle { font-weight:600; color:var(--muted); }

.btn {
  font-family:var(--font-display); font-weight:600; font-size:20px; color:var(--bg-bot);
  background:var(--gold); border:none; padding:18px 46px; border-radius:999px; cursor:pointer;
  box-shadow:0 0 30px rgba(244,211,94,.4);
}
.btn:active { transform:scale(.96); }
.btn--ghost {
  background:transparent; color:var(--ink); border:2px solid rgba(241,239,231,.35);
  box-shadow:none; padding:16px 40px;
}

.home-link {
  position:fixed; top:20px; left:20px; z-index:30;
  font-family:var(--font-display); font-weight:600; font-size:15px; color:var(--ink);
  background:rgba(255,255,255,.06); border:1px solid rgba(241,239,231,.25);
  padding:10px 20px; border-radius:999px; text-decoration:none; display:flex; align-items:center; gap:8px;
}
.home-link:active { transform:scale(.95); }

.hud { position:absolute; top:0; left:0; right:0; z-index:10; display:flex; justify-content:space-between; align-items:center; padding:24px 32px; pointer-events:none; }
.hud-box { font-family:var(--font-display); text-align:right; padding-top:3em; }
.hud-label { font-size:12px; letter-spacing:.08em; text-transform:uppercase; color:var(--muted); font-weight:500; }
.hud-value { font-size:30px; font-weight:600; line-height:1.1; }

/* Tuiles d'accueil */
.tile-grid { display:grid; grid-template-columns:repeat(auto-fit, minmax(170px, 220px)); justify-content:center; gap:clamp(16px,2.4vw,28px); margin-top:20px; max-width:900px; }
.tile {
  aspect-ratio:1; border-radius:28px; text-decoration:none; color:var(--ink);
  background:rgba(255,255,255,.03); border:2px solid var(--accent, var(--gold));
  box-shadow:0 0 26px -4px var(--accent-glow, rgba(244,211,94,.4));
  display:flex; flex-direction:column; align-items:center; justify-content:center;
  transition:transform .15s ease;
}
.tile:active { transform:scale(.95); }
.tile .icon { font-size:clamp(44px,7vw,64px); margin-bottom:10px; }
.tile .name { font-family:var(--font-display); font-weight:600; font-size:clamp(18px,2.2vw,22px); }
.tile .desc { font-size:12px; color:var(--muted); margin-top:4px; font-weight:600; }

.tile--gold { --accent:var(--gold-deep); --accent-glow:rgba(244,211,94,.4); }
.tile--cyan { --accent:var(--cyan-deep); --accent-glow:rgba(45,212,191,.4); }
.tile--violet { --accent:var(--violet-deep); --accent-glow:rgba(167,139,250,.4); }
.tile--green { --accent:var(--green-deep); --accent-glow:rgba(74,222,128,.4); }
.tile--orange { --accent:var(--orange-deep); --accent-glow:rgba(242,153,74,.4); }
.tile--red { --accent:var(--red-deep); --accent-glow:rgba(248,113,113,.4); }

.end-score-label { font-size:16px; color:var(--muted); font-weight:600; letter-spacing:.06em; text-transform:uppercase; }
.end-score { font-family:var(--font-display); font-weight:700; font-size:clamp(56px,12vw,100px); margin:4px 0 8px; }
.end-tier { font-size:clamp(16px,2.2vw,22px); font-weight:600; margin-bottom:36px; }
.btn-row { display:flex; gap:16px; flex-wrap:wrap; justify-content:center; }

.countdown-num { font-family:var(--font-display); font-weight:700; font-size:clamp(90px,20vw,160px); color:var(--gold); text-shadow:0 0 40px rgba(244,211,94,.5); }

/* Écran de veille tactile : assombrit l'écran après inactivité, réveil instantané au toucher.
   Animation en opacité uniquement (pas d'agrandissement) pour ne jamais fausser
   le calcul de la zone défilable de la page. */
#idle-overlay {
  position:fixed; inset:0; z-index:999;
  background:#000;
  display:flex; align-items:center; justify-content:center;
  opacity:0; pointer-events:none; transition:opacity 1.2s ease;
  overflow:hidden;
}
#idle-overlay.show { opacity:1; pointer-events:auto; }
#idle-overlay .idle-msg {
  font-family:var(--font-display); font-weight:600; color:rgba(241,239,231,.55);
  font-size:clamp(16px,3vw,22px); text-align:center; line-height:1.8;
  animation:idle-pulse 2.4s ease-in-out infinite;
}
@keyframes idle-pulse { 0%,100%{ opacity:.4; } 50%{ opacity:.9; } }

/* Écran d'arrêt / redémarrage, déclenché par un geste caché (voir common.js) */
.power-overlay {
  position:fixed; inset:0; z-index:9999;
  background:rgba(5,8,20,.97);
  display:flex; flex-direction:column; align-items:center; justify-content:center; gap:32px;
  opacity:0; pointer-events:none; transition:opacity .3s ease;
  overflow:hidden;
}
.power-overlay.show { opacity:1; pointer-events:auto; }
.power-row { display:flex; flex-direction:column; align-items:center; gap:16px; }
.power-row .power-q { font-family:var(--font-display); font-weight:600; font-size:clamp(20px,3vw,26px); color:var(--ink); }
.power-btns { display:flex; gap:16px; }
.power-btn {
  font-family:var(--font-display); font-weight:600; font-size:18px; padding:14px 38px;
  border-radius:999px; border:2px solid rgba(241,239,231,.3); background:rgba(255,255,255,.05);
  color:var(--ink); cursor:pointer;
}
.power-btn:active { transform:scale(.96); }
.power-btn.yes-shutdown { border-color:var(--red-deep); color:var(--red); }
.power-btn.yes-reboot { border-color:var(--gold-deep); color:var(--gold); }
.power-status { font-family:var(--font-display); font-size:15px; color:var(--muted); max-width:340px; text-align:center; min-height:20px; }
