/* ==========================================================================
   地図記号クイズ (Chizu Kigou Quiz) - Design System & Styles
   Theme: Sleek Dark / Cool Modern Aesthetic
   ========================================================================== */

/* --- CSS Variables & Design Tokens --- */
:root {
  --bg-main: #0b0f17;
  --bg-surface: #141b27;
  --bg-surface-elevated: #1b2434;
  --bg-surface-subtle: #222d40;
  
  --border-subtle: #243042;
  --border-focus: #38bdf8;
  --border-active: #60a5fa;

  --text-main: #f3f4f6;
  --text-muted: #94a3b8;
  --text-subtle: #64748b;

  --accent-cyan: #38bdf8;
  --accent-blue: #3b82f6;
  --accent-gold: #fbbf24;
  --accent-gold-dark: #d97706;

  --color-correct: #10b981;
  --color-correct-bg: rgba(16, 185, 129, 0.16);
  --color-correct-border: #059669;

  --color-wrong: #f43f5e;
  --color-wrong-bg: rgba(244, 63, 94, 0.16);
  --color-wrong-border: #e11d48;

  --color-urgent: #ef4444;

  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-full: 9999px;

  --shadow-sm: 0 2px 6px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.45);
  --shadow-lg: 0 16px 36px rgba(0, 0, 0, 0.6);
  --shadow-gold: 0 0 24px rgba(251, 191, 36, 0.35);

  --font-base: 'Noto Sans JP', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-heading: 'Outfit', 'Noto Sans JP', sans-serif;
}

/* --- Base & Reset --- */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

html {
  font-size: 16px;
  background-color: var(--bg-main);
  color: var(--text-main);
  font-family: var(--font-base);
  line-height: 1.6;
}

body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  position: relative;
  overflow-x: hidden;
  background: radial-gradient(circle at 50% 0%, #162032 0%, #0b0f17 70%);
}

/* --- Confetti Canvas --- */
#confetti-canvas {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  pointer-events: none;
  z-index: 100;
}

/* --- App Container --- */
.app-container {
  width: 100%;
  max-width: 720px;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  padding: 1.25rem 1rem 2.5rem;
}

/* --- Header --- */
.app-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
  padding: 0.5rem 0.25rem;
}

.brand-area {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  cursor: pointer;
  user-select: none;
  border-radius: var(--radius-sm);
  padding: 0.25rem;
  transition: opacity 0.2s;
}

.brand-area:hover {
  opacity: 0.85;
}

.brand-icon {
  width: 38px;
  height: 38px;
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  display: grid;
  place-items: center;
  color: var(--accent-cyan);
}

.brand-title {
  font-family: var(--font-heading);
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text-main);
}

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

.header-text-btn {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  color: var(--text-main);
  font-family: var(--font-base);
  font-size: 0.85rem;
  font-weight: 600;
  padding: 0.45rem 0.85rem;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  gap: 0.35rem;
  cursor: pointer;
  transition: all 0.2s ease;
}

.header-text-btn:hover {
  background: var(--bg-surface-elevated);
  border-color: var(--border-focus);
  color: var(--accent-cyan);
}

.icon-btn {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  color: var(--text-muted);
  width: 40px;
  height: 40px;
  border-radius: var(--radius-md);
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: all 0.2s ease;
}

.icon-btn:hover {
  background: var(--bg-surface-elevated);
  color: var(--text-main);
  border-color: var(--border-focus);
}

.icon-btn.is-muted {
  color: var(--text-subtle);
  opacity: 0.6;
}

/* --- Screen Transitions --- */
.screen {
  display: none;
  flex-direction: column;
  flex: 1;
  animation: fadeIn 0.25s ease-out forwards;
}

.screen.active {
  display: flex;
}

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

/* ==========================================================================
   1. スタート画面 (Start Screen)
   ========================================================================== */
.hero-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 1.75rem 1.25rem;
  text-align: center;
  margin-bottom: 1.5rem;
  box-shadow: var(--shadow-sm);
}

.hero-badge {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 0.35rem 0.85rem;
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  color: var(--accent-cyan);
  border-radius: var(--radius-full);
  margin-bottom: 0.75rem;
}

.hero-title {
  font-size: 1.6rem;
  font-weight: 800;
  line-height: 1.3;
  margin-bottom: 0.75rem;
  color: var(--text-main);
}

.hero-desc {
  font-size: 0.95rem;
  color: var(--text-muted);
  line-height: 1.6;
}

.mode-selection-title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 0.75rem;
  padding-left: 0.25rem;
}

