/* =============================================================
   Homestead Homeschool — TV-friendly distraction-free video app
   Designed for laptop -> HDMI -> TV. Big text. High contrast.
   ============================================================= */

:root {
  --bg: #1a1410;
  --bg-elev: #2a201a;
  --bg-elev-2: #3a2c20;
  --accent: #d97706;
  --accent-hover: #f59e0b;
  --mushroom-brown: #8b5a3c;
  --leaf: #5b7a3a;
  --text: #f5e9d3;
  --text-muted: #a99e8c;
  --text-dim: #6b6357;
  --danger: #c44536;
  --radius: 12px;
  --radius-lg: 20px;
  --shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
[hidden] { display: none !important; }

html, body {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 20px;
  line-height: 1.5;
  min-height: 100vh;
  overflow-x: hidden;
}

a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; border: none; background: none; color: inherit; }

/* =============================================================
   HOME PAGE — theme header + card grid
   ============================================================= */

.home-page {
  background:
    radial-gradient(ellipse at top, rgba(217, 119, 6, 0.08), transparent 60%),
    var(--bg);
  min-height: 100vh;
  padding-bottom: 60px;
}

.theme-header {
  padding: 64px 72px 48px;
  border-bottom: 1px solid var(--bg-elev);
  background: linear-gradient(180deg, rgba(139, 90, 60, 0.15), transparent);
}

.theme-header-inner {
  max-width: 1400px;
  margin: 0 auto;
}

.theme-eyebrow {
  font-size: 18px;
  text-transform: uppercase;
  letter-spacing: 2px;
  color: var(--accent);
  margin-bottom: 16px;
}

.theme-title {
  font-size: 64px;
  line-height: 1.05;
  font-weight: 700;
  margin-bottom: 12px;
  color: var(--text);
}

.theme-subtitle {
  font-size: 24px;
  color: var(--text-muted);
  margin-bottom: 24px;
}

.theme-description {
  font-size: 22px;
  color: var(--text);
  max-width: 900px;
  line-height: 1.55;
}

.cards-section {
  max-width: 1400px;
  margin: 0 auto;
  padding: 56px 72px 0;
}

.section-label {
  font-size: 20px;
  text-transform: uppercase;
  letter-spacing: 2px;
  color: var(--text-muted);
  margin-bottom: 28px;
  font-weight: 600;
}

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(360px, 1fr));
  gap: 28px;
}

.card {
  background: var(--bg-elev);
  border-radius: var(--radius-lg);
  overflow: hidden;
  transition: transform 0.18s ease, background 0.18s ease, box-shadow 0.18s ease;
  display: flex;
  flex-direction: column;
  border: 2px solid transparent;
  text-align: left;
  width: 100%;
  font-family: inherit;
  color: inherit;
}

.card:hover, .card:focus-within {
  background: var(--bg-elev-2);
  transform: translateY(-4px);
  box-shadow: var(--shadow);
  border-color: var(--accent);
  outline: none;
}

.card-open {
  display: flex;
  flex: 1;
  width: 100%;
  min-width: 0;
  padding: 0;
  flex-direction: column;
  border: 0;
  color: inherit;
  background: transparent;
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.card-open:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: -3px;
}

.card-actions {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  padding: 10px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.card-action {
  min-height: 44px;
  padding: 8px 10px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 9px;
  color: var(--text-muted);
  background: rgba(255, 255, 255, 0.035);
  font: inherit;
  font-size: 13px;
  font-weight: 750;
  cursor: pointer;
}

.card-action:hover,
.card-action:focus-visible,
.card-action[aria-pressed="true"] {
  border-color: rgba(230, 166, 75, 0.55);
  color: var(--accent);
  background: rgba(230, 166, 75, 0.09);
  outline: none;
}

.card-action-block:hover,
.card-action-block:focus-visible {
  border-color: rgba(196, 69, 54, 0.7);
  color: #f09a8f;
  background: rgba(196, 69, 54, 0.12);
}

/* Loading skeleton tiles — pulse-animated placeholders that match the
   card shape so the layout doesn't reflow when real content arrives. */
.card-skeleton {
  background: var(--bg-elev, #1f1f1f);
  cursor: default;
  pointer-events: none;
}
.card-skeleton:hover, .card-skeleton:focus-visible {
  transform: none;
  box-shadow: none;
  border-color: transparent;
}
.card-skeleton-thumb {
  background: linear-gradient(90deg, #2a2a2a 0%, #3a3a3a 50%, #2a2a2a 100%);
  background-size: 200% 100%;
  animation: skeleton-shimmer 1.4s ease-in-out infinite;
}
.card-skeleton-line {
  background: linear-gradient(90deg, #2a2a2a 0%, #3a3a3a 50%, #2a2a2a 100%);
  background-size: 200% 100%;
  animation: skeleton-shimmer 1.4s ease-in-out infinite;
  border-radius: 4px;
}
@keyframes skeleton-shimmer {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* Empty-category state — for categories that have zero themes yet
   (e.g. music_and_movement while the catalog cron is still filling). */
.empty-category {
  grid-column: 1 / -1;
  padding: 56px 24px;
  text-align: center;
  background: var(--bg-elev, #1a1a1a);
  border: 1px dashed var(--border, #333);
  border-radius: 12px;
}
.empty-category-icon { font-size: 56px; line-height: 1; margin-bottom: 4px; }

/* Active-kid chip in the header — small pill that shows which kid the
   grid is filtered for. Tap to switch (links to select-kid.html). */
.active-kid-chip {
  position: absolute;
  top: 22px;
  right: 84px;  /* leave room for the parent-gear at right: 16px (52px wide + 16px gap) */
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  border-radius: 999px;
  background: rgba(42, 32, 26, 0.7);
  border: 1.5px solid rgba(255, 255, 255, 0.12);
  color: var(--text, #ddd);
  font-size: 15px;
  font-weight: 600;
  text-decoration: none;
  z-index: 5;
  transition: background 0.15s ease, border-color 0.15s ease;
  min-height: 40px;
}
.active-kid-chip:hover { background: var(--bg-elev-2); border-color: var(--accent); }
.active-kid-chip-emoji { font-size: 20px; line-height: 1; }
.active-kid-chip-name { line-height: 1; }
@media (max-width: 600px) {
  .active-kid-chip { font-size: 13px; padding: 6px 12px; right: 76px; }
  .active-kid-chip-emoji { font-size: 17px; }
}

/* Watched state — fades the tile so already-seen content visually
   recedes. The .card-watched-badge in the top-right corner keeps
   the watched signal explicit even at a glance. */
.card.watched {
  opacity: 0.55;
}
.card.watched:hover, .card.watched:focus-within {
  opacity: 1;
}
.card-watched-badge {
  position: absolute;
  top: 6px;
  right: 6px;
  background: rgba(106, 168, 79, 0.92);
  color: #fff;
  font-size: 11px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 999px;
  letter-spacing: 0.02em;
  z-index: 2;
  pointer-events: none;
}

.card-thumb {
  position: relative;
  aspect-ratio: 16 / 9;
  background: #000;
  overflow: hidden;
}

.card-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.card-thumb-fallback {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 80px;
  background: linear-gradient(135deg, var(--mushroom-brown), var(--bg-elev-2));
}

.card-number {
  position: absolute;
  top: 12px;
  left: 12px;
  background: rgba(0, 0, 0, 0.85);
  color: var(--accent);
  font-weight: 700;
  font-size: 18px;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid var(--accent);
}

.card-platform-tag {
  position: absolute;
  bottom: 12px;
  right: 12px;
  background: rgba(0, 0, 0, 0.85);
  color: var(--text);
  font-size: 14px;
  padding: 4px 10px;
  border-radius: 4px;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.card-platform-tag.external { background: rgba(196, 69, 54, 0.9); }
.card-platform-tag.tbd { background: rgba(217, 119, 6, 0.9); color: #1a1410; }

.card-body { padding: 22px 24px 24px; flex: 1; display: flex; flex-direction: column; }

.card-title {
  font-size: 24px;
  font-weight: 600;
  line-height: 1.3;
  margin-bottom: 8px;
  color: var(--text);
}

.card-meta {
  font-size: 16px;
  color: var(--text-muted);
  margin-bottom: 12px;
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.card-meta span:not(:last-child)::after {
  content: "·";
  margin-left: 12px;
  color: var(--text-dim);
}

.card-notes {
  font-size: 17px;
  color: var(--text-muted);
  margin-top: auto;
  font-style: italic;
}

.page-footer {
  max-width: 1400px;
  margin: 60px auto 0;
  padding: 0 72px;
  color: var(--text-dim);
  font-size: 16px;
}

/* =============================================================
   PLAYER PAGE — distraction-free video viewer
   ============================================================= */

.player-page {
  background: #000;
  overflow-y: auto;
}

.player-shell {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: auto minmax(200px, 1fr) auto;
  width: 100%;
  height: 100vh;
  height: 100dvh;
}

.player-topbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 32px;
  /* 16px+ inset on every edge so kid's thumb gripping the tablet doesn't
     trigger edge buttons accidentally (per docs/vision.md §6 Phase 1).
     Top: respect notch via env(safe-area-inset-top). */
  padding: max(20px, env(safe-area-inset-top)) max(32px, env(safe-area-inset-right)) 20px max(32px, env(safe-area-inset-left));
  background: linear-gradient(180deg, rgba(0, 0, 0, 0.95), rgba(0, 0, 0, 0.6));
  border-bottom: 1px solid var(--bg-elev);
}

.btn-back {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--bg-elev);
  padding: 14px 24px;
  border-radius: var(--radius);
  font-size: 20px;
  font-weight: 600;
  transition: background 0.15s;
  border: 2px solid transparent;
}

.btn-back:hover, .btn-back:focus-visible {
  background: var(--bg-elev-2);
  border-color: var(--accent);
  outline: none;
}

.back-arrow { font-size: 24px; }

.btn-fullscreen {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--bg-elev);
  padding: 14px 22px;
  border-radius: var(--radius);
  font-size: 18px;
  font-weight: 600;
  border: 2px solid transparent;
  transition: background 0.15s, border-color 0.15s;
  flex-shrink: 0;
  color: var(--text);
  font-family: inherit;
  cursor: pointer;
}

.btn-fullscreen:hover, .btn-fullscreen:focus-visible {
  background: var(--bg-elev-2);
  border-color: var(--accent);
  outline: none;
}

.player-meta { flex: 1 1 120px; min-width: 0; }

.player-position {
  font-size: 14px;
  text-transform: uppercase;
  letter-spacing: 2px;
  color: var(--accent);
  margin-bottom: 4px;
}

.player-title {
  font-size: 26px;
  font-weight: 600;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--text);
}

.player-channel {
  font-size: 16px;
  color: var(--text-muted);
}

.video-wrapper {
  position: relative;
  min-width: 0;
  min-height: 200px;
  background: #000;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

#yt-player {
  width: 100%;
  height: 100%;
  position: relative;
  z-index: 1;
}

#yt-player iframe {
  width: 100%;
  height: 100%;
  border: 0;
  display: block;
}

.end-card, .error-card {
  position: absolute;
  inset: 0;
  background: var(--bg);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  overflow-y: auto;
  padding: clamp(20px, 5vw, 48px);
  text-align: center;
  z-index: 20;          /* above all the iframe masks */
}

/* Center a short card, but keep the beginning and actions scrollable when
   it is taller than the player. Flex auto margins collapse on overflow. */
.end-card > *, .error-card > * { flex-shrink: 0; max-width: 100%; }
.end-card > :first-child, .error-card > :first-child { margin-top: auto; }
.end-card > :last-child, .error-card > :last-child { margin-bottom: auto; }

.end-card h2, .error-card h2 {
  font-size: 56px;
  margin-bottom: 20px;
  color: var(--accent);
}

.end-card p, .error-card p {
  font-size: 24px;
  margin-bottom: 36px;
  color: var(--text);
  max-width: 800px;
}

.error-actions {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  justify-content: center;
}

.player-bottom {
  background: linear-gradient(0deg, rgba(0, 0, 0, 0.96), rgba(0, 0, 0, 0.78));
  border-top: 1px solid var(--bg-elev);
  /* 16px+ inset; bottom respects iOS home indicator via safe-area-inset-bottom. */
  padding: 18px max(28px, env(safe-area-inset-right)) max(22px, env(safe-area-inset-bottom)) max(28px, env(safe-area-inset-left));
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.progress-row {
  display: flex;
  align-items: center;
  gap: 18px;
}

.time-label {
  font-size: 18px;
  font-variant-numeric: tabular-nums;
  color: var(--text);
  min-width: 64px;
  text-align: center;
}

.progress-bar {
  flex: 1;
  position: relative;
  height: 24px;                 /* big easy hit target */
  cursor: pointer;
  display: flex;
  align-items: center;
}

.progress-bar:focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; border-radius: 6px; }

.progress-track {
  position: relative;
  width: 100%;
  height: 8px;
  background: var(--bg-elev);
  border-radius: 999px;
  overflow: visible;
  transition: height 0.12s ease;
}

.progress-bar:hover .progress-track,
.progress-bar:focus-visible .progress-track {
  height: 12px;
}

.progress-fill {
  position: absolute;
  inset: 0 auto 0 0;
  width: 0%;
  background: var(--accent);
  border-radius: 999px;
  transition: width 0.1s linear;
}

.progress-thumb {
  position: absolute;
  top: 50%;
  left: 0%;
  transform: translate(-50%, -50%);
  width: 18px;
  height: 18px;
  background: var(--accent);
  border: 3px solid var(--text);
  border-radius: 50%;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.6);
  transition: width 0.12s, height 0.12s;
  pointer-events: none;
}

.progress-bar:hover .progress-thumb,
.progress-bar:focus-visible .progress-thumb {
  width: 22px;
  height: 22px;
}

.chapter-ticks {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.chapter-tick {
  position: absolute;
  top: 50%;
  width: 3px;
  height: 16px;
  background: var(--text);
  opacity: 0.55;
  border-radius: 2px;
  transform: translate(-50%, -50%);
}

.chapters-row {
  display: flex;
  align-items: center;
  gap: 14px;
  overflow: hidden;
}

.chapters-label {
  font-size: 14px;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: var(--text-muted);
  flex-shrink: 0;
}

.chapters-list {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--bg-elev-2) transparent;
  padding-bottom: 4px;
}

.chapters-list::-webkit-scrollbar { height: 6px; }
.chapters-list::-webkit-scrollbar-thumb { background: var(--bg-elev-2); border-radius: 4px; }

.chapter-pill {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  background: var(--bg-elev);
  border: 1px solid transparent;
  border-radius: 999px;
  font-size: 15px;
  color: var(--text);
  cursor: pointer;
  transition: background 0.12s, border-color 0.12s;
  white-space: nowrap;
}

.chapter-pill:hover, .chapter-pill:focus-visible {
  background: var(--bg-elev-2);
  border-color: var(--accent);
  outline: none;
}

.chapter-pill.active {
  background: var(--accent);
  color: var(--bg);
  border-color: var(--text);
}

.chapter-pill .chapter-time {
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  opacity: 0.85;
  font-size: 13px;
}

.player-controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding-top: 4px;
}

.btn-skip-back, .btn-skip-fwd {
  background: transparent;
  border: 2px solid var(--bg-elev-2);
  min-width: 110px;
}

.btn-skip-back:hover, .btn-skip-back:focus-visible,
.btn-skip-fwd:hover, .btn-skip-fwd:focus-visible {
  background: var(--bg-elev);
  border-color: var(--accent);
}

.btn-control {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 32px;
  background: var(--bg-elev);
  border-radius: var(--radius);
  font-size: 22px;
  font-weight: 600;
  min-width: 160px;
  justify-content: center;
  transition: background 0.15s, transform 0.1s, border-color 0.15s;
  border: 2px solid transparent;
  color: var(--text);
}

.btn-control:hover, .btn-control:focus-visible {
  background: var(--bg-elev-2);
  border-color: var(--accent);
  outline: none;
}

.btn-control:active { transform: scale(0.97); }

.btn-control:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  background: var(--bg-elev);
}

.btn-play-pause {
  background: var(--accent);
  color: var(--bg);
  min-width: 200px;
}

.btn-play-pause:hover, .btn-play-pause:focus-visible {
  background: var(--accent-hover);
  border-color: var(--text);
}

.control-icon {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  flex: 0 0 28px;
  line-height: 1;
}
.media-svg {
  width: 100%;
  height: 100%;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.media-svg.icon-fill { fill: currentColor; stroke: none; }
.icon-contract,
.icon-pause { display: none; }
.btn-fullscreen.is-fullscreen .icon-expand,
.btn-play-pause.is-playing .icon-play { display: none; }
.btn-fullscreen.is-fullscreen .icon-contract,
.btn-play-pause.is-playing .icon-pause { display: block; }
.skip-icon .media-svg { position: absolute; inset: 0; }
.skip-forward .media-svg { transform: scaleX(-1); }
.skip-number {
  position: relative;
  z-index: 1;
  padding-top: 4px;
  font-size: 8px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.5px;
}
.control-label { font-size: 20px; }

.btn-primary {
  display: inline-block;
  background: var(--accent);
  color: var(--bg);
  padding: 16px 36px;
  border-radius: var(--radius);
  font-size: 22px;
  font-weight: 600;
  border: 2px solid transparent;
  transition: background 0.15s;
}

.btn-primary:hover, .btn-primary:focus-visible {
  background: var(--accent-hover);
  border-color: var(--text);
  outline: none;
}

.btn-secondary {
  display: inline-block;
  background: var(--bg-elev);
  color: var(--text);
  padding: 16px 32px;
  border-radius: var(--radius);
  font-size: 20px;
  font-weight: 600;
  border: 2px solid transparent;
  transition: background 0.15s;
}

.btn-secondary:hover, .btn-secondary:focus-visible {
  background: var(--bg-elev-2);
  border-color: var(--accent);
  outline: none;
}

/* =============================================================
   Loading / error states on home
   ============================================================= */

.loading, .error-banner {
  text-align: center;
  padding: 60px 24px;
  font-size: 22px;
  color: var(--text-muted);
}

.error-banner {
  color: var(--danger);
  background: rgba(196, 69, 54, 0.08);
  border-radius: var(--radius);
  border: 1px solid rgba(196, 69, 54, 0.3);
  margin: 32px 0;
}

/* =============================================================
   Responsive — phones, tablets, and TV
   ============================================================= */

/* --- Tablet portrait & small laptops --- */
@media (max-width: 1024px) {
  .theme-header { padding: 48px 36px 32px; }
  .theme-title { font-size: 48px; }
  .theme-subtitle { font-size: 20px; }
  .theme-description { font-size: 19px; }
  .cards-section { padding: 36px 36px 0; }
  .card-grid { grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 22px; }
  .page-footer { padding: 0 36px; }
}

/* --- Large phone / small tablet --- */
@media (max-width: 768px) {
  /* Home page */
  .theme-header { padding: 32px 24px 24px; }
  .theme-title { font-size: 36px; }
  .theme-subtitle { font-size: 18px; margin-bottom: 18px; }
  .theme-description { font-size: 17px; }
  .cards-section { padding: 28px 24px 0; }
  .card-grid { grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 16px; }
  .card-title { font-size: 20px; }
  .card-meta { font-size: 14px; }
  .card-notes { font-size: 15px; }
  .page-footer { padding: 0 24px; }

  /* Player topbar — 16px inset minimum on tablet (vision §6 Phase 1) */
  .player-topbar { padding: max(12px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right)) 12px max(16px, env(safe-area-inset-left)); gap: 12px; }
  .player-title { font-size: 17px; white-space: normal; line-height: 1.25; }
  .player-position { font-size: 12px; letter-spacing: 1.5px; }
  .player-channel { font-size: 13px; }
  .btn-back { padding: 10px 14px; font-size: 16px; }
  .btn-back .back-label { display: none; }
  .btn-fullscreen { padding: 10px 14px; font-size: 16px; }
  .btn-fullscreen .control-label { display: none; }

  /* Bottom controls — icons only, tight spacing; 16px edge inset on tablet */
  .player-bottom { padding: 12px max(16px, env(safe-area-inset-right)) max(14px, env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left)); gap: 8px; }
  .progress-row { gap: 12px; }
  .time-label { min-width: 48px; font-size: 14px; }
  .progress-track { height: 6px; }
  .progress-bar:hover .progress-track { height: 10px; }

  .chapters-row { gap: 10px; }
  .chapters-label { font-size: 12px; }
  .chapter-pill { font-size: 13px; padding: 6px 10px; }

  .player-controls { gap: 8px; padding-top: 2px; }
  .btn-control {
    min-width: 0;
    padding: 12px 14px;
    font-size: 14px;
    gap: 0;
  }
  .btn-control .control-label { display: none; }
  .btn-skip-back, .btn-skip-fwd { min-width: 0; }
  .btn-play-pause { min-width: 64px; padding: 12px 18px; }
  .control-icon { width: 22px; height: 22px; flex-basis: 22px; }
}

/* --- Phones --- */
@media (max-width: 480px) {
  .theme-header { padding: 24px 16px 20px; }
  .theme-title { font-size: 28px; }
  .theme-subtitle { font-size: 16px; }
  .cards-section { padding: 20px 16px 0; }
  .card-grid { grid-template-columns: 1fr; gap: 14px; }
  .page-footer { padding: 0 16px; }

  .player-topbar { padding: max(10px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right)) 10px max(16px, env(safe-area-inset-left)); gap: 10px; }
  .player-title { font-size: 16px; }
  .player-channel { display: none; }       /* claw back vertical space */
  .btn-back, .btn-fullscreen { padding: 9px 12px; }
  .back-arrow { font-size: 22px; }

  .player-bottom { padding: 10px max(16px, env(safe-area-inset-right)) max(12px, env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left)); gap: 6px; }
  .progress-row { gap: 8px; }
  .time-label { min-width: 42px; font-size: 13px; }

  .player-controls { gap: 6px; }
  .btn-control { padding: 11px 10px; }
  .btn-play-pause { min-width: 56px; padding: 11px 14px; }
  .control-icon { width: 20px; height: 20px; flex-basis: 20px; }
}

