:root {
  --blue-900: #0b3d6b;
  --blue-800: #103f6f;
  --blue-700: #14548f;
  --blue-600: #1a6bb5;
  --blue-100: #e8f1fa;
  --sky-300: #7dd3fc;
  --sky-400: #38bdf8;
  --sky-500: #0ea5e9;
  --grey-50: #f5f6f8;
  --grey-100: #eceef1;
  --grey-200: #dde1e6;
  --grey-400: #9aa2ad;
  --grey-600: #5c6570;
  --grey-800: #2b3138;
  --green-600: #1f9254;
  --green-100: #e4f7ec;
  --red-600: #d93636;
  --red-100: #fce9e9;
  --purple-600: #7b3fae;
  --purple-100: #f1e7fa;
  --white: #ffffff;
  --radius: 8px;
  --shadow-sm: 0 1px 3px rgba(20,30,50,0.08);
  --shadow-md: 0 4px 16px rgba(20,30,50,0.12);
  font-size: 15px;
}

* { box-sizing: border-box; }

[hidden] { display: none !important; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  font-family: "Segoe UI", -apple-system, BlinkMacSystemFont, Roboto, Arial, sans-serif;
  color: var(--grey-800);
  background: var(--grey-50);
}

button { font-family: inherit; cursor: pointer; }
input { font-family: inherit; }

.screen {
  min-height: 100vh;
  width: 100%;
}

/* ============ Buttons ============ */
.btn {
  border: none;
  border-radius: 6px;
  padding: 10px 18px;
  font-size: 14px;
  font-weight: 600;
  transition: filter 0.15s, transform 0.05s;
}
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-primary { background: var(--blue-700); color: white; }
.btn-primary:hover:not(:disabled) { filter: brightness(1.1); }
.btn-danger { background: var(--red-600); color: white; }
.btn-danger:hover { filter: brightness(1.1); }
.btn-ghost { background: transparent; color: var(--grey-600); border: 1px solid var(--grey-200); }
.btn-ghost:hover { background: var(--grey-100); }
.btn-outline { background: white; color: var(--grey-800); border: 1px solid var(--grey-200); }
.btn-outline:hover { background: var(--grey-100); }
.btn-outline-purple { background: white; color: var(--purple-600); border: 1px solid var(--purple-600); }
.btn-outline-purple:hover { background: var(--purple-100); }

