:root {
  --bg: #f3f7f2;
  --surface: #ffffff;
  --ink: #1d2b36;
  --muted: #6b7a86;
  --line: #e2e8e4;
  --primary: #2d6a4f;
  --primary-dark: #1b4332;
  --primary-soft: #d8efe3;
  --accent: #f4a261;
  --danger: #d62839;
  --danger-soft: #fde2e4;
  --soft: #fff4d6;
  --blue: #005293;
  --yellow: #fecb00;
  --radius: 18px;
  --shadow: 0 2px 0 rgba(29, 43, 54, 0.08), 0 8px 24px rgba(29, 43, 54, 0.06);
  --font: "Nunito", system-ui, -apple-system, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 17px;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}

#app {
  max-width: 520px;
  margin: 0 auto;
  min-height: 100dvh;
}

a {
  color: var(--primary);
  font-weight: 700;
}

h1,
h2,
h3 {
  margin: 0;
}

button {
  font-family: inherit;
  color: inherit;
}

.muted {
  color: var(--muted);
}
.small {
  font-size: 0.85rem;
}
.center {
  text-align: center;
}
.row {
  display: flex;
  gap: 10px;
}
.row > * {
  flex: 1;
}

/* ---------- layout ---------- */

.shell {
  padding: 16px 16px 110px;
}
.lesson-shell {
  padding: 12px 16px 24px;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  padding-top: max(10px, env(safe-area-inset-top));
  background: rgba(243, 247, 242, 0.92);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.topbar-title {
  font-weight: 900;
  color: var(--primary-dark);
  letter-spacing: 0.2px;
}
.me {
  display: flex;
  align-items: center;
  gap: 6px;
  border: 0;
  background: none;
  padding: 0;
  cursor: pointer;
  font-weight: 800;
  justify-self: start;
}
.stats {
  justify-self: end;
  display: flex;
  gap: 10px;
  font-weight: 800;
  font-size: 0.95rem;
}
.stats span {
  opacity: 0.55;
}
.stats span.lit,
.stats span:last-child {
  opacity: 1;
}

.tabbar {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 520px;
  z-index: 20;
  display: flex;
  background: var(--surface);
  border-top: 1px solid var(--line);
  padding: 6px 6px max(8px, env(safe-area-inset-bottom));
}
.tabbar a {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 6px 0;
  border-radius: 14px;
  text-decoration: none;
  color: var(--muted);
  font-size: 0.7rem;
  font-weight: 800;
}
.tabbar a.active {
  color: var(--primary);
  background: var(--primary-soft);
}
.tab-icon {
  font-size: 1.3rem;
  line-height: 1;
}

/* ---------- basics ---------- */

.card {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px;
  margin-bottom: 14px;
}
.card-title {
  font-size: 1.1rem;
  font-weight: 900;
  margin-bottom: 8px;
}
.card p {
  margin: 6px 0;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 0;
  border-radius: 16px;
  padding: 14px 20px;
  font-size: 1rem;
  font-weight: 900;
  letter-spacing: 0.3px;
  cursor: pointer;
  text-decoration: none;
  transition: transform 0.08s, filter 0.15s;
}
.btn:active:not(:disabled) {
  transform: translateY(2px);
}
.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}
.btn-block {
  width: 100%;
  margin-top: 10px;
}
.btn-primary {
  background: var(--primary);
  color: #fff;
  box-shadow: 0 4px 0 var(--primary-dark);
}
.btn-danger {
  background: var(--danger);
  color: #fff;
  box-shadow: 0 4px 0 #9b1c28;
}
.btn-secondary {
  background: var(--surface);
  color: var(--primary);
  border: 2px solid var(--line);
  box-shadow: 0 3px 0 var(--line);
}
.btn-ghost {
  background: none;
  color: var(--muted);
}
.btn-done {
  background: var(--primary-soft);
  color: var(--primary);
}
.btn-mic {
  background: var(--blue);
  color: #fff;
  box-shadow: 0 4px 0 #003366;
  font-size: 1.1rem;
  padding: 18px;
}
.btn-mic.listening {
  animation: pulse 1s infinite;
}

