/* ==========================================================================
   Japanese Shikhi Views Design (Explorer, Mindmap, Flashcards, Quiz, Alchemy)
   ========================================================================== */

/* --- FORM CONTROLS & SELECTS --- */
.filter-select, .search-input-mini {
  background: var(--bg-subtle);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  padding: 0.45rem 0.8rem;
  border-radius: var(--radius-md);
  font-size: 0.82rem;
  font-weight: 500;
  outline: none;
  cursor: pointer;
  transition: all 0.15s ease;
}

.filter-select:hover, .filter-select:focus,
.search-input-mini:hover, .search-input-mini:focus {
  border-color: var(--js-crimson);
}

/* --- 1. EXPLORER VIEW --- */
.explorer-filter-bar {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xl);
  padding: 1.25rem;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

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

.search-input-wrapper .search-icon {
  position: absolute;
  left: 1rem;
  font-size: 0.95rem;
  color: var(--text-muted);
}

.search-input {
  width: 100%;
  background: var(--bg-subtle);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 0.7rem 2.75rem;
  font-size: 0.92rem;
  color: var(--text-primary);
  outline: none;
  transition: all 0.15s ease;
}

.search-input:focus {
  border-color: var(--js-crimson);
  box-shadow: 0 0 0 2px rgba(230, 57, 70, 0.2);
}

.clear-search-btn {
  position: absolute;
  right: 1rem;
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 0.9rem;
}

.filter-controls-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.85rem;
}

.filter-group {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
}

.filter-toggle-btn {
  background: var(--bg-subtle);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  padding: 0.45rem 0.85rem;
  border-radius: var(--radius-md);
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}

.filter-toggle-btn.active {
  background: rgba(244, 162, 97, 0.15);
  color: var(--js-amber);
  border-color: var(--js-amber);
}

.explorer-results-header {
  margin-top: 1.25rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.results-count {
  font-size: 0.84rem;
  color: var(--text-muted);
  font-weight: 600;
}

.empty-search-state {
  grid-column: 1 / -1;
  text-align: center;
  padding: 4rem 1rem;
}

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

/* --- 2. MINDMAP VIEW --- */
.view-mindmap-layout {
  display: grid;
  grid-template-columns: 320px 1fr;
  gap: 1.25rem;
  height: calc(100vh - 130px);
  min-height: 580px;
}

.mindmap-sidebar {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xl);
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  overflow-y: auto;
  box-shadow: var(--shadow-sm);
}

.mindmap-sidebar-header h3 {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 0.3rem;
}

.mindmap-sidebar-header p {
  font-size: 0.8rem;
  color: var(--text-muted);
  line-height: 1.45;
}

.mindmap-mode-toggle {
  display: flex;
  background: var(--bg-subtle);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-pill);
  padding: 2px;
}

.mode-btn {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--text-muted);
  padding: 0.4rem 0.6rem;
  border-radius: var(--radius-pill);
  font-size: 0.76rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
  text-align: center;
}

.mode-btn.active {
  background: var(--bg-card);
  color: var(--text-primary);
  box-shadow: var(--shadow-sm);
}

.section-label {
  display: block;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  margin-bottom: 0.6rem;
}

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

.preset-pill {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  background: var(--bg-subtle);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 0.55rem 0.85rem;
  color: var(--text-secondary);
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  text-align: left;
  transition: all 0.15s ease;
}

.preset-pill:hover {
  background: var(--bg-card-hover);
  color: var(--text-primary);
}

.preset-pill.active {
  background: rgba(230, 57, 70, 0.12);
  border-color: rgba(230, 57, 70, 0.4);
  color: var(--js-crimson);
}

.preset-glyph {
  font-family: var(--font-cjk);
  font-size: 1.15rem;
  font-weight: 700;
}

.mindmap-family-desc-card {
  background: var(--bg-subtle);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1rem;
  margin-top: auto;
}

.fd-badge {
  font-size: 0.68rem;
  font-weight: 700;
  color: var(--js-crimson);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 0.25rem;
}

.mindmap-family-desc-card h4 {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 0.35rem;
}

.fd-onyomi {
  font-size: 0.8rem;
  color: #60a5fa;
  margin-bottom: 0.35rem;
}

