@media (max-width: 600px) {
  .card.current {
    min-height: 70vh;
    max-height: none;
    padding: 10px 4px;
    font-size: 1.1rem;
    border-radius: 10px;
  }
  .reader.uix .stack {
    height: 70vh;
    min-height: 320px;
  }
  .reader.uix .card .meta {
    flex-direction: column;
    gap: 4px;
    font-size: 0.95rem;
  }
  .reader.uix .card .chain, .reader.uix .card .source {
    font-size: 0.95rem;
  }
  .nav-controls, .controls {
    gap: 6px;
  }
  button.primary {
    min-width: 38px;
    min-height: 38px;
    font-size: 1.2rem;
    padding: 8px 10px;
    margin-top: 4px;
  }
}
.actions {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--gap);
}
.actions .primary.nextLevel {
  font-size: 2.2rem;
  min-width: 64px;
  min-height: 64px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto;
}
/* Align .controls to the left */
.controls {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: var(--gap);
  margin-top: 16px;
}
.actions {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: var(--gap);
}
.actions button.restart {
  border: none !important;
  align-self: flex-start;
}
.primary.correct {
  border: 2px solid #10b981 !important;
}
.primary.incorrect {
  border: 2px solid #ef4444 !important;
}

.primary.nextLevel {
  /* remove border */
  border: none;
}
.controls button.primary {
  border: 1px solid #6b7280;
}

:root { --gap: 10px; }
* { box-sizing: border-box; }
body { margin: 0; font-family: system-ui, -apple-system, Segoe UI, Roboto, "Helvetica Neue", Arial; background: #f6f7fb; color: #111827; }
main { max-width: 1000px; margin: 24px auto; padding: 12px; }

/* Tabs */
.tabs { display:flex; gap:8px; margin-bottom:12px; }
.tabs button { padding:8px 12px; border-radius:8px; border:1px solid #e5e7eb; background:#fff; cursor:pointer; }
.tabs button.active { background:#111827; color:#fff; }

/* Shared card */
.card { border:1px solid #e5e7eb; border-radius:12px; padding:16px; background:#fff; box-shadow:0 1px 2px rgba(0,0,0,.04); }
/* .actions { margin-top:12px; display:flex; justify-content:flex-end; gap: var(--gap); } */
.nav-controls { display: flex; align-items: center; justify-content: center; gap: var(--gap); }
button.primary { background:#111827; color:white; border:none; border-radius:8px; padding:10px 14px; cursor:pointer; width: 40px; height: 40px; margin-top: 10px;}
button.primary:disabled { opacity:.55; cursor:not-allowed; }

/* Progress */
.bar { display:flex; justify-content:space-between; margin-bottom:12px; font-weight:600; }
.result { text-align:center; }
.result .scoreline { font-size: 1.2rem; margin: 10px 0 16px; }

/* Quiz */
.prompt { font-size:1.15rem; line-height:1.9; margin-bottom:8px; }
.prompt .mask { filter: blur(8px); transition: filter .15s ease; }
.prompt.revealed .mask { filter: none; }
/* .question.hint.controls { 
  display:flex;
  justify-content:space-between;
  background:#0b1220;
  border-color:#1f2937; 
} */
.controls button.primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
/* Reader UIX */
.reader.uix .topbar { display: flex; gap: 8px; align-items: center; margin-bottom: 12px; }
.reader.uix .topbar .search-input { flex: 1; padding: 8px; border:1px solid #e5e7eb; border-radius: 8px; }
.reader.uix .topbar .status-filter { padding: 8px; border:1px solid #e5e7eb; border-radius: 8px; min-width: 130px; }
.reader.uix .topbar .counter { font-weight: 600; min-width: 70px; text-align: right; }

.reader.uix .stack { position: relative; height: auto; min-height: 420px; touch-action: pan-y; display: flex; flex-direction: column; justify-content: flex-start; }
.reader.uix .card { position: static; width: 100%; padding: 16px; background: #fff; border: 1px solid #e5e7eb; border-radius: 14px; box-shadow: 0 10px 20px rgba(0,0,0,.06); transition: transform .2s ease, opacity .2s ease; display: flex; flex-direction: column; min-height: 0; }
.reader.uix .card .meta { display:flex; justify-content: space-between; align-items:center; color:#6b7280; margin-bottom: 8px; }
.reader.uix .card .meta .actions { display:flex; align-items:center; gap:8px; }
.reader.uix .card .meta .eye { border: 1px solid #e5e7eb; border-radius: 8px; padding: 6px 10px; background:#fff; cursor:pointer; }
.reader.uix .card .meta .memorized { border: 1px solid #e5e7eb71; border-radius: 8px; padding: 6px 10px; background:#111827; color:white; cursor:pointer; }

.reader.uix .card .chain { font-size: 0.95rem; color: #374151; margin: 4px 0 8px; }
.reader.uix .card .txt {  font-weight: 600; line-height: 1.7; margin: 0.25rem 0 0; }
.reader.uix .card .source { font-size: 0.95rem; color: #6b7280; margin-top: 8px; }

.reader.uix .card.prev   { align-items:center; transform: translateX(-10%) scale(.96); opacity: .55; z-index: 1; }
.reader.uix .card.current{ transform: translateX(0) scale(1);      opacity: 1;   z-index: 3; }
.reader.uix .card.next   { align-items:center; transform: translateX(10%)  scale(.96); opacity: .55; z-index: 2; }



/* Eye toggle hides text */
.reader.uix .card.hidden .txt { filter: blur(8px); }

@media (prefers-color-scheme: dark) {
  body { background: #0b1220; color:#e5e7eb; }
  .card { background:#111827; border-color:#1f2937; }
  .tabs button { background:#0b1220; color:#e5e7eb; border-color:#1f2937; }
  .tabs button.active { background:#2563eb; color:#fff; }
  .reader.uix .card { background: #111827; border-color: #1f2937; }
  .reader.uix .topbar .search-input, .reader.uix .topbar .status-filter {
    background: #0b1220; color: #e5e7eb; border-color:#1f2937;
  }
  .reader.uix .toggle-memo, .reader.uix .card .meta .eye { background:#0b1220; color:#e5e7eb; border-color:#1f2937; }
  .reader.uix .card .chain { color: #e5e7eb; }
  .reader.uix .card .source { color: #9ca3af; }
}


/* Memorization flag badge in header */
.reader.uix .card .mem-flag {
  color: #10b981;
  font-weight: 700;
  margin-inline-start: 8px;
}
.reader.uix .card.memorized { border-color: #10b981; box-shadow: 0 10px 24px rgba(16,185,129,.2); }
