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

body {
  font-family: 'Segoe UI', system-ui, sans-serif;
  background: #0f1117;
  color: #e8eaf0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

h1 {
  font-size: 1.4rem;
  font-weight: 300;
  letter-spacing: 0.15em;
  color: #7c85a6;
  text-transform: uppercase;
  margin-bottom: 32px;
}

/* When splash is showing: full-bleed, no padding */
body:has(#home-view.active) > h1 {
  display: none;
}
body:has(#home-view.active) {
  padding: 0;
  justify-content: stretch;
}
body:has(#home-view.active) #sync-controls {
  display: none;
}

/* ── Views ── */
#import-view,
#home-view,
#level-view,
#main-view,
#session-end,
#grammar-menu-view,
#grammar-list-view,
#grammar-lesson-view,
#conjugation-view,
#pokedex-view,
#ai-exam-view {
  display: none;
  flex-direction: column;
  align-items: center;
  width: 100%;
}
#import-view.active,
#home-view.active,
#level-view.active,
#main-view.active,
#session-end.active,
#grammar-menu-view.active,
#grammar-list-view.active,
#grammar-lesson-view.active,
#conjugation-view.active,
#pokedex-view.active,
#ai-exam-view.active {
  display: flex;
}

/* ── Import screen ── */
#import-view {
  gap: 20px;
  max-width: 480px;
  text-align: center;
}

.import-box {
  width: 100%;
  border: 2px dashed #252a3d;
  border-radius: 16px;
  padding: 48px 32px;
  cursor: pointer;
  transition:
    border-color 0.2s,
    background 0.2s;
  background: #181c2a;
}

.import-box:hover,
.import-box.drag-over {
  border-color: #4f7cff;
  background: #1a2040;
}

.import-box p {
  color: #4a5170;
  font-size: 0.9rem;
  line-height: 1.8;
}
.import-box .import-icon {
  font-size: 2.5rem;
  margin-bottom: 12px;
  opacity: 0.4;
}
.import-box strong {
  color: #7c85a6;
}
#file-input {
  display: none;
}

.import-status {
  font-size: 0.85rem;
  color: #4a5170;
  min-height: 20px;
}
.import-status.error {
  color: #c0394f;
}
.import-status.success {
  color: #22a55a;
}

.detected-fields {
  font-size: 0.78rem;
  color: #4a5170;
  background: #181c2a;
  border: 1px solid #252a3d;
  border-radius: 10px;
  padding: 10px 16px;
  text-align: left;
  line-height: 1.8;
  max-width: 480px;
  width: 100%;
}
.detected-fields .found {
  color: #22a55a;
}
.detected-fields .missing {
  color: #5a4040;
}

.btn-skip {
  background: none;
  border: none;
  color: #3a4060;
  font-size: 0.8rem;
  cursor: pointer;
  text-decoration: underline;
  padding: 4px;
}
.btn-skip:hover {
  color: #5a6080;
}

/* ── Level select screen ── */
#level-view {
  max-width: 1000px;
  gap: 24px;
}

.level-tabs {
  display: flex;
  gap: 0;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid #252a3d;
}

.level-tab-btn {
  padding: 10px 28px;
  background: #181c2a;
  border: none;
  color: #4a5170;
  font-size: 0.85rem;
  cursor: pointer;
  letter-spacing: 0.06em;
  transition: all 0.2s;
}
.level-tab-btn.active {
  background: #2a3060;
  color: #a0b4ff;
}

.level-panels {
  width: 100%;
}
.level-panel {
  display: none;
}
.level-panel.active {
  display: block;
}

/* ── Scroll row container ── */
.scroll-row {
  position: relative;
  width: 100%;
  overflow: visible;
}

.scroll-row-track {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  overflow-y: visible;
  scrollbar-width: none;
  -ms-overflow-style: none;
  padding: 22px 0;
  margin: -22px 0;
}
.scroll-row-track::-webkit-scrollbar {
  display: none;
}