.fd-note {
  font-size: 0.78rem;
  color: var(--text-secondary);
  line-height: 1.45;
}

/* Canvas Area */
.mindmap-graph-area {
  position: relative;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xl);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

.mindmap-wrapper {
  position: relative;
  width: 100%;
  height: 100%;
}

.mindmap-wrapper canvas {
  display: block;
  width: 100%;
  height: 100%;
}

.mindmap-hud-controls {
  position: absolute;
  bottom: 1.25rem;
  right: 1.25rem;
  display: flex;
  gap: 0.35rem;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-pill);
  padding: 3px;
  box-shadow: var(--shadow-md);
}

.hud-btn {
  background: transparent;
  border: none;
  color: var(--text-primary);
  width: 32px;
  height: 32px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 0.88rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s ease;
}

.hud-btn:hover {
  background: var(--bg-subtle);
}

.mindmap-info-tooltip {
  position: absolute;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 0.85rem 1rem;
  box-shadow: var(--shadow-lg);
  pointer-events: none;
  z-index: 10;
  max-width: 250px;
}

.tt-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.4rem;
}

.tt-glyph {
  font-family: var(--font-cjk);
  font-size: 1.8rem;
  font-weight: 800;
  color: var(--text-primary);
}

.tt-readings {
  font-size: 0.75rem;
  color: #60a5fa;
}

.tt-formula {
  font-size: 0.78rem;
  color: var(--text-secondary);
  margin-bottom: 0.4rem;
}

.tt-action {
  font-size: 0.72rem;
  color: var(--js-crimson);
  font-weight: 600;
}

/* --- 3. ALCHEMY (SYNTHESIZER) VIEW --- */
.alchemy-view-layout {
  max-width: 920px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.alchemy-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

.alchemy-header-row h2 {
  font-size: 1.4rem;
  font-weight: 800;
  color: var(--text-primary);
}

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

.alchemy-mode-switch {
  display: flex;
  background: var(--bg-subtle);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-pill);
  padding: 3px;
}

.mode-pill {
  background: transparent;
  border: none;
  color: var(--text-muted);
  padding: 0.4rem 0.9rem;
  border-radius: var(--radius-pill);
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}

.mode-pill.active {
  background: var(--bg-card);
  color: var(--text-primary);
  box-shadow: var(--shadow-sm);
}

.alchemy-challenge-banner {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1rem 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.challenge-tag {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--js-crimson);
  text-transform: uppercase;
  margin-right: 0.5rem;
}

.challenge-stats {
  display: flex;
  gap: 1.25rem;
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.alchemy-crucible-area {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xl);
  padding: 2rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.5rem;
  box-shadow: var(--shadow-sm);
}

.crucible-slots {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  min-height: 80px;
}

.crucible-placeholder {
  color: var(--text-muted);
  font-size: 0.88rem;
}

.slot-item {
  position: relative;
  width: 64px;
  height: 64px;
  background: var(--bg-subtle);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
}

.slot-glyph {
  font-family: var(--font-cjk);
  font-size: 2rem;
  font-weight: 700;
  color: var(--text-primary);
}

.slot-remove-btn {
  position: absolute;
  top: -6px;
  right: -6px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  width: 18px;
  height: 18px;
  border-radius: 50%;
  font-size: 0.65rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.slot-plus {
  font-size: 1.2rem;
  color: var(--text-muted);
}

.crucible-actions {
  display: flex;
  gap: 0.75rem;
}

.btn-alchemy-clear {
  background: var(--bg-subtle);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  padding: 0.6rem 1.2rem;
  border-radius: var(--radius-md);
  font-weight: 600;
  font-size: 0.88rem;
  cursor: pointer;
}

.btn-alchemy-forge {
  background: var(--js-crimson);
  color: #ffffff;
  border: none;
  padding: 0.6rem 1.5rem;
  border-radius: var(--radius-md);
  font-weight: 700;
  font-size: 0.88rem;
  cursor: pointer;
  box-shadow: 0 2px 10px rgba(230, 57, 70, 0.3);
  transition: all 0.15s ease;
}

.btn-alchemy-forge:hover {
  background: var(--js-crimson-hover);
}

/* Synthesis Result */
.alchemy-success-box {
  background: var(--bg-subtle);
  border: 1px solid rgba(42, 157, 143, 0.3);
  border-radius: var(--radius-xl);
  padding: 1.5rem;
  display: flex;
  align-items: center;
  gap: 1.5rem;
}

.alchemy-glow-glyph {
  font-family: var(--font-cjk);
  font-size: 3.8rem;
  font-weight: 800;
  color: var(--js-teal);
  line-height: 1;
}

.alchemy-formula-quote {
  font-size: 0.95rem;
  color: var(--text-secondary);
  margin: 0.35rem 0 0.85rem 0;
}

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

.btn-inspect-alchemy {
  background: var(--js-crimson);
  color: #ffffff;
  border: none;
  padding: 0.45rem 0.9rem;
  border-radius: var(--radius-md);
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
}

.alchemy-fail-box {
  background: var(--bg-subtle);
  border: 1px solid rgba(239, 68, 68, 0.25);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  display: flex;
  align-items: center;
  gap: 1rem;
}

.fail-icon {
  font-size: 1.8rem;
}

/* Ingredients Shelf */
.alchemy-shelf-section {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xl);
  padding: 1.5rem;
  box-shadow: var(--shadow-sm);
}

