:root {
  --bg: #f4f3ee;
  --surface: #ffffff;
  --surface-soft: #f8fafc;
  --text: #0f172a;
  --text-muted: #475569;
  --border: #e2e8f0;
  --accent: #0f766e;
  --accent-soft: #ccfbf1;
  --accent-dark: #115e59;
  --amber: #b45309;
  --amber-soft: #fef3c7;
  --blue: #1d4ed8;
  --blue-soft: #dbeafe;
  --danger: #b91c1c;
  --danger-soft: #fee2e2;
  --ok: #15803d;
  --ok-soft: #dcfce7;
  --radius: 14px;
  --shadow: 0 10px 28px rgba(15, 23, 42, 0.08);
}

*, *::before, *::after {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  font-family: "Hiragino Kaku Gothic ProN", "Yu Gothic UI", "Meiryo", system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
}

.hidden {
  display: none !important;
}

/* ========== ボタン共通 ========== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 18px;
  border-radius: 10px;
  border: 1px solid transparent;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  transition: background-color 0.15s ease, transform 0.1s ease, opacity 0.15s ease;
}

.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.btn-primary {
  background: var(--accent);
  color: #ffffff;
}
.btn-primary:hover:not(:disabled) {
  background: var(--accent-dark);
}

.btn-accent {
  background: #1d4ed8;
  color: #ffffff;
}
.btn-accent:hover:not(:disabled) {
  background: #1e40af;
}

.btn-ghost {
  background: transparent;
  border-color: var(--border);
  color: var(--text);
}
.btn-ghost:hover:not(:disabled) {
  background: var(--surface-soft);
}

.btn-sm {
  padding: 6px 12px;
  font-size: 12.5px;
  border-radius: 8px;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
}
.btn-sm:hover:not(:disabled) {
  background: var(--surface-soft);
}

.btn-danger-outline {
  color: var(--danger);
  border-color: #fecaca;
}
.btn-danger-outline:hover:not(:disabled) {
  background: var(--danger-soft);
}

/* ========== ホーム画面（クラス一覧） ========== */
.home-shell {
  min-height: 100%;
  display: flex;
  flex-direction: column;
}

.home-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 24px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}

.home-brand {
  display: flex;
  align-items: center;
  gap: 10px;
}

.home-brand h1 {
  margin: 0;
  font-size: 18px;
  font-weight: 800;
}

.brand-badge {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 999px;
  background: var(--accent);
  color: #ffffff;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.04em;
}

.voice-pill {
  font-size: 12px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--surface-soft);
  border: 1px solid var(--border);
  color: var(--text-muted);
}

.home-main {
  width: min(920px, 100%);
  margin: 24px auto;
  padding: 0 16px 40px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* ========== 今日の授業（メイン導線） ========== */
.today-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-top: 4px solid var(--accent);
  border-radius: 18px;
  padding: 24px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.today-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.today-kicker {
  font-size: 12px;
  font-weight: 800;
  color: var(--accent);
  letter-spacing: 0.04em;
  margin-bottom: 2px;
}

.today-title {
  margin: 0 0 4px;
  font-size: 24px;
  font-weight: 900;
}

.today-subtitle {
  margin: 0;
  font-size: 14px;
  color: var(--text-muted);
}

.today-action-wrap {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
}

.btn-lg {
  padding: 13px 24px;
  font-size: 15.5px;
  border-radius: 12px;
}

.queue-section {
  border-top: 1px solid var(--border);
  padding-top: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.queue-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.queue-label {
  font-size: 12.5px;
  font-weight: 700;
  color: var(--text-muted);
}

.queue-count-badge {
  font-size: 12px;
  font-weight: 800;
  padding: 2px 9px;
  border-radius: 999px;
  background: var(--surface-soft);
  border: 1px solid var(--border);
  color: var(--text);
}

.queue-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.queue-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 11px 14px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--surface-soft);
}

.queue-item.is-next {
  background: #f0fdfa;
  border-color: #5eead4;
}