/* Short landscape screens need a height-aware compact mode. Width-only
   breakpoints miss modern phones turned sideways and caused the right edge
   of both the header and transport controls to be clipped. */
@media (max-height: 600px) and (orientation: landscape) {
  .player-shell { grid-template-rows: auto minmax(200px, 1fr) auto; }
  .player-topbar {
    gap: 14px;
    padding: max(10px, env(safe-area-inset-top)) max(18px, env(safe-area-inset-right)) 10px max(18px, env(safe-area-inset-left));
  }
  .player-position { margin-bottom: 1px; font-size: 11px; letter-spacing: 1.5px; }
  .player-title { font-size: 18px; }
  .player-channel { font-size: 12px; }
  .btn-back,
  .btn-fullscreen { gap: 8px; padding: 10px 14px; font-size: 15px; }
  .player-bottom {
    gap: 6px;
    padding: 8px max(18px, env(safe-area-inset-right)) max(10px, env(safe-area-inset-bottom)) max(18px, env(safe-area-inset-left));
  }
  .progress-row { gap: 10px; }
  .time-label { min-width: 44px; font-size: 14px; }
  .player-controls { gap: 8px; padding-top: 0; }
  .btn-control {
    flex: 1 1 0;
    min-width: 0;
    max-width: 180px;
    gap: 8px;
    padding: 10px 12px;
    font-size: 16px;
  }
  .btn-skip-back,
  .btn-skip-fwd,
  .btn-play-pause { min-width: 0; }
  .btn-play-pause { flex-grow: 1.15; }
  .control-icon { width: 24px; height: 24px; flex-basis: 24px; }
  .control-label { font-size: 16px; }
}

@media (max-height: 480px) and (orientation: landscape) {
  .player-channel { display: none; }
  .btn-back .back-label,
  .btn-fullscreen .control-label { display: none; }
}

/* =============================================================
   PARENT PAGE — sign-in card + dashboard
   ============================================================= */

.parent-page {
  background:
    radial-gradient(ellipse at top, rgba(217, 119, 6, 0.08), transparent 60%),
    var(--bg);
  min-height: 100vh;
}

/* ---- Loading shell ---- */
.loading-shell {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  color: var(--text-muted);
  font-size: 18px;
}

/* ---- Signed-out (sign-in card) ---- */
.signed-out-shell {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 24px;
}

.signed-out-card {
  background: var(--bg-elev);
  border-radius: var(--radius-lg);
  padding: 56px 56px 40px;
  max-width: 520px;
  width: 100%;
  box-shadow: var(--shadow);
  text-align: center;
}

.signed-out-eyebrow {
  font-size: 14px;
  text-transform: uppercase;
  letter-spacing: 2px;
  color: var(--accent);
  margin-bottom: 12px;
}

.signed-out-card h1 {
  font-size: 36px;
  margin-bottom: 12px;
  color: var(--text);
}

.signed-out-blurb {
  font-size: 17px;
  color: var(--text-muted);
  margin-bottom: 32px;
}

.clerk-mount {
  display: flex;
  justify-content: center;
  margin-bottom: 24px;
}

.signed-out-footer {
  font-size: 14px;
  color: var(--text-dim);
  border-top: 1px solid var(--bg-elev-2);
  padding-top: 20px;
  margin-top: 20px;
}

.signed-out-footer a {
  color: var(--accent);
  text-decoration: underline;
}

/* ---- Dashboard ---- */
.dashboard-shell {
  max-width: 1200px;
  margin: 0 auto;
  padding: 48px 48px 80px;
}

.dashboard-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  border-bottom: 1px solid var(--bg-elev);
  padding-bottom: 32px;
  margin-bottom: 40px;
}

/* Slim variant: less vertical real estate, no border, smaller title.
   Used wherever the bottom tab bar handles primary nav so we don't
   need a heavy header on top of that. */
.dashboard-header-slim {
  border-bottom: 0;
  padding-bottom: 14px;
  margin-bottom: 18px;
}
.dashboard-header-slim .dashboard-title {
  font-size: 26px;
  margin-bottom: 2px;
}
.dashboard-header-slim .dashboard-subtitle {
  font-size: 14px;
}

.dashboard-header-meta { flex: 1; min-width: 0; }

.dashboard-eyebrow {
  font-size: 14px;
  text-transform: uppercase;
  letter-spacing: 2px;
  color: var(--accent);
  margin-bottom: 10px;
}

.dashboard-title {
  font-size: 44px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 8px;
  line-height: 1.1;
}

.dashboard-subtitle {
  font-size: 17px;
  color: var(--text-muted);
}

.user-button-mount {
  flex-shrink: 0;
  padding-top: 8px;
}

.dashboard-section {
  margin-bottom: 40px;
}

.dashboard-section-title {
  font-size: 14px;
  text-transform: uppercase;
  letter-spacing: 2px;
  color: var(--text-muted);
  margin-bottom: 18px;
  font-weight: 600;
}

.dashboard-empty {
  background: var(--bg-elev);
  border: 1px dashed var(--bg-elev-2);
  border-radius: var(--radius);
  padding: 24px;
  color: var(--text-muted);
  font-size: 16px;
  line-height: 1.6;
}

.dashboard-links {
  list-style: none;
  padding: 0;
  margin: 0;
}

.dashboard-links li { margin-bottom: 10px; }

.dashboard-links a {
  color: var(--accent);
  font-size: 17px;
  text-decoration: underline;
}

/* ---- Kid cards ---- */
.kids-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 20px;
}

.kid-card {
  background: var(--bg-elev);
  border-radius: var(--radius-lg);
  padding: 24px 26px;
  border: 1px solid transparent;
}

.kid-card-name {
  font-size: 24px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 4px;
}

.kid-card-meta {
  font-size: 14px;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 1.5px;
  margin-bottom: 14px;
}

.kid-card-line {
  font-size: 15px;
  color: var(--text);
  margin-bottom: 6px;
  line-height: 1.45;
}

.kid-card-line strong {
  color: var(--text-muted);
  font-weight: 600;
}

.kid-card-notes {
  font-size: 14px;
  color: var(--text-muted);
  font-style: italic;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--bg-elev-2);
  line-height: 1.5;
}

/* Responsive — collapse padding on phones */
@media (max-width: 768px) {
  .dashboard-shell { padding: 28px 20px 60px; }
  .dashboard-header {
    flex-direction: column;
    align-items: stretch;
    gap: 16px;
    padding-bottom: 22px;
    margin-bottom: 28px;
  }
  .dashboard-title { font-size: 32px; }
  .signed-out-card { padding: 36px 24px 28px; }
  .signed-out-card h1 { font-size: 28px; }
  .kids-grid { grid-template-columns: 1fr; gap: 14px; }
}

/* ---- Activity log form + list ---- */

.activity-form {
  background: var(--bg-elev);
  border-radius: var(--radius-lg);
  padding: 22px 24px 18px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  border: 1px solid var(--bg-elev-2);
}

.activity-form-row {
  display: grid;
  grid-template-columns: minmax(140px, 1fr) minmax(140px, 1.2fr) minmax(160px, 1.4fr) 100px;
  gap: 14px;
}

.activity-form-row-bottom {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

.activity-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.activity-field-label {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  color: var(--text-muted);
  font-weight: 600;
}

.activity-hint {
  text-transform: none;
  letter-spacing: 0;
  color: var(--text-dim);
  font-weight: 400;
  margin-left: 6px;
  font-size: 11px;
}

.activity-form input[type="text"],
.activity-form input[type="number"],
.activity-form select,
.activity-form textarea {
  background: var(--bg);
  color: var(--text);
  border: 1.5px solid var(--bg-elev-2);
  border-radius: var(--radius);
  padding: 10px 14px;
  font-size: 16px;
  font-family: inherit;
  transition: border-color 0.15s;
}

.activity-form input:focus,
.activity-form select:focus,
.activity-form textarea:focus {
  outline: none;
  border-color: var(--accent);
}

.activity-form textarea {
  resize: vertical;
  min-height: 70px;
  line-height: 1.5;
}

.mood-picker {
  border: 1.5px solid var(--bg-elev-2);
  border-radius: var(--radius);
  padding: 8px 14px 10px;
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
}

.mood-picker legend {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  color: var(--text-muted);
  font-weight: 600;
  padding: 0 8px;
}

.mood-picker label {
  cursor: pointer;
  font-size: 26px;
  line-height: 1;
  padding: 4px 6px;
  border-radius: 8px;
  border: 2px solid transparent;
  transition: background 0.12s, border-color 0.12s;
  user-select: none;
}

.mood-picker label:hover { background: var(--bg-elev-2); }

.mood-picker input[type="radio"] {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.mood-picker input[type="radio"]:checked + span {
  display: inline-block;
  transform: scale(1.15);
}

.mood-picker label:has(input[type="radio"]:checked) {
  border-color: var(--accent);
  background: var(--bg);
}

.activity-form-actions {
  display: flex;
  align-items: center;
  gap: 14px;
}

.activity-form-msg {
  font-size: 14px;
  color: var(--text-muted);
}
.activity-form-msg[data-kind="error"] { color: var(--danger); }
.activity-form-msg[data-kind="ok"]    { color: var(--leaf); }

/* ---- Activity list ---- */

.activity-list {
  display: flex;
  flex-direction: column;
  gap: 28px;
}

.activity-loading,
.activity-empty {
  color: var(--text-muted);
  font-size: 16px;
  padding: 16px 4px;
}

.activity-day-heading {
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 2px;
  color: var(--accent);
  margin-bottom: 12px;
  font-weight: 600;
}

.activity-day {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.activity-entry {
  background: var(--bg-elev);
  border: 1px solid transparent;
  border-radius: var(--radius);
  padding: 14px 18px;
  transition: border-color 0.15s;
}

.activity-entry:hover { border-color: var(--bg-elev-2); }

.activity-entry-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  margin-bottom: 6px;
}

.activity-entry-kid {
  font-weight: 700;
  color: var(--text);
  font-size: 16px;
}

.activity-entry-subject {
  background: var(--bg-elev-2);
  color: var(--text);
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.activity-entry-source {
  color: var(--text-muted);
  font-size: 14px;
}
.activity-entry-source::before { content: "· "; color: var(--text-dim); }

.activity-entry-duration {
  color: var(--text-muted);
  font-size: 14px;
  font-variant-numeric: tabular-nums;
}
.activity-entry-duration::before { content: "· "; color: var(--text-dim); }

.activity-entry-mood {
  font-size: 18px;
  line-height: 1;
}

.activity-entry-time {
  margin-left: auto;
  color: var(--text-dim);
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}

.activity-entry-notes {
  color: var(--text);
  font-size: 15px;
  line-height: 1.55;
  margin: 4px 0 0;
}

@media (max-width: 768px) {
  .activity-form { padding: 16px 16px 14px; }
  .activity-form-row {
    grid-template-columns: 1fr 1fr;
  }
  .activity-form-row > .activity-field-kid { grid-column: 1 / -1; }
  .activity-form-row > .activity-field-narrow {
    grid-column: 1 / 2;
  }
  .activity-form-row-bottom {
    flex-direction: column;
    align-items: stretch;
  }
  .activity-form-actions {
    justify-content: space-between;
    width: 100%;
  }
  .activity-entry-header { gap: 8px; font-size: 14px; }
  .activity-entry-time { margin-left: 0; width: 100%; order: 99; }
}

.dashboard-section-blurb {
  color: var(--text-muted);
  font-size: 15px;
  margin-bottom: 16px;
  line-height: 1.6;
  max-width: 700px;
}

/* ---- Curriculum form + list ---- */

.curriculum-form {
  background: var(--bg-elev);
  border-radius: var(--radius-lg);
  padding: 18px 22px 16px;
  margin-bottom: 18px;
  border: 1px solid var(--bg-elev-2);
}

.curriculum-form-row {
  display: grid;
  grid-template-columns: minmax(240px, 2fr) minmax(160px, 1fr) minmax(180px, 1.2fr);
  gap: 14px;
  margin-bottom: 12px;
}

.curriculum-field { display: flex; flex-direction: column; gap: 6px; }
.curriculum-field-label {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  color: var(--text-muted);
  font-weight: 600;
}

.curriculum-form input,
.curriculum-form select {
  background: var(--bg);
  color: var(--text);
  border: 1.5px solid var(--bg-elev-2);
  border-radius: var(--radius);
  padding: 10px 14px;
  font-size: 16px;
  font-family: inherit;
}
.curriculum-form input:focus,
.curriculum-form select:focus {
  outline: none;
  border-color: var(--accent);
}

.curriculum-form-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 14px;
}
.curriculum-form-msg { font-size: 14px; color: var(--text-muted); }
.curriculum-form-msg[data-kind="error"] { color: var(--danger); }
.curriculum-form-msg[data-kind="ok"]    { color: var(--leaf); }

.curriculum-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 10px;
}

.curriculum-empty {
  color: var(--text-muted);
  font-size: 15px;
  padding: 12px 4px;
  grid-column: 1 / -1;
}

.curriculum-item {
  background: var(--bg-elev);
  border-radius: var(--radius);
  padding: 12px 14px;
  display: flex;
  align-items: center;
  gap: 12px;
  border: 1px solid transparent;
  transition: border-color 0.12s;
}
.curriculum-item:hover { border-color: var(--bg-elev-2); }

.curriculum-icon { font-size: 24px; flex-shrink: 0; }

.curriculum-body { flex: 1; min-width: 0; }

.curriculum-name {
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
}

.curriculum-meta {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 2px;
}

.curriculum-delete {
  background: transparent;
  color: var(--text-dim);
  border: 1px solid transparent;
  border-radius: 6px;
  width: 44px;
  height: 44px;
  font-size: 16px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background 0.12s, color 0.12s, border-color 0.12s;
}
.curriculum-delete:hover {
  background: rgba(196, 69, 54, 0.15);
  color: var(--danger);
  border-color: var(--danger);
}

/* =============================================================
   PLANNER PAGE
   ============================================================= */

.planner-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 22px;
}

