/* Alpine.js: 初期化完了までの FOUC 防止 */
[x-cloak] { display: none !important; }

:root {
  /* 基本色 */
  --bg:           #FAFAF8;
  --bg-card:      #FFFFFF;
  --bg-subtle:    #F5F4F0;

  /* テキスト */
  --text:         #1A1A1A;
  --text-muted:   #666666;
  --text-subtle:  #999999;

  /* ボーダー */
  --border:       #E5E5E2;
  --border-strong: #CCCCCA;

  /* アクセント（日章旗の赤） — 装飾3箇所のみ使用 */
  --accent:       #BC002D;
  --accent-hover: #9A0024;

  /* 機能色 */
  --correct: #2e7d32;
  --wrong:   #c62828;

  /* 形状 */
  --radius:    6px;
  --radius-lg: 10px;
}

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family:
    'Be Vietnam Pro',
    'Noto Sans JP',
    -apple-system, BlinkMacSystemFont,
    'Hiragino Kaku Gothic ProN',
    'Hiragino Sans',
    'Yu Gothic Medium',
    '游ゴシック Medium',
    YuGothic,
    'Yu Gothic',
    Meiryo,
    sans-serif;
  font-size: 16px;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

button {
  cursor: pointer;
  border: none;
  border-radius: var(--radius);
  font-size: 16px;
  padding: 12px 24px;
  line-height: 1.4;
  font-family: inherit;
}

button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

a {
  color: var(--text);
  text-decoration: underline;
  text-underline-offset: 2px;
}

/* 選択肢ボタン */
.choice-btn {
  display: block;
  width: 100%;
  min-height: 52px;
  text-align: left;
  padding: 14px 16px;
  font-size: 17px;
  line-height: 1.6;
  background: var(--bg-card);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 10px;
  transition: border-color 0.15s, background 0.15s;
}

.choice-btn:hover:not(:disabled) {
  border-color: var(--border-strong);
}

.choice-btn.selected {
  border-color: var(--accent);
  background: #FFF5F7;
}

.choice-btn.correct {
  border-color: var(--correct);
  background: #e8f5e9;
}

.choice-btn.wrong {
  border-color: var(--wrong);
  background: #ffebee;
}

/* モーダル */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 16px;
}

.modal-box {
  background: var(--bg);
  border-radius: var(--radius);
  padding: 32px;
  max-width: 540px;
  width: 100%;
  max-height: 85vh;
  overflow-y: auto;
  line-height: 1.7;
}

/* モーダル内要素 */
.modal-h2     { margin-top: 0; }
.modal-para   { margin-bottom: 12px; }
.btn-modal-accept { margin-top: 8px; width: 100%; }
.btn-modal-close  { margin-top: 8px; }

/* ヘッダー */
.site-header {
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  padding: 0 20px;
  position: sticky;
  top: 0;
  z-index: 100;
}

.site-header-inner {
  max-width: 720px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 56px;
}

/* ヘッダーロゴドット */
.site-logo-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--accent);
  flex-shrink: 0;
  display: inline-block;
}

.site-title {
  font-size: 16px;
  font-weight: 500;
  color: var(--text);
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 8px;
}

.site-title:hover {
  text-decoration: none;
}

.site-title-main {
  font-size: 16px;
  font-weight: 500;
  color: var(--text);
  white-space: nowrap;
  letter-spacing: 0.02em;
}

.site-title-sub {
  font-size: 13px;
  font-weight: 400;
  color: var(--text-muted);
  white-space: nowrap;
}

/* ヘッダー言語切替 */
.header-lang-switch {
  display: flex;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.header-lang-btn {
  padding: 4px 10px;
  font-size: 12px;
  font-weight: 400;
  background: transparent;
  color: var(--text-muted);
  border: none;
  cursor: pointer;
  font-family: inherit;
  transition: background 0.15s, color 0.15s;
}

.header-lang-btn.is-active {
  background: var(--text);
  color: #fff;
}

/* ヘッダーナビリンク・ボタン */
.header-login-link {
  font-size: 13px;
  color: var(--text);
  text-decoration: none;
  padding: 4px 12px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
}

.header-register-link {
  font-size: 13px;
  color: #fff;
  background: var(--accent);
  text-decoration: none;
  padding: 4px 12px;
  border: 1px solid var(--accent);
  border-radius: var(--radius);
}

.header-logged-in {
  display: flex;
  align-items: center;
  gap: 12px;
}

.header-admin-link {
  font-size: 13px;
  color: var(--text);
  text-decoration: none;
}

.header-user-link {
  font-size: 13px;
  color: var(--text);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.header-logout-btn {
  font-size: 13px;
  color: var(--text);
  background: transparent;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  cursor: pointer;
  padding: 4px 12px;
  font-family: inherit;
}

/* モバイルメニュー内ユーザーリンク */
.mobile-user-link {
  color: var(--text);
  text-decoration: underline;
  text-underline-offset: 2px;
}

/* ヘッダー右側ラッパー */
.header-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

/* デスクトップナビ（モバイルでは非表示） */
.header-nav-desktop {
  display: flex;
  align-items: center;
  gap: 12px;
}

/* ハンバーガーボタン（デスクトップでは非表示） */
.hamburger-btn {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  background: none;
  border: none;
  padding: 8px;
  border-radius: 4px;
  cursor: pointer;
  min-width: 40px;
  min-height: 40px;
}

.hamburger-btn .bar {
  display: block;
  width: 22px;
  height: 2px;
  background: var(--text);
  border-radius: 2px;
  transition: transform 0.2s, opacity 0.2s;
}

.hamburger-btn.open .bar:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.hamburger-btn.open .bar:nth-child(2) { opacity: 0; }
.hamburger-btn.open .bar:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* モバイルドロップダウンメニュー */
.mobile-menu {
  position: fixed;
  top: 56px;
  left: 0;
  right: 0;
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
  z-index: 200;
  padding: 8px 0;
}

.mobile-menu-item {
  display: flex;
  align-items: center;
  width: 100%;
  min-height: 48px;
  padding: 12px 20px;
  font-size: 15px;
  text-decoration: none;
  color: var(--text);
  background: none;
  border: none;
  text-align: left;
  cursor: pointer;
  font-family: inherit;
  border-radius: 0;
  line-height: 1.4;
}

.mobile-menu-item:active {
  background: var(--bg-subtle);
}

.mobile-menu-item.accent {
  color: var(--text);
}

@media (max-width: 520px) {
  .header-nav-desktop { display: none; }
  .hamburger-btn { display: flex; }
}

/* フッター */
.site-footer {
  border-top: 3px solid var(--accent);
  background: var(--bg-card);
  padding: 16px 20px;
  text-align: center;
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 48px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.footer-links { display: flex; align-items: center; }

.footer-disclaimer-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  text-decoration: underline;
  text-underline-offset: 2px;
  cursor: pointer;
  font-size: 12px;
  padding: 0;
  font-family: inherit;
}

.footer-sep {
  margin: 0 10px;
  color: var(--text-subtle);
}

.footer-privacy-link {
  color: var(--text-muted);
  text-decoration: underline;
  text-underline-offset: 2px;
  font-size: 12px;
}

.footer-copyright {
  font-size: 12px;
  color: var(--text-muted);
}

/* セクション見出し装飾 */
.section-heading {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 0 0 12px;
}

.section-heading-bar {
  width: 4px;
  height: 20px;
  background: var(--accent);
  border-radius: 1px;
  flex-shrink: 0;
}

.section-heading h1 {
  font-size: 20px;
  font-weight: 500;
  letter-spacing: 0.01em;
  margin: 0;
}

.section-heading h2 {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-muted);
  letter-spacing: 0.04em;
  margin: 0;
}

/* レベルグリッド */
.level-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 10px;
  margin-bottom: 36px;
}