.icon-btn {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: 2px solid var(--line);
  background: var(--surface);
  font-size: 1.25rem;
  cursor: pointer;
  flex-shrink: 0;
  box-shadow: 0 3px 0 var(--line);
}
.icon-btn.small {
  width: 38px;
  height: 38px;
  font-size: 1rem;
}
.icon-btn.plain {
  border: 0;
  box-shadow: none;
  background: none;
  font-size: 1.4rem;
  color: var(--muted);
}

.bar {
  height: 10px;
  border-radius: 99px;
  background: rgba(0, 0, 0, 0.08);
  overflow: hidden;
}
.bar-fill {
  height: 100%;
  border-radius: 99px;
  background: var(--primary);
  transition: width 0.35s ease;
}

.badge {
  background: var(--soft);
  border-radius: 99px;
  padding: 2px 8px;
  font-size: 0.8rem;
  font-weight: 800;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 96px;
  transform: translateX(-50%);
  background: var(--ink);
  color: #fff;
  padding: 10px 18px;
  border-radius: 99px;
  font-weight: 800;
  z-index: 50;
  animation: rise 0.25s ease;
}

/* ---------- characters ---------- */

.char-art {
  width: 52px;
  height: 52px;
  flex-shrink: 0;
}
.char-art svg {
  width: 100%;
  height: 100%;
  display: block;
}
.bob {
  animation: bob 3.2s ease-in-out infinite;
}
.bubble-row {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  margin: 10px 0 14px;
}
.bubble {
  position: relative;
  flex: 1;
  background: var(--surface);
  border: 2px solid var(--line);
  border-radius: 18px 18px 18px 6px;
  padding: 10px 14px;
  line-height: 1.4;
  font-size: 0.95rem;
}
.bubble-name {
  display: block;
  font-size: 0.72rem;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--primary);
  margin-bottom: 2px;
}
.bubble-row.joke .bubble {
  background: var(--soft);
  border-color: #f5e2a8;
}

.sticker-art {
  position: relative;
  width: 100%;
  height: 100%;
}
.sticker-art > svg {
  width: 100%;
  height: 100%;
}
.acc {
  position: absolute;
}
.acc svg {
  width: 100%;
  height: 100%;
}
.acc-coffee {
  width: 42%;
  right: -4%;
  bottom: -2%;
}
.acc-bun {
  width: 44%;
  left: -6%;
  bottom: -4%;
}
.acc-crown {
  width: 60%;
  left: 20%;
  top: 6%;
}
.acc-star {
  width: 34%;
  right: 0;
  top: 0;
  animation: spin 6s linear infinite;
}

/* ---------- welcome ---------- */

.welcome {
  padding-top: 24px;
}
.cast-row {
  display: flex;
  justify-content: center;
  gap: 4px;
}
.cast-row .char-art {
  width: 72px;
  height: 72px;
}
.cast-row .char-art:nth-child(2) {
  animation-delay: 0.4s;
}
.cast-row .char-art:nth-child(3) {
  animation-delay: 0.8s;
}
.cast-row .char-art:nth-child(4) {
  animation-delay: 1.2s;
}
.logo {
  text-align: center;
  font-size: 2.6rem;
  font-weight: 900;
  color: var(--primary-dark);
  margin-top: 8px;
  letter-spacing: -0.5px;
}
.tagline {
  text-align: center;
  color: var(--muted);
  margin: 4px 0 28px;
}
.section-title {
  font-size: 1.05rem;
  font-weight: 900;
  margin: 0 0 12px;
}
.profile-card {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 14px;
  border: 2px solid transparent;
  cursor: pointer;
  text-align: left;
}
.profile-card:hover {
  border-color: var(--primary);
}
.profile-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.profile-info strong {
  font-size: 1.2rem;
}
.chev {
  font-size: 1.8rem;
  color: var(--muted);
}

/* ---------- path ---------- */

.today {
  display: flex;
  align-items: center;
  gap: 14px;
}
.today-text {
  flex: 1;
  display: flex;
  flex-direction: column;
}
.freeze {
  font-weight: 900;
  background: #e0f2ff;
  border-radius: 99px;
  padding: 4px 10px;
}
.goal-ring {
  border-radius: 50%;
  background: conic-gradient(var(--primary) var(--pct), rgba(0, 0, 0, 0.08) 0);
  display: grid;
  place-items: center;
  position: relative;
  flex-shrink: 0;
}
.goal-ring::before {
  content: "";
  position: absolute;
  inset: 6px;
  background: var(--surface);
  border-radius: 50%;
}
.goal-ring span {
  position: relative;
  font-size: 0.72rem;
  font-weight: 900;
}
.goal-ring.done span {
  font-size: 1.3rem;
  color: var(--primary);
}