/* ============ HOME ============ */
.home-header {
  background: linear-gradient(135deg, var(--blue-900), var(--sky-500));
  padding: 32px 40px;
  color: white;
}
.home-header-inner {
  display: flex; align-items: center; justify-content: space-between; gap: 20px;
  max-width: 1100px; margin: 0 auto;
}
.brand { display: flex; align-items: center; gap: 18px; }
.header-actions { flex-shrink: 0; }
.btn-header-login {
  background: rgba(255,255,255,0.15); border: 1px solid rgba(255,255,255,0.45);
  color: white; padding: 9px 20px; border-radius: 8px;
  font-weight: 700; font-size: 13px; cursor: pointer;
}
.btn-header-login:hover { background: rgba(255,255,255,0.28); }
.brand-logo {
  width: 56px; height: 56px; border-radius: 12px; flex-shrink: 0;
  background: rgba(255,255,255,0.15);
  display: flex; align-items: center; justify-content: center;
  border: 1px solid rgba(255,255,255,0.3);
}
.brand h1 { margin: 0; font-size: 26px; font-weight: 800; letter-spacing: 0.5px; }
.brand-pg { color: #ffffff; }
.brand-ascent { color: var(--sky-300); }
.brand-tagline {
  margin: 3px 0 0; font-size: 11.5px; font-weight: 700; letter-spacing: 0.8px;
  text-transform: uppercase; color: var(--sky-300);
}
.brand .sub { margin: 5px 0 0; opacity: 0.85; font-size: 14px; }

.tab-bar {
  background: white; border-bottom: 1px solid var(--grey-200);
  padding: 6px 40px; display: flex; align-items: center; justify-content: flex-end; gap: 18px;
}
.tab-buttons { display: flex; gap: 2px; }
.tab-btn {
  background: transparent; border: none; border-bottom: 3px solid transparent;
  padding: 9px 12px; font-size: 12.5px; font-weight: 700; color: var(--grey-600);
}
.tab-btn:hover { color: var(--blue-700); }
.tab-btn.active { color: var(--blue-800); border-bottom-color: var(--blue-700); }

.home-main { max-width: 1100px; margin: 0 auto; padding: 28px 40px 60px; }

.dash-hero-row {
  display: flex; align-items: stretch; gap: 20px; margin-bottom: 20px; flex-wrap: wrap;
}

.dash-hero-banner {
  flex: 1 1 400px; max-width: 560px;
  border-radius: 10px; overflow: hidden; line-height: 0;
  box-shadow: var(--shadow-sm);
}
.dash-hero-banner img { display: block; width: 100%; height: auto; }

.dash-performance-panel {
  flex: 1 1 400px; max-width: 560px;
  background: white; border: 1px solid var(--grey-200); border-radius: 10px;
  box-shadow: var(--shadow-sm); padding: 18px 20px;
  display: flex; flex-direction: column;
}
.dpp-header { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
.dpp-header h3 { margin: 0; font-size: 16px; color: var(--blue-800); }
.dpp-header-sub { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.4px; color: var(--sky-500); }

.dpp-summary {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 14px;
}
.dpp-stat {
  background: var(--blue-100); border-radius: 8px; padding: 10px 8px; text-align: center;
}
.dpp-stat-value { font-size: 18px; font-weight: 800; color: var(--blue-900); }
.dpp-stat-label { font-size: 10.5px; color: var(--grey-600); margin-top: 2px; text-transform: uppercase; letter-spacing: 0.3px; }

.dpp-list { flex: 1; display: flex; flex-direction: column; gap: 8px; overflow-y: auto; max-height: 210px; }
.dpp-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 8px 10px; border-radius: 7px; background: var(--grey-50);
  font-size: 12.5px;
}
.dpp-row-name { font-weight: 600; color: var(--grey-800); flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; padding-right: 8px; }
.dpp-row-metrics { display: flex; gap: 12px; flex-shrink: 0; }
.dpp-metric { text-align: right; }
.dpp-metric-value { font-weight: 700; color: var(--blue-800); }
.dpp-metric-label { font-size: 9.5px; color: var(--grey-600); text-transform: uppercase; }

.dpp-empty { color: var(--grey-600); font-size: 13px; padding: 16px 0; text-align: center; }
.dpp-note { font-size: 10.5px; color: var(--grey-400); margin: 12px 0 0; line-height: 1.4; }

@media (max-width: 700px) {
  .dash-hero-banner, .dash-performance-panel { flex: 1 1 100%; max-width: 100%; }
}

.dash-welcome h2 { color: var(--blue-800); margin-bottom: 4px; }
.dash-welcome p { color: var(--grey-600); margin: 0; }

.dash-resume-banner {
  display: flex; align-items: center; justify-content: space-between;
  background: linear-gradient(135deg, var(--blue-100), #f4f8fd);
  border: 1px solid var(--blue-100); border-radius: 10px;
  padding: 16px 20px; margin: 22px 0;
}
.drb-label { font-size: 11.5px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.4px; color: var(--blue-700); }
.drb-title { font-size: 16px; font-weight: 700; color: var(--blue-900); margin-top: 2px; }

.dash-quick-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 18px; margin-top: 24px;
}
.dash-quick-card {
  border-radius: 12px; padding: 22px 20px; color: white; cursor: pointer;
  box-shadow: var(--shadow-sm); transition: box-shadow 0.15s, transform 0.1s;
  display: flex; flex-direction: column; gap: 6px;
}
.dash-quick-card:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); }
.dqc-icon { font-size: 26px; }
.dqc-title { font-size: 16px; font-weight: 800; }
.dqc-desc { font-size: 12.5px; opacity: 0.9; }