.scroll-btn {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 36px;
  z-index: 2;
  border: none;
  color: #7c85a6;
  font-size: 1.4rem;
  cursor: pointer;
  transition: opacity 0.3s;
  display: flex;
  align-items: center;
  justify-content: center;
}
.scroll-btn--left {
  left: 0;
  background: linear-gradient(to right, #0f1117, rgba(15, 17, 23, 0.05));
  padding-right: 8px;
}
.scroll-btn--right {
  right: 0;
  background: linear-gradient(to left, #0f1117, rgba(15, 17, 23, 0.05));
  padding-left: 8px;
}
.scroll-btn:hover {
  color: #a0b4ff;
}
.scroll-btn.hidden {
  opacity: 0;
  pointer-events: none;
}

.level-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 10px;
  width: 100%;
}

.level-tile {
  background: #181c2a;
  border: 1px solid #252a3d;
  border-radius: 12px;
  padding: 14px 12px;
  cursor: pointer;
  transition:
    border-color 0.2s,
    background 0.2s,
    box-shadow 0.2s,
    transform 0.15s;
  position: relative;
  min-height: 90px;
  min-width: 160px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.level-tile:hover:not(.locked) {
  transform: translateY(-1px);
  filter: brightness(1.12);
}

.level-tile.locked {
  cursor: default;
  opacity: 0.45;
}

.level-tile-title {
  font-size: 0.78rem;
  font-weight: 600;
  color: #7c85a6;
  letter-spacing: 0.06em;
  text-transform: capitalize;
}

.level-tile-range {
  font-size: 0.68rem;
  color: #3a4060;
}

.level-tile-progress {
  font-size: 0.68rem;
  color: #4a5170;
  margin-top: auto;
}

.level-tile-bar {
  height: 2px;
  background: #1e2130;
  border-radius: 2px;
  overflow: hidden;
}

.level-tile-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, #4f7cff, #a78bfa);
  border-radius: 2px;
  transition: width 0.4s ease;
}

.tile-counts {
  display: flex;
  gap: 5px;
  justify-content: center;
  margin-top: 5px;
  min-height: 18px;
}
.tile-counts span {
  font-size: 0.72rem;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 8px;
  line-height: 1.4;
}
.tc-new {
  background: #1a3a6e;
  color: #6aabff;
}
.tc-learning {
  background: #4a1a1a;
  color: #ff8c69;
}
.tc-due {
  background: #0d3320;
  color: #4cde8a;
}

.level-lock-icon {
  position: absolute;
  top: 10px;
  right: 10px;
  font-size: 0.7rem;
  opacity: 0.4;
}

/* ── Thematic section ── */
.thematic-section {
  width: 100%;
}

.thematic-heading {
  font-size: 0.8rem;
  font-weight: 400;
  color: #4a5170;
  letter-spacing: 0.06em;
  margin-bottom: 10px;
}

.thematic-tile {
  background: #181c2a;
  border: 1px solid #252a3d;
  border-radius: 12px;
  padding: 14px 12px;
  cursor: pointer;
  transition:
    border-color 0.2s,
    background 0.2s,
    box-shadow 0.2s,
    transform 0.15s;
  min-width: 160px;
  min-height: 90px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
  text-align: center;
  align-items: center;
}

.thematic-tile:hover {
  transform: translateY(-1px);
  filter: brightness(1.12);
}

.thematic-tile-icon {
  font-size: 1.2rem;
  line-height: 1;
}

.thematic-tile-title {
  font-size: 0.78rem;
  font-weight: 600;
  color: #7c85a6;
  letter-spacing: 0.06em;
}


.dir-select {
  display: flex;
  gap: 0;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid #252a3d;
}
.dir-select button {
  padding: 6px 14px;
  background: #181c2a;
  border: none;
  color: #4a5170;
  font-size: 0.78rem;
  cursor: pointer;
  transition: all 0.2s;
  letter-spacing: 0.04em;
}
.dir-select button.active {
  background: #2a3060;
  color: #a0b4ff;
}

.btn-practice {
  padding: 8px 20px;
  background: linear-gradient(135deg, #2a3060, #3a4170);
  border: 1px solid #3a4170;
  border-radius: 8px;
  color: #a0b4ff;
  font-size: 0.82rem;
  cursor: pointer;
  transition: all 0.2s;
  letter-spacing: 0.04em;
}
.btn-practice:hover {
  background: linear-gradient(135deg, #3a4060, #4a5280);
}

/* ── Progress bar (session) ── */
/* Anki-style queue counts: new + learning + review */
.queue-counts {
  font-size: 0.85rem;
  color: #6b7194;
  text-align: center;
  max-width: 480px;
  width: 100%;
  margin-bottom: 28px;
  letter-spacing: 0.5px;
}
.count-new {
  color: #4f9fff;
}
.count-learn {
  color: #d4915e;
}
.count-review {
  color: #5fbf7f;
}
.count-current {
  text-decoration: underline;
}

/* ── Card ── */
.scene {
  width: 480px;
  max-width: 100%;
  perspective: 1200px;
  cursor: pointer;
  margin-bottom: 28px;
  position: relative;
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
}

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

.card.flipped {
  transform: rotateY(180deg);
}

.card-face {
  position: absolute;
  width: 100%;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  border-radius: 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  padding: 32px;
  gap: 12px;
  transition:
    border-color 0.3s,
    box-shadow 0.3s;
}

/* front face sets scene height */
.card-front {
  position: relative;
  background: #181c2a;
  border: 1px solid #252a3d;
  box-shadow: 0 8px 40px rgba(0, 0, 0, 0.4);
  min-height: 280px;
  justify-content: center;
}

.card-back {
  background: #181c2a;
  border: 1px solid #2d3255;
  box-shadow: 0 8px 40px rgba(0, 0, 0, 0.4);
  transform: rotateY(180deg);
  top: 0;
  min-height: 280px;
  justify-content: flex-start;
  padding-top: 80px;
}

.card-lang {
  font-size: 0.7rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #4f7cff;
  font-weight: 500;
}

.card-word {
  font-size: 2.4rem;
  font-weight: 300;
  color: #e8eaf0;
  text-align: center;
  line-height: 1.2;
}

.card-hint {
  font-size: 0.75rem;
  color: #3a4060;
  margin-top: 8px;
}

.card-type-badge {
  position: absolute;
  top: 10px;
  right: 12px;
  font-size: 0.62rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 2px 7px;
  border-radius: 6px;
}
.card-type-badge.new-card {
  background: #1a3a6e;
  color: #6aabff;
}
.card-type-badge.learning-card {
  background: #3a2a10;
  color: #e0a040;
}
.card-type-badge.review-card {
  background: #0d3320;
  color: #4cde8a;
}
.card-type-badge.relearning-card {
  background: #3a1a1a;
  color: #ff8c69;
}
.card-type-badge.leech-card {
  background: #3a1a2a;
  color: #ff6b9d;
}

.card-answer-label {
  font-size: 0.7rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #5a4a8a;
  font-weight: 500;
}

.card-answer {
  font-size: 2rem;
  font-weight: 400;
  color: #a78bfa;
  text-align: center;
}

/* Sentence section on card back */
.card-sentence-area {
  width: 100%;
  margin-top: 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  min-height: 0;
}

.sentence-gr {
  font-size: 0.9rem;
  color: #6b7499;
  text-align: center;
  line-height: 1.6;
  opacity: 0;
  transform: translateY(4px);
  transition:
    opacity 0.3s ease,
    transform 0.3s ease;
}
.sentence-gr.visible {
  opacity: 1;
  transform: translateY(0);
}

.sentence-en {
  font-size: 0.78rem;
  color: #4a5170;
  text-align: center;
  font-style: italic;
  opacity: 0;
  transform: translateY(4px);
  transition:
    opacity 0.3s ease,
    transform 0.3s ease;
}
.sentence-en.visible {
  opacity: 1;
  transform: translateY(0);
}

/* Frequency badge */
.freq-badge {
  position: absolute;
  bottom: 12px;
  right: 14px;
  font-size: 0.7rem;
  font-weight: 600;
  opacity: 0.85;
  letter-spacing: 0.03em;
}

/* Keyboard hint */
.kbd-hint {
  font-size: 0.7rem;
  color: #252a3d;
  text-align: center;
  max-width: 480px;
  width: 100%;
  margin-top: -16px;
  margin-bottom: 12px;
  transition: opacity 0.5s;
  letter-spacing: 0.04em;
}

/* Buttons */
.btn-row {
  display: flex;
  gap: 16px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease 0.2s;
}
.btn-row.visible {
  opacity: 1;
  pointer-events: all;
}

button {
  padding: 12px 36px;
  border: none;
  border-radius: 10px;
  font-size: 0.95rem;
  font-weight: 500;
  cursor: pointer;
  transition:
    transform 0.15s,
    box-shadow 0.15s;
  letter-spacing: 0.03em;
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
}
button:active {
  transform: scale(0.97);
}

.btn-again,
.btn-hard,
.btn-good,
.btn-easy {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 10px 20px;
  min-width: 64px;
}

.btn-interval {
  font-size: 0.65rem;
  font-weight: 400;
  opacity: 0.7;
}

.btn-again {
  background: #2a1520;
  color: #e88;
  border: 1px solid #3a2030;
}
.btn-again:hover {
  background: #351a28;
}

.btn-hard {
  background: #1e1e2a;
  color: #b0a0c0;
  border: 1px solid #2a2a3d;
}
.btn-hard:hover {
  background: #28283a;
}

.btn-good {
  background: #152a1a;
  color: #6c6;
  border: 1px solid #203a28;
}
.btn-good:hover {
  background: #1a351f;
}

.btn-easy {
  background: #1a2040;
  color: #8af;
  border: 1px solid #253060;
}
.btn-easy:hover {
  background: #202850;
}

.btn-back-session {
  position: fixed;
  top: 16px;
  left: 16px;
  background: none;
  border: none;
  color: #3a4060;
  font-size: 0.8rem;
  cursor: pointer;
  padding: 4px 8px;
  z-index: 100;
  transition: color 0.2s;
}
.btn-back-session:hover {
  color: #7c85a6;
}

.btn-back-to-levels {
  background: linear-gradient(135deg, #2a2f4a, #3a4170);
  color: #a0aacc;
  padding: 10px 28px;
  border-radius: 10px;
  border: 1px solid #3a4170;
  font-size: 0.85rem;
  cursor: pointer;
  letter-spacing: 0.04em;
  margin-top: 4px;
}
.btn-back-to-levels:hover {
  background: linear-gradient(135deg, #3a4060, #4a5280);
}

/* Session end */
#session-end {
  gap: 20px;
  text-align: center;
}
#session-end h2 {
  font-size: 1.6rem;
  font-weight: 300;
  color: #a78bfa;
}
.session-stats {
  font-size: 0.9rem;
  color: #5a6080;
  line-height: 1.8;
}
.session-stats span {
  color: #e8eaf0;
  font-weight: 500;
}

.btn-restart {
  background: linear-gradient(135deg, #2a2f4a, #3a4170);
  color: #a0aacc;
  padding: 12px 40px;
  border-radius: 10px;
  border: 1px solid #3a4170;
  font-size: 0.9rem;
  cursor: pointer;
  letter-spacing: 0.05em;
}
.btn-restart:hover {
  background: linear-gradient(135deg, #3a4060, #4a5280);
}

/* ── Loading spinner ── */
.spinner {
  width: 32px;
  height: 32px;
  border: 3px solid #1e2130;
  border-top-color: #4f7cff;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin: 0 auto;
}
@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* ── Audio controls (fixed bottom-right) ── */
#audio-controls {
  position: fixed;
  bottom: 20px;
  right: 20px;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
  z-index: 100;
}

#btn-speaker {
  width: 36px;
  height: 36px;
  background: none;
  border: none;
  font-size: 1.1rem;
  cursor: pointer;
  opacity: 0.2;
  transition: opacity 0.3s;
  padding: 0;
  border-radius: 50%;
}
#btn-speaker:hover,
#btn-speaker.active {
  opacity: 1;
}

#volume-popover {
  background: #181c2a;
  border: 1px solid #252a3d;
  border-radius: 10px;
  padding: 12px 14px;
  display: none;
  min-width: 160px;
}
#volume-popover.open {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
#volume-slider,
#speed-slider {
  width: 100%;
  accent-color: #4f7cff;
}