.review {
  display: flex;
  align-items: center;
  gap: 12px;
}
.review > div {
  flex: 1;
}
.review.has-due {
  border: 2px solid var(--accent);
}

.unit {
  margin: 26px 0 10px;
}
.unit-head {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--unit);
  color: #fff;
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: 0 4px 0 rgba(0, 0, 0, 0.18);
}
.unit-head > div:first-child {
  flex: 1;
}
.unit-head h2 {
  font-size: 1.4rem;
  font-weight: 900;
}
.unit-head p {
  margin: 2px 0 10px;
  opacity: 0.9;
  font-size: 0.9rem;
}
.unit-head .bar {
  background: rgba(255, 255, 255, 0.3);
  height: 8px;
}
.unit-kicker {
  font-size: 0.72rem;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 1px;
  opacity: 0.85;
}
.locked-unit .unit-head {
  filter: grayscale(0.7);
  opacity: 0.75;
}

.nodes {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 18px 0 4px;
  gap: 14px;
}
.node-wrap {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  transform: translateX(calc(var(--x) * 44px));
}
.node {
  width: 74px;
  height: 70px;
  border-radius: 50%;
  border: 0;
  font-size: 1.9rem;
  cursor: pointer;
  background: var(--unit);
  box-shadow: 0 6px 0 rgba(0, 0, 0, 0.25);
  transition: transform 0.1s;
}
.node:active:not(:disabled) {
  transform: translateY(4px);
  box-shadow: 0 2px 0 rgba(0, 0, 0, 0.25);
}
.node.done {
  background: var(--yellow);
  box-shadow: 0 6px 0 #c79c00;
}
.node.locked {
  background: #d9dee2;
  box-shadow: 0 6px 0 #b8bfc5;
  cursor: not-allowed;
  font-size: 1.4rem;
}
.node.current {
  outline: 6px solid color-mix(in srgb, var(--unit) 30%, transparent);
  animation: pulse-ring 2s infinite;
}
.node.checkpoint {
  border-radius: 22px;
  width: 84px;
}
.node-label {
  margin-top: 8px;
  font-size: 0.8rem;
  font-weight: 800;
  color: var(--muted);
}
.node-flag {
  position: absolute;
  top: -30px;
  background: var(--surface);
  border: 2px solid var(--line);
  color: var(--primary);
  font-weight: 900;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  padding: 3px 10px;
  border-radius: 10px;
  animation: bob 2s ease-in-out infinite;
  z-index: 1;
}

/* ---------- lesson ---------- */

.lesson {
  min-height: calc(100dvh - 36px);
  display: flex;
  flex-direction: column;
}
.lesson-top {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
}
.lesson-bar {
  flex: 1;
  height: 14px;
}
.retry-tag {
  font-weight: 900;
  color: var(--accent);
  font-size: 1.2rem;
}
.lesson-body {
  flex: 1;
  padding-bottom: 260px;
}

.ex-label {
  font-size: 0.75rem;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  color: var(--accent);
}
.ex-prompt {
  font-size: 1.45rem;
  font-weight: 900;
  margin: 4px 0 16px;
}
.prompt-en {
  font-size: 1.25rem;
  font-weight: 700;
  margin-bottom: 16px;
}
.prompt-sv {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  border: 2px solid var(--line);
  background: var(--surface);
  border-radius: var(--radius);
  padding: 18px;
  font-size: 1.6rem;
  font-weight: 900;
  color: var(--primary-dark);
  cursor: pointer;
  margin-bottom: 16px;
  text-align: left;
}
.hint {
  color: var(--muted);
  font-size: 0.9rem;
  text-align: center;
  margin: 12px 0;
}

