/* Scenarios — Glass Blue (aligned with Radio) */
:root {
  --sc-night: #020617;
  --sc-night-2: #0b1229;
  --sc-glass: rgba(15, 23, 42, 0.42);
  --sc-glass-2: rgba(30, 58, 138, 0.28);
  --sc-stroke: rgba(186, 230, 253, 0.35);
  --sc-cyan: #22d3ee;
  --sc-sky: #38bdf8;
  --sc-ice: #e0f2fe;
  --sc-text: #f8fafc;
  --sc-muted: #94a3b8;
  --you: #38bdf8;
  --other: #fb923c;
  --thai: #fda4af;
  --font-display: 'Outfit', system-ui, sans-serif;
  --font-thai: 'Sarabun', 'Thai', sans-serif;
  --sc-blur: blur(18px) saturate(1.35);
  --sc-radius: 22px;
  --sc-shadow: 0 18px 50px rgba(2, 6, 23, 0.45);
  --accent: #22d3ee;
  --border: var(--sc-stroke);
  --muted: var(--sc-muted);
  --text: var(--sc-text);
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body.scenarios-page {
  font-family: var(--font-display);
  color: var(--sc-text);
  background: var(--sc-night);
  position: relative;
  overflow-x: hidden;
  padding: 12px 14px 56px;
}
.sc-ambient {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background:
    radial-gradient(900px 520px at 12% -10%, rgba(56, 189, 248, 0.22), transparent 58%),
    radial-gradient(760px 480px at 95% 8%, rgba(37, 99, 235, 0.32), transparent 55%),
    radial-gradient(600px 400px at 50% 100%, rgba(14, 165, 233, 0.12), transparent 60%),
    linear-gradient(180deg, #020617 0%, #0b1229 45%, #020617 100%);
}
.wrap {
  position: relative;
  z-index: 1;
  max-width: 920px;
  margin: 0 auto;
}
.sc-glass-card {
  background: linear-gradient(155deg, rgba(255, 255, 255, 0.09), rgba(255, 255, 255, 0.02) 40%, var(--sc-glass-2));
  border: 1px solid var(--sc-stroke);
  backdrop-filter: var(--sc-blur);
  -webkit-backdrop-filter: var(--sc-blur);
  box-shadow: var(--sc-shadow), inset 0 1px 0 rgba(255, 255, 255, 0.18);
  border-radius: var(--sc-radius);
}

.tm-hero-scenarios {
  margin: 0 0 14px;
  padding: 16px 16px 18px;
  background: linear-gradient(155deg, rgba(56, 189, 248, 0.14), transparent 42%, rgba(37, 99, 235, 0.18)) !important;
}
.tm-hero-scenarios .tm-kicker {
  color: var(--sc-cyan);
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-size: 0.68rem;
  margin: 0 0 6px;
}
.tm-hero-scenarios h1 {
  margin: 0 0 8px;
  font-size: clamp(1.55rem, 4.2vw, 2.1rem);
  font-weight: 800;
  letter-spacing: -0.02em;
  color: #fff;
}
.tm-hero-scenarios h1 .th {
  display: block;
  font-family: var(--font-thai);
  font-size: 0.72em;
  font-weight: 700;
  opacity: 0.92;
  margin-top: 4px;
  color: var(--sc-ice);
}
.tm-lead {
  color: var(--sc-muted);
  font-weight: 600;
  line-height: 1.4;
}
.tm-lead .th {
  display: block;
  font-family: var(--font-thai);
  margin-top: 4px;
  opacity: 0.9;
}
.tm-cta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}
.tm-cta a, .sc-continue-cta {
  display: inline-flex;
  align-items: center;
  padding: 8px 12px;
  border-radius: 12px;
  border: 1px solid var(--sc-stroke);
  background: rgba(255, 255, 255, 0.06);
  color: var(--sc-ice);
  text-decoration: none;
  font-weight: 700;
  font-size: 0.82rem;
  font-family: inherit;
  cursor: pointer;
}
.sc-continue-cta {
  background: linear-gradient(135deg, rgba(34, 211, 238, 0.35), rgba(59, 130, 246, 0.35));
  border-color: var(--sc-cyan);
  color: #fff;
}
.tm-nav a {
  color: var(--sc-ice);
  opacity: 0.85;
}
.tm-nav a.active { color: var(--sc-cyan); opacity: 1; }
.tm-dark-btn {
  border: 1px solid var(--sc-stroke);
  background: rgba(255,255,255,0.08);
  color: var(--sc-ice);
  border-radius: 10px;
  padding: 6px 10px;
  font-weight: 700;
  cursor: pointer;
  font-family: inherit;
}

.sc-panel {
  margin-top: 14px;
  padding: 14px 14px 14px;
}
.sc-head h2, .sc-scene-titles h2 {
  margin: 0;
  font-size: 1.15rem;
  font-weight: 800;
  color: #fff;
}
.sc-sub { margin: 4px 0 0; color: var(--sc-muted); font-size: 0.85rem; font-weight: 600; }
.sc-cats {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 12px 0 8px;
}
.sc-levels { margin-top: 0; }
.sc-cat {
  border: 1px solid var(--sc-stroke);
  background: rgba(255, 255, 255, 0.06);
  border-radius: 999px;
  padding: 6px 10px;
  font-weight: 700;
  font-size: 0.75rem;
  cursor: pointer;
  font-family: inherit;
  color: var(--sc-ice);
}
.sc-cat.active {
  background: linear-gradient(135deg, rgba(34, 211, 238, 0.45), rgba(59, 130, 246, 0.4));
  border-color: var(--sc-cyan);
  color: #fff;
}
.sc-level { opacity: 0.95; }

.sc-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(148px, 1fr));
  gap: 10px;
}
.sc-card {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  min-height: 118px;
  padding: 12px 10px;
  border-radius: 16px;
  border: 1px solid var(--sc-stroke);
  background: rgba(15, 23, 42, 0.45);
  cursor: pointer;
  text-align: left;
  font-family: inherit;
  color: inherit;
  transition: transform 0.12s, border-color 0.15s, box-shadow 0.15s;
}
.sc-card:hover {
  transform: translateY(-2px);
  border-color: var(--sc-cyan);
  box-shadow: 0 0 0 1px rgba(34, 211, 238, 0.35);
}
.sc-card.done { border-color: rgba(34, 211, 238, 0.55); }
.sc-card-emoji { font-size: 1.7rem; line-height: 1; }
.sc-card strong { font-weight: 800; font-size: 0.92rem; color: #fff; }
.sc-card-th { font-family: var(--font-thai); font-weight: 700; font-size: 0.85rem; color: var(--thai); }
.sc-card-nv { font-weight: 700; font-size: 0.8rem; color: var(--sc-cyan); line-height: 1.25; }
.sc-card-meta { font-size: 0.7rem; color: var(--sc-muted); font-weight: 600; }
.sc-card-meta b { color: var(--sc-sky); text-transform: uppercase; font-size: 0.65rem; letter-spacing: 0.04em; }
.sc-cont { color: var(--sc-cyan); font-style: normal; font-weight: 800; }
.sc-meta { margin: 10px 0 0; font-size: 0.78rem; color: var(--sc-muted); font-weight: 600; }

.sc-back {
  border: 1px solid var(--sc-stroke);
  background: rgba(255,255,255,0.06);
  color: var(--sc-ice);
  border-radius: 10px;
  padding: 8px 12px;
  font-weight: 700;
  font-size: 0.82rem;
  cursor: pointer;
  font-family: inherit;
  margin-bottom: 12px;
}
.sc-scene-head {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 10px;
}
.sc-scene-emoji { font-size: 2.4rem; line-height: 1; }
.sc-scene-th {
  margin: 2px 0 0;
  font-family: var(--font-thai);
  font-weight: 700;
  color: var(--thai);
  font-size: 1rem;
}
.sc-level-badge {
  display: inline-block;
  margin-top: 6px;
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--sc-cyan);
  border: 1px solid rgba(34, 211, 238, 0.4);
  border-radius: 999px;
  padding: 3px 8px;
}

