:root {
  --bg: #151a17;
  --bg-elevated: #1b211e;
  --card: #222a26;
  --card-hover: #2a332e;
  --border: #2e3833;
  --text: #f3f5f4;
  --text-muted: #9aa59f;
  --accent: #e85b73;
  --accent-soft: #3a2428;
  --progress-track: #2a332e;
  --correct: #3dcc7a;
  --correct-bg: rgba(61, 204, 122, 0.16);
  --correct-border: #3dcc7a;
  --wrong: #ef5b6e;
  --wrong-bg: rgba(239, 91, 110, 0.16);
  --wrong-border: #ef5b6e;
  --btn: #3ee07a;
  --btn-pressed: #33c86b;
  --btn-text: #0c1a10;
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.28);
  --radius: 18px;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-top: env(safe-area-inset-top, 0px);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Noto Sans",
    "Noto Sans Greek", "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}

body {
  min-height: 100dvh;
}

button {
  font: inherit;
  color: inherit;
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
}

button:disabled {
  cursor: default;
}

button:focus-visible {
  outline: 2px solid var(--btn);
  outline-offset: 3px;
}

#app {
  min-height: 100dvh;
}

.shell {
  width: min(520px, 100%);
  margin: 0 auto;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  padding: calc(12px + var(--safe-top)) 20px calc(20px + var(--safe-bottom));
}

.shell.has-cta {
  padding-bottom: calc(96px + var(--safe-bottom));
}

/* —— Top bar —— */
.top {
  display: flex;
  align-items: center;
  gap: 14px;
  min-height: 44px;
  margin-bottom: 22px;
}

.icon-btn {
  flex: 0 0 auto;
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: var(--text-muted);
}

.icon-btn:hover {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text);
}

.icon-btn svg {
  width: 18px;
  height: 18px;
  display: block;
}

.progress {
  flex: 1;
  display: flex;
  gap: 10px;
  align-items: center;
  min-width: 0;
}

.progress-bar {
  flex: 1;
  display: flex;
  gap: 5px;
  align-items: center;
  min-width: 0;
}

.seg {
  flex: 1;
  height: 8px;
  min-width: 8px;
  border-radius: 99px;
  background: var(--progress-track);
}

.seg.is-correct {
  background: var(--correct);
}

.seg.is-wrong {
  background: var(--wrong);
}

.seg.is-current {
  height: 10px;
  box-shadow: 0 0 0 2px rgba(243, 245, 244, 0.88);
}

.progress-count {
  flex: 0 0 auto;
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: -0.02em;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

/* —— Screens —— */
.main {
  flex: 1;
  display: flex;
  flex-direction: column;
}

.question {
  margin: 0 0 28px;
  font-size: clamp(26px, 7vw, 34px);
  font-weight: 800;
  letter-spacing: -0.035em;
  line-height: 1.2;
}

.options {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.option {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  text-align: left;
  background: var(--card);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 16px 16px 18px;
  min-height: 64px;
  transition: background 0.15s ease, border-color 0.15s ease, opacity 0.15s ease, transform 0.08s ease;
}

.option:not(:disabled):hover {
  background: var(--card-hover);
}

.option:not(:disabled):active {
  transform: scale(0.985);
}

.option-text {
  flex: 1;
  font-size: 17px;
  font-weight: 600;
  line-height: 1.35;
}

.option-mark {
  flex: 0 0 auto;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: none;
  place-items: center;
}

.option-mark svg {
  width: 14px;
  height: 14px;
  display: block;
}

.shell.is-locked .option {
  cursor: default;
}

.option.is-correct {
  background: var(--correct-bg);
  border-color: var(--correct-border);
}

.option.is-correct .option-mark {
  display: grid;
  background: var(--correct);
  color: #072010;
}

.option.is-wrong {
  background: var(--wrong-bg);
  border-color: var(--wrong-border);
}

.option.is-wrong .option-mark {
  display: grid;
  background: var(--wrong);
  color: #fff;
}

.option.is-dim {
  opacity: 0.38;
}

/* —— Feedback card —— */
.feedback {
  margin-top: 20px;
  animation: rise 0.22s ease;
}

.feedback-card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 16px 18px 18px;
  border: 1px solid var(--border);
}

.feedback-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}

.feedback-icon {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
}

.feedback-icon svg {
  width: 14px;
  height: 14px;
  display: block;
}

.feedback-card.is-correct .feedback-icon {
  background: var(--correct);
  color: #072010;
}

.feedback-card.is-wrong .feedback-icon {
  background: var(--wrong);
  color: #fff;
}

.feedback-title {
  font-size: 20px;
  font-weight: 800;
  letter-spacing: -0.03em;
}

.feedback-card.is-correct .feedback-title {
  color: var(--correct);
}

.feedback-card.is-wrong .feedback-title {
  color: var(--wrong);
}