.popover-label {
  font-size: 0.65rem;
  color: #4a5170;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.voice-select {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
}
.voice-select button {
  padding: 5px 4px;
  background: #0f1117;
  border: 1px solid #252a3d;
  border-radius: 6px;
  color: #4a5170;
  font-size: 0.68rem;
  cursor: pointer;
  transition: all 0.15s;
  min-width: 0;
}
.voice-select button.active {
  background: #2a3060;
  color: #a0b4ff;
  border-color: #3a4a80;
}
.voice-select button:hover:not(.active) {
  background: #1a1f30;
  color: #7c85a6;
}

.popover-replay-btns {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  margin-top: 4px;
}
.popover-replay-btns button {
  padding: 6px 4px;
  background: #0f1117;
  border: 1px solid #252a3d;
  border-radius: 6px;
  color: #7c85a6;
  font-size: 0.68rem;
  cursor: pointer;
  transition: all 0.15s;
}
.popover-replay-btns button:active {
  background: #2a3060;
  color: #a0b4ff;
}

.ai-next-btn {
  margin-top: 12px;
  width: 100%;
}

/* ═══════════════════════════════════════════════════════════════════════════════
   HOME SPLASH
   ═══════════════════════════════════════════════════════════════════════════════ */
#home-view {
  max-width: none;
  width: 100%;
  gap: 0;
  flex: 1;
  position: relative;
}