.pattern-banner {
  display: flex; align-items: center; gap: 14px;
  background: var(--green-100); border: 1px solid var(--green-600);
  border-radius: 10px; padding: 14px 18px; margin-bottom: 18px;
}
.pattern-banner-icon { font-size: 22px; flex-shrink: 0; }
.pattern-banner-title { font-size: 14px; font-weight: 800; color: var(--green-600); }
.pattern-banner-sub { font-size: 12.5px; color: var(--grey-600); margin-top: 2px; }

.pattern-banner-blue { background: var(--blue-100); border-color: var(--blue-600); }
.pattern-banner-title-blue { color: var(--blue-700); }

.sub-tab-bar {
  display: inline-flex; gap: 4px; background: var(--grey-100);
  border-radius: 999px; padding: 4px; margin-bottom: 10px;
}
.sub-tab-btn {
  background: transparent; border: none; border-radius: 999px;
  padding: 8px 18px; font-size: 13px; font-weight: 700; color: var(--grey-600);
  transition: background 0.15s, color 0.15s;
}
.sub-tab-btn:hover { color: var(--blue-700); }
.sub-tab-btn.active { background: white; color: var(--blue-800); box-shadow: var(--shadow-sm); }

.empty-state {
  text-align: center; padding: 70px 20px; color: var(--grey-600);
}
.empty-state-icon { font-size: 40px; margin-bottom: 10px; }
.empty-state h2 { color: var(--blue-800); margin: 0 0 8px; }
.empty-state p { margin: 0; font-size: 14px; }

/* ============ LOGIN ============ */
.login-wrap {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, var(--blue-900), var(--blue-600));
  padding: 24px;
}
.login-card {
  background: white; border-radius: 14px; box-shadow: var(--shadow-md);
  padding: 36px 32px; width: 100%; max-width: 380px; text-align: center;
  position: relative;
}
.login-close {
  position: absolute; top: 12px; right: 14px; width: 30px; height: 30px;
  border: none; background: none; color: var(--grey-400); font-size: 22px;
  line-height: 1; cursor: pointer; border-radius: 50%;
}
.login-close:hover { background: var(--grey-100); color: var(--grey-800); }
.login-logo { margin: 0 auto 14px; background: var(--blue-100); color: var(--blue-700); border: none; }
.login-title { margin: 0; font-size: 22px; color: var(--blue-800); }
.login-sub { margin: 4px 0 22px; color: var(--grey-600); font-size: 13.5px; }
.login-form { display: flex; flex-direction: column; gap: 10px; }
.login-input {
  padding: 11px 12px; border: 1px solid var(--grey-200); border-radius: 6px;
  font-size: 14px; font-family: inherit; width: 100%;
}
.login-input:focus { outline: none; border-color: var(--blue-600); }
.btn-block { width: 100%; padding: 11px; margin-top: 4px; }
.login-error {
  background: var(--red-100); color: var(--red-600); border-radius: 6px;
  padding: 9px 12px; font-size: 13px; margin-bottom: 12px; text-align: left;
}
.login-info {
  background: var(--blue-100); color: var(--blue-800); border-radius: 6px;
  padding: 9px 12px; font-size: 13px; margin-bottom: 12px; text-align: left;
}
.login-switch { font-size: 13.5px; color: var(--grey-600); margin: 16px 0 0; }
.link-btn { background: none; border: none; color: var(--blue-700); font-weight: 700; padding: 0; font-size: inherit; cursor: pointer; }
.link-btn:hover { text-decoration: underline; }
.login-note { font-size: 11.5px; color: var(--grey-400); margin: 18px 0 0; line-height: 1.5; }

/* ============ ACCOUNT ============ */
.account-guest-card {
  max-width: 420px; margin: 60px auto; text-align: center;
  background: white; border: 1px solid var(--grey-200); border-radius: 12px;
  box-shadow: var(--shadow-sm); padding: 36px 30px;
}
.account-guest-icon {
  width: 64px; height: 64px; border-radius: 50%; margin: 0 auto 16px;
  background: var(--blue-100); display: flex; align-items: center; justify-content: center;
  font-size: 28px;
}
.account-guest-card h2 { margin: 0 0 8px; color: var(--blue-800); font-size: 18px; }
.account-guest-card p { color: var(--grey-600); font-size: 13.5px; margin: 0 0 20px; line-height: 1.5; }

