/* Haru's Trains - two design systems on purpose.
   Parent surfaces: Airbnb-system warmth (white canvas, ink, one Rausch voltage,
   soft shapes, one shadow tier). Kid screen: calm near-black stage, video-first,
   YouTube-familiar controls; motion only where it carries meaning. */

* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

:root {
  /* parent system (Airbnb DESIGN.md) */
  --primary: #ff385c;
  --primary-active: #e00b41;
  --primary-disabled: #ffd1da;
  --ink: #222222;
  --body: #3f3f3f;
  --muted: #6a6a6a;
  --hairline: #dddddd;
  --hairline-soft: #ebebeb;
  --canvas: #ffffff;
  --surface-soft: #f7f7f7;
  --surface-strong: #f2f2f2;
  --shadow-card: rgba(0,0,0,0.02) 0 0 0 1px, rgba(0,0,0,0.04) 0 2px 6px 0, rgba(0,0,0,0.1) 0 4px 8px 0;
  /* kid stage */
  --stage: #0b0b0d;
  --stage-panel: #16161a;
  --scrub-red: #ff0033;
  --warm-cue: #ffb84d;
  --font: "Inter", -apple-system, system-ui, "Hiragino Sans", "Hiragino Kaku Gothic ProN", Roboto, "Helvetica Neue", sans-serif;
}

html, body { height: 100%; overflow: hidden; }
body { font-family: var(--font); color: var(--ink); user-select: none; -webkit-user-select: none; }

/* Japanese text: never italic, slightly muted, normal weight */
[lang="ja"] { font-style: normal; }

.screen { position: fixed; inset: 0; display: flex; align-items: center; justify-content: center; }
.hidden { display: none !important; }

/* ============ parent surfaces: white canvas, generous, soft ============ */
.parent-surface { background: var(--canvas); overflow-y: auto; overflow-x: clip; }
.parent-surface * { min-width: 0; }

.parent-card {
  width: min(620px, 100vw);
  max-width: 100%;
  padding: 40px 32px calc(40px + env(safe-area-inset-bottom));
  margin: auto;
}

.wordmark {
  font-size: 22px; font-weight: 600; letter-spacing: -0.44px; color: var(--primary);
  margin-bottom: 24px;
}
.wordmark-train { font-size: 20px; }

.card-title { font-size: 22px; font-weight: 600; letter-spacing: -0.44px; line-height: 1.25; color: var(--ink); }
.card-title [lang="ja"] { font-size: 16px; font-weight: 500; color: var(--muted); margin-left: 8px; }
.card-sub { font-size: 16px; font-weight: 400; color: var(--body); margin-top: 6px; line-height: 1.6; }
.card-hint { font-size: 14px; color: var(--muted); margin: 16px 0 4px; line-height: 1.6; }

/* tonight's video: photo-first listing card */
.video-card {
  border-radius: 14px; overflow: hidden;
  border: 1px solid var(--hairline-soft);
  box-shadow: var(--shadow-card);
  margin-bottom: 32px;
}
.video-card-photo { display: block; width: 100%; aspect-ratio: 16 / 9; object-fit: cover; }
.video-card-meta { padding: 16px; }
.video-card-title { font-size: 16px; font-weight: 600; line-height: 1.25; }
.video-card-title [lang="ja"] { font-weight: 500; color: var(--muted); margin-left: 6px; }
.video-card-sub { font-size: 14px; color: var(--muted); margin-top: 4px; line-height: 1.43; }

.field { margin-bottom: 28px; }
.field-label { font-size: 14px; font-weight: 500; color: var(--ink); margin-bottom: 10px; }
.field-label [lang="ja"] { color: var(--muted); font-weight: 400; margin-left: 6px; }

.level-picker { display: flex; gap: 10px; }
.level-btn {
  flex: 1; display: flex; flex-direction: column; align-items: flex-start; gap: 2px;
  background: var(--canvas); color: var(--ink);
  border: 1px solid var(--hairline); border-radius: 14px;
  padding: 14px; font-family: var(--font); cursor: pointer; text-align: left;
}
.level-btn .level-num { font-size: 20px; font-weight: 600; line-height: 1.2; }
.level-btn .level-name { font-size: 14px; font-weight: 500; line-height: 1.3; }
.level-btn .level-desc { font-size: 12px; color: var(--muted); line-height: 1.4; }
.level-btn.selected { border: 2px solid var(--ink); padding: 13px; }

.preload-row { margin-bottom: 20px; }
.preload-status { font-size: 14px; color: var(--muted); margin-bottom: 8px; }
.preload-bar { height: 6px; background: var(--surface-strong); border-radius: 3px; overflow: hidden; }
#preload-fill { height: 100%; width: 0%; background: var(--ink); border-radius: 3px; transition: width 0.2s; }

/* the one Rausch voltage */
.cta {
  display: block; width: 100%; min-height: 52px; padding: 14px 24px;
  background: var(--primary); color: #fff; border: none; border-radius: 8px;
  font-family: var(--font); font-size: 16px; font-weight: 500; line-height: 1.4; cursor: pointer;
}
.cta:active { background: var(--primary-active); }
.cta:disabled { background: var(--primary-disabled); }
.cta [lang="ja"] { font-size: 14px; opacity: 0.9; margin-left: 6px; }
.cta.secondary {
  background: var(--canvas); color: var(--ink);
  border: 1px solid var(--ink); margin-top: 12px;
}
.cta.secondary:active { background: var(--surface-soft); }
.cta + .cta { margin-top: 12px; }