.intro-card,
.speak-card {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 22px 16px 16px;
  text-align: center;
  margin: 8px 0 12px;
}
.big-sv {
  font-size: 2.2rem;
  font-weight: 900;
  color: var(--primary-dark);
  line-height: 1.15;
}
.big-en {
  font-size: 1.1rem;
  color: var(--muted);
  font-weight: 700;
  margin-top: 4px;
}
.say-box {
  margin-top: 14px;
  color: var(--muted);
  font-size: 0.9rem;
}
.say {
  font-style: italic;
  color: var(--ink);
}
.say b {
  font-style: normal;
  font-weight: 900;
  color: var(--primary);
  text-decoration: underline;
  text-decoration-thickness: 3px;
  text-underline-offset: 3px;
  text-decoration-color: var(--accent);
}
.say-lg {
  display: block;
  font-size: 1.35rem;
  margin-top: 4px;
}
.audio-row {
  display: flex;
  justify-content: center;
  gap: 12px;
  margin: 14px 0 4px;
}
.audio-row.compact {
  margin: 10px 0 0;
}

.rules {
  margin-top: 12px;
}
.rule-chips {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px;
}
.rule-chip {
  border: 2px solid #cfe3f5;
  background: #eef6fd;
  color: var(--blue);
  border-radius: 99px;
  padding: 4px 12px;
  font-weight: 800;
  font-size: 0.85rem;
  cursor: pointer;
}
.rule-chip.active {
  background: var(--blue);
  color: #fff;
  border-color: var(--blue);
}
.rule-detail {
  margin-top: 10px;
  text-align: left;
  background: #eef6fd;
  border-radius: 12px;
  padding: 10px 12px;
  font-size: 0.9rem;
  line-height: 1.45;
}

.listen-pad {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  margin: 8px 0 20px;
}
.big-audio {
  width: 96px;
  height: 96px;
  border-radius: 28px;
  border: 0;
  background: var(--blue);
  color: #fff;
  font-size: 2.4rem;
  cursor: pointer;
  box-shadow: 0 6px 0 #003366;
}
.big-audio:active {
  transform: translateY(4px);
  box-shadow: 0 2px 0 #003366;
}

.choices {
  display: grid;
  gap: 10px;
}
.choice {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 14px;
  border: 2px solid var(--line);
  border-radius: 16px;
  background: var(--surface);
  font-size: 1.05rem;
  font-weight: 700;
  text-align: left;
  cursor: pointer;
  box-shadow: 0 3px 0 var(--line);
}
.choice:hover:not(:disabled) {
  border-color: #b7d8c6;
}
.choice-num {
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border-radius: 8px;
  border: 2px solid var(--line);
  font-size: 0.8rem;
  color: var(--muted);
  flex-shrink: 0;
}
.choice.correct {
  border-color: var(--primary);
  background: var(--primary-soft);
  box-shadow: 0 3px 0 var(--primary);
}
.choice.wrong {
  border-color: var(--danger);
  background: var(--danger-soft);
  box-shadow: 0 3px 0 var(--danger);
  animation: shake 0.35s;
}
.choice.dim {
  opacity: 0.5;
}
.choice:disabled {
  cursor: default;
}

.answer-line {
  min-height: 64px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  padding: 10px 0;
  border-bottom: 2px solid var(--line);
  margin-bottom: 18px;
}
.placeholder {
  color: var(--muted);
  font-size: 0.9rem;
}
.chip-bank {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  margin-bottom: 12px;
  min-height: 48px;
}
.chip {
  border: 2px solid var(--line);
  background: var(--surface);
  border-radius: 12px;
  padding: 9px 14px;
  font-size: 1.05rem;
  font-weight: 800;
  cursor: pointer;
  box-shadow: 0 3px 0 var(--line);
  animation: pop 0.15s ease;
}
.chip.placed {
  border-color: #b7d8c6;
}

.type-input {
  width: 100%;
  padding: 16px;
  font-family: inherit;
  font-size: 1.35rem;
  font-weight: 800;
  border: 2px solid var(--line);
  border-radius: 16px;
  background: var(--surface);
  color: var(--ink);
}
.type-input:focus {
  outline: none;
  border-color: var(--primary);
}
.special-keys {
  display: flex;
  gap: 8px;
  margin-top: 10px;
}
.key {
  flex: 1;
  padding: 10px;
  border: 2px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  font-size: 1.3rem;
  font-weight: 900;
  cursor: pointer;
  box-shadow: 0 3px 0 var(--line);
}

