:root {
  color-scheme: dark;
  --ink: #fbf3e4;
  --muted: rgba(251, 243, 228, 0.72);
  --night: #120d08;
  --gold: #d9a441;
  --font: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; background: var(--night); color: var(--ink); font-family: var(--font); }
body { min-height: 100dvh; -webkit-font-smoothing: antialiased; }

#pixels { position: fixed; inset: 0; width: 100vw; height: 100vh; height: 100dvh; display: block; z-index: 0; }
/* Voile pour garder le bouton lisible sur le portrait */
.home::after {
  content: ""; position: fixed; inset: 0; z-index: 1; pointer-events: none;
  background: radial-gradient(ellipse 60% 45% at 50% 58%, rgba(18, 13, 8, 0.55), transparent 70%),
              linear-gradient(to bottom, transparent 55%, rgba(18, 13, 8, 0.55));
  opacity: 0; transition: opacity 1.2s ease;
}
.pixels-done .home::after { opacity: 1; }

.gate {
  position: relative; z-index: 2; min-height: 100dvh;
  display: grid; place-content: center; justify-items: center; gap: 26px;
  padding: 24px 16px calc(24px + env(safe-area-inset-bottom));
  padding-top: 38vh;
}
.welcome {
  margin: 0; text-align: center; font-size: clamp(26px, 6.5vw, 44px); font-weight: 650; letter-spacing: -0.02em; line-height: 1.1;
  text-shadow: 0 2px 24px rgba(0, 0, 0, 0.65), 0 1px 2px rgba(0, 0, 0, 0.5);
}
.gate > * { opacity: 0; transform: translateY(14px) scale(0.98); transition: opacity 0.8s ease, transform 0.8s cubic-bezier(.2,.8,.2,1); }
.pixels-done .gate > * { opacity: 1; transform: none; }
.pixels-done .gate > :nth-child(2) { transition-delay: 0.12s; }
.pixels-done .gate > :nth-child(3) { transition-delay: 0.24s; }

.cta {
  display: inline-flex; align-items: center; gap: 12px;
  padding: 16px 28px; border-radius: 999px;
  font-size: 17px; font-weight: 600; letter-spacing: 0.01em; color: var(--ink); text-decoration: none;
  background: rgba(24, 17, 10, 0.55);
  border: 1px solid rgba(251, 243, 228, 0.28);
  backdrop-filter: blur(14px) saturate(1.3); -webkit-backdrop-filter: blur(14px) saturate(1.3);
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.12);
  transition: background 0.25s ease, border-color 0.25s ease, transform 0.25s ease;
}
.cta svg { width: 20px; height: 20px; }
.cta:hover { background: rgba(217, 164, 65, 0.32); border-color: rgba(217, 164, 65, 0.7); transform: translateY(-1px); }
.cta:focus-visible { outline: 2px solid var(--gold); outline-offset: 4px; }
.note { margin: 0; font-size: 13px; color: var(--muted); text-shadow: 0 1px 10px rgba(0, 0, 0, 0.7); }
.note { color: #ffd2b5; }

/* Tableau de bord : photo nette + verre liquide */
.dash .photo, .dash #reveal {
  position: fixed; inset: 0; width: 100vw; height: 100vh; height: 100dvh; z-index: 0;
}
.dash .photo { object-fit: cover; object-position: 50% 30%; }
.dash #reveal { transition: opacity 0.9s ease; }
.revealed .dash #reveal { opacity: 0; }
.dash::after {
  content: ""; position: fixed; inset: 0; z-index: 1; pointer-events: none;
  background: linear-gradient(to bottom, rgba(18, 13, 8, 0.35), rgba(18, 13, 8, 0.05) 30%, rgba(18, 13, 8, 0.1) 60%, rgba(18, 13, 8, 0.55));
}

