/* Teacher demo first-screen intro + 3-step picture story */
#teacherShow[hidden], #teacherShow.ti-out{ display:none !important; }
#teacherShow{
  position:fixed; inset:0; z-index:10000;
  display:flex; align-items:stretch; justify-content:center;
  overflow:auto;
  color:#2c3a44;
  font-family:Nunito, "Segoe UI", system-ui, sans-serif;
  background:
    radial-gradient(ellipse 70% 45% at 8% -10%, rgba(243,207,200,.8), transparent 58%),
    radial-gradient(ellipse 55% 40% at 96% 0%, rgba(197,221,232,.75), transparent 55%),
    radial-gradient(ellipse 50% 35% at 80% 110%, rgba(183,216,210,.45), transparent 55%),
    radial-gradient(ellipse 40% 30% at 12% 100%, rgba(212,198,224,.5), transparent 50%),
    linear-gradient(180deg, #fbf7f2 0%, #f7f3ee 42%, #ebe3d6 100%);
  -webkit-font-smoothing:antialiased;
}
html.ti-open, html.ti-open body{ overflow:hidden; height:100%; }
html.ti-open #rotateOverlay{ visibility:hidden !important; pointer-events:none !important; }

#teacherShow .ti-card{
  width:min(760px, 100%);
  margin:auto;
  padding:max(16px, env(safe-area-inset-top)) max(18px, env(safe-area-inset-right)) max(16px, env(safe-area-inset-bottom)) max(18px, env(safe-area-inset-left));
  display:flex; flex-direction:column; gap:12px;
  min-height:100%;
  box-sizing:border-box;
}
#teacherShow .ti-brand{
  font:800 12px/1 Nunito, system-ui, sans-serif;
  letter-spacing:.12em;
  text-transform:uppercase;
  color:#c45b4a;
}
#teacherShow .ti-title{
  font-family:Fraunces, Georgia, serif;
  font-weight:700;
  font-size:clamp(1.7rem, 6vw, 2.35rem);
  line-height:1.05;
  letter-spacing:-.02em;
  color:#2c3a44;
  margin:0;
}
#teacherShow .ti-lead{
  margin:0;
  max-width:36em;
  font:600 15px/1.45 Nunito, system-ui, sans-serif;
  color:#4a5c68;
}
#teacherShow .ti-story{ display:flex; flex-direction:column; gap:8px; min-width:0; }
#teacherShow .ti-track{
  display:flex;
  gap:14px;
  overflow-x:auto;
  overflow-y:hidden;
  scroll-snap-type:x mandatory;
  scroll-behavior:smooth;
  -webkit-overflow-scrolling:touch;
  padding:2px 2px 8px;
  margin:0 -4px;
  scrollbar-width:none;
}
#teacherShow .ti-track::-webkit-scrollbar{ display:none; }
#teacherShow .ti-step{
  flex:0 0 min(86%, 420px);
  scroll-snap-align:center;
  min-width:0;
}
#teacherShow .ti-stage{ position:relative; }
#teacherShow .ti-visual{
  position:relative;
  border-radius:18px;
  overflow:hidden;
  background:#efe6da;
  box-shadow:0 10px 28px rgba(70,90,110,.14);
  aspect-ratio:4/3;
}
#teacherShow .ti-visual img{
  display:block; width:100%; height:100%; object-fit:cover;
}
#teacherShow .ti-mock{
  position:absolute;
  right:8px; bottom:8px;
  width:38%;
  max-width:160px;
  min-width:112px;
  filter:drop-shadow(0 8px 16px rgba(44,58,68,.28));
  pointer-events:none;
}
#teacherShow .ti-caption{ padding:8px 4px 0; }
#teacherShow .ti-label{
  margin:0;
  font:800 13px/1 Nunito, system-ui, sans-serif;
  letter-spacing:.08em;
  text-transform:uppercase;
  color:#c45b4a;
}
#teacherShow .ti-note{
  margin:4px 0 0;
  font:650 15px/1.35 Nunito, system-ui, sans-serif;
  color:#2c3a44;
}
#teacherShow .ti-dots{
  display:flex; justify-content:center; gap:8px;
  padding:2px 0 0;
}
#teacherShow .ti-dot{
  width:8px; height:8px; border-radius:99px;
  border:0; padding:0;
  background:rgba(44,58,68,.22);
  cursor:pointer;
}
#teacherShow .ti-dot.on{ background:#c45b4a; width:22px; }
#teacherShow .ti-actions{
  display:flex; flex-direction:column; align-items:center; gap:8px;
  margin-top:auto; padding-top:6px;
}
#teacherShow .ti-try{
  appearance:none; -webkit-appearance:none;
  display:inline-flex; align-items:center; justify-content:center;
  width:min(100%, 360px);
  height:52px;
  border:0; border-radius:999px;
  background:#d4543e;
  color:#fffaf7;
  font:800 18px/1 Nunito, system-ui, sans-serif;
  letter-spacing:.01em;
  box-shadow:0 6px 0 #a63d2c, 0 10px 24px rgba(168,61,44,.25);
  cursor:pointer;
  -webkit-tap-highlight-color:transparent;
}
#teacherShow .ti-try:hover, #teacherShow .ti-try:focus-visible{ background:#c44732; }
#teacherShow .ti-try:active{ transform:translateY(2px); box-shadow:0 4px 0 #a63d2c, 0 6px 16px rgba(168,61,44,.22); }
#teacherShow .ti-foot{
  margin:0;
  font:600 12px/1.3 Nunito, system-ui, sans-serif;
  color:#5e6e78;
}