.sc-tip, .sc-culture, .sc-vocab {
  padding: 10px 12px;
  border-radius: 14px;
  background: rgba(34, 211, 238, 0.08);
  border: 1px dashed rgba(34, 211, 238, 0.45);
  font-size: 0.85rem;
  font-weight: 600;
  margin-bottom: 10px;
  line-height: 1.35;
  color: var(--sc-ice);
}
.sc-tip .th, .sc-culture .th { display: block; font-family: var(--font-thai); margin-top: 3px; color: var(--sc-muted); }
.sc-tip .nv { display: block; margin-top: 3px; color: var(--sc-cyan); font-weight: 700; }
.sc-culture strong, .sc-vocab strong {
  display: block;
  font-size: 0.72rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--sc-cyan);
  margin-bottom: 4px;
}
.sc-culture .sc-en { display: block; }
.sc-vocab-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 6px;
}
.sc-vocab-chip {
  border: 1px solid var(--sc-stroke);
  background: rgba(15, 23, 42, 0.5);
  border-radius: 12px;
  padding: 6px 9px;
  cursor: pointer;
  font-family: inherit;
  color: inherit;
  text-align: left;
  display: flex;
  flex-direction: column;
  gap: 1px;
}
.sc-vocab-chip b { font-size: 0.78rem; color: #fff; }
.sc-vocab-chip em { font-style: normal; font-family: var(--font-thai); font-size: 0.82rem; color: var(--thai); font-weight: 700; }
.sc-vocab-chip .sc-roman { font-size: 0.68rem; color: var(--sc-muted); }

.sc-roles {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 10px;
}
.sc-role {
  font-size: 0.75rem;
  font-weight: 800;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid transparent;
}
.sc-role.you { background: rgba(56, 189, 248, 0.18); color: var(--you); border-color: rgba(56, 189, 248, 0.35); }
.sc-role.other { background: rgba(251, 146, 60, 0.18); color: var(--other); border-color: rgba(251, 146, 60, 0.35); }

.sc-paths { margin-bottom: 12px; }
.sc-paths-label { margin: 0 0 6px; font-size: 0.8rem; font-weight: 700; color: var(--sc-muted); }
.sc-paths-row { display: flex; flex-wrap: wrap; gap: 8px; }
.sc-path-btn {
  flex: 1 1 140px;
  border: 1px solid var(--sc-stroke);
  background: rgba(255,255,255,0.05);
  border-radius: 14px;
  padding: 10px 12px;
  cursor: pointer;
  font-family: inherit;
  color: inherit;
  text-align: left;
}
.sc-path-btn strong { display: block; color: #fff; font-size: 0.88rem; }
.sc-path-btn .th { display: block; font-family: var(--font-thai); color: var(--thai); font-weight: 700; margin-top: 2px; font-size: 0.82rem; }
.sc-path-btn.active {
  border-color: var(--sc-cyan);
  box-shadow: 0 0 0 1px rgba(34, 211, 238, 0.4);
  background: rgba(34, 211, 238, 0.12);
}

.sc-opts-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin-bottom: 10px;
}
.sc-opt {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--sc-muted);
}
.sc-opt select {
  border: 1px solid var(--sc-stroke);
  background: rgba(15, 23, 42, 0.65);
  color: var(--sc-ice);
  border-radius: 10px;
  padding: 6px 8px;
  font-family: inherit;
  font-weight: 700;
}