.tip-row {
  display: flex; gap: 10px; align-items: flex-start;
  margin-top: 24px; padding-top: 20px; border-top: 1px solid var(--hairline-soft);
  font-size: 13px; color: var(--muted); line-height: 1.6;
}
.tip-icon { font-size: 14px; }

/* session report: visual recall cards */
.report-options { display: flex; flex-direction: column; gap: 12px; margin: 16px 0 20px; }
.report-option {
  display: flex; align-items: center; gap: 14px;
  background: var(--canvas); border: 1px solid var(--hairline); border-radius: 14px;
  padding: 10px; font-family: var(--font); cursor: pointer; text-align: left;
}
.report-option:active { background: var(--surface-soft); }
.report-thumb { width: 112px; aspect-ratio: 16 / 9; object-fit: cover; border-radius: 8px; flex-shrink: 0; }
.report-word { font-size: 18px; font-weight: 600; color: var(--ink); line-height: 1.3; }
.report-word-sub { display: block; font-size: 13px; font-weight: 400; color: var(--muted); margin-top: 2px; }
.report-thanks { margin-top: 20px; font-size: 18px; font-weight: 500; color: var(--ink); text-align: center; }

/* ============ kid screen: calm dark stage, video-first ============ */
#kid-screen { flex-direction: column; background: var(--stage); }
#video-wrap { position: relative; flex: 1; width: 100%; display: flex; align-items: center; justify-content: center; overflow: hidden; }
#video { width: 100%; height: 100%; object-fit: contain; }

#big-play {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%);
  width: 128px; height: 128px; border-radius: 50%; border: none;
  background: rgba(255, 255, 255, 0.92); color: var(--ink); font-size: 48px; cursor: pointer;
  display: flex; align-items: center; justify-content: center; padding-left: 10px;
  box-shadow: var(--shadow-card);
}

#tap-layer { position: absolute; inset: 0; }
.tap-target {
  position: absolute; border-radius: 20px; cursor: pointer;
  border: 4px solid rgba(255, 184, 77, 0.95);
  background: rgba(255, 184, 77, 0.10);
  animation: glow 1.8s ease-in-out infinite;
}
@keyframes glow {
  0%, 100% { box-shadow: 0 0 0 0 rgba(255, 184, 77, 0.4); }
  50% { box-shadow: 0 0 28px 8px rgba(255, 184, 77, 0.5); }
}

/* the product's one loud typographic moment */
#word-display {
  position: absolute; left: 50%; bottom: 12%; transform: translateX(-50%);
  background: rgba(11, 11, 13, 0.88); border-radius: 24px; padding: 18px 44px;
  font-size: 64px; font-weight: 700; letter-spacing: -1px; color: #fff; white-space: nowrap;
  text-align: center; animation: pop 0.3s ease-out;
}
#word-display .romaji { display: block; font-size: 20px; font-weight: 500; letter-spacing: 0; color: var(--warm-cue); }
@keyframes pop { 0% { transform: translateX(-50%) scale(0.7); opacity: 0; } 100% { transform: translateX(-50%) scale(1); opacity: 1; } }

/* expectant breathing ring: an invitation, not an alarm */
#paw-pulse {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%);
  width: 180px; height: 180px; border-radius: 50%; pointer-events: none;
  border: 6px solid rgba(255, 184, 77, 0.85);
  animation: breathe 1.5s ease-in-out infinite;
}
@keyframes breathe {
  0%, 100% { transform: translate(-50%, -50%) scale(0.85); opacity: 0.55; }
  50% { transform: translate(-50%, -50%) scale(1.1); opacity: 1; }
}

#parent-gate { position: absolute; left: 0; top: 0; width: 90px; height: 90px; }

/* controls: YouTube-familiar, big targets */
#controls {
  width: 100%; padding: 14px 20px calc(18px + env(safe-area-inset-bottom));
  display: flex; align-items: center; gap: 16px; background: var(--stage-panel);
}
#play-pause {
  width: 60px; height: 60px; border-radius: 50%; border: none; flex-shrink: 0;
  background: rgba(255, 255, 255, 0.14); color: #fff; font-size: 24px; cursor: pointer;
}
#scrubber { flex: 1; padding: 18px 0; cursor: pointer; touch-action: none; }
#scrub-track { position: relative; height: 10px; background: rgba(255, 255, 255, 0.18); border-radius: 5px; }
#scrub-fill { position: absolute; left: 0; top: 0; bottom: 0; width: 0%; background: var(--scrub-red); border-radius: 5px; }
#scrub-thumb {
  position: absolute; top: 50%; left: 0%; transform: translate(-50%, -50%);
  width: 32px; height: 32px; border-radius: 50%; background: var(--scrub-red);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.5);
}

@media (max-width: 600px) {
  .parent-card { padding: 28px 20px calc(32px + env(safe-area-inset-bottom)); }
  .level-picker { flex-direction: column; }
  .level-btn { flex-direction: row; align-items: center; gap: 12px; }
  #word-display { font-size: 44px; padding: 14px 30px; }
}