.shelf-title {
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 1rem;
}

.ingredients-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(85px, 1fr));
  gap: 0.65rem;
}

.ing-tile {
  background: var(--bg-subtle);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 0.65rem 0.35rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  cursor: pointer;
  transition: all 0.15s ease;
}

.ing-tile:hover {
  background: var(--bg-card-hover);
  border-color: var(--js-crimson);
  transform: translateY(-2px);
}

.ing-glyph {
  font-family: var(--font-cjk);
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.2;
}

.ing-name {
  font-size: 0.68rem;
  color: var(--text-muted);
  margin-top: 2px;
}

/* --- 4. FLASHCARDS VIEW --- */
.flashcards-view-layout {
  max-width: 620px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  align-items: center;
}

.fc-header-row {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
}

.fc-title-group h2 {
  font-size: 1.35rem;
  font-weight: 800;
  color: var(--text-primary);
}

.fc-title-group p {
  font-size: 0.82rem;
  color: var(--text-muted);
}

.fc-deck-controls {
  display: flex;
  gap: 0.5rem;
}

.fc-progress-bar-container {
  width: 100%;
  height: 4px;
  background: var(--bg-subtle);
  border-radius: var(--radius-pill);
  overflow: hidden;
}

.fc-progress-fill {
  height: 100%;
  background: var(--js-crimson);
  transition: width 0.3s ease;
}

.fc-counter-label {
  font-size: 0.8rem;
  color: var(--text-muted);
  font-weight: 600;
}

/* 3D Flashcard */
.flashcard-scene {
  width: 100%;
  height: 380px;
  perspective: 1000px;
  cursor: pointer;
}

.flashcard-3d {
  width: 100%;
  height: 100%;
  position: relative;
  transform-style: preserve-3d;
  transition: transform 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

.flashcard-3d.is-flipped {
  transform: rotateY(180deg);
}

.card-face {
  position: absolute;
  inset: 0;
  backface-visibility: hidden;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xl);
  padding: 2rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-md);
  text-align: center;
}

.card-back {
  transform: rotateY(180deg);
  background: var(--bg-subtle);
}

.fc-badge-top {
  position: absolute;
  top: 1.25rem;
  left: 1.25rem;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
}

.fc-hero-glyph {
  font-family: var(--font-cjk);
  font-size: 5.5rem;
  font-weight: 800;
  color: var(--text-primary);
  line-height: 1;
  margin-bottom: 1rem;
}

.fc-hint-text {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-top: 1rem;
}

.fc-meaning-hero {
  font-size: 2rem;
  font-weight: 800;
  color: var(--text-primary);
  margin-bottom: 0.5rem;
}

.fc-meaning-text {
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 0.4rem;
}

.fc-formula-box {
  background: var(--bg-card);
  border-left: 3px solid var(--js-crimson);
  border-radius: var(--radius-md);
  padding: 0.85rem 1rem;
  margin-top: 1rem;
  font-size: 0.85rem;
  color: var(--text-secondary);
  text-align: left;
}

.fc-action-bar {
  width: 100%;
  display: flex;
  justify-content: center;
  min-height: 48px;
}

