:root{
  --bg: #0f1220;
  --card: #171a2b;
  --card-2: #1e2238;
  --text: #e7ecff;
  --muted: #9aa3c7;
  --accent: #4ade80;
  --primary: #60a5fa;
  --danger: #f87171;
  --warning: #fbbf24;
  --border: #2b3050;
  --shadow: rgba(0,0,0,.35);
}

*{ box-sizing: border-box; }
html,body{ height:100%; }
body{
  margin:0;
  font-family: "Rubik", system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  color: var(--text);
  background:
    linear-gradient(90deg, rgba(255,255,255,.03) 1px, transparent 1px) 0 0/32px 32px,
    linear-gradient(0deg, rgba(255,255,255,.02) 1px, transparent 1px) 0 0/32px 32px,
    var(--bg);
}

.app{ max-width: 920px; margin: 24px auto 64px; padding: 0 16px; }

.header{ text-align:center; margin-bottom: 12px; }

.title{
  font-family: "Press Start 2P", monospace;
  font-size: 28px;
  letter-spacing: 1px;
  margin: 12px 0 0;
  color: #fff;
  text-shadow: 0 2px 0 #000, 0 0 16px rgba(96,165,250,.25);
}

.card{
  background: linear-gradient(180deg, var(--card), var(--card-2));
  border: 2px solid var(--border);
  border-radius: 18px;
  padding: 16px;
  margin: 16px 0;
  box-shadow: 0 12px 24px var(--shadow);
}

h2{
  font-family: "Press Start 2P", monospace;
  font-size: 16px;
  margin: 0 0 14px 0;
  color: #fff;
}

.hint{ color: var(--muted); font-size: 13px; margin: 8px 0 0; }
.hint.strong{ font-weight: 700; }

.quota-row, .session-row, .options-row, .controls{
  display:flex;
  gap:12px;
  flex-wrap:wrap;
  align-items:center;
}