/* Phone-frame mocks */
#teacherShow .mock-phone{
  background:#fffaf7;
  border:2px solid #2c3a44;
  border-radius:14px;
  padding:8px 7px 7px;
  color:#2c3a44;
  font-family:Nunito, system-ui, sans-serif;
  position:relative;
}
#teacherShow .mock-phone::before{
  content:""; display:block; width:28%; height:3px; border-radius:99px;
  background:#2c3a44; margin:0 auto 6px; opacity:.7;
}
#teacherShow .mock-h{
  font:800 8px/1.2 Nunito, system-ui, sans-serif;
  margin:0 0 5px;
}
#teacherShow .mock-song{
  display:flex; align-items:center; gap:4px;
  background:#f3cfc8; border-radius:7px; padding:5px 6px;
  font:800 7.5px/1.2 Nunito, system-ui, sans-serif;
  margin-bottom:4px;
}
#teacherShow .mock-song .mock-dot{
  width:8px; height:8px; border-radius:50%; background:#d4543e; flex:none;
}
#teacherShow .mock-meta{
  font:700 6.5px/1.2 Nunito, system-ui, sans-serif;
  color:#5e6e78; margin:0 0 5px;
}
#teacherShow .mock-qr{
  width:42px; height:42px; margin:0 auto 5px;
  background:
    linear-gradient(90deg, #2c3a44 25%, transparent 25% 75%, #2c3a44 75%) 0 0 / 6px 6px,
    linear-gradient(#2c3a44 25%, transparent 25% 75%, #2c3a44 75%) 0 0 / 6px 6px,
    #fffaf7;
  border:1px solid #2c3a44; border-radius:3px;
  box-shadow: inset 3px 3px 0 #2c3a44, inset -3px -3px 0 #2c3a44;
}
#teacherShow .mock-btn{
  background:#d4543e; color:#fffaf7; text-align:center;
  border-radius:99px; font:800 7px/1 Nunito, system-ui, sans-serif;
  padding:5px 0;
}
#teacherShow .mock-play{
  background:linear-gradient(180deg,#fbf7f2,#ebe3d6);
  min-height:72px;
}
#teacherShow .mock-chip{
  display:inline-block; background:#d4a84b; color:#2c3a44;
  font:800 6px/1 Nunito, system-ui, sans-serif;
  padding:2px 5px; border-radius:99px; margin-bottom:4px;
}
#teacherShow .mock-bars{
  display:flex; align-items:flex-end; gap:2px; height:34px; margin:2px 0 4px;
}
#teacherShow .mock-bars i{
  display:block; flex:1; border-radius:1px 1px 0 0;
  background:#7a3e28;
}
#teacherShow .mock-bars i:nth-child(odd){ background:#5a331c; }
#teacherShow .mock-drops{ position:relative; height:16px; }
#teacherShow .mock-drops b{
  position:absolute; top:0; width:6px; height:8px; border-radius:50% 50% 50% 50% / 60% 60% 40% 40%;
  background:#e07a5f;
}
#teacherShow .mock-keys{
  display:flex; height:22px; border:1px solid #2c3a44; border-radius:0 0 4px 4px; overflow:hidden; background:#fffaf7;
  margin:2px 0 4px;
}
#teacherShow .mock-keys span{ flex:1; border-right:1px solid #2c3a44; position:relative; }
#teacherShow .mock-keys span:nth-child(2n)::after,
#teacherShow .mock-keys span:nth-child(3n)::after{
  content:""; position:absolute; left:70%; top:0; width:45%; height:60%;
  background:#2c3a44; border-radius:0 0 1px 1px;
}
#teacherShow .mock-stars{ text-align:center; color:#d4a84b; font-size:9px; letter-spacing:1px; line-height:1; }
#teacherShow .mock-prog .mock-row{
  display:grid; grid-template-columns:8px 1fr auto auto auto;
  align-items:center; gap:3px;
  font:700 6.5px/1 Nunito, system-ui, sans-serif;
  margin:3px 0;
}
#teacherShow .mock-av{ width:8px; height:8px; border-radius:50%; background:#8eb8c9; }
#teacherShow .mock-av.b{ background:#e8a99e; }
#teacherShow .mock-av.c{ background:#7aafa6; }
#teacherShow .mock-ok{ color:#2a8c66; font-weight:800; }
#teacherShow .mock-star{ color:#d4a84b; letter-spacing:-.5px; }