.planner-kid-tabs { display: flex; gap: 8px; flex-wrap: wrap; }
.planner-kid-tab {
  padding: 10px 18px;
  border: 1.5px solid var(--bg-elev-2);
  background: var(--bg-elev);
  color: var(--text);
  border-radius: 999px;
  cursor: pointer;
  font-size: 15px;
  font-weight: 600;
  transition: background 0.12s, border-color 0.12s, color 0.12s;
  font-family: inherit;
}
.planner-kid-tab:hover { background: var(--bg-elev-2); }
.planner-kid-tab.active {
  background: var(--accent);
  color: var(--bg);
  border-color: var(--accent);
}

.planner-week-nav {
  display: flex;
  align-items: center;
  gap: 12px;
}

.btn-week-nav {
  background: var(--bg-elev);
  border: 1.5px solid var(--bg-elev-2);
  color: var(--text);
  width: 44px;
  height: 44px;
  border-radius: 999px;
  font-size: 18px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: inherit;
  transition: background 0.12s, border-color 0.12s;
}
.btn-week-nav:hover { background: var(--bg-elev-2); border-color: var(--accent); }

.btn-week-today {
  background: var(--bg-elev);
  border: 1.5px solid var(--bg-elev-2);
  color: var(--text);
  padding: 8px 14px;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
}
.btn-week-today:hover { background: var(--bg-elev-2); border-color: var(--accent); }

.planner-week-label {
  font-size: 18px;
  font-weight: 600;
  color: var(--text);
  min-width: 240px;
  text-align: center;
}

.planner-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 10px;
  align-items: start;
}

.planner-loading {
  grid-column: 1 / -1;
  text-align: center;
  padding: 40px 0;
  color: var(--text-muted);
}

.planner-day {
  background: var(--bg-elev);
  border-radius: var(--radius);
  padding: 12px 10px 10px;
  min-height: 200px;
  display: flex;
  flex-direction: column;
  border: 1px solid transparent;
}

.planner-day-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  padding: 0 4px 8px;
  border-bottom: 1px solid var(--bg-elev-2);
  margin-bottom: 8px;
}

.planner-day-name {
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  font-weight: 700;
  color: var(--text-muted);
}

.planner-day-date {
  font-size: 12px;
  color: var(--text-dim);
}

.planner-day-today .planner-day-name { color: var(--accent); }
.planner-day-today { border-color: var(--accent); }

.planner-blocks {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 8px;
}

.planner-block {
  background: var(--bg-elev-2);
  border-radius: 8px;
  padding: 8px 10px;
  cursor: pointer;
  border-left: 3px solid var(--accent);
  transition: background 0.12s;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.planner-block:hover { background: var(--bg); }

.planner-block[data-type="workshop"]      { border-left-color: #b88a4a; }
.planner-block[data-type="free_play"]     { border-left-color: var(--leaf); }
.planner-block[data-type="extracurricular"] { border-left-color: #b04ad9; }
.planner-block[data-type="meal"]          { border-left-color: #d96b4a; }
.planner-block[data-type="chore"]         { border-left-color: #777; }
.planner-block[data-type="field_trip"]    { border-left-color: #4a8fd9; }
.planner-block[data-type="sleep"]         { border-left-color: #4a5568; }
.planner-block[data-type="other"]         { border-left-color: var(--text-dim); }

.planner-block-time {
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  color: var(--accent);
  font-weight: 600;
}

.planner-block-label {
  font-size: 14px;
  color: var(--text);
  line-height: 1.3;
}

.planner-block-icon { margin-right: 2px; }

.planner-block-meta {
  font-size: 12px;
  color: var(--text-muted);
  font-style: italic;
}

.planner-block-duration {
  font-size: 12px;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}

.planner-add-btn {
  background: transparent;
  border: 1px dashed var(--bg-elev-2);
  color: var(--text-muted);
  border-radius: 8px;
  padding: 8px;
  font-size: 13px;
  cursor: pointer;
  font-family: inherit;
  margin-top: auto;
  transition: background 0.12s, color 0.12s, border-color 0.12s;
}
.planner-add-btn:hover {
  background: var(--bg-elev-2);
  color: var(--text);
  border-color: var(--accent);
}

.planner-msg {
  background: rgba(196, 69, 54, 0.12);
  color: var(--danger);
  border: 1px solid rgba(196, 69, 54, 0.3);
  border-radius: var(--radius);
  padding: 12px 16px;
  margin-top: 16px;
  font-size: 14px;
}
.planner-msg[data-kind="ok"] { background: rgba(91, 122, 58, 0.15); color: var(--leaf); border-color: rgba(91, 122, 58, 0.4); }

/* ---- Block-edit modal ---- */

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  overscroll-behavior: contain;
  touch-action: pan-y;          /* let the modal body scroll, not the page */
}

/* While any modal is open, pin the page behind so taps don't scroll the
   calendar through the overlay. */
body.hh-modal-open {
  overflow: hidden;
  touch-action: none;
}
body.hh-modal-open .modal-backdrop { touch-action: auto; }

/* Preview-mode banner — appears at the very top when parent.js detects
   it's running outside the deployed frontend (file://, local panel,
   etc.). Visually obvious so live and demo never get confused. */
.hh-preview-banner {
  position: sticky;
  top: 0;
  z-index: 60;
  background: linear-gradient(90deg, var(--accent), #f59e0b);
  color: #1a1410;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 1.5px;
  text-align: center;
  padding: 6px 14px;
  text-transform: uppercase;
}

.modal-card {
  background: var(--bg);
  border-radius: var(--radius-lg);
  padding: 24px 28px;
  max-width: 560px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  border: 1px solid var(--bg-elev-2);
  box-shadow: var(--shadow);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--bg-elev);
}

.modal-header h2 {
  font-size: 22px;
  color: var(--text);
}

.modal-close {
  background: var(--bg-elev);
  border: 1px solid var(--bg-elev-2);
  color: var(--text);
  width: 44px;
  height: 44px;
  border-radius: 50%;
  font-size: 16px;
  cursor: pointer;
  font-family: inherit;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.modal-close:hover { background: var(--bg-elev-2); }

.block-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.block-field { display: flex; flex-direction: column; gap: 6px; }
.block-field-label {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  color: var(--text-muted);
  font-weight: 600;
}

.block-form input,
.block-form select,
.block-form textarea {
  background: var(--bg-elev);
  color: var(--text);
  border: 1.5px solid var(--bg-elev-2);
  border-radius: var(--radius);
  padding: 10px 14px;
  font-size: 16px;
  font-family: inherit;
}
.block-form input:focus,
.block-form select:focus,
.block-form textarea:focus {
  outline: none;
  border-color: var(--accent);
}
.block-form textarea { resize: vertical; min-height: 60px; line-height: 1.5; }

.block-field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.block-field-narrow { grid-column: span 1; }

.block-form-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 8px;
  padding-top: 14px;
  border-top: 1px solid var(--bg-elev);
}
.block-form-msg {
  flex: 1;
  font-size: 14px;
  color: var(--text-muted);
}
.block-form-msg[data-kind="error"] { color: var(--danger); }

@media (max-width: 768px) {
  .curriculum-form-row { grid-template-columns: 1fr; }
  .planner-grid { grid-template-columns: 1fr; gap: 12px; }
  .planner-day { min-height: 0; }
  .planner-week-label { min-width: 0; font-size: 16px; }
  .block-field-row { grid-template-columns: 1fr; }
  .modal-card { padding: 18px; }
}

/* =============================================================
   TODAY PAGE — 24-hour radial clock
   ============================================================= */

.today-page {
  background:
    radial-gradient(circle at 50% 35%, rgba(217, 119, 6, 0.07), transparent 70%),
    var(--bg);
  min-height: 100vh;
  padding: 32px 24px 48px;
}

.today-header {
  max-width: 1200px;
  margin: 0 auto 24px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  flex-wrap: wrap;
}

.today-back-link {
  color: var(--accent);
  text-decoration: underline;
  font-size: 14px;
}

.today-header-right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 12px;
}

.today-view-toggle {
  margin-bottom: 0;
}

.today-header-meta { flex: 1; min-width: 200px; }

.today-eyebrow {
  font-size: 14px;
  text-transform: uppercase;
  letter-spacing: 2px;
  color: var(--accent);
  margin-bottom: 8px;
}

.today-title {
  font-size: 44px;
  font-weight: 700;
  color: var(--text);
  line-height: 1.05;
  margin-bottom: 6px;
}

.today-subtitle {
  font-size: 18px;
  color: var(--text-muted);
}

.today-kid-tabs {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.today-kid-tab {
  padding: 10px 18px;
  border: 1.5px solid var(--bg-elev-2);
  background: var(--bg-elev);
  color: var(--text);
  border-radius: 999px;
  font-size: 16px;
  font-weight: 600;
  text-decoration: none;
  transition: background 0.12s, border-color 0.12s;
}
.today-kid-tab:hover { background: var(--bg-elev-2); }
.today-kid-tab.active {
  background: var(--accent);
  color: var(--bg);
  border-color: var(--accent);
}

.today-main {
  max-width: 1200px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: minmax(0, 560px) 1fr;
  gap: 40px;
  align-items: start;
}

@media (max-width: 900px) {
  .today-main {
    grid-template-columns: 1fr;
    gap: 24px;
  }
}

.clock-wrapper {
  position: relative;
  aspect-ratio: 1 / 1;
  width: 100%;
}

/* Hide the radial clock on phone widths — too cramped to be useful, and
   the calendar grid on parent.html is the better mobile experience.
   Desktop keeps the radial as a visual centerpiece. */
@media (max-width: 900px) {
  .clock-wrapper { display: none; }
  .today-main {
    grid-template-columns: 1fr !important;
    gap: 0 !important;
  }
}

#clock-svg {
  width: 100%;
  height: 100%;
  display: block;
}

.clock-now-display {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}

.clock-now-time {
  font-size: 38px;
  font-weight: 700;
  color: var(--text);
  font-variant-numeric: tabular-nums;
  letter-spacing: 1px;
  line-height: 1;
}

.clock-now-label {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 2px;
  color: var(--text-muted);
  margin-top: 4px;
}

.clock-now-weather {
  font-size: 18px;
  color: var(--text);
  margin-top: 8px;
  font-weight: 600;
}

/* SVG element classes */

.bg-day   { fill: rgba(245, 215, 130, 0.13); }
.bg-night { fill: rgba(28, 36, 70, 0.45); }
.bg-dawn  { fill: rgba(255, 156, 110, 0.32); }
.bg-dusk  { fill: rgba(255, 120, 90,  0.32); }

/* Stars on the night portion of the ring */
.star {
  fill: #f5e9d3;
  filter: drop-shadow(0 0 2px rgba(245, 233, 211, 0.6));
  pointer-events: none;
}

/* Weather emoji along the day arc */
.weather-strip-icon {
  font-size: 14px;
  pointer-events: none;
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.6));
}

.clock-plate-outer {
  fill: rgba(42, 32, 26, 0.6);
  stroke: var(--bg-elev-2);
  stroke-width: 1.5;
}

.clock-plate-inner {
  fill: var(--bg);
  stroke: var(--bg-elev-2);
  stroke-width: 1.5;
}

.hour-tick {
  stroke: var(--text-dim);
  stroke-width: 1.5;
}

.hour-tick-major {
  stroke: var(--text-muted);
  stroke-width: 2.5;
}

.hour-label {
  fill: var(--text-muted);
  font-size: 14px;
  font-weight: 600;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

.sun-icon, .moon-icon {
  font-size: 22px;
}

.block-arc {
  fill-opacity: 0.88;
  stroke: rgba(0, 0, 0, 0.25);
  stroke-width: 0.5;
  transition: fill-opacity 0.12s;
}

.block-group:hover .block-arc { fill-opacity: 1; }
.block-group:hover .block-arc-label { fill: var(--bg); }

.block-icon {
  font-size: 18px;
  pointer-events: none;
}

.block-arc-label {
  fill: var(--text);
  font-size: 11px;
  font-weight: 600;
  pointer-events: none;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  letter-spacing: 0.3px;
}

.sun-marker {
  font-size: 16px;
  pointer-events: none;
}

.now-indicator {
  fill: #ff5b3a;
  stroke: var(--text);
  stroke-width: 1.5;
}

/* ---- Today block list (text fallback / accessibility) ---- */

.today-list-section {
  background: var(--bg-elev);
  border-radius: var(--radius-lg);
  padding: 22px 24px 18px;
}

.today-list-heading {
  font-size: 14px;
  text-transform: uppercase;
  letter-spacing: 2px;
  color: var(--text-muted);
  margin-bottom: 16px;
}

.today-block-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.today-list-empty {
  color: var(--text-muted);
  font-size: 15px;
  padding: 16px 0;
}

.today-list-item {
  display: grid;
  grid-template-columns: 110px 1fr;
  gap: 14px;
  padding: 10px 12px;
  background: var(--bg-elev-2);
  border-radius: var(--radius);
}

.today-list-time {
  font-size: 14px;
  font-weight: 600;
  color: var(--accent);
  font-variant-numeric: tabular-nums;
  align-self: start;
  padding-top: 1px;
}

.today-list-body { min-width: 0; }

.today-list-label {
  font-size: 16px;
  color: var(--text);
  font-weight: 600;
}

.today-list-curriculum {
  font-size: 13px;
  color: var(--text-muted);
  font-style: italic;
  margin-top: 2px;
}

.today-list-details {
  font-size: 14px;
  color: var(--text-muted);
  margin-top: 4px;
  line-height: 1.5;
}

.today-footer {
  max-width: 1200px;
  margin: 32px auto 0;
  text-align: right;
  font-size: 14px;
}
.today-footer a {
  color: var(--accent);
  text-decoration: underline;
}

/* ---- Detail panel (slide-in from right) ---- */

.today-detail-panel {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: 420px;
  max-width: 100vw;
  background: var(--bg-elev);
  z-index: 100;
  padding: 32px 28px;
  overflow-y: auto;
  border-left: 1px solid var(--bg-elev-2);
  box-shadow: -8px 0 24px rgba(0, 0, 0, 0.5);
  transform: translateX(100%);
  transition: transform 0.28s ease;
}
.today-detail-panel.open {
  transform: translateX(0);
}

.detail-close {
  position: absolute;
  top: 14px;
  right: 14px;
  background: var(--bg-elev-2);
  border: 1px solid transparent;
  color: var(--text);
  width: 44px;
  height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  font-size: 16px;
  cursor: pointer;
  font-family: inherit;
  transition: background 0.12s, border-color 0.12s;
}
.detail-close:hover {
  background: var(--bg);
  border-color: var(--accent);
}

.detail-header {
  margin-bottom: 20px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--bg-elev-2);
}

.detail-time {
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 2px;
  color: var(--accent);
  font-weight: 700;
  margin-bottom: 8px;
}

.detail-title {
  font-size: 26px;
  font-weight: 700;
  color: var(--text);
  line-height: 1.15;
  margin-bottom: 6px;
}

.detail-type {
  font-size: 14px;
  color: var(--text-muted);
}

.detail-body {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.detail-section {
  background: var(--bg);
  border-radius: var(--radius);
  padding: 14px 16px;
  border: 1px solid var(--bg-elev-2);
}

.detail-section h3 {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: var(--accent);
  font-weight: 700;
  margin-bottom: 6px;
}

.detail-curriculum-name {
  font-size: 16px;
  color: var(--text);
  font-weight: 600;
}

.detail-notes {
  background: var(--bg);
  border-radius: var(--radius);
  padding: 14px 16px;
  font-size: 15px;
  color: var(--text);
  line-height: 1.6;
  border-left: 3px solid var(--accent);
}

.detail-links {
  margin-top: 24px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.detail-section-heading {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 2px;
  color: var(--text-muted);
  font-weight: 700;
  margin-bottom: 6px;
}

.detail-link {
  display: block;
  background: var(--bg);
  border-radius: var(--radius);
  padding: 12px 16px;
  color: var(--text);
  font-size: 16px;
  font-weight: 500;
  text-decoration: none;
  border: 1px solid var(--bg-elev-2);
  transition: background 0.12s, border-color 0.12s;
}
.detail-link:hover {
  background: var(--bg-elev-2);
  border-color: var(--accent);
}

@media (max-width: 768px) {
  .today-detail-panel {
    width: 100vw;
  }
}

/* =============================================================
   VIEW TOGGLE — Day / Week / Year
   ============================================================= */

.view-toggle {
  display: inline-flex;
  background: var(--bg-elev);
  padding: 4px;
  border-radius: 999px;
  margin-bottom: 22px;
  border: 1px solid var(--bg-elev-2);
  gap: 2px;
}

.view-toggle-link {
  padding: 8px 18px;
  font-size: 14px;
  font-weight: 600;
  border-radius: 999px;
  color: var(--text-muted);
  text-decoration: none;
  transition: background 0.12s, color 0.12s;
}
.view-toggle-link:hover { background: var(--bg-elev-2); color: var(--text); }
.view-toggle-link.active {
  background: var(--accent);
  color: var(--bg);
}

/* =============================================================
   YEAR PAGE
   ============================================================= */

.year-grid {
  display: flex;
  flex-direction: column;
  gap: 28px;
}

.year-month {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.year-month-heading {
  font-size: 14px;
  text-transform: uppercase;
  letter-spacing: 2px;
  color: var(--text-muted);
  font-weight: 600;
}

.year-month-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 10px;
}

.year-week-card {
  background: var(--bg-elev);
  border-radius: var(--radius);
  padding: 12px 14px;
  text-decoration: none;
  display: flex;
  flex-direction: column;
  gap: 4px;
  border: 1.5px solid transparent;
  transition: background 0.12s, border-color 0.12s;
}

.year-week-card:hover {
  background: var(--bg-elev-2);
  border-color: var(--accent);
}

.year-week-current {
  border-color: var(--accent) !important;
  background: rgba(217, 119, 6, 0.10);
}

.year-week-planned {
  background: linear-gradient(180deg, var(--bg-elev) 0%, rgba(217, 119, 6, 0.08) 100%);
}

.year-week-num {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: var(--accent);
  font-weight: 700;
}

.year-week-dates {
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
}

.year-week-status {
  font-size: 13px;
  color: var(--text-muted);
}

.year-week-status-empty {
  color: var(--text-dim);
}

/* =============================================================
   WORKSHOPS PAGE
   ============================================================= */

.workshop-form {
  background: var(--bg-elev);
  border-radius: var(--radius-lg);
  padding: 22px 24px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  border: 1px solid var(--bg-elev-2);
  margin-bottom: 24px;
}

.workshop-form-row {
  grid-template-columns: minmax(180px, 1.5fr) minmax(120px, 1fr) minmax(120px, 1fr);
}

.workshop-form input,
.workshop-form select,
.workshop-form textarea {
  background: var(--bg);
  color: var(--text);
  border: 1.5px solid var(--bg-elev-2);
  border-radius: var(--radius);
  padding: 10px 14px;
  font-size: 16px;
  font-family: inherit;
}
.workshop-form input:focus,
.workshop-form select:focus,
.workshop-form textarea:focus {
  outline: none;
  border-color: var(--accent);
}
.workshop-form textarea {
  resize: vertical;
  line-height: 1.55;
}

.workshop-form-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 14px;
}

.workshops-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(360px, 1fr));
  gap: 18px;
}

.workshop-card {
  background: var(--bg-elev);
  border-radius: var(--radius-lg);
  padding: 20px 22px;
  border: 1px solid var(--bg-elev-2);
}

.workshop-card-header {
  display: grid;
  grid-template-columns: 1fr auto;
  grid-template-rows: auto auto;
  gap: 4px 10px;
  margin-bottom: 14px;
  align-items: start;
}

.workshop-card-title {
  font-size: 20px;
  font-weight: 700;
  color: var(--text);
  grid-column: 1 / 2;
}

.workshop-card-meta {
  grid-column: 1 / 2;
  font-size: 13px;
  color: var(--text-muted);
}

.workshop-card-header .curriculum-delete {
  grid-column: 2 / 3;
  grid-row: 1 / 3;
  align-self: start;
}

.workshop-card-curriculum {
  font-size: 14px;
  color: var(--text-muted);
  font-style: italic;
  margin-bottom: 12px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--bg-elev-2);
}

.workshop-card-h4 {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: var(--accent);
  margin: 14px 0 6px;
  font-weight: 700;
}

.workshop-card-list {
  margin: 0 0 0 22px;
  padding: 0;
  font-size: 15px;
  color: var(--text);
  line-height: 1.55;
}

.workshop-card-list li { margin-bottom: 4px; }

.workshop-card-entrep {
  background: rgba(217, 119, 6, 0.10);
  border-radius: var(--radius);
  padding: 10px 14px;
  font-size: 14px;
  color: var(--text);
  margin-top: 14px;
  border-left: 3px solid var(--accent);
}

@media (max-width: 768px) {
  .workshop-form-row { grid-template-columns: 1fr; }
  .workshops-list { grid-template-columns: 1fr; }
}

/* =============================================================
   FAMILY SETTINGS FORM
   ============================================================= */

.family-form {
  background: var(--bg-elev);
  border-radius: var(--radius-lg);
  padding: 22px 24px;
  border: 1px solid var(--bg-elev-2);
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.family-form-row {
  display: grid;
  grid-template-columns: minmax(220px, 1.5fr) minmax(140px, 1fr);
  gap: 14px;
}

.family-form input,
.family-form select {
  background: var(--bg);
  color: var(--text);
  border: 1.5px solid var(--bg-elev-2);
  border-radius: var(--radius);
  padding: 10px 14px;
  font-size: 16px;
  font-family: inherit;
}
.family-form input:focus,
.family-form select:focus {
  outline: none;
  border-color: var(--accent);
}

@media (max-width: 768px) {
  .family-form-row { grid-template-columns: 1fr; }
}

/* =============================================================
   TRIPS PAGE — extends workshop-card styling
   ============================================================= */

.trip-form {
  background: var(--bg-elev);
  border-radius: var(--radius-lg);
  padding: 22px 24px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  border: 1px solid var(--bg-elev-2);
  margin-bottom: 24px;
}

.trip-form-row {
  grid-template-columns: minmax(200px, 1.6fr) minmax(120px, 1fr) minmax(120px, 1fr);
}

.trip-form input,
.trip-form textarea {
  background: var(--bg);
  color: var(--text);
  border: 1.5px solid var(--bg-elev-2);
  border-radius: var(--radius);
  padding: 10px 14px;
  font-size: 16px;
  font-family: inherit;
}
.trip-form input:focus,
.trip-form textarea:focus {
  outline: none;
  border-color: var(--accent);
}

.trip-card-address,
.trip-card-line,
.trip-card-notes {
  font-size: 14px;
  color: var(--text-muted);
  margin: 6px 0;
  line-height: 1.5;
}

.trip-card-notes {
  font-style: italic;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--bg-elev-2);
}

.trip-card-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
}