.fc-btn-flip {
  background: var(--js-crimson);
  color: #ffffff;
  border: none;
  padding: 0.65rem 1.8rem;
  border-radius: var(--radius-pill);
  font-size: 0.9rem;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 2px 10px rgba(230, 57, 70, 0.3);
}

.fc-rating-buttons {
  display: flex;
  gap: 0.5rem;
  width: 100%;
}

.rating-btn {
  flex: 1;
  border: 1px solid var(--border-color);
  padding: 0.6rem 0.5rem;
  border-radius: var(--radius-md);
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}

.rating-btn.again { background: rgba(239, 68, 68, 0.12); color: #ef4444; border-color: rgba(239, 68, 68, 0.3); }
.rating-btn.hard { background: rgba(244, 162, 97, 0.12); color: #F4A261; border-color: rgba(244, 162, 97, 0.3); }
.rating-btn.good { background: rgba(96, 165, 250, 0.12); color: #60a5fa; border-color: rgba(96, 165, 250, 0.3); }
.rating-btn.easy { background: rgba(42, 157, 143, 0.12); color: #2A9D8F; border-color: rgba(42, 157, 143, 0.3); }

/* --- 5. QUIZ ARENA VIEW --- */
.quiz-view-layout {
  max-width: 680px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.quiz-header-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
}

.quiz-header-row h2 {
  font-size: 1.35rem;
  font-weight: 800;
  color: var(--text-primary);
}

.quiz-header-row p {
  font-size: 0.82rem;
  color: var(--text-muted);
}

.quiz-mode-tabs {
  display: flex;
  background: var(--bg-subtle);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-pill);
  padding: 3px;
}

.quiz-tab-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  padding: 0.35rem 0.75rem;
  border-radius: var(--radius-pill);
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}

.quiz-tab-btn.active {
  background: var(--bg-card);
  color: var(--text-primary);
  box-shadow: var(--shadow-sm);
}

.quiz-hud-bar {
  display: flex;
  justify-content: space-around;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 0.75rem 1rem;
}

.hud-item {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.hud-label {
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-muted);
}

.hud-val {
  font-size: 1.1rem;
  font-weight: 800;
  color: var(--text-primary);
}

.hud-val.highlight {
  color: var(--js-crimson);
}

.quiz-card-box {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xl);
  padding: 2rem;
  box-shadow: var(--shadow-md);
  text-align: center;
}

.q-prompt-text {
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 1.25rem;
}

.q-hero-glyph-wrapper {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 1.5rem;
}

.q-hero-glyph {
  font-family: var(--font-cjk);
  font-size: 4.5rem;
  font-weight: 800;
  color: var(--text-primary);
  line-height: 1;
}

.q-audio-btn {
  position: absolute;
  right: -36px;
  bottom: 8px;
  background: var(--bg-subtle);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  width: 32px;
  height: 32px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 0.85rem;
}

.q-options-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
}

.q-option-btn {
  background: var(--bg-subtle);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 0.85rem 1rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  color: var(--text-primary);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
  text-align: left;
}

.q-option-btn:hover {
  background: var(--bg-card-hover);
  border-color: var(--js-crimson);
}