/* Stacked story on roomy desktops */
@media (min-width: 900px) and (min-height: 700px){
  #teacherShow .ti-card{ width:min(820px, 100%); gap:16px; padding-top:32px; padding-bottom:28px; min-height:auto; }
  #teacherShow .ti-track{
    display:flex; flex-direction:column; overflow:visible;
    scroll-snap-type:none; gap:18px; margin:0; padding:0;
  }
  #teacherShow .ti-step{ flex:none; width:auto; }
  #teacherShow .ti-stage{ display:grid; grid-template-columns:1fr 168px; gap:16px; align-items:end; }
  #teacherShow .ti-visual{ aspect-ratio:4/3; }
  #teacherShow .ti-mock{ position:static; width:168px; max-width:none; min-width:0; }
  #teacherShow .ti-dots{ display:none; }
}

/* Landscape phones and short screens: compact three-column-ish intro */
@media (max-height: 500px){
  #teacherShow .ti-card{
    display:grid;
    grid-template-columns: minmax(180px, 28%) minmax(0, 1fr) minmax(140px, 22%);
    grid-template-areas:
      "top story act"
      "lead story act";
    gap:8px 16px;
    align-items:center;
    min-height:100%;
    padding:max(8px, env(safe-area-inset-top)) max(12px, env(safe-area-inset-right)) max(8px, env(safe-area-inset-bottom)) max(12px, env(safe-area-inset-left));
  }
  #teacherShow .ti-brand{ display:none; }
  #teacherShow .ti-title{ font-size:clamp(1.25rem, 4.2vw, 1.7rem); grid-area:top; align-self:end; }
  #teacherShow .ti-lead{ font-size:12.5px; line-height:1.35; grid-area:lead; align-self:start; }
  #teacherShow .ti-story{ grid-area:story; min-width:0; }
  #teacherShow .ti-actions{ grid-area:act; margin:0; padding:0; }
  #teacherShow .ti-try{ width:100%; height:44px; font-size:16px; }
  #teacherShow .ti-visual{ aspect-ratio:16/11; }
  #teacherShow .ti-caption{ padding-top:4px; }
  #teacherShow .ti-note{ font-size:13px; }
  #teacherShow .ti-dots{ padding:0; }
}

@media (prefers-reduced-motion: reduce){
  #teacherShow .ti-track{ scroll-behavior:auto; }
  #teacherShow .ti-try:active{ transform:none; }
}