.account-card { max-width: 340px; margin: 40px auto 28px; text-align: center; }
.account-avatar {
  width: 72px; height: 72px; border-radius: 50%; margin: 0 auto 14px;
  background: linear-gradient(135deg, var(--blue-700), var(--blue-900));
  color: white; display: flex; align-items: center; justify-content: center;
  font-size: 28px; font-weight: 800;
}
.account-card h2 { margin: 0 0 4px; color: var(--blue-800); }
.account-username { color: var(--grey-600); font-size: 13.5px; margin: 0 0 22px; }

.account-info-card {
  max-width: 460px; margin: 0 auto 40px; background: white;
  border: 1px solid var(--grey-200); border-radius: 10px;
  box-shadow: var(--shadow-sm); padding: 22px 26px 26px;
}
.account-info-card h3 { margin: 0 0 16px; color: var(--blue-800); font-size: 16px; }
.account-info-form { display: flex; flex-direction: column; gap: 14px; }
.account-info-field { display: flex; flex-direction: column; gap: 5px; text-align: left; }
.account-info-field label { font-size: 11.5px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.3px; color: var(--grey-600); }
.account-info-field .login-input:disabled { background: var(--grey-50); color: var(--grey-600); cursor: not-allowed; }
.account-info-msg { font-size: 13px; padding: 8px 12px; border-radius: 6px; }
.account-info-msg.success { background: var(--green-100); color: var(--green-600); }
.account-info-msg.error { background: var(--red-100); color: var(--red-600); }
.account-info-form .btn { align-self: flex-start; }

.subjects-intro { color: var(--grey-600); font-size: 13.5px; margin: 0 0 16px; }
.subjects-breadcrumb { display: flex; align-items: center; gap: 8px; margin-bottom: 14px; font-size: 13.5px; }
.subjects-breadcrumb .bc-link { color: var(--blue-700); font-weight: 600; cursor: pointer; background: none; border: none; padding: 0; font-size: inherit; }
.subjects-breadcrumb .bc-link:hover { text-decoration: underline; }
.subjects-breadcrumb .bc-sep { color: var(--grey-400); }
.subjects-breadcrumb .bc-current { color: var(--grey-800); font-weight: 700; }

.subject-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 18px;
}
.subject-card {
  background: white; border: 1px solid var(--grey-200); border-radius: 12px;
  overflow: hidden; box-shadow: var(--shadow-sm); display: flex; flex-direction: column;
  transition: box-shadow 0.15s, transform 0.1s;
}
.subject-card:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); }
.subject-card-thumb {
  height: 64px; display: flex; align-items: center; justify-content: center;
  font-size: 26px; font-weight: 800; color: rgba(255,255,255,0.92); letter-spacing: 0.5px;
}
.subject-card-body { padding: 14px 16px 16px; display: flex; flex-direction: column; gap: 8px; flex: 1; }
.subject-card-name { font-size: 15.5px; font-weight: 700; color: var(--grey-800); }
.subject-card-meta { font-size: 12px; color: var(--grey-600); display: flex; gap: 10px; }
.subject-card-progress { font-size: 11.5px; color: var(--green-600); font-weight: 600; min-height: 14px; }
.subject-card-actions { display: flex; gap: 8px; margin-top: auto; }
.subject-card-actions .btn { flex: 1; padding: 8px 10px; font-size: 13px; }
.subject-card-actions .btn-topics { background: var(--grey-100); color: var(--blue-800); }
.subject-card-actions .btn-topics:hover { background: var(--grey-200); }