.match-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.match-col {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.match-item {
  min-height: 60px;
  padding: 10px;
  border: 2px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
  font-weight: 800;
  font-size: 0.95rem;
  cursor: pointer;
  box-shadow: 0 3px 0 var(--line);
}
.match-item.selected {
  border-color: var(--blue);
  background: #eef6fd;
}
.match-item.matched {
  opacity: 0.35;
  border-color: var(--primary);
  pointer-events: none;
}
.match-item.miss {
  border-color: var(--danger);
  background: var(--danger-soft);
  animation: shake 0.35s;
}

.sheet {
  position: fixed;
  left: 50%;
  bottom: 0;
  transform: translateX(-50%);
  width: 100%;
  max-width: 520px;
  z-index: 30;
  border-radius: 24px 24px 0 0;
  padding: 16px 16px max(18px, env(safe-area-inset-bottom));
  animation: slide-up 0.22s ease;
  box-shadow: 0 -8px 30px rgba(0, 0, 0, 0.12);
}
.sheet.ok {
  background: #d7f5e3;
}
.sheet.soft {
  background: #fff1c9;
}
.sheet.nope {
  background: #ffe0e3;
}
.sheet-head {
  font-size: 1.3rem;
  font-weight: 900;
}
.sheet.ok .sheet-head {
  color: var(--primary);
}
.sheet.nope .sheet-head {
  color: var(--danger);
}
.sheet-answer {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 8px;
  font-size: 1.1rem;
}
.sheet-msg {
  margin-top: 6px;
  font-size: 0.9rem;
}
.sheet .bubble {
  background: rgba(255, 255, 255, 0.7);
  border-color: transparent;
}
.sheet .bubble-row {
  margin: 10px 0 4px;
}
.sheet .char-art {
  width: 44px;
  height: 44px;
}

.overlay {
  position: fixed;
  inset: 0;
  background: rgba(29, 43, 54, 0.45);
  display: grid;
  place-items: center;
  z-index: 60;
  padding: 20px;
  animation: fade 0.15s;
}
.dialog {
  width: 100%;
  max-width: 400px;
  animation: pop 0.2s ease;
}

/* ---------- report ---------- */

.report-card {
  text-align: center;
}
.report-title {
  font-size: 1.5rem;
  font-weight: 900;
  color: var(--primary-dark);
}
.report-sub {
  color: var(--muted);
  font-weight: 700;
}
.report-stats,
.mission-stats {
  display: flex;
  gap: 8px;
  margin: 16px 0 6px;
}
.report-stats > div,
.mission-stats > div {
  flex: 1;
  display: flex;
  flex-direction: column;
  border: 2px solid var(--line);
  border-radius: 14px;
  padding: 10px 4px;
}
.report-stats b,
.mission-stats b {
  font-size: 1.4rem;
  font-weight: 900;
}
.report-stats span,
.mission-stats span {
  font-size: 0.75rem;
  color: var(--muted);
  font-weight: 800;
  text-transform: uppercase;
}
.report-card .bubble-row {
  text-align: left;
}
.banner.good {
  background: var(--primary-soft);
  font-weight: 800;
}
.unlock {
  display: flex;
  align-items: center;
  gap: 14px;
  border: 2px solid var(--yellow);
  animation: pop 0.3s ease;
}
.unlock-art {
  width: 80px;
  height: 80px;
  flex-shrink: 0;
}
.unlock-kicker {
  font-size: 0.72rem;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--accent);
}
.mini-list,
.plain-list {
  list-style: none;
  padding: 0;
  margin: 0;
}
.mini-list li {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 0;
  border-bottom: 1px solid var(--line);
  font-weight: 800;
}
.plain-list li {
  padding: 5px 0;
  line-height: 1.4;
}
.mission-teaser {
  border: 2px dashed var(--accent);
}

.strength {
  display: inline-flex;
  align-items: center;
  gap: 3px;
}
.strength i {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.12);
}
.strength i.on {
  background: var(--primary);
}
.strength .star {
  font-size: 0.8rem;
  margin-left: 2px;
}

/* ---------- phrasebook / missions ---------- */