.queue-item.is-review {
  border-left: 4px solid var(--blue);
}

.queue-item.is-main {
  border-left: 4px solid var(--accent);
}

.queue-item-left {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.queue-order-num {
  width: 24px;
  height: 24px;
  border-radius: 999px;
  background: #e2e8f0;
  color: #334155;
  font-size: 12px;
  font-weight: 800;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
}

.queue-item.is-next .queue-order-num {
  background: var(--accent);
  color: #ffffff;
}

.queue-item-title {
  font-size: 14.5px;
  font-weight: 800;
}

.queue-item-meta {
  font-size: 12.5px;
  color: var(--text-muted);
}

.queue-empty {
  padding: 14px;
  border-radius: 12px;
  background: var(--ok-soft);
  border: 1px solid #bbf7d0;
  color: #14532d;
  font-size: 14px;
  font-weight: 700;
}

.upcoming-review-note {
  padding: 9px 12px;
  border-radius: 10px;
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  color: #1e40af;
  font-size: 12.5px;
  font-weight: 700;
}

/* ========== マニュアルでのクラス選択（サブ導線） ========== */
.manual-section {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.manual-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

.manual-controls {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.manual-search-input {
  padding: 6px 11px;
  border-radius: 9px;
  border: 1px solid var(--border);
  background: var(--surface);
  font-size: 13px;
  color: var(--text);
  min-width: 180px;
}

.manual-load-more-wrap {
  display: flex;
  justify-content: center;
  padding-top: 4px;
}

.level-filter-group {
  display: inline-flex;
  gap: 4px;
  padding: 3px;
  border-radius: 10px;
  background: var(--surface);
  border: 1px solid var(--border);
}

.level-filter-btn {
  padding: 4px 11px;
  border-radius: 7px;
  border: none;
  background: transparent;
  font-size: 12.5px;
  font-weight: 700;
  color: var(--text-muted);
  cursor: pointer;
}

.level-filter-btn.is-active {
  background: var(--accent);
  color: #ffffff;
}

.manual-heading {
  margin: 0;
  font-size: 14px;
  font-weight: 800;
  color: var(--text-muted);
}

.manual-class-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.manual-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.manual-card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.manual-card-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.class-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 24px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.class-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.class-code {
  font-size: 12px;
  font-weight: 800;
  color: var(--accent);
  letter-spacing: 0.04em;
  margin-bottom: 4px;
}

.class-title {
  margin: 0 0 4px;
  font-size: 22px;
  font-weight: 800;
}

.class-subtitle {
  margin: 0;
  font-size: 14px;
  color: var(--text-muted);
}

.mastery-badge {
  flex: 0 0 auto;
  padding: 4px 12px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
  background: var(--surface-soft);
  border: 1px solid var(--border);
  color: var(--text-muted);
}

.mastery-badge.is-main-done {
  background: var(--amber-soft);
  border-color: #fde68a;
  color: var(--amber);
}

.mastery-badge.is-mastered {
  background: var(--ok-soft);
  border-color: #bbf7d0;
  color: var(--ok);
}

.item-chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.item-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12.5px;
  font-weight: 700;
  background: var(--surface-soft);
  border: 1px solid var(--border);
}

.item-chip-kind {
  font-size: 11px;
  padding: 1px 6px;
  border-radius: 999px;
  background: #e2e8f0;
  color: #334155;
}

.item-chip.is-grammar .item-chip-kind {
  background: var(--blue-soft);
  color: var(--blue);
}

.mode-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.mode-panel {
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 16px;
  background: var(--surface-soft);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.mode-panel-main {
  border-left: 4px solid var(--accent);
}

.mode-panel-review {
  border-left: 4px solid var(--blue);
}

.mode-panel-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.mode-tag {
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
  color: #ffffff;
}

.mode-tag-main {
  background: var(--accent);
}

.mode-tag-review {
  background: var(--blue);
}

.mode-status {
  font-size: 12.5px;
  font-weight: 700;
  color: var(--text-muted);
}

.mode-desc {
  margin: 0;
  font-size: 13.5px;
  color: var(--text-muted);
}

.review-timer-box {
  padding: 8px 12px;
  border-radius: 8px;
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  font-size: 12.5px;
  font-weight: 700;
  color: #1e40af;
}

.mode-actions {
  margin-top: auto;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.syllabus-block {
  border-top: 1px solid var(--border);
  padding-top: 16px;
}

.syllabus-heading {
  margin: 0 0 10px;
  font-size: 14px;
  font-weight: 800;
  color: var(--text-muted);
}

.syllabus-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.syllabus-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 14px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface);
}

.syllabus-row-left {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.syllabus-term-line {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.syllabus-term {
  font-size: 15px;
  font-weight: 800;
}

.syllabus-pos {
  font-size: 11.5px;
  color: var(--text-muted);
  background: var(--surface-soft);
  padding: 1px 7px;
  border-radius: 6px;
  border: 1px solid var(--border);
}

.syllabus-meaning {
  font-size: 13.5px;
  font-weight: 600;
}

.syllabus-ex {
  font-size: 12.5px;
  color: var(--text-muted);
}

.syllabus-row-right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 0 0 auto;
}

.dev-bar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  padding: 12px 16px;
  border-radius: 12px;
  background: #ffffff;
  border: 1px dashed #cbd5e1;
}

.dev-bar-label {
  font-size: 12.5px;
  font-weight: 700;
  color: var(--text-muted);
}

.dev-bar-msg {
  font-size: 12.5px;
  font-weight: 700;
  color: var(--accent-dark);
}

/* ========== ステージ（受講画面） ========== */
.stage {
  position: relative;
  width: 100%;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: linear-gradient(180deg, #e7eef2 0%, #f4f3ee 55%);
}

/* HUD */
.hud {
  position: absolute;
  top: max(12px, env(safe-area-inset-top));
  z-index: 25;
  display: flex;
  align-items: center;
  gap: 8px;
}

.hud-top-left {
  left: 14px;
}

.hud-top-right {
  right: 14px;
}

.hud-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 13px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.94);
  border: 1px solid var(--border);
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.08);
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
  cursor: pointer;
}