/* ===== Screenplay showcase ===== */
html.ts-on, html.ts-on body{ overflow:hidden; height:100%; }
html.ts-on #rotateOverlay{ display:none !important; visibility:hidden !important; pointer-events:none !important; }
#teacherShow{
  position:fixed; inset:0; z-index:10000;
  font-family:Nunito, "Segoe UI", system-ui, sans-serif;
  color:#2c3a44;
  pointer-events:none;
}
#teacherShow *{ box-sizing:border-box; }
#teacherShow .ts-chrome, #teacherShow .ts-card, #teacherShow .ts-gate, #teacherShow .ts-end{
  pointer-events:auto;
}
#teacherShow .ts-skip{
  position:absolute; top:max(10px, env(safe-area-inset-top)); right:max(12px, env(safe-area-inset-right));
  z-index:6;
  appearance:none; border:0; background:rgba(255,250,247,.82);
  color:#4a5c68; font:800 12px/1 Nunito, system-ui, sans-serif;
  padding:8px 12px; border-radius:999px; cursor:pointer;
  box-shadow:0 4px 14px rgba(70,90,110,.12);
  backdrop-filter:blur(8px); -webkit-backdrop-filter:blur(8px);
}
#teacherShow .ts-hud{
  position:absolute; inset:0; z-index:5;
  padding: max(10px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right)) max(10px, env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left));
  display:flex; flex-direction:column; align-items:center; gap:8px;
  background:transparent;
  pointer-events:none;
}
#teacherShow .ts-dots{ margin-top:auto; }
#teacherShow .ts-caption{
  margin:0; text-align:center;
  font:800 15px/1.2 Nunito, system-ui, sans-serif;
  color:#2c3a44;
  background:rgba(255,250,247,.92);
  border:1px solid rgba(44,58,68,.08);
  padding:6px 14px; border-radius:999px;
  box-shadow:0 4px 14px rgba(70,90,110,.1);
}
#teacherShow .ts-dots{ display:flex; gap:7px; justify-content:center; }
#teacherShow .ts-dot{
  width:8px; height:8px; border-radius:99px; background:rgba(44,58,68,.22);
}
#teacherShow .ts-dot.on{ background:#d4543e; width:20px; }
#teacherShow .ts-hint{
  display:none; margin:0;
  font:700 12px/1.3 Nunito, system-ui, sans-serif; color:#5e6e78; text-align:center;
}
@media (orientation: portrait) and (max-width: 700px){
  #teacherShow .ts-hint.ts-turn{ display:block; }
}

/* Hide app chrome while the live instrument scenes run */
html.ts-live header.td-chrome,
html.ts-live .td-dock,
html.ts-live .td-chrome,
html.ts-live #tdSide,
html.ts-live #tdSideHandle,
html.ts-live #tdFloatPlay,
html.ts-live #tdMore,
html.ts-live #tdMoreMenu,
html.ts-live .now-playing,
html.ts-live #tryBtn,
html.ts-live .tray-row,
html.ts-live .info-card,
html.ts-live #infoPanel,
html.ts-live .fine,
html.ts-live #sheetBackdrop,
html.ts-live .info-toggle,
html.ts-live .top.td-chrome{ display:none !important; }
html.ts-live .page{ max-width:none; padding:0; height:100%; }
html.ts-live .stage-wrap{ margin:0; height:100dvh; border-radius:0; box-shadow:none; }
html.ts-live .stage{ height:100%; }

/* Dim the instrument under cards */
html.ts-gate .stage-wrap, html.ts-story .stage-wrap, html.ts-end .stage-wrap,
html.ts-gate #tsPiano, html.ts-story #tsPiano, html.ts-end #tsPiano{
  filter:saturate(.85) brightness(.92);
}

/* Full-screen cards: gate, story, end */
#teacherShow .ts-veil{
  position:absolute; inset:0; z-index:4;
  display:flex; align-items:stretch; justify-content:center;
  overflow:auto;
  background:
    radial-gradient(ellipse 70% 45% at 8% -10%, rgba(243,207,200,.8), transparent 58%),
    radial-gradient(ellipse 55% 40% at 96% 0%, rgba(197,221,232,.75), transparent 55%),
    radial-gradient(ellipse 50% 35% at 80% 110%, rgba(183,216,210,.45), transparent 55%),
    linear-gradient(180deg, #fbf7f2 0%, #f7f3ee 42%, #ebe3d6 100%);
  pointer-events:auto;
}
#teacherShow.ts-phase-live .ts-veil{ display:none; }
#teacherShow .ts-card{
  width:min(760px, 100%);
  margin:auto;
  padding:max(16px, env(safe-area-inset-top)) max(18px, env(safe-area-inset-right)) max(16px, env(safe-area-inset-bottom)) max(18px, env(safe-area-inset-left));
  display:flex; flex-direction:column; gap:12px;
  min-height:100%;
}
#teacherShow .ts-brand{
  font:800 12px/1 Nunito, system-ui, sans-serif;
  letter-spacing:.12em; text-transform:uppercase; color:#c45b4a;
}
#teacherShow .ts-title{
  font-family:Fraunces, Georgia, serif;
  font-weight:700; font-size:clamp(1.7rem, 6vw, 2.35rem);
  line-height:1.05; letter-spacing:-.02em; margin:0; color:#2c3a44;
}
#teacherShow .ts-lead{
  margin:0; max-width:36em;
  font:600 15px/1.45 Nunito, system-ui, sans-serif; color:#4a5c68;
}
#teacherShow .ts-try, #teacherShow .ts-start{
  appearance:none; -webkit-appearance:none;
  display:inline-flex; align-items:center; justify-content:center;
  width:min(100%, 360px); height:52px;
  border:0; border-radius:999px;
  background:#d4543e; color:#fffaf7;
  font:800 18px/1 Nunito, system-ui, sans-serif;
  box-shadow:0 6px 0 #a63d2c, 0 10px 24px rgba(168,61,44,.25);
  cursor:pointer;
}
#teacherShow .ts-try:hover, #teacherShow .ts-start:hover,
#teacherShow .ts-try:focus-visible, #teacherShow .ts-start:focus-visible{ background:#c44732; }
#teacherShow .ts-try:active, #teacherShow .ts-start:active{ transform:translateY(2px); box-shadow:0 4px 0 #a63d2c; }
#teacherShow .ts-replay{
  appearance:none; border:0; background:transparent;
  color:#4a5c68; font:800 14px/1 Nunito, system-ui, sans-serif;
  padding:10px 12px; cursor:pointer; text-decoration:underline; text-underline-offset:3px;
}
#teacherShow .ts-actions{ display:flex; flex-direction:column; align-items:center; gap:8px; margin-top:auto; padding-top:8px; }
#teacherShow .ts-foot{ margin:0; font:600 12px/1.3 Nunito, system-ui, sans-serif; color:#5e6e78; }

