/* ==========================================================================
   中国語単語暗記アプリ スタイルシート
   ========================================================================== */

:root {
  --primary: #4f46e5;
  --primary-hover: #4338ca;
  --primary-light: #eef2ff;
  --success: #10b981;
  --success-light: #ecfdf5;
  --warning: #f59e0b;
  --warning-light: #fffbeb;
  --danger: #ef4444;
  --danger-light: #fef2f2;
  --info: #06b6d4;
  --info-light: #ecfeff;
  
  --bg-main: #f8fafc;
  --bg-card: #ffffff;
  --text-main: #1e293b;
  --text-muted: #64748b;
  --border: #e2e8f0;
  
  --status-unlearned: #94a3b8;
  --status-learning: #f59e0b;
  --status-tentative: #3b82f6;
  --status-mastered: #10b981;

  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
  --radius: 12px;
}

/* ダークモード */
[data-theme="dark"] {
  --primary: #6366f1;
  --primary-hover: #4f46e5;
  --primary-light: #1e1b4b;
  --bg-main: #0f172a;
  --bg-card: #1e293b;
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --border: #334155;

  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.3);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.4), 0 2px 4px -2px rgb(0 0 0 / 0.4);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.5), 0 4px 6px -4px rgb(0 0 0 / 0.5);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  background-color: var(--bg-main);
  color: var(--text-main);
  line-height: 1.6;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  padding-bottom: calc(64px + env(safe-area-inset-bottom, 0px));
  -webkit-font-smoothing: antialiased;
}

body.quiz-immersive-mode {
  padding-bottom: env(safe-area-inset-bottom, 0px);
}

/* ヘッダー（スマホ最適化） */
.app-header {
  background-color: var(--bg-card);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 50;
  box-shadow: var(--shadow-sm);
  padding-top: env(safe-area-inset-top, 0px);
}