/* ── Canvas container ─────────────────────────────────────────────────────── */
.splash-canvas {
  position: relative;
  width: 100%;
  flex: 1;
  min-height: 0;
  border-radius: 0;
  overflow: hidden;
  user-select: none;
}

.splash-bg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  pointer-events: none;
  filter: brightness(0.85);
}

/* ── Trapezium zones (clip-path) ──────────────────────────────────────────── */
/* Diagonal: 53 % at top → 47 % at bottom                                     */
.splash-zone {
  position: absolute;
  inset: 0;
  cursor: pointer;
  display: flex;
  align-items: center;
  transition:
    filter 0.45s ease,
    opacity 0.45s ease;
}

.splash-zone--left {
  clip-path: polygon(0 0, 53% 0, 47% 100%, 0 100%);
  justify-content: flex-start;
  padding-left: 8%;
}
.splash-zone--right {
  clip-path: polygon(53% 0, 100% 0, 100% 100%, 47% 100%);
  justify-content: flex-end;
  padding-right: 8%;
}

/* Each zone gets its own copy of the painting so filters are independent     */
.splash-zone::before {
  content: '';
  position: absolute;
  inset: 0;
  background: url('../_The_School_of_Athens__by_Raffaello_Sanzio_da_Urbino.png') center / cover no-repeat;
  transition: filter 0.45s ease;
  z-index: 0;
}
@media (max-width: 800px) {
  .splash-zone::before {
    background-image: url('../image.png');
  }
  .splash-bg {
    content: url('../image.png');
  }
}

/* ── Hover states ─────────────────────────────────────────────────────────── */
/* Default: both sides normal                                                  */
.splash-zone::before {
  filter: brightness(0.85);
}

/* Hovered side: lifted, bright                                                */
.splash-zone:hover::before {
  filter: brightness(0.95);
}
.splash-zone:hover {
  z-index: 2;
  box-shadow: inset 0 0 60px rgba(255, 255, 255, 0.08);
}

/* When one side is hovered, darken + blur the OTHER side                      */
.splash-canvas:has(.splash-zone--right:hover) .splash-zone--left::before {
  filter: brightness(0.45) blur(2px);
}
.splash-canvas:has(.splash-zone--left:hover) .splash-zone--right::before {
  filter: brightness(0.45) blur(2px);
}

/* ── Diagonal divider line ────────────────────────────────────────────────── */
.splash-divider {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 3;
  /* SVG line from (53%, 0) to (47%, 100%)                                     */
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='100%25' height='100%25' preserveAspectRatio='none' viewBox='0 0 100 100'%3E%3Cline x1='53' y1='0' x2='47' y2='100' stroke='rgba(255,255,255,0.12)' stroke-width='0.25'/%3E%3C/svg%3E");
  background-size: 100% 100%;
}

/* ── Labels ────────────────────────────────────────────────────────────────── */
.splash-zone-label {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  text-shadow:
    0 2px 16px rgba(0, 0, 0, 0.85),
    0 0 40px rgba(0, 0, 0, 0.6);
  transition:
    transform 0.35s ease,
    opacity 0.35s ease;
}
.splash-zone:hover .splash-zone-label {
  transform: scale(1.05);
}

.splash-title {
  font-family: 'Libertinus Serif Display', Georgia, 'Times New Roman', serif;
  font-weight: 400;
  font-size: clamp(1.6rem, 5vw, 5.5rem);
  color: #fff;
  letter-spacing: 0.04em;
}

.splash-sub {
  font-family: 'Libertinus Serif Display', Georgia, 'Times New Roman', serif;
  font-weight: 400;
  font-size: clamp(0.8rem, 1.6vw, 1.15rem);
  color: rgba(255, 255, 255, 0.7);
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

/* Greek-only toggle — floats over bottom of painting */
#home-view > .home-toggle {
  position: absolute;
  bottom: 12px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 4;
}
.home-toggle {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  padding: 6px 12px;
  border-radius: 8px;
  transition: background 0.2s;
}
.home-toggle:hover {
  background: rgba(24, 28, 42, 0.7);
}

.toggle-track {
  width: 36px;
  height: 20px;
  background: #252a3d;
  border-radius: 10px;
  position: relative;
  transition: background 0.2s;
}
.home-toggle.active .toggle-track {
  background: #4f7cff;
}

.toggle-thumb {
  width: 16px;
  height: 16px;
  background: #e8eaf0;
  border-radius: 50%;
  position: absolute;
  top: 2px;
  left: 2px;
  transition: left 0.2s;
}
.home-toggle.active .toggle-thumb {
  left: 18px;
}

.toggle-label {
  font-size: 0.78rem;
  color: #4a5170;
  letter-spacing: 0.04em;
}

/* ═══════════════════════════════════════════════════════════════════════════════
   GRAMMAR MENU
   ═══════════════════════════════════════════════════════════════════════════════ */
#grammar-menu-view {
  max-width: 600px;
  gap: 24px;
  padding-top: 40px;
}

.grammar-menu-panels {
  display: flex;
  gap: 20px;
  width: 100%;
}

.grammar-menu-card {
  flex: 1;
  background: #181c2a;
  border: 1px solid #252a3d;
  border-radius: 14px;
  padding: 36px 20px;
  cursor: pointer;
  transition:
    transform 0.2s,
    border-color 0.2s;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  text-align: center;
}
.grammar-menu-card:hover {
  transform: translateY(-3px);
  border-color: #3a4a80;
}

.gmc-icon {
  font-size: 2rem;
  opacity: 0.7;
}
.gmc-title {
  font-size: 1.1rem;
  color: #e8eaf0;
  font-weight: 400;
}
.gmc-sub {
  font-size: 0.72rem;
  color: #4a5170;
}

/* ═══════════════════════════════════════════════════════════════════════════════
   GRAMMAR LESSON LIST
   ═══════════════════════════════════════════════════════════════════════════════ */
#grammar-list-view {
  max-width: 600px;
  gap: 16px;
  padding-top: 40px;
}

