/* Thème sombre permanent — le seul et unique thème de l'app. */
:root {
  color-scheme: dark;
  --bg-1: #0f1a29;
  --bg-2: #16233a;
  --text: #e9f1fa;
  --text-soft: #8fa6c0;
  --accent: #4a9fe8;
  --accent-strong: #61aef2;
  --card: #1c2b45;
  --border: #2b405f;
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.45);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html, body { height: 100%; }

/* Le dégradé est sur la racine : il peint tout le canvas, y compris
   les zones de sécurité iOS (sous l'horloge, autour de la barre home)
   et l'overscroll — sinon iOS y montre des bandes de couleur parasite. */
html {
  /* no-repeat + couleur unie : au-delà du dégradé (zone home iOS,
     overscroll), c'est bg-2 qui continue — pas de bande claire. */
  background-color: var(--bg-2);
  background-image: linear-gradient(180deg, var(--bg-1), var(--bg-2));
  background-repeat: no-repeat;
}

body {
  font-family: ui-rounded, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior: none;
}

.screen {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  padding: calc(env(safe-area-inset-top) + 16px) 24px calc(env(safe-area-inset-bottom) + 20px);
}

.hidden { display: none !important; }

/* ---- En-tête ---- */

.app-header {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: 21px;
  font-weight: 800;
  letter-spacing: -0.3px;
  color: var(--accent-strong);
}

.app-header .logo { font-size: 24px; }

/* ---- Accueil ---- */

.home-center {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 10px;
}

.home-center .label {
  font-size: 21px;
  color: var(--text-soft);
  font-weight: 600;
}

.home-center .breast-name {
  font-size: 66px;
  font-weight: 800;
  letter-spacing: -1px;
}

.home-center .when {
  font-size: 26px;
  color: var(--text-soft);
  font-weight: 600;
}

.home-center .elapsed {
  font-size: 17px;
  font-weight: 700;
  color: var(--accent-strong);
  background: color-mix(in srgb, var(--accent) 14%, transparent);
  padding: 6px 16px;
  border-radius: 999px;
  margin-top: 6px;
}

.home-center .bottle {
  font-size: 72px;
  animation: float 3s ease-in-out infinite;
}

@keyframes pop {
  0% { transform: scale(0.85); opacity: 0; }
  100% { transform: scale(1); opacity: 1; }
}

@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-10px); }
}