.feedback-text {
  margin: 0;
  color: var(--text);
  font-size: 16px;
  line-height: 1.45;
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

/* —— Continue —— */
.bottom {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  bottom: 0;
  width: min(520px, 100%);
  padding: 12px 20px calc(16px + var(--safe-bottom));
  background: linear-gradient(to top, var(--bg) 70%, rgba(21, 26, 23, 0));
}

.btn-continue,
.btn-primary,
.btn-secondary {
  width: 100%;
  height: 56px;
  border-radius: 16px;
  font-size: 18px;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.btn-continue,
.btn-primary {
  background: var(--btn);
  color: var(--btn-text);
}

.btn-continue:active,
.btn-primary:active {
  background: var(--btn-pressed);
}

.btn-secondary {
  background: transparent;
  color: var(--text);
  border: 2px solid var(--border);
  margin-top: 10px;
}

.btn-secondary:active {
  background: var(--card);
}

.btn-secondary:disabled {
  opacity: 0.35;
}

/* —— Start & result —— */
.brand {
  margin: 12px 0 6px;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.screen-title {
  margin: 0 0 8px;
  font-size: clamp(28px, 8vw, 36px);
  font-weight: 800;
  letter-spacing: -0.04em;
  line-height: 1.15;
}

.screen-sub {
  margin: 0 0 24px;
  color: var(--text-muted);
  font-size: 16px;
  line-height: 1.4;
}

.test-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.test-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  text-align: left;
  background: var(--card);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 18px;
}

.test-card:hover {
  background: var(--card-hover);
}

.test-card.is-all {
  border-color: rgba(62, 224, 122, 0.45);
  background: rgba(62, 224, 122, 0.08);
}

.test-card-title {
  display: block;
  font-size: 17px;
  font-weight: 700;
  line-height: 1.3;
}

.test-card-meta {
  display: block;
  margin-top: 4px;
  color: var(--text-muted);
  font-size: 13px;
}

.test-card-arrow {
  color: var(--text-muted);
  font-size: 22px;
  line-height: 1;
}

.score-block {
  margin: 24px 0 32px;
  text-align: center;
}

.score-value {
  font-size: clamp(56px, 16vw, 80px);
  font-weight: 800;
  letter-spacing: -0.05em;
  line-height: 1;
}

.score-label {
  margin-top: 8px;
  color: var(--text-muted);
  font-size: 16px;
}

.error {
  margin: 24px 0;
  padding: 16px;
  border-radius: var(--radius);
  background: var(--wrong-bg);
  color: var(--text);
}

/* —— Start screen extras —— */
.mode-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 22px;
}

.section-label {
  margin: 8px 0 10px;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.progress-meta {
  display: block;
  margin-top: 6px;
  color: var(--text-muted);
  font-size: 13px;
  line-height: 1.45;
}

.progress-meta .is-learned {
  color: var(--correct);
}

.progress-meta .is-mistakes {
  color: var(--wrong);
}

.bar {
  display: flex;
  height: 6px;
  border-radius: 99px;
  background: var(--progress-track);
  overflow: hidden;
  margin-top: 10px;
  gap: 0;
}

.bar span {
  display: block;
  height: 100%;
}

.bar .bar-learned {
  background: var(--correct);
}

.bar .bar-answered {
  background: #6b756f;
}

.tools {
  margin-top: auto;
  padding-top: 28px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.tool-btn {
  background: transparent;
  color: var(--text-muted);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 10px 14px;
  font-size: 14px;
  font-weight: 650;
}

.tool-btn:hover {
  color: var(--text);
  background: var(--card);
}

.tool-btn.is-danger:hover {
  color: var(--wrong);
  border-color: var(--wrong);
}

/* —— Feedback stats / learned —— */
.feedback-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 14px;
  flex-wrap: wrap;
}

.stats-line {
  color: var(--text-muted);
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.02em;
  white-space: nowrap;
}

.stats-line .ok {
  color: var(--correct);
}

.stats-line .bad {
  color: var(--wrong);
}

.learn-btn {
  border-radius: 999px;
  padding: 8px 14px;
  font-size: 14px;
  font-weight: 700;
  border: 1.5px solid var(--border);
  color: var(--text-muted);
  background: transparent;
}

.learn-btn.is-on {
  border-color: var(--correct);
  background: var(--correct-bg);
  color: var(--correct);
}

/* —— Review list —— */
.review-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding-bottom: 24px;
}

.review-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 16px 14px;
}

.review-card.is-learned {
  border-color: rgba(61, 204, 122, 0.35);
}

.review-q {
  margin: 0 0 8px;
  font-size: 17px;
  font-weight: 750;
  letter-spacing: -0.02em;
  line-height: 1.35;
}

.review-source {
  margin: 0 0 8px;
  color: var(--text-muted);
  font-size: 12px;
}

.review-answer {
  margin: 0 0 8px;
  font-size: 15px;
  line-height: 1.4;
}

.review-answer strong {
  color: var(--correct);
  font-weight: 750;
}

.review-expl {
  margin: 0;
  font-size: 15px;
  line-height: 1.45;
  color: var(--text);
}

.empty {
  color: var(--text-muted);
  font-size: 16px;
  line-height: 1.45;
}

.hidden-file {
  display: none;
}

.test-card:disabled {
  opacity: 0.45;
  cursor: default;
}