.mode-cards-grid {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.mode-card {
  display: flex;
  align-items: center;
  gap: 1rem;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 1rem 1.25rem;
  text-align: left;
  cursor: pointer;
  color: var(--text-main);
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: var(--shadow-sm);
}

.mode-card:hover {
  background: var(--bg-surface-elevated);
  border-color: var(--border-focus);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.mode-card:active {
  transform: scale(0.98);
}

.mode-icon-wrapper {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-md);
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  display: grid;
  place-items: center;
  font-size: 1.35rem;
  flex-shrink: 0;
}

.mode-card-content {
  flex: 1;
}

.mode-card-title {
  font-size: 1.05rem;
  font-weight: 700;
  margin-bottom: 0.2rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.mode-card-desc {
  font-size: 0.825rem;
  color: var(--text-muted);
}

.mode-card-arrow {
  color: var(--text-subtle);
  transition: transform 0.2s;
}

.mode-card:hover .mode-card-arrow {
  transform: translateX(4px);
  color: var(--accent-cyan);
}

/* Dictionary Entry Card on Start Screen */
.dictionary-entry-card {
  display: flex;
  align-items: center;
  gap: 1rem;
  background: linear-gradient(135deg, rgba(27, 36, 52, 0.9) 0%, rgba(20, 27, 39, 0.95) 100%);
  border: 1px solid rgba(56, 189, 248, 0.35);
  border-radius: var(--radius-md);
  padding: 1rem 1.25rem;
  text-align: left;
  cursor: pointer;
  color: var(--text-main);
  margin-bottom: 1.5rem;
  transition: all 0.2s ease;
  box-shadow: var(--shadow-sm);
}

.dictionary-entry-card:hover {
  background: linear-gradient(135deg, rgba(35, 48, 70, 0.95) 0%, rgba(25, 34, 49, 1) 100%);
  border-color: var(--accent-cyan);
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(56, 189, 248, 0.15);
}

.dictionary-entry-card:active {
  transform: scale(0.98);
}

.dict-icon-wrapper {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-md);
  background: rgba(56, 189, 248, 0.12);
  border: 1px solid rgba(56, 189, 248, 0.25);
  display: grid;
  place-items: center;
  font-size: 1.35rem;
  flex-shrink: 0;
}

.dict-card-content {
  flex: 1;
}

.dict-card-title {
  font-size: 1.05rem;
  font-weight: 700;
  margin-bottom: 0.2rem;
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.badge-count {
  font-size: 0.725rem;
  font-weight: 700;
  background: rgba(56, 189, 248, 0.2);
  color: var(--accent-cyan);
  border: 1px solid rgba(56, 189, 248, 0.4);
  padding: 0.1rem 0.5rem;
  border-radius: var(--radius-full);
}

.dict-card-desc {
  font-size: 0.825rem;
  color: var(--text-muted);
}

.dict-card-arrow {
  color: var(--accent-cyan);
  transition: transform 0.2s;
}

.dictionary-entry-card:hover .dict-card-arrow {
  transform: translateX(4px);
}

.game-rule-box {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 1rem 1.25rem;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.rule-header {
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 0.35rem;
}

.game-rule-box ul {
  list-style: none;
  padding-left: 0;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.game-rule-box li::before {
  content: "•";
  color: var(--accent-cyan);
  display: inline-block;
  width: 1em;
  margin-left: 0.1em;
}

/* ==========================================================================
   2. クイズ画面 (Quiz Screen)
   ========================================================================== */
.quiz-top-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.75rem;
}

.question-badge {
  font-size: 0.875rem;
  font-weight: 700;
  color: var(--text-main);
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  padding: 0.35rem 0.85rem;
  border-radius: var(--radius-full);
}

.timer-indicator {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-family: var(--font-heading);
  font-size: 1rem;
  font-weight: 700;
  color: var(--accent-cyan);
}

.timer-indicator.urgent {
  color: var(--color-urgent);
  animation: pulseUrgent 0.6s infinite alternate;
}

@keyframes pulseUrgent {
  from { opacity: 0.7; transform: scale(0.96); }
  to { opacity: 1; transform: scale(1.04); }
}

/* --- Progress / Timer Bar --- */
.timer-bar-wrapper {
  width: 100%;
  height: 6px;
  background: var(--bg-surface);
  border-radius: var(--radius-full);
  overflow: hidden;
  margin-bottom: 1.25rem;
  border: 1px solid var(--border-subtle);
}

.timer-bar {
  height: 100%;
  width: 100%;
  background: var(--accent-cyan);
  transition: width 0.05s linear;
}

.timer-bar.urgent {
  background: var(--color-urgent);
}

.question-type-label {
  font-size: 0.875rem;
  color: var(--text-muted);
  margin-bottom: 0.75rem;
  text-align: center;
}

/* --- Question Prompt Area --- */
.prompt-container {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 1.75rem 1.25rem;
  text-align: center;
  margin-bottom: 1.25rem;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 190px;
}

.symbol-card-large {
  width: 110px;
  height: 110px;
  background: #ffffff;
  color: #111827;
  border-radius: var(--radius-md);
  padding: 0.75rem;
  display: grid;
  place-items: center;
  margin-bottom: 0.75rem;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
}

.symbol-svg {
  width: 100%;
  height: 100%;
  display: block;
}

.name-card-large {
  margin-bottom: 0.75rem;
}

.name-sub {
  font-size: 0.875rem;
  color: var(--accent-cyan);
  display: block;
  margin-bottom: 0.25rem;
}

.name-main {
  font-size: 2rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--text-main);
}

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

/* --- Feedback Banner --- */
.feedback-banner {
  min-height: 38px;
  border-radius: var(--radius-md);
  margin-bottom: 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.95rem;
  font-weight: 700;
  padding: 0.4rem 1rem;
  text-align: center;
  transition: all 0.2s ease;
}

.feedback-banner.hidden {
  visibility: hidden;
  opacity: 0;
}

.feedback-banner.correct {
  background: var(--color-correct-bg);
  color: var(--color-correct);
  border: 1px solid var(--color-correct-border);
}

.feedback-banner.wrong {
  background: var(--color-wrong-bg);
  color: var(--color-wrong);
  border: 1px solid var(--color-wrong-border);
}

/* --- 4-Choice Button Grid --- */
.choices-container {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.75rem;
  margin-bottom: 1.5rem;
}

@media (max-width: 520px) {
  .choices-container {
    grid-template-columns: 1fr;
  }
}

.choice-btn {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 0.85rem 1rem;
  min-height: 64px;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  cursor: pointer;
  color: var(--text-main);
  transition: all 0.15s ease;
  font-family: var(--font-base);
  text-align: left;
  position: relative;
  overflow: hidden;
}

.choice-btn:hover:not(:disabled) {
  background: var(--bg-surface-elevated);
  border-color: var(--border-focus);
  transform: translateY(-2px);
}

.choice-btn:active:not(:disabled) {
  transform: scale(0.98);
}

.choice-num {
  width: 26px;
  height: 26px;
  border-radius: var(--radius-sm);
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  display: grid;
  place-items: center;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text-muted);
  flex-shrink: 0;
}

.choice-text {
  font-size: 1rem;
  font-weight: 600;
  line-height: 1.4;
  flex: 1;
}

.choice-symbol-box {
  width: 48px;
  height: 48px;
  background: #ffffff;
  color: #111827;
  border-radius: var(--radius-sm);
  padding: 0.35rem;
  display: grid;
  place-items: center;
  flex-shrink: 0;
}

/* Button Answer States */
.choice-btn.correct {
  background: var(--color-correct-bg) !important;
  border-color: var(--color-correct) !important;
  color: #ffffff !important;
}

.choice-btn.wrong {
  background: var(--color-wrong-bg) !important;
  border-color: var(--color-wrong) !important;
  color: #ffffff !important;
  animation: shake 0.4s ease;
}

.choice-btn.correct-answer-hint {
  border-color: var(--color-correct) !important;
  background: rgba(16, 185, 129, 0.1) !important;
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20%, 60% { transform: translateX(-4px); }
  40%, 80% { transform: translateX(4px); }
}

/* ==========================================================================
   3. 結果画面 (Result Screen)
   ========================================================================== */
.result-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 2rem 1.25rem;
  text-align: center;
  margin-bottom: 1.25rem;
  box-shadow: var(--shadow-md);
  position: relative;
  overflow: hidden;
}