.hud-pill:hover {
  background: #ffffff;
}

.hud-pill-sm {
  padding: 6px 11px;
  font-size: 12.5px;
}

.hud-sep {
  color: #94a3b8;
}

.icon-chevron {
  width: 15px;
  height: 15px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.2;
}

.mode-pill {
  padding: 5px 11px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
  color: #ffffff;
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.1);
}
.mode-pill-main {
  background: var(--accent);
}
.mode-pill-review {
  background: var(--blue);
}

/* ポップオーバー */
.popover {
  position: absolute;
  top: 56px;
  z-index: 30;
  width: min(320px, calc(100vw - 28px));
  max-height: 62vh;
  overflow-y: auto;
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: 0 18px 40px rgba(15, 23, 42, 0.16);
  padding: 12px;
}

.popover-left {
  left: 14px;
}

.popover-right {
  right: 14px;
}

.popover-wide {
  width: min(400px, calc(100vw - 28px));
}

.popover-header {
  font-size: 12px;
  font-weight: 800;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.step-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.step-list-btn {
  width: 100%;
  text-align: left;
  padding: 7px 10px;
  border-radius: 8px;
  border: 1px solid transparent;
  background: transparent;
  font-size: 12.5px;
  color: var(--text);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
}

.step-list-btn:hover {
  background: var(--surface-soft);
}

.step-list-btn.is-active {
  background: var(--accent-soft);
  border-color: #99f6e4;
  font-weight: 800;
}

.step-list-tag {
  font-size: 10.5px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 6px;
  background: #e2e8f0;
  color: #334155;
  flex: 0 0 auto;
}

.notes-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.note-mini-card {
  padding: 9px 11px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface-soft);
}

.note-mini-term {
  font-size: 14px;
  font-weight: 800;
}