.header-inner {
  max-width: 900px;
  margin: 0 auto;
  padding: 0.65rem 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.logo-area {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.logo-icon {
  font-size: 1.75rem;
}

.logo-area h1 {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--primary);
}

.version-tag {
  font-size: 0.75rem;
  background-color: var(--primary-light);
  color: var(--primary);
  padding: 0.2rem 0.5rem;
  border-radius: 9999px;
  font-weight: 600;
}

.header-right-area {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.theme-toggle-btn {
  background: none;
  border: 1px solid var(--border);
  padding: 0.4rem 0.65rem;
  border-radius: 8px;
  font-size: 1.1rem;
  cursor: pointer;
  transition: all 0.2s;
  color: var(--text-main);
}

.theme-toggle-btn:hover {
  background-color: var(--primary-light);
  border-color: var(--primary);
}

.nav-tabs {
  display: flex;
  gap: 0.5rem;
}

.nav-item {
  background: none;
  border: none;
  padding: 0.6rem 1.2rem;
  border-radius: 8px;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.nav-item:hover {
  background-color: var(--primary-light);
  color: var(--primary);
}

.nav-item.active {
  background-color: var(--primary);
  color: #ffffff;
}

/* 汎用非表示クラス */
.hidden {
  display: none !important;
}

/* メインコンテンツエリア */
.app-main {
  flex: 1;
  max-width: 900px;
  width: 100%;
  margin: 0 auto;
  padding: 1rem;
}

.view-section {
  display: block;
  animation: fadeInView 0.2s ease-out;
}

@keyframes fadeInView {
  from {
    opacity: 0;
    transform: translateY(4px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.view-section.hidden {
  display: none !important;
}

/* ホーム画面 */
.home-container {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.hero-card {
  background: linear-gradient(135deg, #4f46e5 0%, #3730a3 100%);
  color: #ffffff;
  padding: 2rem;
  border-radius: var(--radius);
  display: flex;
  justify-content: space-between;
  align-items: center;
  box-shadow: var(--shadow-md);
}

.hero-content h2 {
  font-size: 1.8rem;
  margin-bottom: 0.5rem;
}

.hero-sub {
  font-size: 0.95rem;
  opacity: 0.9;
}

.hero-total-badge {
  background: rgba(255, 255, 255, 0.15);
  backdrop-filter: blur(8px);
  padding: 1rem 1.5rem;
  border-radius: 12px;
  text-align: center;
  min-width: 140px;
}

.total-number {
  display: block;
  font-size: 2.2rem;
  font-weight: 800;
  line-height: 1.1;
}

.total-label {
  font-size: 0.85rem;
  opacity: 0.85;
}

/* 4ステータスグリッド */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1rem;
}

.stat-card {
  background-color: var(--bg-card);
  padding: 1.25rem;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  display: flex;
  align-items: center;
  gap: 1rem;
  transition: transform 0.2s;
}

.stat-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.stat-icon {
  font-size: 1.75rem;
}

.stat-label {
  font-size: 0.85rem;
  color: var(--text-muted);
  font-weight: 600;
}

.stat-value {
  font-size: 1.75rem;
  font-weight: 700;
  line-height: 1.2;
}

.stat-unlearned .stat-value { color: var(--status-unlearned); }
.stat-learning .stat-value { color: var(--status-learning); }
.stat-tentative .stat-value { color: var(--status-tentative); }
.stat-mastered .stat-value { color: var(--status-mastered); }

/* アクションボタンセクション */
.action-buttons-section {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 1.25rem;
}

.action-card {
  background-color: var(--bg-card);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  padding: 1.5rem;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.action-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.action-card h3 {
  font-size: 1.15rem;
}

.recommend-badge {
  background-color: var(--primary-light);
  color: var(--primary);
  font-size: 0.75rem;
  font-weight: 700;
  padding: 0.25rem 0.6rem;
  border-radius: 9999px;
}

.review-badge {
  background-color: var(--bg-main);
  color: var(--text-muted);
  font-size: 0.8rem;
  font-weight: 600;
  padding: 0.25rem 0.6rem;
  border-radius: 9999px;
}

.review-badge.has-reviews {
  background-color: #fee2e2;
  color: #dc2626;
  font-weight: 700;
}

.btn-action-primary {
  margin-top: auto;
  background-color: var(--primary);
  color: #ffffff;
  padding: 0.85rem 1.25rem;
  font-size: 1rem;
  border-radius: 8px;
  border: none;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 0.2s;
}

.btn-action-primary:hover:not(:disabled) {
  background-color: var(--primary-hover);
}

.btn-action-review {
  margin-top: auto;
  background-color: #0d9488;
  color: #ffffff;
  padding: 0.85rem 1.25rem;
  font-size: 1rem;
  border-radius: 8px;
  border: none;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 0.2s;
}

.btn-action-review:hover:not(:disabled) {
  background-color: #0f766e;
}

.home-bottom-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.25rem;
}

.info-box {
  background-color: var(--bg-card);
  padding: 1.25rem;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

/* 単語管理ビュー */
.word-list-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1rem;
  flex-wrap: wrap;
}

.search-and-filter {
  display: flex;
  gap: 1rem;
  flex: 1;
  flex-wrap: wrap;
}

.search-box {
  position: relative;
  flex: 1;
  min-width: 240px;
}

.search-box .icon {
  position: absolute;
  left: 0.75rem;
  top: 50%;
  transform: translateY(-50%);
  opacity: 0.5;
}

.search-box input {
  width: 100%;
  padding: 0.65rem 2rem 0.65rem 2.25rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 0.95rem;
  outline: none;
  transition: border-color 0.2s;
}

.search-box input:focus {
  border-color: var(--primary);
}

.clear-btn {
  position: absolute;
  right: 0.5rem;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  font-size: 1.2rem;
  color: var(--text-muted);
  cursor: pointer;
}

.filter-group {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.select-control {
  padding: 0.65rem 1rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background-color: var(--bg-card);
  font-size: 0.95rem;
}

.word-list-stats {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 1rem;
  font-weight: 500;
}

/* 単語カードグリッド */
.word-cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 1rem;
}

.word-card {
  background-color: var(--bg-card);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  padding: 1.25rem;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  transition: transform 0.2s, box-shadow 0.2s;
}

.word-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.word-card-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.75rem;
}

.badge {
  font-size: 0.75rem;
  font-weight: 700;
  padding: 0.2rem 0.6rem;
  border-radius: 9999px;
}

.badge.status-unlearned { background-color: #f1f5f9; color: var(--status-unlearned); }
.badge.status-learning { background-color: #fef3c7; color: #b45309; }
.badge.status-tentative { background-color: #dbeafe; color: #1d4ed8; }
.badge.status-mastered { background-color: #d1fae5; color: #047857; }

.hsk-badge {
  font-size: 0.75rem;
  color: var(--text-muted);
  background-color: var(--bg-main);
  padding: 0.15rem 0.45rem;
  border-radius: 4px;
}

.word-card-main {
  text-align: center;
  margin: 0.5rem 0 1rem 0;
}

.chinese-text {
  font-size: 2rem;
  font-weight: 700;
  color: var(--text-main);
  letter-spacing: 0.05em;
  font-family: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
}

.pinyin-text {
  font-size: 1rem;
  color: var(--primary);
  font-weight: 500;
  margin-top: 0.25rem;
}

.meaning-text {
  font-size: 0.95rem;
  color: var(--text-muted);
  margin-top: 0.4rem;
}

.word-card-meta {
  font-size: 0.75rem;
  color: var(--text-muted);
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-top: 1px solid var(--border);
  padding-top: 0.6rem;
  margin-top: auto;
}

.word-card-actions {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.75rem;
}

.card-action-btn {
  flex: 1;
  background: none;
  border: 1px solid var(--border);
  padding: 0.35rem 0.5rem;
  border-radius: 6px;
  font-size: 0.8rem;
  cursor: pointer;
  transition: all 0.2s;
  color: var(--text-muted);
}

.card-action-btn:hover {
  background-color: var(--bg-main);
  color: var(--text-main);
}

.card-action-btn.delete-btn:hover {
  border-color: var(--danger);
  color: var(--danger);
  background-color: var(--danger-light);
}

/* ボタン汎用 */
.btn {
  padding: 0.6rem 1.2rem;
  border-radius: 8px;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  border: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
}

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

.btn-primary {
  background-color: var(--primary);
  color: #ffffff;
}

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

.btn-secondary {
  background-color: #e2e8f0;
  color: var(--text-main);
}

.btn-secondary:hover:not(:disabled) {
  background-color: #cbd5e1;
}

.btn-outline {
  background-color: transparent;
  border: 1px solid var(--border);
  color: var(--text-main);
}

.btn-outline:hover:not(:disabled) {
  background-color: var(--bg-main);
}

/* モーダル */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 1rem;
}

.modal-overlay.hidden {
  display: none !important;
}

.modal-content {
  background-color: var(--bg-card);
  border-radius: var(--radius);
  max-width: 500px;
  width: 100%;
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  animation: modalIn 0.2s ease-out;
}

@keyframes modalIn {
  from { opacity: 0; transform: scale(0.95); }
  to { opacity: 1; transform: scale(1); }
}

.modal-header {
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.close-modal-btn {
  background: none;
  border: none;
  font-size: 1.5rem;
  color: var(--text-muted);
  cursor: pointer;
}

.app-form {
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.form-row {
  display: flex;
  gap: 1rem;
}

.flex-1 { flex: 1; }

.form-group label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-main);
}

.required {
  color: var(--danger);
}

.form-input {
  padding: 0.65rem 0.85rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 0.95rem;
  outline: none;
  transition: border-color 0.2s;
}

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

.chinese-input {
  font-size: 1.15rem;
  font-weight: 600;
}

.form-hint {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
  margin-top: 0.5rem;
}

.empty-state {
  grid-column: 1 / -1;
  padding: 3rem 1rem;
  text-align: center;
  color: var(--text-muted);
}

.empty-icon {
  font-size: 3rem;
  margin-bottom: 0.5rem;
}

/* ==========================================================================
   段階2: テスト機能用スタイル
   ========================================================================== */

.test-container {
  max-width: 680px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.test-header-card {
  text-align: center;
  padding: 1.5rem 1rem;
}

.test-header-card h2 {
  font-size: 1.75rem;
  color: var(--text-main);
  margin-bottom: 0.25rem;
}

.test-sub {
  color: var(--text-muted);
  font-size: 0.95rem;
}

/* 中断テスト再開アラート */
.resume-alert {
  background-color: #eff6ff;
  border: 1px solid #bfdbfe;
  border-radius: var(--radius);
  padding: 1.25rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
}

.resume-icon {
  font-size: 2rem;
}

.resume-content {
  flex: 1;
  min-width: 200px;
}

.resume-content strong {
  color: #1e40af;
  font-size: 1rem;
  display: block;
}

.resume-content p {
  color: #3b82f6;
  font-size: 0.85rem;
  margin-top: 0.2rem;
}

.resume-actions {
  display: flex;
  gap: 0.5rem;
}

/* テスト設定カード */
.setup-card {
  background-color: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.75rem;
  box-shadow: var(--shadow-sm);
}

.setup-card h3 {
  font-size: 1.1rem;
  margin-bottom: 1rem;
  color: var(--text-main);
}

.order-mode-options {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.mode-option {
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  padding: 1rem;
  border: 1.5px solid var(--border);
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.2s;
}

.mode-option:hover {
  background-color: var(--bg-main);
}

.mode-option.selected {
  border-color: var(--primary);
  background-color: var(--primary-light);
}

.mode-option input[type="radio"] {
  margin-top: 0.25rem;
  accent-color: var(--primary);
  cursor: pointer;
}

.mode-info {
  flex: 1;
}

.mode-title {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.recommend-pill {
  background-color: var(--primary);
  color: #ffffff;
  font-size: 0.7rem;
  font-weight: 700;
  padding: 0.15rem 0.5rem;
  border-radius: 9999px;
}

.mode-desc {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-top: 0.35rem;
  line-height: 1.4;
}

.count-options {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.count-btn {
  flex: 1;
  min-width: 70px;
  padding: 0.65rem 1rem;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  background-color: var(--bg-card);
  font-weight: 600;
  font-size: 0.95rem;
  cursor: pointer;
  transition: all 0.2s;
}

.count-btn:hover {
  background-color: var(--bg-main);
}

.count-btn.active {
  border-color: var(--primary);
  background-color: var(--primary);
  color: #ffffff;
}

.setup-start-footer {
  margin-top: 2rem;
  text-align: center;
}

.btn-large {
  width: 100%;
  padding: 0.9rem 1.5rem;
  font-size: 1.1rem;
  font-weight: 700;
  border-radius: 10px;
}

/* クイズ実施画面 */
.quiz-top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.btn-sm {
  padding: 0.4rem 0.8rem;
  font-size: 0.85rem;
}

.quiz-progress-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.35rem;
}

.quiz-counter {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--text-muted);
}

.progress-bar-bg {
  width: 100%;
  height: 8px;
  background-color: var(--border);
  border-radius: 9999px;
  overflow: hidden;
}

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

.mode-badge-sm {
  font-size: 0.75rem;
  color: var(--text-muted);
  background-color: var(--border);
  padding: 0.2rem 0.6rem;
  border-radius: 9999px;
  white-space: nowrap;
}

.mode-badge-sm.badge-review-mode {
  background-color: #ccfbf1;
  color: #0f766e;
  font-weight: 700;
  border: 1px solid #5eead4;
}

/* クイズカード */
.quiz-card-container {
  perspective: 1000px;
}

.quiz-flashcard {
  background-color: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 2rem 1.5rem;
  box-shadow: var(--shadow-md);
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  min-height: 280px;
  position: relative;
  transition: border-color 0.2s;
}

.card-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.toggle-pinyin-btn {
  background: none;
  border: 1px solid var(--border);
  padding: 0.3rem 0.6rem;
  border-radius: 6px;
  font-size: 0.75rem;
  cursor: pointer;
  color: var(--text-muted);
  transition: all 0.2s;
}

.toggle-pinyin-btn:hover {
  background-color: var(--bg-main);
  color: var(--text-main);
}

.card-question-body {
  text-align: center;
  margin: 1rem 0;
}

.quiz-chinese {
  font-size: 3.5rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  font-family: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  color: var(--text-main);
  line-height: 1.2;
}

.quiz-pinyin {
  font-size: 1.4rem;
  font-weight: 600;
  color: var(--primary);
  margin-top: 0.75rem;
  min-height: 2rem;
  transition: filter 0.2s;
}

.quiz-pinyin.blur-pinyin {
  filter: blur(8px);
  user-select: none;
}

.card-answer-section {
  margin-top: auto;
  min-height: 80px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.reveal-btn {
  width: 100%;
}

.answer-box {
  background-color: var(--bg-main);
  border: 1px dashed var(--border);
  border-radius: 10px;
  padding: 1rem 1.5rem;
  width: 100%;
  text-align: center;
  animation: answerFadeIn 0.25s ease-out;
}

@keyframes answerFadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

.answer-meaning-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-weight: 600;
  text-transform: uppercase;
}

.answer-meaning {
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--text-main);
  margin-top: 0.25rem;
}

/* 自己評価ボタンバー */
.quiz-actions-bar {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.eval-buttons {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.75rem;
}

.eval-buttons.disabled {
  opacity: 0.4;
  pointer-events: none;
}

.eval-btn {
  padding: 1rem 0.5rem;
  border-radius: 10px;
  border: 2px solid transparent;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.35rem;
  font-weight: 700;
  transition: all 0.15s ease;
}

.eval-btn:active {
  transform: scale(0.97);
}

.eval-emoji {
  font-size: 1.5rem;
}

.eval-text {
  font-size: 0.95rem;
}

.eval-forgotten {
  background-color: #fee2e2;
  color: #b91c1c;
  border-color: #fca5a5;
}
.eval-forgotten:hover {
  background-color: #fecaca;
  border-color: #ef4444;
}

.eval-vague {
  background-color: #fef3c7;
  color: #b45309;
  border-color: #fcd34d;
}
.eval-vague:hover {
  background-color: #fde68a;
  border-color: #f59e0b;
}

.eval-memorized {
  background-color: #d1fae5;
  color: #047857;
  border-color: #6ee7b7;
}
.eval-memorized:hover {
  background-color: #a7f3d0;
  border-color: #10b981;
}

/* 直前の回答修正 */
.correction-area {
  text-align: center;
}

.btn-text {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  text-decoration: underline;
  padding: 0.4rem;
}

.btn-text:hover {
  color: var(--primary);
}

/* リザルト画面 */
.result-view {
  text-align: center;
}

.result-header-card {
  background: linear-gradient(135deg, #4f46e5 0%, #3730a3 100%);
  color: #ffffff;
  padding: 2rem 1.5rem;
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
}

.result-trophy {
  font-size: 3rem;
}

.result-header-card h2 {
  font-size: 1.5rem;
}

.result-score-circle {
  background: rgba(255, 255, 255, 0.15);
  backdrop-filter: blur(8px);
  padding: 1rem 2rem;
  border-radius: 9999px;
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
}

.rate-num {
  font-size: 2.2rem;
  font-weight: 800;
}

.rate-label {
  font-size: 0.9rem;
  opacity: 0.9;
}

.result-breakdown-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
}

.result-stat-box {
  background-color: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem 0.5rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.35rem;
  box-shadow: var(--shadow-sm);
}

.result-stat-emoji {
  font-size: 1.5rem;
}

.result-stat-val {
  font-size: 1.8rem;
  font-weight: 800;
}

.result-stat-name {
  font-size: 0.85rem;
  color: var(--text-muted);
  font-weight: 600;
}

.stat-box-memorized .result-stat-val { color: #10b981; }
.stat-box-vague .result-stat-val { color: #f59e0b; }
.stat-box-forgotten .result-stat-val { color: #ef4444; }

.result-list-card {
  background-color: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  text-align: left;
  box-shadow: var(--shadow-sm);
}

.result-list-card h3 {
  font-size: 1.1rem;
  margin-bottom: 1rem;
}

.result-items-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  max-height: 320px;
  overflow-y: auto;
}

.result-item-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.6rem 0.75rem;
  border-radius: 8px;
  background-color: var(--bg-main);
}

.row-num {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text-muted);
  width: 24px;
}

.row-words {
  flex: 1;
  display: flex;
  align-items: baseline;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.row-chinese {
  font-size: 1.2rem;
  font-weight: 700;
}

.row-pinyin {
  font-size: 0.85rem;
  color: var(--primary);
}

.row-meaning {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.badge-eval-memorized {
  background-color: #d1fae5;
  color: #047857;
}

.badge-eval-vague {
  background-color: #fef3c7;
  color: #b45309;
}

.badge-eval-forgotten {
  background-color: #fee2e2;
  color: #b91c1c;
}

.result-footer-actions {
  display: flex;
  gap: 1rem;
  justify-content: center;
}

/* ==========================================================================
   段階4: HSK単語リスト・一括インポート・音声機能用スタイル
   ========================================================================== */

.modal-large {
  max-width: 680px;
}

.import-tabs {
  display: flex;
  border-bottom: 1px solid var(--border);
  background-color: var(--bg-main);
}

.import-tab-btn {
  flex: 1;
  padding: 0.85rem 1rem;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  transition: all 0.2s;
}

.import-tab-btn:hover {
  color: var(--primary);
}

.import-tab-btn.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
  background-color: var(--bg-card);
}

.import-body {
  padding: 1.5rem;
  max-height: 70vh;
  overflow-y: auto;
}

.tab-lead {
  font-size: 0.9rem;
  color: var(--text-muted);
  margin-bottom: 1.25rem;
}

.hsk-presets-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1rem;
}

.hsk-card {
  background-color: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  box-shadow: var(--shadow-sm);
  transition: transform 0.2s;
}

.hsk-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.hsk-card-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.hsk-card-top h4 {
  font-size: 1.1rem;
  color: var(--primary);
}

.count-tag {
  background-color: var(--primary-light);
  color: var(--primary);
  font-size: 0.75rem;
  font-weight: 700;
  padding: 0.2rem 0.5rem;
  border-radius: 9999px;
}

.hsk-card p {
  font-size: 0.85rem;
  color: var(--text-muted);
  line-height: 1.4;
  margin-bottom: auto;
}

.file-drop-area {
  border: 2px dashed var(--border);
  border-radius: 10px;
  padding: 2rem 1.5rem;
  text-align: center;
  background-color: var(--bg-main);
  transition: all 0.2s;
}

.file-drop-area.dragover {
  border-color: var(--primary);
  background-color: var(--primary-light);
}

.drop-icon {
  font-size: 2.5rem;
  display: block;
  margin-bottom: 0.5rem;
}

.file-select-label {
  display: inline-block;
  margin-top: 0.75rem;
  cursor: pointer;
}

.checkbox-label {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.85rem;
  color: var(--text-muted);
  cursor: pointer;
}

.preview-box {
  margin-top: 1.25rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background-color: var(--bg-card);
  overflow: hidden;
}

.preview-header {
  padding: 0.65rem 1rem;
  background-color: var(--bg-main);
  border-bottom: 1px solid var(--border);
  font-size: 0.85rem;
}

.preview-list {
  max-height: 160px;
  overflow-y: auto;
  padding: 0.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.preview-item {
  display: flex;
  gap: 0.75rem;
  font-size: 0.85rem;
  padding: 0.35rem 0.5rem;
  border-bottom: 1px dashed var(--border);
}

.preview-footer {
  padding: 0.75rem 1rem;
  text-align: right;
  border-top: 1px solid var(--border);
}

.card-action-btn.audio-btn {
  color: #0284c7;
  border-color: #bae6fd;
}

.card-action-btn.audio-btn:hover {
  background-color: #e0f2fe;
}

/* ==========================================================================
   段階5: 学習統計・バックアップ・自動テスト・PWA用スタイル
   ========================================================================== */

.stats-view-container {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.stats-header {
  text-align: center;
  padding: 1rem 0;
}

.stats-header h2 {
  font-size: 1.75rem;
  color: var(--text-main);
  margin-bottom: 0.25rem;
}

.stats-sub {
  color: var(--text-muted);
  font-size: 0.95rem;
}

.stats-card {
  background-color: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.stats-card-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.stats-card h3 {
  font-size: 1.15rem;
  color: var(--text-main);
}

.card-caption {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-top: -0.5rem;
}

/* 累積プログレスバー */
.stacked-progress-bar {
  height: 24px;
  background-color: var(--border);
  border-radius: 9999px;
  overflow: hidden;
  display: flex;
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.1);
}

.bar-seg {
  height: 100%;
  transition: width 0.3s ease;
}

.seg-mastered { background-color: var(--status-mastered); }
.seg-tentative { background-color: var(--status-tentative); }
.seg-learning { background-color: var(--status-learning); }
.seg-unlearned { background-color: var(--status-unlearned); }

.progress-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 1.25rem;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  display: inline-block;
}

.dot-mastered { background-color: var(--status-mastered); }
.dot-tentative { background-color: var(--status-tentative); }
.dot-learning { background-color: var(--status-learning); }
.dot-unlearned { background-color: var(--status-unlearned); }

/* サマリーカード */
.stats-summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
}

.summary-card {
  background-color: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.35rem;
  box-shadow: var(--shadow-sm);
}

.summary-emoji {
  font-size: 1.8rem;
}

.summary-val {
  font-size: 2rem;
  font-weight: 800;
  color: var(--primary);
  line-height: 1.2;
}

.summary-label {
  font-size: 0.85rem;
  color: var(--text-muted);
  font-weight: 600;
}

/* 7日間棒グラフ */
.activity-bar-chart {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 0.5rem;
  height: 160px;
  padding-top: 1rem;
  border-bottom: 2px solid var(--border);
}

.chart-col {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  height: 100%;
}

.chart-col-val {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--primary);
  min-height: 1.2rem;
}

.chart-bar-bg {
  flex: 1;
  width: 28px;
  background-color: var(--bg-main);
  border-radius: 6px 6px 0 0;
  display: flex;
  align-items: flex-end;
}

.chart-bar-fill {
  width: 100%;
  background-color: var(--primary);
  border-radius: 6px 6px 0 0;
  transition: height 0.4s ease;
}

.chart-col-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 0.5rem;
  white-space: nowrap;
}

/* バックアップグリッド */
.backup-actions-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1rem;
}

.backup-action-box {
  background-color: var(--bg-main);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.backup-action-box h4 {
  font-size: 1rem;
  color: var(--text-main);
}

.backup-action-box p {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: auto;
}

/* テスト結果表示 */
.test-result-summary {
  padding: 0.75rem 1rem;
  border-radius: 8px;
  font-size: 0.95rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.75rem;
}

.test-result-summary.all-pass {
  background-color: #d1fae5;
  color: #047857;
}

.test-result-summary.has-fail {
  background-color: #fee2e2;
  color: #b91c1c;
}

.test-cases-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.test-case-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.5rem 0.75rem;
  border-radius: 6px;
  font-size: 0.85rem;
}

.test-case-row.pass {
  background-color: var(--bg-main);
}

.test-case-row.fail {
  background-color: #fef2f2;
}

.test-status-icon {
  font-weight: 800;
  width: 16px;
}

.test-case-row.pass .test-status-icon {
  color: #10b981;
}

.test-case-row.fail .test-status-icon {
  color: #ef4444;
}

.test-case-name {
  flex: 1;
  font-weight: 600;
}

.test-case-detail {
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* ==========================================================================
   Ver 2.0 Mobile First UI スタイル群
   ========================================================================== */

/* 1. 下部固定5タブナビゲーション */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: calc(58px + env(safe-area-inset-bottom, 0px));
  padding-bottom: env(safe-area-inset-bottom, 0px);
  background-color: var(--bg-card);
  border-top: 1px solid var(--border);
  display: flex;
  align-items: stretch;
  justify-content: space-around;
  z-index: 100;
  box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.05);
  transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.2s ease;
}

.bottom-nav.nav-hidden {
  transform: translateY(100%);
  opacity: 0;
  pointer-events: none;
}

.bottom-nav-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px 2px;
  min-height: 48px;
  transition: color 0.15s ease, transform 0.15s ease;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

.bottom-nav-item .nav-icon {
  font-size: 1.25rem;
  line-height: 1.2;
}

.bottom-nav-item .nav-label {
  font-size: 0.68rem;
  font-weight: 500;
  margin-top: 2px;
}

.bottom-nav-item.active {
  color: var(--primary);
  font-weight: 700;
}

.bottom-nav-item.active .nav-icon {
  transform: scale(1.12);
}

/* 2. 共通モバイルUIレイアウト */
.view-content-wrapper {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  max-width: 680px;
  margin: 0 auto;
  width: 100%;
}

.view-header-title {
  padding: 0.25rem 0.25rem 0;
}

.view-header-title h2 {
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--text-main);
  letter-spacing: -0.02em;
}

.view-header-sub {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-top: 0.2rem;
}

.mobile-card {
  background-color: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.card-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.card-title-row h3 {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-main);
}

.card-caption {
  font-size: 0.82rem;
  color: var(--text-muted);
  line-height: 1.5;
}

/* 3. ホーム画面のモバイルUI */
.home-hero-card {
  background: linear-gradient(135deg, #4f46e5 0%, #3730a3 100%);
  color: #ffffff;
  border-radius: var(--radius);
  padding: 1.35rem 1.25rem;
  box-shadow: var(--shadow-md);
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.home-hero-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.75rem;
}

.home-hero-badge {
  background-color: rgba(255, 255, 255, 0.2);
  padding: 0.2rem 0.6rem;
  border-radius: 9999px;
  font-weight: 600;
  letter-spacing: 0.03em;
}

.home-hero-total {
  opacity: 0.95;
}

.home-hero-title {
  font-size: 1.5rem;
  font-weight: 800;
  letter-spacing: -0.01em;
  margin: 0;
}

.home-hero-sub {
  font-size: 0.82rem;
  opacity: 0.9;
  line-height: 1.45;
  margin: 0;
}

.home-overall-progress {
  margin-top: 0.5rem;
  background-color: rgba(0, 0, 0, 0.15);
  border-radius: 8px;
  padding: 0.6rem 0.75rem;
}

.home-progress-label {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.78rem;
  margin-bottom: 0.35rem;
}

.home-progress-track {
  width: 100%;
  height: 7px;
  background-color: rgba(255, 255, 255, 0.25);
  border-radius: 9999px;
  overflow: hidden;
}

.home-progress-fill {
  height: 100%;
  background-color: #10b981;
  border-radius: 9999px;
  transition: width 0.4s ease;
}

.home-actions-group {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.mobile-action-card {
  background-color: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.15rem;
  box-shadow: var(--shadow-sm);
  display: flex;
  gap: 1rem;
  align-items: flex-start;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.mobile-action-card.has-review-items {
  border-color: #f59e0b;
  background-color: var(--warning-light);
}

[data-theme="dark"] .mobile-action-card.has-review-items {
  background-color: #292113;
  border-color: #78350f;
}

.card-icon-col {
  flex-shrink: 0;
}

.action-card-emoji {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background-color: var(--primary-light);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
}

.mobile-action-card.has-review-items .action-card-emoji {
  background-color: #fef3c7;
}

[data-theme="dark"] .mobile-action-card.has-review-items .action-card-emoji {
  background-color: #451a03;
}

.card-content-col {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.card-title-line {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.card-title-line h3 {
  font-size: 1.1rem;
  font-weight: 700;
}

.action-card-desc {
  font-size: 0.82rem;
  color: var(--text-muted);
  line-height: 1.45;
  margin-bottom: 0.4rem;
}

.btn-action-large {
  width: 100%;
  min-height: 48px;
  font-size: 0.95rem;
  font-weight: 700;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  cursor: pointer;
  border: none;
  transition: all 0.15s ease;
  touch-action: manipulation;
}

.btn-review-start {
  background-color: #d97706;
  color: #ffffff;
}

.btn-review-start:hover:not(:disabled) {
  background-color: #b45309;
}

.btn-test-start {
  background-color: var(--primary);
  color: #ffffff;
}

.btn-test-start:hover:not(:disabled) {
  background-color: var(--primary-hover);
}

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

/* 4ステータスセルグリッド */
.status-quad-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.65rem;
}

.status-cell {
  background-color: var(--bg-main);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.65rem 0.85rem;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.status-cell .cell-head {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.status-cell .cell-title {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-weight: 600;
}

.status-cell .cell-val {
  font-size: 1.35rem;
  font-weight: 800;
  color: var(--text-main);
  line-height: 1.2;
}

.status-cell.unlearned .cell-val { color: var(--status-unlearned); }
.status-cell.learning .cell-val { color: var(--status-learning); }
.status-cell.tentative .cell-val { color: var(--status-tentative); }
.status-cell.mastered .cell-val { color: var(--status-mastered); }

.quick-link-tile {
  background-color: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.15rem;
  display: flex;
  align-items: center;
  gap: 0.85rem;
  width: 100%;
  cursor: pointer;
  text-align: left;
  box-shadow: var(--shadow-sm);
  transition: all 0.15s ease;
}

.quick-link-tile:hover {
  background-color: var(--primary-light);
  border-color: var(--primary);
}

.tile-icon {
  font-size: 1.5rem;
}

.tile-text {
  flex: 1;
  display: flex;
  flex-direction: column;
}

.tile-text strong {
  font-size: 0.95rem;
  color: var(--text-main);
}

.tile-text span {
  font-size: 0.78rem;
  color: var(--text-muted);
}

.tile-arrow {
  font-size: 1.1rem;
  color: var(--text-muted);
}

/* 4. 学習記録画面のスタイル */
.format-filter-tabs {
  display: flex;
  gap: 0.4rem;
  overflow-x: auto;
  padding: 0.2rem 0;
  -webkit-overflow-scrolling: touch;
}

.format-tab-pill {
  flex-shrink: 0;
  background-color: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text-muted);
  padding: 0.45rem 0.85rem;
  border-radius: 9999px;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  transition: all 0.15s ease;
}

.format-tab-pill.active {
  background-color: var(--primary);
  color: #ffffff;
  border-color: var(--primary);
}

.badge-mini {
  font-size: 0.65rem;
  background-color: rgba(0, 0, 0, 0.08);
  padding: 0.1rem 0.35rem;
  border-radius: 4px;
}

.stacked-progress-bar {
  display: flex;
  height: 14px;
  border-radius: 9999px;
  overflow: hidden;
  background-color: var(--border);
  margin: 0.5rem 0;
}

.bar-seg {
  height: 100%;
  transition: width 0.3s ease;
}

.seg-mastered { background-color: var(--status-mastered); }
.seg-tentative { background-color: var(--status-tentative); }
.seg-learning { background-color: var(--status-learning); }
.seg-unlearned { background-color: var(--status-unlearned); }

.progress-legend-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.45rem;
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 0.25rem;
}

.legend-cell {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  display: inline-block;
}

.dot-mastered { background-color: var(--status-mastered); }
.dot-tentative { background-color: var(--status-tentative); }
.dot-learning { background-color: var(--status-learning); }
.dot-unlearned { background-color: var(--status-unlearned); }

.summary-metric-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.65rem;
}

.metric-card {
  background-color: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.85rem 0.5rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 0.2rem;
  box-shadow: var(--shadow-sm);
}

.metric-icon {
  font-size: 1.25rem;
}

.metric-value {
  font-size: 1.35rem;
  font-weight: 800;
  color: var(--primary);
  line-height: 1.2;
}

.metric-label {
  font-size: 0.72rem;
  color: var(--text-muted);
  font-weight: 600;
}

/* 5. 設定画面のスタイル */
.setting-item-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.setting-item-info {
  display: flex;
  flex-direction: column;
}

.setting-item-info strong {
  font-size: 0.95rem;
  color: var(--text-main);
}

.setting-item-info span {
  font-size: 0.78rem;
  color: var(--text-muted);
}

.backup-actions-stack {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  margin-top: 0.5rem;
}

.file-select-label {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  cursor: pointer;
}

.app-info-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  font-size: 0.85rem;
}

.info-row {
  display: flex;
  justify-content: space-between;
  padding: 0.4rem 0;
  border-bottom: 1px dashed var(--border);
}

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

.info-label {
  color: var(--text-muted);
}

.info-val {
  font-weight: 600;
  color: var(--text-main);
}

/* 6. テスト画面の片手操作最適化 */
.quiz-top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.5rem 0;
}

.quiz-progress-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.25rem;
}

.quiz-counter {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text-muted);
}

.progress-bar-bg {
  width: 100%;
  max-width: 180px;
  height: 6px;
  background-color: var(--border);
  border-radius: 9999px;
  overflow: hidden;
}

.progress-bar-fill {
  height: 100%;
  background-color: var(--primary);
  border-radius: 9999px;
  transition: width 0.25s ease;
}

.mode-badge-sm {
  font-size: 0.72rem;
  padding: 0.2rem 0.5rem;
  border-radius: 6px;
  background-color: var(--primary-light);
  color: var(--primary);
  font-weight: 600;
  white-space: nowrap;
}

.badge-review-mode {
  background-color: #fef3c7;
  color: #b45309;
}

.quiz-flashcard {
  background-color: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem 1.25rem;
  box-shadow: var(--shadow-md);
  display: flex;
  flex-direction: column;
  min-height: 280px;
  justify-content: space-between;
  transition: border-color 0.2s ease;
}

.card-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.hsk-badge {
  font-size: 0.75rem;
  font-weight: 700;
  background-color: var(--primary-light);
  color: var(--primary);
  padding: 0.2rem 0.5rem;
  border-radius: 6px;
}

.toggle-pinyin-btn {
  background: none;
  border: 1px solid var(--border);
  padding: 0.35rem 0.65rem;
  border-radius: 6px;
  font-size: 0.8rem;
  color: var(--text-muted);
  cursor: pointer;
  touch-action: manipulation;
}

.card-question-body {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 1.5rem 0;
  text-align: center;
}

.quiz-chinese {
  font-size: 2.75rem;
  font-weight: 800;
  color: var(--text-main);
  letter-spacing: 0.05em;
  margin-bottom: 0.5rem;
  line-height: 1.2;
}

.quiz-pinyin {
  font-size: 1.2rem;
  font-weight: 600;
  color: var(--primary);
  letter-spacing: 0.02em;
  min-height: 1.8rem;
  transition: filter 0.2s ease;
}

.quiz-pinyin.blur-pinyin {
  filter: blur(8px);
  user-select: none;
}

.card-answer-section {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
}

.reveal-btn {
  width: 100%;
  min-height: 52px;
  font-size: 1.05rem;
  font-weight: 700;
  border-radius: 12px;
}

.answer-box {
  width: 100%;
  background-color: var(--bg-main);
  border: 1px dashed var(--border);
  border-radius: 10px;
  padding: 0.85rem;
  text-align: center;
}

.answer-meaning-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-weight: 600;
  margin-bottom: 0.25rem;
}

.answer-meaning {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-main);
}

.quiz-actions-bar {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  margin-top: 1rem;
}

.eval-buttons {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.65rem;
  width: 100%;
}

.eval-btn {
  min-height: 56px;
  border-radius: 12px;
  border: 2px solid transparent;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.2rem;
  font-weight: 700;
  font-size: 0.88rem;
  cursor: pointer;
  touch-action: manipulation;
  transition: all 0.15s ease;
}

.eval-btn .eval-emoji {
  font-size: 1.2rem;
}

.eval-forgotten {
  background-color: var(--danger-light);
  color: var(--danger);
  border-color: #fca5a5;
}

[data-theme="dark"] .eval-forgotten {
  background-color: #450a0a;
  border-color: #7f1d1d;
}

.eval-vague {
  background-color: var(--warning-light);
  color: #b45309;
  border-color: #fcd34d;
}

[data-theme="dark"] .eval-vague {
  background-color: #451a03;
  border-color: #78350f;
}

.eval-memorized {
  background-color: var(--success-light);
  color: #047857;
  border-color: #6ee7b7;
}

[data-theme="dark"] .eval-memorized {
  background-color: #064e3b;
  border-color: #065f46;
}

.eval-buttons.disabled .eval-btn {
  opacity: 0.35;
  cursor: not-allowed;
  pointer-events: none;
}

.correction-area {
  display: flex;
  justify-content: center;
}

.btn-text {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 0.82rem;
  cursor: pointer;
  padding: 0.4rem 0.6rem;
  border-radius: 6px;
}

.btn-text:hover {
  text-decoration: underline;
  color: var(--text-main);
}

/* 7. 単語一覧画面のモバイル最適化 */
@media (max-width: 640px) {
  .word-list-header {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
  }

  .search-and-filter {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    width: 100%;
  }

  .filter-group {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    width: 100%;
  }

  .filter-group .select-control {
    flex: 1;
    min-height: 42px;
  }

  .list-actions {
    display: grid;
    grid-template-columns: 1fr 1fr 1.2fr;
    gap: 0.4rem;
    width: 100%;
  }

  .list-actions .btn {
    padding: 0.5rem 0.25rem;
    font-size: 0.8rem;
    min-height: 44px;
    justify-content: center;
  }

  .word-cards-grid {
    grid-template-columns: 1fr;
    gap: 0.65rem;
  }
}

/* ==========================================================================
   Phase 2: 3形式出題UI・独立SRS・リスニング4択スタイル
   ========================================================================== */

.setup-error-banner {
  background-color: var(--danger-light);
  border: 1.5px solid #fca5a5;
  color: var(--danger);
  border-radius: var(--radius);
  padding: 1rem 1.15rem;
  display: flex;
  gap: 0.75rem;
  align-items: flex-start;
}

[data-theme="dark"] .setup-error-banner {
  background-color: #450a0a;
  border-color: #7f1d1d;
  color: #fca5a5;
}

.error-banner-icon {
  font-size: 1.35rem;
  line-height: 1.2;
}

.error-banner-body strong {
  display: block;
  font-size: 0.95rem;
  margin-bottom: 0.25rem;
}

.error-banner-body p {
  font-size: 0.85rem;
  line-height: 1.45;
  margin: 0;
}

.format-mode-options {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.format-option {
  display: flex;
  align-items: flex-start;
  gap: 0.85rem;
  padding: 1rem;
  border: 1.5px solid var(--border);
  border-radius: 10px;
  cursor: pointer;
  background-color: var(--bg-card);
  transition: all 0.2s ease;
  touch-action: manipulation;
}

.format-option:hover {
  border-color: var(--primary);
}

.format-option.selected {
  border-color: var(--primary);
  background-color: var(--primary-light);
}

.format-stat-pill {
  font-size: 0.72rem;
  font-weight: 700;
  padding: 0.15rem 0.5rem;
  border-radius: 9999px;
  background-color: var(--bg-main);
  color: var(--text-muted);
  border: 1px solid var(--border);
}

.due-mini-badge,
.due-pill {
  font-size: 0.7rem;
  font-weight: 700;
  padding: 0.15rem 0.45rem;
  border-radius: 9999px;
  background-color: #fef3c7;
  color: #b45309;
  border: 1px solid #fcd34d;
}

.setup-review-shortcut {
  margin-top: 1rem;
}

.quiz-skip-notice {
  background-color: var(--warning-light);
  color: #b45309;
  border: 1px solid #fcd34d;
  border-radius: 8px;
  padding: 0.55rem 0.85rem;
  font-size: 0.8rem;
  line-height: 1.4;
}

[data-theme="dark"] .quiz-skip-notice {
  background-color: #451a03;
  color: #fde68a;
  border-color: #78350f;
}

/* 形式B: 日本語 ➔ 中国語 */
.hint-tag-badge {
  font-size: 0.72rem;
  font-weight: 600;
  background-color: var(--bg-main);
  color: var(--text-muted);
  border: 1px solid var(--border);
  padding: 0.2rem 0.5rem;
  border-radius: 6px;
}

.quiz-prompt-caption {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 0.65rem;
}

.quiz-japanese-prompt {
  font-size: 1.85rem;
  font-weight: 800;
  color: var(--text-main);
  line-height: 1.35;
  padding: 0.5rem 0.25rem;
}

.answer-box-zh {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.25rem;
}

.answer-chinese-large {
  font-size: 2.35rem;
  font-weight: 800;
  color: var(--text-main);
  font-family: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  line-height: 1.2;
}

.answer-pinyin-large {
  font-size: 1.15rem;
  font-weight: 600;
  color: var(--primary);
}

/* 形式C: 音声 ➔ 日本語 (4択) */
.audio-mode-hint {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--primary);
}

.audio-question-body {
  gap: 1rem;
  padding: 1rem 0;
}

.audio-hero-play-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.3rem;
  width: 100%;
  max-width: 260px;
  min-height: 104px;
  padding: 1rem 1.25rem;
  border-radius: 16px;
  border: 2px solid var(--primary);
  background-color: var(--primary-light);
  color: var(--primary);
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  touch-action: manipulation;
  box-shadow: var(--shadow-sm);
}

.audio-hero-play-btn:active {
  transform: scale(0.97);
}

.audio-hero-icon {
  font-size: 2.1rem;
  line-height: 1;
}

.audio-hero-text {
  font-size: 1rem;
  font-weight: 800;
}

.audio-hero-sub {
  font-size: 0.72rem;
  opacity: 0.85;
}

.audio-revealed-word-box {
  width: 100%;
  background-color: var(--bg-main);
  border: 1px dashed var(--border);
  border-radius: 10px;
  padding: 0.85rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.25rem;
  animation: answerFadeIn 0.2s ease-out;
}

.objective-result-banner {
  width: 100%;
  padding: 0.4rem 0.75rem;
  border-radius: 8px;
  font-size: 0.85rem;
  font-weight: 700;
  margin-bottom: 0.25rem;
}

.objective-result-banner.obj-correct {
  background-color: #d1fae5;
  color: #047857;
}

.objective-result-banner.obj-wrong {
  background-color: #fee2e2;
  color: #b91c1c;
}

[data-theme="dark"] .objective-result-banner.obj-correct {
  background-color: #064e3b;
  color: #6ee7b7;
}

[data-theme="dark"] .objective-result-banner.obj-wrong {
  background-color: #450a0a;
  color: #fca5a5;
}

.audio-choices-grid {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  width: 100%;
}

.choice-option-btn {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  width: 100%;
  min-height: 50px;
  padding: 0.65rem 0.9rem;
  border-radius: 10px;
  border: 1.5px solid var(--border);
  background-color: var(--bg-main);
  color: var(--text-main);
  font-size: 0.95rem;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
  transition: all 0.15s ease;
  touch-action: manipulation;
}

.choice-option-btn:hover:not(:disabled) {
  border-color: var(--primary);
  background-color: var(--primary-light);
}

.choice-num {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background-color: var(--bg-card);
  border: 1px solid var(--border);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.78rem;
  font-weight: 800;
  color: var(--text-muted);
  flex-shrink: 0;
}

.choice-label {
  flex: 1;
  line-height: 1.35;
}

.choice-option-btn.choice-correct {
  border-color: #10b981;
  background-color: #d1fae5;
  color: #047857;
}

.choice-option-btn.choice-wrong {
  border-color: #ef4444;
  background-color: #fee2e2;
  color: #b91c1c;
}

.choice-option-btn.choice-dimmed {
  opacity: 0.5;
}

[data-theme="dark"] .choice-option-btn.choice-correct {
  background-color: #064e3b;
  border-color: #059669;
  color: #a7f3d0;
}

[data-theme="dark"] .choice-option-btn.choice-wrong {
  background-color: #450a0a;
  border-color: #dc2626;
  color: #fca5a5;
}

.result-format-pill {
  background-color: rgba(255, 255, 255, 0.2);
  padding: 0.25rem 0.75rem;
  border-radius: 9999px;
  font-size: 0.8rem;
  font-weight: 700;
}

.badge-choice-ok {
  background-color: #d1fae5;
  color: #047857;
}

.badge-choice-ng {
  background-color: #fee2e2;
  color: #b91c1c;
}

/* 学習記録・単語カードの3形式表示 */
.format-comparison-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.format-comp-row {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.format-comp-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.8rem;
}

.format-comp-head span {
  color: var(--text-muted);
  font-size: 0.75rem;
}

.word-card-format-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-top: 0.25rem;
}

.fmt-mini-status {
  font-size: 0.68rem;
  font-weight: 600;
  padding: 0.15rem 0.45rem;
  border-radius: 6px;
  border: 1px solid var(--border);
  background-color: var(--bg-main);
  color: var(--text-muted);
}



/* ==========================================================================
   Phase 3: 日本語からの中国語単語検索・自動登録 UI スタイル
   ========================================================================== */

.add-word-modal-content {
  max-width: 600px;
  width: 95%;
  max-height: 90vh;
  max-height: 90dvh;
  display: flex;
  flex-direction: column;
  padding: 0;
  overflow: hidden;
}

.add-word-modal-content .modal-header {
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.modal-subtitle {
  font-size: 0.76rem;
  color: var(--text-muted);
  margin-top: 0.15rem;
}

.add-word-scroll-body {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 1rem 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 1.1rem;
}

.dict-search-section {
  background-color: var(--bg-main);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 0.9rem;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.dict-search-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-main);
}

.dict-offline-badge {
  font-size: 0.7rem;
  font-weight: 700;
  padding: 0.15rem 0.45rem;
  border-radius: 9999px;
  background-color: var(--primary-light);
  color: var(--primary);
}

.dict-search-input-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.dict-search-icon {
  position: absolute;
  left: 0.75rem;
  font-size: 1rem;
  pointer-events: none;
}

.dict-search-input {
  width: 100%;
  padding-left: 2.35rem !important;
  padding-right: 2.2rem !important;
  font-size: 1rem !important;
  min-height: 46px;
  border-radius: 10px !important;
  border: 1.5px solid var(--primary) !important;
  background-color: var(--bg-card) !important;
}

.dict-search-input-wrap .clear-btn {
  position: absolute;
  right: 0.5rem;
  background: none;
  border: none;
  font-size: 1.25rem;
  color: var(--text-muted);
  cursor: pointer;
  padding: 0.25rem 0.4rem;
}

.dict-results-panel {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.dict-results-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--text-muted);
}