.result-card.perfect-score {
  border-color: var(--accent-gold);
  box-shadow: var(--shadow-gold);
}

.celebration-area {
  margin-bottom: 1rem;
}

.celebration-badge {
  animation: popIn 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}

@keyframes popIn {
  from { transform: scale(0.6); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

.trophy-icon {
  font-size: 3.5rem;
  margin-bottom: 0.25rem;
  filter: drop-shadow(0 0 12px rgba(251, 191, 36, 0.6));
  animation: bounceTrophy 1.5s infinite;
}

@keyframes bounceTrophy {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-8px); }
}

.celebration-title {
  font-size: 1.35rem;
  font-weight: 800;
  color: var(--accent-gold);
  margin-bottom: 0.25rem;
}

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

.result-score-block {
  display: flex;
  justify-content: center;
  align-items: baseline;
  gap: 0.75rem;
  margin-bottom: 0.5rem;
}

.result-score-val {
  font-family: var(--font-heading);
  font-size: 3.2rem;
  font-weight: 900;
  line-height: 1;
  color: var(--text-main);
}

.result-percentage-val {
  font-family: var(--font-heading);
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--accent-cyan);
}

.result-card.perfect-score .result-percentage-val {
  color: var(--accent-gold);
}

.result-rank {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 0.5rem;
}