.note-mini-meaning {
  font-size: 12.5px;
  color: var(--text);
}

.note-mini-ex {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
}

/* ========== 中央ボードエリア ========== */
.board-area {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: 64px 16px 240px;
  display: flex;
  justify-content: center;
  align-items: flex-start;
}

.board-container {
  width: min(820px, 100%);
}

.board-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 22px 24px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.board-kicker {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 800;
  color: var(--accent);
  letter-spacing: 0.03em;
}

.board-heading {
  margin: 0;
  font-size: 20px;
  font-weight: 800;
}

.board-lead {
  margin: 0;
  font-size: 14px;
  color: var(--text-muted);
}

/* 単語カード */
.word-hero {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
  padding: 14px 18px;
  border-radius: 14px;
  background: #f0fdfa;
  border: 1px solid #99f6e4;
}

.word-term-big {
  font-size: 32px;
  font-weight: 900;
  letter-spacing: 0.01em;
  color: #0f172a;
}

.word-meta-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 4px;
}

.pos-badge {
  padding: 2px 8px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 700;
  background: #ffffff;
  border: 1px solid #99f6e4;
  color: var(--accent-dark);
}

.word-reading {
  font-size: 13px;
  color: var(--text-muted);
}

.word-meaning-box {
  text-align: right;
}

.word-meaning {
  font-size: 19px;
  font-weight: 800;
}

.pattern-strip {
  padding: 8px 14px;
  border-radius: 10px;
  background: var(--surface-soft);
  border: 1px solid var(--border);
  font-size: 14px;
  font-weight: 700;
}

/* 例文ブロック */
.example-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.example-box {
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--surface-soft);
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.example-id {
  font-size: 16.5px;
  font-weight: 800;
  color: var(--text);
}

.example-hl {
  background: #fef08a;
  padding: 0 4px;
  border-radius: 4px;
}

.example-ja {
  font-size: 14px;
  color: var(--text);
  margin-top: 2px;
}

.example-note {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 4px;
}

.btn-speak-id {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 6px 11px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: #ffffff;
  font-size: 12px;
  font-weight: 700;
  color: var(--text);
  cursor: pointer;
}

.btn-speak-id:hover {
  background: var(--accent-soft);
  border-color: #99f6e4;
}

.tip-box {
  padding: 11px 14px;
  border-radius: 12px;
  background: #fffbeb;
  border: 1px solid #fde68a;
  font-size: 13.5px;
}

.tip-title {
  font-weight: 800;
  color: var(--amber);
  margin-bottom: 2px;
}

/* 文法ブロック図 */
.grammar-blocks {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  padding: 14px;
  border-radius: 14px;
  background: var(--surface-soft);
  border: 1px solid var(--border);
}

.g-block {
  padding: 8px 14px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: #ffffff;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.g-block.is-connector {
  background: #eff6ff;
  border-color: #93c5fd;
}

.g-block-label {
  font-size: 11px;
  font-weight: 800;
  color: var(--text-muted);
}

.g-block.is-connector .g-block-label {
  color: var(--blue);
}

.g-block-text {
  font-size: 16px;
  font-weight: 800;
}

/* 対照テーブル */
.compare-table {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.compare-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 14px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface-soft);
}

.compare-left {
  font-size: 15.5px;
  font-weight: 800;
}

.compare-right {
  font-size: 14px;
  color: var(--text-muted);
}

/* 概要アイテムグリッド */
.overview-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 10px;
}

.overview-item {
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface-soft);
}

.overview-tag {
  font-size: 11px;
  font-weight: 800;
  color: var(--accent);
}

.overview-term {
  font-size: 16px;
  font-weight: 800;
  margin-top: 2px;
}

.overview-gloss {
  font-size: 13px;
  color: var(--text-muted);
}

/* インタラクティブ確認テスト */
.quiz-card {
  border-top: 4px solid var(--blue);
}

.quiz-prompt {
  margin: 0;
  font-size: 16px;
  font-weight: 800;
}