.search {
  width: 100%;
  padding: 12px 16px;
  border: 2px solid var(--line);
  border-radius: 14px;
  font-family: inherit;
  font-size: 1rem;
  margin-bottom: 8px;
  background: var(--surface);
}
.phrase-group {
  margin-top: 18px;
}
.group-title {
  font-size: 0.8rem;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  color: var(--unit);
  margin-bottom: 8px;
}
.phrase-list {
  list-style: none;
  padding: 0;
  margin: 0;
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.phrase-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
}
.phrase-row:last-child {
  border-bottom: 0;
}
.phrase-row.fresh {
  opacity: 0.55;
}
.phrase-text {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 1px;
}
.phrase-text span {
  font-size: 0.9rem;
}
.phrase-text .say {
  font-size: 0.85rem;
}

.mission.done {
  opacity: 0.7;
}
.mission-head {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 1.1rem;
}
.mission-head strong {
  flex: 1;
}

.rule-card p {
  line-height: 1.5;
}
.rule-short {
  display: inline-block;
  background: var(--blue);
  color: #fff;
  font-weight: 900;
  border-radius: 99px;
  padding: 3px 12px;
  margin-bottom: 8px;
}
.example-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

/* ---------- stories & quotes ---------- */

.story p {
  line-height: 1.6;
  margin: 10px 0;
}
.story-head {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 6px;
}
.story-head h2 {
  font-size: 1.35rem;
  font-weight: 900;
  line-height: 1.2;
}
.story-kicker {
  font-size: 0.72rem;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: #7b2cbf;
}
.story-sub {
  font-size: 0.8rem;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--muted);
  margin: 18px 0 8px;
}
.ex .story {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px;
}

.quote {
  margin: 16px 0;
  padding: 14px 16px;
  border-left: 5px solid var(--blue);
  background: #f2f6fb;
  border-radius: 0 14px 14px 0;
}
.quote blockquote,
.daily-quote blockquote {
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.08rem;
  line-height: 1.5;
  font-style: italic;
}
.quote figcaption {
  margin-top: 8px;
  font-weight: 900;
  display: flex;
  flex-direction: column;
}
.quote figcaption span {
  font-weight: 600;
  font-size: 0.8rem;
  color: var(--muted);
}
.quote-sv {
  display: block;
  border: 0;
  background: none;
  padding: 0;
  font-size: 1.1rem;
  font-weight: 900;
  color: var(--primary-dark);
  cursor: pointer;
  text-align: left;
  margin: 4px 0 2px;
}
.quote-say {
  font-size: 0.85rem;
  margin-bottom: 6px;
}

.daily-quote {
  border-top: 5px solid var(--yellow);
}
.daily-quote blockquote {
  margin: 8px 0 12px;
}
.quote-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  font-size: 0.82rem;
  color: var(--muted);
}

.word-spot {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}
.word {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  border: 2px solid var(--line);
  background: var(--surface);
  border-radius: 14px;
  padding: 10px 6px;
  cursor: pointer;
  box-shadow: 0 3px 0 var(--line);
}
.word b {
  font-weight: 900;
  color: var(--primary-dark);
}
.word span {
  font-size: 0.8rem;
}
.word i {
  font-size: 0.75rem;
  font-style: normal;
}
.word.mini {
  flex-shrink: 0;
  padding: 6px 10px;
}

.story-row {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 14px;
  border: 0;
  text-align: left;
  cursor: pointer;
}
.story-row.locked {
  opacity: 0.5;
  cursor: not-allowed;
}
.story-icon {
  width: 52px;
  height: 52px;
  border-radius: 16px;
  display: grid;
  place-items: center;
  font-size: 1.6rem;
  background: var(--unit);
  flex-shrink: 0;
}
.story-row-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.install-card {
  display: flex;
  align-items: center;
  gap: 10px;
  border-left: 5px solid var(--blue);
}
.install-actions {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}

/* ---------- word x-ray ---------- */