.result-comment {
  font-size: 0.9rem;
  color: var(--text-muted);
  line-height: 1.5;
}

.result-actions {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.btn-primary {
  background: var(--accent-blue);
  border: 1px solid transparent;
  color: #ffffff;
  border-radius: var(--radius-md);
  padding: 0.9rem 1.25rem;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  transition: all 0.2s ease;
}

.btn-primary:hover {
  background: #2563eb;
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.btn-secondary {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  color: var(--text-main);
  border-radius: var(--radius-md);
  padding: 0.9rem 1.25rem;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  transition: all 0.2s ease;
}

.btn-secondary:hover {
  background: var(--bg-surface-elevated);
  border-color: var(--border-focus);
}

.btn-secondary.btn-sm {
  padding: 0.5rem 1rem;
  font-size: 0.875rem;
}

.btn-dict-action {
  width: 100%;
  background: var(--bg-surface);
  border: 1px solid rgba(56, 189, 248, 0.4);
  color: var(--accent-cyan);
  border-radius: var(--radius-md);
  padding: 0.85rem 1.25rem;
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  margin-bottom: 2rem;
  transition: all 0.2s ease;
}

.btn-dict-action:hover {
  background: var(--bg-surface-elevated);
  border-color: var(--accent-cyan);
}

/* ==========================================================================
   4. 復習リスト (Review List)
   ========================================================================== */
.review-section {
  margin-top: 0.5rem;
}

.review-section-title {
  font-size: 1.1rem;
  font-weight: 700;
  margin-bottom: 0.75rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--text-main);
}

.review-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.review-item {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 1rem 1.25rem;
}

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

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

.review-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.75rem;
}

.review-qnum {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-muted);
}

.status-tag {
  font-size: 0.75rem;
  font-weight: 700;
  padding: 0.2rem 0.6rem;
  border-radius: var(--radius-full);
}

.status-tag.correct {
  background: var(--color-correct-bg);
  color: var(--color-correct);
}

.status-tag.wrong, .status-tag.timeout {
  background: var(--color-wrong-bg);
  color: var(--color-wrong);
}

.review-body {
  display: flex;
  gap: 1rem;
  align-items: flex-start;
}

.review-symbol-box {
  width: 60px;
  height: 60px;
  background: #ffffff;
  color: #111827;
  border-radius: var(--radius-sm);
  padding: 0.4rem;
  display: grid;
  place-items: center;
  flex-shrink: 0;
}

.review-details {
  flex: 1;
}

.review-name {
  font-size: 1.05rem;
  font-weight: 700;
  margin-bottom: 0.25rem;
  color: var(--text-main);
}

.review-kana {
  font-size: 0.8rem;
  font-weight: normal;
  color: var(--text-muted);
}

.review-ans-diff {
  font-size: 0.85rem;
  margin-bottom: 0.5rem;
}

.diff-user {
  color: var(--color-wrong);
  margin-bottom: 0.15rem;
}

.diff-correct {
  color: var(--color-correct);
}

.review-trivia {
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 0.5rem 0.75rem;
  font-size: 0.825rem;
  color: var(--text-muted);
  line-height: 1.5;
}

.trivia-label {
  color: var(--accent-cyan);
  font-weight: 700;
}

/* ==========================================================================
   5. 地図記号ずかん画面 (Dictionary Screen)
   ========================================================================== */
.dict-top-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.25rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--border-subtle);
}

