/* story.css — the ಕಥೆಯ ದಾರಿ page. Sits on top of styles.css (tokens, fonts, body)
 * and prefixes everything `sp-` so it can never restyle the drill app. */

.sp-top { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: 8px;
  padding: 10px 16px; background: var(--paper); border-bottom: 1px solid var(--line); }
.sp-top h2 { margin: 0; font-size: 19px; flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sp-btn { border: 2px solid var(--line-deep); background: var(--surface); color: var(--ink); border-radius: var(--r-md);
  padding: 10px 14px; font: inherit; font-size: 16px; cursor: pointer; min-height: 44px; }
.sp-btn:active { transform: translateY(1px); }
.sp-btn.primary { background: var(--indigo); border-color: var(--indigo-d); color: #fff; }
.sp-btn.ghost { border-color: transparent; background: transparent; }
.sp-btn.on { background: var(--gold); border-color: var(--gold-d); color: #1b2a4a; }
.sp-btn[disabled] { opacity: .4; cursor: default; }
.sp-wrap { padding: 16px; display: flex; flex-direction: column; gap: 14px; }
.sp-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.sp-row.center { justify-content: center; }
.sp-note { color: var(--ink-soft); font-size: 14px; margin: 0; }
.sp-ml { font-family: var(--ml); font-weight: 600; }
.sp-mg { color: var(--ink-soft); font-size: 13px; font-style: italic; }

/* ---------- home */
.sp-hero { display: flex; gap: 14px; align-items: center; }
.sp-hero .big { font-size: 54px; line-height: 1; }
.sp-hero h1 { margin: 0; font-size: 28px; color: var(--red); }
.sp-days { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; }
.sp-day { background: var(--surface); border: 2px solid var(--line); border-radius: var(--r-md); padding: 8px 4px;
  text-align: center; font-size: 13px; cursor: pointer; }
.sp-day b { display: block; font-size: 20px; }
.sp-day { font-family: inherit; font-weight: inherit; color: var(--ink); }
.sp-goal { border: 0; background: transparent; font: inherit; color: inherit; cursor: pointer; padding: 4px 0; text-align: left; }
.sp-goal:hover { text-decoration: underline; }
.sp-day.done { background: var(--ok-bg); border-color: var(--ok); }
.sp-day.today { border-color: var(--gold); box-shadow: 0 0 0 3px color-mix(in srgb, var(--gold) 35%, transparent); }
/* after .done, so the selected day stays visible even when finished */
.sp-day.sel { background: var(--gold); border-color: var(--gold-d); color: #1b2a4a; }
.sp-today { background: var(--surface); border: 2px solid var(--gold); border-radius: var(--r-lg); padding: 12px 14px; }
.sp-today ul { margin: 6px 0 0; padding-left: 20px; }
.sp-today li.ok { color: var(--ok-ink); }
.sp-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.sp-tile { background: var(--surface); border: 2px solid var(--line); border-radius: var(--r-lg); padding: 14px 10px;
  text-align: center; cursor: pointer; font: inherit; color: var(--ink); }
.sp-tile .ico { font-size: 38px; display: block; }
.sp-tile .nm { font-family: var(--kn); font-size: 20px; font-weight: 700; }
.sp-tile .sub { font-size: 12px; color: var(--ink-soft); }
.sp-tile.locked { opacity: .6; border-style: dashed; }
.sp-tile.quiet .sub::before { content: "🌱 "; }

/* ---------- the stage: one picture of the story */
.sp-stage { position: relative; border-radius: var(--r-lg); padding: 14px 10px 12px; min-height: 230px;
  display: flex; flex-direction: column; justify-content: flex-end; gap: 8px; overflow: hidden;
  border: 2px solid var(--line); }
.bg-field  { background: linear-gradient(#ffe8b3, #f2c27a 60%, #d99a4e); }
.bg-tent   { background: linear-gradient(#fdf1dc, #ecd3a5 70%, #c9a46a); }
.bg-palace { background: linear-gradient(#efe3ff, #d9c4f5 65%, #b598e0); }
.bg-sky    { background: linear-gradient(#bfe3ff, #8ccaf7 60%, #e9c78a 61%, #d7a865); }
.bg-battle { background: linear-gradient(#ffd2b8, #f09a72 60%, #b9583a); }
.bg-dusk   { background: linear-gradient(#41356b, #8a5a8c 55%, #d98b6a); }
.bg-school   { background: linear-gradient(#d3f9d8, #b2f2bb 60%, #8ce99a); }
.bg-station  { background: linear-gradient(#e7f5ff, #c5dff5 60%, #a5b4c8); }
.bg-platform { background: linear-gradient(#e9ecef, #ced4da 62%, #868e96 63%, #adb5bd); }
.bg-hill     { background: linear-gradient(#d0ebff, #a5d8ff 45%, #b2d8a4 46%, #8cc084); }
.bg-night    { background: linear-gradient(#0b1d3a, #1f3b6b 65%, #3b5a3a 66%, #2c4a2c); }
.bg-city     { background: linear-gradient(#fff4e0, #f3d9a4 60%, #b08d5a); }
.bg-home     { background: linear-gradient(#fdf6e3, #f1e0bd 70%, #c9a87a); }
.bg-hosp     { background: linear-gradient(#f1f8ff, #dbe9f5 70%, #b9cbe0); }
.bg-village  { background: linear-gradient(#e6f4ea, #c9e8b8 60%, #9bc77f); }
.bg-river    { background: linear-gradient(#e3f2fd, #b3dcf2 60%, #7fb6d8); }
.bg-sea      { background: linear-gradient(#cfeefe, #8fd3f4 55%, #f3e1b6 56%, #e8cf98); }
.bg-forest   { background: linear-gradient(#d8f5d0, #a8dca0 55%, #6fb46a 56%, #4f8f4c); }
.bg-lab      { background: linear-gradient(#eef2ff, #d0d8f5 65%, #a9b6e0); }
.bg-stage    { background: radial-gradient(circle at 50% 30%, #fff7d6, #f4c27a 70%, #d9894a); }
.bg-train    { background: linear-gradient(#fff3bf, #ffe066 55%, #868e96 56%, #adb5bd); }
.sp-props { position: absolute; top: 10px; left: 12px; right: 12px; display: flex; justify-content: space-between;
  font-size: 40px; pointer-events: none; }
.sp-props span { transition: transform .3s; }
.sp-props.pulse span { animation: sp-pulse .9s ease-in-out 2; }
.sp-actors { display: flex; justify-content: center; align-items: flex-end; gap: 6px; flex-wrap: wrap; position: relative; }
.sp-actor { display: flex; flex-direction: column; align-items: center; width: 92px; transition: transform .25s, opacity .25s; }
.sp-face { position: relative; width: 74px; height: 74px; border-radius: 50%; background: #fff;
  border: 5px solid var(--ring, #999); display: grid; place-items: center; font-size: 44px; line-height: 1;
  box-shadow: 0 3px 0 rgba(0,0,0,.15); }
.sp-face .tag { position: absolute; left: -8px; bottom: -6px; font-size: 22px; }
.sp-face .mood { position: absolute; right: -10px; top: -10px; font-size: 28px; transform: scale(0); transition: transform .25s; }
.sp-face .mood.show { transform: scale(1); }
.sp-actor .nm { margin-top: 3px; font-size: 13px; background: rgba(255,255,255,.85); color: #1b2a4a;
  border-radius: 8px; padding: 0 6px; font-family: var(--kn); font-weight: 700; }
.sp-actor.talk { transform: translateY(-6px) scale(1.12); }
.sp-actor.talk .sp-face { box-shadow: 0 0 0 6px color-mix(in srgb, var(--ring) 45%, transparent); animation: sp-talk .45s ease-in-out infinite alternate; }
.sp-actor.dim { opacity: .55; }
.sp-actor.point::before { content: "👇"; font-size: 26px; position: absolute; margin-top: -32px; animation: sp-bob .6s infinite alternate; }
.sp-actor { position: relative; }
.sp-actor.pick { cursor: pointer; border-radius: var(--r-md); padding: 6px 2px; border: 3px solid transparent; background: var(--surface); }
.sp-actor.pick .nm { background: transparent; color: var(--ink); }
.sp-actor.pick.right { border-color: var(--ok); background: var(--ok-bg); }
.sp-actor.pick.wrong { border-color: var(--no-ink); background: var(--no-bg); }
@keyframes sp-talk { to { transform: scale(1.06); } }
@keyframes sp-bob { to { transform: translateY(5px); } }
@keyframes sp-pulse { 50% { transform: scale(1.35) rotate(-8deg); } }

/* ---------- caption with tappable meaning words */
.sp-cap { background: var(--surface); border: 2px solid var(--line); border-radius: var(--r-md); padding: 12px 14px;
  min-height: 64px; font-size: 22px; }
.sp-cap.hidden-text .txt { filter: blur(7px); user-select: none; }
.sp-cap .who { font-size: 13px; color: var(--ink-soft); font-family: var(--kn); }
.sp-k { border-bottom: 3px dotted var(--indigo); cursor: pointer; }
.sp-gloss { position: fixed; left: 50%; bottom: 18px; transform: translateX(-50%); width: min(92vw, 420px); z-index: 20;
  background: var(--surface); border: 3px solid var(--indigo); border-radius: var(--r-lg); padding: 12px 14px;
  box-shadow: 0 10px 30px rgba(0,0,0,.25); display: flex; gap: 12px; align-items: center; }
.sp-gloss .e { font-size: 46px; }
.sp-gloss .k { font-family: var(--kn); font-size: 22px; font-weight: 700; }

.sp-strip { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 4px; }
.sp-strip button { flex: 0 0 auto; min-width: 44px; min-height: 44px; border-radius: 50%; border: 2px solid var(--line-deep);
  background: var(--surface); color: var(--ink); font: inherit; cursor: pointer; position: relative; }
.sp-strip button.cur { border-color: var(--indigo); background: var(--indigo); color: #fff; }
.sp-strip button .n { position: absolute; right: -4px; top: -6px; font-size: 11px; background: var(--gold); color: #1b2a4a;
  border-radius: 8px; padding: 0 4px; }

/* ---------- answers */
.sp-q { font-family: var(--kn); font-size: 22px; font-weight: 700; text-align: center; margin: 0; }
.sp-yn { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.sp-opt { border: 3px solid var(--line-deep); background: var(--surface); color: var(--ink); border-radius: var(--r-lg);
  padding: 14px 10px; font-family: var(--kn); font-size: 22px; font-weight: 700; cursor: pointer; min-height: 60px; }
.sp-opt .e { font-size: 30px; display: block; }
.sp-opt.right { border-color: var(--ok); background: var(--ok-bg); color: var(--ok-ink); }
.sp-opt.wrong { border-color: var(--no-ink); background: var(--no-bg); color: var(--no-ink); }
.sp-opts { display: grid; gap: 10px; }
.sp-recast { text-align: center; font-family: var(--kn); font-size: 19px; color: var(--ok-ink); min-height: 30px; margin: 0; }

/* ---------- cards: phrases, commands */
.sp-card { background: var(--surface); border: 2px solid var(--line); border-radius: var(--r-lg); padding: 12px;
  display: flex; gap: 12px; align-items: center; cursor: pointer; }
.sp-card .g { font-size: 40px; width: 52px; text-align: center; flex: 0 0 auto; }
.sp-card .t { flex: 1; min-width: 0; }
.sp-card .kn { font-size: 22px; font-weight: 700; display: block; }
.sp-card.heard { border-color: var(--ok); }
.sp-mini { width: 34px; height: 34px; border-radius: 50%; border: 3px solid var(--ring); background: #fff;
  display: inline-grid; place-items: center; font-size: 20px; flex: 0 0 auto; }
.sp-big { text-align: center; padding: 18px; background: var(--surface); border: 2px solid var(--line); border-radius: var(--r-lg); }
.sp-big .e { font-size: 96px; line-height: 1.1; }
.sp-big .kn { font-size: 28px; font-weight: 700; }
.sp-big.ear .e { animation: sp-pulse 1s infinite; }

/* ---------- the play script */
.sp-script { display: flex; flex-direction: column; gap: 8px; }
.sp-ln { display: flex; gap: 8px; align-items: flex-start; padding: 8px 10px; border-radius: var(--r-md);
  background: var(--surface); border: 2px solid var(--line); }
.sp-ln.dir { background: transparent; border-style: dashed; font-style: italic; color: var(--ink-soft); }
.sp-ln.dir .kn { font-size: 16px; }
.sp-ln .kn { font-size: 19px; }
.sp-ln.mine { border-color: var(--gold); }
.sp-ln.cur { border-color: var(--indigo); box-shadow: 0 0 0 3px color-mix(in srgb, var(--indigo) 30%, transparent); }
.sp-ln .spk { font-family: var(--kn); font-size: 12px; color: var(--ink-soft); display: block; }
.sp-turn { position: sticky; bottom: 0; background: var(--paper); padding: 10px 0; border-top: 2px solid var(--gold); }

/* ---------- parent page */
.sp-par h3 { margin: 10px 0 4px; font-family: var(--ui); }
.sp-par p, .sp-par li { font-family: var(--ui); font-weight: 600; line-height: 1.5; }
.sp-par table { border-collapse: collapse; width: 100%; font-size: 14px; }
.sp-par td { border-bottom: 1px solid var(--line); padding: 6px 4px; vertical-align: top; }
.sp-par .warn { background: var(--no-bg); color: var(--no-ink); padding: 10px 12px; border-radius: var(--r-md); }

@media (max-width: 380px) { .sp-actor { width: 76px; } .sp-face { width: 62px; height: 62px; font-size: 36px; } }
@media (prefers-reduced-motion: reduce) { .sp-actor.talk .sp-face, .sp-props.pulse span, .sp-actor.point::before, .sp-big.ear .e { animation: none; } }

/* Drawn scenes: the picture fills the top; the faces become a slim row below. */
.sp-stage.has-img { padding: 0; min-height: 0; background: var(--surface); gap: 0; }
.sp-stage.has-img .sp-pic { display: block; width: 100%; aspect-ratio: 16 / 9; object-fit: cover; }
.sp-stage.has-img .sp-props { display: none; }
.sp-stage.has-img .sp-actors { padding: 8px 6px 6px; gap: 2px; }
.sp-stage.has-img .sp-actor { width: 64px; }
.sp-stage.has-img .sp-face { width: 44px; height: 44px; font-size: 26px; border-width: 3px; }
.sp-stage.has-img .sp-face .tag { font-size: 14px; left: -6px; bottom: -4px; }
.sp-stage.has-img .sp-face .mood { font-size: 18px; right: -8px; top: -8px; }
.sp-stage.has-img .sp-actor .nm { font-size: 11px; }
.sp-stage.has-img .sp-actor.talk { transform: translateY(-3px) scale(1.12); }
.sp-stage.has-img .sp-actor.point::before { font-size: 18px; margin-top: -22px; }

/* Drawn faces over the emoji (the emoji stays underneath as the fallback). */
.sp-face-img { position: absolute; inset: 0; width: 100%; height: 100%; border-radius: 50%; object-fit: cover; }
.sp-mini { position: relative; overflow: hidden; }
.sp-face .tag, .sp-face .mood { z-index: 1; }