.trip-card-tag {
  font-size: 12px;
  padding: 3px 10px;
  background: var(--bg-elev-2);
  color: var(--text);
  border-radius: 999px;
  text-transform: lowercase;
}

.trip-card-link {
  display: inline-block;
  margin-top: 12px;
  color: var(--accent);
  text-decoration: underline;
  font-size: 14px;
}

@media (max-width: 768px) {
  .trip-form-row { grid-template-columns: 1fr; }
}

/* =============================================================
   INSIGHTS PANEL
   ============================================================= */

.insights-panel {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 14px;
}

.insights-card {
  background: var(--bg-elev);
  border-radius: var(--radius-lg);
  padding: 18px 20px;
  border: 1px solid var(--bg-elev-2);
}

.insights-kid-name {
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 12px;
}

.insights-totals-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 12px;
}

.insights-stat {
  background: var(--bg);
  border-radius: var(--radius);
  padding: 12px;
  text-align: center;
}

.insights-stat-num {
  font-size: 24px;
  font-weight: 700;
  color: var(--accent);
  font-variant-numeric: tabular-nums;
}

.insights-stat-label {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  color: var(--text-muted);
  margin-top: 2px;
}

.insights-stat-delta {
  font-size: 12px;
  color: var(--text-dim);
  margin-top: 6px;
}

.insights-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  font-size: 13px;
  margin-bottom: 8px;
}

.insights-row-label {
  text-transform: uppercase;
  letter-spacing: 1px;
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 600;
  margin-right: 4px;
}

.insights-pill {
  background: var(--bg-elev-2);
  color: var(--text);
  border-radius: 999px;
  padding: 3px 10px;
  font-size: 12px;
}

.insights-empty {
  color: var(--text-muted);
  font-size: 13px;
  font-style: italic;
  margin-top: 4px;
}

/* =============================================================
   READING LOG
   ============================================================= */

.reading-form {
  background: var(--bg-elev);
  border-radius: var(--radius-lg);
  padding: 18px 22px;
  border: 1px solid var(--bg-elev-2);
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 18px;
}

.reading-form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.reading-form input,
.reading-form select,
.reading-form textarea {
  background: var(--bg);
  color: var(--text);
  border: 1.5px solid var(--bg-elev-2);
  border-radius: var(--radius);
  padding: 10px 14px;
  font-size: 16px;
  font-family: inherit;
}
.reading-form input:focus,
.reading-form select:focus,
.reading-form textarea:focus {
  outline: none;
  border-color: var(--accent);
}

.reading-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 10px;
}

.reading-card {
  background: var(--bg-elev);
  border-radius: var(--radius);
  padding: 14px 16px;
  border: 1px solid transparent;
  position: relative;
}
.reading-card:hover { border-color: var(--bg-elev-2); }

.reading-card-header {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 6px;
}

.reading-card-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
  flex: 1;
  min-width: 0;
}

.reading-card-toggle {
  font-size: 12px;
  padding: 5px 10px;
  border-radius: 999px;
  background: var(--bg-elev-2);
  border: 1px solid var(--bg-elev-2);
  color: var(--text);
  cursor: pointer;
  font-family: inherit;
  white-space: nowrap;
  flex-shrink: 0;
}
.reading-card-toggle.finished {
  background: var(--leaf);
  color: var(--bg);
  border-color: var(--leaf);
}
.reading-card-toggle:hover { background: var(--bg); }

.reading-card-meta {
  font-size: 13px;
  color: var(--text-muted);
}

.reading-card-notes {
  font-size: 13px;
  color: var(--text-muted);
  font-style: italic;
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid var(--bg-elev-2);
  line-height: 1.5;
}

.reading-card-delete {
  position: absolute;
  top: 8px;
  right: 8px;
  background: transparent;
  border: none;
  color: var(--text-dim);
  cursor: pointer;
  font-size: 14px;
  width: 44px;
  height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  width: 22px;
  height: 22px;
  border-radius: 4px;
}
.reading-card-delete:hover {
  background: rgba(196,69,54,0.2);
  color: var(--danger);
}

/* =============================================================
   PLANNER EXTRAS — copy-week button + block link rows
   ============================================================= */

.planner-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 22px;
}

.btn-copy-week {
  background: var(--bg-elev);
  border: 1.5px solid var(--bg-elev-2);
  color: var(--text);
  padding: 8px 16px;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
}
.btn-copy-week:hover {
  background: var(--bg-elev-2);
  border-color: var(--accent);
}

.block-links-field {
  border: 1.5px solid var(--bg-elev-2);
  border-radius: var(--radius);
  padding: 12px 14px;
}

.block-links-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 10px;
}

.block-link-row {
  display: grid;
  grid-template-columns: 60px minmax(120px, 1.4fr) minmax(180px, 2fr) 28px;
  gap: 8px;
}

.block-link-row input {
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--bg-elev-2);
  border-radius: var(--radius);
  padding: 8px 12px;
  font-size: 14px;
  font-family: inherit;
}

.block-link-remove {
  background: transparent;
  border: 1px solid var(--bg-elev-2);
  color: var(--text-dim);
  border-radius: 4px;
  cursor: pointer;
  font-family: inherit;
  width: 44px;
  height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.block-link-remove:hover {
  background: rgba(196,69,54,0.2);
  color: var(--danger);
  border-color: var(--danger);
}

.btn-link-add {
  background: transparent;
  border: 1px dashed var(--bg-elev-2);
  color: var(--text-muted);
  border-radius: var(--radius);
  padding: 8px 12px;
  font-size: 13px;
  cursor: pointer;
  font-family: inherit;
}
.btn-link-add:hover {
  background: var(--bg-elev-2);
  color: var(--text);
}

/* ---- Today date nav ---- */

.today-date-nav {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.today-date-nav .today-subtitle {
  margin: 0;
  min-width: 220px;
}

.activity-delete-btn {
  color: var(--danger) !important;
}

.trip-visited-btn {
  display: inline-block;
  margin-top: 10px;
  background: var(--bg-elev-2);
  color: var(--text);
  border: 1px solid var(--bg-elev-2);
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 13px;
  cursor: pointer;
  font-family: inherit;
}
.trip-visited-btn:hover {
  border-color: var(--accent);
  background: var(--bg);
}

.trip-card-visited {
  color: var(--leaf) !important;
  font-weight: 600;
}

/* =============================================================
   ONBOARDING WIZARD + INVITE CARD
   ============================================================= */

.onboarding-card {
  max-width: 640px;
}

.onboarding-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
  text-align: left;
  margin-top: 12px;
}

.wizard-section {
  border: 1px solid var(--bg-elev-2);
  border-radius: var(--radius);
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.wizard-section legend {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: var(--accent);
  font-weight: 700;
  padding: 0 6px;
}

.wizard-row {
  grid-template-columns: 1.5fr 1fr 1fr 1fr auto;
}

.wizard-kids {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.wizard-kid-row {
  border: 1px dashed var(--bg-elev-2);
  border-radius: var(--radius);
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.onboarding-form input,
.onboarding-form select,
.onboarding-form textarea {
  background: var(--bg);
  color: var(--text);
  border: 1.5px solid var(--bg-elev-2);
  border-radius: var(--radius);
  padding: 10px 14px;
  font-size: 16px;
  font-family: inherit;
}

.onboarding-form input:focus,
.onboarding-form select:focus,
.onboarding-form textarea:focus {
  outline: none;
  border-color: var(--accent);
}

.onboarding-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-top: 8px;
}

.wizard-remove {
  align-self: flex-end;
}

@media (max-width: 768px) {
  .wizard-row { grid-template-columns: 1fr 1fr; }
  .wizard-row > .block-field-narrow { grid-column: span 1; }
}

/* =============================================================
   INVITATIONS UI
   ============================================================= */

.invite-form {
  background: var(--bg-elev);
  border-radius: var(--radius-lg);
  padding: 18px 22px;
  border: 1px solid var(--bg-elev-2);
  margin-bottom: 18px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.invite-form-row {
  display: grid;
  grid-template-columns: minmax(220px, 2fr) minmax(140px, 1fr) minmax(180px, 1.4fr);
  gap: 12px;
}

.invite-form input,
.invite-form select {
  background: var(--bg);
  color: var(--text);
  border: 1.5px solid var(--bg-elev-2);
  border-radius: var(--radius);
  padding: 10px 14px;
  font-size: 16px;
  font-family: inherit;
}

.invite-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

@media (max-width: 768px) {
  .invite-form-row { grid-template-columns: 1fr; }
}

/* =============================================================
   BOTTOM TAB BAR — primary navigation on parent-facing pages.
   Lives in the thumb zone on mobile; hidden on desktop where it
   would just be wasted real estate (header still has user button).
   ============================================================= */

body.has-tab-bar {
  /* Reserve bottom space for the tab bar PLUS the schedule toolbar
     (kid toggle + Schedule/Week/Month) that sits just above it on
     the home view. Tab-bar's actual height = 8px top pad + 56px
     min content + 8px bottom pad + safe-area = 72 + safe-area. */
  padding-bottom: calc(72px + 52px + env(safe-area-inset-bottom));
}

.tab-bar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 50;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0;
  background: rgba(26, 20, 16, 0.96);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-top: 1px solid var(--bg-elev-2);
  padding: 8px 6px calc(8px + env(safe-area-inset-bottom));
}

.tab-bar-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  min-height: 56px;
  padding: 6px 4px;
  background: transparent;
  border: 0;
  border-radius: var(--radius);
  color: var(--text-muted);
  font-family: inherit;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  transition: color 0.12s ease, background 0.12s ease, transform 0.12s ease;
}
.tab-bar-item:hover { background: var(--bg-elev); color: var(--text); }
.tab-bar-item.active { color: var(--accent); }
.tab-bar-item.active .tab-bar-icon { transform: translateY(-1px); }

.tab-bar-icon {
  font-size: 22px;
  line-height: 1;
  transition: transform 0.12s ease;
}
.tab-bar-label {
  font-size: 11px;
  letter-spacing: 0.2px;
}


/* ---- Side drawer used by the More tab ---- */
.tab-drawer {
  position: fixed;
  inset: 0;
  z-index: 200;
  pointer-events: none;
}
.tab-drawer-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  opacity: 0;
  transition: opacity 0.22s ease;
  pointer-events: auto;
}
.tab-drawer-panel {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  width: min(380px, 92vw);
  background: var(--bg);
  border-left: 1px solid var(--bg-elev-2);
  box-shadow: var(--shadow);
  transform: translateX(100%);
  transition: transform 0.22s ease;
  pointer-events: auto;
  overflow-y: auto;
  padding: 20px 22px calc(28px + env(safe-area-inset-bottom));
}
.tab-drawer.open .tab-drawer-backdrop { opacity: 1; }
.tab-drawer.open .tab-drawer-panel    { transform: translateX(0); }

.tab-drawer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--bg-elev);
  margin-bottom: 18px;
}
.tab-drawer-title {
  font-size: 18px;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: var(--text-muted);
  font-weight: 600;
}
.tab-drawer-section {
  margin-bottom: 24px;
}
.tab-drawer-section-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 1.4px;
  color: var(--text-dim);
  margin-bottom: 10px;
  font-weight: 600;
}
.tab-drawer-links {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.tab-drawer-link {
  display: block;
  width: 100%;
  text-align: left;
  padding: 14px 16px;          /* 44pt min touch target */
  min-height: 44px;
  border-radius: var(--radius);
  color: var(--text);
  font-size: 16px;
  background: transparent;
  border: 1px solid transparent;
  cursor: pointer;
  font-family: inherit;
  text-decoration: none;
}
.tab-drawer-link:hover {
  background: var(--bg-elev);
  border-color: var(--bg-elev-2);
}

/* =============================================================
   SCHEDULE-AS-HOME (parent.html in default Today view)
   ============================================================= */

.home-schedule-section { margin-top: 8px; }

.home-date-strip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}
.home-date-label {
  font-size: 18px;
  font-weight: 600;
  color: var(--text);
}
.home-date-meta {
  font-size: 14px;
  color: var(--text-muted);
}