.actions {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

/* ---- Boutons ---- */

.btn {
  border: none;
  border-radius: 22px;
  font-family: inherit;
  font-size: 22px;
  font-weight: 700;
  padding: 18px;
  cursor: pointer;
  transition: transform 0.1s ease, filter 0.15s ease;
}

.btn:active { transform: scale(0.96); }

.btn.primary {
  background: linear-gradient(135deg, var(--accent), var(--accent-strong));
  color: #fff;
  box-shadow: var(--shadow);
}

.btn.secondary {
  background: var(--card);
  color: var(--accent-strong);
  border: 2px solid var(--border);
}

.btn-text {
  background: none;
  border: none;
  font-family: inherit;
  font-size: 17px;
  font-weight: 700;
  color: var(--accent-strong);
  cursor: pointer;
  padding: 8px;
}

/* ---- Historique ---- */

.panel {
  background: linear-gradient(180deg, var(--bg-1), var(--bg-2));
  z-index: 10;
  overflow-y: auto;
  animation: slide-up 0.25s ease;
}

@keyframes slide-up {
  from { transform: translateY(30px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 12px;
}

.panel-header h1 {
  font-size: 28px;
  font-weight: 800;
}

#history-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

#history-list li {
  display: flex;
  align-items: center;
  gap: 14px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 14px 16px;
  box-shadow: 0 2px 10px rgba(47, 123, 214, 0.06);
}

.badge {
  flex-shrink: 0;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 18px;
  color: var(--accent-strong);
  background: color-mix(in srgb, var(--accent) 15%, transparent);
}

.row-text { flex: 1; min-width: 0; }

.row-text .row-breast {
  font-weight: 700;
  font-size: 17px;
}

.row-text .row-when {
  color: var(--text-soft);
  font-size: 15px;
  font-weight: 500;
}

.row-delete {
  background: none;
  border: none;
  color: var(--text-soft);
  font-size: 20px;
  padding: 8px;
  cursor: pointer;
}

.sync-info {
  background: none;
  border: none;
  font-family: inherit;
  color: var(--text-soft);
  font-size: 13px;
  font-weight: 600;
  padding: 0 0 12px;
  text-align: left;
  cursor: pointer;
}

.empty {
  text-align: center;
  color: var(--text-soft);
  font-size: 18px;
  margin-top: 40vh;
  transform: translateY(-50%);
}

/* ---- Feuille (choix du sein, code famille) ---- */

.sheet { position: fixed; inset: 0; z-index: 20; }

.sheet-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(10, 25, 45, 0.4);
  animation: fade-in 0.2s ease;
}

@keyframes fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

.sheet-panel {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  background: var(--card);
  border-radius: 28px 28px 0 0;
  padding: 12px 24px calc(env(safe-area-inset-bottom) + 28px);
  text-align: center;
  animation: sheet-up 0.25s ease;
  box-shadow: 0 -10px 40px rgba(0, 0, 0, 0.15);
}

@keyframes sheet-up {
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
}

.sheet-grip {
  width: 40px;
  height: 5px;
  border-radius: 3px;
  background: var(--border);
  margin: 0 auto 16px;
}

.sheet-panel h2 {
  font-size: 26px;
  font-weight: 800;
  margin-bottom: 6px;
}

.hint {
  color: var(--text-soft);
  font-size: 15px;
  font-weight: 500;
  min-height: 20px;
  margin-bottom: 18px;
}

.picker-buttons {
  display: flex;
  gap: 14px;
}

.btn.breast {
  flex: 1;
  padding: 36px 0;
  font-size: 24px;
  background: color-mix(in srgb, var(--text-soft) 14%, var(--card));
  color: var(--text);
}

.btn.breast.suggested {
  background: linear-gradient(135deg, var(--accent), var(--accent-strong));
  color: #fff;
  box-shadow: var(--shadow);
}

#setup-input {
  width: 100%;
  border: 2px solid var(--border);
  border-radius: 16px;
  background: var(--bg-1);
  color: var(--text);
  font-family: inherit;
  font-size: 20px;
  font-weight: 600;
  text-align: center;
  padding: 14px;
  outline: none;
}

#setup-input:focus { border-color: var(--accent); }

.setup-error {
  color: var(--accent-strong);
  font-size: 14px;
  font-weight: 600;
  min-height: 20px;
  margin: 6px 0;
}

.btn.full { width: 100%; margin-bottom: 6px; }

/* ---- Célébration après enregistrement ---- */

.celebration {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}

.celebration-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  background: var(--card);
  border-radius: 28px;
  padding: 28px 40px;
  box-shadow: var(--shadow);
  animation: celebrate-pop 0.45s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.celebration.leaving .celebration-card {
  animation: celebrate-out 0.3s ease forwards;
}

.celebration-emoji { font-size: 64px; animation: wiggle 0.7s ease; }

.celebration-text {
  font-size: 22px;
  font-weight: 800;
  color: var(--accent-strong);
}

@keyframes celebrate-pop {
  0% { transform: scale(0.4); opacity: 0; }
  100% { transform: scale(1); opacity: 1; }
}

@keyframes celebrate-out {
  to { transform: scale(0.85); opacity: 0; }
}

@keyframes wiggle {
  0%, 100% { transform: rotate(0); }
  25% { transform: rotate(-14deg); }
  60% { transform: rotate(12deg); }
}

.bubble {
  position: fixed;
  bottom: -40px;
  font-size: 28px;
  animation: bubble-rise var(--dur, 1.2s) ease-out forwards;
  pointer-events: none;
}

@keyframes bubble-rise {
  0% { transform: translateY(0) scale(0.6); opacity: 0; }
  15% { opacity: 1; }
  100% { transform: translateY(calc(-60vh - 40px)) scale(1.15) rotate(var(--spin, 0deg)); opacity: 0; }
}