/* Boutons génériques */
.btn{
  appearance: none;
  border: 3px solid #0a0d1d;
  background: #222644;
  color: #e7ecff;
  padding: 12px 16px;
  border-radius: 14px;
  font-weight: 700;
  letter-spacing: .2px;
  transition: transform .06s ease, box-shadow .06s ease, background .2s ease;
  box-shadow: 0 6px 0 #0a0d1d, 0 10px 18px rgba(0,0,0,.25);
  cursor: pointer;
  user-select:none;
}
.btn:hover{ transform: translateY(-2px); }
.btn:active{ transform: translateY(1px); box-shadow: 0 3px 0 #0a0d1d; }
.btn[disabled]{ opacity: .55; cursor: not-allowed; filter: grayscale(.2); }

.btn-choice{ background: #243056; border-color: #0d1330; }
.btn-session{ background: #1f2a4e; }
.btn-primary{ background: var(--primary); color: #0d1530; }
.btn-danger{ background: var(--danger); color: #2b0b0b; }
.btn-warning{ background: var(--warning); color: #2b1f05; }

/* Boutons PLUS GROS */
.btn-choice-lg{
  padding: 16px 18px;
  font-size: 18px;
  border-radius: 16px;
}
.btn-session-lg{
  padding: 18px 20px;
  font-size: 20px;
  border-radius: 16px;
}

/* Zone session */
.running{
  margin-top: 8px;
  padding: 12px;
  background: #121529;
  border: 2px dashed #2a2f55;
  border-radius: 12px;
}

.big-time{
  font-family: "Press Start 2P", monospace;
  font-size: 22px;
  margin-bottom: 6px;
}

/* Bloc “Temps restant” en deux lignes */
.mega-time{
  display:flex;
  flex-direction:column;
  align-items:center;
  justify-content:center;
  text-align:center;
  gap:8px;
  font-family: "Press Start 2P", monospace;
  padding: 14px 16px;
  margin: 4px 0 14px;
  background: #121529;
  border: 2px dashed #2a2f55;
  border-radius: 14px;
}
.mega-label{
  font-size: 16px;
  color: #cdd6ff;
  letter-spacing: .5px;
}
.mega-value{
  font-size: 48px;
  letter-spacing: 1px;
  line-height: 1.1;
}

/* Flash plein écran : fond qui clignote (en continu tant que .show) */
.flash-overlay{
  position: fixed;
  inset: 0;
  background: radial-gradient(ellipse at center, rgba(255,255,255,.95), rgba(255,255,255,0.2)), #fff;
  z-index: 9990;            /* dessous de l'alarme */
  display:none;
  pointer-events: none;
  animation: flashBlink 1.2s ease-in-out infinite;
}
.flash-overlay.show{ display:block; }

@keyframes flashBlink{
  0%   { opacity: 0; }
  15%  { opacity: 1; }
  40%  { opacity: 0; }
  55%  { opacity: 1; }
  80%  { opacity: 0; }
  100% { opacity: 1; }
}

/* Toggle simple */
.toggle{
  display:flex;
  align-items:center;
  gap:8px;
  margin-top: 6px;
}
.toggle input{
  transform: scale(1.1);
}

/* === Alarme persistante (fenêtre stable au-dessus du flash) === */
.alarm-overlay{
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 10000;           /* au-dessus du flash */
  background: rgba(0,0,0,0.35); /* léger assombrissement, mais NE CLIGNOTE PAS */
}

.alarm-overlay.show{ display: flex; }

.alarm-box{
  background: linear-gradient(180deg, #1b0f12, #2a0f13);
  border: 3px solid #5a1116;
  border-radius: 18px;
  padding: 20px 18px;
  box-shadow: 0 16px 32px rgba(0,0,0,.45);
  text-align: center;
  max-width: 520px;
  width: 92%;
}

.alarm-title{
  font-family: "Press Start 2P", monospace;
  font-size: 18px;
  margin-bottom: 8px;
  color: #fff;
  text-shadow: 0 2px 0 #000;
}

.alarm-text{
  color: #ffd7d7;
  margin: 0 0 14px;
  line-height: 1.4;
}

.btn-alarm{
  font-size: 18px;
  padding: 14px 20px;
  border-radius: 16px;
}

/* === Rappel : chrono non démarré === */
.reminder-overlay{
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 10001;           /* au-dessus de tout */
  background: rgba(0,0,0,0.5);
  animation: reminderPulse 1.5s ease-in-out infinite;
}

.reminder-overlay.show{ display: flex; }

@keyframes reminderPulse{
  0%, 100% { background: rgba(0,0,0,0.5); }
  50% { background: rgba(251, 191, 36, 0.3); }
}

.reminder-box{
  background: linear-gradient(180deg, #2a1f0f, #3a2f1f);
  border: 4px solid var(--warning);
  border-radius: 18px;
  padding: 24px 20px;
  box-shadow: 0 16px 32px rgba(0,0,0,.6), 0 0 40px rgba(251, 191, 36, 0.4);
  text-align: center;
  max-width: 520px;
  width: 92%;
  animation: reminderShake 0.5s ease-in-out infinite;
}

@keyframes reminderShake{
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-4px) rotate(-1deg); }
  75% { transform: translateX(4px) rotate(1deg); }
}

.reminder-title{
  font-family: "Press Start 2P", monospace;
  font-size: 20px;
  margin-bottom: 12px;
  color: var(--warning);
  text-shadow: 0 2px 0 #000, 0 0 20px rgba(251, 191, 36, 0.6);
  animation: reminderBlink 1s ease-in-out infinite;
}

@keyframes reminderBlink{
  0%, 100% { opacity: 1; }
  50% { opacity: 0.7; }
}

.reminder-text{
  color: #fff8e1;
  margin: 0 0 18px;
  line-height: 1.5;
  font-size: 16px;
}

/* === Popup d'avertissement personnalisé === */
.warning-overlay{
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 10002;           /* au-dessus de tout */
  background: rgba(0,0,0,0.6);
}

.warning-overlay.show{ 
  display: flex !important; 
}

.warning-box{
  background: linear-gradient(180deg, #2a1f0f, #3a2f1f);
  border: 3px solid var(--warning);
  border-radius: 18px;
  padding: 24px 20px;
  box-shadow: 0 16px 32px rgba(0,0,0,.6), 0 0 40px rgba(251, 191, 36, 0.3);
  text-align: center;
  max-width: 520px;
  width: 92%;
  margin: auto;
  position: relative;
}

.warning-title{
  font-family: "Press Start 2P", monospace;
  font-size: 18px;
  margin-bottom: 12px;
  color: var(--warning);
  text-shadow: 0 2px 0 #000;
}

.warning-text{
  color: #fff8e1;
  margin: 0 0 18px;
  line-height: 1.5;
  font-size: 15px;
  white-space: pre-line;
}

/* Petits écrans */
@media (max-width:480px){
  .title{ font-size: 22px; }
  .mega-value{ font-size: 38px; }
  .big-time{ font-size: 18px; }
  .btn-choice-lg{ font-size: 16px; padding: 14px 16px; }
  .btn-session-lg{ font-size: 18px; padding: 16px 18px; }
  .warning-title{ font-size: 16px; }
  .warning-text{ font-size: 14px; }
}