/* Story inside the screenplay uses existing .ti-* styles */
#teacherShow .ti-track{ margin-top:4px; }
#teacherShow.ts-phase-story .ti-step{ display:none; }
#teacherShow.ts-phase-story .ti-step.on{ display:block; }
#teacherShow.ts-phase-story .ti-dots{ display:none; }

@media (min-width: 900px) and (min-height: 700px){
  #teacherShow.ts-phase-story .ti-step.on{
    display:grid; grid-template-columns:none;
  }
  #teacherShow.ts-phase-story .ti-step.on .ti-stage{
    display:grid; grid-template-columns:1fr 168px; gap:16px; align-items:end;
  }
}

@media (max-height: 500px){
  #teacherShow .ts-caption{ font-size:15px; }
  #teacherShow .ts-title{ font-size:clamp(1.3rem, 4.2vw, 1.8rem); }
  #teacherShow .ts-lead{ font-size:13px; line-height:1.35; max-width:28em; }
  #teacherShow .ts-card{
    display:flex; flex-direction:column; justify-content:center;
    min-height:100%; gap:10px;
    padding:max(10px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right)) max(10px, env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left));
  }
  #teacherShow.ts-phase-gate .ts-card,
  #teacherShow.ts-phase-end .ts-card{
    flex-direction:row; flex-wrap:wrap; align-items:center; justify-content:space-between;
  }
  #teacherShow.ts-phase-gate .ts-title,
  #teacherShow.ts-phase-end .ts-title{ flex:1 1 46%; }
  #teacherShow.ts-phase-gate .ts-lead,
  #teacherShow.ts-phase-end .ts-lead{ flex:1 1 100%; }
  #teacherShow.ts-phase-gate .ts-actions,
  #teacherShow.ts-phase-end .ts-actions{ margin:0; flex:0 0 auto; align-items:flex-end; }
  #teacherShow .ts-start, #teacherShow .ts-try{ width:240px; height:44px; font-size:16px; }
  #teacherShow.ts-phase-story .ti-visual{ aspect-ratio:16/10; }
}

