/* Fairy-tale series (FAIRYTALE.md): stages, animated cutouts, particles, hub, gallery, episode framing, finale.
   Per-series colours come in as --tale-main / --tale-deep / --tale-glow. Motion only animates transform/opacity. */
.tale-bg { position: absolute; inset: 0; background: #2B2166 center / cover no-repeat; animation: taleKen 28s ease-in-out infinite alternate; }
@keyframes taleKen { from { transform: scale(1.02); } to { transform: scale(1.08) translate(-1%, -.6%); } }

/* ---------- characters ---------- */
.tale-actor { position: absolute; bottom: 0; animation: taleBreath 3.6s ease-in-out infinite; transform-origin: 50% 100%; }
.tale-actor.floats { animation: taleFloat 4.2s ease-in-out infinite; }
.tale-side.floats { animation-duration: 3.1s; animation-delay: -1.2s; }
.tale-actor-in { position: relative; width: 100%; height: 100%; transform-origin: 50% 100%; }
.tale-actor-in.hop { animation: taleHop .75s cubic-bezier(.3, 1.3, .5, 1); }
.tale-actor img { position: absolute; bottom: 0; left: 50%; height: 100%; width: auto; max-width: none; transform: translateX(-50%);
  opacity: 0; transition: opacity .28s ease; pointer-events: none; user-select: none; }
.tale-actor img.on { opacity: 1; }
.tale-actor img.p-cheer { height: 106%; }
.tale-actor:not(.floats)::before { content: ''; position: absolute; left: 22%; right: 22%; bottom: -2%; height: 7%;
  background: radial-gradient(closest-side, rgba(20, 10, 40, .35), transparent); border-radius: 50%; }
@keyframes taleBreath { 0%, 100% { transform: scale(1, 1); } 50% { transform: scale(1.012, .985); } }
@keyframes taleFloat { 0%, 100% { transform: translateY(0) rotate(-1deg); } 50% { transform: translateY(-4%) rotate(1.2deg); } }
@keyframes taleHop {
  0% { transform: none; } 14% { transform: scale(1.08, .9); } 42% { transform: translateY(-16%) scale(.95, 1.07); }
  72% { transform: translateY(0) scale(1.05, .95); } 86% { transform: scale(.98, 1.02); } 100% { transform: none; } }
.tale-actor.enter { animation: taleEnter .9s cubic-bezier(.2, 1.2, .4, 1) both, taleBreath 3.6s ease-in-out .9s infinite; }
.tale-actor.floats.enter { animation: taleEnter .9s cubic-bezier(.2, 1.2, .4, 1) both, taleFloat 4.2s ease-in-out .9s infinite; }
@keyframes taleEnter { from { opacity: 0; transform: translateY(12%) scale(.9); } to { opacity: 1; transform: none; } }

/* ---------- head portrait ---------- */
.tale-head { display: inline-block; width: 44px; height: 44px; border-radius: 50%; flex: none;
  background-color: var(--tale-glow, #FFE39A); background-repeat: no-repeat; box-shadow: 0 0 0 3px #fff, 0 3px 10px rgba(0, 0, 0, .18); }

/* ---------- ambient particles ---------- */
.tale-fx { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.tale-fx i { position: absolute; left: var(--x); top: var(--y); animation: var(--anim) var(--t) ease-in-out var(--d) infinite; }
.fx-glow i { --anim: fxGlow; width: calc(10px * var(--s)); height: calc(10px * var(--s)); border-radius: 50%;
  background: radial-gradient(circle, #FFF6B8 0%, var(--tale-glow) 45%, transparent 72%); }
@keyframes fxGlow { 0%, 100% { transform: translate(0, 0); opacity: .15; } 30% { opacity: 1; } 50% { transform: translate(18px, -26px); opacity: .9; } 80% { opacity: .2; } }
.fx-star i { --anim: fxStar; width: calc(14px * var(--s)); height: calc(14px * var(--s));
  background: #FFF4C2; clip-path: polygon(50% 0, 61% 39%, 100% 50%, 61% 61%, 50% 100%, 39% 61%, 0 50%, 39% 39%); }
@keyframes fxStar { 0%, 100% { transform: scale(.3) rotate(0); opacity: 0; } 50% { transform: scale(1) rotate(45deg); opacity: 1; } }
.fx-spark i { --anim: fxSpark; width: calc(7px * var(--s)); height: calc(7px * var(--s)); border-radius: 50%;
  background: radial-gradient(circle, #FFF1C9, var(--tale-glow) 55%, transparent 75%); }
@keyframes fxSpark { 0% { transform: translate(0, 40px); opacity: 0; } 25% { opacity: 1; } 100% { transform: translate(14px, -90px); opacity: 0; } }
.fx-bubble i { --anim: fxBubble; width: calc(16px * var(--s)); height: calc(16px * var(--s)); border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, .75); background: radial-gradient(circle at 32% 30%, rgba(255, 255, 255, .8) 0 18%, rgba(255, 255, 255, .08) 22%); }
@keyframes fxBubble { 0% { transform: translate(0, 60px); opacity: 0; } 15% { opacity: .9; } 50% { transform: translate(10px, -20px); } 100% { transform: translate(-6px, -120px); opacity: 0; } }
.fx-breeze i { --anim: fxBreeze; width: calc(46px * var(--s)); height: 4px; border-radius: 4px; background: linear-gradient(90deg, transparent, rgba(255, 255, 255, .85), transparent); }
@keyframes fxBreeze { 0% { transform: translateX(-80px); opacity: 0; } 30% { opacity: .9; } 100% { transform: translateX(140px); opacity: 0; } }

/* ---------- stage (hub / gallery) ---------- */
.tale-stage { position: relative; overflow: hidden; border-radius: 28px; background: var(--tale-deep); box-shadow: 0 10px 34px rgba(30, 20, 70, .22); isolation: isolate; }
.tale-cast { position: absolute; inset: 0; pointer-events: none; }

/* ---------- home hub ---------- */
.hub { flex: 1; width: 100%; max-width: 1180px; margin: 0 auto; padding: 0 22px 28px; display: flex; flex-direction: column; gap: 18px; }
.hub-stage { display: grid; grid-template-columns: 1fr min(47%, 520px); min-height: clamp(360px, 56vh, 470px); cursor: pointer; }
.hub-stage .tale-hero { left: 2%; height: min(92%, 440px); width: 34%; }
.hub-stage .tale-side { left: 29%; bottom: 44%; height: min(30%, 150px); width: 16%; }
.hub-panel { position: relative; grid-column: 2; align-self: center; margin: 16px 16px 16px 0; cursor: default;
  background: rgba(255, 255, 255, .92); border-radius: 26px; padding: 18px 22px 20px;
  display: flex; flex-direction: column; gap: 10px; align-items: flex-start; box-shadow: 0 10px 30px rgba(20, 10, 50, .2); }
.tale-kicker { font-size: 15px; font-weight: 900; letter-spacing: .8px; text-transform: uppercase; color: var(--tale-deep); }
.tale-epno { font-size: 16px; font-weight: 900; color: #fff; background: var(--tale-main); border-radius: 999px; padding: 3px 12px; }
.hub-title { font-size: 30px; font-weight: 900; color: var(--ink); line-height: 1.1; }
.hub-bubble { font-size: 19px; align-self: stretch; }
.hub-bubble b { color: var(--tale-deep); }
.hub .start { background: var(--tale-main); box-shadow: 0 5px 0 var(--tale-deep); }
.hub-row { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.hub-row .streak { font-size: 18px; }
.hub-row .wd { width: 38px; }
.hub-got { display: inline-flex; align-items: center; gap: 6px; font-weight: 900; color: var(--tale-deep); }
.hub-got img { width: 30px; height: 30px; object-fit: contain; }
.tale-season { display: flex; flex-direction: column; gap: 8px; }
.tale-season-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; padding: 0 4px; }
.tale-season-head h2 { font-size: 20px; }
.tale-eps { display: grid; grid-auto-flow: column; grid-auto-columns: 150px; gap: 12px; overflow-x: auto; padding: 4px 4px 10px; scroll-snap-type: x proximity; }
.ep-card { position: relative; border-radius: 16px; overflow: hidden; background: #fff; box-shadow: var(--sh); scroll-snap-align: start; text-align: left; }
.ep-card img { display: block; width: 100%; aspect-ratio: 3 / 2; object-fit: cover; }
.ep-card b { display: block; font-size: 14px; line-height: 1.2; padding: 6px 9px 9px; min-height: 42px; }
.ep-card .ep-n { position: absolute; top: 6px; left: 6px; min-width: 28px; height: 28px; border-radius: 999px; padding: 0 7px;
  background: rgba(255, 255, 255, .92); font-weight: 900; font-size: 14px; display: grid; place-items: center; }
.ep-card.done .ep-n { background: var(--green); color: #fff; }
.ep-card.now { box-shadow: 0 0 0 4px var(--tale-main), var(--sh); }
.ep-card.now .ep-n { background: var(--tale-main); color: #fff; }
.ep-card.later img { filter: saturate(.35) brightness(.9); }
.ep-card.later b { color: var(--muted); }
.hub .tiles { grid-template-columns: repeat(7, 1fr); gap: 12px; }
.hub .tile { padding: 14px 8px 12px; font-size: 16px; }
.hub .tile-ic { font-size: 36px; }
.hub .tile-ic .tale-head { width: 52px; height: 52px; }

.prof-hero { position: relative; width: 120px; height: 140px; }
.prof-hero .tale-hero { left: 0; right: 0; height: 100%; }
.who .tale-head { width: 40px; height: 40px; }

/* ---------- hero gallery ---------- */
.tale-heroes-main { flex: 1; width: 100%; max-width: 1200px; margin: 0 auto; padding: 0 22px 30px; display: flex; flex-direction: column; gap: 14px; }
.tale-heroes-main > p { margin: 0; text-align: center; font-size: 19px; font-weight: 700; color: var(--ink2); }
.tale-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.hero-card { position: relative; height: 250px; border-radius: 24px; overflow: hidden; text-align: left; color: #fff; isolation: isolate;
  box-shadow: 0 8px 24px rgba(30, 20, 70, .22); transition: transform .15s, box-shadow .15s; }
.hero-card:hover { transform: translateY(-4px); }
.hero-card.on { box-shadow: 0 0 0 5px #fff, 0 0 0 10px var(--tale-main), 0 14px 34px rgba(30, 20, 70, .35); transform: translateY(-4px) scale(1.02); }
.hero-card .tale-bg { animation: none; transition: transform .6s ease; }
.hero-card:hover .tale-bg { transform: scale(1.04); }
.hero-card.on .tale-bg { animation: taleKen 14s ease-in-out infinite alternate; }
.hero-card::after { content: ''; position: absolute; inset: 0; background: linear-gradient(180deg, transparent 45%, rgba(15, 8, 40, .86)); z-index: 1; }
.hero-card .hero-card-txt { position: absolute; left: 16px; right: 16px; bottom: 12px; z-index: 3; display: flex; flex-direction: column; gap: 2px; }
.hero-card .hero-card-txt b { font-size: 23px; line-height: 1.1; text-shadow: 0 2px 8px rgba(0, 0, 0, .5); }
.hero-card .hero-card-txt small { font-size: 15px; font-weight: 800; opacity: .95; text-shadow: 0 1px 6px rgba(0, 0, 0, .6); }
.hero-card .hero-card-txt span { font-size: 14px; font-weight: 700; opacity: .9; line-height: 1.25; text-shadow: 0 1px 6px rgba(0, 0, 0, .6); }
.hero-card-ep { position: absolute; z-index: 3; top: 12px; left: 12px; background: var(--tale-main); color: #fff; font-weight: 900; font-size: 14px;
  border-radius: 999px; padding: 4px 12px; box-shadow: 0 3px 10px rgba(0, 0, 0, .25); }
.tale-pickbar { display: flex; justify-content: center; align-items: center; gap: 14px; min-height: 72px; }
.tale-pickbar .btn { background: var(--tale-main, var(--blue)); box-shadow: 0 5px 0 var(--tale-deep, var(--blue-d)); }

/* ---------- episode (session) ---------- */
.screen-session.tale { position: relative; isolation: isolate; }
.screen-session.tale > .tale-bg { position: fixed; z-index: -2; animation: none; }
.screen-session.tale::before { content: ''; position: fixed; inset: 0; z-index: -1; background: linear-gradient(180deg, rgba(255, 255, 255, .25), rgba(255, 255, 255, .5)); }
.screen-session.tale .ex-card, .screen-session.tale .feedback { background: rgba(255, 255, 255, .95); }
.screen-session.tale .bubble { background: rgba(255, 255, 255, .95); }
.screen-session.tale .ses-top .btn-icon, .screen-session.tale .coins { box-shadow: 0 4px 14px rgba(0, 0, 0, .18); }
.screen-session.tale .ses { grid-template-columns: 230px 1fr; }
.ses-side .tale-hero { position: relative; width: 210px; height: 250px; }
.ses-side .tale-hero::before { display: none; }
.ses-talk { display: flex; align-items: flex-start; gap: 6px; width: 100%; }
.ses-talk img { width: 46px; height: 46px; object-fit: contain; flex: none; animation: taleFloat 3.1s ease-in-out infinite; }
.ses-talk .bubble { flex: 1; font-size: 16px; padding: 10px 12px; }
.tale-path { position: relative; flex: 1; height: 46px; margin: 0 26px 0 6px; }
.tale-path-track { position: absolute; left: 0; right: 0; top: 50%; height: 12px; margin-top: -6px; border-radius: 999px;
  background: rgba(255, 255, 255, .85); box-shadow: inset 0 0 0 2px rgba(0, 0, 0, .08), 0 3px 10px rgba(0, 0, 0, .12); overflow: hidden; }
.tale-path-fill { height: 100%; width: 0; background: linear-gradient(90deg, var(--tale-glow), var(--tale-main)); transition: width 1s linear; }
.tale-path .stone { position: absolute; top: 50%; width: 34px; height: 34px; margin: -17px 0 0 -17px; border-radius: 50%;
  display: grid; place-items: center; font-size: 17px; color: #C9CEDB; background: #fff; box-shadow: 0 3px 10px rgba(0, 0, 0, .18); transition: all .4s; }
.tale-path .stone.on { color: #fff; background: var(--tale-main); box-shadow: 0 0 0 4px rgba(255, 255, 255, .8), 0 0 18px var(--tale-glow); transform: scale(1.12); }
.tale-path .token { position: absolute; top: 50%; width: 42px; height: 42px; margin: -21px 0 0 -21px; transition: left 1s linear; z-index: 2; }

/* ---------- title card / beat ---------- */
.tale-card { position: fixed; inset: 0; z-index: 90; overflow: hidden; background: #140B2E; opacity: 0; transition: opacity .35s; isolation: isolate; }
.tale-card.in { opacity: 1; }
.tale-card.out { opacity: 0; }
.tale-card::after { content: ''; position: absolute; inset: 0; z-index: 1; background: linear-gradient(90deg, rgba(15, 8, 40, .82) 0%, rgba(15, 8, 40, .55) 42%, rgba(15, 8, 40, 0) 70%); }
.tale-card .tale-fx { z-index: 2; }
.tale-card-cast { position: absolute; inset: 0; z-index: 2; pointer-events: none; }
.tale-card-cast .tale-hero { right: 8%; bottom: 3%; height: 74%; width: 34%; }
.tale-card-cast .tale-side { right: 33%; bottom: 46%; height: 24%; width: 14%; }
.tale-card-body { position: absolute; z-index: 3; left: 6%; top: 78px; bottom: 24px; width: min(50%, 620px); color: #fff;
  display: flex; flex-direction: column; justify-content: center; gap: 12px; }
.tale-card-body .tale-kicker { color: var(--tale-glow); }
.tale-card-body .tale-epno { align-self: flex-start; font-size: 20px; }
.tale-card-body h1 { font-size: 50px; line-height: 1.05; text-shadow: 0 4px 18px rgba(0, 0, 0, .45); }
.tale-card-body p { margin: 0; font-size: 22px; font-weight: 700; line-height: 1.4; text-shadow: 0 2px 10px rgba(0, 0, 0, .5); }
.tale-card-body .tale-opening { font-style: italic; opacity: .92; }
.tale-card-btns { display: flex; align-items: center; gap: 14px; margin-top: 8px; }
.tale-card-back { position: absolute; z-index: 4; top: 18px; left: 22px; }
.btn.primary.tale-go { background: var(--tale-main); box-shadow: 0 6px 0 var(--tale-deep); }
.tale-beat { position: fixed; z-index: 85; left: 50%; bottom: 26px; transform: translate(-50%, 140%); width: min(660px, calc(100vw - 32px));
  display: flex; align-items: center; gap: 14px; padding: 12px 22px 12px 12px; border-radius: 26px; text-align: left; color: var(--ink);
  background: rgba(255, 255, 255, .97); box-shadow: 0 0 0 4px var(--tale-main), 0 16px 40px rgba(20, 10, 50, .35); transition: transform .45s cubic-bezier(.2, 1.3, .4, 1), opacity .3s; }
.tale-beat.in { transform: translate(-50%, 0); }
.tale-beat.out { opacity: 0; transform: translate(-50%, 30%); }
.tale-beat img { width: 84px; height: 84px; object-fit: contain; flex: none; animation: taleFloat 3.1s ease-in-out infinite; }
.tale-beat-body { display: flex; flex-direction: column; gap: 4px; }
.tale-beat small { font-size: 14px; font-weight: 900; color: var(--tale-deep); letter-spacing: .5px; text-transform: uppercase; }
.tale-beat b { font-size: 21px; line-height: 1.3; }

/* ---------- finale ---------- */
.tale-finale { position: relative; flex: 1; isolation: isolate; display: flex; align-items: center; justify-content: center; padding: 24px; }
.tale-finale > .tale-bg { position: fixed; z-index: -2; filter: brightness(1.08) saturate(1.1); }
.tale-finale::before { content: ''; position: fixed; inset: 0; z-index: -1; background: radial-gradient(ellipse at 30% 60%, rgba(255, 255, 255, 0) 30%, rgba(20, 10, 50, .35)); }
.finale-cast { position: fixed; left: 0; bottom: 0; width: 38%; height: 88vh; pointer-events: none; z-index: 1; }
.finale-cast .tale-hero { left: 8%; bottom: 0; height: 86%; width: 72%; }
.finale-cast .tale-side { left: 70%; bottom: 60%; height: 24%; width: 32%; }
.finale-card { position: relative; z-index: 2; margin-left: 34%; width: min(640px, 62vw); background: rgba(255, 255, 255, .95);
  border-radius: 30px; padding: 24px 28px; box-shadow: 0 16px 50px rgba(20, 10, 50, .3); display: flex; flex-direction: column; gap: 10px; align-items: center; text-align: center; }
.finale-card h1 { font-size: 40px; color: var(--tale-deep); }
.finale-text { margin: 0; font-size: 20px; font-weight: 700; line-height: 1.4; color: var(--ink2); }
.finale-next { background: color-mix(in srgb, var(--tale-glow) 22%, #fff); border-radius: 18px; padding: 10px 16px; font-size: 17px; font-weight: 700; width: 100%; }
.finale-next b { color: var(--tale-deep); }
.finale-card .res-stats { grid-template-columns: repeat(auto-fit, minmax(96px, 1fr)); width: 100%; }
.finale-card .res-stats b img { width: 26px; height: 26px; vertical-align: -5px; object-fit: contain; }
.finale-card .btn.primary { background: var(--tale-main); box-shadow: 0 5px 0 var(--tale-deep); }
.tale-rain { position: fixed; inset: 0; pointer-events: none; z-index: 60; overflow: hidden; }
.tale-rain img { position: absolute; top: -12%; animation: taleRain var(--t) cubic-bezier(.3, .1, .6, 1) var(--d) both; }
@keyframes taleRain { from { transform: translateY(0) rotate(0); opacity: 1; } 85% { opacity: 1; } to { transform: translateY(118vh) rotate(var(--r)); opacity: 0; } }

@media (max-width: 1100px) {
  .hub .tiles { grid-template-columns: repeat(4, 1fr); }
  .tale-grid { grid-template-columns: repeat(2, 1fr); }
  .tale-card-body h1 { font-size: 40px; }
}
@media (max-width: 900px) {
  .hub-stage { grid-template-columns: 1fr 56%; }
  .hub .btn.huge { padding: 16px 24px; font-size: 21px; }
  .hub-row .week { display: none; }
  .screen-session.tale .ses { grid-template-columns: 170px 1fr; }
  .ses-side .tale-hero { width: 160px; height: 200px; }
}
@media (max-height: 740px) {
  .hub-stage { min-height: 340px; }
  .hub-title { font-size: 26px; }
  .hub-bubble { font-size: 17px; }
  .tale-card-body h1 { font-size: 36px; }
  .tale-card-body p { font-size: 18px; }
  .hero-card { height: 210px; }
  .ses-side .tale-hero { width: 160px; height: 200px; }
}

/* ---------- tablets (portrait): the hero column keeps the hero above the sidekick's bubble ---------- */
@media (min-width: 701px) and (max-width: 1000px) and (min-height: 801px) {
  .screen-session.tale .ses { grid-template-columns: 190px minmax(0, 1fr); }
  .screen-session.tale .ses-side { flex-direction: column; justify-content: flex-start; padding-top: 10px; }
  .ses-side .tale-hero { width: 180px; height: 220px; }
}

/* ---------- phones (portrait): stacked scenes ---------- */
@media (max-width: 700px) {
  .tale-kicker { font-size: 14px; letter-spacing: .5px; }
  .tale-epno { font-size: 15px; }
  /* hub: the place with the hero on top, the panel below */
  .hub { gap: 14px; padding: 0 12px 24px; }
  .hub-stage { grid-template-columns: 1fr; grid-template-rows: 250px auto; min-height: 0; border-radius: 24px; }
  .hub-stage .tale-hero { top: 12px; bottom: auto; left: 4%; width: 50%; height: 238px; }
  .hub-stage .tale-side { top: 34px; bottom: auto; left: 58%; width: 30%; height: 100px; }
  .hub-panel { grid-column: 1; grid-row: 2; gap: 8px; margin: 0 8px 8px; padding: 14px 16px 16px; border-radius: 20px; }
  .hub-title { font-size: 24px; }
  .hub-bubble { padding: 12px 14px; font-size: 16px; }
  .hub .btn.huge { align-self: stretch; padding: 16px 20px; font-size: 22px; }
  .tale-season-head h2 { font-size: 16px; }
  .tale-eps { grid-auto-columns: 132px; gap: 10px; }
  .hub .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .hub .tile { padding: 12px 8px 10px; font-size: 15px; }
  .hub .tile:last-child:nth-child(odd) { grid-column: 1 / -1; }
  .hub .tile-ic { font-size: 32px; }
  .hub .tile-ic svg { width: 44px; height: 44px; }
  .hub .tile-ic .tale-head { width: 44px; height: 44px; }
  /* hero gallery: two small cards per row, the choose button stays in reach */
  .tale-heroes-main { gap: 10px; padding: 0 12px 0; }
  .tale-heroes-main > p { font-size: 16px; }
  .tale-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .hero-card { height: 168px; border-radius: 18px; }
  .hero-card .hero-card-txt { left: 10px; right: 8px; bottom: 8px; }
  .hero-card .hero-card-txt b { font-size: 16px; line-height: 1.1; }
  .hero-card .hero-card-txt small { font-size: 14px; line-height: 1.15; }
  .hero-card .hero-card-txt span { display: none; }
  .hero-card-ep { top: 8px; left: 8px; }
  .tale-pickbar { position: sticky; bottom: 0; z-index: 5; min-height: 0; margin: 0 -12px; padding: 10px 12px 14px;
    background: linear-gradient(180deg, rgba(242, 248, 255, 0), rgba(242, 248, 255, .96) 30%); }
  .tale-pickbar:empty { padding: 0; }
  .tale-pickbar .btn.huge { padding: 14px 22px; font-size: 20px; }
  /* episode: the hero and the sidekick's bubble in a row above the card */
  .tale-path { height: 40px; margin: 0 14px 0 4px; }
  .tale-path .stone { width: 26px; height: 26px; margin: -13px 0 0 -13px; font-size: 14px; }
  .tale-path .token { width: 34px; height: 34px; margin: -17px 0 0 -17px; }
  .screen-session.tale .tbar-lbl { display: none; }
  .screen-session.tale .ses { grid-template-columns: 1fr; }
  .screen-session.tale .ses-side { flex-direction: row; align-items: flex-end; justify-content: flex-start; gap: 8px; }
  .ses-side .tale-hero { flex: none; width: 70px; height: 90px; }
  .ses-side .power { order: 1; flex: none; width: 48px; height: 48px; margin: 0; }
  .ses-talk { flex: 1; min-width: 0; align-items: flex-end; }
  .ses-talk img { width: 40px; height: 40px; }
  .ses-talk .bubble { min-height: 44px; padding: 8px 12px; font-size: 15px; }
  /* title card: the cast on top, the story below on a dark fade; the text scrolls, the button stays */
  .tale-card::after { background: linear-gradient(180deg, rgba(15, 8, 40, .25) 0%, rgba(15, 8, 40, 0) 22%, rgba(15, 8, 40, .55) 44%, rgba(15, 8, 40, .9) 62%); }
  .tale-card-back { top: 12px; left: 12px; }
  .tale-card-cast .tale-hero { top: 7%; right: auto; bottom: auto; left: 24%; width: 56%; height: 44%; }
  .tale-card-cast .tale-side { top: 12%; right: auto; bottom: auto; left: 4%; width: 26%; height: 15%; }
  .tale-card-body { top: auto; right: 0; bottom: 0; left: 0; width: auto; max-height: calc(100% - 72px); overflow-y: auto;
    justify-content: flex-start; gap: 8px; padding: 44px 18px 0;
    background: linear-gradient(180deg, rgba(20, 11, 46, 0), rgba(20, 11, 46, .72) 44px, rgba(20, 11, 46, .9)); }
  .tale-card-body .tale-kicker { text-shadow: 0 1px 6px rgba(0, 0, 0, .6); }
  .tale-card-body h1 { font-size: 30px; }
  .tale-card-body p { font-size: 17px; line-height: 1.35; }
  .tale-card-body .tale-epno { font-size: 16px; }
  .tale-card-btns { position: sticky; bottom: 0; margin: 4px -18px 0; padding: 10px 18px 16px;
    background: linear-gradient(180deg, rgba(20, 11, 46, 0), rgba(20, 11, 46, .92) 30%); }
  .tale-card .btn.huge { flex: 1; padding: 16px 20px; font-size: 22px; }
  /* station beat */
  .tale-beat { bottom: 12px; gap: 10px; width: calc(100vw - 24px); padding: 10px 16px 10px 10px; border-radius: 22px; }
  .tale-beat img { width: 56px; height: 56px; }
  .tale-beat b { font-size: 17px; }
  /* finale: the cast on top, the card full width over its feet */
  .tale-finale { align-items: flex-start; padding: 12px; }
  .finale-cast { top: 0; bottom: auto; width: 100%; height: 38vh; }
  .finale-cast .tale-hero { left: 6%; width: 52%; height: 94%; }
  .finale-cast .tale-side { left: 58%; bottom: 38%; width: 34%; height: 40%; }
  .finale-card { width: 100%; margin: calc(38vh - 64px) 0 0; gap: 8px; padding: 18px 16px 20px; border-radius: 26px; }
  .finale-card h1 { font-size: 30px; }
  .finale-text { font-size: 17px; }
  .finale-next { padding: 10px 14px; font-size: 16px; }
  .finale-card .res-stats { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
  .finale-card .res-stats b img { width: 22px; height: 22px; }
}

@media (max-width: 700px) and (max-height: 780px) {
  .ses-side .tale-hero { width: 60px; height: 74px; }
}

/* ---------- phones (landscape): side by side, compact ---------- */
@media (max-height: 500px) and (min-width: 560px) {
  .tale-kicker { font-size: 14px; letter-spacing: .5px; }
  .tale-epno { font-size: 15px; }
  /* hub */
  .hub { gap: 12px; padding: 0 14px 20px; }
  .hub-stage { grid-template-columns: 1fr min(56%, 500px); min-height: 0; border-radius: 22px; }
  .hub-stage .tale-hero { left: 3%; width: 36%; height: 94%; }
  .hub-stage .tale-side { left: 29%; bottom: 50%; width: 16%; height: 30%; }
  .hub-panel { gap: 6px; margin: 10px 10px 10px 0; padding: 12px 16px 14px; border-radius: 20px; }
  .hub-title { font-size: 22px; }
  .hub-bubble { padding: 10px 14px; font-size: 15px; }
  .hub .btn.huge { padding: 12px 22px; font-size: 20px; }
  .hub-row { gap: 10px; }
  .hub-row .streak { font-size: 16px; }
  .hub-row .wd { width: 32px; }
  .tale-season-head h2 { font-size: 18px; }
  .tale-eps { grid-auto-columns: 136px; gap: 10px; }
  .hub .tile { padding: 10px 6px; font-size: 15px; }
  .hub .tile-ic { font-size: 30px; }
  .hub .tile-ic svg { width: 42px; height: 42px; }
  .hub .tile-ic .tale-head { width: 42px; height: 42px; }
  /* hero gallery */
  .tale-heroes-main { gap: 8px; padding: 0 14px 0; }
  .tale-heroes-main > p { font-size: 16px; }
  .tale-grid { grid-template-columns: repeat(3, 1fr); gap: 10px; }
  .hero-card { height: 140px; border-radius: 18px; }
  .hero-card .hero-card-txt { left: 12px; right: 12px; bottom: 8px; }
  .hero-card .hero-card-txt b { font-size: 18px; }
  .hero-card .hero-card-txt small { font-size: 14px; }
  .hero-card .hero-card-txt span { display: none; }
  .tale-pickbar { position: sticky; bottom: 0; z-index: 5; min-height: 0; margin: 0 -14px; padding: 8px 14px 10px;
    background: linear-gradient(180deg, rgba(242, 248, 255, 0), rgba(242, 248, 255, .96) 30%); }
  .tale-pickbar:empty { padding: 0; }
  .tale-pickbar .btn.huge { padding: 12px 26px; font-size: 20px; }
  /* episode: a narrow hero column, the exercise beside its answer */
  .tale-path { height: 40px; }
  .tale-path .stone { width: 30px; height: 30px; margin: -15px 0 0 -15px; font-size: 15px; }
  .tale-path .token { width: 38px; height: 38px; margin: -19px 0 0 -19px; }
  .screen-session.tale .ses { grid-template-columns: clamp(120px, 17vw, 150px) minmax(0, 1fr); }
  .screen-session.tale .ses-side { flex-direction: column; align-items: center; gap: 4px; }
  .ses-side .tale-hero { flex: none; width: 100%; height: 146px; }
  .screen-session.tale .ses-side .power { position: absolute; top: 0; right: -4px; width: 46px; height: 46px; }
  .ses-talk { flex-direction: column; align-items: center; gap: 2px; }
  .ses-talk img { width: 36px; height: 36px; }
  .ses-talk .bubble { min-height: 0; padding: 8px 10px; font-size: 14px; }
  /* title card: the story on the left (scrolls if long, the button stays), the cast on the right */
  .tale-card::after { background: linear-gradient(90deg, rgba(15, 8, 40, .86) 0%, rgba(15, 8, 40, .74) 46%, rgba(15, 8, 40, 0) 72%); }
  .tale-card-back { top: 12px; left: 14px; }
  .tale-card-cast .tale-hero { right: 3%; bottom: 2%; width: 30%; height: 86%; }
  .tale-card-cast .tale-side { right: 27%; bottom: 56%; width: 12%; height: 24%; }
  /* the story sits just above the buttons; a long one scrolls in its own box, the buttons never move */
  .tale-card-body { top: 10px; bottom: 66px; left: 76px; width: min(calc(58% - 76px), 580px); overflow-y: auto; justify-content: flex-start; gap: 6px; padding: 0 8px 0 0; }
  .tale-card-body::after { content: ''; position: sticky; bottom: 0; flex: none; height: 18px; margin-top: -6px; pointer-events: none;
    background: linear-gradient(180deg, rgba(15, 8, 40, 0), rgba(15, 8, 40, .85));
    -webkit-mask-image: linear-gradient(90deg, #000 60%, transparent); mask-image: linear-gradient(90deg, #000 60%, transparent); } /* a story too long for the box fades out at its edge */
  .tale-card-body .tale-kicker { text-shadow: 0 1px 6px rgba(0, 0, 0, .6); }
  .tale-card-body > :first-child { margin-top: auto; }
  .tale-card-body h1 { font-size: 28px; }
  .tale-card-body p { font-size: 15px; line-height: 1.3; }
  .tale-card-body .tale-epno { font-size: 15px; }
  .tale-card-btns { position: fixed; left: 76px; bottom: 12px; margin: 0; }
  .tale-card .btn.huge { padding: 12px 26px; font-size: 21px; }
  /* station beat */
  .tale-beat { bottom: 10px; gap: 12px; padding: 8px 18px 8px 10px; border-radius: 22px; }
  .tale-beat img { width: 60px; height: 60px; }
  .tale-beat b { font-size: 17px; }
  /* finale: the cast stays on the left, the card scrolls beside it */
  .tale-finale { padding: 12px 14px; }
  .finale-cast { width: 36%; height: 96vh; }
  .finale-card { width: min(640px, 62vw); margin-left: 34%; gap: 8px; padding: 16px 20px 18px; border-radius: 24px; }
  .finale-card h1 { font-size: 28px; }
  .finale-text { font-size: 16px; }
  .finale-next { padding: 8px 14px; font-size: 16px; }
  .finale-card .stars { font-size: 40px; }
  .finale-card .res-stats { grid-template-columns: repeat(auto-fit, minmax(80px, 1fr)); gap: 8px; }
  .finale-card .res-stats b { font-size: 22px; }
}
@media (prefers-reduced-motion: reduce) {
  .tale-bg, .tale-actor, .tale-actor-in, .tale-fx i, .ses-talk img, .tale-beat img { animation: none !important; }
}