.opt-num {
  font-size: 0.75rem;
  color: var(--text-muted);
  background: var(--bg-card);
  width: 20px;
  height: 20px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.q-option-btn.correct {
  background: rgba(42, 157, 143, 0.15);
  border-color: #2A9D8F;
  color: #2A9D8F;
}

.q-option-btn.incorrect {
  background: rgba(239, 68, 68, 0.15);
  border-color: #ef4444;
  color: #ef4444;
}

.q-feedback-banner {
  margin-top: 1.25rem;
  border-radius: var(--radius-md);
  padding: 0.85rem 1rem;
}

.fb-success { color: #2A9D8F; font-size: 0.9rem; }
.fb-error { color: #ef4444; font-size: 0.9rem; }
.fb-note { color: var(--text-secondary); font-size: 0.82rem; margin-top: 0.35rem; }

.quiz-action-bar {
  display: flex;
  justify-content: center;
}

/* --- 6. RADICALS MATRIX VIEW --- */
.radicals-view-layout {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.radicals-header-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
}

.radicals-header-row h2 {
  font-size: 1.35rem;
  font-weight: 800;
  color: var(--text-primary);
}

.radicals-header-row p {
  font-size: 0.82rem;
  color: var(--text-muted);
}

.radicals-filters-row {
  display: flex;
  gap: 0.65rem;
}

.rad-positions-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.pos-legend-pill {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  padding: 0.3rem 0.65rem;
  border-radius: var(--radius-pill);
  font-size: 0.72rem;
  color: var(--text-secondary);
}

.rad-stroke-group {
  margin-bottom: 1.5rem;
}

.rad-stroke-title {
  font-size: 0.84rem;
  font-weight: 700;
  color: var(--js-crimson);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 0.65rem;
}

.rad-tiles-row {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 0.5rem;
}

.rad-card-tile {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 0.65rem 0.75rem;
  display: flex;
  align-items: center;
  gap: 0.65rem;
  cursor: pointer;
  transition: all 0.15s ease;
  text-align: left;
}

.rad-card-tile:hover {
  background: var(--bg-card-hover);
  border-color: var(--js-crimson);
}

.rad-tile-sym {
  font-family: var(--font-cjk);
  font-size: 1.4rem;
  font-weight: 800;
  color: var(--text-primary);
}

.rad-tile-name {
  display: block;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text-primary);
}

.rad-tile-meaning {
  display: block;
  font-size: 0.68rem;
  color: var(--text-muted);
}

/* --- 7. PROGRESS DASHBOARD VIEW --- */
.progress-view-layout {
  max-width: 860px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.prog-header h2 {
  font-size: 1.4rem;
  font-weight: 800;
  color: var(--text-primary);
}

.prog-header p {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
}

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

.kpi-label {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  margin-bottom: 0.35rem;
}

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

.kpi-sub {
  font-size: 0.72rem;
  color: var(--text-muted);
  margin-top: 0.25rem;
}

.kpi-card.accent-green .kpi-val { color: #2A9D8F; }
.kpi-card.accent-blue .kpi-val { color: #60a5fa; }
.kpi-card.accent-pink .kpi-val { color: var(--js-crimson); }

.prog-section-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xl);
  padding: 1.5rem;
  box-shadow: var(--shadow-sm);
}

.prog-section-card h3 {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 1rem;
}

.milestone-row {
  margin-bottom: 1rem;
}

.milestone-info {
  display: flex;
  justify-content: space-between;
  font-size: 0.85rem;
  margin-bottom: 0.35rem;
}

.prog-bar-track {
  height: 6px;
  background: var(--bg-subtle);
  border-radius: var(--radius-pill);
  overflow: hidden;
}

.prog-bar-fill {
  height: 100%;
  border-radius: var(--radius-pill);
}

.fill-green { background: #2A9D8F; }
.fill-blue { background: #60a5fa; }

.bookmarks-tray {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.bookmark-chip {
  background: var(--bg-subtle);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 0.45rem 0.75rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--text-primary);
  cursor: pointer;
  transition: all 0.15s ease;
}

.bookmark-chip:hover {
  border-color: var(--js-amber);
}

.bm-glyph {
  font-family: var(--font-cjk);
  font-weight: 700;
  font-size: 1.1rem;
}

.bm-meaning {
  font-size: 0.75rem;
  color: var(--text-secondary);
}

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

.backup-actions-row {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.file-input-label {
  cursor: pointer;
}

.hidden-file-input {
  display: none;
}

@media (max-width: 768px) {
  .view-mindmap-layout {
    grid-template-columns: 1fr;
    height: auto;
  }
  .mindmap-graph-area {
    height: 450px;
  }
  .kpi-grid {
    grid-template-columns: 1fr 1fr;
  }
  .q-options-grid {
    grid-template-columns: 1fr;
  }
}

/* --- TOPICS FILTER STRIP --- */
.topics-filter-strip {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  overflow-x: auto;
  padding-bottom: 0.35rem;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}

.topics-filter-strip::-webkit-scrollbar {
  display: none;
}

.topic-chip {
  background: var(--bg-subtle);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  padding: 0.35rem 0.85rem;
  border-radius: var(--radius-pill);
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s ease;
  flex-shrink: 0;
}

.topic-chip:hover {
  background: var(--bg-card-hover);
  color: var(--text-primary);
}

.topic-chip.active {
  background: rgba(230, 57, 70, 0.15);
  border-color: var(--js-crimson);
  color: var(--js-crimson);
}

/* --- SINGLES VS JOINTS TOGGLE --- */
.view-mode-toggle {
  display: flex;
  background: var(--bg-subtle);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-pill);
  padding: 2px;
}

.mode-toggle-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  padding: 0.35rem 0.75rem;
  border-radius: var(--radius-pill);
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}

.mode-toggle-btn.active {
  background: var(--bg-card);
  color: var(--text-primary);
  box-shadow: var(--shadow-sm);
}

/* --- GROUPED JOINTS (COMPOUNDS) GRID --- */
.kanji-joints-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 1.25rem;
  margin-top: 1.25rem;
}

.joint-group-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xl);
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  box-shadow: var(--shadow-sm);
  transition: all 0.2s ease;
}

.joint-group-card:hover {
  border-color: rgba(230, 57, 70, 0.3);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.joint-head {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding-bottom: 0.85rem;
  border-bottom: 1px solid var(--border-subtle);
  cursor: pointer;
}

.joint-head-glyph {
  width: 52px;
  height: 52px;
  background: var(--bg-subtle);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-cjk);
  font-size: 2.2rem;
  font-weight: 800;
  color: var(--js-crimson);
  line-height: 1;
}

.joint-head-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-primary);
}

