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

:root {
  --bg:        #FFFFFF;
  --surface:   #F7F8FA;
  --card:      #FFFFFF;
  --ink:       #14181F;
  --tx:        #2C333D;
  --tx-2:      #5B6472;
  --tx-3:      #8A93A2;
  --br:        #F26A1B;
  --br-d:      #D9560C;
  --br-tint:   #FFF1E8;
  --deep:      #16202E;
  --ok:        #1F9D57;
  --ok-tint:   #E8F7EF;
  --err:       #D93025;
  --err-tint:  #FDE8E7;
  --ln:        #E7EAF0;
  --sh-sm: 0 1px 3px rgba(20,24,31,0.08);
  --sh-md: 0 4px 12px rgba(20,24,31,0.08);
  --r-s: 10px;
  --r-m: 16px;
  --r-l: 20px;
  --font-head: 'Manrope', system-ui, sans-serif;
  --font-body: 'Inter', system-ui, sans-serif;
}

html, body {
  height: 100%;
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.6;
  color: var(--tx);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  overscroll-behavior: none;
}

/* ── Screens ── */
.screen {
  display: none;
  flex-direction: column;
  min-height: 100vh;
  min-height: 100dvh;
}
.screen.active { display: flex; }

/* ── Start screen ── */
.start-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  flex: 1;
  padding: 40px 24px 32px;
  gap: 0;
}

.logo-mark {
  width: 64px;
  height: 64px;
  background: var(--br);
  border-radius: var(--r-m);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  color: #fff;
  font-weight: 800;
  margin-bottom: 24px;
  box-shadow: 0 8px 24px rgba(242,106,27,0.30);
}

.start-inner h1 {
  font-family: var(--font-head);
  font-size: 26px;
  font-weight: 800;
  color: var(--ink);
  line-height: 1.2;
  margin-bottom: 10px;
}

.subtitle {
  color: var(--tx-2);
  font-size: 14px;
  margin-bottom: 28px;
}

.course-meta {
  display: flex;
  gap: 12px;
  margin-bottom: 36px;
  flex-wrap: wrap;
  justify-content: center;
}

.meta-item {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--surface);
  border-radius: var(--r-s);
  padding: 8px 14px;
  font-size: 13px;
  font-weight: 500;
  color: var(--tx);
}

.meta-icon { font-size: 16px; }

.hint {
  color: var(--tx-3);
  font-size: 12px;
  margin-top: 16px;
}

/* ── Topbar + progress ── */
.topbar {
  padding: 16px 20px 12px;
  background: var(--bg);
  border-bottom: 1px solid var(--ln);
  position: sticky;
  top: 0;
  z-index: 10;
}

.progress-wrap {
  display: flex;
  align-items: center;
  gap: 12px;
}

.progress-bar {
  flex: 1;
  height: 5px;
  background: var(--ln);
  border-radius: 99px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: var(--br);
  border-radius: 99px;
  transition: width 0.4s ease;
  width: 0%;
}

.progress-label {
  font-size: 12px;
  color: var(--tx-3);
  white-space: nowrap;
  font-weight: 500;
}

/* ── Module content ── */
.module-content {
  flex: 1;
  padding: 24px 20px;
  overflow-y: auto;
}

.module-tag {
  display: inline-block;
  background: var(--br-tint);
  color: var(--br);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 4px 10px;
  border-radius: 99px;
  margin-bottom: 14px;
}

.module-content h2 {
  font-family: var(--font-head);
  font-size: 22px;
  font-weight: 800;
  color: var(--ink);
  line-height: 1.25;
  margin-bottom: 20px;
}

.module-content h3 {
  font-family: var(--font-head);
  font-size: 15px;
  font-weight: 700;
  color: var(--ink);
  margin: 24px 0 10px;
}

.module-content p {
  color: var(--tx);
  margin-bottom: 14px;
  font-size: 15px;
  line-height: 1.65;
}

.module-content ul, .module-content ol {
  padding-left: 20px;
  margin-bottom: 14px;
}

.module-content li {
  margin-bottom: 6px;
  color: var(--tx);
  line-height: 1.55;
}

.module-content strong { color: var(--ink); font-weight: 600; }

.tip-card {
  background: var(--br-tint);
  border-left: 3px solid var(--br);
  border-radius: 0 var(--r-s) var(--r-s) 0;
  padding: 14px 16px;
  margin: 20px 0;
}