.sc-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 8px;
}
.sc-tool {
  border: 1px solid var(--sc-stroke);
  background: rgba(255, 255, 255, 0.06);
  border-radius: 10px;
  padding: 8px 10px;
  font-weight: 700;
  font-size: 0.78rem;
  cursor: pointer;
  font-family: inherit;
  color: var(--sc-ice);
}
.sc-tool.secondary { opacity: 0.9; }
.sc-tool.accent, .sc-tool[aria-pressed="true"], .sc-tool.is-playing {
  background: linear-gradient(135deg, rgba(34, 211, 238, 0.45), rgba(59, 130, 246, 0.4));
  border-color: var(--sc-cyan);
  color: #fff;
}
.sc-status {
  min-height: 1.2em;
  margin: 0 0 10px;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--sc-muted);
}
.sc-status.ok { color: #4ade80; }
.sc-status.bad { color: #fb7185; }

.sc-chat {
  display: flex;
  flex-direction: column;
  gap: 8px;
  scroll-padding-bottom: calc(100px + env(safe-area-inset-bottom, 0px));
  padding-bottom: 8px;
}
.sc-bubble {
  max-width: min(92%, 520px);
  padding: 10px 12px;
  border-radius: 16px;
  border: 1px solid var(--sc-stroke);
  background: rgba(15, 23, 42, 0.55);
  animation: scIn 0.22s ease;
  scroll-margin-top: 12px;
  scroll-margin-bottom: calc(100px + env(safe-area-inset-bottom, 0px));
}
@keyframes scIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: none; }
}
.sc-bubble.you {
  align-self: flex-end;
  border-color: rgba(56, 189, 248, 0.45);
  background: rgba(56, 189, 248, 0.12);
}
.sc-bubble.other {
  align-self: flex-start;
  border-color: rgba(251, 146, 60, 0.45);
  background: rgba(251, 146, 60, 0.1);
}
.sc-bubble.playing {
  box-shadow: 0 0 0 2px var(--sc-cyan);
}
.sc-who {
  font-size: 0.7rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  margin-bottom: 3px;
  opacity: 0.8;
}
.sc-bubble.you .sc-who { color: var(--you); }
.sc-bubble.other .sc-who { color: var(--other); }
.sc-en { font-weight: 800; font-size: 0.95rem; line-height: 1.3; color: #fff; }
.sc-th {
  font-family: var(--font-thai);
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--thai);
  margin-top: 2px;
  line-height: 1.35;
}
.sc-roman {
  display: none;
  font-size: 0.78rem;
  color: var(--sc-muted);
  margin-top: 2px;
  font-weight: 600;
}
body.sc-show-roman .sc-roman { display: block; }
body.sc-shadow-en .sc-en { filter: blur(5px); user-select: none; }
body.sc-shadow-th .sc-th { filter: blur(5px); user-select: none; }
.sc-nv {
  font-weight: 700;
  font-size: 0.92rem;
  color: var(--sc-cyan);
  margin-top: 3px;
  line-height: 1.35;
}
.sc-line-audio {
  display: flex;
  gap: 4px;
  margin-top: 6px;
}
.sc-line-audio button {
  border: 1px solid var(--sc-stroke);
  background: rgba(255,255,255,0.08);
  border-radius: 8px;
  padding: 3px 7px;
  font-size: 0.68rem;
  font-weight: 800;
  cursor: pointer;
  font-family: inherit;
  color: var(--sc-ice);
}