.dict-source-tag {
  font-size: 0.72rem;
  color: var(--primary);
}

.dict-candidate-list {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  max-height: 220px;
  overflow-y: auto;
  padding-right: 2px;
}

.dict-candidate-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.65rem;
  background-color: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.65rem 0.8rem;
  cursor: pointer;
  transition: border-color 0.15s ease, background-color 0.15s ease;
  touch-action: manipulation;
}

.dict-candidate-card:hover,
.dict-candidate-card:active {
  border-color: var(--primary);
  background-color: var(--primary-light);
}

.dict-candidate-card.is-registered {
  border-left: 4px solid #f59e0b;
}

.dict-cand-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.dict-cand-top {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.dict-cand-zh {
  font-size: 1.2rem;
  font-weight: 800;
  color: var(--text-main);
  font-family: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
}

.dict-cand-pinyin {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--primary);
}

.pos-badge {
  font-size: 0.68rem;
  font-weight: 700;
  padding: 0.12rem 0.42rem;
  border-radius: 5px;
  background-color: #e0e7ff;
  color: #3730a3;
}

[data-theme="dark"] .pos-badge {
  background-color: #312e81;
  color: #c7d2fe;
}

.hsk-mini-badge {
  font-size: 0.66rem;
  font-weight: 600;
  padding: 0.1rem 0.38rem;
  border-radius: 4px;
  background-color: var(--bg-main);
  color: var(--text-muted);
  border: 1px solid var(--border);
}