.btn-back {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  color: var(--text-main);
  font-family: var(--font-base);
  font-size: 0.875rem;
  font-weight: 600;
  padding: 0.45rem 0.85rem;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  gap: 0.4rem;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-back:hover {
  background: var(--bg-surface-elevated);
  border-color: var(--border-focus);
  color: var(--accent-cyan);
}

.dict-page-title {
  font-size: 1.2rem;
  font-weight: 800;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.dict-count-pill {
  font-size: 0.75rem;
  font-weight: 700;
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  color: var(--accent-cyan);
  padding: 0.15rem 0.55rem;
  border-radius: var(--radius-full);
}

/* --- Search Input --- */
.dict-search-wrapper {
  position: relative;
  display: flex;
  align-items: center;
  margin-bottom: 1rem;
}

.search-icon {
  position: absolute;
  left: 1rem;
  color: var(--text-subtle);
  pointer-events: none;
}

.dict-search-input {
  width: 100%;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 0.75rem 2.5rem 0.75rem 2.75rem;
  font-size: 0.95rem;
  font-family: var(--font-base);
  color: var(--text-main);
  outline: none;
  transition: all 0.2s ease;
}

.dict-search-input:focus {
  border-color: var(--border-focus);
  background: var(--bg-surface-elevated);
  box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.15);
}

.dict-search-input::placeholder {
  color: var(--text-subtle);
}

.dict-search-clear {
  position: absolute;
  right: 0.75rem;
  background: var(--bg-surface-subtle);
  border: none;
  color: var(--text-muted);
  width: 22px;
  height: 22px;
  border-radius: var(--radius-full);
  display: grid;
  place-items: center;
  font-size: 0.75rem;
  cursor: pointer;
  transition: all 0.15s;
}

.dict-search-clear:hover {
  background: var(--color-wrong-bg);
  color: var(--color-wrong);
}

.dict-search-clear.hidden {
  display: none;
}

/* --- Category Filters --- */
.category-filters {
  display: flex;
  gap: 0.5rem;
  overflow-x: auto;
  padding-bottom: 0.5rem;
  margin-bottom: 1.25rem;
  scrollbar-width: thin;
  -webkit-overflow-scrolling: touch;
}

.filter-chip {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  color: var(--text-muted);
  font-family: var(--font-base);
  font-size: 0.825rem;
  font-weight: 600;
  padding: 0.4rem 0.85rem;
  border-radius: var(--radius-full);
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.2s ease;
}

.filter-chip:hover {
  background: var(--bg-surface-elevated);
  color: var(--text-main);
  border-color: var(--border-focus);
}

.filter-chip.active {
  background: var(--accent-cyan);
  border-color: var(--accent-cyan);
  color: #0b0f17;
  font-weight: 700;
}

/* --- Dictionary Grid & Cards --- */
.dict-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.85rem;
  margin-bottom: 2rem;
}

@media (min-width: 600px) {
  .dict-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

.dict-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  transition: all 0.2s ease;
  box-shadow: var(--shadow-sm);
}

.dict-card:hover {
  background: var(--bg-surface-elevated);
  border-color: var(--border-focus);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.dict-card-top {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.dict-symbol-box {
  width: 54px;
  height: 54px;
  background: #ffffff;
  color: #111827;
  border-radius: var(--radius-sm);
  padding: 0.35rem;
  display: grid;
  place-items: center;
  flex-shrink: 0;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.dict-card-info {
  flex: 1;
  min-width: 0;
}

.dict-card-cat {
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--accent-cyan);
  display: inline-block;
  margin-bottom: 0.15rem;
}

.dict-card-name {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-main);
  line-height: 1.25;
  word-break: break-word;
}

.dict-card-kana {
  font-size: 0.75rem;
  color: var(--text-muted);
  display: block;
}

.dict-card-trivia {
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 0.5rem 0.65rem;
  font-size: 0.8rem;
  color: var(--text-muted);
  line-height: 1.45;
  margin-top: auto;
}

/* Empty State */
.dict-empty-state {
  text-align: center;
  padding: 3rem 1.5rem;
  background: var(--bg-surface);
  border: 1px dashed var(--border-subtle);
  border-radius: var(--radius-lg);
  margin-bottom: 2rem;
}

.dict-empty-state.hidden {
  display: none;
}

.empty-icon {
  font-size: 2.5rem;
  margin-bottom: 0.75rem;
  opacity: 0.7;
}

.empty-text {
  font-size: 0.95rem;
  color: var(--text-muted);
  margin-bottom: 1rem;
}

/* ==========================================================================
   6. フッター (Footer)
   ========================================================================== */
.app-footer {
  margin-top: auto;
  padding-top: 2rem;
  text-align: center;
  font-size: 0.8rem;
  color: var(--text-subtle);
}