/* ---- Sticky toolbar (kid toggle + Day/Week/Month) above tab bar ---- */
.schedule-toolbar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: calc(72px + env(safe-area-inset-bottom));
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 12px;
  background: rgba(26, 20, 16, 0.96);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-top: 1px solid var(--bg-elev-2);
  height: 52px;
}

.schedule-kid-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  min-height: 36px;
  background: var(--bg-elev);
  border: 1.5px solid var(--bg-elev-2);
  border-radius: 999px;
  color: var(--text);
  font-family: inherit;
  font-size: 15px;
  font-weight: 500;
  cursor: pointer;
  max-width: 50%;
}
.schedule-kid-toggle:hover { border-color: var(--accent); }
.schedule-kid-toggle .schedule-kid-avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px; height: 24px;
  background: var(--accent);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  border-radius: 50%;
  flex-shrink: 0;
}
.schedule-kid-name {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.schedule-kid-chevron {
  font-size: 11px;
  color: var(--text-muted);
}

.schedule-view-toggle {
  display: flex;
  align-items: stretch;
  background: var(--bg-elev);
  border: 1.5px solid var(--bg-elev-2);
  border-radius: 999px;
  padding: 2px;
}
.schedule-view-btn {
  padding: 6px 14px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  text-decoration: none;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  transition: background 0.12s ease, color 0.12s ease;
}
.schedule-view-btn:hover { color: var(--text); }
.schedule-view-btn.active {
  background: var(--accent);
  color: #fff;
}

/* Kid picker overlay — opens above the toolbar when the kid toggle is tapped */
.schedule-kid-picker {
  position: fixed;
  left: 12px;
  right: auto;
  max-width: 240px;
  bottom: calc(72px + 52px + 8px + env(safe-area-inset-bottom));
  z-index: 45;
  display: flex;
  flex-direction: column;
  gap: 4px;
  border: 1.5px solid var(--accent);
  border-radius: var(--radius);
  padding: 6px;
  background: var(--bg-elev);
  box-shadow: 0 -8px 24px rgba(0, 0, 0, 0.45);
}
.schedule-kid-pick-row {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  background: transparent;
  border: 1.5px solid transparent;
  border-radius: var(--radius);
  color: var(--text);
  font-family: inherit;
  font-size: 15px;
  font-weight: 500;
  cursor: pointer;
  text-align: left;
}
.schedule-kid-pick-row:hover {
  background: var(--bg);
  border-color: var(--bg-elev-2);
}
.schedule-kid-pick-row.selected {
  background: rgba(217, 119, 6, 0.18);
  border-color: var(--accent);
}
.schedule-kid-pick-row .schedule-kid-avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px; height: 26px;
  background: var(--accent);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  border-radius: 50%;
  flex-shrink: 0;
}

/* =============================================================
   REDUCED MOTION — respect the user's OS-level preference.
   Strip all our transitions/animations down to instant.
   ============================================================= */

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
  .hamburger-drawer-panel,
  .tab-drawer-panel {
    transition: none !important;
  }
}

/* Fullscreen keeps our controls in dedicated rows. Nothing overlays or
   obscures the official YouTube iframe. */
.player-shell:fullscreen,
.player-shell:-webkit-full-screen {
  display: grid;
  width: 100%;
  height: 100vh;
  height: 100dvh;
  grid-template-rows: auto minmax(200px, 1fr) auto;
  overflow-y: auto;
  background: #000;
}

.player-shell:fullscreen .video-wrapper,
.player-shell:-webkit-full-screen .video-wrapper {
  position: relative;
  width: 100%;
  height: 100%;
  min-height: 200px;
}

/* =============================================================
   DASHBOARD REDESIGN — hub mode + hamburger + kid sub-dashboards
   ============================================================= */

/* ---- Header right side ---- */
.dashboard-header-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

/* ---- Hamburger button ---- */
.hamburger-btn {
  width: 44px;
  height: 44px;
  background: var(--bg-elev);
  border: 1px solid var(--bg-elev-2);
  border-radius: var(--radius);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  cursor: pointer;
  transition: background 0.15s ease;
}
.hamburger-btn:hover { background: var(--bg-elev-2); }
.hamburger-btn span {
  display: block;
  width: 22px;
  height: 2px;
  background: var(--text);
  border-radius: 2px;
  transition: all 0.2s ease;
}
.hamburger-btn[aria-expanded="true"] span:nth-child(1) {
  transform: translateY(7px) rotate(45deg);
}
.hamburger-btn[aria-expanded="true"] span:nth-child(2) {
  opacity: 0;
}
.hamburger-btn[aria-expanded="true"] span:nth-child(3) {
  transform: translateY(-7px) rotate(-45deg);
}

/* ---- Hamburger drawer ---- */
.hamburger-drawer {
  position: fixed;
  inset: 0;
  z-index: 200;
  pointer-events: none;
}
.hamburger-drawer-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  opacity: 0;
  transition: opacity 0.22s ease;
  pointer-events: auto;
}
.hamburger-drawer-panel {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  width: min(360px, 90vw);
  background: var(--bg);
  border-left: 1px solid var(--bg-elev-2);
  box-shadow: var(--shadow);
  transform: translateX(100%);
  transition: transform 0.22s ease;
  pointer-events: auto;
  overflow-y: auto;
  padding: 20px 22px 32px;
}
.hamburger-drawer.open .hamburger-drawer-backdrop { opacity: 1; }
.hamburger-drawer.open .hamburger-drawer-panel    { transform: translateX(0); }

.hamburger-drawer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--bg-elev);
  margin-bottom: 18px;
}
.hamburger-drawer-title {
  font-size: 18px;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: var(--text-muted);
  font-weight: 600;
}

.hamburger-section {
  margin-bottom: 24px;
}
.hamburger-section-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 1.4px;
  color: var(--text-dim);
  margin-bottom: 10px;
  font-weight: 600;
}
.hamburger-links {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.hamburger-link {
  display: block;
  width: 100%;
  text-align: left;
  padding: 12px 14px;
  border-radius: var(--radius);
  color: var(--text);
  font-size: 17px;
  background: transparent;
  border: 1px solid transparent;
  cursor: pointer;
  font-family: inherit;
}
.hamburger-link:hover {
  background: var(--bg-elev);
  border-color: var(--bg-elev-2);
}

/* ---- Kid card now an <a> link ---- */
.kid-card {
  display: block;
  position: relative;
  text-decoration: none;
  cursor: pointer;
  transition: transform 0.15s ease, border-color 0.15s ease;
}
.kid-card:hover {
  transform: translateY(-2px);
  border-color: var(--accent);
}
.kid-card-arrow {
  position: absolute;
  top: 16px;
  right: 16px;
  font-size: 22px;
  color: var(--text-muted);
  transition: transform 0.15s ease, color 0.15s ease;
}
.kid-card:hover .kid-card-arrow {
  transform: translateX(4px);
  color: var(--accent);
}

/* ---- Quick-action buttons row ---- */
.kid-action-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}
.kid-action-btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 14px 22px;
  border-radius: var(--radius);
  font-size: 17px;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  border: 1px solid transparent;
  font-family: inherit;
  transition: transform 0.12s ease, background 0.12s ease;
}
.kid-action-btn:hover { transform: translateY(-1px); }
.kid-action-icon { font-size: 20px; line-height: 1; }
.kid-actions-section { margin-top: 4px; }

/* ---- Modal card variants used by modals.js ---- */
.modal-card-wide { max-width: 700px; }
.modal-body { display: flex; flex-direction: column; gap: 16px; }
.modal-blurb {
  font-size: 15px;
  color: var(--text-muted);
  line-height: 1.5;
}
.modal-hint {
  font-size: 13px;
  color: var(--text-muted);
  font-style: italic;
}
.modal-context {
  background: rgba(217, 119, 6, 0.12);
  border: 1px solid rgba(217, 119, 6, 0.3);
  border-radius: var(--radius);
  padding: 10px 14px;
  font-size: 14px;
  color: var(--text);
  margin-bottom: 4px;
}

/* =============================================================
   WEEK VIEW (in-page on parent.html) — stacked list of 7 days
   ============================================================= */

