/* The kid's listener: always dark, readable from across a room. */

:root {
  --bg: #0b1020;
  --panel: #151b30;
  --line: #2a3352;
  --text: #eef1fa;
  --muted: #98a2c0;
  --accent: #6ea8ff;
  --accent-ink: #06122b;
  --ok: #3ddc97;
  --warn: #ffb020;
  --alert-bg: #ffd400;
  --alert-ink: #1a1400;
  color-scheme: dark;
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 18px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-text-size-adjust: 100%;
}

main {
  min-height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px 16px;
  padding-bottom: max(24px, env(safe-area-inset-bottom));
  text-align: center;
}

[hidden] { display: none !important; }

h1 { font-size: 1.4rem; font-weight: 600; margin: 0 0 8px; letter-spacing: 0.01em; }
.muted { color: var(--muted); }
.small { font-size: 0.85rem; }
.error { color: #ff8c8c; margin: 4px 0 0; }

button {
  font: inherit;
  cursor: pointer;
  border-radius: 12px;
  border: 1px solid transparent;
  padding: 12px 22px;
  min-height: 48px;
}
button:focus-visible, input:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
button:disabled { opacity: 0.6; cursor: default; }
.primary { background: var(--accent); color: var(--accent-ink); font-weight: 700; }
.ghost { background: transparent; color: var(--muted); border-color: var(--line); margin-top: 28px; }
.big { font-size: 1.15rem; padding: 16px 26px; }

/* ----- sign in ----- */

.panel {
  width: 100%;
  max-width: 380px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 28px 24px;
  text-align: left;
}
.panel form { display: grid; gap: 8px; margin-top: 16px; }
.panel label { font-size: 0.9rem; color: var(--muted); margin-top: 6px; }
.panel input {
  font: inherit;
  width: 100%;
  padding: 12px 14px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: #0e1428;
  color: var(--text);
}
.panel .primary { margin-top: 14px; width: 100%; }

/* ----- idle screen ----- */

.status {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 0.9rem;
  margin-bottom: 20px;
  max-width: 34ch;
}
.dot { width: 10px; height: 10px; border-radius: 50%; background: var(--warn); flex: none; }
.dot.on { background: var(--ok); box-shadow: 0 0 0 4px rgba(61, 220, 151, 0.18); }

.clock {
  font-size: clamp(3.5rem, 18vw, 8rem);
  font-weight: 200;
  line-height: 1;
  font-variant-numeric: tabular-nums;
  margin-top: 8px;
}
.date { color: var(--muted); margin-top: 8px; }

.next {
  margin-top: 36px;
  padding: 18px 24px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--panel);
  min-width: min(100%, 320px);
}
.next .label { font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.12em; color: var(--muted); }
.next-title { font-size: 1.4rem; font-weight: 600; margin: 4px 0 2px; overflow-wrap: anywhere; }

/* ----- sound banner ----- */

.banner {
  position: fixed;
  inset: auto 0 0 0;
  padding: 16px;
  padding-bottom: max(16px, env(safe-area-inset-bottom));
  background: #1d2440;
  border-top: 1px solid var(--line);
  z-index: 5;
}
.banner p { margin: 0 0 10px; color: var(--muted); font-size: 0.95rem; }
.banner .big { width: min(100%, 420px); }

/* ----- Stage 1: calm heads-up cards ----- */

.cards {
  position: fixed;
  top: 16px;
  left: 50%;
  transform: translateX(-50%);
  width: min(calc(100% - 32px), 440px);
  display: grid;
  gap: 12px;
  z-index: 4;
}
.card {
  background: #18223f;
  border: 1px solid #36508a;
  border-radius: 16px;
  padding: 16px 18px;
  text-align: left;
  display: grid;
  grid-template-columns: 1fr auto;
  column-gap: 14px;
  align-items: center;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
}
.card-kicker { grid-column: 1; font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.12em; color: var(--accent); }
.card-title { grid-column: 1; font-size: 1.25rem; font-weight: 600; overflow-wrap: anywhere; }
.card-when { grid-column: 1; color: var(--muted); font-variant-numeric: tabular-nums; }
.card button { grid-column: 2; grid-row: 1 / span 3; }

/* ----- Stage 2: full-screen, high contrast ----- */

.alert {
  position: fixed;
  inset: 0;
  z-index: 10;
  background: var(--alert-bg);
  color: var(--alert-ink);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2vh;
  padding: 24px;
  animation: pulse 1.2s ease-in-out infinite alternate;
}
.alert-kicker { font-size: clamp(1.2rem, 4vw, 2rem); font-weight: 600; text-transform: uppercase; letter-spacing: 0.14em; }
.alert-title {
  font-size: clamp(2.4rem, 11vw, 7rem);
  font-weight: 800;
  line-height: 1.05;
  overflow-wrap: anywhere;
  max-width: 16ch;
}
.ack {
  margin-top: 4vh;
  font-size: clamp(1.6rem, 6vw, 3.2rem);
  font-weight: 800;
  padding: 0.6em 1.2em;
  min-height: 96px;
  border-radius: 24px;
  background: var(--alert-ink);
  color: var(--alert-bg);
  border: 4px solid var(--alert-ink);
  box-shadow: 0 12px 0 rgba(0, 0, 0, 0.25);
}
.ack:active { transform: translateY(6px); box-shadow: 0 6px 0 rgba(0, 0, 0, 0.25); }
.ack:focus-visible { outline: 6px solid #fff; outline-offset: 4px; }
.alert-more { min-height: 1.5em; font-weight: 600; }

@keyframes pulse {
  from { background: #ffd400; }
  to { background: #ff9d00; }
}

@media (prefers-reduced-motion: reduce) {
  .alert { animation: none; }
}