.glass {
  --mx: 30%; --my: 0%;
  position: relative; isolation: isolate; overflow: hidden;
  color: var(--ink); text-decoration: none;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.2), rgba(255, 255, 255, 0.05) 55%, rgba(255, 255, 255, 0.1));
  border: 1px solid rgba(255, 255, 255, 0.3);
  backdrop-filter: blur(22px) saturate(1.8) brightness(1.06);
  -webkit-backdrop-filter: blur(22px) saturate(1.8) brightness(1.06);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.55),
    inset 0 -1px 1px rgba(255, 255, 255, 0.12),
    inset 0 0 24px rgba(255, 255, 255, 0.06),
    0 18px 50px rgba(0, 0, 0, 0.3);
  transition: transform 0.35s cubic-bezier(.2,.8,.2,1), box-shadow 0.35s ease, background 0.35s ease;
}
/* Reflet spéculaire qui suit le pointeur */
.glass::before {
  content: ""; position: absolute; inset: 0; z-index: -1; pointer-events: none;
  background: radial-gradient(120% 90% at var(--mx) var(--my), rgba(255, 255, 255, 0.32), transparent 55%);
  opacity: 0.7; transition: opacity 0.35s ease;
}
/* Arête lumineuse du verre */
.glass::after {
  content: ""; position: absolute; inset: 0; border-radius: inherit; pointer-events: none; padding: 1px;
  background: linear-gradient(160deg, rgba(255, 255, 255, 0.7), rgba(255, 255, 255, 0) 35%, rgba(255, 255, 255, 0) 65%, rgba(255, 255, 255, 0.35));
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor; mask-composite: exclude;
}
.glass:hover { transform: translateY(-3px) scale(1.01); box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.65), inset 0 0 30px rgba(255, 255, 255, 0.1), 0 26px 60px rgba(0, 0, 0, 0.35); }
.glass:hover::before { opacity: 1; }
.glass:active { transform: scale(0.98); }
.glass:focus-visible { outline: 2px solid rgba(255, 255, 255, 0.9); outline-offset: 3px; }

.dash-main {
  position: relative; z-index: 2; max-width: 960px; min-height: 100dvh; margin: 0 auto;
  padding: calc(28px + env(safe-area-inset-top)) 16px calc(32px + env(safe-area-inset-bottom));
  display: flex; flex-direction: column;
}
.dash-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.dash-head h1 {
  margin: 0; font-size: clamp(26px, 6vw, 38px); font-weight: 650; letter-spacing: -0.02em;
  text-shadow: 0 2px 20px rgba(0, 0, 0, 0.55);
}
.pill { border-radius: 999px; padding: 10px 16px; font-size: 14px; font-weight: 500; white-space: nowrap; }

.apps {
  margin-top: auto; display: grid; gap: 16px;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 240px), 1fr));
}
.app {
  display: grid; grid-template-columns: auto 1fr; grid-template-rows: auto auto; column-gap: 16px; align-items: center;
  padding: 20px; border-radius: 30px;
  opacity: 0; transform: translateY(24px) scale(0.97);
}
.revealed .app { animation: float-in 0.8s cubic-bezier(.2,.8,.2,1) forwards; animation-delay: calc(0.1s + var(--i) * 90ms); }
.app-icon {
  grid-row: span 2; width: 56px; height: 56px; border-radius: 18px; display: grid; place-items: center;
  color: #fff;
  background: linear-gradient(160deg, color-mix(in srgb, var(--tint) 92%, #fff), color-mix(in srgb, var(--tint) 80%, #000));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.5), 0 8px 20px color-mix(in srgb, var(--tint) 45%, transparent);
}
.app-icon svg { width: 28px; height: 28px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.app-name { align-self: end; font-size: 19px; font-weight: 650; letter-spacing: -0.01em; text-shadow: 0 1px 8px rgba(0, 0, 0, 0.35); }
.app-desc { align-self: start; font-size: 14px; color: rgba(255, 255, 255, 0.82); text-shadow: 0 1px 8px rgba(0, 0, 0, 0.4); }
@keyframes float-in { to { opacity: 1; transform: none; } }

@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .glass { background: rgba(40, 30, 20, 0.78); }
}
@media (prefers-reduced-motion: reduce) {
  .gate > * { transition: none; }
  .app, .revealed .app { animation: none; opacity: 1; transform: none; }
  .glass { transition: none; }
}
