:root{
  --text: rgba(255,255,255,0.92);
  --muted: rgba(255,255,255,0.70);

  --glass: rgba(255,255,255,0.10);
  --glassBorder: rgba(255,255,255,0.16);

  --shadow: rgba(0,0,0,0.45);
  --glow: rgba(255,255,255,0.32);

  --focusRing: rgba(255,255,255,0.75);
  --focusGlow: rgba(120,180,255,0.55);
}

*{ box-sizing: border-box; }
html, body{ height: 100%; }

body{
  margin: 0;
  font-family: ui-sans-serif, system-ui, -apple-system, "SF Pro Display","SF Pro Text","Segoe UI", Roboto, Arial, "Noto Sans", "Helvetica Neue", sans-serif;
  color: var(--text);
  overflow-x: hidden;
}

/* ===== THEME tvOS ===== */
body.theme-tvos{
  /* Fond sombre + “auras” façon Apple TV */
  background:
    radial-gradient(1200px 700px at 20% 10%, rgba(120,80,255,0.35), transparent 60%),
    radial-gradient(900px 600px at 80% 25%, rgba(255,60,160,0.28), transparent 55%),
    radial-gradient(900px 700px at 50% 95%, rgba(0,200,255,0.18), transparent 55%),
    radial-gradient(1200px 900px at 50% 50%, rgba(255,255,255,0.06), transparent 62%),
    linear-gradient(180deg, #0b0d12 0%, #07080c 100%);
}

.page{
  min-height: 100vh;
  position: relative;
}

/* “Vignette” */
.page::after{
  content:"";
  position:absolute;
  inset:0;
  pointer-events:none;
  background: radial-gradient(1200px 800px at 50% 40%, transparent 55%, rgba(0,0,0,0.55) 100%);
  z-index: 0;
}

/* Watermark (même image que le logo) */
.page::before{
  content: "";
  position: absolute;
  inset: 0;
  background-image: url("./assets/logo.png");
  background-repeat: no-repeat;
  background-position: 50% 52%;
  background-size: 560px auto;
  opacity: 0.09;
  pointer-events: none;
  filter: saturate(1.05) blur(0.2px);
  z-index: 0;
}

/* Logo top-left */
.brand{
  position: absolute;
  top: 18px;
  left: 22px;
  display: flex;
  align-items: center;
  gap: 10px;
  z-index: 3;
}
.brand img{
  width: 44px;
  height: 44px;
  object-fit: contain;
  filter: drop-shadow(0 10px 18px rgba(0,0,0,0.45));
}

/* Zone centrale */
.center{
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 90px 16px 90px;
  position: relative;
  z-index: 2;
}

/* Stack */
.stack{
  display: flex;
  flex-direction: column;
  gap: 18px;
  align-items: center;
}

.pill{
  width: min(560px, 88vw);
  height: 72px;
  border-radius: 26px;

  display: inline-flex;
  align-items: center;
  justify-content: center;

  text-decoration: none;
  color: var(--text);
  font-weight: 750;
  font-size: 20px;
  letter-spacing: 0.2px;

  /* IMPORTANT: blur léger pour éviter le lag */
  background: rgba(255,255,255,0.10);
  border: 1px solid var(--glassBorder);

  /* Ombre plus “simple” (moins coûteuse) */
  box-shadow: 0 18px 45px rgba(0,0,0,0.45), inset 0 1px 0 rgba(255,255,255,0.16);

  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);

  /* Perf + fluidité */
  will-change: transform, box-shadow;
  transform: translate3d(0,0,0);
  backface-visibility: hidden;

  transition:
    transform 120ms cubic-bezier(.2,.8,.2,1),
    box-shadow 120ms cubic-bezier(.2,.8,.2,1),
    border-color 120ms cubic-bezier(.2,.8,.2,1);
  user-select: none;
  position: relative;
  overflow: hidden;
}

/* Shine (léger) */
.pill::before{
  content:"";
  position:absolute;
  inset:-40% -20%;
  background: radial-gradient(closest-side at 30% 30%, rgba(255,255,255,0.28), transparent 60%);
  opacity: 0.45;
  transform: rotate(12deg);
  pointer-events:none;
}

/* Hover (pas de filter: brightness -> souvent janky) */
@media (hover: hover){
  .pill:hover{
    transform: scale(1.03) translate3d(0,-1px,0);
    border-color: rgba(255,255,255,0.26);
    box-shadow:
      0 26px 70px rgba(0,0,0,0.58),
      0 0 18px rgba(255,255,255,0.18),
      inset 0 1px 0 rgba(255,255,255,0.18);
  }
}

/* Focus clavier */
.pill:focus,
.pill:focus-visible{
  outline: none;
  transform: scale(1.055) translate3d(0,-1px,0);
  border-color: rgba(255,255,255,0.34);
  box-shadow:
    0 30px 90px rgba(0,0,0,0.62),
    0 0 0 2px rgba(255,255,255,0.65),
    0 0 22px rgba(120,180,255,0.45),
    inset 0 1px 0 rgba(255,255,255,0.22);
}


/* Footer */
.footer{
  position: absolute;
  left: 0;
  right: 0;
  bottom: 16px;
  display: flex;
  justify-content: center;
  z-index: 3;
  padding: 0 12px;
}
.footer .text{
  font-size: 14px;
  color: rgba(255,255,255,0.65);
  text-shadow: 0 2px 10px rgba(0,0,0,0.55);
  text-align: center;
}