.grammar-heading {
  font-size: 1.3rem;
  font-weight: 300;
  color: #a78bfa;
  letter-spacing: 0.08em;
  margin-bottom: 8px;
}

.grammar-list {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.grammar-lesson-card {
  display: flex;
  align-items: center;
  gap: 14px;
  background: #181c2a;
  border: 1px solid #252a3d;
  border-radius: 12px;
  padding: 14px 16px;
  cursor: pointer;
  transition:
    border-color 0.2s,
    transform 0.15s;
  position: relative;
}
.grammar-lesson-card:hover:not(.empty) {
  border-color: #3a4a80;
  transform: translateX(3px);
}
.grammar-lesson-card.empty {
  opacity: 0.4;
  cursor: default;
}
.grammar-lesson-card.completed {
  border-color: #1a3a2a;
}

.glc-number {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: #252a3d;
  color: #7c85a6;
  font-size: 0.8rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.grammar-lesson-card.completed .glc-number {
  background: #1a3a2a;
  color: #4cde8a;
}

.glc-body {
  flex: 1;
  min-width: 0;
}
.glc-title {
  font-size: 0.9rem;
  color: #e8eaf0;
  margin-bottom: 2px;
}
.glc-desc {
  font-size: 0.72rem;
  color: #4a5170;
}
.glc-progress {
  font-size: 0.65rem;
  color: #3a4060;
  margin-top: 3px;
}
.glc-check {
  color: #4cde8a;
  font-size: 1.1rem;
  font-weight: 700;
}
.glc-badge {
  font-size: 0.62rem;
  color: #4a5170;
  background: #252a3d;
  padding: 2px 8px;
  border-radius: 6px;
  letter-spacing: 0.04em;
}

/* ═══════════════════════════════════════════════════════════════════════════════
   GRAMMAR LESSON CONTENT
   ═══════════════════════════════════════════════════════════════════════════════ */
#grammar-lesson-view {
  max-width: 640px;
  gap: 16px;
  padding-top: 40px;
}

.lesson-content {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.lesson-title {
  font-size: 1.3rem;
  font-weight: 300;
  color: #a78bfa;
  letter-spacing: 0.06em;
}

.lesson-text {
  font-size: 0.88rem;
  color: #b0b8d0;
  line-height: 1.7;
}

.lesson-table-wrap {
  overflow-x: auto;
}

.grammar-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.82rem;
}
.grammar-table th {
  background: #1a2040;
  color: #7c85a6;
  padding: 8px 12px;
  text-align: left;
  font-weight: 500;
  font-size: 0.72rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  border-bottom: 1px solid #252a3d;
}
.grammar-table td {
  padding: 8px 12px;
  border-bottom: 1px solid #1e2130;
  color: #e8eaf0;
}
.grammar-table td.row-header {
  color: #7c85a6;
  font-weight: 500;
}
.grammar-table tr:hover td {
  background: #1a1f30;
}

/* Exercises */
.exercise-block {
  background: #181c2a;
  border: 1px solid #252a3d;
  border-radius: 12px;
  padding: 16px;
}
.exercise-block.answered {
  pointer-events: none;
}

.ex-label {
  font-size: 0.7rem;
  color: #4a5170;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin-bottom: 6px;
}

.ex-prompt {
  font-size: 1rem;
  color: #e8eaf0;
  margin-bottom: 12px;
  line-height: 1.5;
}

.ex-options {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.ex-option {
  padding: 8px 18px;
  background: #252a3d;
  border: 1px solid #3a4060;
  border-radius: 8px;
  color: #b0b8d0;
  font-size: 0.85rem;
  cursor: pointer;
  transition: all 0.15s;
}
.ex-option:hover {
  background: #2a3050;
  border-color: #4a5a80;
}
.ex-option.correct {
  background: #1a3a2a;
  border-color: #2a5a3a;
  color: #4cde8a;
}
.ex-option.wrong {
  background: #3a1a1a;
  border-color: #5a2a2a;
  color: #ff8c69;
}

.ex-feedback {
  font-size: 0.8rem;
  margin-top: 10px;
  min-height: 20px;
}
.ex-feedback.correct {
  color: #4cde8a;
}
.ex-feedback.wrong {
  color: #ff8c69;
}

/* ═══════════════════════════════════════════════════════════════════════════════
   CONJUGATION DRILLS
   ═══════════════════════════════════════════════════════════════════════════════ */
#conjugation-view {
  max-width: 480px;
  gap: 20px;
  padding-top: 40px;
}

.conj-header {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.conj-mode-toggle {
  display: flex;
  gap: 0;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid #252a3d;
}
.conj-mode-toggle button {
  padding: 6px 14px;
  background: #181c2a;
  border: none;
  color: #4a5170;
  font-size: 0.75rem;
  cursor: pointer;
  transition: all 0.2s;
  letter-spacing: 0.04em;
}
.conj-mode-toggle button.active {
  background: #2a3060;
  color: #a0b4ff;
}

.conj-progress {
  font-size: 0.8rem;
  color: #4a5170;
}

.conj-card {
  background: #181c2a;
  border: 1px solid #252a3d;
  border-radius: 16px;
  padding: 32px;
  width: 100%;
  text-align: center;
  min-height: 160px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.conj-verb {
  font-size: 2rem;
  font-weight: 300;
  color: #e8eaf0;
}
.conj-verb-en {
  font-size: 0.8rem;
  color: #4a5170;
}
.conj-person {
  font-size: 1.2rem;
  color: #a78bfa;
  margin-top: 8px;
  font-weight: 400;
}

.conj-input {
  width: 100%;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
}

.conj-text-input {
  width: 100%;
  padding: 12px 16px;
  background: #0f1117;
  border: 1px solid #252a3d;
  border-radius: 10px;
  color: #e8eaf0;
  font-size: 1.1rem;
  text-align: center;
  outline: none;
  transition: border-color 0.2s;
}
.conj-text-input:focus {
  border-color: #4f7cff;
}
.conj-text-input.correct {
  border-color: #2a5a3a;
  background: #0a1a10;
}
.conj-text-input.wrong {
  border-color: #5a2a2a;
  background: #1a0a0a;
}

.conj-mc-btn {
  flex: 1 1 calc(50% - 4px);
  padding: 12px 16px;
  background: #252a3d;
  border: 1px solid #3a4060;
  border-radius: 10px;
  color: #b0b8d0;
  font-size: 0.95rem;
  cursor: pointer;
  transition: all 0.15s;
  min-width: 120px;
}
.conj-mc-btn:hover {
  background: #2a3050;
  border-color: #4a5a80;
}
.conj-mc-btn.correct {
  background: #1a3a2a;
  border-color: #2a5a3a;
  color: #4cde8a;
}
.conj-mc-btn.wrong {
  background: #3a1a1a;
  border-color: #5a2a2a;
  color: #ff8c69;
}
.conj-mc-btn:disabled {
  cursor: default;
  opacity: 0.7;
}

.conj-submit {
  padding: 10px 28px;
  background: linear-gradient(135deg, #2a3060, #3a4170);
  border: 1px solid #3a4170;
  border-radius: 10px;
  color: #a0b4ff;
  font-size: 0.85rem;
  cursor: pointer;
  letter-spacing: 0.04em;
  transition: all 0.2s;
}
.conj-submit:hover {
  background: linear-gradient(135deg, #3a4060, #4a5280);
}
.conj-submit.secondary {
  background: #181c2a;
  color: #4a5170;
  border-color: #252a3d;
}

.conj-feedback {
  font-size: 0.9rem;
  min-height: 24px;
  text-align: center;
}
.conj-feedback.correct {
  color: #4cde8a;
}
.conj-feedback.wrong {
  color: #ff8c69;
}

.conj-end-title {
  font-size: 1.1rem;
  color: #7c85a6;
  letter-spacing: 0.08em;
}
.conj-end-score {
  font-size: 2.5rem;
  font-weight: 300;
  color: #e8eaf0;
}
.conj-end-pct {
  font-size: 1rem;
  color: #a78bfa;
}



/* ═══════════════════════════════════════════════════════════════════════════════
   POKEDEX (VOCABULARY BROWSER)
   ═══════════════════════════════════════════════════════════════════════════════ */
#pokedex-view {
  max-width: 1200px;
  gap: 12px;
  padding-top: 40px;
  width: 100%;
}

.pdex-toolbar {
  display: flex;
  align-items: center;
  gap: 16px;
  width: 100%;
}

.pdex-search-wrap {
  flex: 1;
  position: relative;
  display: flex;
  align-items: center;
}

.pdex-search {
  width: 100%;
  padding: 8px 32px 8px 14px;
  background: #0f1117;
  border: 1px solid #252a3d;
  border-radius: 8px;
  color: #e8eaf0;
  font-size: 0.85rem;
  outline: none;
  transition: border-color 0.2s;
}
.pdex-search:focus {
  border-color: #4f7cff;
}
.pdex-search::placeholder {
  color: #3a4060;
}

.pdex-search-clear {
  position: absolute;
  right: 6px;
  background: none;
  border: none;
  color: #4a5170;
  font-size: 1.1rem;
  cursor: pointer;
  padding: 2px 6px;
  line-height: 1;
  border-radius: 4px;
  transition: color 0.15s;
}
.pdex-search-clear:hover {
  color: #e8eaf0;
}
.pdex-search-clear.hidden {
  display: none;
}

.pdex-controls {
  display: flex;
  align-items: center;
  gap: 16px;
  width: 100%;
}

.pdex-practice {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.pdex-practice-label {
  font-size: 0.72rem;
  color: #4a5170;
}

.pdex-row-input {
  width: 52px;
  padding: 5px 6px;
  background: #0f1117;
  border: 1px solid #252a3d;
  border-radius: 8px;
  color: #e8eaf0;
  font-size: 0.8rem;
  text-align: center;
}

.pdex-count {
  font-size: 0.72rem;
  color: #4a5170;
  text-align: right;
  width: 100%;
}

.pdex-table-wrap {
  width: 100%;
  overflow-x: auto;
  overflow-y: auto;
  max-height: calc(100vh - 260px);
  border: 1px solid #252a3d;
  border-radius: 12px;
  background: #181c2a;
  scrollbar-width: thin;
  scrollbar-color: #252a3d #0f1117;
}
.pdex-table-wrap::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
.pdex-table-wrap::-webkit-scrollbar-track {
  background: #0f1117;
  border-radius: 4px;
}
.pdex-table-wrap::-webkit-scrollbar-thumb {
  background: #252a3d;
  border-radius: 4px;
}
.pdex-table-wrap::-webkit-scrollbar-thumb:hover {
  background: #3a4060;
}
.pdex-table-wrap::-webkit-scrollbar-corner {
  background: #0f1117;
}

.pdex-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.78rem;
}

.pdex-table thead {
  position: sticky;
  top: 0;
  z-index: 2;
}

.pdex-table th {
  background: #1a2040;
  color: #7c85a6;
  padding: 8px 10px;
  text-align: left;
  font-weight: 500;
  font-size: 0.68rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  border-bottom: 1px solid #252a3d;
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
  transition: color 0.15s;
}
.pdex-table th:hover {
  color: #a0b4ff;
}
.pdex-table th.no-sort {
  cursor: default;
}
.pdex-table th.no-sort:hover {
  color: #7c85a6;
}

.pdex-sort-arrow {
  margin-left: 4px;
  font-size: 0.6rem;
  color: #4f7cff;
}

.pdex-table td {
  padding: 6px 10px;
  border-bottom: 1px solid #1e2130;
  color: #e8eaf0;
  vertical-align: middle;
}

.pdex-table:not(.heatmap-on) tbody tr:hover td {
  background: #1a1f30;
}
.pdex-table.heatmap-on tbody tr:hover td {
  filter: brightness(1.15);
}

.pdex-play-btn {
  background: none;
  border: none;
  color: #4a5170;
  cursor: pointer;
  font-size: 0.72rem;
  padding: 2px 4px;
  border-radius: 4px;
  transition:
    color 0.15s,
    background 0.15s;
  flex-shrink: 0;
  min-width: 0;
}
.pdex-play-btn:hover {
  color: #a0b4ff;
  background: rgba(79, 124, 255, 0.1);
}

.pdex-cell-audio {
  display: flex;
  align-items: center;
  gap: 4px;
}

.pdex-unseen {
  color: #3a4060;
}

.pdex-table td.pdex-sentence {
  max-width: 260px;
  white-space: normal;
  font-size: 0.74rem;
  line-height: 1.4;
}

.btn-pokedex {
  padding: 10px 24px;
  background: linear-gradient(135deg, #1a2040, #252a50);
  border: 1px solid #3a4170;
  border-radius: 10px;
  color: #a0b4ff;
  font-size: 0.85rem;
  cursor: pointer;
  transition: all 0.2s;
  letter-spacing: 0.04em;
  margin-top: 8px;
}
.btn-pokedex:hover {
  background: linear-gradient(135deg, #252a50, #3a4170);
  border-color: #4f7cff;
}

/* Pagination */
.pdex-pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  width: 100%;
  padding: 4px 0;
}

.pdex-page-btn {
  background: #181c2a;
  border: 1px solid #252a3d;
  border-radius: 6px;
  color: #7c85a6;
  font-size: 1rem;
  cursor: pointer;
  padding: 4px 12px;
  transition: all 0.15s;
  line-height: 1;
}
.pdex-page-btn:hover:not(:disabled) {
  background: #252a3d;
  color: #a0b4ff;
}
.pdex-page-btn:disabled {
  opacity: 0.3;
  cursor: default;
}

.pdex-page-info {
  font-size: 0.72rem;
  color: #4a5170;
  letter-spacing: 0.04em;
  min-width: 80px;
  text-align: center;
}

.pdex-per-page {
  background: #0f1117;
  border: 1px solid #252a3d;
  border-radius: 6px;
  color: #7c85a6;
  font-size: 0.72rem;
  padding: 4px 8px;
  cursor: pointer;
  outline: none;
}
.pdex-per-page option {
  background: #0f1117;
  color: #e8eaf0;
}

@media (max-width: 700px) {
  .pdex-col-sentence-gr,
  .pdex-col-sentence-en,
  .pdex-col-desktop {
    display: none;
  }
  .pdex-toolbar {
    flex-direction: column;
    gap: 8px;
  }
  .pdex-search-wrap {
    width: 100%;
  }
  #pdex-dir-select {
    width: 100%;
    display: flex;
  }
  #pdex-dir-select button {
    flex: 1;
  }
  .pdex-controls {
    flex-wrap: wrap;
  }
  .pdex-table {
    font-size: 0.72rem;
  }
  .pdex-table th,
  .pdex-table td {
    padding: 5px 6px;
  }
}

/* ═══════════════════════════════════════════════════════════════════════════════
   WORD TOOLTIPS
   ═══════════════════════════════════════════════════════════════════════════════ */
.gw {
  position: relative;
  cursor: help;
  border-bottom: 1px dotted #4a5170;
  transition: color 0.15s;
}
.gw:hover {
  color: #a78bfa;
}

.gw::after {
  content: attr(data-en);
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%);
  background: #252a3d;
  color: #e8eaf0;
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 0.72rem;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.15s;
  z-index: 200;
  margin-bottom: 4px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
}
.gw:hover::after {
  opacity: 1;
}

/* Show gender/info if data-info exists */
.gw[data-info]::after {
  content: attr(data-en) ' · ' attr(data-info);
}

/* ═══════════════════════════════════════════════════════════════════════════════
   RESPONSIVE
   ═══════════════════════════════════════════════════════════════════════════════ */
@media (max-width: 500px) {
  .grammar-menu-panels {
    flex-direction: column;
  }
  .scroll-btn {
    width: 28px;
    font-size: 1.1rem;
  }
  .level-tile,
  .thematic-tile {
    min-width: 140px;
  }
}

/* ═══════════════════════════════════════════════════════════════════════════════
   SNACKBAR
   ═══════════════════════════════════════════════════════════════════════════════ */
.snackbar {
  position: fixed;
  bottom: -60px;
  left: 50%;
  transform: translateX(-50%);
  padding: 10px 24px;
  border-radius: 8px;
  font-size: 0.85rem;
  color: #e8eaf0;
  background: #252a3d;
  z-index: 9999;
  transition: bottom 0.3s ease;
  white-space: nowrap;
  max-width: 90vw;
  text-align: center;
}
.snackbar.show {
  bottom: 32px;
}
.snackbar-success {
  background: #1a3a1a;
  border: 1px solid #2e7d32;
}
.snackbar-error {
  background: #3a1a1a;
  border: 1px solid #c62828;
}
.snackbar-warn {
  background: #3a2e1a;
  border: 1px solid #e68a00;
}
.snackbar-info {
  background: #252a3d;
  border: 1px solid #3a4060;
}

/* ═══════════════════════════════════════════════════════════════════════════════
   SYNC CONFIRM MODAL
   ═══════════════════════════════════════════════════════════════════════════════ */
.sync-modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  z-index: 9998;
  align-items: center;
  justify-content: center;
}
.sync-modal-overlay.active {
  display: flex;
}
.sync-modal {
  background: #1a1e2e;
  border: 1px solid #252a3d;
  border-radius: 12px;
  padding: 24px 32px;
  text-align: center;
  max-width: 320px;
}
.sync-modal p {
  margin-bottom: 16px;
  font-size: 0.95rem;
}
.sync-modal-btns {
  display: flex;
  gap: 12px;
  justify-content: center;
}

/* ═══════════════════════════════════════════════════════════════════════════════
   SYNC CONTROLS (fixed bottom-left widget)
   ═══════════════════════════════════════════════════════════════════════════════ */
#sync-controls {
  position: fixed;
  bottom: 16px;
  left: 16px;
  z-index: 100;
}
#btn-sync {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 1px solid #252a3d;
  background: #0F1117;
  color: #7c85a6;
  font-size: 1.2rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}