.tip-card p { margin: 0; color: var(--tx); font-size: 14px; }

.tip-card strong { color: var(--br-d); }

/* ── Bottom bar ── */
.bottom-bar {
  padding: 16px 20px;
  background: var(--bg);
  border-top: 1px solid var(--ln);
}

/* ── Buttons ── */
.btn-primary {
  display: block;
  width: 100%;
  padding: 16px 24px;
  background: var(--br);
  color: #fff;
  font-family: var(--font-body);
  font-size: 15px;
  font-weight: 600;
  border: none;
  border-radius: var(--r-m);
  cursor: pointer;
  transition: background 0.15s, transform 0.1s, opacity 0.15s;
  letter-spacing: 0.01em;
}

.btn-primary:active { transform: scale(0.98); }
.btn-primary:hover { background: var(--br-d); }
.btn-primary:disabled { opacity: 0.4; cursor: not-allowed; transform: none; }

/* ── Quiz ── */
.quiz-content {
  flex: 1;
  padding: 24px 20px;
  overflow-y: auto;
}

.question-num {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--tx-3);
  margin-bottom: 12px;
}

.question-text {
  font-family: var(--font-head);
  font-size: 18px;
  font-weight: 700;
  color: var(--ink);
  line-height: 1.3;
  margin-bottom: 24px;
}

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

.option {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 16px;
  border: 2px solid var(--ln);
  border-radius: var(--r-m);
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
  background: var(--bg);
}

.option:active { transform: scale(0.99); }

.option.selected {
  border-color: var(--br);
  background: var(--br-tint);
}

.option.correct {
  border-color: var(--ok);
  background: var(--ok-tint);
}

.option.wrong {
  border-color: var(--err);
  background: var(--err-tint);
}

.option.disabled { cursor: default; pointer-events: none; }

.option-letter {
  width: 26px;
  height: 26px;
  min-width: 26px;
  border-radius: 50%;
  background: var(--surface);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  color: var(--tx-2);
  transition: background 0.15s, color 0.15s;
}

.option.selected .option-letter {
  background: var(--br);
  color: #fff;
}

.option.correct .option-letter {
  background: var(--ok);
  color: #fff;
}

.option.wrong .option-letter {
  background: var(--err);
  color: #fff;
}

.option-text {
  font-size: 14px;
  line-height: 1.5;
  color: var(--tx);
  padding-top: 3px;
}

.feedback-banner {
  margin-top: 16px;
  padding: 12px 16px;
  border-radius: var(--r-s);
  font-size: 14px;
  font-weight: 500;
  display: none;
}

.feedback-banner.show { display: block; }
.feedback-banner.ok { background: var(--ok-tint); color: var(--ok); }
.feedback-banner.fail { background: var(--err-tint); color: var(--err); }

/* ── Module result ── */
.result-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  flex: 1;
  padding: 40px 24px 40px;
  gap: 0;
}

.result-icon {
  font-size: 56px;
  margin-bottom: 20px;
}

.result-inner h2 {
  font-family: var(--font-head);
  font-size: 24px;
  font-weight: 800;
  color: var(--ink);
  margin-bottom: 10px;
}

.result-inner p {
  color: var(--tx-2);
  font-size: 15px;
  margin-bottom: 24px;
  max-width: 280px;
}

.score-badge {
  background: var(--surface);
  border-radius: var(--r-l);
  padding: 16px 32px;
  font-family: var(--font-head);
  font-size: 32px;
  font-weight: 800;
  color: var(--br);
  margin-bottom: 32px;
}

/* ── Final screen ── */
.final-score {
  background: var(--br);
  color: #fff;
  border-radius: var(--r-l);
  padding: 20px 40px;
  font-family: var(--font-head);
  font-size: 36px;
  font-weight: 800;
  margin-bottom: 20px;
  box-shadow: 0 8px 24px rgba(242,106,27,0.30);
}

.final-modules {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 32px;
}

.final-module-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  background: var(--surface);
  border-radius: var(--r-s);
  font-size: 13px;
}

.final-module-row .mod-name {
  color: var(--tx-2);
  flex: 1;
  text-align: left;
}

.final-module-row .mod-score {
  font-weight: 700;
  color: var(--ink);
  margin-left: 12px;
}

.final-module-row .mod-icon { margin-left: 6px; }
