@import url("/shared/fonts/datasquiz-fonts.css");
/* shared/base.css — Datasquiz Apps Platform baseline stylesheet
   Apps link this FIRST, then their own styles.css for overrides.
   Version: APP-FRAME-02 */

/* ============================================================
   1. CSS variable tokens — matches marketplace palette
   ============================================================ */
/* UX-P-01: bridge Web semantic tokens (--text-primary, --surface-*) to legacy --ds-* aliases */
:root {
  --text-primary: #e8f0fc;
  --text-muted: #8ea6c8;
  --surface-1: rgba(10, 17, 32, 0.98);
  --surface-2: #0d1a2e;
  --surface-3: #162035;
  --border-subtle: rgba(148, 163, 184, 0.16);
  --border-strong: rgba(148, 163, 184, 0.28);
  --intent-success: #34d399;
  --intent-warning: #f6ad55;
  --intent-danger: #f87171;
  --intent-info: #60a5fa;
}

body[data-theme="dark"] {
  --text-primary: #e8f0fc;
  --text-muted: #8ea6c8;
  --surface-1: rgba(10, 17, 32, 0.98);
  --surface-2: #0d1a2e;
  --surface-3: #162035;
  --border-subtle: rgba(148, 163, 184, 0.16);
  --border-strong: rgba(148, 163, 184, 0.28);
  --intent-success: #34d399;
  --intent-warning: #f6ad55;
  --intent-danger: #f87171;
  --intent-info: #60a5fa;
}