.sc-quiz-prompt {
  font-weight: 800;
  color: var(--sc-ice);
  margin: 0 0 8px;
}
.sc-quiz-prompt-line {
  padding: 10px 12px;
  border-radius: 14px;
  border: 1px solid rgba(251, 146, 60, 0.4);
  background: rgba(251, 146, 60, 0.1);
  margin-bottom: 10px;
}
.sc-quiz-opts { display: flex; flex-direction: column; gap: 8px; }
.sc-quiz-opt {
  border: 1px solid var(--sc-stroke);
  background: rgba(15, 23, 42, 0.55);
  border-radius: 14px;
  padding: 12px;
  text-align: left;
  cursor: pointer;
  font-family: inherit;
  color: inherit;
}
.sc-quiz-opt:hover { border-color: var(--sc-cyan); }
.sc-quiz-opt.bad { border-color: #fb7185; opacity: 0.7; }
.sc-quiz-prog { font-size: 0.78rem; color: var(--sc-muted); font-weight: 700; }
.sc-quiz-done {
  text-align: center;
  padding: 20px 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: center;
}
.sc-quiz-done strong { font-size: 1.2rem; color: #fff; }
.sc-quiz-done .th { font-family: var(--font-thai); color: var(--thai); font-weight: 700; }

.sc-practice-help {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--sc-muted);
  margin: 8px 0;
}
.sc-bank, .sc-built { display: flex; flex-direction: column; gap: 6px; }
.sc-bank { margin-top: 8px; }
.sc-built-item, .sc-bank-btn {
  border: 1px solid var(--sc-stroke);
  background: rgba(15, 23, 42, 0.55);
  border-radius: 12px;
  padding: 8px 10px;
  text-align: left;
  font-family: inherit;
  color: inherit;
}
.sc-bank-btn { cursor: pointer; width: 100%; }
.sc-bank-btn:hover { border-color: var(--sc-cyan); }
.sc-built-item strong { margin-right: 6px; }
.sc-built-item em {
  display: block;
  font-style: normal;
  font-family: var(--font-thai);
  color: var(--thai);
  font-weight: 700;
  margin-top: 2px;
}
.sc-practice-actions { margin-top: 10px; }
.sc-scene-links {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 16px;
  padding-top: 12px;
  border-top: 1px solid rgba(186, 230, 253, 0.2);
}
.sc-scene-links a {
  color: var(--sc-cyan);
  font-weight: 700;
  text-decoration: none;
  font-size: 0.85rem;
}

.sc-footer {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 14px;
  align-items: center;
  margin-top: 18px;
  padding: 12px 4px 8px;
  font-size: 0.85rem;
  color: var(--sc-muted);
  border-top: 1px solid rgba(186, 230, 253, 0.15);
}
.sc-footer a { color: var(--sc-cyan); font-weight: 700; text-decoration: none; }

.mobile-dock {
  display: none;
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 9998;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 4px;
  padding: 8px 8px calc(8px + env(safe-area-inset-bottom, 0px));
  background: color-mix(in srgb, #020617 92%, transparent);
  backdrop-filter: blur(14px);
  border-top: 2px solid color-mix(in srgb, #22d3ee 55%, transparent);
}
.mobile-dock button, .mobile-dock a.dock-link {
  min-height: 56px;
  border: 1px solid rgba(255,255,255,0.14);
  background: rgba(255,255,255,0.08);
  color: #e2e8f0;
  border-radius: 14px;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  font-size: 0.62rem;
  line-height: 1.1;
  padding: 4px 2px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1px;
  text-decoration: none;
}
.mobile-dock a.dock-link.primary {
  background: color-mix(in srgb, #0ea5e9 55%, transparent);
  border-color: #22d3ee;
}
.dock-ico { font-size: 1.1rem; line-height: 1; }
.dock-th { font-family: var(--font-thai); font-size: 0.68rem; }
.dock-lbl { opacity: 0.85; }

.sc-menu-overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 10000;
  background: rgba(2, 6, 23, 0.65);
  align-items: flex-end;
  justify-content: center;
  padding: 12px;
}
.sc-menu-overlay.open { display: flex; }
.sc-menu-sheet {
  width: min(480px, 100%);
  background: linear-gradient(160deg, #0b1229, #020617);
  border: 1px solid var(--sc-stroke);
  border-radius: 18px 18px 14px 14px;
  padding: 16px;
  box-shadow: var(--sc-shadow);
  color: var(--sc-text);
}
.sc-menu-sheet h3 { margin: 0 0 12px; font-size: 1rem; }
.sc-menu-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.sc-menu-grid a {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 12px;
  border-radius: 12px;
  border: 1px solid var(--sc-stroke);
  text-decoration: none;
  color: inherit;
  font-weight: 700;
  background: rgba(255,255,255,0.04);
}
.sc-menu-grid a .th { font-family: var(--font-thai); }
.sc-menu-grid a .en { font-size: 0.75rem; color: var(--sc-muted); }
.sc-menu-close {
  width: 100%;
  margin-top: 12px;
  padding: 10px;
  border-radius: 10px;
  border: 1px solid var(--sc-stroke);
  background: rgba(34, 211, 238, 0.2);
  color: #fff;
  font-weight: 800;
  cursor: pointer;
  font-family: inherit;
}

/* Locale hub may keep light panels — soften clash */
body.locale-scenarios:not(.sc-glass) {
  /* legacy path unused when glass applied */
}

@media (max-width: 900px) {
  .mobile-dock { display: grid; }
  body.scenarios-page { padding-bottom: calc(88px + env(safe-area-inset-bottom, 0px)); }
  .sc-chat { padding-bottom: calc(28px + 88px + env(safe-area-inset-bottom, 0px)); }
}
@media (max-width: 640px) {
  body.scenarios-page { padding: 10px; padding-bottom: calc(88px + env(safe-area-inset-bottom, 0px)); }
  .sc-grid { grid-template-columns: repeat(auto-fill, minmax(132px, 1fr)); }
}
@media (min-width: 901px) {
  .mobile-dock { display: none !important; }
}