.paper-list { display: flex; flex-direction: column; gap: 12px; max-width: 760px; }
.paper-card {
  background: white;
  border: 1px solid var(--grey-200);
  border-radius: var(--radius);
  padding: 16px 20px;
  box-shadow: var(--shadow-sm);
  display: flex;
  align-items: center;
  gap: 18px;
  transition: box-shadow 0.15s;
}
.paper-card:hover { box-shadow: var(--shadow-md); }
.paper-card .pc-main { flex: 1; min-width: 0; }
.paper-card .pc-date { font-size: 16px; font-weight: 700; color: var(--blue-800); }
.paper-card .pc-meta { font-size: 13px; color: var(--grey-600); display: flex; gap: 14px; margin-top: 4px; }
.paper-card .pc-progress { font-size: 12px; color: var(--green-600); font-weight: 600; margin-top: 4px; }
.paper-card .btn { flex-shrink: 0; }

/* ---- Paywall lock states ---- */
.paper-card.is-locked, .subject-card.is-locked { opacity: 0.92; }
.lock-badge {
  display: inline-flex; align-items: center; gap: 5px; font-size: 11.5px; font-weight: 700;
  color: var(--sky-500); margin-top: 4px;
}
.subject-card .lock-badge { justify-content: center; }
.btn-unlock {
  background: linear-gradient(135deg, var(--sky-500), var(--blue-700)); color: white;
}
.btn-unlock:hover { filter: brightness(1.08); }
.subject-card.is-locked .subject-card-thumb { filter: grayscale(35%); position: relative; }
.subject-card.is-locked .subject-card-thumb::after {
  content: '🔒'; position: absolute; font-size: 20px;
  text-shadow: 0 1px 3px rgba(0,0,0,0.4);
}

.subscribe-plan-list { display: flex; flex-direction: column; gap: 8px; margin: 16px 0; text-align: left; }
.plan-option {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 16px; border: 1px solid var(--grey-200); border-radius: 8px;
  background: white; cursor: pointer; font-family: inherit; transition: border-color 0.12s, background 0.12s;
}
.plan-option:hover:not(:disabled) { border-color: var(--sky-500); background: var(--blue-100); }
.plan-option:disabled { opacity: 0.6; cursor: not-allowed; }
.plan-option-label { font-weight: 600; color: var(--grey-800); font-size: 14px; }
.plan-option-price { font-weight: 800; color: var(--blue-800); font-size: 15px; }

.subscription-card { text-align: center; }
.subscription-status {
  font-size: 14px; font-weight: 700; padding: 10px; border-radius: 8px; margin-bottom: 14px;
  background: var(--grey-50); color: var(--grey-600);
}
.subscription-status.active { background: var(--green-100); color: var(--green-600); }

/* ============ INSTRUCTIONS ============ */
.instr-wrap {
  max-width: 780px; margin: 0 auto; padding: 32px 24px 100px;
}
.instr-wrap h2 { color: var(--blue-800); }
.instr-body {
  background: white; border: 1px solid var(--grey-200); border-radius: var(--radius);
  padding: 24px 28px; box-shadow: var(--shadow-sm);
}
.instr-body ol { padding-left: 22px; line-height: 1.7; }
.instr-body li { margin-bottom: 8px; }
.legend-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 10px;
  margin: 14px 0 18px; padding: 14px; background: var(--grey-50); border-radius: 6px;
}
.legend-item { display: flex; align-items: center; gap: 10px; font-size: 13px; }
.agree-row {
  display: flex; align-items: flex-start; gap: 10px; margin-top: 18px;
  font-size: 13.5px; line-height: 1.5; color: var(--grey-600);
}
.agree-row input { margin-top: 3px; }

.timer-choice {
  margin-top: 20px; padding: 16px 18px; background: var(--blue-100);
  border: 1px solid var(--grey-200); border-radius: 8px;
}
.timer-choice-label { font-weight: 700; color: var(--blue-800); margin-bottom: 10px; font-size: 14px; }
.timer-choice-options { display: flex; flex-direction: column; gap: 8px; }
.timer-choice-opt {
  display: flex; align-items: flex-start; gap: 10px; font-size: 13.5px;
  background: white; border: 1px solid var(--grey-200); border-radius: 6px;
  padding: 10px 12px; cursor: pointer;
}
.timer-choice-opt:hover { border-color: var(--blue-600); }
.timer-choice-opt input { margin-top: 3px; accent-color: var(--blue-700); }
.tc-hint { color: var(--grey-600); font-size: 12px; }
.instr-footer {
  position: sticky; bottom: 0; background: var(--grey-50);
  max-width: 780px; margin: 0 auto; padding: 16px 24px;
  display: flex; justify-content: space-between;
  border-top: 1px solid var(--grey-200);
}