.week-view-section { margin-top: 8px; }
.week-grid {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.week-day {
  display: grid;
  grid-template-columns: 88px 1fr;
  gap: 14px;
  align-items: start;
  padding: 12px 14px;
  background: var(--bg-elev);
  border: 1px solid var(--bg-elev-2);
  border-radius: var(--radius);
  cursor: pointer;
  transition: border-color 0.12s ease, transform 0.12s ease;
}
.week-day:hover { border-color: var(--accent); transform: translateX(2px); }
.week-day.today { border-left: 4px solid var(--accent); padding-left: 11px; }

.week-day-header {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
}
.week-day-name {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  color: var(--text-muted);
  font-weight: 600;
}
.week-day-num {
  font-size: 28px;
  font-weight: 700;
  color: var(--text);
  line-height: 1;
}
.week-day.today .week-day-num { color: var(--accent); }

.week-day-body {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: flex-start;
}
.week-day-empty {
  font-size: 13px;
  color: var(--text-dim);
  font-style: italic;
}
.week-block-chip {
  display: inline-flex;
  font-size: 12px;
  padding: 4px 10px;
  background: var(--bg);
  border: 1px solid var(--bg-elev-2);
  border-left: 3px solid var(--accent);
  border-radius: 6px;
  color: var(--text);
  white-space: nowrap;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
}
.week-block-chip[data-type="lesson"]          { border-left-color: #d97706; }
.week-block-chip[data-type="workshop"]        { border-left-color: #b88a4a; }
.week-block-chip[data-type="free_play"]       { border-left-color: #5b7a3a; }
.week-block-chip[data-type="extracurricular"] { border-left-color: #b04ad9; }
.week-block-chip[data-type="meal"]            { border-left-color: #d96b4a; }
.week-block-chip[data-type="chore"]           { border-left-color: #777777; }
.week-block-chip[data-type="field_trip"]      { border-left-color: #4a8fd9; }
.week-block-chip[data-type="sleep"]           { border-left-color: #2a3a5e; }

.week-block-more {
  font-size: 12px;
  color: var(--text-muted);
  align-self: center;
}

/* =============================================================
   MONTH VIEW (in-page on parent.html) — 6×7 calendar grid
   ============================================================= */

.month-view-section { margin-top: 8px; }
.month-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}
.month-title {
  font-size: 22px;
  font-weight: 700;
  color: var(--text);
  flex: 1;
  text-align: center;
}
.month-nav {
  width: 44px; height: 44px;
  border-radius: 50%;
  background: var(--bg-elev);
  border: 1.5px solid var(--bg-elev-2);
  color: var(--text);
  font-size: 20px;
  cursor: pointer;
  font-family: inherit;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.month-nav:hover { background: var(--bg-elev-2); border-color: var(--accent); }

.month-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
}
.month-dow {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  text-align: center;
  padding: 6px 0;
  text-transform: uppercase;
  letter-spacing: 0.8px;
}
.month-cell {
  aspect-ratio: 1 / 1;
  background: var(--bg-elev);
  border: 1px solid var(--bg-elev-2);
  border-radius: 8px;
  color: var(--text);
  font-size: 14px;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.12s ease, border-color 0.12s ease, transform 0.12s ease;
}
.month-cell:hover { border-color: var(--accent); transform: scale(1.04); }
.month-cell.other-month { color: var(--text-dim); opacity: 0.45; }
.month-cell.today {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
  font-weight: 700;
}

@media (max-width: 480px) {
  .week-day { grid-template-columns: 64px 1fr; gap: 10px; padding: 10px 12px; }
  .week-day-num { font-size: 22px; }
  .month-cell { font-size: 12px; }
}

/* =============================================================
   LOCK-TIME CHECKBOX (plan.html block-edit modal)
   ============================================================= */

.block-field-checkbox {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  background: var(--bg-elev);
  border: 1px solid var(--bg-elev-2);
  border-radius: var(--radius);
  padding: 14px 16px;
  cursor: pointer;
}
.block-field-checkbox input[type="checkbox"] {
  width: 22px;
  height: 22px;
  flex-shrink: 0;
  accent-color: var(--accent);
  cursor: pointer;
  margin-top: 2px;
}
.block-field-checkbox span strong {
  display: block;
  font-size: 15px;
  color: var(--text);
  font-weight: 600;
  margin-bottom: 2px;
}
.block-field-checkbox .block-field-hint {
  display: block;
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.4;
  font-weight: 400;
}

/* =============================================================
   HOURLY SCHEDULE GRID — Today view as a calendar
   ============================================================= */

.schedule-grid {
  position: relative;
  background: var(--bg-elev);
  border: 1px solid var(--bg-elev-2);
  border-radius: var(--radius);
  /* Fill all the vertical room between the date strip above and the
     fixed schedule-toolbar + tab bar below. Grid scrolls internally
     so all 24 hours are reachable. No max-height cap — full screen. */
  height: calc(100vh - 200px);
  min-height: 360px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.schedule-grid-loading {
  padding: 24px;
  color: var(--text-muted);
  text-align: center;
}

.schedule-grid-inner {
  position: relative;
  /* height set by JS to 24 * HOUR_HEIGHT */
}

/* Each hour row is a horizontal band with a label on the left */
.schedule-hour-row {
  position: absolute;
  left: 0;
  right: 0;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
}
.schedule-hour-row:first-child { border-top: 0; }
/* Subtle band shading for daytime hours so it's easier to scan */
.schedule-hour-row[data-hour="6"],  .schedule-hour-row[data-hour="7"],
.schedule-hour-row[data-hour="8"],  .schedule-hour-row[data-hour="9"],
.schedule-hour-row[data-hour="10"], .schedule-hour-row[data-hour="11"],
.schedule-hour-row[data-hour="12"], .schedule-hour-row[data-hour="13"],
.schedule-hour-row[data-hour="14"], .schedule-hour-row[data-hour="15"],
.schedule-hour-row[data-hour="16"], .schedule-hour-row[data-hour="17"] {
  background: rgba(255, 255, 255, 0.012);
}

.schedule-hour-label {
  position: absolute;
  left: 6px;
  top: -7px;
  font-size: 10px;
  font-weight: 600;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  background: var(--bg-elev);
  padding: 0 3px;
  z-index: 1;
}

/* Block cards positioned absolutely inside the grid — full-width to give
   the title plenty of room. Hour labels in the corner show through where
   blocks don't cover. */
.schedule-block {
  position: absolute;
  left: 36px;       /* small gutter for hour labels */
  right: 6px;
  background: var(--bg);
  border: 1.5px solid var(--bg-elev-2);
  border-left: 4px solid var(--accent);
  border-radius: 8px;
  padding: 6px 10px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  overflow: hidden;
  transition: transform 0.12s ease, border-color 0.12s ease;
  cursor: pointer;
  z-index: 2;
}
.schedule-block:hover {
  border-color: var(--accent);
  transform: translateX(2px);
}
.schedule-block.logged {
  opacity: 0.55;
  border-left-color: var(--leaf);
}

/* Title-left + time-right header row */
.schedule-block-header {
  display: flex;
  align-items: baseline;
  gap: 8px;
  width: 100%;
  min-width: 0;     /* allows the title to ellipsis instead of pushing time off */
}
.schedule-block-label {
  flex: 1 1 auto;
  min-width: 0;
  font-size: 14px;
  color: var(--text);
  font-weight: 600;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.schedule-block-time {
  flex: 0 0 auto;
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 500;
  line-height: 1.2;
  white-space: nowrap;
}
.schedule-block-curriculum {
  font-size: 11px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.schedule-block-logged-tag {
  position: absolute;
  bottom: 4px;
  right: 8px;
  font-size: 10px;
  color: var(--leaf);
  font-weight: 600;
  letter-spacing: 0.5px;
}

/* Tiny mic + camera indicator badges tucked into the header row after
   the time. Inactive: muted but readable. Active: full color + a
   green check badge stacked on top. */
.schedule-block-indicators {
  flex: 0 0 auto;
  display: flex;
  gap: 6px;
  pointer-events: none;
}
.schedule-block-indicator {
  position: relative;
  font-size: 13px;
  line-height: 1;
  opacity: 0.55;
  filter: none;
  transition: opacity 0.12s ease;
}
.schedule-block-indicator.active {
  opacity: 1;
}
.schedule-block-indicator.active::after {
  content: "✓";
  position: absolute;
  bottom: -3px;
  right: -6px;
  font-size: 9px;
  font-weight: 800;
  color: #fff;
  background: var(--leaf);
  border-radius: 50%;
  width: 11px;
  height: 11px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 0 1px var(--bg);
  line-height: 1;
}

/* Visual hint when a neighbor has been pushed down by a drag in progress */
.schedule-block.displaced {
  opacity: 0.85;
  border-style: dashed;
}

/* Resize handle on the bottom edge of soft blocks. Sized generously
   for thumb hits even on phones; the visual grip is a small horizontal
   bar centered on the bottom edge. */
.schedule-block-resize-handle {
  position: absolute;
  left: 0;
  right: 0;
  bottom: -6px;
  height: 14px;
  cursor: ns-resize;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 3;
  touch-action: none;
}
.schedule-resize-grip {
  display: block;
  width: 28px;
  height: 4px;
  background: rgba(255, 255, 255, 0.18);
  border-radius: 2px;
  transition: background 0.12s ease, width 0.12s ease;
}
.schedule-block:hover .schedule-resize-grip,
.schedule-block-resize-handle.active .schedule-resize-grip {
  background: var(--accent);
  width: 44px;
}

/* While resizing, lift the block slightly to draw attention */
.schedule-block.resizing {
  border-color: var(--accent);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.4);
  z-index: 50;
}

/* Block-type tints for the left border */
.schedule-block[data-type="lesson"]          { border-left-color: #d97706; }
.schedule-block[data-type="workshop"]        { border-left-color: #b88a4a; }
.schedule-block[data-type="free_play"]       { border-left-color: #5b7a3a; }
.schedule-block[data-type="extracurricular"] { border-left-color: #b04ad9; }
.schedule-block[data-type="meal"]            { border-left-color: #d96b4a; }
.schedule-block[data-type="chore"]           { border-left-color: #777777; }
.schedule-block[data-type="field_trip"]      { border-left-color: #4a8fd9; }
.schedule-block[data-type="sleep"]           { border-left-color: #2a3a5e; }

/* Locked blocks: distinct visual so the parent knows they're hard-scheduled */
.schedule-block.locked {
  background: linear-gradient(135deg, var(--bg) 0%, rgba(74, 143, 217, 0.08) 100%);
  border-color: rgba(74, 143, 217, 0.4);
  cursor: pointer;     /* still clickable to log; just not draggable */
}
.schedule-block.locked .schedule-block-label {
  font-weight: 700;
}

/* Drag state: lifted block follows the finger */
.schedule-block.dragging {
  transform: scale(1.03);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.55), 0 0 0 2px var(--accent);
  z-index: 100;
  cursor: grabbing;
  transition: transform 0.08s ease, box-shadow 0.08s ease;
  /* The transition on `top` is removed during drag for snappy feel */
}
.schedule-block:not(.dragging) {
  transition: top 0.18s ease, transform 0.12s ease, border-color 0.12s ease;
}
/* Allow the calendar to scroll vertically when the user touches a block
   and immediately swipes — only the long-press timer (380ms) elevates
   the gesture into a drag. Also disables the 300ms double-tap-zoom
   delay, so taps register instantly. */
.schedule-block { touch-action: pan-y; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; }
.schedule-block:active { transform: scale(0.99); }

/* Now-line: thin red line across the grid with a clock label */
.schedule-now-line {
  position: absolute;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--danger);
  z-index: 5;
  pointer-events: none;
}
.schedule-now-line::before {
  content: "";
  position: absolute;
  left: 56px;
  top: -4px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--danger);
  box-shadow: 0 0 0 3px rgba(196, 69, 54, 0.25);
}
.schedule-now-time {
  position: absolute;
  left: 8px;
  top: -10px;
  font-size: 11px;
  font-weight: 700;
  color: var(--danger);
  background: var(--bg-elev);
  padding: 1px 4px;
  border-radius: 4px;
}

@media (max-width: 480px) {
  .schedule-grid { height: calc(100vh - 240px); }
  .schedule-hour-label { font-size: 9px; }
  .schedule-block { left: 32px; right: 4px; padding: 5px 8px; }
  .schedule-block-label { font-size: 13px; }
  .schedule-block-time { font-size: 10px; }
}

/* =============================================================
   ACTIVITY MODAL — rich context, bottom action bar, kid picker,
   mood row, dictation recording state, photo preview, etc.
   ============================================================= */

.act-modal-card {
  display: flex;
  flex-direction: column;
  padding: 0;
  max-height: 92vh;
}
.act-modal-card .modal-header.act-modal-header {
  padding: 16px 22px 12px;
  margin-bottom: 0;
  align-items: flex-start;
}
.act-modal-title-wrap {
  flex: 1;
  min-width: 0;
}
.act-modal-title-wrap h2 {
  font-size: 22px;
  line-height: 1.2;
  margin: 0;
}
.act-modal-subtitle {
  margin-top: 2px;
  font-size: 14px;
  color: var(--accent);
  font-weight: 600;
  letter-spacing: 0.4px;
}

.act-modal-body {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: 12px 22px 8px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.act-modal-details {
  font-size: 16px;
  color: var(--text);
  font-style: italic;
  line-height: 1.4;
  margin: 0;
}
.act-modal-links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0;
}

/* ---- Rich context block (what's supposed to happen) ---- */
.act-context {
  background: rgba(217, 119, 6, 0.08);
  border: 1px solid rgba(217, 119, 6, 0.25);
  border-radius: var(--radius);
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.act-context-time {
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  color: var(--accent);
  font-weight: 600;
}
.act-context-label {
  font-size: 20px;
  font-weight: 600;
  color: var(--text);
  line-height: 1.25;
}
.act-context-meta {
  font-size: 13px;
  color: var(--text-muted);
}
.act-context-details {
  font-size: 15px;
  color: var(--text);
  font-style: italic;
  line-height: 1.5;
  padding-top: 6px;
  border-top: 1px dashed rgba(217, 119, 6, 0.25);
  margin-top: 4px;
}
.act-context-links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 6px;
}
.act-context-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  background: var(--bg);
  border: 1px solid var(--bg-elev-2);
  border-radius: 999px;
  font-size: 14px;
  color: var(--text);
  text-decoration: none;
}
.act-context-link:hover { border-color: var(--accent); }

/* ---- Photo preview (multi-photo grid + delete + add-another) ---- */
.act-photo-preview {
  display: flex;
  flex-direction: column;
  gap: 8px;
  border: 1px solid var(--bg-elev-2);
  border-radius: var(--radius);
  padding: 10px;
  background: var(--bg-elev);
}
.act-photo-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(86px, 1fr));
  gap: 8px;
}
.act-photo-item {
  position: relative;
  width: 100%;
  aspect-ratio: 1 / 1;
  border-radius: 8px;
  overflow: hidden;
  background: var(--bg);
}
.act-photo-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.act-photo-del {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: rgba(26, 20, 16, 0.85);
  border: 1px solid var(--bg-elev-2);
  color: var(--text);
  font-size: 12px;
  font-family: inherit;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.act-photo-del:hover { background: var(--danger); border-color: var(--danger); }
.act-photo-add {
  width: 100%;
  aspect-ratio: 1 / 1;
  background: transparent;
  border: 2px dashed var(--bg-elev-2);
  border-radius: 8px;
  color: var(--accent);
  cursor: pointer;
  font-family: inherit;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  transition: border-color 0.12s ease, background 0.12s ease;
}
.act-photo-add:hover { border-color: var(--accent); background: rgba(217, 119, 6, 0.05); }
.act-photo-add-plus { font-size: 26px; line-height: 1; }
.act-photo-add-label { font-size: 12px; font-weight: 600; }
.act-photo-warn {
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.4;
  margin: 0;
}

/* ---- Pinned bottom region: emoji row + action bar + submit row ---- */
.act-modal-pinned {
  position: relative;            /* anchors the absolute kid-picker overlay */
  border-top: 1px solid var(--bg-elev);
  background: var(--bg);
  padding: 10px 16px calc(12px + env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex-shrink: 0;
}

/* Mood row (5 emoji buttons) */
.act-mood-row {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 6px;
}
.act-mood-btn {
  background: var(--bg-elev);
  border: 1.5px solid var(--bg-elev-2);
  border-radius: var(--radius);
  padding: 10px 0;
  font-size: 26px;
  cursor: pointer;
  font-family: inherit;
  min-height: 48px;
  transition: transform 0.12s ease, background 0.12s ease, border-color 0.12s ease;
}
.act-mood-btn:hover { background: var(--bg-elev-2); }
.act-mood-btn.selected {
  background: rgba(217, 119, 6, 0.25);
  border-color: var(--accent);
  transform: scale(1.05);
}

/* Kid picker column (toggled by Kid button) — overlay so it doesn't shove
   the emoji row up; emojis hide BEHIND it which is fine because the
   picker collapses as soon as a kid is chosen. */
.act-kid-picker {
  position: absolute;
  left: 16px;
  right: 16px;
  bottom: calc(78px + env(safe-area-inset-bottom));   /* sits just above action bar + submit row */
  display: flex;
  flex-direction: column;
  gap: 4px;
  border: 1px solid var(--accent);
  border-radius: var(--radius);
  padding: 6px;
  background: var(--bg-elev);
  box-shadow: 0 -8px 24px rgba(0, 0, 0, 0.4);
  z-index: 10;
}
.act-kid-pick-row {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  background: transparent;
  border: 1.5px solid transparent;
  border-radius: var(--radius);
  color: var(--text);
  font-size: 16px;
  font-family: inherit;
  cursor: pointer;
  text-align: left;
}
.act-kid-pick-row:hover {
  background: var(--bg);
  border-color: var(--bg-elev-2);
}
.act-kid-pick-row.selected {
  background: rgba(217, 119, 6, 0.18);
  border-color: var(--accent);
}

/* Action bar — 4 buttons (Kid / Photo / Dictate / Done) */
.act-action-bar {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
}
.act-action-bar.four-cols { grid-template-columns: repeat(4, 1fr); }
.act-action-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  padding: 10px 6px;
  min-height: 60px;
  background: var(--bg-elev);
  border: 1.5px solid var(--bg-elev-2);
  border-radius: var(--radius);
  color: var(--text);
  font-family: inherit;
  cursor: pointer;
  transition: background 0.12s ease, border-color 0.12s ease, transform 0.12s ease;
}
.act-action-btn:hover { background: var(--bg-elev-2); border-color: var(--accent); }
.act-action-btn:active { transform: scale(0.97); }
.act-action-icon { font-size: 22px; line-height: 1; }
.act-action-label { font-size: 12px; font-weight: 600; }

.act-action-btn-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}
.act-action-btn-primary:hover {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
}

/* Recording state for the Dictate button (pulse + red glow) */
.act-action-btn.recording {
  background: var(--danger);
  border-color: var(--danger);
  color: #fff;
  animation: act-pulse 1.2s ease-in-out infinite;
}
.act-action-btn.recording:hover { background: #d4574a; border-color: #d4574a; }
@keyframes act-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(196, 69, 54, 0.55); }
  50%      { box-shadow: 0 0 0 10px rgba(196, 69, 54, 0); }
}

/* Avatar circle used inside the Kid button + Kid picker rows */
.act-kid-avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0;
  flex-shrink: 0;
}

/* Bottom row: status message + (when editing) delete-as-link */
.act-bottom-row {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 16px;
}
.act-bottom-row .block-form-msg { flex: 1; font-size: 13px; }
.act-delete-link {
  background: transparent;
  border: 0;
  color: var(--danger);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  padding: 6px 8px;
  font-family: inherit;
  text-decoration: underline;
  text-underline-offset: 3px;
}
.act-delete-link:hover { color: #e26054; }

@media (max-width: 480px) {
  .act-action-btn { padding: 8px 4px; min-height: 56px; }
  .act-action-icon { font-size: 20px; }
  .act-action-label { font-size: 11px; }
  .act-mood-btn { font-size: 24px; padding: 8px 0; }
  .act-context-label { font-size: 18px; }
}

/* =============================================================
   KID SUB-DASHBOARD (kid.html)
   ============================================================= */

.kid-today-blocks {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.kid-today-block {
  display: grid;
  grid-template-columns: 110px 1fr auto;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  background: var(--bg-elev);
  border: 1px solid var(--bg-elev-2);
  border-radius: var(--radius);
  cursor: pointer;
  transition: border-color 0.12s ease, transform 0.12s ease;
}
.kid-today-block:hover {
  border-color: var(--accent);
  transform: translateX(2px);
}
.kid-today-block-done {
  opacity: 0.65;
}
.kid-today-block-time {
  font-size: 14px;
  color: var(--text-muted);
  font-weight: 500;
}
.kid-today-block-body { display: flex; flex-direction: column; gap: 4px; }
.kid-today-block-label {
  font-size: 17px;
  color: var(--text);
  font-weight: 500;
}
.kid-today-block-curriculum {
  font-size: 13px;
  color: var(--text-muted);
}
.kid-today-block-log {
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--bg-elev-2);
  border-radius: var(--radius);
  padding: 8px 14px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  font-family: inherit;
}
.kid-today-block-log:hover {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}
.kid-today-block-log.logged {
  background: rgba(91, 122, 58, 0.2);
  border-color: var(--leaf);
  color: var(--leaf);
}

.activity-entry-blocktag {
  font-size: 11px;
  background: rgba(217, 119, 6, 0.18);
  border: 1px solid rgba(217, 119, 6, 0.4);
  color: var(--accent);
  padding: 2px 7px;
  border-radius: 6px;
  font-weight: 500;
}

.kid-profile-card {
  display: flex;
  flex-direction: column;
  gap: 8px;
  background: var(--bg-elev);
  border: 1px solid var(--bg-elev-2);
  border-radius: var(--radius);
  padding: 16px 18px;
}
.kid-profile-row {
  font-size: 15px;
  line-height: 1.5;
  color: var(--text);
}
.kid-profile-row strong { color: var(--text-muted); font-weight: 500; }

/* =============================================================
   TODAY DETAIL PANEL — log button + status
   ============================================================= */

.detail-actions {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--bg-elev);
  display: flex;
  flex-direction: column;
  gap: 10px;
  align-items: flex-start;
}
.detail-log-btn {
  width: 100%;
  padding: 12px 18px;
  border-radius: var(--radius);
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
}
.detail-logged-status {
  font-size: 14px;
  color: var(--leaf);
  font-weight: 500;
}

/* =============================================================
   Mobile tweaks
   ============================================================= */

@media (max-width: 768px) {
  .kid-today-block { grid-template-columns: 90px 1fr auto; gap: 10px; padding: 12px 14px; }
  .kid-today-block-time { font-size: 12px; }
  .kid-today-block-label { font-size: 15px; }
  .kid-action-btn { padding: 12px 16px; font-size: 15px; }
  .modal-card-wide { max-width: 100%; }
}

/* =============================================================
   MEDIA APP — parent gear (kid surface) + parent tab states
   ============================================================= */

.theme-header { position: relative; }
.parent-gear {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: rgba(42, 32, 26, 0.7);
  border: 1.5px solid rgba(255, 255, 255, 0.12);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  font-size: 24px;
  text-decoration: none;
  transition: background 0.15s ease, color 0.15s ease, transform 0.3s ease;
  z-index: 5;
}
.parent-gear:hover {
  background: var(--bg-elev-2);
  color: var(--accent);
  transform: rotate(60deg);
}
.parent-gear-icon { line-height: 1; }

.theme-eyebrow.curriculum-mode { color: var(--leaf); }

/* ---- Parent tab — full-screen state cards (sign-in / PIN / setup) ---- */
.parent-tab-page {
  background:
    radial-gradient(circle at 50% 20%, rgba(217, 119, 6, 0.06), transparent 60%),
    var(--bg);
  min-height: 100vh;
}
.state-shell {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px 20px;
}
.state-card {
  background: var(--bg-elev);
  border: 1px solid var(--bg-elev-2);
  border-radius: var(--radius-lg);
  padding: 32px 28px;
  max-width: 460px;
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 14px;
  box-shadow: var(--shadow);
  position: relative;
}
.state-back {
  font-size: 14px;
  color: var(--text-muted);
  text-decoration: none;
  align-self: flex-start;
}
.state-back:hover { color: var(--accent); }
.state-eyebrow {
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: var(--accent);
  font-weight: 700;
}
.state-card h1 {
  font-size: 28px;
  font-weight: 700;
  color: var(--text);
  line-height: 1.2;
}
.state-blurb {
  font-size: 15px;
  color: var(--text-muted);
  line-height: 1.5;
}
.state-footnote {
  font-size: 13px;
  color: var(--text-dim);
  margin-top: 8px;
  line-height: 1.5;
}
.state-mount { margin-top: 4px; }
.state-msg {
  font-size: 13px;
  color: var(--text-muted);
  min-height: 18px;
}
.state-link {
  background: transparent;
  border: 0;
  color: var(--text-muted);
  text-decoration: underline;
  text-underline-offset: 3px;
  font-size: 13px;
  padding: 8px 0;
  cursor: pointer;
  font-family: inherit;
  align-self: flex-start;
}
.state-link:hover { color: var(--accent); }

/* PIN forms */
.pin-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.pin-form input[type="password"] {
  width: 100%;
  font-size: 22px;
  letter-spacing: 6px;
  text-align: center;
  padding: 14px 16px;
  background: var(--bg);
  border: 1.5px solid var(--bg-elev-2);
  border-radius: var(--radius);
  color: var(--text);
  font-family: inherit;
}
.pin-form input[type="password"]:focus {
  outline: none;
  border-color: var(--accent);
}
.pin-form button.btn-primary { margin-top: 6px; }

.kid-card-pickable {
  background: var(--bg-elev);
  border: 1.5px solid var(--bg-elev-2);
  cursor: pointer;
  text-align: left;
  font-family: inherit;
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.kid-card-pickable:hover { border-color: var(--accent); }
.kid-card-pickable.selected {
  border-color: var(--accent);
  background: rgba(217, 119, 6, 0.12);
}

/* Parent-managed channel + video blocks */
.media-blocks-section {
  padding: clamp(18px, 3vw, 28px);
  border: 1px solid rgba(217, 119, 6, 0.28);
  border-radius: 16px;
  background: linear-gradient(145deg, rgba(217, 119, 6, 0.08), var(--bg-elev));
}

.media-blocks-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.media-blocks-heading .dashboard-section-title { margin: 2px 0 0; }

.media-blocks-kicker {
  margin: 0;
  color: var(--accent);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.media-blocks-count {
  flex: 0 0 auto;
  padding: 6px 10px;
  border: 1px solid rgba(217, 119, 6, 0.30);
  border-radius: 999px;
  color: var(--accent);
  background: rgba(217, 119, 6, 0.10);
  font-size: 12px;
  font-weight: 750;
}

.media-blocks-intro { display: block; margin: 12px 0 18px; line-height: 1.55; }

.media-block-list,
.media-block-search-results {
  display: grid;
  gap: 10px;
}

.media-block-group {
  display: grid;
  gap: 8px;
}

.media-block-group + .media-block-group { margin-top: 8px; }

.media-block-group h3,
.media-block-search-results h3 {
  margin: 4px 0 0;
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.media-block-row,
.media-block-result-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  min-height: 62px;
  padding: 10px 12px;
  border: 1px solid var(--bg-elev-2);
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.16);
}

.media-block-result-row { grid-template-columns: minmax(0, 1fr) auto; }

.media-block-icon {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border-radius: 9px;
  color: #f0bc72;
  background: rgba(217, 119, 6, 0.12);
  font-size: 15px;
}

.media-block-copy {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 3px;
}

.media-block-copy strong {
  overflow: hidden;
  color: var(--text);
  font-size: 14px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.media-block-copy span {
  overflow: hidden;
  color: var(--text-muted);
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.media-block-unblock,
.media-block-result-action {
  min-height: 44px;
  padding: 9px 13px;
  border: 1px solid rgba(217, 119, 6, 0.38);
  border-radius: 9px;
  color: #f0bc72;
  background: rgba(217, 119, 6, 0.08);
  font: inherit;
  font-size: 13px;
  font-weight: 750;
  cursor: pointer;
}

.media-block-unblock:hover,
.media-block-result-action:hover { background: rgba(217, 119, 6, 0.16); }

.media-block-unblock:disabled,
.media-block-result-action:disabled { cursor: default; opacity: 0.58; }

.media-block-empty {
  margin: 0;
  padding: 16px;
  border: 1px dashed var(--bg-elev-2);
  border-radius: 12px;
  color: var(--text-muted);
  font-size: 13px;
  line-height: 1.5;
}

.media-block-search {
  display: grid;
  gap: 8px;
  margin-top: 20px;
}

.media-block-search-row { display: flex; gap: 8px; }

.media-block-search-row .btn-secondary {
  min-height: 48px;
  padding: 10px 16px;
  border: 1px solid var(--bg-elev-2);
  font-size: 14px;
  white-space: nowrap;
}

.media-block-search-row input {
  flex: 1;
  min-width: 0;
  min-height: 48px;
  padding: 11px 13px;
  border: 1px solid var(--bg-elev-2);
  border-radius: 10px;
  outline: 0;
  color: var(--text);
  background: var(--bg);
  font: inherit;
  font-size: 15px;
}

.media-block-search-row input:focus { border-color: var(--accent); }
.media-block-search-results { margin-top: 14px; }

.media-block-privacy-note {
  margin: 14px 0 0;
  padding-top: 12px;
  border-top: 1px solid var(--bg-elev-2);
  color: var(--text-dim);
  font-size: 12px;
  line-height: 1.5;
}

.media-block-dialog {
  width: min(560px, calc(100% - 28px));
  max-height: calc(100dvh - 28px);
  padding: 0;
  overflow: auto;
  border: 1px solid var(--bg-elev-2);
  border-radius: 18px;
  color: var(--text);
  background: var(--bg-elev);
  box-shadow: 0 28px 90px rgba(0, 0, 0, 0.62);
}

.media-block-dialog::backdrop { background: rgba(15, 10, 7, 0.76); backdrop-filter: blur(4px); }

.media-block-dialog-sheet { position: relative; display: grid; gap: 15px; padding: 28px; }
.media-block-dialog-sheet h2 { margin: 0; font-size: 24px; line-height: 1.2; }
.media-block-dialog-detail { margin: -8px 0 0; color: var(--text-muted); line-height: 1.45; }

.media-block-dialog-close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 44px;
  height: 44px;
  border: 0;
  border-radius: 50%;
  color: var(--text-muted);
  background: rgba(255, 255, 255, 0.06);
  font: inherit;
  font-size: 24px;
  cursor: pointer;
}

.media-block-reasons { display: grid; gap: 4px; margin: 0; padding: 0; border: 0; }
.media-block-reasons legend { margin-bottom: 6px; font-size: 14px; font-weight: 750; }
.media-block-reasons legend span { color: var(--text-muted); font-weight: 400; }
.media-block-reasons label { display: flex; align-items: center; gap: 9px; min-height: 40px; font-size: 14px; cursor: pointer; }
.media-block-reasons input { width: 18px; height: 18px; accent-color: var(--accent); }
.media-block-dialog-actions { display: flex; justify-content: flex-end; gap: 10px; }

@media (max-width: 600px) {
  .media-block-search-row { flex-direction: column; }
  .media-block-search-row .btn-secondary { width: 100%; }
  .media-block-row,
  .media-block-result-row { grid-template-columns: auto minmax(0, 1fr); }
  .media-block-result-row { grid-template-columns: minmax(0, 1fr); }
  .media-block-row .media-block-unblock,
  .media-block-result-action { grid-column: 1 / -1; width: 100%; }
  .media-block-dialog { width: 100%; max-width: none; margin: auto 0 0; border-radius: 18px 18px 0 0; }
  .media-block-dialog-sheet { padding: 24px 20px; }
  .media-block-dialog-actions { display: grid; grid-template-columns: 1fr 1fr; }
}

/* =============================================================
   WIND-DOWN MODE — vision §2.12a calm-pacing trio
   Active 18:30–19:30 local. <body> gets `wind-down-mode`. The hero
   rail lives in `.wind-down-section`. Goal: dim chrome and kill
   motion so the bedtime window feels different, not just looks
   different. Honors prefers-reduced-motion always.
   ============================================================= */

.wind-down-mode {
  /* Cooler, dimmer palette — desaturate the warm orange + lower
     brightness without going pitch black (kid still needs to see). */
  filter: brightness(0.78) saturate(0.65) hue-rotate(-12deg);
}
.wind-down-mode .home-page {
  background:
    radial-gradient(ellipse at top, rgba(80, 90, 140, 0.10), transparent 60%),
    var(--bg);
}
.wind-down-mode .theme-eyebrow {
  color: #a3b3d4;
  letter-spacing: 1.5px;
}
.wind-down-mode .theme-title {
  color: #d6dbe8;
}
/* Kill all transitions and animations across the page. */
.wind-down-mode *,
.wind-down-mode *::before,
.wind-down-mode *::after {
  animation-duration: 0s !important;
  animation-delay: 0s !important;
  transition-duration: 0s !important;
  transition-delay: 0s !important;
}
/* Same treatment for users who set OS-level prefers-reduced-motion,
   regardless of wind-down. The wind-down rule covers what the OS
   doesn't. */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0s !important;
    animation-delay: 0s !important;
    transition-duration: 0s !important;
    transition-delay: 0s !important;
  }
}

.wind-down-section {
  /* Subtle separation from the categories grid below. The card grid
     itself uses the existing .card-grid layout — no special rail
     styling beyond a spacing tweak. */
  border-bottom: 1px solid rgba(120, 130, 170, 0.12);
  padding-bottom: 20px;
}
.wind-down-grid .card {
  /* Slightly muted card chrome inside the wind-down rail — keeps the
     calm feeling consistent even outside wind-down hours when a
     parent previews the rail. */
  border: 1px solid rgba(140, 150, 190, 0.10);
}

/* =============================================================
   STREAMING LIBRARY HOME
   A calm, catalog-first home inspired by the sibling streaming app.
   Shelves are editorial/rule-based: there is no opaque recommendation
   ranking on this surface.
   ============================================================= */

.library-page {
  --library-bg: #0b0d12;
  --library-panel: #141821;
  --library-panel-2: #1a202b;
  --library-border: rgba(255, 255, 255, 0.09);
  --library-text: #f5f4ef;
  --library-muted: #a5adba;
  --library-accent: #e6a64b;
  margin: 0;
  min-height: 100vh;
  color: var(--library-text);
  background:
    radial-gradient(circle at 78% -10%, rgba(230, 166, 75, 0.10), transparent 35rem),
    var(--library-bg);
}

.sr-only {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

.kids-appbar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 28px;
  min-height: 68px;
  padding: max(10px, env(safe-area-inset-top)) clamp(18px, 4vw, 56px) 10px;
  border-bottom: 1px solid var(--library-border);
  background: rgba(11, 13, 18, 0.92);
  -webkit-backdrop-filter: blur(18px);
  backdrop-filter: blur(18px);
}

.kids-brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--library-text);
  font-size: 18px;
  font-weight: 650;
  letter-spacing: -0.02em;
  text-decoration: none;
  white-space: nowrap;
}

.kids-brand strong { color: var(--library-accent); }

/* Up to tablet width the app bar shows the short name, so the longer full
   name never pushes the actions further off-screen; the Y mark and the
   link's aria-label keep the full name. */
@media (max-width: 860px) {
  .kids-brand-company { display: none; }
}

.kids-brand-mark {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border-radius: 10px;
  color: #16120c;
  background: linear-gradient(145deg, #f1bf6e, #ca7d27);
  box-shadow: 0 8px 22px rgba(202, 125, 39, 0.22);
  font-family: Georgia, serif;
  font-size: 21px;
  font-weight: 800;
}

.kids-nav {
  display: flex;
  align-items: center;
  gap: 8px;
}

.kids-nav a {
  min-height: 42px;
  padding: 10px 15px;
  border-radius: 999px;
  color: var(--library-muted);
  font-size: 14px;
  font-weight: 700;
  text-decoration: none;
}

.kids-nav a:hover,
.kids-nav a:focus-visible,
.kids-nav a.is-active {
  color: var(--library-text);
  background: rgba(255, 255, 255, 0.08);
}

.kids-appbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.kids-appbar .active-kid-chip,
.kids-appbar .parent-gear {
  position: static;
  inset: auto;
}

.kids-appbar .active-kid-chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 42px;
  padding: 7px 12px 7px 8px;
  border: 1px solid var(--library-border);
  border-radius: 999px;
  color: var(--library-text);
  background: var(--library-panel);
  text-decoration: none;
}

.kids-appbar .active-kid-chip[hidden] { display: none; }

.kids-appbar .parent-gear {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border: 1px solid var(--library-border);
  border-radius: 50%;
  color: var(--library-muted);
  background: var(--library-panel);
  text-decoration: none;
}

.library-main {
  width: 100%;
  max-width: none;
  padding: 0 0 40px;
}

.library-page .search-section {
  width: min(880px, calc(100% - 36px));
  max-width: none;
  margin: clamp(22px, 4vw, 42px) auto clamp(22px, 3vw, 34px);
  padding: 0;
}

.library-page .search-section form {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px;
  border: 1px solid var(--library-border);
  border-radius: 16px;
  background: var(--library-panel);
  box-shadow: 0 14px 40px rgba(0, 0, 0, 0.24);
}

.search-icon {
  padding-left: 10px;
  color: var(--library-muted);
  font-size: 30px;
  line-height: 1;
  transform: rotate(-15deg);
}

.library-page #search-input {
  flex: 1;
  min-width: 0;
  min-height: 48px;
  padding: 10px 8px;
  border: 0;
  outline: 0;
  color: var(--library-text);
  background: transparent;
  font: inherit;
  font-size: 16px;
}

.library-page #search-input::placeholder { color: #747d8b; }

.search-submit,
.search-clear,
.catalog-back,
.hero-action {
  min-height: 44px;
  padding: 10px 18px;
  border: 0;
  border-radius: 10px;
  color: #17130e;
  background: var(--library-accent);
  font: inherit;
  font-size: 14px;
  font-weight: 800;
  cursor: pointer;
}

.search-clear {
  display: none;
  color: var(--library-text);
  background: rgba(255, 255, 255, 0.08);
}

.library-page .search-hint {
  min-height: 18px;
  margin: 8px 8px 0;
  color: var(--library-muted);
  font-size: 13px;
}

.library-section,
.curriculum-feature,
.library-page .cards-section,
.library-page .theme-header {
  width: min(1500px, calc(100% - clamp(36px, 8vw, 112px)));
  max-width: none;
  margin-right: auto;
  margin-left: auto;
}

.curriculum-feature {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(260px, 42%);
  min-height: clamp(300px, 38vw, 480px);
  margin-bottom: clamp(34px, 5vw, 64px);
  overflow: hidden;
  border: 1px solid var(--library-border);
  border-radius: 24px;
  background: var(--library-panel);
  box-shadow: 0 28px 90px rgba(0, 0, 0, 0.32);
}

.curriculum-feature[hidden] { display: none; }

.curriculum-feature-copy {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  padding: clamp(28px, 5vw, 66px);
}

.curriculum-feature-copy::after {
  position: absolute;
  top: 0;
  right: -140px;
  bottom: 0;
  z-index: -1;
  width: 220px;
  background: linear-gradient(90deg, var(--library-panel), transparent);
  content: "";
}

.hero-kicker,
.section-kicker {
  margin: 0 0 8px;
  color: var(--library-accent);
  font-size: 12px;
  font-weight: 850;
  letter-spacing: 0.13em;
  text-transform: uppercase;
}

.curriculum-feature h1 {
  max-width: 720px;
  margin: 0;
  color: var(--library-text);
  font-size: clamp(34px, 5.5vw, 72px);
  line-height: 0.98;
  letter-spacing: -0.045em;
}

.curriculum-feature p.hero-description {
  max-width: 650px;
  margin: 18px 0 24px;
  color: #c7ccd4;
  font-size: clamp(15px, 1.6vw, 19px);
  line-height: 1.55;
}

.hero-meta {
  margin: 0 0 18px;
  color: var(--library-muted);
  font-size: 14px;
  font-weight: 700;
}

.curriculum-feature-art {
  min-height: 260px;
  background-position: center;
  background-size: cover;
}

.library-section { margin-bottom: clamp(34px, 5vw, 58px); }

.section-heading-row {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 16px;
}

.section-heading-row h2 {
  margin: 0;
  color: var(--library-text);
  font-size: clamp(23px, 2.5vw, 32px);
  letter-spacing: -0.025em;
}

.section-see-all {
  color: var(--library-accent);
  font-size: 14px;
  font-weight: 750;
  text-decoration: none;
  white-space: nowrap;
}

.shelf-row {
  display: flex;
  gap: 16px;
  margin-right: calc(clamp(18px, 4vw, 56px) * -1);
  padding: 2px clamp(18px, 4vw, 56px) 14px 2px;
  overflow-x: auto;
  overscroll-behavior-inline: contain;
  scroll-padding-inline: 2px;
  scroll-snap-type: x proximity;
  scrollbar-color: #424a56 transparent;
}

.shelf-row .card {
  flex: 0 0 clamp(245px, 24vw, 330px);
  scroll-snap-align: start;
}

.shelf-row .theme-rail-card { flex-basis: clamp(220px, 20vw, 280px); }

.library-page .card {
  overflow: hidden;
  border: 1px solid var(--library-border);
  border-radius: 14px;
  color: var(--library-text);
  background: var(--library-panel);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.18);
  transition: transform 150ms ease, border-color 150ms ease, box-shadow 150ms ease;
}

.library-page .card:hover,
.library-page .card:focus-within {
  border-color: rgba(230, 166, 75, 0.5);
  outline: 0;
  transform: translateY(-4px);
  box-shadow: 0 18px 42px rgba(0, 0, 0, 0.34);
}

.my-list-empty {
  display: flex;
  min-height: 150px;
  align-items: center;
  padding: clamp(22px, 4vw, 38px);
  border: 1px dashed rgba(230, 166, 75, 0.34);
  border-radius: 16px;
  background: linear-gradient(110deg, rgba(230, 166, 75, 0.07), rgba(255, 255, 255, 0.015));
}

.my-list-empty h2 { margin: 0; color: var(--library-text); font-size: clamp(23px, 2.5vw, 32px); }
.my-list-empty p:last-child { max-width: 620px; margin: 8px 0 0; color: var(--library-muted); line-height: 1.55; }

.video-info-dialog {
  width: min(620px, calc(100% - 28px));
  max-height: calc(100dvh - 28px);
  padding: 0;
  overflow: auto;
  border: 1px solid var(--library-border);
  border-radius: 20px;
  color: var(--library-text);
  background: var(--library-panel);
  box-shadow: 0 32px 100px rgba(0, 0, 0, 0.68);
}

.video-info-dialog::backdrop { background: rgba(3, 6, 10, 0.76); backdrop-filter: blur(5px); }
.video-info-sheet { position: relative; padding: clamp(24px, 5vw, 40px); }
.video-info-sheet h2 { margin: 0; font-size: clamp(26px, 5vw, 40px); line-height: 1.08; letter-spacing: -0.035em; }
.video-info-close {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 44px;
  height: 44px;
  border: 0;
  border-radius: 50%;
  color: var(--library-text);
  background: rgba(255, 255, 255, 0.08);
  font: inherit;
  font-size: 26px;
  cursor: pointer;
}
.video-info-summary { margin: 16px 0 22px; color: #c7ccd4; font-size: 16px; line-height: 1.6; }
.video-info-facts { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin: 0 0 18px; }
.video-info-facts div { padding: 12px; border-radius: 10px; background: rgba(255, 255, 255, 0.045); }
.video-info-facts dt { margin-bottom: 4px; color: var(--library-muted); font-size: 11px; font-weight: 800; letter-spacing: 0.08em; text-transform: uppercase; }
.video-info-facts dd { margin: 0; font-size: 13px; font-weight: 700; }
.video-info-trust { display: flex; gap: 4px; padding: 14px; flex-direction: column; border-left: 3px solid var(--library-accent); border-radius: 0 10px 10px 0; background: rgba(230, 166, 75, 0.08); }
.video-info-trust span { color: var(--library-muted); font-size: 13px; line-height: 1.45; }
.video-info-talk { margin-top: 18px; padding: 16px; border-radius: 12px; background: rgba(106, 168, 79, 0.10); }
.video-info-talk p:last-child { margin: 0; color: #bdd5ae; line-height: 1.5; }
.video-info-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 24px; }
.video-info-save { min-height: 44px; padding: 10px 16px; border: 1px solid var(--library-border); border-radius: 10px; color: var(--library-text); background: rgba(255, 255, 255, 0.05); font: inherit; font-weight: 750; cursor: pointer; }
.video-info-save[aria-pressed="true"] { border-color: rgba(230, 166, 75, 0.55); color: var(--library-accent); background: rgba(230, 166, 75, 0.09); }

.library-page .card-thumb { aspect-ratio: 16 / 9; }
.library-page .card-body { padding: 14px 15px 16px; }
.library-page .card-title { color: var(--library-text); }
.library-page .card-meta { color: var(--library-muted); }
.library-page .card-notes {
  display: -webkit-box;
  margin-top: 8px;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
}
.rail-card .card-number { display: none; }
.rail-card .card-platform-tag { font-size: 10px; opacity: 0.8; }
.rail-card .card-notes { display: none; }
.rail-card .card-coviewing { display: none; }

.resume-progress {
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 3;
  height: 4px;
  background: rgba(255, 255, 255, 0.18);
}

.resume-progress span {
  display: block;
  height: 100%;
  background: var(--library-accent);
}

.topic-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.topic-chip {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  min-height: 48px;
  padding: 11px 16px;
  border: 1px solid var(--library-border);
  border-radius: 12px;
  color: var(--library-text);
  background: var(--library-panel);
  font-size: 14px;
  font-weight: 700;
  text-decoration: none;
}

.topic-chip:hover,
.topic-chip:focus-visible {
  border-color: rgba(230, 166, 75, 0.5);
  background: var(--library-panel-2);
}

.library-page #catalog-view .theme-header {
  min-height: auto;
  margin-top: 18px;
  margin-bottom: 12px;
  padding: 0;
  background: transparent;
}

.library-page #catalog-view .theme-header-inner { padding: 26px 0; }
.library-page .catalog-back { margin-top: 18px; }
.library-page #catalog-view .cards-section { padding: 0; }

.library-error {
  padding: 32px;
  border: 1px solid rgba(217, 119, 6, 0.35);
  border-radius: 16px;
  color: #e7c38f;
  background: rgba(217, 119, 6, 0.08);
}

.library-page .page-footer {
  border-top: 1px solid var(--library-border);
  color: var(--library-muted);
}

@media (max-width: 760px) {
  .kids-appbar {
    grid-template-columns: 1fr auto;
    gap: 12px;
    padding-right: 14px;
    padding-left: 14px;
  }
  .kids-nav {
    grid-column: 1 / -1;
    grid-row: 2;
    order: 3;
    margin: -2px 0 0;
    overflow-x: auto;
  }
  .kids-nav a { min-height: 38px; padding: 8px 13px; }
  .active-kid-chip-name { display: none; }
  .kids-appbar .active-kid-chip { padding-right: 8px; }
  .library-page .search-section { width: calc(100% - 28px); margin-top: 18px; }
  .library-page .search-section form { gap: 4px; }
  .search-submit { width: 46px; padding: 0; font-size: 0; }
  .search-submit::after { font-size: 20px; content: "→"; }
  .search-clear { padding: 8px 11px; }
  .library-section,
  .curriculum-feature,
  .library-page .cards-section,
  .library-page .theme-header {
    width: calc(100% - 28px);
  }
  .curriculum-feature {
    display: flex;
    min-height: 420px;
    flex-direction: column-reverse;
  }
  .curriculum-feature[hidden] { display: none; }
  .curriculum-feature-art { min-height: 185px; }
  .curriculum-feature-copy { padding: 24px; }
  .curriculum-feature-copy::after {
    top: -90px;
    right: 0;
    bottom: auto;
    left: 0;
    width: auto;
    height: 100px;
    background: linear-gradient(0deg, var(--library-panel), transparent);
  }
  .curriculum-feature h1 { font-size: clamp(34px, 11vw, 48px); }
  .curriculum-feature p.hero-description { margin: 12px 0 18px; }
  .shelf-row { gap: 12px; margin-right: -14px; padding-right: 14px; }
  .shelf-row .card { flex-basis: min(78vw, 290px); }
  .shelf-row .theme-rail-card { flex-basis: min(68vw, 250px); }
  .topic-chips { flex-wrap: nowrap; margin-right: -14px; padding: 0 14px 10px 0; overflow-x: auto; }
  .topic-chip { flex: 0 0 auto; }
  .video-info-dialog { width: 100%; max-width: none; margin: auto 0 0; border-radius: 20px 20px 0 0; }
  .video-info-facts { grid-template-columns: 1fr; }
  .video-info-actions { display: grid; grid-template-columns: 1fr 1fr; }
}

/* Parent quick-block: deliberately available on the kid surface, but every
   mutation is protected by the same rate-limited family PIN as settings. */
.player-parent-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
  max-width: 100%;
  margin-left: auto;
}

.btn-block-video {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  min-height: 58px;
  padding: 14px 18px;
  border: 2px solid rgba(196, 69, 54, 0.34);
  border-radius: var(--radius);
  color: #f3c0b9;
  background: rgba(196, 69, 54, 0.10);
  font-size: 18px;
  font-weight: 700;
  transition: background 0.15s, border-color 0.15s;
}

.btn-block-video:hover,
.btn-block-video:focus-visible {
  border-color: #df7164;
  background: rgba(196, 69, 54, 0.22);
  outline: none;
}

.quick-block-dialog {
  width: min(540px, calc(100% - 28px));
  max-height: calc(100dvh - 28px);
  margin: auto;
  padding: 0;
  overflow: auto;
  overscroll-behavior: contain;
  border: 1px solid rgba(255, 255, 255, 0.13);
  border-radius: 22px;
  color: var(--library-text, var(--text));
  background: var(--library-panel, #141821);
  box-shadow: 0 32px 100px rgba(0, 0, 0, 0.76);
}

.quick-block-dialog::backdrop {
  background: rgba(2, 4, 8, 0.82);
  backdrop-filter: blur(6px);
}

.quick-block-sheet {
  position: relative;
  display: grid;
  gap: 18px;
  padding: clamp(24px, 5vw, 38px);
}

.quick-block-close {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  color: var(--library-text, var(--text));
  background: rgba(255, 255, 255, 0.08);
  font-size: 27px;
}

.quick-block-close:hover,
.quick-block-close:focus-visible {
  background: rgba(255, 255, 255, 0.15);
  outline: 2px solid var(--library-accent, var(--accent));
}

.quick-block-kicker {
  padding-right: 48px;
  color: var(--library-accent, #e6a64b);
  font-size: 12px;
  font-weight: 850;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.quick-block-sheet h2 {
  margin-top: -10px;
  font-size: clamp(27px, 5vw, 38px);
  line-height: 1.08;
  letter-spacing: -0.035em;
}

.quick-block-target {
  display: grid;
  gap: 4px;
  margin-top: -8px;
  padding: 13px 15px;
  border-left: 3px solid var(--library-accent, #e6a64b);
  border-radius: 0 10px 10px 0;
  background: rgba(230, 166, 75, 0.08);
  line-height: 1.35;
}

.quick-block-target strong { font-size: 15px; }
.quick-block-target span { color: var(--library-muted, #a5adba); font-size: 13px; }

.quick-block-types {
  display: grid;
  gap: 8px;
  min-width: 0;
  border: 0;
}

.quick-block-types legend,
.quick-block-field > span {
  margin-bottom: 8px;
  color: var(--library-muted, #a5adba);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.quick-block-types label {
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr);
  gap: 11px;
  align-items: start;
  min-height: 58px;
  padding: 11px 13px;
  border: 1px solid rgba(255, 255, 255, 0.10);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.035);
  cursor: pointer;
}

.quick-block-types label:has(input:checked) {
  border-color: rgba(230, 166, 75, 0.56);
  background: rgba(230, 166, 75, 0.09);
}

.quick-block-types input {
  width: 20px;
  height: 20px;
  margin-top: 2px;
  accent-color: var(--library-accent, #e6a64b);
}

.quick-block-types label span { display: grid; gap: 2px; }
.quick-block-types label strong { font-size: 14px; }
.quick-block-types label small { color: var(--library-muted, #a5adba); font-size: 12px; line-height: 1.4; }

.quick-block-field { display: grid; }
.quick-block-field > span small { text-transform: none; letter-spacing: 0; }

.quick-block-field select,
.quick-block-field input {
  width: 100%;
  min-height: 50px;
  padding: 11px 13px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 11px;
  color: var(--library-text, var(--text));
  background: #0f131b;
  font: inherit;
  font-size: 16px;
}

.quick-block-field input:focus,
.quick-block-field select:focus {
  border-color: var(--library-accent, #e6a64b);
  outline: 2px solid rgba(230, 166, 75, 0.20);
}

.quick-block-message {
  min-height: 22px;
  margin-top: -8px;
  color: #f0a69d;
  font-size: 13px;
  line-height: 1.4;
}

.quick-block-actions {
  display: grid;
  grid-template-columns: 1fr 1.25fr;
  gap: 10px;
}

.quick-block-actions button {
  min-height: 50px;
  padding: 11px 16px;
  border-radius: 11px;
  font-size: 15px;
  font-weight: 800;
}

.quick-block-cancel {
  border: 1px solid rgba(255, 255, 255, 0.13);
  background: rgba(255, 255, 255, 0.05);
}

.quick-block-confirm {
  color: #fff;
  background: #b93f31;
}

.quick-block-confirm:hover,
.quick-block-confirm:focus-visible { background: #d05243; outline: 2px solid #f09a8f; }
.quick-block-confirm:disabled { opacity: 0.58; cursor: wait; }

@media (max-width: 768px) {
  .btn-block-video { min-height: 48px; padding: 10px 13px; }
  .btn-block-video .control-label { display: none; }
}

@media (max-width: 560px) {
  .card-actions { gap: 6px; padding: 8px; }
  .card-action { padding-right: 6px; padding-left: 6px; font-size: 12px; }
  .quick-block-dialog {
    width: 100%;
    max-width: none;
    max-height: min(92dvh, 760px);
    margin: auto 0 0;
    border-radius: 22px 22px 0 0;
  }
  .quick-block-sheet { gap: 15px; padding: 24px 18px max(22px, env(safe-area-inset-bottom)); }
  .quick-block-actions { position: sticky; bottom: 0; }
  .btn-block-video { padding: 9px 11px; }
}

@media (max-height: 600px) and (orientation: landscape) {
  .btn-block-video { min-height: 46px; gap: 7px; padding: 9px 12px; font-size: 15px; }
  .quick-block-dialog { max-height: calc(100dvh - 16px); }
  .quick-block-sheet { gap: 12px; padding: 20px 24px; }
  .quick-block-target { padding-top: 9px; padding-bottom: 9px; }
  .quick-block-types { grid-template-columns: 1fr 1fr; }
}

/* Clerk sign-in card (October 6, 2026): the page already has its own heading, and the app's dark-theme field
   styles must not leak into Clerk's white card, where they made the email field dark on dark. */
html .cl-rootBox .cl-headerTitle, html .cl-rootBox .cl-headerSubtitle { display: none !important; }
html .cl-rootBox input.cl-formFieldInput { background: #ffffff !important; color: #1d2b28 !important; border: 1px solid #c9d3cc !important; }
html .cl-rootBox input.cl-formFieldInput::placeholder { color: #6b7a74 !important; opacity: 1; }
html .cl-rootBox .cl-socialButtonsBlockButton { background: #ffffff !important; color: #1d2b28 !important; border: 1px solid #c9d3cc !important; }