/* Piano live stage */
#tsPiano{
  position:fixed; inset:0; z-index:1;
  display:none;
  background:
    radial-gradient(ellipse 70% 50% at 20% 0%, #2a3a68 0%, transparent 50%),
    radial-gradient(ellipse 50% 40% at 90% 10%, #4a2a58 0%, transparent 46%),
    linear-gradient(180deg, #151a2c 0%, #1b1630 40%, #efe8ff 40%, #f7f3ee 100%);
}
html.ts-live[data-demo="piano"] #tsPiano,
html.ts-gate[data-demo="piano"] #tsPiano,
html.ts-story[data-demo="piano"] #tsPiano,
html.ts-end[data-demo="piano"] #tsPiano{ display:block; }
#tsPiano .tsp-sky{ position:absolute; left:0; right:0; top:0; height:58%; overflow:hidden; }
#tsPiano .tsp-drop{
  position:absolute; width:28px; height:42px; margin-left:-14px;
  border-radius:50% 50% 50% 50% / 60% 60% 40% 40%;
  background:radial-gradient(circle at 35% 30%, #fff 0 12%, var(--c, #3fb98a) 28%, #1f7a4d 100%);
  box-shadow:0 6px 16px rgba(0,0,0,.25);
  display:flex; align-items:flex-end; justify-content:center;
  color:#fff; font:800 11px/1 Nunito, system-ui, sans-serif;
  padding-bottom:7px; transform:translate(-50%, 0);
  z-index:2;
}
#tsPiano .tsp-board{
  position:absolute; left:0; right:0; bottom:0; height:46%;
  display:flex; align-items:stretch;
  padding:0 2% max(8px, env(safe-area-inset-bottom));
}
#tsPiano .tsp-white{
  flex:1; position:relative;
  background:#fbf8f3; border:1px solid #2c3a44; border-radius:0 0 8px 8px;
  box-shadow: inset 0 -10px 0 rgba(44,58,68,.06);
}
#tsPiano .tsp-white.on{
  background:#3fb98a;
  box-shadow: inset 0 -10px 0 rgba(20,80,50,.18), 0 0 18px rgba(63,185,138,.45);
}
#tsPiano .tsp-white span{
  position:absolute; left:0; right:0; bottom:10px;
  text-align:center; font:800 11px/1 Nunito, system-ui, sans-serif; color:#4a5c68;
  pointer-events:none;
}
#tsPiano .tsp-white.on span{ color:#0d3d22; }
#tsPiano .tsp-black{
  position:absolute; top:0; width:58%; height:58%;
  left:72%; z-index:3;
  background:#2c3a44; border-radius:0 0 5px 5px;
  box-shadow:0 6px 10px rgba(0,0,0,.25);
}
#tsPiano .tsp-black.on{ background:#1f7a4d; box-shadow:0 0 16px rgba(63,185,138,.5); }

@media (max-height: 500px){
  #tsPiano{ background:
    radial-gradient(ellipse 70% 50% at 20% 0%, #2a3a68 0%, transparent 50%),
    linear-gradient(180deg, #151a2c 0%, #1b1630 32%, #efe8ff 32%, #f7f3ee 100%);
  }
  #tsPiano .tsp-sky{ height:48%; }
  #tsPiano .tsp-board{ height:56%; }
}

@media (prefers-reduced-motion: reduce){
  #tsPiano .tsp-drop{ transition:none; }
}

#teacherShow.ts-phase-story .ts-card{ padding-bottom:72px; }
#teacherShow.ts-phase-story .ts-hud{ background:none; }

#teacherShow .ts-gate[hidden],
#teacherShow .ts-story[hidden],
#teacherShow .ts-end[hidden],
#teacherShow .ts-veil[hidden]{ display:none !important; }

html.ts-live.td-side-on #app,
html.ts-live.td-side-on .page,
html.ts-live.td-side-on #stageWrapRoot {
  padding-left: 0 !important;
  margin: 0 !important;
}
html.ts-live .stage-wrap, html.ts-live .stage { width: 100% !important; }

@media (max-height: 500px){
  #teacherShow.ts-phase-story .ti-step.on{
    display:grid;
    grid-template-columns: minmax(0,1fr) 150px;
    grid-template-rows: 1fr auto;
    gap:8px 14px;
    align-items:center;
    height:calc(100dvh - 20px);
  }
  #teacherShow.ts-phase-story .ti-stage{ display:contents; }
  #teacherShow.ts-phase-story .ti-visual{
    aspect-ratio:auto;
    height:calc(100dvh - 88px);
    background:#efe6da;
  }
  #teacherShow.ts-phase-story .ti-visual img{ object-fit:contain; }
  #teacherShow.ts-phase-story .ti-mock{ position:static; width:150px; max-width:none; min-width:0; }
  #teacherShow.ts-phase-story .ti-caption{ grid-column:1 / -1; padding:0; }
}

/* === story-scene layout v2 (full-opacity, 45/45 landscape) === */
@keyframes tsSceneIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

#teacherShow .ts-skip { pointer-events: auto; }

/* Do not wash the story with a cream veil. Captions stay full contrast. */
#teacherShow.ts-phase-story .ts-hud {
  background: none !important;
}
#teacherShow.ts-phase-story .ti-label,
#teacherShow.ts-phase-story .ti-note,
#teacherShow.ts-phase-story .ti-visual,
#teacherShow.ts-phase-story .ti-mock,
#teacherShow.ts-phase-story .mock-phone {
  opacity: 1;
}