.registered-badge {
  font-size: 0.66rem;
  font-weight: 700;
  padding: 0.1rem 0.42rem;
  border-radius: 4px;
  background-color: #fef3c7;
  color: #b45309;
  border: 1px solid #fcd34d;
}

.dict-cand-meaning {
  font-size: 0.85rem;
  color: var(--text-main);
  line-height: 1.35;
}

.dict-cand-meta {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.68rem;
  color: var(--text-muted);
}

.dict-partial-warn {
  color: #d97706;
  font-weight: 700;
}

.dict-cand-actions {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  flex-shrink: 0;
}

.btn-cand-audio {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background-color: var(--bg-main);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.95rem;
}

.dict-online-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.4rem;
  padding-top: 0.25rem;
  border-top: 1px dashed var(--border);
}

.dict-online-btn {
  font-size: 0.8rem;
  padding: 0.4rem 0.75rem;
}

.dict-online-hint {
  font-size: 0.7rem;
  color: var(--text-muted);
}

.dict-online-notice {
  font-size: 0.75rem;
  background-color: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.5rem 0.65rem;
  color: var(--text-muted);
  line-height: 1.4;
}

.dict-ext-link {
  font-size: 0.75rem;
  color: var(--primary);
  text-decoration: underline;
}

.dict-empty-message {
  background-color: var(--bg-card);
  border: 1px dashed var(--border);
  border-radius: 8px;
  padding: 0.75rem;
  font-size: 0.82rem;
  color: var(--text-main);
}