@media (max-width: 520px) {
  .level-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

/* ユーティリティ */
.btn-primary {
  background: var(--text);
  color: #ffffff;
  font-weight: 500;
  padding: 14px 32px;
  font-size: 16px;
}

.btn-primary:hover:not(:disabled) {
  background: #333333;
}

.btn-secondary {
  background: var(--bg-subtle);
  color: var(--text);
}

.btn-secondary:hover:not(:disabled) {
  background: var(--border);
}

/* 進行状況バー */
.progress-bar-wrap {
  height: 6px;
  background: var(--border);
  border-radius: 3px;
  margin-bottom: 20px;
  overflow: hidden;
}

.progress-bar-fill {
  height: 100%;
  background: var(--border-strong);
  border-radius: 3px;
  transition: width 0.3s ease;
}

/* エラー表示 */
.error-message {
  color: var(--wrong);
  padding: 12px;
  background: #ffebee;
  border-radius: var(--radius);
  margin: 12px 0;
}

/* ローディング */
.loading-text {
  color: var(--text-muted);
  text-align: center;
  padding: 24px;
}

/* ===== 管理画面レスポンシブ ===== */

/* admin-hamburger はデスクトップでは非表示 */
.admin-hamburger {
  display: none;
  background: none;
  border: none;
  padding: 8px;
  cursor: pointer;
  border-radius: 4px;
  min-width: 40px;
  min-height: 40px;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
}

.admin-hamburger .bar {
  display: block;
  width: 22px;
  height: 2px;
  background: #fff;
  border-radius: 2px;
  transition: transform 0.2s, opacity 0.2s;
}

.admin-hamburger.open .bar:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.admin-hamburger.open .bar:nth-child(2) { opacity: 0; }
.admin-hamburger.open .bar:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

@media (max-width: 768px) {
  /* レイアウト: サイドバー → トップバー */
  .admin-wrapper {
    flex-direction: column !important;
  }

  .admin-nav {
    width: 100% !important;
    flex-direction: column !important;
    padding: 0 !important;
    gap: 0 !important;
  }

  .admin-nav-title-bar {
    display: flex !important;
    justify-content: space-between;
    align-items: center;
    padding: 0 16px !important;
    height: 52px;
    flex-shrink: 0;
    border-bottom: 1px solid rgba(255,255,255,0.2);
  }

  .admin-hamburger {
    display: flex;
  }

  /* モバイルではタイトルの下線を非表示（titleBar の border-bottom で代替） */
  .admin-nav-title-bar span {
    border-bottom: none !important;
    padding-bottom: 0 !important;
  }

  /* ナビリンク: デフォルト非表示、open で表示 */
  /* inline style (display:flex) を上書きするため !important が必要 */
  .admin-nav-links {
    display: none !important;
    flex-direction: column !important;
    border-top: 1px solid rgba(255,255,255,0.2);
  }

  .admin-nav-links.open {
    display: flex !important;
  }

  .admin-logout-btn {
    margin: 8px 16px !important;
  }

  /* メインコンテンツ: 幅いっぱい */
  .admin-main {
    padding: 16px !important;
    max-width: 100% !important;
  }

  /* 問題一覧: テーブル横スクロール */
  .admin-table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  /* 問題一覧: topBar を折り返し */
  .admin-top-bar {
    flex-wrap: wrap !important;
    gap: 8px !important;
  }

  /* 問題一覧: フィルター行を縦積み */
  .admin-filters {
    flex-direction: column !important;
  }

  /* 統計: 2カラムグリッド */
  .admin-stats-grid {
    grid-template-columns: repeat(2, 1fr) !important;
  }

  /* フォームモーダル: padding を縮小 */
  .admin-modal {
    padding: 16px !important;
  }

  /* フォーム: セクション/レベル/ステータス行を折り返し */
  .admin-form-row {
    flex-wrap: wrap !important;
  }

  /* フォーム: 選択肢入力を縦積み */
  .admin-choice-row {
    flex-wrap: wrap !important;
  }

  .admin-choice-row > input {
    width: 100%;
    min-width: 0;
  }

  /* CSVインポート: ボタンを全幅 */
  .admin-import-btn {
    width: 100% !important;
  }
}

/* 問題文中のターゲット語（mark）*/
.question-mark {
  background: none;
  color: inherit;
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* fill_blank の空欄 */
.question-fill-blank {
  display: inline-block;
  min-width: 3em;
  border-bottom: 2px solid var(--text, #333);
  vertical-align: bottom;
}

/* ---- セグメントコントロール（ラジオボタン型タブ） ---- */
.seg-ctrl {
  display: inline-flex;
  gap: 6px;
}

.seg-ctrl label {
  cursor: pointer;
  padding: 10px 28px;
  font-size: 14px;
  font-weight: 600;
  border: 1px solid #ccc;
  border-radius: 4px;
  display: block;
  user-select: none;
  background: #fff;
  color: #333;
  transition: background 0.12s, color 0.12s, border-color 0.12s;
}

.seg-ctrl label:hover {
  background: #eef2fa;
  border-color: #2c5aa0;
  color: #2c5aa0;
}

.seg-ctrl label.is-selected {
  background: #2c5aa0;
  color: #fff;
  border-color: #2c5aa0;
}

/* ---- 管理画面: インポートページ ---- */
.import-section-label {
  font-size: 13px;
  color: #555;
  font-weight: 600;
  margin-bottom: 8px;
}

.import-format-box {
  margin-bottom: 20px;
  padding: 16px;
  background: #fff;
  border: 1px solid #e0e0e0;
  border-radius: 8px;
  font-size: 13px;
  color: #555;
}

.import-format-box code {
  display: block;
  background: #f5f5f5;
  padding: 10px 12px;
  border-radius: 4px;
  font-size: 12px;
  margin: 8px 0;
  word-break: break-all;
  line-height: 1.8;
}

.import-format-box ul {
  margin: 4px 0 0 16px;
  line-height: 1.8;
}

.import-notice {
  margin-bottom: 20px;
  padding: 16px;
  background: #fff8e1;
  border: 1px solid #ffe082;
  border-radius: 8px;
  font-size: 14px;
  color: #795548;
}

.import-result {
  margin-top: 28px;
  padding: 20px;
  background: #fff;
  border: 1px solid #e0e0e0;
  border-radius: 8px;
  max-width: 640px;
}

.import-result h2 {
  font-size: 18px;
  margin-bottom: 8px;
}

.import-dry-badge {
  font-size: 13px;
  background: #fff3e0;
  color: #e65100;
  border: 1px solid #ffcc80;
  border-radius: 4px;
  padding: 2px 8px;
  margin-left: 8px;
}

.import-result-success { color: #2e7d32; margin-bottom: 6px; }
.import-result-skip    { color: #856404; margin-bottom: 6px; }
.import-result-errors  { margin-top: 12px; font-size: 13px; color: #c62828; }
.import-result-warns   { margin-top: 12px; font-size: 13px; color: #856404; }
.import-result-errors ul,
.import-result-warns  ul { margin: 6px 0 0 16px; line-height: 1.8; }

.admin-description-box { background: #f0f4f8; border-left: 4px solid #5b8dd9; border-radius: 4px; padding: 14px 18px; margin-bottom: 28px; font-size: 14px; line-height: 1.8; }
.admin-description-box p { margin: 0 0 8px; }
.admin-description-box ul { margin: 0 0 0 18px; padding: 0; }
.admin-description-box li { margin-bottom: 4px; }
.import-block      { margin-bottom: 24px; }
.import-mode-note  { font-size: 12px; color: #888; margin-left: 12px; }

/* ===== Quiz Pages ===== */

/* セクション選択 */
.section-level-hint {
  color: #888;
  margin-bottom: 8px;
}

.section-h1 {
  font-size: 22px;
  margin-bottom: 24px;
}

.section-desc {
  color: #666;
  margin-bottom: 24px;
}

.section-btn-group {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.section-btn {
  font-size: 18px;
  padding: 16px 28px;
  background: #fff;
  border: 2px solid #e0e0e0;
  border-radius: 8px;
  cursor: pointer;
  font-family: inherit;
}

.section-btn--disabled {
  background: #f0f0f0;
  border-color: #d0d0d0;
  color: #aaa;
  cursor: not-allowed;
  opacity: 0.6;
}

/* クイズ開始画面 */
.quiz-level-hint {
  color: #888;
  margin-bottom: 8px;
}

.quiz-h1 {
  font-size: 22px;
  margin-bottom: 24px;
}

.quiz-scope-card {
  background: #fff;
  border: 1px solid #e0e0e0;
  border-radius: 8px;
  padding: 16px 20px;
  margin-bottom: 24px;
}

.quiz-scope-title {
  font-size: 15px;
  font-weight: bold;
  margin-bottom: 12px;
  color: #333;
}

.quiz-radio-label {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
  cursor: pointer;
}

.quiz-radio-label.last { margin-bottom: 16px; }

.quiz-radio-text { font-size: 15px; }

.quiz-bookmark-label { font-size: 15px; color: #333; }
.quiz-bookmark-label.is-disabled { color: #aaa; }

.quiz-bookmark-count {
  color: #f4a100;
  font-size: 13px;
  margin-left: 6px;
}

.quiz-scope-hr {
  border: none;
  border-top: 1px solid #eee;
  margin-bottom: 14px;
}

.quiz-checkbox-label {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
}

.quiz-checkbox-text { font-size: 15px; }

.quiz-limit-card {
  background: #fff;
  border: 1px solid #e0e0e0;
  border-radius: 8px;
  padding: 14px 20px;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.quiz-limit-label {
  font-size: 15px;
  color: #333;
  flex-shrink: 0;
}

.quiz-limit-select {
  font-size: 15px;
  padding: 6px 10px;
  border-radius: 6px;
  border: 1px solid #ccc;
  color: #333;
  cursor: pointer;
}

.quiz-limit-unit {
  font-size: 15px;
  color: #555;
}

.quiz-limit-input {
  font-size: 15px;
  padding: 6px 10px;
  border-radius: 6px;
  border: 1px solid #ccc;
  color: #333;
  width: 72px;
  text-align: center;
}

.quiz-count-hint {
  color: #555;
  margin-bottom: 24px;
}

.btn-quiz-start {
  font-size: 18px;
  padding: 16px 40px;
}

/* クイズ結果画面 */
.result-centered {
  text-align: center;
  padding-top: 16px;
}

.result-h1 {
  font-size: 24px;
  margin-bottom: 8px;
}

.result-score {
  font-size: 48px;
  font-weight: 500;
  margin: 16px 0 8px;
  color: var(--text);
}

.result-accuracy {
  font-size: 18px;
  color: #555;
  margin-bottom: 32px;
}

.result-badges {
  display: flex;
  justify-content: center;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 32px;
}

.result-badge {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: bold;
}

.result-badge.is-correct  { background: #e8f5e9; border: 2px solid #2e7d32; color: #2e7d32; }
.result-badge.is-wrong    { background: #ffebee; border: 2px solid #c62828; color: #c62828; }
.result-badge.is-skipped  { background: #f5f5f5; border: 2px solid #9e9e9e; color: #757575; }

.result-register-cta {
  background: #f0f7ff;
  border: 1px solid #c2d8f0;
  border-radius: var(--radius);
  padding: 16px 20px;
  margin: 0 auto 20px;
  max-width: 480px;
  text-align: center;
}

.result-register-cta p {
  margin: 0 0 10px;
  font-size: 14px;
  color: var(--text);
}

.btn-register-cta {
  display: inline-block;
  background: var(--accent);
  color: #fff;
  text-decoration: none;
  padding: 8px 20px;
  border-radius: var(--radius);
  font-size: 14px;
  font-weight: 500;
}

.result-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  max-width: 480px;
  margin: 0 auto;
}

.btn-result {
  padding: 14px 16px;
  text-align: center;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

/* クイズ再生画面 */
.quiz-empty-box {
  text-align: center;
  padding: 48px 16px;
}

.quiz-empty-text {
  color: #888;
  margin-bottom: 24px;
}

.quiz-progress-label {
  color: #666;
  font-size: 14px;
  margin: 0 0 8px;
}

.quiz-body {
  font-size: 18px;
  line-height: 2;
  margin-bottom: 20px;
  padding: 16px 0;
  border-bottom: 1px solid #e0e0e0;
}

.quiz-instruction {
  margin: 0 0 12px;
  font-size: 15px;
  color: #555;
}

.quiz-target-word {
  margin: 0 0 20px;
  font-size: 24px;
  font-weight: bold;
  text-align: center;
  color: #333;
}

.quiz-sentence {
  margin: 0;
  font-size: 18px;
  line-height: 2;
}

.quiz-order-notice {
  margin: 0;
  font-size: 15px;
  color: #888;
}

.choice-number {
  margin-right: 8px;
  color: #888;
  font-size: 14px;
}

.btn-answer-full { margin-top: 8px; width: 100%; }

.answer-panel {
  margin-top: 16px;
  padding: 16px;
  border-radius: 8px;
  border-left: 4px solid;
}

.answer-panel.is-correct { border-color: #2e7d32; background: #e8f5e9; }
.answer-panel.is-wrong   { border-color: #c62828; background: #ffebee; }

.answer-verdict {
  font-weight: bold;
  font-size: 18px;
  margin: 0 0 8px;
}

.answer-verdict.is-correct { color: #2e7d32; }
.answer-verdict.is-wrong   { color: #c62828; }

.answer-correct-label {
  margin: 0 0 8px;
  font-size: 14px;
}

.answer-explanation-heading {
  font-weight: bold;
  font-size: 14px;
  margin: 8px 0 4px;
  color: #555;
}

.answer-explanation-body {
  margin: 0;
  font-size: 15px;
  line-height: 1.7;
}

.btn-next { margin-top: 16px; }

.mark-learned-label {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 12px;
    font-size: 14px;
    color: #555;
    cursor: pointer;
}

/* ===== Shared Page Classes ===== */

/* メインコンテンツ外枠 */
.page-main {
  max-width: 700px;
  margin: 0 auto;
  padding: 24px 16px;
}

/* ---- 認証ページ共通 ---- */

.auth-wrap {
  max-width: 400px;
  margin: 40px auto;
  padding: 0 16px;
}

.auth-heading {
  font-size: 24px;
  margin-bottom: 24px;
  color: var(--text);
}

.alert-info {
  padding: 10px 12px;
  margin-bottom: 16px;
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-muted);
  font-size: 14px;
}

.alert-error {
  padding: 10px 12px;
  margin-bottom: 16px;
  background: #fce4e4;
  border: 1px solid #f5c6c6;
  border-radius: var(--radius);
  color: #c62828;
  font-size: 14px;
}

.btn-google {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  padding: 11px 0;
  font-size: 15px;
  background: #fff;
  color: #444;
  border: 1px solid #ddd;
  border-radius: 4px;
  cursor: pointer;
  min-height: 44px;
  font-weight: 500;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  font-family: inherit;
}

.btn-google-icon {
  margin-right: 8px;
  flex-shrink: 0;
}

.btn-google-hint {
  margin: 6px 0 0;
  font-size: 0.8em;
  color: var(--text-muted);
  text-align: center;
}

.auth-divider {
  display: flex;
  align-items: center;
  margin: 20px 0;
}

.auth-divider-label {
  flex: 1;
  text-align: center;
  font-size: 13px;
  color: var(--text-subtle);
  border-top: 1px solid var(--border);
  background: var(--bg);
  padding: 0 12px;
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.form-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 14px;
  color: #555;
}

.form-input {
  padding: 10px 12px;
  font-size: 16px;
  border: 1px solid #ccc;
  border-radius: 4px;
  outline: none;
  font-family: inherit;
  width: 100%;
}

.form-input:focus {
  border-color: var(--border-strong);
}

.btn-submit {
  padding: 12px 0;
  font-size: 16px;
  background: var(--text);
  color: #fff;
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  min-height: 44px;
  width: 100%;
  font-family: inherit;
}

.btn-submit:hover:not(:disabled) {
  background: #333333;
}

.auth-footer-links {
  margin-top: 24px;
  font-size: 14px;
  color: var(--text-muted);
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}

.auth-footer-links .sep {
  color: var(--border-strong);
}

.text-success {
  color: var(--correct);
}

/* ---- ユーザーページ共通 ---- */

.page-h1 {
  font-size: 22px;
  margin-bottom: 24px;
  color: var(--text);
}

.card-section {
  background-color: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 20px 24px;
  margin-bottom: 20px;
}

.card-section-heading {
  font-size: 18px;
  margin-bottom: 16px;
  color: var(--text);
  font-weight: 500;
}

.info-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid #f5f5f5;
  flex-wrap: wrap;
}

.info-row:last-child {
  border-bottom: none;
}

.info-label {
  font-size: 13px;
  color: #777;
  width: 120px;
  flex-shrink: 0;
}

.info-value {
  font-size: 15px;
  color: var(--text);
}

.inline-edit-group {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.input-sm {
  font-size: 14px;
  padding: 5px 8px;
  border: 1px solid #bbb;
  border-radius: 4px;
  width: 200px;
  font-family: inherit;
}

.btn-sm-primary {
  font-size: 13px;
  padding: 5px 12px;
  background-color: var(--text);
  color: #fff;
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  font-family: inherit;
}

.btn-sm-ghost {
  font-size: 13px;
  padding: 5px 12px;
  background: transparent;
  color: var(--text-muted);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  cursor: pointer;
  font-family: inherit;
}

.btn-icon-edit {
  font-size: 14px;
  background: none;
  border: none;
  cursor: pointer;
  color: #888;
  padding: 2px 4px;
  font-family: inherit;
}

.msg-base {
  font-size: 13px;
  margin-top: 4px;
}

.msg-success {
  color: var(--correct);
}

.msg-error {
  color: var(--wrong);
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}

.stat-card {
  padding: 16px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.stat-label {
  font-size: 13px;
  color: #777;
}

.stat-value {
  font-size: 24px;
  font-weight: 500;
  color: var(--text);
}

.stats-table-wrap {
  margin-top: 20px;
}

.stats-table-wrap table {
  width: 100%;
  border-collapse: collapse;
  font-size: 15px;
}

.stats-table-wrap th {
  text-align: left;
  padding: 8px 12px;
  border-bottom: 2px solid var(--border);
  color: #555;
}

.stats-table-wrap td {
  padding: 8px 12px;
  border-bottom: 1px solid #f0f0f0;
  color: var(--text);
}

.pw-form-box {
  background: #f9f9f7;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 16px 20px;
  margin-top: 8px;
  margin-bottom: 4px;
}

.pw-form-desc {
  font-size: 13px;
  color: #555;
  margin-bottom: 12px;
}

.pw-form-field {
  margin-bottom: 10px;
}

.pw-form-label {
  display: block;
  font-size: 13px;
  color: #777;
  margin-bottom: 4px;
}

.pw-form-actions {
  display: flex;
  gap: 8px;
  margin-top: 12px;
}

.btn-lang {
  font-size: 13px;
  padding: 4px 14px;
  border-radius: var(--radius);
  cursor: pointer;
  border: 1px solid var(--border);
  background-color: var(--bg-card);
  color: var(--text-muted);
  font-family: inherit;
}

.btn-lang.is-active {
  background-color: var(--text);
  color: #fff;
  border-color: var(--text);
  font-weight: 500;
}

.tag-link {
  font-size: 13px;
  padding: 4px 10px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  color: var(--text);
  text-decoration: none;
}

.tag-link:hover {
  background: var(--bg-subtle);
  text-decoration: none;
}

/* ---- ホームページ専用 ---- */

.section-heading-wrap {
  margin-bottom: 28px;
}

.subsection-heading-wrap {
  margin-bottom: 12px;
}

.section-heading-bar.is-sm {
  height: 14px;
}

.section-subtitle {
  font-size: 13px;
  color: var(--text-muted);
  margin: 4px 0 0 16px;
}

.range-banner {
  border-radius: var(--radius);
  padding: 10px 14px;
  margin-bottom: 12px;
  font-size: 14px;
  color: var(--text);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
  border: 1px solid var(--border);
  background: var(--bg-subtle);
}

.range-banner.has-pending {
  background: rgba(188, 0, 45, 0.06);
  border-color: rgba(188, 0, 45, 0.30);
}

.range-banner-actions {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}

.btn-range-confirm {
  font-size: 13px;
  padding: 4px 14px;
  background: var(--accent);
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  color: #fff;
  font-weight: 600;
  font-family: inherit;
}

.btn-range-cancel {
  font-size: 13px;
  padding: 4px 12px;
  background: transparent;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  cursor: pointer;
  color: var(--text-muted);
  font-family: inherit;
}

.level-btn {
  border-radius: var(--radius-lg);
  padding: 18px 8px 14px;
  text-align: center;
  width: 100%;
  background: var(--bg-card);
  border: 1px solid var(--border);
  transition: border-color 0.15s, background 0.15s;
  cursor: pointer;
  font-family: inherit;
}

.level-btn:disabled,
.level-btn.is-disabled {
  cursor: default;
  opacity: 0.5;
}

.level-btn.is-start,
.level-btn.is-endpoint {
  background: var(--accent);
  border-color: var(--accent);
}

.level-btn.is-between {
  background: rgba(188, 0, 45, 0.10);
  border-color: rgba(188, 0, 45, 0.30);
}

.level-btn-name {
  font-size: 22px;
  font-weight: 500;
  letter-spacing: 0.02em;
  margin-bottom: 4px;
  color: var(--text);
}

.level-btn.is-start .level-btn-name,
.level-btn.is-endpoint .level-btn-name {
  color: #fff;
}

.level-btn.is-disabled .level-btn-name {
  color: var(--text-muted);
}

.level-btn-desc {
  font-size: 11px;
  color: var(--text-muted);
}

.level-btn.is-start .level-btn-desc,
.level-btn.is-endpoint .level-btn-desc {
  color: rgba(255, 255, 255, 0.8);
}

.level-btn.is-between .level-btn-desc {
  color: rgba(188, 0, 45, 0.7);
}

.study-lists-wrap {
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.study-lists-wrap table {
  width: 100%;
  border-collapse: collapse;
}

.study-lists-wrap thead {
  background: var(--bg-subtle);
}

.study-lists-wrap th {
  padding: 10px 16px;
  font-weight: 500;
  font-size: 12px;
  color: var(--text-muted);
  text-align: left;
  white-space: nowrap;
}

.study-lists-wrap td {
  padding: 12px 16px;
  font-size: 14px;
}

.study-lists-wrap tr {
  border-top: 1px solid var(--border);
}

.study-lists-wrap .col-level {
  font-weight: 500;
}

.table-content-link {
  color: var(--text);
  text-decoration: underline;
  text-decoration-color: var(--border-strong);
  text-underline-offset: 3px;
}

.table-coming-soon {
  color: var(--text-muted);
  font-size: 12px;
}

.font-medium { font-weight: 500; }
.text-muted  { color: var(--text-muted); }

.btn-group  { display: flex; gap: 4px; }
.tag-group  { display: flex; gap: 6px; flex-wrap: wrap; }

/* ===== 語彙・文法リストページ共通 ===== */

.selection-bar {
  position: sticky;
  top: 0;
  z-index: 100;
  margin-bottom: 12px;
  padding: 8px 12px;
  background: var(--text);
  color: #fff;
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.selection-bar-count { font-size: 14px; }
.selection-bar-actions { display: flex; gap: 8px; }

.btn-clear-selection {
  font-size: 12px;
  padding: 4px 10px;
  background: rgba(255, 255, 255, 0.2);
  border: none;
  border-radius: 4px;
  color: #fff;
  cursor: pointer;
  font-family: inherit;
}

.btn-sticky-quiz {
  font-size: 13px;
  font-weight: 500;
  padding: 4px 14px;
  background: #fff;
  color: var(--text);
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-family: inherit;
}

.study-breadcrumb { color: #888; margin-bottom: 4px; font-size: 13px; }
.study-h1 { font-size: 20px; margin-bottom: 16px; }

.inline-register-note {
  font-size: 13px;
  color: #666;
  background: #f8f8f6;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 8px 12px;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.inline-register-note a {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 2px;
  white-space: nowrap;
}

.search-form { display: flex; gap: 8px; margin-bottom: 12px; }

.search-input {
  flex: 1;
  padding: 8px 12px;
  font-size: 15px;
  border: 1px solid #ccc;
  border-radius: 6px;
  outline: none;
  font-family: inherit;
}

.btn-search {
  padding: 8px 16px;
  background: var(--text);
  color: #fff;
  border: none;
  border-radius: var(--radius);
  font-size: 14px;
  cursor: pointer;
  font-family: inherit;
}

.btn-search-clear {
  padding: 8px 12px;
  font-size: 14px;
  cursor: pointer;
  border: 1px solid #ccc;
  border-radius: 6px;
  font-family: inherit;
}

.kana-index { display: flex; gap: 4px; flex-wrap: wrap; margin-bottom: 12px; }

.kana-btn {
  padding: 4px 10px;
  font-size: 13px;
  border-radius: 4px;
  cursor: pointer;
  min-width: 34px;
  font-family: inherit;
  border: 1px solid var(--border);
  background: var(--bg-card);
  font-weight: 400;
}

.kana-btn.is-active {
  border: 2px solid var(--border-strong);
  background: var(--bg-subtle);
  font-weight: 500;
}

.filter-bar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 4px; }
.filter-btns { display: flex; gap: 6px; }

.filter-btn {
  padding: 4px 12px;
  border-radius: 16px;
  cursor: pointer;
  font-size: 13px;
  font-family: inherit;
  border: 1px solid var(--border);
  background: var(--bg-card);
  font-weight: 400;
}

.filter-btn.is-active {
  border: 2px solid var(--border-strong);
  background: var(--bg-subtle);
  font-weight: 500;
}

.item-count { font-size: 13px; color: #888; }

.random-row { display: flex; gap: 6px; align-items: center; margin-bottom: 8px; }
.random-row-label { font-size: 12px; color: #888; }

.random-btn {
  padding: 3px 10px;
  font-size: 12px;
  border: 1px solid #ddd;
  border-radius: 4px;
  font-family: inherit;
  background: #fff;
  color: #333;
  cursor: pointer;
}

.random-btn:disabled { color: #bbb; cursor: default; }

.study-empty { color: #888; margin-top: 24px; text-align: center; }

.list-legend { font-size: 12px; color: #555; margin-bottom: 4px; display: flex; gap: 12px; align-items: center; }
.legend-action-btn { font-size: 12px; color: #555; background: none; border: none; cursor: pointer; padding: 0; text-decoration: underline; text-underline-offset: 2px; }
.legend-action-btn:hover { color: #333; }

.item-list { border: 1px solid #e0e0e0; border-radius: 6px; overflow: hidden; }

.item-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  background: #fff;
}

.item-row.is-bordered { border-top: 1px solid #f0f0f0; }
.item-row.is-alt      { background: var(--bg); }
.item-row.is-learned  { background: #f5faf5; }

.bookmark-btn {
  font-size: 17px;
  line-height: 1;
  background: none;
  border: none;
  cursor: pointer;
  padding: 2px;
  flex-shrink: 0;
  width: 24px;
  color: var(--border-strong);
}

.bookmark-btn.is-bookmarked { color: var(--text); }

.learned-btn {
  font-size: 12px;
  font-weight: 500;
  line-height: 1;
  border: 1px solid #ccc;
  border-radius: 20px;
  cursor: pointer;
  padding: 0 10px;
  flex-shrink: 0;
  white-space: nowrap;
  background: #fff;
  color: #888;
  min-height: 44px;
  min-width: 52px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.learned-btn:hover { border-color: #999; background: #f5f5f5; }
.learned-btn:active { transform: scale(0.96); }
.learned-btn.is-learned { background: #4caf50; color: #fff; border-color: #388e3c; }

.item-content { flex: 1; min-width: 0; cursor: pointer; }
.item-header  { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }

.item-word    { font-size: 18px; font-weight: bold; color: #111; flex-shrink: 0; }
.item-pattern { font-size: 16px; font-weight: bold; color: #1a237e; flex-shrink: 0; }
.item-reading { font-size: 14px; color: #777; flex-shrink: 0; }
.item-meaning { font-size: 14px; color: #444; line-height: 1.5; }

.item-pos-tag { font-size: 11px; padding: 1px 5px; border-radius: 3px; background: #f0f0f0; color: #666; flex-shrink: 0; }

.origin-tag     { font-size: 11px; padding: 1px 5px; border-radius: 3px; flex-shrink: 0; }
.origin-kango   { background: #F5F4F0; color: #1A1A1A; }
.origin-wago    { background: #e8f5e9; color: #2e7d32; }
.origin-gairaigo { background: #fce4ec; color: #b71c1c; }
.origin-mixed   { background: #fff8e1; color: #e65100; }

.formality-tag     { font-size: 11px; padding: 1px 5px; border-radius: 3px; flex-shrink: 0; }
.formality-written { background: #F5F4F0; color: #1A1A1A; }
.formality-spoken  { background: #e8f5e9; color: #2e7d32; }

.item-expand-btn { font-size: 12px; color: var(--text-muted); background: none; border: none; cursor: pointer; padding: 2px 4px; flex-shrink: 0; }

.item-detail {
  padding: 10px 14px 12px 52px;
  background: var(--bg-subtle);
  border-top: 1px solid var(--border);
  font-size: 14px;
  line-height: 1.8;
  color: #444;
}

.item-detail-row      { margin: 0 0 4px; }
.item-detail-row.mt   { margin: 4px 0 0; }
.item-detail-row.solo { margin: 0; }
.item-detail-label    { font-size: 12px; color: #999; margin-right: 6px; }
.item-detail-code     { font-size: 13px; background: #f0f4ff; padding: 1px 4px; border-radius: 3px; }
.item-detail-empty    { margin: 0; color: #aaa; }

.pagination { display: flex; gap: 12px; margin-top: 16px; justify-content: center; align-items: center; }
.btn-page   { padding: 6px 16px; }
.page-count { font-size: 13px; color: #666; }

/* スティッキー選択バー */
.sticky-quiz-bar {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  z-index: 300;
  background: rgba(250, 250, 248, 0.82);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-top: 1px solid rgba(0,0,0,0.07);
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px max(14px, env(safe-area-inset-bottom));
}
.sqb-clear {
  font-size: 13px;
  background: none;
  box-shadow: none;
  padding: 8px 4px;
  color: var(--text-muted);
  text-decoration: underline;
  text-underline-offset: 2px;
  white-space: nowrap;
  flex-shrink: 0;
}
.sqb-start {
  margin-left: auto;
  font-size: 14px;
  padding: 10px 18px;
  border-radius: 24px;
  box-shadow: 0 2px 10px rgba(0,0,0,.18);
  white-space: nowrap;
  flex-shrink: 0;
}
.sqb-enter, .sqb-leave { transition: transform .25s ease, opacity .25s ease; }
.sqb-enter-from, .sqb-leave-to { transform: translateY(100%); opacity: 0; }
.sqb-enter-to, .sqb-leave-from { transform: translateY(0); opacity: 1; }
.pb-sticky { padding-bottom: 80px; }

/* プライバシーポリシーページ */
.policy-h1 {
  font-size: 22px;
  margin-bottom: 4px;
}

.policy-meta {
  color: #888;
  font-size: 13px;
  margin-bottom: 4px;
}

.policy-meta-last {
  color: #888;
  font-size: 13px;
  margin-bottom: 24px;
}

.policy-section {
  margin-bottom: 24px;
}

.policy-section-heading {
  font-size: 16px;
  font-weight: bold;
  margin-bottom: 8px;
}

.policy-line {
  font-size: 15px;
  line-height: 1.8;
  margin: 4px 0;
}

.policy-footer {
  margin-top: 32px;
  padding-top: 16px;
  border-top: 1px solid #e0e0e0;
}

.policy-back-link {
  color: var(--text);
  font-size: 14px;
}


/* ホームページ 登録CTA */
.home-register-note {
  text-align: center;
  margin: 8px 0 16px;
  font-size: 14px;
}

.home-register-note a {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 2px;
}

/* JMdict/EDICT クレジット */
.jmdict-notice {
  font-size: 11px;
  color: var(--text-muted);
  line-height: 1.6;
  text-align: left;
  padding: 6px 0;
}

.jmdict-notice--box {
  font-size: 12px;
  color: #555;
  background: #fdf5f5;
  border: 1px solid var(--accent);
  border-left: 4px solid var(--accent);
  border-radius: 6px;
  padding: 12px 16px;
  margin: 20px 0 8px;
  text-align: left;
  line-height: 1.7;
}

.jmdict-notice--subtle {
  font-size: 11px;
  color: var(--text-muted);
  background: #f5f5f3;
  border: 1px solid #ddd;
  border-radius: 4px;
  padding: 10px 14px;
  margin: 24px 0 8px;
  text-align: left;
  line-height: 1.6;
}

/* ---- 結果ページ: 問題別振り返り ---- */
.result-review {
  text-align: left;
  border-top: 1px solid var(--border);
  padding-top: 24px;
  margin-top: 8px;
}

.result-review-title {
  font-size: 17px;
  font-weight: 600;
  margin: 0 0 16px;
  color: var(--text-muted);
}

.result-review-item {
  border: 1px solid var(--border);
  border-radius: 8px;
  margin-bottom: 12px;
  overflow: hidden;
}

.result-review-item.is-correct  { border-color: #a5d6a7; }
.result-review-item.is-wrong    { border-color: #ef9a9a; }
.result-review-item.is-skipped  { border-color: #bdbdbd; }

.result-review-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
}

.result-review-header.is-correct  { background: #e8f5e9; }
.result-review-header.is-wrong    { background: #ffebee; }
.result-review-header.is-skipped  { background: #f5f5f5; }

.result-review-verdict {
  font-size: 18px;
  font-weight: bold;
  line-height: 1;
}

.result-review-header.is-correct  .result-review-verdict { color: #2e7d32; }
.result-review-header.is-wrong    .result-review-verdict { color: #c62828; }
.result-review-header.is-skipped  .result-review-verdict { color: #757575; }

.result-review-num {
  font-size: 14px;
  font-weight: 600;
  color: #555;
}

.result-review-body {
  padding: 12px 14px;
}

.result-review-sentence {
  margin: 0 0 10px;
  font-size: 16px;
  line-height: 1.8;
  color: var(--text);
}

.result-review-answer,
.result-review-correct {
  margin: 0 0 4px;
  font-size: 14px;
}

.result-review-label { color: #555; }

.result-review-answer .is-correct,
.result-review-correct .is-correct { font-weight: 500; color: #2e7d32; }

.result-review-answer .is-wrong { font-weight: 500; color: #c62828; }

/* 一括操作ボタン */
.result-learned-bulk {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 16px;
}

.btn-learned-bulk {
  font-size: 12px;
  padding: 5px 12px;
  border: 1px solid #bbb;
  border-radius: 4px;
  background: #fff;
  color: #555;
  cursor: pointer;
  line-height: 1.4;
}

.btn-learned-bulk:hover { background: #f0f0ee; }

.btn-learned-bulk--clear { color: #888; border-color: #ccc; }

/* 各アイテムの学習済みチェック */
.result-learned-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.result-learned-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 8px;
  font-size: 13px;
  color: #555;
  cursor: pointer;
}

.result-learned-msg {
  margin-top: 8px;
  font-size: 12px;
  color: #4a7c59;
}

/* ================================================================
   利用規約同意モーダル
   ================================================================ */
.terms-modal-overlay {
  z-index: 1000;
}
.modal-box--terms {
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  width: min(640px, 94vw);
}
.terms-modal-lead {
  font-size: 0.95rem;
  color: #555;
  margin-bottom: 0.75rem;
}
.terms-scroll-area {
  flex: 1;
  overflow-y: auto;
  max-height: 45vh;
  border: 1px solid #e0e0e0;
  border-radius: 6px;
  padding: 1rem 1.2rem;
  margin-bottom: 0.75rem;
  background: #fafafa;
}
.terms-section-heading {
  font-size: 0.95rem;
  font-weight: 700;
  margin: 1rem 0 0.3rem;
  color: #333;
}
.terms-section-heading:first-child {
  margin-top: 0;
}
.terms-line {
  font-size: 0.875rem;
  line-height: 1.75;
  margin: 0.2rem 0;
  color: #444;
}
.terms-scroll-hint {
  font-size: 0.8rem;
  color: #888;
  margin-bottom: 0.5rem;
  text-align: center;
}
.terms-checkbox-label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 1rem;
  font-size: 0.95rem;
  cursor: pointer;
}
.terms-checkbox-label input[type="checkbox"] {
  width: 18px;
  height: 18px;
  cursor: pointer;
}
.terms-checkbox-disabled {
  opacity: 0.4;
  cursor: not-allowed;
}
.terms-checkbox-disabled input[type="checkbox"] {
  cursor: not-allowed;
}
.terms-agree-btn {
  width: 100%;
}
.terms-agree-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