.joint-head-meta {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 0.2rem;
}

.joint-words-list {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.joint-word-item {
  background: var(--bg-subtle);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 0.65rem 0.85rem;
}

.jw-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.2rem;
}

.jw-word {
  font-family: var(--font-cjk);
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-primary);
}

.jw-reading {
  font-size: 0.82rem;
  color: #60a5fa;
  font-weight: 600;
}

.jw-meaning {
  font-size: 0.82rem;
  color: var(--text-secondary);
}

/* --- MOBILE SPECIFIC ENHANCEMENTS --- */
@media (max-width: 640px) {
  .app-header .header-inner {
    padding: 0.5rem 0.75rem;
    gap: 0.75rem;
  }
  
  .brand-title {
    font-size: 0.95rem;
  }
  
  .brand-kanji-sub {
    font-size: 0.68rem;
  }

  .header-search-box {
    display: none; /* Accessible in Explorer tab */
  }

  .filter-controls-row {
    flex-direction: column;
    align-items: stretch;
    gap: 0.6rem;
  }

  .view-mindmap-layout {
    grid-template-columns: 1fr;
    height: auto;
  }

  .mindmap-graph-area {
    height: 400px;
  }

  .flashcard-scene {
    height: 320px;
  }

  .fc-hero-glyph {
    font-size: 4rem;
  }

  .fc-meaning-hero {
    font-size: 1.5rem;
  }

  .modal-dialog {
    max-height: 95vh;
    border-radius: var(--radius-lg);
  }

  .modal-body-scroll {
    padding: 1rem;
  }

  .modal-header-hero {
    padding: 1rem;
  }

  .hero-glyph-box {
    width: 64px;
    height: 64px;
  }

  .hero-glyph {
    font-size: 2.5rem;
  }

  .kpi-grid {
    grid-template-columns: 1fr 1fr;
  }
}

/* --- LEVEL PILLS STRIP --- */
.level-pills-strip {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  overflow-x: auto;
  padding-bottom: 0.25rem;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}

.level-pills-strip::-webkit-scrollbar {
  display: none;
}

.level-pill {
  background: var(--bg-subtle);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  padding: 0.4rem 0.9rem;
  border-radius: var(--radius-pill);
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s ease;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex-shrink: 0;
}

.level-pill:hover {
  background: var(--bg-card-hover);
  color: var(--text-primary);
}

.level-pill.active {
  background: var(--js-crimson);
  border-color: var(--js-crimson);
  color: #ffffff;
  box-shadow: 0 2px 8px rgba(230, 57, 70, 0.35);
}

.level-pill .pill-badge {
  background: rgba(255, 255, 255, 0.18);
  font-size: 0.7rem;
  padding: 1px 6px;
  border-radius: var(--radius-pill);
  font-weight: 600;
}

.level-pill:not(.active) .pill-badge {
  background: var(--bg-surface);
  color: var(--text-muted);
}