/* Story card uses the full viewport so the right side is no longer empty. */
#teacherShow.ts-phase-story .ts-story.ts-card {
  width: 100%;
  max-width: none;
  margin: 0;
  min-height: 100%;
  height: 100%;
  justify-content: stretch;
  gap: 12px;
  padding-top: max(56px, calc(env(safe-area-inset-top) + 44px));
  padding-bottom: max(52px, calc(env(safe-area-inset-bottom) + 32px));
  padding-left: max(16px, env(safe-area-inset-left));
  padding-right: max(16px, env(safe-area-inset-right));
}
#teacherShow.ts-phase-story .ti-track {
  display: block;
  overflow: visible;
  height: 100%;
  flex: 1 1 auto;
  margin: 0;
  padding: 0;
  min-height: 0;
}
#teacherShow.ts-phase-story .ti-step {
  display: none;
  flex: none;
  width: auto;
  min-width: 0;
}
#teacherShow.ts-phase-story .ti-step.on {
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: 100%;
  height: 100%;
  min-width: 0;
  min-height: 0;
  opacity: 1;
  animation: tsSceneIn 400ms ease-out;
}
#teacherShow.ts-phase-story .ti-stage {
  position: static;
  display: flex;
  flex-direction: column;
  gap: 14px;
  flex: 1 1 auto;
  min-height: 0;
}
#teacherShow.ts-phase-story .ti-visual {
  position: relative;
  flex: 1 1 auto;
  aspect-ratio: auto;
  height: auto;
  min-height: 0;
  width: 100%;
  background: #efe6da;
}
#teacherShow.ts-phase-story .ti-visual img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 22%;
}
#teacherShow.ts-phase-story .ti-mock {
  position: static;
  width: min(100%, 360px);
  max-width: none;
  min-width: 0;
  margin: 0 auto;
  filter: drop-shadow(0 10px 22px rgba(44,58,68,.22));
  pointer-events: none;
  flex: 0 0 auto;
}
#teacherShow.ts-phase-story .ti-caption {
  padding: 0;
  flex: none;
}
#teacherShow.ts-phase-story .ti-label {
  color: #c45b4a;
  font: 800 13px/1.1 Nunito, system-ui, sans-serif;
  letter-spacing: .08em;
  text-transform: uppercase;
}
#teacherShow.ts-phase-story .ti-note {
  color: #2c3a44;
  margin: 4px 0 0;
  font: 700 16px/1.35 Nunito, system-ui, sans-serif;
}

/* Bigger, readable UI mocks (these were sized for a 150px overlay). */
#teacherShow.ts-phase-story .mock-phone {
  width: 100%;
  height: 100%;
  box-sizing: border-box;
  overflow: hidden;
  border-radius: 28px;
  border-width: 3px;
  padding: 16px 18px 16px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 6px;
  background: #fffaf7;
}
#teacherShow.ts-phase-story .mock-phone::before {
  width: 22%;
  height: 5px;
  margin: 0 auto 8px;
  opacity: 1;
}
#teacherShow.ts-phase-story .mock-h {
  font: 800 18px/1.2 Nunito, system-ui, sans-serif;
  margin: 0 0 8px;
  color: #2c3a44;
}
#teacherShow.ts-phase-story .mock-song {
  font: 800 16px/1.2 Nunito, system-ui, sans-serif;
  padding: 10px 12px;
  gap: 8px;
  border-radius: 12px;
  margin-bottom: 6px;
}
#teacherShow.ts-phase-story .mock-song .mock-dot {
  width: 12px;
  height: 12px;
}
#teacherShow.ts-phase-story .mock-meta {
  font: 700 14px/1.3 Nunito, system-ui, sans-serif;
  margin: 0 0 10px;
  color: #4a5c68;
}
#teacherShow.ts-phase-story .mock-qr {
  width: 100px;
  height: 100px;
  margin: 0 auto 12px;
  background:
    linear-gradient(90deg, #2c3a44 25%, transparent 25% 75%, #2c3a44 75%) 0 0 / 10px 10px,
    linear-gradient(#2c3a44 25%, transparent 25% 75%, #2c3a44 75%) 0 0 / 10px 10px,
    #fffaf7;
  border: 2px solid #2c3a44;
  border-radius: 6px;
  box-shadow: inset 5px 5px 0 #2c3a44, inset -5px -5px 0 #2c3a44;
}
#teacherShow.ts-phase-story .mock-btn {
  font: 800 16px/1 Nunito, system-ui, sans-serif;
  padding: 12px 0;
}
#teacherShow.ts-phase-story .mock-chip {
  font: 800 13px/1 Nunito, system-ui, sans-serif;
  padding: 5px 10px;
  margin-bottom: 8px;
}
#teacherShow.ts-phase-story .mock-bars {
  height: 80px;
  gap: 6px;
  margin: 6px 0 8px;
}
#teacherShow.ts-phase-story .mock-drops { height: 32px; }
#teacherShow.ts-phase-story .mock-drops b {
  width: 14px;
  height: 18px;
}
#teacherShow.ts-phase-story .mock-keys {
  height: 64px;
  margin: 6px 0 8px;
  border-width: 2px;
}
#teacherShow.ts-phase-story .mock-stars {
  font-size: 22px;
  letter-spacing: 2px;
}
#teacherShow.ts-phase-story .mock-prog .mock-row {
  grid-template-columns: 16px 1fr auto auto auto;
  font: 700 15px/1.2 Nunito, system-ui, sans-serif;
  gap: 8px;
  margin: 8px 0;
}
#teacherShow.ts-phase-story .mock-av {
  width: 14px;
  height: 14px;
}