.quiz-sentence {
  font-size: 19px;
  font-weight: 800;
  padding: 14px 16px;
  border-radius: 12px;
  background: var(--surface-soft);
  border: 1px solid var(--border);
}

.quiz-blank {
  display: inline-block;
  min-width: 90px;
  padding: 2px 10px;
  margin: 0 4px;
  border-bottom: 3px solid var(--blue);
  text-align: center;
  color: var(--blue);
  background: #eff6ff;
  border-radius: 6px 6px 0 0;
}

.quiz-options-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 10px;
}

.quiz-options-col {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.quiz-opt-btn {
  text-align: left;
  padding: 12px 14px;
  border-radius: 12px;
  border: 2px solid var(--border);
  background: #ffffff;
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
  cursor: pointer;
  transition: border-color 0.15s ease, background-color 0.15s ease;
}

.quiz-opt-btn:hover:not(:disabled) {
  border-color: #93c5fd;
  background: #f8fafc;
}

.quiz-opt-btn.is-correct {
  border-color: var(--ok);
  background: var(--ok-soft);
  color: #14532d;
}

.quiz-opt-btn.is-wrong {
  border-color: var(--danger);
  background: var(--danger-soft);
  color: #7f1d1d;
}

/* 語順並べ替え */
.order-answer-zone {
  min-height: 54px;
  padding: 10px 12px;
  border-radius: 12px;
  border: 2px dashed #cbd5e1;
  background: var(--surface-soft);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.order-placeholder {
  font-size: 13.5px;
  color: #94a3b8;
}

.order-bank {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.token-chip {
  padding: 8px 14px;
  border-radius: 10px;
  border: 1.5px solid #cbd5e1;
  background: #ffffff;
  font-size: 15px;
  font-weight: 800;
  color: var(--text);
  cursor: pointer;
}

.token-chip:hover:not(:disabled) {
  border-color: var(--blue);
  background: #eff6ff;
}

.token-chip.is-used {
  opacity: 0.35;
  cursor: default;
}

.token-chip-selected {
  background: #eff6ff;
  border-color: #60a5fa;
}

.order-controls {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.quiz-result-banner {
  padding: 10px 14px;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 800;
}

.quiz-result-banner.is-correct {
  background: var(--ok-soft);
  color: #14532d;
  border: 1px solid #86efac;
}

.quiz-result-banner.is-wrong {
  background: var(--danger-soft);
  color: #7f1d1d;
  border: 1px solid #fecaca;
}

/* ========== 下部：ゆっくり字幕＆プレイヤー ========== */
.caption-pane {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 20;
  padding: 0 16px max(12px, env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  pointer-events: none;
  background: linear-gradient(to top, rgba(244, 243, 238, 0.96) 0%, rgba(244, 243, 238, 0.72) 72%, transparent 100%);
}

.dialogue-row {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 14px;
  width: min(1080px, 100%);
  pointer-events: none;
}

.yukkuri-slot {
  position: relative;
  flex: 0 0 clamp(112px, 12.5vw, 168px);
  width: clamp(112px, 12.5vw, 168px);
  height: clamp(94px, 10.5vw, 140px);
  pointer-events: none;
  opacity: 0.72;
  transform: scale(0.92);
  transform-origin: bottom center;
  transition: opacity 0.2s ease, transform 0.2s ease;
  filter: drop-shadow(0 6px 14px rgba(15, 23, 42, 0.2));
}

.yukkuri-slot.is-speaking {
  opacity: 1;
  transform: scale(1.02);
  animation: yukkuri-bob 0.65s ease-in-out infinite alternate;
}

@keyframes yukkuri-bob {
  0% { transform: scale(1.02) translateY(0px); }
  100% { transform: scale(1.02) translateY(-3px); }
}

.yukkuri-stage {
  position: relative;
  width: 100%;
  height: 100%;
}

.yukkuri-left .yukkuri-stage {
  transform: scaleX(-1);
}

.yukkuri-part {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  user-select: none;
  pointer-events: none;
}

.speaker-tag {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
  color: #ffffff;
}

.speaker-reimu {
  background: #be185d;
}

.speaker-marisa {
  background: #92400e;
}

.caption-card {
  pointer-events: auto;
  flex: 1 1 auto;
  max-width: 760px;
  padding: 12px 18px;
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.97);
  border: 1px solid var(--border);
  border-left: 4px solid var(--accent);
  box-shadow: 0 10px 28px rgba(15, 23, 42, 0.12);
}

.caption-meta {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-bottom: 4px;
  flex-wrap: wrap;
}

.section-badge {
  padding: 1px 8px;
  border-radius: 999px;
  background: var(--accent);
  color: #ffffff;
  font-size: 11px;
  font-weight: 700;
}

.role-badge {
  padding: 1px 8px;
  border-radius: 999px;
  background: #f1f5f9;
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 700;
}

.step-title {
  margin: 0;
  font-size: 14px;
  font-weight: 800;
}

.subtitle-text {
  margin: 0;
  font-size: 15px;
  line-height: 1.6;
  color: var(--text);
}

.caption-footer {
  margin-top: 8px;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
}

.quiz-gate-hint {
  font-size: 12px;
  font-weight: 700;
  color: var(--amber);
}

.btn-next-section {
  padding: 6px 14px;
  border-radius: 999px;
  border: none;
  background: var(--accent);
  color: #ffffff;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}

.btn-next-section:hover:not(:disabled) {
  background: var(--accent-dark);
}

.btn-next-section:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

/* プレイヤーバー */
.player-bar {
  pointer-events: auto;
  width: min(1080px, 100%);
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.96);
  border: 1px solid var(--border);
  box-shadow: 0 6px 18px rgba(15, 23, 42, 0.1);
}

.player-controls {
  display: flex;
  align-items: center;
  gap: 4px;
}

.ctrl-btn {
  width: 32px;
  height: 32px;
  border-radius: 999px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.ctrl-btn:hover {
  background: var(--surface-soft);
}

.ctrl-btn svg {
  width: 17px;
  height: 17px;
  fill: currentColor;
}

.ctrl-play {
  background: var(--accent);
  color: #ffffff;
}
.ctrl-play:hover {
  background: var(--accent-dark);
}

.timeline {
  flex: 1 1 auto;
  display: flex;
  align-items: center;
  gap: 5px;
  overflow-x: auto;
  padding: 2px 4px;
}

.tl-dot {
  flex: 1 1 0;
  min-width: 10px;
  max-width: 28px;
  height: 7px;
  border-radius: 999px;
  border: none;
  background: #cbd5e1;
  cursor: pointer;
  padding: 0;
  transition: background-color 0.15s ease, transform 0.15s ease;
}

.tl-dot.is-quiz {
  border-radius: 2px;
  background: #fde68a;
}

.tl-dot.is-done {
  background: #5eead4;
}

.tl-dot.is-quiz.is-done {
  background: #f59e0b;
}

.tl-dot.is-active {
  background: var(--accent);
  transform: scaleY(1.35);
}

.tl-dot.is-quiz.is-active {
  background: var(--blue);
}

.tts-controls {
  display: flex;
  align-items: center;
  gap: 4px;
}

.ctrl-tts.is-on {
  color: var(--accent);
}

.ctrl-rate-btn {
  padding: 3px 8px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface-soft);
  font-size: 11.5px;
  font-weight: 800;
  cursor: pointer;
}

.player-hint {
  font-size: 11.5px;
  font-weight: 700;
  color: var(--text-muted);
  min-width: 44px;
  text-align: right;
}

@media (max-width: 720px) {
  .mode-grid {
    grid-template-columns: 1fr;
  }
  .yukkuri-slot {
    flex: 0 0 78px;
    width: 78px;
    height: 66px;
  }
  .board-area {
    padding: 58px 10px 250px;
  }
  .board-card {
    padding: 16px;
  }
}