/* ============ Palette button base (shared: legend + real palette) ============ */
.pal-btn {
  width: 34px; height: 34px; border-radius: 6px;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 700; color: white;
  border: none;
}
.st-not-visited { background: var(--white); color: var(--grey-800); border: 1px solid var(--grey-400); }
.st-not-answered { background: var(--red-600); }
.st-answered { background: var(--green-600); }
.st-marked { background: var(--purple-600); border-radius: 50%; }
.st-answered-marked { background: var(--purple-600); border-radius: 50%; position: relative; }
.st-answered-marked::after {
  content: ''; position: absolute; bottom: -2px; right: -2px;
  width: 10px; height: 10px; border-radius: 50%;
  background: var(--green-600); border: 2px solid white;
}

/* ============ EXAM ============ */
#screen-exam { display: flex; flex-direction: column; height: 100vh; }
.exam-top {
  background: var(--blue-900); color: white;
  padding: 10px 22px; display: flex; justify-content: space-between; align-items: center;
  flex-wrap: wrap; gap: 10px;
}
.exam-top-left { display: flex; align-items: center; gap: 16px; }
.exam-title { font-weight: 700; font-size: 16px; }
.candidate-name {
  background: rgba(255,255,255,0.12); border: 1px solid rgba(255,255,255,0.25);
  border-radius: 5px; padding: 6px 10px; color: white; font-size: 13px; width: 200px;
}
.candidate-name::placeholder { color: rgba(255,255,255,0.6); }
.exam-top-right { display: flex; align-items: center; gap: 16px; }
.timer-box { text-align: right; }
.timer-label { display: block; font-size: 11px; opacity: 0.75; }
.timer-display { font-size: 20px; font-weight: 800; font-variant-numeric: tabular-nums; letter-spacing: 0.5px; }
.timer-display.timer-warn { color: #ffb74d; }
.timer-display.timer-critical { color: #ff6b6b; }

.section-tabs {
  display: flex; gap: 6px; padding: 8px 22px;
  background: var(--grey-100); border-bottom: 1px solid var(--grey-200);
}
.section-tab {
  font-size: 12px; font-weight: 700; padding: 5px 12px; border-radius: 5px;
  background: white; border: 1px solid var(--grey-200); color: var(--grey-600);
}
.section-tab-current { background: var(--blue-700); color: white; border-color: var(--blue-700); }
.section-tab-locked { background: var(--grey-200); color: var(--grey-600); }
.section-tab-upcoming { opacity: 0.55; }

.exam-body { flex: 1; display: flex; overflow: hidden; }
.question-panel {
  flex: 1; display: flex; flex-direction: column; background: white;
  border-right: 1px solid var(--grey-200); min-width: 0;
}
.qp-scroll { flex: 1; overflow-y: auto; padding: 24px 32px; }
.qp-header-row { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; }
.qp-qno { font-size: 17px; font-weight: 700; color: var(--blue-800); }
.qp-marks { font-size: 12.5px; color: var(--grey-600); background: var(--grey-100); padding: 4px 10px; border-radius: 12px; }
.q-text { font-size: 16px; line-height: 1.65; margin-bottom: 14px; white-space: pre-wrap; }
.q-images { margin-bottom: 16px; display: flex; gap: 12px; flex-wrap: wrap; }
.q-images img { max-width: 320px; max-height: 320px; border: 1px solid var(--grey-200); border-radius: 6px; }
.q-options { display: flex; flex-direction: column; gap: 10px; }
.option-row {
  display: flex; align-items: center; gap: 12px;
  border: 1px solid var(--grey-200); border-radius: 8px; padding: 12px 16px;
  cursor: pointer; transition: background 0.12s, border-color 0.12s;
}
.option-row:hover { background: var(--blue-100); border-color: var(--blue-600); }
.option-row.selected { background: var(--blue-100); border-color: var(--blue-700); }
.option-row input { width: 17px; height: 17px; flex-shrink: 0; accent-color: var(--blue-700); }
.option-letter {
  width: 26px; height: 26px; border-radius: 50%; background: var(--grey-100);
  display: flex; align-items: center; justify-content: center; font-weight: 700;
  font-size: 12.5px; flex-shrink: 0; text-transform: uppercase;
}
.option-row.selected .option-letter { background: var(--blue-700); color: white; }
.option-text { font-size: 15px; line-height: 1.5; }
.multi-hint { font-size: 12px; color: var(--purple-600); font-weight: 600; margin-bottom: 8px; }

.option-row.correct { background: var(--green-100); border-color: var(--green-600); cursor: default; }
.option-row.correct .option-letter { background: var(--green-600); color: white; }
.option-row.incorrect { background: var(--red-100); border-color: var(--red-600); cursor: default; }
.option-row.incorrect .option-letter { background: var(--red-600); color: white; }
.option-row input:disabled { cursor: default; }

.reveal-banner {
  margin-top: 14px; padding: 12px 16px; border-radius: 8px;
  font-weight: 700; font-size: 14px;
}
.reveal-banner.reveal-correct { background: var(--green-100); color: var(--green-600); }
.reveal-banner.reveal-incorrect { background: var(--red-100); color: var(--red-600); }
.reveal-banner.reveal-unattempted { background: var(--grey-100); color: var(--grey-600); }

.qp-nav {
  display: flex; align-items: center; gap: 10px; padding: 14px 32px;
  border-top: 1px solid var(--grey-200); background: var(--grey-50); flex-wrap: wrap;
}
.qp-nav-spacer { flex: 1; }

.palette-panel {
  width: 300px; flex-shrink: 0; background: var(--grey-50);
  display: flex; flex-direction: column; overflow: hidden;
}
.candidate-summary { padding: 16px 18px; border-bottom: 1px solid var(--grey-200); background: white; }
.cs-row { display: flex; align-items: center; gap: 8px; font-size: 12.5px; margin-bottom: 7px; color: var(--grey-600); }
.cs-row b { margin-left: auto; color: var(--grey-800); }
.dot { width: 12px; height: 12px; border-radius: 3px; flex-shrink: 0; display: inline-block; }
.dot-answered { background: var(--green-600); }
.dot-not-answered { background: var(--red-600); }
.dot-not-visited { background: white; border: 1px solid var(--grey-400); }
.dot-marked { background: var(--purple-600); border-radius: 50%; }
.dot-answered-marked { background: var(--purple-600); border-radius: 50%; box-shadow: 0 0 0 2px var(--green-600) inset; }

.palette-scroll { flex: 1; overflow-y: auto; padding: 16px 18px; }
.palette-grid {
  display: grid; grid-template-columns: repeat(auto-fill, 38px); gap: 8px;
}
.palette-grid .pal-btn { width: 38px; height: 38px; cursor: pointer; font-size: 13px; }
.palette-grid .pal-btn.current { outline: 3px solid var(--blue-600); outline-offset: 1px; }

/* ============ MODAL ============ */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(15,25,40,0.55);
  display: flex; align-items: center; justify-content: center; z-index: 50;
}
.modal-box {
  background: white; border-radius: 10px; padding: 24px 28px; width: 420px; max-width: 92vw;
  box-shadow: var(--shadow-md);
}
.modal-box h3 { margin-top: 0; color: var(--blue-800); }
.submit-summary { display: flex; flex-direction: column; gap: 6px; margin: 14px 0; font-size: 13.5px; }
.submit-summary .ss-row { display: flex; justify-content: space-between; }
.modal-note { font-size: 12.5px; color: var(--grey-600); }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 16px; }