/* Landscape: illustration left ~45%, bigger mock right ~45%, caption under at full contrast. */
@media (orientation: landscape) {
  #teacherShow.ts-phase-story .ti-step.on {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    grid-template-rows: minmax(0, 1fr) auto;
    column-gap: 4%;
    row-gap: 10px;
    align-items: stretch;
    height: 100%;
  }
  #teacherShow.ts-phase-story .ti-stage { display: contents; }
  #teacherShow.ts-phase-story .ti-visual {
    grid-column: 1;
    grid-row: 1;
    height: 100%;
    width: 100%;
    min-height: 0;
  }
  #teacherShow.ts-phase-story .ti-mock {
    grid-column: 2;
    grid-row: 1;
    width: 100%;
    max-width: none;
    margin: 0;
    display: flex;
    align-items: stretch;
    justify-content: stretch;
    min-height: 0;
  }
  #teacherShow.ts-phase-story .ti-caption {
    grid-column: 1 / -1;
    grid-row: 2;
    padding: 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  #teacherShow.ts-phase-story .ti-step.on { animation: none; opacity: 1; }
}

#teacherShow.ts-phase-story .mock-phone > *,
#teacherShow.ts-phase-story .mock-phone::before,
#teacherShow.ts-phase-story .mock-qr,
#teacherShow.ts-phase-story .mock-btn,
#teacherShow.ts-phase-story .mock-song,
#teacherShow.ts-phase-story .mock-bars,
#teacherShow.ts-phase-story .mock-keys {
  flex-shrink: 0;
}
#teacherShow.ts-phase-story .mock-song .mock-dot {
  flex: none;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #d4543e;
  position: static;
  top: auto;
  left: auto;
  margin: 0;
  z-index: auto;
  box-shadow: none;
}
@media (orientation: landscape) and (max-height: 500px) {
  #teacherShow.ts-phase-story .mock-qr {
    width: 72px;
    height: 72px;
  }
}

@media (orientation: landscape) and (max-height: 500px) {
  #teacherShow.ts-phase-story .mock-phone {
    padding: 10px 14px 12px;
    gap: 4px;
    overflow: hidden;
  }
  #teacherShow.ts-phase-story .mock-phone::before {
    margin: 0 auto 4px;
    height: 4px;
  }
  #teacherShow.ts-phase-story .mock-h { font-size: 16px; margin-bottom: 4px; }
  #teacherShow.ts-phase-story .mock-song { font-size: 14px; padding: 8px 10px; margin-bottom: 2px; }
  #teacherShow.ts-phase-story .mock-meta { font-size: 12px; margin-bottom: 4px; }
  #teacherShow.ts-phase-story .mock-qr { width: 56px; height: 56px; margin: 0 auto 6px; }
  #teacherShow.ts-phase-story .mock-btn { font-size: 14px; padding: 8px 0; }
  #teacherShow.ts-phase-story .mock-bars { height: 56px; margin: 4px 0 6px; }
  #teacherShow.ts-phase-story .mock-keys { height: 48px; margin: 4px 0 6px; }
  #teacherShow.ts-phase-story .mock-drops { height: 22px; }
  #teacherShow.ts-phase-story .mock-stars { font-size: 18px; }
  #teacherShow.ts-phase-story .mock-prog .mock-row { font-size: 14px; margin: 5px 0; }
  #teacherShow.ts-phase-story .mock-chip { font-size: 12px; padding: 4px 8px; margin-bottom: 4px; }
}