/* Clock tvOS */
.clock{
  position: absolute;
  top: 18px;
  right: 22px;
  z-index: 3;

  padding: 12px 14px;
  border-radius: 18px;
  background: rgba(255,255,255,0.10);
  border: 1px solid rgba(255,255,255,0.16);

  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);

  box-shadow: 0 18px 50px rgba(0,0,0,0.50);
}

.clock .time{
  font-size: 22px;
  font-weight: 800;
  line-height: 1.1;
}
.clock .date{
  font-size: 13px;
  color: rgba(255,255,255,0.72);
  margin-top: 4px;
}

/* Réduction d’animations si demandé */
@media (prefers-reduced-motion: reduce){
  .pill{ transition: none; }
  .pill:hover{ transform: none; }
  .pill:focus, .pill:focus-visible{ transform: none; }
}

/* =========================
   AUTH OVERLAY
   ========================= */
body.is-locked .center,
body.is-locked .footer,
body.is-locked .brand,
body.is-locked .clock{
  pointer-events: none; /* on empêche l’interaction tant que verrouillé */
}

.auth-overlay{
  position: fixed;
  inset: 0;
  z-index: 999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 28px 16px;
  background: rgba(0,0,0,0.60);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}

.auth-overlay.is-hidden{
  display: none;
}

.auth-card{
  width: min(520px, 92vw);
  border-radius: 28px;
  background: rgba(255,255,255,0.10);
  border: 1px solid rgba(255,255,255,0.18);
  box-shadow: 0 26px 85px rgba(0,0,0,0.65), inset 0 1px 0 rgba(255,255,255,0.16);
  padding: 26px 22px 22px;
  text-align: center;
}

.auth-logo{
  width: 62px;
  height: 62px;
  object-fit: contain;
  filter: drop-shadow(0 12px 22px rgba(0,0,0,0.55));
  margin-bottom: 10px;
}

.auth-title{
  margin: 0;
  font-size: 26px;
  font-weight: 850;
  letter-spacing: 0.2px;
}

.auth-sub{
  margin: 8px 0 18px;
  color: rgba(255,255,255,0.75);
  font-size: 14px;
}

.auth-form{
  display: grid;
  gap: 10px;
  margin-top: 8px;
  text-align: left;
}

.auth-label{
  font-size: 13px;
  color: rgba(255,255,255,0.72);
  margin-top: 6px;
}

.auth-input{
  width: 100%;
  height: 46px;
  border-radius: 16px;
  border: 1px solid rgba(255,255,255,0.18);
  background: rgba(0,0,0,0.25);
  color: rgba(255,255,255,0.92);
  padding: 0 14px;
  font-size: 16px;
  outline: none;
}

.auth-input:focus{
  border-color: rgba(255,255,255,0.34);
  box-shadow:
    0 0 0 2px rgba(255,255,255,0.40),
    0 0 22px rgba(120,180,255,0.35);
}

.auth-btn{
  margin-top: 10px;
  height: 52px;
  border-radius: 18px;
  border: 1px solid rgba(255,255,255,0.20);
  background: rgba(255,255,255,0.14);
  color: rgba(255,255,255,0.95);
  font-weight: 850;
  font-size: 16px;
  cursor: pointer;
  box-shadow: 0 18px 55px rgba(0,0,0,0.55), inset 0 1px 0 rgba(255,255,255,0.18);
  transition: transform 120ms cubic-bezier(.2,.8,.2,1);
}

.auth-btn:hover{
  transform: scale(1.02);
}

.auth-btn:focus,
.auth-btn:focus-visible{
  outline: none;
  box-shadow:
    0 22px 70px rgba(0,0,0,0.62),
    0 0 0 2px rgba(255,255,255,0.65),
    0 0 22px rgba(120,180,255,0.45);
}

.auth-error{
  display: none;
  margin-top: 8px;
  padding: 10px 12px;
  border-radius: 14px;
  background: rgba(255,70,70,0.12);
  border: 1px solid rgba(255,70,70,0.22);
  color: rgba(255,255,255,0.92);
  font-size: 14px;
}

.auth-hint{
  margin-top: 14px;
  font-size: 13px;
  color: rgba(255,255,255,0.70);
  text-align: center;
}

/* Bouton Déconnexion (dans la clock) */
.logout{
  margin-top: 10px;
  width: 100%;
  height: 38px;
  border-radius: 14px;
  border: 1px solid rgba(255,255,255,0.18);
  background: rgba(255,255,255,0.10);
  color: rgba(255,255,255,0.88);
  font-weight: 750;
  font-size: 13px;
  cursor: pointer;
  box-shadow: 0 10px 26px rgba(0,0,0,0.45), inset 0 1px 0 rgba(255,255,255,0.16);
  transition:
    transform 120ms cubic-bezier(.2,.8,.2,1),
    box-shadow 120ms cubic-bezier(.2,.8,.2,1),
    border-color 120ms cubic-bezier(.2,.8,.2,1);
}

@media (hover: hover){
  .logout:hover{
    transform: scale(1.02);
    border-color: rgba(255,255,255,0.26);
    box-shadow: 0 14px 32px rgba(0,0,0,0.55), inset 0 1px 0 rgba(255,255,255,0.18);
  }
}

.logout:focus,
.logout:focus-visible{
  outline: none;
  border-color: rgba(255,255,255,0.34);
  box-shadow:
    0 16px 36px rgba(0,0,0,0.60),
    0 0 0 2px rgba(255,255,255,0.55),
    0 0 18px rgba(120,180,255,0.35);
}