@media (hover: hover) {
  #btn-sync:hover {
    border-color: #3a4060;
    color: #e8eaf0;
  }
}
#sync-popover {
  display: none;
  position: absolute;
  bottom: 48px;
  left: 0;
  background: #1a1e2e;
  border: 1px solid #252a3d;
  border-radius: 10px;
  padding: 12px;
  width: 200px;
}
#sync-popover.open {
  display: block;
}
.sync-popover-btns {
  display: flex;
  gap: 8px;
  margin-bottom: 10px;
}
.sync-popover-btns button {
  flex: 1;
  font-size: 0.8rem;
  padding: 6px 0;
}
.sync-config-fields label {
  display: block;
  font-size: 0.7rem;
  color: #5a6080;
  margin-bottom: 2px;
}
.sync-config-fields input {
  width: 100%;
  padding: 4px 8px;
  border-radius: 5px;
  border: 1px solid #252a3d;
  background: #0f1117;
  color: #e8eaf0;
  font-size: 0.78rem;
  margin-bottom: 6px;
}
.sync-config-actions {
  display: flex;
  gap: 6px;
  margin-top: 4px;
}
.sync-config-actions button {
  flex: 1;
  font-size: 0.75rem;
  padding: 4px 0;
}

@media (max-width: 500px) {
  #sync-controls {
    bottom: 10px;
    left: 10px;
  }
  #btn-sync {
    width: 34px;
    height: 34px;
    font-size: 1rem;
  }
  #sync-popover {
    bottom: 42px;
    width: 180px;
    padding: 10px;
  }
}