.word-tiles {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px;
  margin: 12px 0 4px;
}
.tile {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 52px;
  padding: 6px 10px;
  border: 2px solid var(--line);
  border-bottom-width: 4px;
  border-radius: 12px;
  background: var(--surface);
  cursor: pointer;
  font: inherit;
}
.tile b {
  font-size: 1.05rem;
  font-weight: 900;
  color: var(--primary-dark);
}
.tile span {
  font-size: 0.72rem;
  color: var(--muted);
  max-width: 120px;
  line-height: 1.2;
}
.word-tiles.compact {
  justify-content: flex-start;
}
.word-tiles.compact .tile {
  min-width: 0;
  padding: 4px 8px;
}
.word-tiles.compact .tile b {
  font-size: 0.9rem;
}

.book-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  text-align: center;
  margin: 6px 0 10px;
}
.book-stats div {
  background: var(--primary-soft);
  border-radius: 14px;
  padding: 10px 4px;
  display: flex;
  flex-direction: column;
}
.book-stats b {
  font-size: 1.5rem;
  font-weight: 900;
  color: var(--primary-dark);
}
.book-stats span {
  font-size: 0.75rem;
  font-weight: 700;
}
.phrase-row {
  cursor: pointer;
}

/* ---------- stuffie theater ---------- */

.scene-head h2 {
  font-size: 1.3rem;
  font-weight: 900;
}
.scene-roles {
  font-size: 0.85rem;
  background: var(--soft);
  border-radius: 12px;
  padding: 8px 10px;
  margin: 8px 0 12px;
}
.scene-lines {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 12px;
}
.scene-line {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  border: 0;
  background: none;
  padding: 0;
  text-align: left;
  font: inherit;
  cursor: pointer;
  animation: pop-in 0.25s ease-out;
}
.scene-line.right {
  flex-direction: row-reverse;
  text-align: right;
}
.scene-bubble {
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 2px solid var(--line);
  border-radius: 16px;
  padding: 8px 12px;
  max-width: 78%;
}
.scene-line.right .scene-bubble {
  background: #eef4fb;
}
.scene-sv {
  font-weight: 800;
  font-size: 1.05rem;
}
.scene-en {
  font-size: 0.85rem;
  color: var(--muted);
}
.scene-act {
  font-style: italic;
  font-size: 0.85rem;
  color: var(--muted);
  text-align: center;
  margin: 2px 16px;
  animation: pop-in 0.25s ease-out;
}
.scene-toggle {
  display: flex;
  gap: 8px;
  align-items: center;
  font-size: 0.8rem;
  color: var(--muted);
  margin-bottom: 10px;
}
.story-icon.theater {
  background: #ffe5ec;
}
@keyframes pop-in {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
}

/* ---------- duel ---------- */