/* ============ RESULTS ============ */
.results-wrap { max-width: 760px; margin: 0 auto; padding: 40px 24px 60px; text-align: center; }
.results-wrap h2 { color: var(--blue-800); margin-bottom: 4px; }
.result-title { color: var(--grey-600); margin-bottom: 24px; }
.score-hero {
  background: linear-gradient(135deg, var(--blue-900), var(--blue-600));
  color: white; border-radius: 14px; padding: 32px; margin-bottom: 24px;
}
.score-big { font-size: 44px; font-weight: 800; }
.score-max { font-size: 22px; opacity: 0.85; font-weight: 600; }
.score-label { margin-top: 6px; opacity: 0.85; font-size: 13px; letter-spacing: 0.5px; text-transform: uppercase; }
.result-stats {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 14px;
  margin-bottom: 28px;
}
.stat-card { background: white; border: 1px solid var(--grey-200); border-radius: 10px; padding: 16px 8px; }
.stat-num { font-size: 24px; font-weight: 800; }
.stat-label { font-size: 12px; color: var(--grey-600); margin-top: 4px; }
.stat-correct .stat-num { color: var(--green-600); }
.stat-incorrect .stat-num { color: var(--red-600); }
.stat-unattempted .stat-num { color: var(--grey-600); }
.stat-accuracy .stat-num { color: var(--blue-700); }
.results-actions { display: flex; justify-content: center; gap: 12px; }

