@import url('https://fonts.googleapis.com/css2?family=Noto+Sans+TC:wght@500;700;900&display=swap');

:root {
  --bg: #fffaf3;
  --card: #ffffff;
  --ink: #1f2937;
  --muted: #6b7280;
  --green: #0f9d72;
  --green-dark: #0b6b4f;
  --coral: #ef6351;
  --border: #f0e4d4;
  --shadow: 0 8px 24px rgba(31, 41, 55, 0.07);
}

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

body {
  background: radial-gradient(circle at top, #fff4df 0%, var(--bg) 45%);
  color: var(--ink);
  font-family: 'Noto Sans TC', 'Microsoft JhengHei', system-ui, sans-serif;
  min-height: 100vh;
}

.page-wrap {
  max-width: 1440px;
  margin: 0 auto;
  padding: 12px 16px 28px;
}

.topbar {
  text-align: center;
  margin-bottom: 10px;
}

.topbar h1 {
  font-size: 22px;
  font-weight: 900;
  letter-spacing: 0.02em;
}

.topbar p {
  margin-top: 6px;
  font-size: 14px;
  color: var(--muted);
  font-weight: 700;
}

.stage-grid {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* Desktop / tablet landscape: video on the left, Uncle Tommy's panel on the right */
@media (min-width: 1000px) {
  .stage-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 400px;
    align-items: start;
  }
}

.card {
  background: var(--card);
  border: 2px solid var(--border);
  border-radius: 20px;
  box-shadow: var(--shadow);
  padding: 14px;
}

.video-card {
  padding: 8px;
}

.video-frame {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  border-radius: 14px;
  overflow: hidden;
  background: #0f172a;
  border: 3px solid #fcd34d;
}

.video-frame iframe,
.video-frame #yt-player {
  position: absolute;
  inset: 0;
  width: 100% !important;
  height: 100% !important;
  pointer-events: none;
}

.video-shield {
  position: absolute;
  inset: 0;
  z-index: 3;
  background: transparent;
}

.video-hint {
  margin-top: 10px;
  font-size: 13px;
  font-weight: 700;
  color: var(--muted);
  text-align: center;
}

.guide-card {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
  align-items: stretch;
}

.tommy-stage-wrap {
  position: relative;
  width: 100%;
  height: 170px;
  border-radius: 16px;
  overflow: hidden;
  background: linear-gradient(160deg, #e0f2fe, #d1fae5);
  border: 2px solid #bfdbfe;
}

#tommy-canvas {
  width: 100%;
  height: 100%;
  display: block;
}

.tommy-badge {
  position: absolute;
  top: 10px;
  left: 10px;
  background: rgba(255, 255, 255, 0.94);
  padding: 5px 11px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.speaking-bars {
  display: inline-flex;
  align-items: flex-end;
  gap: 2px;
  height: 12px;
}

.speaking-bars span {
  width: 3px;
  height: 4px;
  border-radius: 99px;
  background: var(--coral);
}

.tommy-status-pill {
  position: absolute;
  bottom: 10px;
  right: 10px;
  background: rgba(15, 23, 42, 0.78);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 999px;
}

.speech-bubble {
  background: #fffbeb;
  border: 2px solid #fde68a;
  border-radius: 16px;
  padding: 14px;
  min-height: 150px;
}

.bubble-tag {
  display: inline-block;
  background: var(--green);
  color: #fff;
  font-size: 11px;
  font-weight: 800;
  padding: 3px 9px;
  border-radius: 999px;
  margin-bottom: 8px;
}

.bubble-text {
  font-size: 19px;
  font-weight: 700;
  line-height: 1.65;
  color: var(--ink);
}

.bubble-question {
  margin-top: 10px;
  padding: 9px 11px;
  background: #fff;
  border: 1.5px solid #fcd34d;
  border-radius: 12px;
  font-size: 20px;
  line-height: 1.45;
  font-weight: 900;
  color: #92400e;
}

.choice-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 10px;
  counter-reset: choice;
}

.choice-btn {
  width: 100%;
  text-align: left;
  padding: 14px 14px;
  border-radius: 16px;
  border: 3px solid #fed7aa;
  background: #fff;
  color: var(--ink);
  font-size: 22px;
  line-height: 1.35;
  font-weight: 900;
  cursor: pointer;
  font-family: inherit;
  display: flex;
  align-items: center;
  gap: 10px;
}

/* Big number badge so Uncle Tommy can say "first / second" */
.choice-btn::before {
  counter-increment: choice;
  content: counter(choice);
  flex: none;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--coral);
  color: #fff;
  display: grid;
  place-items: center;
  font-size: 22px;
  font-weight: 900;
}

.choice-btn:hover:not(:disabled) {
  border-color: var(--coral);
  background: #fff7ed;
}

.choice-btn:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.choice-btn.picked,
.choice-btn.picked:disabled {
  border-color: var(--green);
  background: #ecfdf5;
  color: var(--green-dark);
  opacity: 1;
  cursor: default;
}

.choice-btn.picked::before {
  background: var(--green);
}

.guide-card .btn-continue {
  grid-column: 1 / -1;
}

.btn-continue {
  width: 100%;
  border: none;
  border-radius: 14px;
  padding: 14px;
  font-size: 16px;
  font-weight: 900;
  background: var(--coral);
  color: #fff;
  cursor: pointer;
  font-family: inherit;
  box-shadow: 0 6px 16px rgba(239, 99, 81, 0.28);
}

.btn-continue:hover {
  filter: brightness(1.03);
}

.audio-unlock {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
  display: grid;
  place-items: center;
  z-index: 50;
  padding: 16px;
}

.btn-unlock {
  border: none;
  border-radius: 16px;
  padding: 16px 22px;
  font-size: 18px;
  font-weight: 900;
  background: #fff;
  color: var(--ink);
  cursor: pointer;
  font-family: inherit;
  box-shadow: var(--shadow);
}
/* iPhone / iPad friendliness */
html { -webkit-text-size-adjust: 100%; }
button, .choice-btn, .btn-continue, .btn-unlock {
  touch-action: manipulation;           /* no double-tap zoom delay */
  -webkit-tap-highlight-color: transparent;
}
.btn-unlock { font-size: 22px; padding: 22px 28px; max-width: 90vw; }
.page-wrap { padding-left: max(16px, env(safe-area-inset-left)); padding-right: max(16px, env(safe-area-inset-right)); padding-bottom: max(28px, env(safe-area-inset-bottom)); }

/* Phones: keep the avatar compact so the question and options stay on screen */
@media (max-width: 600px) {
  .tommy-stage-wrap { height: 150px; }
  .choice-btn { font-size: 20px; }
  .bubble-question { font-size: 18px; }
}