body[data-theme="light"] {
  --text-primary: var(--ds-text, #111827);
  --text-muted: var(--ds-text-soft, #6b7280);
  --surface-1: var(--ds-surface, #ffffff);
  --surface-2: var(--ds-surface-2, #f9fafb);
  --surface-3: var(--ds-surface-2, #f9fafb);
  --border-subtle: color-mix(in srgb, var(--ds-border, #e5e7eb) 80%, transparent);
  --border-strong: var(--ds-border, #e5e7eb);
  --intent-success: var(--ds-green, #16a34a);
  --intent-warning: var(--ds-gold, #d97706);
  --intent-danger: var(--ds-red, #dc2626);
  --intent-info: var(--ds-purple, #7c3aed);
}

/* APP-FRAME-02: audience personalization tokens — data-audience on html/body */
:root {
  --audience-font-scale: 1;
  --audience-accent: var(--ds-purple, #7c3aed);
  --audience-touch-min: 44px;
}

html[data-audience="kids"],
body[data-audience="kids"],
body.audience-kids {
  --audience-font-scale: 1.125;
  --audience-accent: #f59e0b;
  --audience-touch-min: 48px;
}

html[data-audience="teens"],
body[data-audience="teens"],
body.audience-teens {
  --audience-font-scale: 1.05;
  --audience-accent: #8b5cf6;
  --audience-touch-min: 46px;
}

html[data-audience="adults"],
body[data-audience="adults"],
body.audience-adults {
  --audience-font-scale: 1;
  --audience-accent: var(--ds-purple, #7c3aed);
  --audience-touch-min: 44px;
}

html[data-audience="family"],
body[data-audience="family"],
body.audience-family {
  --audience-font-scale: 1.08;
  --audience-accent: #22c55e;
  --audience-touch-min: 46px;
}

body[data-audience] .ds-btn,
body[data-audience] .primary,
body[data-audience] button:not(.ghost):not(.icon-btn) {
  min-height: var(--audience-touch-min);
  min-width: var(--audience-touch-min);
}

body[data-audience] .shell,
body[data-audience] .studio {
  font-size: calc(1rem * var(--audience-font-scale));
}

body[data-audience] .brand .mark,
body[data-audience] .ds-accent {
  background: var(--audience-accent);
}

:root {
  --ds-purple:        #7c3aed;
  --ds-purple-light:  #ede9fe;
  --ds-purple-dark:   #4c1d95;
  --ds-green:         #16a34a;
  --ds-red:           #dc2626;
  --ds-gold:          #d97706;
  --ds-navy:          #1e1b4b;
  --ds-surface:       #ffffff;
  --ds-surface-2:     #f9fafb;
  --ds-border:        #e5e7eb;
  --ds-text:          #111827;
  --ds-text-soft:     #6b7280;
  --ds-radius-card:   20px;
  --ds-radius-btn:    14px;
  --ds-shadow-card:   0 8px 32px rgba(0,0,0,0.12);
}

body[data-preview="1"] .ds-nav-back,
body.ds-preview-embed .ds-nav-back,
body.ds-preview-embed #ds-platform-nav,
body.ds-preview-embed .back-link,
body.ds-preview-embed .marketplace-back {
  display: none !important;
}

body.ds-preview-embed {
  padding-top: 0;
}

body.ds-preview-embed [data-full-app-only] {
  display: none !important;
}

.ds-demo-mount {
  padding: 12px 12px 0;
  max-width: min(1120px, calc(100vw - 16px));
  margin: 0 auto;
}

.ds-demo-card {
  position: relative;
  overflow: hidden;
  border: 1px solid color-mix(in srgb, var(--ds-demo-accent, #7c3aed) 35%, rgba(255,255,255,.12));
  border-radius: 20px;
  padding: 18px;
  background: linear-gradient(155deg, rgba(255,255,255,.06), rgba(255,255,255,.02));
  box-shadow: 0 24px 60px rgba(0,0,0,.28);
}

.ds-demo-glow {
  position: absolute;
  inset: -40% auto auto -20%;
  width: 280px;
  height: 280px;
  border-radius: 999px;
  background: radial-gradient(circle, color-mix(in srgb, var(--ds-demo-accent, #7c3aed) 40%, transparent), transparent 70%);
  opacity: .45;
  pointer-events: none;
}

.ds-demo-head {
  position: relative;
  display: grid;
  gap: 8px;
  margin-bottom: 14px;
}

.ds-demo-badge {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  min-height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  font-size: .72rem;
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: #061521;
  background: linear-gradient(135deg, var(--ds-demo-accent, #7c3aed), color-mix(in srgb, var(--ds-demo-accent, #7c3aed) 70%, #fff));
}

.ds-demo-badge-soft {
  color: var(--ds-ink, #edf4ff);
  background: rgba(255,255,255,.08);
  border: 1px solid rgba(255,255,255,.12);
}

.ds-demo-title {
  margin: 0;
  font-size: clamp(1.1rem, 2.8vw, 1.45rem);
  line-height: 1.2;
}

.ds-demo-scenarios {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 14px;
}

.ds-demo-scenario {
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 999px;
  background: rgba(255,255,255,.04);
  color: var(--ds-muted, #9db0c7);
  padding: 8px 12px;
  font: inherit;
  cursor: pointer;
}

.ds-demo-scenario.is-active {
  color: #061521;
  border-color: transparent;
  background: linear-gradient(135deg, var(--ds-demo-accent, #7c3aed), color-mix(in srgb, var(--ds-demo-accent, #7c3aed) 70%, #fff));
  font-weight: 700;
}

.ds-demo-flow {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1.15fr);
  gap: 12px;
  align-items: stretch;
}

.ds-demo-panel {
  border: 1px solid rgba(255,255,255,.10);
  border-radius: 16px;
  padding: 14px;
  background: rgba(255,255,255,.03);
}

.ds-demo-label {
  display: block;
  margin-bottom: 8px;
  font-size: .78rem;
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--ds-muted, #9db0c7);
}

.ds-demo-input-text,
.ds-demo-output-body {
  margin: 0;
  line-height: 1.65;
  color: var(--ds-ink, #edf4ff);
}

.ds-demo-arrow {
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--ds-demo-accent, #7c3aed);
  font-size: 1.4rem;
  font-weight: 800;
}

.ds-demo-meta-row {
  margin-top: 12px;
}

.ds-demo-meta {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,.12);
  font-size: .78rem;
  color: var(--ds-muted, #9db0c7);
}

.ds-demo-foot {
  margin-top: 14px;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: space-between;
  align-items: center;
}

.ds-demo-foot p {
  margin: 0;
  color: var(--ds-muted, #9db0c7);
  font-size: .86rem;
  line-height: 1.5;
  max-width: 62ch;
}

.ds-demo-upgrade {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  padding: 0 12px;
  border-radius: 999px;
  background: rgba(116,226,183,.12);
  color: #74e2b7;
  font-size: .82rem;
  font-weight: 700;
}

.ds-demo-fallback {
  margin: 0;
  padding: 16px;
  color: var(--ds-muted, #9db0c7);
}

@media (max-width: 768px) {
  .ds-demo-flow {
    grid-template-columns: 1fr;
  }

  .ds-demo-arrow {
    transform: rotate(90deg);
  }
}

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

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: system-ui, -apple-system, BlinkMacSystemFont, Segoe UI, Roboto, sans-serif;
  background: var(--ds-surface-2);
  color: var(--ds-text);
  min-height: 100dvh;
  line-height: 1.5;
}

img, video, canvas, svg {
  max-width: 100%;
  display: block;
}

button {
  font-family: inherit;
  cursor: pointer;
}

a {
  color: var(--ds-purple);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

/* ============================================================
   3. Audience-aware sizing — body classes set by personalization.js
      .audience-kids / .audience-teens / .audience-adults / .audience-family
   ============================================================ */
body.audience-kids {
  font-size: 18px;
}

body.audience-kids .ds-challenge-card {
  padding: 28px 24px;
}

body.audience-kids .ds-choice-real,
body.audience-kids .ds-choice-ai,
body.audience-kids .ds-choice-unsure {
  font-size: 1.35rem;
  min-height: 72px;
}

body.audience-teens {
  font-size: 17px;
}

body.audience-adults {
  font-size: 16px;
}

body.audience-family {
  font-size: 17px;
}

/* ============================================================
   4. Challenge card — .ds-challenge-card
   ============================================================ */
.ds-challenge-card {
  background: var(--ds-surface);
  border-radius: var(--ds-radius-card);
  box-shadow: var(--ds-shadow-card);
  padding: 24px 20px;
  max-width: 680px;
  margin: 0 auto 24px;
  width: 100%;
}

/* ============================================================
   5. Choice buttons
   ============================================================ */
.ds-choice-real,
.ds-choice-ai,
.ds-choice-unsure {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 64px;
  min-width: 44%;
  font-size: 1.2rem;
  font-weight: 600;
  border: none;
  border-radius: var(--ds-radius-btn);
  color: #ffffff;
  padding: 12px 20px;
  cursor: pointer;
  transition: opacity 0.15s, transform 0.12s;
  text-align: center;
}

.ds-choice-real {
  background: var(--ds-green);
}

.ds-choice-ai {
  background: var(--ds-purple);
}

.ds-choice-unsure {
  background: var(--ds-gold);
}

.ds-choice-real:hover,
.ds-choice-ai:hover,
.ds-choice-unsure:hover {
  opacity: 0.92;
  transform: translateY(-1px);
}

.ds-choice-real:active,
.ds-choice-ai:active,
.ds-choice-unsure:active {
  transform: translateY(0);
  opacity: 1;
}

.ds-choice-real:disabled,
.ds-choice-ai:disabled,
.ds-choice-unsure:disabled {
  opacity: 0.5;
  cursor: default;
  transform: none;
}

/* ============================================================
   6. Clue chips — .ds-clue-chip
   ============================================================ */
.ds-clue-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: 999px;
  border: 2px solid transparent;
  background: var(--ds-surface-2);
  color: var(--ds-text);
  font-size: 0.95rem;
  font-weight: 500;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
  user-select: none;
}

.ds-clue-chip:hover {
  border-color: var(--ds-purple);
  background: var(--ds-surface);
}

.ds-clue-chip.selected {
  border-color: var(--ds-purple);
  background: var(--ds-purple-light);
  color: var(--ds-purple-dark);
}

/* ============================================================
   7. XP / score display — .ds-xp, .ds-streak
   ============================================================ */
.ds-xp {
  color: var(--ds-gold);
  font-weight: 700;
  font-size: 1.1rem;
}

.ds-streak {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-weight: 700;
  font-size: 1rem;
  color: var(--ds-text);
}

.ds-streak[data-streak=0] {
  color: var(--ds-text-soft);
}

/* ============================================================
   8. Speech bubble — .ds-speech-bubble
   ============================================================ */
.ds-speech-bubble {
  background: var(--ds-purple-light);
  border-radius: 16px;
  padding: 16px 20px;
  position: relative;
  color: var(--ds-text);
  font-size: 1rem;
  line-height: 1.6;
}

.ds-speech-bubble::before {
  content: ;
  position: absolute;
  bottom: -10px;
  left: 24px;
  border-width: 10px 10px 0;
  border-style: solid;
  border-color: var(--ds-purple-light) transparent transparent;
}

/* ============================================================
   9. Voice button — .ds-voice-btn
   ============================================================ */
@keyframes ds-pulse-glow {
  0%, 100% { box-shadow: 0 0 0 0px rgba(124, 58, 237, 0.3); }
  50%       { box-shadow: 0 0 0 8px rgba(124, 58, 237, 0.12); }
}

.ds-voice-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 18px;
  border: 2px solid var(--ds-border);
  border-radius: var(--ds-radius-btn);
  background: var(--ds-surface);
  color: var(--ds-text);
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}

.ds-voice-btn:hover {
  border-color: var(--ds-purple);
  background: var(--ds-purple-light);
}

.ds-voice-btn.listening {
  border-color: var(--ds-purple);
  background: var(--ds-purple-light);
  color: var(--ds-purple-dark);
  box-shadow: 0 0 0 4px rgba(124, 58, 237, 0.3);
  animation: ds-pulse-glow 1s infinite;
}

/* ============================================================
   10. Platform nav — .ds-nav
   ============================================================ */
.ds-nav {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 20px;
  background: var(--ds-surface);
  border-bottom: 1px solid var(--ds-border);
  position: sticky;
  top: 0;
  z-index: 100;
}

.ds-nav-back {
  text-decoration: none;
  color: var(--ds-text-soft);
  font-size: 0.9rem;
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  transition: color 0.15s;
}

.ds-nav-back:hover {
  color: var(--ds-purple);
  text-decoration: none;
}

.ds-voice-pill {
  font-size: 0.8rem;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 999px;
  background: var(--ds-surface-2);
  color: var(--ds-text-soft);
  border: 1px solid var(--ds-border);
  margin-left: auto;
}

.ds-voice-pill.active {
  background: var(--ds-purple-light);
  color: var(--ds-purple-dark);
  border-color: var(--ds-purple);
}

/* ============================================================
   11. Welcome card — .ds-welcome-card
   ============================================================ */
.ds-welcome-card {
  background: var(--ds-surface);
  border-radius: var(--ds-radius-card);
  box-shadow: var(--ds-shadow-card);
  padding: 32px 28px;
  max-width: 480px;
  margin: 48px auto;
  text-align: center;
}

.ds-welcome-card h2 {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--ds-navy);
  margin-bottom: 8px;
}

.ds-welcome-card p {
  color: var(--ds-text-soft);
  margin-bottom: 20px;
}

/* ============================================================
   12. Feedback panel — .ds-feedback
   ============================================================ */
.ds-feedback {
  border-radius: 12px;
  padding: 14px 18px;
  font-size: 0.98rem;
  line-height: 1.55;
  border-left: 4px solid transparent;
}

.ds-feedback.correct {
  background: #dcfce7;
  border-left-color: var(--ds-green);
  color: #14532d;
}

.ds-feedback.wrong {
  background: #fef2f2;
  border-left-color: var(--ds-red);
  color: #7f1d1d;
}

.ds-feedback.info {
  background: var(--ds-purple-light);
  border-left-color: var(--ds-purple);
  color: var(--ds-purple-dark);
}

/* ============================================================
   13. Type badge — .ds-type-badge
   ============================================================ */
.ds-type-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  background: var(--ds-surface-2);
  color: var(--ds-text-soft);
  border: 1px solid var(--ds-border);
}

.ds-type-badge.kids-safe    { background: #dcfce7; color: #14532d; border-color: #bbf7d0; }
.ds-type-badge.family-safe  { background: #fef9c3; color: #713f12; border-color: #fde68a; }
.ds-type-badge.general      { background: #dbeafe; color: #1e3a8a; border-color: #bfdbfe; }

/* ============================================================
   14. Responsive — mobile ≤ 768px
   ============================================================ */
@media (max-width: 768px) {
  .ds-challenge-card {
    padding: 18px 14px;
    border-radius: 14px;
    margin-left: 12px;
    margin-right: 12px;
  }

  .ds-choice-real,
  .ds-choice-ai,
  .ds-choice-unsure {
    min-width: 100%;
    font-size: 1.1rem;
  }

  .ds-welcome-card {
    margin: 24px 12px;
    padding: 24px 18px;
  }

  .ds-nav {
    padding: 8px 14px;
  }
}

/* APP-FRAME-05 verbose feedback blocks */
.dq-feedback { display: grid; gap: 10px; text-align: left; }
.dq-feedback-block { display: flex; gap: 10px; align-items: flex-start; padding: 8px 10px; border-radius: 12px; background: rgba(255,255,255,0.06); }
.dq-feedback-icon { font-size: 1.25rem; line-height: 1.2; }
.dq-feedback-evidence { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.dq-feedback-evidence li { display: flex; gap: 8px; align-items: flex-start; }
.challenge-timer { font-weight: 700; color: #f59e0b; margin-top: 8px; }
.game-bar__timer { font-size: 0.85rem; opacity: 0.9; }

/* ============================================================
   15. APP-SCREEN-CONTRACT-01: Four-zone screen contract
   ============================================================ */
/* Every kids-shell screen must have these four zones in this order:
   1. Companion slot (top-left or floating)
   2. Primary-action zone (visually dominant, one clear next action)
   3. Feedback zone (skill-gap reactions, honest failure states)
   4. Background-context zone (non-interactive, ambient)
*/

/* Zone 1: Companion slot */
.screen-companion {
  position: fixed;
  top: 16px;
  left: 16px;
  z-index: 100;
  pointer-events: auto;
}

/* Zone 2: Primary-action zone */
.screen-primary-action {
  position: relative;
  z-index: 50;
  margin: 20px auto;
  max-width: 600px;
}

.screen-primary-action [data-primary-action] {
  display: block;
  width: 100%;
  padding: 16px 24px;
  font-size: 1.125rem;
  font-weight: 700;
  border-radius: 12px;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.screen-primary-action [data-primary-action]:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.15);
}

/* Zone 3: Feedback zone */
.screen-feedback {
  position: relative;
  z-index: 40;
  margin: 16px auto;
  max-width: 600px;
  padding: 16px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.95);
  border-left: 4px solid var(--ds-purple);
}

.screen-feedback.correct {
  border-left-color: var(--ds-green);
  background: #dcfce7;
}

.screen-feedback.wrong {
  border-left-color: var(--ds-red);
  background: #fef2f2;
}

/* Zone 4: Background-context zone (non-interactive) */
.screen-background {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  pointer-events: none;
  opacity: 0.4;
}

/* Screen container enforces zone order */
.screen-container {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  position: relative;
}

.screen-container > .screen-companion { order: 1; }
.screen-container > .screen-primary-action { order: 2; }
.screen-container > .screen-feedback { order: 3; }
.screen-container > .screen-background { order: 4; }

/* ============================================================
   16. COMPANION-01: Shared companion component styles
   ============================================================ */

/* Companion container */
.screen-companion {
  position: fixed;
  top: 16px;
  left: 16px;
  z-index: 100;
  pointer-events: auto;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
}

/* Companion avatar */
.companion-avatar {
  font-size: 2.5rem;
  line-height: 1;
  transition: transform 0.3s ease;
  cursor: pointer;
  user-select: none;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* TOONBEE-CHARACTER-01: real character art, sized to roughly match the emoji
   footprint it replaces. object-fit:contain keeps the character fully visible
   regardless of any future asset aspect-ratio drift. */
.companion-avatar-img {
  width: 64px;
  height: 64px;
  object-fit: contain;
  display: block;
  pointer-events: none;
}

/* Gentle talking bounce, layered on top of whatever expression state (idle,
   encouraging, celebrating, ...) is currently showing -- independent signal
   from the character's expression, matching how speak() now toggles this
   class without changing companion state. */
.screen-companion.companion-talking .companion-avatar-img {
  animation: companion-talk-bounce 0.5s ease-in-out infinite;
}

@keyframes companion-talk-bounce {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.06); }
}

.companion-avatar.celebrate {
  animation: companion-celebrate 0.6s ease-in-out;
}

.companion-avatar.shake {
  animation: companion-shake 0.5s ease-in-out;
}

@keyframes companion-celebrate {
  0%, 100% { transform: scale(1) rotate(0deg); }
  25% { transform: scale(1.3) rotate(-10deg); }
  50% { transform: scale(1.2) rotate(10deg); }
  75% { transform: scale(1.3) rotate(-5deg); }
}

@keyframes companion-shake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-5px) rotate(-5deg); }
  40% { transform: translateX(5px) rotate(5deg); }
  60% { transform: translateX(-5px) rotate(-5deg); }
  80% { transform: translateX(5px) rotate(5deg); }
}

/* Speech bubble */
.companion-bubble {
  background: var(--surface-1);
  color: var(--text-primary);
  padding: 12px 16px;
  border-radius: 16px;
  border: 2px solid var(--border-strong);
  font-size: 0.95rem;
  line-height: 1.4;
  max-width: 280px;
  opacity: 0;
  transform: translateY(-10px);
  transition: opacity 0.3s ease, transform 0.3s ease;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.companion-bubble.visible {
  opacity: 1;
  transform: translateY(0);
}

/* COMPANION-VOICE-INPUT-01: mic affordance -- 48px tappable target (kids'
   fine-motor control is worse than adults', so this is deliberately bigger
   than a typical 44px a11y minimum), pulses while actively listening so a
   pre-reading child gets a visual (not just textual) "I'm hearing you" cue. */
.companion-mic {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: 2px solid var(--border-strong);
  background: var(--surface-1);
  font-size: 1.4rem;
  line-height: 1;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.companion-mic:hover {
  transform: scale(1.08);
}

.companion-mic:active {
  transform: scale(0.95);
}

.companion-mic-listening {
  animation: companion-mic-pulse 1s ease-in-out infinite;
  border-color: var(--ds-purple, #7c3aed);
}

@keyframes companion-mic-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(124, 58, 237, 0.5); }
  50% { box-shadow: 0 0 0 10px rgba(124, 58, 237, 0); }
}

/* DEMO-CHROME-GHOST-01: the preview-mode demo card's "Preview demo" badge
   always renders at the page's top-left corner (see shared/demo-card.js /
   .ds-demo-mount); .screen-companion above independently anchors the
   companion mascot avatar to that same fixed top:16/left:16 corner, so in
   preview mode the avatar visually overlaps and obscures the badge text
   (e.g. "PREVIEW DEMO" reads as "REVIEW DEMO" once covered). Anchor the
   companion to the top-right corner instead while a demo card is showing --
   nothing else renders there. */
body[data-preview="1"] .screen-companion {
  left: auto;
  right: 16px;
  align-items: flex-end;
}

/* Respect prefers-reduced-motion */
@media (prefers-reduced-motion: reduce) {
  .companion-avatar {
    transition: none;
  }
  
  .companion-avatar.celebrate,
  .companion-avatar.shake {
    animation: none;
  }

  .screen-companion.companion-talking .companion-avatar-img {
    animation: none;
  }
  
  .companion-bubble {
    transition: none;
  }

  .companion-mic-listening {
    animation: none;
  }
}

/* === E11 ATTENTION-MODEL-01 === */
[data-attention-focus="primary"] {
  outline: 3px solid var(--accent, #2563eb);
  outline-offset: 3px;
  position: relative;
  z-index: 2;
}
.ds-attention-dimmed {
  opacity: 0.45;
  filter: grayscale(0.15);
  pointer-events: none;
}
.ds-attention-dimmed a,
.ds-attention-dimmed button {
  pointer-events: none;
}

/* === E3-S3 reward rail === */
.ds-reward-rail {
  display: flex;
  gap: 0.75rem;
  align-items: center;
  padding: 0.35rem 0.6rem;
  font-weight: 700;
  font-size: 0.9rem;
}
.ds-reward-rail [data-reward] {
  background: var(--surface-2, #f3f4f6);
  border-radius: 999px;
  padding: 0.2rem 0.65rem;
}

/* === E3-S6 shell lock markers === */
[data-shell-locked="1"] .ds-zone-label[hidden] {
  display: none !important;
}


/* E4B-IMMERSIVE thin prep — honest gated classroom frame */
.classroom-scene-frame { position: relative; }
.classroom-scene-gated {
  margin: 0.5rem 0 0;
  padding: 0.5rem 0.75rem;
  font-size: 0.9rem;
  color: var(--text-secondary, #445);
  background: color-mix(in srgb, var(--surface, #fff) 88%, #cde);
  border-left: 3px solid var(--accent, #3a7);
}
.classroom-scene-frame[data-immersive-enabled="0"] .classroom-scene-art { filter: saturate(0.85); }

/* J-CONSISTENCY / preview: demo primary CTA must dominate sibling buttons */
.ds-demo-primary-cta,
button.ds-demo-primary-cta[data-primary-action] {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  min-width: 220px;
  padding: 12px 22px;
  margin-top: 12px;
  font-size: 1.05rem;
  font-weight: 700;
  border-radius: 14px;
  border: 0;
  cursor: pointer;
  background: #062e28;
  color: #ffffff;
  box-shadow: 0 1px 0 rgba(255,255,255,0.12) inset;
}
.ds-demo-primary-cta:focus-visible {
  outline: 3px solid #ffffff;
  outline-offset: 2px;
}
.ds-demo-scenarios .ds-demo-scenario {
  min-height: 32px;
  font-size: 0.85rem;
  padding: 6px 10px;
}

/* J-CONSISTENCY-LIVE: preview must expose experience zones (multi-screen apps) */
body[data-preview="1"] .screen.screen--challenge,
body.ds-preview-embed .screen.screen--challenge,
body[data-preview="1"] .screen.screen--result,
body.ds-preview-embed .screen.screen--result,
body[data-preview="1"] #challengeScreen,
body.ds-preview-embed #challengeScreen,
body[data-preview="1"] #resultScreen,
body.ds-preview-embed #resultScreen,
body[data-preview="1"] #scorePanel,
body.ds-preview-embed #scorePanel {
  display: block !important;
  visibility: visible !important;
  min-height: 96px;
}
body[data-preview="1"] #scorePanel,
body.ds-preview-embed #scorePanel {
  display: flex !important;
  min-height: 48px;
}
body[data-preview="1"] [data-app-zone],
body.ds-preview-embed [data-app-zone],
[data-shell-locked="1"] [data-app-zone].ds-zone-companion,
[data-shell-locked="1"] [data-app-zone].ds-zone-primary,
[data-shell-locked="1"] [data-app-zone].ds-zone-feedback,
[data-shell-locked="1"] [data-app-zone].ds-zone-background {
  min-width: 160px;
  min-height: 64px;
}