/* ============ REVIEW ============ */
.review-top {
  position: sticky; top: 0; background: white; z-index: 5;
  display: flex; align-items: center; gap: 20px; padding: 14px 32px;
  border-bottom: 1px solid var(--grey-200); flex-wrap: wrap;
}
.review-top h2 { margin: 0; font-size: 18px; color: var(--blue-800); flex: 1; min-width: 160px; }
.review-filters { display: flex; gap: 8px; }
.filter-btn {
  border: 1px solid var(--grey-200); background: white; border-radius: 16px;
  padding: 6px 14px; font-size: 12.5px; font-weight: 600; color: var(--grey-600);
}
.filter-btn.active { background: var(--blue-700); color: white; border-color: var(--blue-700); }
.review-list { max-width: 900px; margin: 0 auto; padding: 24px 24px 60px; display: flex; flex-direction: column; gap: 14px; }
.review-card { background: white; border: 1px solid var(--grey-200); border-radius: 10px; padding: 18px 22px; }
.review-card-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.review-qno { font-weight: 700; color: var(--blue-800); }
.review-status { font-size: 12px; font-weight: 700; padding: 3px 10px; border-radius: 12px; }
.review-status.correct { background: var(--green-100); color: var(--green-600); }
.review-status.incorrect { background: var(--red-100); color: var(--red-600); }
.review-status.unattempted { background: var(--grey-100); color: var(--grey-600); }
.review-q-text { margin-bottom: 12px; line-height: 1.6; }
.review-images { margin-bottom: 12px; display: flex; gap: 10px; flex-wrap: wrap; }
.review-images img { max-width: 260px; max-height: 260px; border: 1px solid var(--grey-200); border-radius: 6px; }
.review-options { display: flex; flex-direction: column; gap: 8px; }
.review-option {
  display: flex; align-items: center; gap: 10px; padding: 9px 14px;
  border-radius: 6px; border: 1px solid var(--grey-200); font-size: 14px;
}
.review-option .option-letter { width: 22px; height: 22px; font-size: 11px; }
.review-option.is-correct { background: var(--green-100); border-color: var(--green-600); }
.review-option.is-correct .option-letter { background: var(--green-600); color: white; }
.review-option.is-wrong-pick { background: var(--red-100); border-color: var(--red-600); }
.review-option.is-wrong-pick .option-letter { background: var(--red-600); color: white; }
.review-tag { margin-left: auto; font-size: 11px; font-weight: 700; }
.review-tag.tag-correct { color: var(--green-600); }
.review-tag.tag-your { color: var(--red-600); }

@media (max-width: 880px) {
  .exam-body { flex-direction: column; overflow: auto; }
  .palette-panel { width: 100%; }
  .qp-scroll { padding: 18px; }
  .qp-nav { padding: 12px 18px; }
}