/* ═══════════════════════════════════════════════════════════════════════════════
   AI EXAM (Claude-powered)
   ═══════════════════════════════════════════════════════════════════════════════ */
#ai-exam-view {
  max-width: 540px;
  gap: 16px;
  padding-top: 40px;
}

.ai-exam-setup {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  padding: 20px 0;
}

.ai-exam-title {
  font-size: 1.2rem;
  font-weight: 300;
  color: #7c85a6;
  letter-spacing: 0.08em;
}

.ai-exam-mode-select {
  display: flex;
  gap: 0;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid #252a3d;
}

.ai-mode-btn {
  padding: 8px 16px;
  background: #181c2a;
  border: none;
  color: #7c85a6;
  font-size: 0.8rem;
  cursor: pointer;
  transition: all 0.2s;
  letter-spacing: 0.04em;
}
.ai-mode-btn.active {
  background: #2a3060;
  color: #a0b4ff;
}

.ai-exam-desc {
  font-size: 0.82rem;
  color: #4a5170;
  text-align: center;
}

.ai-exam-start-btn {
  padding: 10px 32px;
  font-size: 0.9rem;
}

.ai-exam-key-status {
  font-size: 0.72rem;
  color: #5a2a2a;
}

/* Question area */
.ai-exam-question {
  width: 100%;
  max-width: 540px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}