.duel {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding-top: 12px;
}
.duel .bubble {
  text-align: left;
}
.duel-title {
  font-size: 1.7rem;
  font-weight: 900;
  text-align: center;
}
.duel-vs {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
}
.duel-vs > div:not(.vs) {
  display: flex;
  flex-direction: column;
  align-items: center;
}
.duel-vs span {
  font-size: 0.8rem;
  color: var(--muted);
}
.vs {
  font-size: 1.4rem;
  font-weight: 900;
  color: var(--accent);
  transform: rotate(-8deg);
}
.scoreboard {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  position: relative;
}
.score {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--surface);
  border: 3px solid var(--line);
  border-radius: 16px;
  padding: 6px 10px;
}
.score.active {
  border-color: var(--accent);
}
.score b {
  margin-left: auto;
  font-size: 1.2rem;
  font-weight: 900;
}
.round {
  grid-column: 1 / -1;
  text-align: center;
  font-size: 0.75rem;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--muted);
}
.handoff {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 8px;
  padding: 24px 0;
}
.handoff h2 {
  font-size: 1.6rem;
  font-weight: 900;
}
.timer {
  height: 10px;
  border-radius: 99px;
  background: var(--line);
  overflow: hidden;
  margin-bottom: 14px;
}
.timer-fill {
  height: 100%;
  background: var(--accent);
  transform-origin: left;
  animation: drain linear forwards;
}
@keyframes drain {
  from {
    transform: scaleX(1);
  }
  to {
    transform: scaleX(0);
  }
}
.duel-reveal {
  border-radius: var(--radius);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.duel-reveal.ok {
  background: var(--primary-soft);
}
.duel-reveal.nope {
  background: var(--danger-soft);
}
.duel-reveal .sheet-answer {
  border: 0;
  background: none;
  text-align: left;
  font: inherit;
  cursor: pointer;
}
.crowned {
  position: relative;
  display: inline-block;
  margin: 0 auto;
}
.crown {
  position: absolute;
  top: -28px;
  left: 50%;
  transform: translateX(-50%) rotate(-10deg);
  font-size: 2.6rem;
  z-index: 1;
}
.forfeit {
  border-top: 5px solid var(--accent);
  text-align: center;
}
.forfeit .quote-sv {
  text-align: center;
  width: 100%;
  font-size: 1.3rem;
}
.duel-card {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 14px;
  border: 0;
  text-align: left;
  font: inherit;
  cursor: pointer;
  background: linear-gradient(135deg, #fff4d6, #ffe5ec);
}
.duel-faces {
  display: flex;
  align-items: center;
  gap: 2px;
}
.duel-card-text {
  display: flex;
  flex-direction: column;
}

/* ---------- stickers ---------- */

.sticker-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}
.sticker {
  background: var(--surface);
  border: 0;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 12px 8px 10px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  cursor: pointer;
}
.sticker-img {
  width: 76px;
  height: 76px;
}
.sticker.locked .sticker-img,
.sticker-big.locked {
  filter: brightness(0) opacity(0.15);
}
.sticker-label {
  font-size: 0.8rem;
  font-weight: 800;
}
.sticker-big {
  width: 150px;
  height: 150px;
  margin: 0 auto 10px;
}

/* ---------- settings ---------- */

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin: 12px 0;
  font-weight: 800;
}
.field input[type="text"] {
  padding: 12px 14px;
  border: 2px solid var(--line);
  border-radius: 12px;
  font-family: inherit;
  font-size: 1rem;
  font-weight: 700;
}
.avatar-pick {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}
.avatar-opt {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  border: 2px solid var(--line);
  background: var(--surface);
  border-radius: 14px;
  padding: 8px 4px;
  cursor: pointer;
  font-size: 0.8rem;
  font-weight: 800;
}
.avatar-opt.active {
  border-color: var(--primary);
  background: var(--primary-soft);
}
.avatar-opt.locked {
  opacity: 0.4;
  cursor: not-allowed;
}
.seg {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
}
.seg button {
  display: flex;
  flex-direction: column;
  align-items: center;
  border: 2px solid var(--line);
  background: var(--surface);
  border-radius: 12px;
  padding: 8px 2px;
  cursor: pointer;
}
.seg button span {
  font-size: 0.7rem;
  color: var(--muted);
}
.seg button.active {
  border-color: var(--primary);
  background: var(--primary-soft);
}
.toggle {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 800;
}
.toggle input {
  width: 22px;
  height: 22px;
  accent-color: var(--primary);
}
.voice-status {
  margin-top: 10px;
}
.warn {
  background: var(--soft);
  border-radius: 12px;
  padding: 8px 12px;
  margin: 8px 0;
}
.warn p {
  margin: 4px 0;
}
.danger-zone {
  margin-top: 12px;
  border: 2px solid var(--danger-soft);
  border-radius: 14px;
  padding: 12px;
}

/* ---------- motion ---------- */

@keyframes bob {
  0%,
  100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-4px);
  }
}
@keyframes shake {
  0%,
  100% {
    transform: translateX(0);
  }
  25% {
    transform: translateX(-6px);
  }
  75% {
    transform: translateX(6px);
  }
}
@keyframes pop {
  from {
    transform: scale(0.92);
    opacity: 0;
  }
  to {
    transform: scale(1);
    opacity: 1;
  }
}
@keyframes slide-up {
  from {
    transform: translate(-50%, 100%);
  }
  to {
    transform: translate(-50%, 0);
  }
}
@keyframes rise {
  from {
    transform: translate(-50%, 10px);
    opacity: 0;
  }
}
@keyframes fade {
  from {
    opacity: 0;
  }
}
@keyframes pulse {
  50% {
    filter: brightness(1.2);
  }
}
@keyframes pulse-ring {
  50% {
    outline-width: 12px;
  }
}
@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
  }
  /* The duel timer is information, not decoration (10s = DUEL_SECONDS). */
  .timer-fill {
    animation: drain 10s linear forwards !important;
  }
}