.dict-empty-sub {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 0.25rem;
}

.dict-loading {
  padding: 0.75rem;
  text-align: center;
  font-size: 0.82rem;
  color: var(--primary);
}

.form-section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-main);
  padding-bottom: 0.35rem;
  border-bottom: 1px solid var(--border);
}

.btn-text-mini {
  background: none;
  border: none;
  color: var(--primary);
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
}

.selected-candidate-banner {
  background-color: #d1fae5;
  color: #065f46;
  border: 1px solid #6ee7b7;
  border-radius: 8px;
  padding: 0.5rem 0.75rem;
  font-size: 0.8rem;
  line-height: 1.4;
}

[data-theme="dark"] .selected-candidate-banner {
  background-color: #064e3b;
  color: #a7f3d0;
  border-color: #059669;
}

.input-with-audio {
  display: flex;
  gap: 0.35rem;
  align-items: center;
}

.input-with-audio .form-input {
  flex: 1;
}

.btn-icon-audio {
  min-width: 42px;
  height: 42px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background-color: var(--bg-main);
  cursor: pointer;
  font-size: 1.05rem;
}

/* 重複警告・多音字比較パネル */
.duplicate-warning-box {
  border-radius: 10px;
  padding: 0.8rem 0.9rem;
  font-size: 0.82rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.duplicate-warning-box.dup-exact {
  background-color: #fffbeb;
  border: 1.5px solid #f59e0b;
  color: #92400e;
}

.duplicate-warning-box.dup-polyphone {
  background-color: #eff6ff;
  border: 1.5px solid #60a5fa;
  color: #1e40af;
}

[data-theme="dark"] .duplicate-warning-box.dup-exact {
  background-color: #451a03;
  border-color: #d97706;
  color: #fde68a;
}

[data-theme="dark"] .duplicate-warning-box.dup-polyphone {
  background-color: #172554;
  border-color: #3b82f6;
  color: #bfdbfe;
}

.dup-message {
  line-height: 1.4;
  margin: 0;
}

.dup-existing-list {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.dup-existing-item {
  background-color: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.5rem 0.65rem;
  color: var(--text-main);
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.dup-existing-main {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.dup-pinyin {
  color: var(--primary);
  font-weight: 600;
}

.dup-relation-tag {
  font-size: 0.68rem;
  font-weight: 700;
  padding: 0.1rem 0.4rem;
  border-radius: 4px;
  background-color: var(--bg-main);
  border: 1px solid var(--border);
}

.dup-existing-meaning {
  font-size: 0.78rem;
}

.dup-existing-progress {
  font-size: 0.72rem;
  color: var(--text-muted);
}

.dup-confirm-label {
  display: flex;
  align-items: flex-start;
  gap: 0.45rem;
  font-weight: 700;
  cursor: pointer;
  margin-top: 0.2rem;
}

.dup-confirm-label input {
  margin-top: 0.2rem;
}

.dup-safe-note {
  font-size: 0.76rem;
  font-weight: 600;
}

.sticky-modal-footer {
  position: sticky;
  bottom: -1rem;
  background-color: var(--bg-card);
  padding: 0.85rem 0 0.25rem;
  border-top: 1px solid var(--border);
  z-index: 5;
}

.word-card-top-right {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

/* トースト通知 */
.app-toast {
  position: fixed;
  bottom: calc(74px + env(safe-area-inset-bottom, 0px));
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background-color: #065f46;
  color: #ffffff;
  padding: 0.7rem 1.15rem;
  border-radius: 9999px;
  font-size: 0.85rem;
  font-weight: 700;
  box-shadow: var(--shadow-lg);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease, transform 0.25s ease;
  z-index: 2000;
  max-width: 92vw;
  text-align: center;
}

.app-toast.visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}


/* ==========================================================================
   Phase 3 UI改善: 日本語検索中心UI・登録確認画面・詳細編集パネル
   ========================================================================== */

.dict-quick-chips {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.chips-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-weight: 600;
}

.dict-chip-btn {
  font-size: 0.76rem;
  font-weight: 600;
  padding: 0.25rem 0.6rem;
  border-radius: 9999px;
  border: 1px solid var(--border);
  background-color: var(--bg-card);
  color: var(--text-main);
  cursor: pointer;
  transition: all 0.15s ease;
  touch-action: manipulation;
}

.dict-chip-btn:hover,
.dict-chip-btn:active {
  border-color: var(--primary);
  background-color: var(--primary-light);
  color: var(--primary);
}

.dict-candidates-area {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.dict-state-box {
  background-color: var(--bg-card);
  border: 1px dashed var(--border);
  border-radius: 10px;
  padding: 0.85rem 0.95rem;
  font-size: 0.82rem;
  color: var(--text-muted);
  line-height: 1.5;
}

.dict-manual-switch-row {
  margin-top: 0.5rem;
  padding-top: 0.45rem;
  border-top: 1px dashed var(--border);
  text-align: right;
}

.btn-link-subtle {
  background: none;
  border: none;
  color: var(--primary);
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  text-decoration: underline;
}

.dict-no-results {
  border-color: #fcd34d;
  background-color: #fffbeb;
  color: #92400e;
}

[data-theme="dark"] .dict-no-results {
  background-color: #451a03;
  border-color: #b45309;
  color: #fde68a;
}

.no-results-title {
  font-size: 0.88rem;
  font-weight: 700;
  margin-bottom: 0.25rem;
}

.no-results-desc {
  font-size: 0.78rem;
  margin-bottom: 0.65rem;
}

.no-results-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.dict-more-actions-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.5rem;
  padding-top: 0.4rem;
  border-top: 1px dashed var(--border);
}

.dict-candidate-card.is-selected-cand {
  border: 2px solid var(--primary);
  background-color: var(--primary-light);
}

.pos-badge.pos-unset {
  background-color: var(--bg-main);
  color: var(--text-muted);
  border: 1px dashed var(--border);
}

/* ③ 登録内容の確認セクション */
.registration-confirm-section {
  background-color: var(--bg-main);
  border: 1.5px solid var(--primary);
  border-radius: 12px;
  padding: 0.95rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.confirm-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

#confirm-section-title {
  font-size: 0.9rem;
  font-weight: 800;
  color: var(--primary);
}

.confirm-header-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.confirm-preview-card {
  background-color: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.85rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  box-shadow: var(--shadow-sm);
}

.confirm-preview-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.confirm-zh-group {
  display: flex;
  align-items: center;
  gap: 0.55rem;
}

.confirm-zh-text {
  font-size: 1.75rem;
  font-weight: 800;
  color: var(--text-main);
  font-family: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  line-height: 1.2;
}

.confirm-badges-group {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.confirm-pinyin-row,
.confirm-meaning-row {
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
  font-size: 0.9rem;
}

.confirm-field-label {
  font-size: 0.76rem;
  font-weight: 700;
  color: var(--text-muted);
  min-width: 68px;
}

.confirm-pinyin-text {
  font-weight: 700;
  color: var(--primary);
  font-size: 1rem;
}

.confirm-pinyin-text.text-missing-warn {
  color: #d97706;
  font-size: 0.82rem;
}

.confirm-meaning-text {
  font-weight: 700;
  color: var(--text-main);
}

.confirm-source-row {
  font-size: 0.7rem;
  color: var(--text-muted);
  border-top: 1px dashed var(--border);
  padding-top: 0.35rem;
  margin-top: 0.15rem;
}

.missing-info-banner {
  background-color: #fffbeb;
  color: #92400e;
  border: 1px solid #fcd34d;
  border-radius: 8px;
  padding: 0.55rem 0.75rem;
  font-size: 0.78rem;
  line-height: 1.4;
}

[data-theme="dark"] .missing-info-banner {
  background-color: #451a03;
  color: #fde68a;
  border-color: #b45309;
}

.detail-edit-fields {
  background-color: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.85rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.detail-edit-caption {
  font-size: 0.78rem;
  color: var(--text-muted);
  font-weight: 600;
}

/* 単語帳画面内のインライン辞書候補ボックス */
.wordbook-dict-assist-box {
  grid-column: 1 / -1;
  background-color: var(--bg-card);
  border: 1.5px solid var(--primary);
  border-radius: 12px;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  box-shadow: var(--shadow-sm);
}

.wordbook-dict-assist-box .assist-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.5rem;
  font-size: 0.92rem;
  color: var(--primary);
}

.wordbook-dict-assist-box .assist-sub {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin: 0;
}

/* ピンイン確認状態バッジ（辞書確認済 / 複数読み / 自動推定要確認 / 未取得） */
.pinyin-status-badge {
  display: inline-flex;
  align-items: center;
  padding: 0.14rem 0.5rem;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 700;
  white-space: nowrap;
}

.pinyin-status-badge.status-verified {
  background-color: #d1fae5;
  color: #065f46;
  border: 1px solid #6ee7b7;
}

[data-theme="dark"] .pinyin-status-badge.status-verified {
  background-color: #064e3b;
  color: #a7f3d0;
  border-color: #059669;
}

.pinyin-status-badge.status-multiple {
  background-color: #dbeafe;
  color: #1e40af;
  border: 1px solid #93c5fd;
}

[data-theme="dark"] .pinyin-status-badge.status-multiple {
  background-color: #1e3a8a;
  color: #bfdbfe;
  border-color: #3b82f6;
}

.pinyin-status-badge.status-estimated {
  background-color: #fef3c7;
  color: #92400e;
  border: 1px solid #fcd34d;
}

[data-theme="dark"] .pinyin-status-badge.status-estimated {
  background-color: #451a03;
  color: #fde68a;
  border-color: #d97706;
}

.pinyin-status-badge.status-failed {
  background-color: #fee2e2;
  color: #991b1b;
  border: 1px solid #fca5a5;
}

.dict-cand-reading-gloss {
  font-size: 0.8rem;
  color: #1e40af;
  background-color: #eff6ff;
  border-left: 3px solid #3b82f6;
  padding: 0.25rem 0.5rem;
  border-radius: 4px;
  margin-top: 0.15rem;
}

[data-theme="dark"] .dict-cand-reading-gloss {
  color: #bfdbfe;
  background-color: #172554;
  border-left-color: #60a5fa;
}

.reading-rec-tag {
  display: inline-block;
  background-color: #f59e0b;
  color: #ffffff;
  font-size: 0.68rem;
  font-weight: 700;
  padding: 0.08rem 0.4rem;
  border-radius: 999px;
  margin-left: 0.35rem;
}

.dict-cand-poly-warn {
  font-size: 0.76rem;
  color: #b45309;
  background-color: #fffbeb;
  border-left: 3px solid #f59e0b;
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
}

[data-theme="dark"] .dict-cand-poly-warn {
  color: #fde68a;
  background-color: #451a03;
}

/* 確認画面内の複数読み選択ボックス */
.reading-selector-box {
  background-color: var(--bg-card);
  border: 1px solid #93c5fd;
  border-radius: 10px;
  padding: 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.reading-selector-header {
  font-size: 0.8rem;
  color: var(--text-main);
}

.reading-options-list {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.reading-option-btn {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem;
  width: 100%;
  text-align: left;
  padding: 0.5rem 0.7rem;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  background-color: var(--bg-main);
  color: var(--text-main);
  cursor: pointer;
  transition: all 0.15s ease;
}

.reading-option-btn:hover {
  border-color: var(--primary);
}

.reading-option-btn.is-active-reading {
  border-color: var(--primary);
  background-color: rgba(79, 70, 229, 0.08);
}

.reading-opt-pinyin {
  font-weight: 800;
  font-size: 0.92rem;
  color: var(--primary);
}

.reading-opt-gloss {
  font-size: 0.8rem;
  color: var(--text-muted);
  flex: 1;
}

.reading-check-mark {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--primary);
}

/* =========================================================================
   Phase 4-A: 5段階難易度バッジ ＆ クイック難易度セレクター
   ========================================================================= */
.difficulty-badge,
.difficulty-mini-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 0.16rem 0.5rem;
  border-radius: 999px;
  white-space: nowrap;
  letter-spacing: 0.02em;
  border: 1px solid transparent;
}

.difficulty-mini-badge {
  font-size: 0.68rem;
  padding: 0.1rem 0.42rem;
}

/* 1. 初級 (beginner) - エメラルドグリーン */
.diff-beginner {
  background-color: #dcfce7;
  color: #166534;
  border-color: #86efac;
}

[data-theme="dark"] .diff-beginner {
  background-color: #064e3b;
  color: #a7f3d0;
  border-color: #10b981;
}

/* 2. 初中級 (elementary) - スカイブルー */
.diff-elementary {
  background-color: #e0f2fe;
  color: #075985;
  border-color: #7dd3fc;
}

[data-theme="dark"] .diff-elementary {
  background-color: #0c4a6e;
  color: #bae6fd;
  border-color: #38bdf8;
}

/* 3. 中級 (intermediate) - インディゴ/ブルー */
.diff-intermediate {
  background-color: #e0e7ff;
  color: #3730a3;
  border-color: #a5b4fc;
}

[data-theme="dark"] .diff-intermediate {
  background-color: #1e1b4b;
  color: #c7d2fe;
  border-color: #6366f1;
}

/* 4. 中上級 (upper_intermediate) - アンバー/オレンジ */
.diff-upper_intermediate {
  background-color: #fef3c7;
  color: #92400e;
  border-color: #fcd34d;
}

[data-theme="dark"] .diff-upper_intermediate {
  background-color: #451a03;
  color: #fde68a;
  border-color: #f59e0b;
}

/* 5. 上級 (advanced) - ローズ/パープル */
.diff-advanced {
  background-color: #fae8ff;
  color: #86198f;
  border-color: #f0abfc;
}

[data-theme="dark"] .diff-advanced {
  background-color: #4a044e;
  color: #f5d0fe;
  border-color: #d946ef;
}

/* 未設定 (unset) - ニュートラルグレー */
.diff-unset {
  background-color: #f1f5f9;
  color: #475569;
  border-color: #cbd5e1;
}

[data-theme="dark"] .diff-unset {
  background-color: #1e293b;
  color: #94a3b8;
  border-color: #475569;
}

/* 登録確認カード内の難易度設定行 */
.confirm-difficulty-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin-top: 0.35rem;
  padding-top: 0.35rem;
  border-top: 1px dashed var(--border);
}

.select-sm {
  padding: 0.22rem 0.5rem;
  font-size: 0.82rem;
  border-radius: 6px;
}

.confirm-difficulty-note {
  font-size: 0.74rem;
  color: var(--text-muted);
}


.setup-view select, .quiz-speech select, .quiz-speech button { min-height: 44px; font-size: 1rem; }
.setup-view [data-level] ~ small { flex-basis: 100%; padding-bottom: .35rem; }
.quiz-speech { padding: .5rem; }

.result-view { scroll-margin-top: calc(4rem + env(safe-area-inset-top, 0px)); }
.result-header-card > button { display: block; width: 100%; min-height: 44px; margin-top: .5rem; }
.result-header-card > p { margin: .55rem 0; }
.result-header-card > p:empty { margin: 0; }
.result-list-card summary, .setup-view summary, .hsk-card summary { cursor: pointer; padding: .65rem 0; }
@media (max-width: 600px) {
  .result-view .result-header-card { padding: 1rem; }
  .setup-view .order-mode-options { gap: .35rem; }
}

/* テスト設定ウィザード（Phase 8） */
.wizard-steps { display: flex; gap: .4rem; margin-bottom: 1rem; }
.wizard-step-pill { flex: 1; text-align: center; padding: .45rem .2rem; border-radius: 999px; border: 1.5px solid var(--border); font-size: .78rem; color: var(--text-muted); }
.wizard-step-pill.current { border-color: var(--text); color: var(--text); font-weight: 700; }
.wizard-step-pill.done { color: var(--text-muted); }
.wizard-chip-grid { display: flex; flex-wrap: wrap; gap: .5rem; }
.wizard-chip-grid .count-btn { flex: 0 0 auto; }
.wizard-nav { display: flex; gap: .6rem; margin-top: 1.25rem; }
.wizard-nav .btn { flex: 1; }
.setup-start-footer .btn { width: 100%; margin-top: .6rem; }