.ai-exam-progress {
  font-size: 0.8rem;
  color: #4a5170;
  align-self: flex-end;
}

.ai-exam-prompt {
  font-size: 1.15rem;
  line-height: 1.7;
  color: #e8eaf0;
  text-align: center;
}

.ai-exam-input-area {
  width: 100%;
  display: flex;
  gap: 8px;
  justify-content: center;
}

.ai-exam-expected {
  font-size: 0.82rem;
  color: #4a5170;
  text-align: center;
  min-height: 20px;
}

/* Badge-based sentence construction */
.ai-construct-built {
  background: #141722;
  border: 1px dashed #252a3d;
  border-radius: 10px;
  min-height: 50px;
  width: 100%;
  padding: 12px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: center;
  align-items: center;
}

.ai-construct-badges {
  width: 100%;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  padding: 8px 0;
}

.ai-badge {
  padding: 8px 14px;
  background: #1e2338;
  border: 1px solid #353b58;
  border-radius: 20px;
  color: #c8cce0;
  font-size: 0.9rem;
  cursor: pointer;
  transition: all 0.15s;
  user-select: none;
}
.ai-badge:hover {
  background: #2a3050;
  border-color: #4a5a80;
}
.ai-badge.used {
  opacity: 0.3;
  cursor: default;
  pointer-events: none;
}
.ai-badge.placed {
  background: #2a3060;
  border-color: #4f7cff;
  color: #a0b4ff;
}
.ai-badge.correct-badge {
  background: #1a3a2a;
  border-color: #2a5a3a;
  color: #4cde8a;
}
.ai-badge.wrong-badge {
  background: #3a1a1a;
  border-color: #5a2a2a;
  color: #ff8c69;
}

.ai-construct-actions {
  display: flex;
  gap: 8px;
  justify-content: center;
}

/* Loading spinner */
.ai-exam-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  padding: 40px 0;
  color: #4a5170;
}

.ai-loading-spinner {
  width: 32px;
  height: 32px;
  border: 3px solid #252a3d;
  border-top-color: #4f7cff;
  border-radius: 50%;
  animation: ai-spin 0.8s linear infinite;
}

@keyframes ai-spin {
  to { transform: rotate(360deg); }
}

/* AI exam trigger button */
.ai-exam-trigger {
  background: linear-gradient(135deg, #2a2860, #3a3070) !important;
  border-color: #4a3a80 !important;
  color: #b0a0ff !important;
}
.ai-exam-trigger:hover {
  background: linear-gradient(135deg, #3a3870, #4a4090) !important;
}

@media (max-width: 500px) {
  .ai-exam-mode-select {
    flex-wrap: wrap;
    justify-content: center;
  }
  .ai-mode-btn {
    padding: 6px 12px;
    font-size: 0.75rem;
  }
  .ai-badge {
    padding: 6px 10px;
    font-size: 0.82rem;
  }
}
