:root {
  font-family: "Segoe UI", Arial, sans-serif;
  color: #242424;
  background: #f4f3f1;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
  --cgi-red: #e31937;
  --cgi-red-dark: #b80f29;
  --ink: #242424;
  --muted: #686868;
  --paper: #ffffff;
  --line: #ddd9d5;
  --soft: #f7f5f3;
  --success: #26734d;
  --warning: #945d00;
  --shadow: 0 18px 48px rgba(45, 35, 31, 0.08);
}

* { box-sizing: border-box; }
html { min-width: 320px; scroll-behavior: smooth; }
body { min-width: 320px; min-height: 100vh; margin: 0; }
button, select { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: 0.55; }
a { color: inherit; }
[hidden] { display: none !important; }

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.app-shell { min-height: 100vh; display: flex; flex-direction: column; }
main { flex: 1; }

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  min-height: 68px;
  padding: 0 clamp(20px, 5vw, 72px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  background: rgba(255, 255, 255, 0.97);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(10px);
}

.brand {
  min-width: 0;
  padding: 0;
  display: flex;
  align-items: center;
  gap: 10px;
  border: 0;
  background: transparent;
  color: inherit;
  text-align: left;
}

.brand-logo { display: block; width: 74px; height: 47px; object-fit: contain; }
.brand-divider { width: 1px; height: 30px; background: var(--line); }
.brand-label { display: flex; flex-direction: column; gap: 2px; }
.brand-label strong { font-size: 0.91rem; }

.main-navigation {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 3px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--soft);
}

.main-navigation button {
  min-height: 34px;
  padding: 0 13px;
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: #625d59;
  font-size: 0.74rem;
  font-weight: 700;
}

.main-navigation button:hover { color: var(--cgi-red-dark); }
.main-navigation button.active { background: #fff; color: var(--ink); box-shadow: 0 1px 5px rgba(45, 35, 31, 0.12); }

.account { display: flex; align-items: center; gap: 12px; text-align: right; font-size: 0.8rem; }
.admin-trigger { width: 38px; height: 38px; flex: 0 0 38px; padding: 8px; display: grid; place-items: center; border: 1px solid var(--line); border-radius: 50%; background: #fff; color: #5b5551; }
.admin-trigger:hover, .admin-trigger.active { border-color: #d79aa3; background: #fff4f6; color: var(--cgi-red-dark); }
.admin-trigger:focus-visible { outline: 3px solid rgba(227, 25, 55, 0.18); outline-offset: 2px; }
.admin-trigger svg { width: 21px; height: 21px; overflow: visible; fill: none; stroke: currentColor; stroke-linecap: round; stroke-linejoin: round; stroke-width: 1.7; }
.profile-trigger { min-width: 0; padding: 3px; display: flex; align-items: center; gap: 8px; border: 0; border-radius: 999px; background: transparent; color: inherit; }
.profile-trigger:hover { background: var(--soft); }
.profile-trigger:focus-visible { outline: 3px solid rgba(227, 25, 55, 0.18); outline-offset: 2px; }
.profile-trigger strong { max-width: 190px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.account-avatar { width: 32px; height: 32px; flex: 0 0 32px; display: grid; place-items: center; overflow: hidden; border: 1px solid #d9d2ce; border-radius: 50%; background: #f5e8eb center / cover no-repeat; color: var(--cgi-red-dark); font-size: 0.62rem; font-weight: 800; }

.primary-button, .secondary-button, .text-button {
  min-height: 44px;
  padding: 0 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border-radius: 4px;
  font-weight: 700;
  text-decoration: none;
  transition: transform 0.15s ease, background 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}

.primary-button { border: 0; background: var(--cgi-red); color: #fff; box-shadow: 0 7px 18px rgba(227, 25, 55, 0.18); }
.primary-button:hover:not(:disabled) { transform: translateY(-1px); background: var(--cgi-red-dark); box-shadow: 0 10px 24px rgba(184, 15, 41, 0.24); }
.secondary-button { border: 1px solid var(--line); background: #fff; color: #444; }
.secondary-button:hover:not(:disabled) { border-color: #aaa39e; background: #fcfbfa; }
.primary-button.compact, .secondary-button.compact { min-height: 36px; padding: 0 11px; font-size: 0.72rem; }
.text-button { min-height: 36px; padding: 0; border: 0; background: transparent; color: var(--cgi-red-dark); }
.wide { width: 100%; }

.eyebrow {
  margin: 0;
  color: var(--cgi-red-dark);
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.loading-page {
  min-height: calc(100vh - 118px);
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 12px;
  color: var(--muted);
}

.loading-page p { margin: 0; }
.spinner { width: 22px; height: 22px; display: inline-block; border: 2px solid #ded9d6; border-top-color: var(--cgi-red); border-radius: 50%; animation: spin 0.75s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.access-page {
  min-height: calc(100vh - 118px);
  padding: 54px 20px;
  display: grid;
  place-items: center;
  background:
    linear-gradient(135deg, rgba(227, 25, 55, 0.035), transparent 48%),
    #f5f4f2;
}

.access-card {
  width: min(100%, 420px);
  padding: 32px 36px;
  background: #fff;
  border: 1px solid var(--line);
  border-top: 4px solid var(--cgi-red);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.access-card h1 { margin: 10px 0 10px; font-family: Georgia, "Times New Roman", serif; font-size: clamp(2rem, 6vw, 2.5rem); line-height: 1.05; }
.access-card > p:not(.eyebrow) { margin: 0 0 24px; color: #57504c; line-height: 1.5; }
.access-note { margin-top: 12px; display: block; color: var(--muted); text-align: center; line-height: 1.4; }

.home-page { padding-bottom: 34px; }
.path-section { width: min(1180px, 100%); margin: 0 auto; padding: 30px clamp(20px, 5vw, 60px) 20px; }
.path-section > h1 { margin: 0 0 20px; font-family: Georgia, "Times New Roman", serif; font-size: clamp(1.65rem, 3vw, 2.1rem); }
.streak-launch { position: relative; margin-bottom: 18px; padding: 19px 21px; display: flex; align-items: center; justify-content: space-between; gap: 24px; overflow: hidden; border: 1px solid #dca4ad; border-left: 5px solid var(--cgi-red); border-radius: 8px; background: linear-gradient(105deg, #fff 0%, #fff6f7 68%, #fbe7ea 100%); box-shadow: 0 10px 28px rgba(120, 19, 36, 0.07); }
.streak-launch::after { position: absolute; right: 135px; width: 72px; height: 72px; border: 14px solid rgba(227, 25, 55, 0.05); border-radius: 50%; content: ""; pointer-events: none; }
.streak-launch > div { position: relative; z-index: 1; min-width: 0; display: grid; gap: 4px; }
.streak-launch strong { font-family: Georgia, "Times New Roman", serif; font-size: 1.35rem; }
.streak-launch span { max-width: 720px; color: #5c514e; font-size: 0.78rem; line-height: 1.5; }
.streak-launch button { position: relative; z-index: 1; min-width: 132px; }
.section-heading { margin-bottom: 20px; display: flex; justify-content: space-between; align-items: end; gap: 32px; }
.section-heading h2 { margin: 6px 0 0; font-family: Georgia, "Times New Roman", serif; font-size: clamp(1.45rem, 3vw, 2rem); }
.section-heading > p { max-width: 450px; margin: 0; color: var(--muted); line-height: 1.55; }
.path-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }

.path-card {
  position: relative;
  min-width: 0;
  min-height: 180px;
  padding: 22px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 12px 34px rgba(45, 35, 31, 0.045);
}

.path-card::after { position: absolute; right: -25px; top: 42px; width: 100px; height: 100px; border: 18px solid rgba(227, 25, 55, 0.035); border-radius: 50%; content: ""; pointer-events: none; }
.path-card.featured { border-top: 3px solid var(--cgi-red); }
.path-card-heading { position: relative; z-index: 1; display: flex; align-items: center; gap: 13px; }
.path-card-heading > div:last-child { min-width: 0; }
.path-card-heading p { margin: 0 0 4px; color: var(--cgi-red-dark); font-size: 0.6rem; font-weight: 800; letter-spacing: 0.09em; line-height: 1.2; text-transform: uppercase; }
.path-icon { width: 44px; height: 44px; flex: 0 0 44px; display: grid; place-items: center; border-radius: 6px; background: #fce9ec; color: var(--cgi-red-dark); font-family: Georgia, serif; font-size: 1.25rem; font-weight: 800; }
.path-card h3 { margin: 0; font-family: Georgia, "Times New Roman", serif; font-size: 1.25rem; line-height: 1.14; }
.path-topics { position: relative; z-index: 1; margin: 18px 0 0; padding: 0; list-style: none; }
.path-topics li { position: relative; padding: 9px 0 9px 15px; border-top: 1px solid #eee9e6; color: var(--muted); font-size: 0.7rem; line-height: 1.42; }
.path-topics li::before { position: absolute; top: 14px; left: 1px; width: 5px; height: 5px; border-radius: 50%; background: var(--cgi-red); content: ""; }
.path-topics strong, .path-topics span { display: block; }
.path-topics strong { margin-bottom: 2px; color: #3e3936; font-size: 0.72rem; }
.track-actions { position: relative; z-index: 1; margin-top: auto; padding-top: 18px; display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.path-start { width: 100%; min-height: 40px; padding: 0 10px; font-size: 0.72rem; }

.quiz-page { width: min(1280px, 100%); margin: 0 auto; padding: 32px clamp(18px, 4vw, 52px) 70px; }
.quiz-header { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 20px; }
.quiz-identity { text-align: center; }
.quiz-identity strong { margin-top: 4px; display: block; }
.quiz-timer { justify-self: end; min-width: 88px; display: flex; flex-direction: column; text-align: right; }
.quiz-timer small { color: var(--muted); text-transform: uppercase; letter-spacing: 0.08em; font-size: 0.61rem; }
.quiz-timer strong { font-variant-numeric: tabular-nums; }
.progress-track { height: 5px; margin-top: 24px; overflow: hidden; border-radius: 999px; background: #dfdcda; }
.progress-track span { height: 100%; display: block; border-radius: inherit; background: var(--cgi-red); transition: width 0.2s ease; }
.quiz-layout { margin-top: 32px; display: grid; grid-template-columns: 190px minmax(0, 820px); gap: 32px; justify-content: center; align-items: start; }
.quiz-page.streak-page { padding-top: 25px; }
.quiz-layout.streak-layout { margin-top: 14px; grid-template-columns: minmax(0, 900px); }
.streak-page .question-actions { justify-content: flex-end; }
.streak-run-status { width: min(900px, 100%); margin: 0 auto; overflow: hidden; border: 1px solid #e3c7cc; border-radius: 7px; background: linear-gradient(90deg, #fff9fa, #fff); box-shadow: 0 7px 20px rgba(80, 37, 43, 0.05); }
.streak-run-status[hidden] { display: none; }
.streak-run-summary { padding: 12px 17px; display: flex; align-items: center; justify-content: space-between; gap: 22px; }
.streak-run-summary > div { min-width: 0; display: flex; align-items: baseline; gap: 9px; }
.streak-run-status small { color: var(--cgi-red-dark); font-size: 0.62rem; font-weight: 900; letter-spacing: 0.07em; text-transform: uppercase; }
.streak-run-status strong { font-size: 0.85rem; font-variant-numeric: tabular-nums; }
.streak-run-summary > div:first-child strong { font-family: Georgia, "Times New Roman", serif; font-size: 1.05rem; }
.streak-target-progress { padding: 9px 17px 11px; display: grid; grid-template-columns: minmax(0, auto) minmax(140px, 1fr); align-items: center; gap: 15px; border-top: 1px solid rgba(184, 15, 41, 0.13); background: rgba(255, 255, 255, 0.72); }
.streak-target-person { min-width: 0; display: flex; align-items: center; gap: 8px; color: #665d59; font-size: 0.72rem; font-weight: 700; }
.streak-target-person > span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.streak-target-avatar { width: 25px; height: 25px; flex: 0 0 25px; display: grid; place-items: center; border: 1px solid #d9cdcf; border-radius: 50%; background-color: #f5e8eb; background-position: center; background-size: cover; color: var(--cgi-red-dark); font-size: 0.55rem; font-weight: 900; }
.streak-target-track { height: 5px; overflow: hidden; border-radius: 999px; background: #eadfe1; }
.streak-target-track i { width: 0; height: 100%; display: block; border-radius: inherit; background: linear-gradient(90deg, #e31937, #b80f29); transition: width 0.25s ease; }

.question-map { position: sticky; top: 105px; padding: 19px; border: 1px solid var(--line); border-radius: 7px; background: #fff; }
.question-map > small { display: block; color: var(--muted); font-weight: 800; text-transform: uppercase; letter-spacing: 0.08em; }
.question-map > div { margin: 14px 0 18px; display: grid; grid-template-columns: repeat(5, 1fr); gap: 5px; }
.question-map button { aspect-ratio: 1; padding: 0; border: 1px solid var(--line); border-radius: 4px; background: #fff; color: #5b5652; font-size: 0.66rem; }
.question-map button:hover { border-color: #cb8e97; }
.question-map button.current { border-color: var(--cgi-red); box-shadow: 0 0 0 2px rgba(227, 25, 55, 0.12); color: var(--cgi-red-dark); }
.question-map button.answered { border-color: #b9d3c5; background: #e9f4ee; color: var(--success); }
.question-map > span { display: flex; align-items: center; gap: 6px; color: var(--muted); font-size: 0.67rem; }
.question-map i { width: 9px; height: 9px; border-radius: 2px; background: #e9f4ee; border: 1px solid #b9d3c5; }

.question-card { padding: clamp(24px, 5vw, 48px); border: 1px solid var(--line); border-top: 3px solid var(--cgi-red); border-radius: 8px; background: #fff; box-shadow: var(--shadow); }
.question-meta { display: flex; align-items: center; gap: 8px; }
.question-meta span { padding: 5px 8px; border-radius: 3px; background: var(--soft); color: #625d59; font-size: 0.64rem; font-weight: 800; text-transform: uppercase; letter-spacing: 0.06em; }
.question-meta .difficulty-badge { margin-left: auto; border: 1px solid transparent; }
.question-meta .difficulty-foundation { border-color: #acd2bc; background: #eaf5ef; color: #17663f; }
.question-meta .difficulty-intermediate { border-color: #e6c765; background: #fff4cf; color: #755000; }
.question-meta .difficulty-advanced { border-color: #e4a4ae; background: #fff0f2; color: #a10f2a; }
.question-card h1 { margin: 20px 0 28px; font-family: Georgia, "Times New Roman", serif; font-size: clamp(1.45rem, 3vw, 2rem); line-height: 1.3; }
.question-card fieldset { min-width: 0; margin: 0; padding: 0; display: grid; gap: 10px; border: 0; }
.answer-option { min-width: 0; padding: 15px 17px; display: grid; grid-template-columns: 30px 1fr; gap: 12px; align-items: start; border: 1px solid #d8d3cf; border-radius: 6px; background: #fff; cursor: pointer; transition: background 0.15s ease, border-color 0.15s ease; }
.answer-option:hover { border-color: #d58a95; background: #fffafb; }
.answer-option:has(input:checked) { border-color: var(--cgi-red); background: #fff4f6; box-shadow: 0 0 0 2px rgba(227, 25, 55, 0.08); }
.answer-option input { position: absolute; opacity: 0; }
.option-letter { width: 28px; height: 28px; display: grid; place-items: center; border: 1px solid #cdc7c3; border-radius: 50%; color: #665f5b; font-size: 0.72rem; font-weight: 800; }
.answer-option:has(input:checked) .option-letter { border-color: var(--cgi-red); background: var(--cgi-red); color: #fff; }
.option-text { padding-top: 3px; color: #494441; line-height: 1.5; }
.answer-option input:focus-visible + .option-letter { outline: 3px solid rgba(227, 25, 55, 0.18); outline-offset: 2px; }
.answer-option.correct { border-color: #8fc2a6; background: #f0f8f4; }
.answer-option.incorrect { border-color: #dfa5ae; background: #fff3f5; }
.answer-option.correct .option-letter { border-color: var(--success); background: var(--success); color: #fff; }
.answer-option.incorrect .option-letter { border-color: var(--cgi-red-dark); background: var(--cgi-red-dark); color: #fff; }
.streak-page .answer-option { transition: none; }
.streak-page .answer-option:has(input:checked) { border-color: #aeb8b3; background: #f5f7f6; box-shadow: 0 0 0 2px rgba(75, 92, 84, 0.07); }
.streak-page .answer-option:has(input:checked) .option-letter { border-color: #66736c; background: #66736c; color: #fff; }
.streak-page .answer-option.checking:has(input:checked) { border-color: #aeb8b3; background: #f5f7f6; box-shadow: 0 0 0 2px rgba(75, 92, 84, 0.07); cursor: wait; }
.streak-page .answer-option.checking:has(input:checked) .option-letter { border-color: #66736c; background: #66736c; color: #fff; }
.streak-page .answer-option.correct:has(input:checked) { border-color: #8fc2a6; background: #f0f8f4; box-shadow: 0 0 0 2px rgba(31, 122, 79, 0.08); }
.streak-page .answer-option.correct:has(input:checked) .option-letter { border-color: var(--success); background: var(--success); color: #fff; }
.streak-page .answer-option.incorrect:has(input:checked) { border-color: #dfa5ae; background: #fff3f5; box-shadow: 0 0 0 2px rgba(140, 22, 40, 0.07); }
.streak-page .answer-option.incorrect:has(input:checked) .option-letter { border-color: var(--cgi-red-dark); background: var(--cgi-red-dark); color: #fff; }
.answer-option:has(input:disabled) { cursor: default; }
.streak-feedback { margin-top: 18px; padding: 15px 17px; border-left: 4px solid var(--success); border-radius: 4px; background: #f0f8f4; color: #3e4e45; line-height: 1.5; }
.streak-feedback.incorrect { border-left-color: var(--cgi-red-dark); background: #fff3f5; color: #5e343a; }
.streak-feedback strong, .streak-feedback span { display: block; }
.streak-feedback span { margin-top: 5px; font-size: 0.84rem; }
.streak-feedback .streak-feedback-count { width: fit-content; margin: 8px 0 2px; padding: 4px 8px; border-radius: 999px; background: rgba(31, 122, 79, 0.1); color: var(--success); font-size: 0.7rem; font-weight: 900; }
.streak-feedback.incorrect .streak-feedback-count { background: rgba(140, 22, 40, 0.09); color: var(--cgi-red-dark); }
.streak-feedback p { margin: 8px 0 0; font-size: 0.82rem; }
.question-resources { margin-top: 12px; }
.question-resource-content { padding: 12px; display: grid; gap: 10px; justify-items: start; border: 1px solid #e5dfdb; border-radius: 6px; background: #fbfaf9; }
.question-resource-content figure { width: min(100%, 520px); margin: 0; overflow: hidden; border: 1px solid #ded7d3; border-radius: 5px; background: #f1eeeb; }
.question-resource-content img { width: 100%; aspect-ratio: 16 / 9; display: block; object-fit: cover; }
.question-resource-content a { min-height: 32px; padding: 0 10px; display: inline-flex; align-items: center; border: 1px solid #d8d0cc; border-radius: 5px; background: #fff; color: var(--cgi-red-dark); font-size: 0.72rem; font-weight: 800; text-decoration: none; }
.question-resource-content a::after { margin-left: 7px; content: "↗"; font-size: 0.82rem; }
.question-resource-content a:hover { border-color: #b8aaa5; background: #fff7f8; }
.question-resource-content a:focus-visible { outline: 3px solid rgba(227, 25, 55, 0.15); outline-offset: 2px; }
.question-actions { margin-top: 30px; padding-top: 20px; display: flex; align-items: center; gap: 10px; border-top: 1px solid #eeeae7; }
.question-actions > span { margin: 0 auto; color: var(--muted); font-size: 0.74rem; }

.question-preview-window { background: #f4f3f1; }
.question-preview-window .brand { text-decoration: none; }
.question-preview-topbar { position: static; }
.question-preview-window-actions { display: flex; align-items: center; gap: 10px; }
.question-preview-language { padding: 3px; display: flex; gap: 2px; border: 1px solid var(--line); border-radius: 5px; background: var(--soft); }
.question-preview-language button { min-width: 36px; min-height: 30px; padding: 0 8px; border: 0; border-radius: 3px; background: transparent; color: #665f5b; font-size: 0.68rem; font-weight: 800; }
.question-preview-language button.active { background: #fff; color: var(--cgi-red-dark); box-shadow: 0 1px 4px rgba(45, 35, 31, 0.1); }
.question-preview-language button:focus-visible { outline: 3px solid rgba(227, 25, 55, 0.15); outline-offset: 1px; }
.question-preview-page { width: min(980px, 100%); margin: 0 auto; padding: 38px clamp(18px, 5vw, 48px) 70px; }
.question-preview-heading { margin-bottom: 22px; display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; }
.question-preview-heading h1 { margin: 5px 0 0; font-family: Georgia, "Times New Roman", serif; font-size: clamp(1.75rem, 4vw, 2.35rem); }
.question-preview-heading > div:first-child > p:last-child { max-width: 650px; margin: 9px 0 0; color: var(--muted); font-size: 0.78rem; line-height: 1.5; }
.question-preview-record { flex: 0 0 auto; display: flex; align-items: center; gap: 9px; }
.question-preview-record span { padding: 5px 8px; border-radius: 999px; font-size: 0.65rem; font-weight: 900; text-transform: uppercase; }
.question-preview-record span.live { background: #e9f5ee; color: var(--success); }
.question-preview-record span.offline { background: #e7e4e2; color: #68615d; }
.question-preview-record code { color: #8a817c; font-size: 0.7rem; }
.question-preview-loading { min-height: 300px; display: flex; align-items: center; justify-content: center; gap: 10px; color: var(--muted); }
.question-preview-error { min-height: 160px; display: flex; align-items: center; justify-content: center; text-align: center; }
.question-preview-card { width: min(900px, 100%); margin: 0 auto; }
.question-preview-card .answer-option { cursor: default; }

.results-page { width: min(1120px, 100%); margin: 0 auto; padding: 48px clamp(18px, 5vw, 60px) 72px; }
.result-hero { padding: clamp(26px, 5vw, 48px); display: grid; grid-template-columns: 180px 1fr; gap: clamp(30px, 6vw, 64px); align-items: center; border: 1px solid var(--line); border-top: 4px solid var(--cgi-red); border-radius: 8px; background: #fff; box-shadow: var(--shadow); }
.score-ring { --score: 0%; width: 170px; height: 170px; display: grid; place-content: center; justify-items: center; border-radius: 50%; background: radial-gradient(circle closest-side, white 79%, transparent 80% 99%), conic-gradient(var(--cgi-red) var(--score), #e7e2df 0); }
.score-ring strong { font-family: Georgia, serif; font-size: 2.6rem; }
.score-ring small { color: var(--muted); }
.result-leaderboard-status { max-width: 460px; margin: 18px 0 0; padding: 11px 13px; border-left: 3px solid var(--cgi-red); border-radius: 4px; background: #fff4f6; color: #5e343a; font-size: 0.84rem; line-height: 1.45; }
.result-metrics { margin-top: 26px; display: flex; flex-wrap: wrap; gap: 10px; }
.result-metrics span { min-width: 130px; padding: 11px 13px; display: flex; flex-direction: column; gap: 3px; border-radius: 5px; background: var(--soft); }
.result-metrics small { color: var(--muted); font-size: 0.64rem; text-transform: uppercase; letter-spacing: 0.06em; }
.result-actions { margin: 18px 0 46px; display: flex; flex-wrap: wrap; gap: 9px; }
.review-list { display: grid; gap: 10px; }
.review-item { overflow: hidden; border: 1px solid var(--line); border-radius: 6px; background: #fff; }
.review-item summary { padding: 17px 19px; display: grid; grid-template-columns: 33px 1fr auto; gap: 12px; align-items: center; cursor: pointer; list-style: none; }
.review-item summary::-webkit-details-marker { display: none; }
.review-status { width: 29px; height: 29px; display: grid; place-items: center; border-radius: 50%; background: #e9f4ee; color: var(--success); font-weight: 900; }
.review-item.incorrect .review-status { background: #fce8eb; color: var(--cgi-red-dark); }
.review-item summary strong { font-size: 0.86rem; line-height: 1.4; }
.review-item summary small { color: var(--muted); }
.review-body { padding: 0 20px 20px 64px; color: #514b48; line-height: 1.55; }
.review-answer { margin: 0 0 10px; padding: 10px 12px; border-left: 3px solid var(--success); background: #f0f7f3; }
.review-body p:last-child { margin-bottom: 0; }

.leaderboard-page { width: min(1760px, 100%); margin: 0 auto; padding: 24px clamp(18px, 3vw, 44px) 48px; }
.leaderboard-heading { display: flex; align-items: center; justify-content: space-between; gap: 30px; }
.leaderboard-title-group { display: flex; align-items: center; gap: 10px; }
.leaderboard-heading h1 { margin: 0; font-family: Georgia, "Times New Roman", serif; font-size: clamp(1.8rem, 3vw, 2.35rem); }
.leaderboard-heading .secondary-button { min-height: 38px; }
.leaderboard-help { position: relative; z-index: 16; }
.leaderboard-help::after { content: ""; position: absolute; top: 100%; left: -5px; width: 40px; height: 8px; }
.leaderboard-help-button { width: 30px; height: 30px; padding: 0; display: grid; place-items: center; border: 1px solid #d8d2ce; border-radius: 50%; background: #fff; color: var(--cgi-red-dark); font-size: 0.9rem; font-weight: 900; line-height: 1; box-shadow: 0 5px 14px rgba(45, 35, 31, 0.06); }
.leaderboard-help-button:hover, .leaderboard-help-button[aria-expanded="true"] { border-color: var(--cgi-red); background: #fff4f6; }
.leaderboard-help-button:focus-visible { outline: 3px solid rgba(227, 25, 55, 0.18); outline-offset: 2px; }
.leaderboard-help-panel { position: absolute; top: calc(100% + 5px); left: 0; width: min(540px, calc(100vw - 44px)); max-height: calc(100vh - 120px); padding: 18px 20px; overflow-y: auto; border: 1px solid #ddd4d1; border-top: 3px solid var(--cgi-red); border-radius: 8px; background: #fff; box-shadow: 0 22px 60px rgba(45, 35, 31, 0.2); }
.leaderboard-help-panel h2 { margin: 3px 0 13px; font-family: Georgia, "Times New Roman", serif; font-size: 1.25rem; }
.leaderboard-help-panel ul { margin: 0; padding: 0; display: grid; gap: 10px; list-style: none; }
.leaderboard-help-panel li { position: relative; padding-left: 16px; color: #514b48; font-size: 0.78rem; line-height: 1.48; }
.leaderboard-help-panel li::before { content: ""; position: absolute; top: 0.57em; left: 0; width: 5px; height: 5px; border-radius: 50%; background: var(--cgi-red); }
.leaderboard-help-panel li strong { color: var(--ink); }
.leaderboard-help-note { margin: 14px 0 0; padding: 10px 12px; border-left: 3px solid var(--cgi-red); background: #fff5f6; color: #514b48; font-size: 0.75rem; line-height: 1.45; }
.leaderboard-loading, .leaderboard-error { min-height: 180px; display: flex; align-items: center; justify-content: center; gap: 10px; color: var(--muted); }
.leaderboard-error { color: var(--cgi-red-dark); }
.streak-leaderboard { margin-top: 18px; padding: 0; overflow: hidden; border: 1px solid #d8a9b0; border-top: 4px solid var(--cgi-red); border-radius: 9px; background: linear-gradient(110deg, #fff, #fff8f9); box-shadow: 0 15px 38px rgba(99, 27, 39, 0.08); }
.streak-leaderboard > header { min-height: 84px; padding: 16px 19px; display: flex; align-items: center; justify-content: space-between; gap: 20px; border-bottom: 1px solid #ead9dc; }
.streak-leaderboard h2 { margin: 2px 0 0; font-family: Georgia, "Times New Roman", serif; font-size: 1.5rem; }
.streak-leaderboard header p:last-child { margin: 3px 0 0; color: var(--muted); font-size: 0.76rem; }
.streak-rule { padding: 7px 10px; border: 1px solid #e0b8bf; border-radius: 999px; background: #fff; color: var(--cgi-red-dark); font-size: 0.68rem; font-weight: 900; white-space: nowrap; }
.streak-board { min-height: 0; border: 0; border-radius: 0; box-shadow: none; }
.streak-board .track-board-empty { min-height: 100px; }
.streak-board table { table-layout: fixed; }
.streak-board th:nth-child(1) { width: 74px; }
.streak-board th:nth-child(3), .streak-board th:nth-child(4) { width: 150px; }
.streak-board .leaderboard-person strong, .streak-board .leaderboard-person small { max-width: 420px; }
.team-scoreboard { margin-top: 16px; overflow: hidden; border: 1px solid var(--line); border-radius: 8px; background: #fff; box-shadow: 0 10px 28px rgba(45, 35, 31, 0.045); }
.team-scoreboard > header { min-height: 66px; padding: 12px 16px; display: flex; align-items: center; justify-content: space-between; gap: 20px; border-bottom: 1px solid var(--line); background: #fffafb; }
.team-scoreboard h2 { margin: 3px 0 0; font-family: Georgia, "Times New Roman", serif; font-size: 1.2rem; }
.medal-points { display: flex; flex-wrap: wrap; gap: 7px; color: #514b48; font-size: 0.72rem; font-weight: 800; }
.medal-points span { min-width: 52px; padding: 6px 8px; border: 1px solid #e6dfdb; border-radius: 999px; background: #fff; text-align: center; }
.medal-points b { font-size: 0.9rem; }
.team-score-table-wrap { overflow-x: auto; }
.team-score-table { min-width: 100%; table-layout: fixed; }
.team-score-table th, .team-score-table td { height: 40px; padding: 7px 12px; text-align: center; }
.team-score-table th:first-child { width: 48%; text-align: left; }
.team-score-table th:last-child { width: 16%; }
.team-score-table thead th { background: #fff; }
.team-score-table tbody tr { height: 40px; background: #fff; cursor: default; }
.team-score-table tbody tr + tr th { border-top: 1px solid #eeeae7; }
.team-score-table tbody th { color: #3e3936; font-size: 0.76rem; }
.team-score-table tbody td { color: var(--muted); font-size: 0.76rem; font-variant-numeric: tabular-nums; }
.team-score-table tbody td:last-child strong { color: var(--cgi-red-dark); font-size: 0.86rem; }
.team-score-table tbody tr.team-score-leader { background: #fff9ea; }
.leaderboard-matrix { margin-top: 22px; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: clamp(22px, 2vw, 34px); align-items: start; }
.leaderboard-role { min-width: 0; }
.leaderboard-role > h2 { margin: 0 0 7px; color: var(--cgi-red-dark); font-size: 0.75rem; letter-spacing: 0.08em; text-transform: uppercase; }
.leaderboard-role .track-board + .track-board { margin-top: 10px; }
.track-board { min-width: 0; min-height: 180px; overflow: hidden; border: 1px solid var(--line); border-radius: 7px; background: #fff; box-shadow: 0 10px 28px rgba(45, 35, 31, 0.055); }
.track-board > header { min-height: 44px; padding: 8px 12px; display: flex; align-items: baseline; gap: 8px; border-bottom: 1px solid var(--line); }
.track-board h3 { margin: 0; font-family: Georgia, "Times New Roman", serif; font-size: 1.08rem; }
.track-board-empty { min-height: 134px; margin: 0; display: grid; place-items: center; color: var(--muted); font-size: 0.8rem; }
.table-scroll {
  max-height: calc(30px + (54px * 5));
  overflow-x: auto;
  overflow-y: scroll;
  scrollbar-color: #b8b0ac #f4f0ed;
  scrollbar-width: thin;
}
.table-scroll::-webkit-scrollbar { width: 7px; height: 7px; }
.table-scroll::-webkit-scrollbar-track { background: #f4f0ed; }
.table-scroll::-webkit-scrollbar-thumb { border-radius: 999px; background: #b8b0ac; }
.table-scroll::-webkit-scrollbar-thumb:hover { background: #8d817b; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 8px 7px; text-align: left; white-space: nowrap; }
th { height: 30px; background: var(--soft); color: #6b6561; font-size: 0.62rem; letter-spacing: 0.08em; text-transform: uppercase; }
.table-scroll th { position: sticky; top: 0; z-index: 1; }
tbody tr + tr td { border-top: 1px solid #eeeae7; }
tbody tr { height: 54px; background: #fff; cursor: help; }
tbody tr.podium-gold { background: #fffbeb; }
tbody tr.podium-silver { background: #f6f8f9; }
tbody tr.podium-bronze { background: #fff6f0; }
tbody tr.current-user { box-shadow: inset 3px 0 var(--cgi-red); }
.rank-cell { width: 42px; color: var(--cgi-red-dark); font-size: 0.75rem; font-weight: 800; text-align: center; }
.rank-medal { width: 22px; height: 26px; display: block; margin: 0 auto; overflow: visible; }
.rank-medal circle { fill: currentColor; stroke: rgba(36, 36, 36, 0.25); stroke-width: 1; }
.rank-medal text { fill: #fff; font-size: 10px; font-weight: 900; font-family: "Segoe UI", Arial, sans-serif; }
.rank-medal.gold { color: #c79200; }
.rank-medal.silver { color: #8b9299; }
.rank-medal.bronze { color: #a95f32; }
.leaderboard-person-cell { display: flex; align-items: center; gap: 8px; }
.leaderboard-avatar { width: 30px; height: 30px; flex: 0 0 30px; display: grid; place-items: center; object-fit: cover; border: 1px solid #e1dcda; border-radius: 50%; background: #f5e8eb; color: var(--cgi-red-dark); font-size: 0.61rem; font-weight: 800; }
.leaderboard-person { display: flex; min-width: 0; flex-direction: column; gap: 2px; }
.leaderboard-person strong { max-width: 210px; overflow: hidden; text-overflow: ellipsis; font-size: 0.78rem; }
.leaderboard-person small { max-width: 210px; overflow: hidden; color: var(--muted); font-size: 0.66rem; line-height: 1.2; text-overflow: ellipsis; white-space: normal; }
.score-cell strong { color: var(--cgi-red-dark); font-size: 0.86rem; }

.admin-page { width: min(1240px, 100%); margin: 0 auto; padding: 36px clamp(18px, 4vw, 54px) 70px; }
.admin-shell-heading h1 { margin: 6px 0 0; font-family: Georgia, "Times New Roman", serif; font-size: clamp(2rem, 4vw, 2.7rem); }
.admin-section-bar { margin-top: 22px; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 18px; }
.admin-tabs { width: fit-content; padding: 4px; display: flex; gap: 3px; border: 1px solid var(--line); border-radius: 7px; background: #efedeb; }
.admin-tabs button { min-height: 40px; padding: 0 18px; border: 0; border-radius: 5px; background: transparent; color: #615a56; font: inherit; font-size: 0.76rem; font-weight: 800; cursor: pointer; }
.admin-tabs button:hover { color: var(--ink); }
.admin-tabs button.active { background: #fff; color: var(--ink); box-shadow: 0 2px 8px rgba(45, 35, 31, 0.1); }
.admin-tabs button:focus-visible { outline: 3px solid rgba(227, 25, 55, 0.18); outline-offset: 2px; }
.admin-panel { margin-top: 18px; }
.admin-library-title-row { display: flex; flex-wrap: wrap; align-items: center; gap: 11px; }
.admin-total-count { min-height: 28px; padding: 0 11px; display: inline-flex; align-items: center; gap: 5px; border: 1px solid #e5deda; border-radius: 999px; background: #fff; color: var(--muted); font-size: 0.7rem; font-weight: 700; white-space: nowrap; }
.admin-total-count strong { color: var(--cgi-red-dark); font-size: 0.82rem; font-variant-numeric: tabular-nums; }
.admin-loading, .admin-error { min-height: 180px; display: flex; align-items: center; justify-content: center; gap: 10px; color: var(--muted); }
.admin-error { color: var(--cgi-red-dark); }
.admin-overview-content { margin-top: 0; }
.admin-stat-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.admin-stat-grid article { min-height: 116px; padding: 17px 18px; display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: 8px; background: #fff; box-shadow: 0 9px 25px rgba(45, 35, 31, 0.035); }
.admin-stat-grid span { color: var(--muted); font-size: 0.7rem; font-weight: 800; }
.admin-stat-grid strong { margin-top: auto; color: var(--cgi-red-dark); font-family: Georgia, "Times New Roman", serif; font-size: 1.85rem; font-variant-numeric: tabular-nums; }
.admin-stat-grid small { margin-top: 2px; color: var(--success); font-size: 0.68rem; font-weight: 800; }
.admin-roster { margin-top: 18px; overflow: hidden; border: 1px solid var(--line); border-radius: 8px; background: #fff; box-shadow: 0 9px 25px rgba(45, 35, 31, 0.035); }
.admin-roster > header { padding: 16px 18px; display: flex; align-items: center; justify-content: space-between; gap: 20px; border-bottom: 1px solid #eeeae7; }
.admin-roster h2 { margin: 4px 0 0; font-family: Georgia, "Times New Roman", serif; font-size: 1.25rem; }
.admin-roster > header > span { min-width: 30px; height: 30px; padding: 0 8px; display: grid; place-items: center; border-radius: 999px; background: #fff1f3; color: var(--cgi-red-dark); font-size: 0.74rem; font-weight: 900; }
.admin-roster > div { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.admin-roster-entry { min-width: 0; padding: 13px 18px; display: flex; align-items: center; gap: 11px; border-bottom: 1px solid #f0edeb; }
.admin-roster-entry:nth-child(odd) { border-right: 1px solid #f0edeb; }
.admin-roster-icon { width: 30px; height: 30px; flex: 0 0 30px; display: grid; place-items: center; border: 1px solid #efb8c1; border-radius: 50%; background: #fff4f6; color: var(--cgi-red-dark); font-size: 0.66rem; font-weight: 900; }
.admin-roster-entry div { min-width: 0; display: grid; gap: 2px; }
.admin-roster-entry strong { overflow: hidden; color: #332e2b; font-size: 0.78rem; text-overflow: ellipsis; white-space: nowrap; }
.admin-roster-entry small { color: var(--muted); font-size: 0.66rem; }
.admin-import-panel { margin-top: 0; padding: 15px 16px; display: grid; grid-template-columns: minmax(180px, 0.7fr) minmax(420px, 1.3fr); align-items: center; gap: 8px 22px; border: 1px solid var(--line); border-radius: 8px; background: #fff; box-shadow: 0 8px 24px rgba(45, 35, 31, 0.03); }
.admin-import-copy { min-width: 0; display: flex; align-items: center; }
.admin-import-copy strong { color: #332e2b; font-size: 0.84rem; }
.admin-import-actions { min-width: 0; display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 9px; }
.admin-import-actions input[type="file"] { min-width: 220px; max-width: 330px; color: #5e5753; font: inherit; font-size: 0.7rem; }
.admin-import-actions input[type="file"]::file-selector-button { min-height: 34px; margin-right: 9px; padding: 0 11px; border: 1px solid #d6d0cc; border-radius: 5px; background: #fff; color: #403a37; font: inherit; font-weight: 800; cursor: pointer; }
.admin-import-actions input[type="file"]::file-selector-button:hover { border-color: #aaa39e; }
.admin-import-actions .secondary-button { min-height: 36px; }
.admin-template-link { color: var(--cgi-red-dark); font-size: 0.71rem; font-weight: 800; text-underline-offset: 3px; }
.admin-template-link:hover { color: var(--cgi-red); }
.admin-filters { margin-top: 24px; padding: 14px; display: grid; grid-template-columns: minmax(240px, 1fr) repeat(3, minmax(150px, 190px)); gap: 12px; border: 1px solid var(--line); border-radius: 8px; background: #fff; }
.admin-filters label, .question-editor-grid label, .question-explanation-field, .question-reference-field { min-width: 0; display: grid; gap: 6px; }
.admin-filters label > span, .question-editor-grid label > span, .question-explanation-field > span, .question-reference-field > span { color: #514b48; font-size: 0.69rem; font-weight: 800; }
.question-reference-field > span small { color: var(--muted); font-size: inherit; font-weight: 500; }
.admin-filters input, .admin-filters select, .question-editor-grid input, .question-editor-grid select, .question-editor-grid textarea, .answer-editor textarea, .question-explanation-field textarea, .question-reference-field input { width: 100%; min-height: 42px; padding: 9px 11px; border: 1px solid #d8d2ce; border-radius: 5px; background: #fff; color: var(--ink); font: inherit; line-height: 1.4; }
.admin-filters input:focus, .admin-filters select:focus, .question-editor-form input:focus, .question-editor-form select:focus, .question-editor-form textarea:focus { border-color: var(--cgi-red); outline: 3px solid rgba(227, 25, 55, 0.1); }
.admin-list-heading { margin: 26px 0 10px; display: flex; align-items: baseline; justify-content: space-between; gap: 20px; }
.admin-list-heading h2 { margin: 0; font-family: Georgia, "Times New Roman", serif; font-size: 1.45rem; }
.admin-list-heading span { color: var(--muted); font-size: 0.74rem; }
.admin-question-list { display: grid; gap: 10px; }
.admin-question-card { overflow: hidden; border: 1px solid var(--line); border-radius: 8px; background: #fff; box-shadow: 0 8px 24px rgba(45, 35, 31, 0.035); }
.admin-question-card.offline { border-color: #d7d2cf; background: #f3f1ef; box-shadow: none; }
.admin-question-card.offline .admin-question-meta, .admin-question-card.offline .admin-question-id, .admin-question-card.offline .admin-question-main, .admin-question-card.offline .admin-question-details { opacity: 0.58; }
.admin-question-card > header { padding: 14px 16px 0; display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; }
.admin-question-meta { display: flex; flex-wrap: wrap; gap: 6px; }
.admin-question-meta span { padding: 4px 7px; border-radius: 999px; background: var(--soft); color: #655e5a; font-size: 0.62rem; font-weight: 800; letter-spacing: 0.04em; text-transform: uppercase; }
.admin-question-meta .modified { background: #fff0d5; color: #7d5200; }
.admin-question-meta .custom { background: #eaf4ef; color: var(--success); }
.admin-question-header-tools { flex: 0 0 auto; display: flex; align-items: center; gap: 8px; }
.admin-question-id { flex: 0 0 auto; color: #88817d; font-family: Consolas, monospace; font-size: 0.67rem; }
.admin-question-delete { width: 27px; height: 27px; padding: 0; display: grid; place-items: center; border: 1px solid transparent; border-radius: 50%; background: transparent; color: #8a827e; font: inherit; font-size: 1.12rem; line-height: 1; cursor: pointer; }
.admin-question-delete:hover { border-color: #efc2c9; background: #fff1f3; color: var(--cgi-red-dark); }
.admin-question-delete:focus-visible { border-color: var(--cgi-red); outline: 3px solid rgba(227, 25, 55, 0.12); }
.admin-question-delete:disabled { cursor: wait; opacity: 0.6; }
.admin-question-main { padding: 11px 16px 15px; }
.admin-question-main h3 { margin: 0; color: #332e2b; font-size: 0.98rem; line-height: 1.45; }
.admin-question-card.offline h3 { color: #746e6a; }
.admin-correct-answer { margin: 9px 0 0; padding: 8px 10px; border-left: 3px solid var(--success); border-radius: 3px; background: #f1f8f4; color: #3d4e44; font-size: 0.78rem; line-height: 1.45; }
.admin-correct-answer strong { margin-right: 5px; color: var(--success); }
.admin-question-details { border-top: 1px solid #eeeae7; }
.admin-question-details summary { padding: 10px 16px; color: #625b57; font-size: 0.73rem; font-weight: 800; cursor: pointer; list-style: none; }
.admin-question-details summary::-webkit-details-marker { display: none; }
.admin-question-details summary::before { margin-right: 7px; color: var(--cgi-red-dark); content: "+"; }
.admin-question-details[open] summary::before { content: "−"; }
.admin-question-detail-body { padding: 0 16px 15px; }
.admin-answer-list { margin: 0; padding: 0; display: grid; gap: 6px; list-style: none; }
.admin-answer-list li { padding: 8px 10px; display: grid; grid-template-columns: 23px 1fr; gap: 8px; border: 1px solid #ece7e4; border-radius: 4px; color: #5a534f; font-size: 0.75rem; line-height: 1.4; }
.admin-answer-list li.correct { border-color: #b9d8c7; background: #f1f8f4; color: #35483e; }
.admin-answer-list b { color: var(--cgi-red-dark); }
.admin-explanation { margin: 10px 0 0; color: var(--muted); font-size: 0.75rem; line-height: 1.55; }
.admin-question-detail-body .question-resource-content { margin-top: 12px; grid-template-columns: minmax(0, 260px) auto; align-items: end; }
.admin-question-actions { padding: 10px 16px; display: flex; justify-content: flex-end; gap: 8px; border-top: 1px solid #eeeae7; background: #fcfbfa; }
.admin-question-actions button { min-height: 34px; padding: 0 11px; font-size: 0.7rem; }
.admin-question-actions .admin-preview-button { min-width: 76px; }
.admin-question-card.offline .admin-question-actions { background: #ebe8e6; }
.admin-status-toggle { min-height: 34px; padding: 0 10px; display: inline-flex; align-items: center; gap: 8px; border: 1px solid #d6d0cc; border-radius: 5px; background: #fff; color: #5d5652; font-size: 0.7rem; font-weight: 800; cursor: pointer; user-select: none; }
.admin-status-toggle input { position: absolute; width: 1px; height: 1px; overflow: hidden; opacity: 0; }
.admin-status-toggle-track { width: 32px; height: 18px; padding: 2px; display: block; border-radius: 999px; background: #aaa4a0; transition: background 0.16s ease; }
.admin-status-toggle-track::after { width: 14px; height: 14px; display: block; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(45, 35, 31, 0.25); content: ""; transition: transform 0.16s ease; }
.admin-status-toggle input:checked + .admin-status-toggle-track { background: var(--success); }
.admin-status-toggle input:checked + .admin-status-toggle-track::after { transform: translateX(14px); }
.admin-status-toggle input:focus-visible + .admin-status-toggle-track { outline: 3px solid rgba(227, 25, 55, 0.16); outline-offset: 2px; }
.admin-status-toggle:has(input:disabled) { cursor: wait; opacity: 0.65; }
.admin-empty { margin: 0; padding: 50px 20px; border: 1px dashed #cfc8c4; border-radius: 8px; color: var(--muted); text-align: center; }

.question-editor-dialog { width: min(780px, calc(100% - 28px)); max-height: calc(100vh - 28px); padding: 0; overflow-y: auto; border: 0; border-radius: 10px; background: #fff; color: var(--ink); box-shadow: 0 24px 70px rgba(30, 24, 21, 0.3); }
.question-editor-dialog::backdrop { background: rgba(35, 29, 27, 0.58); backdrop-filter: blur(2px); }
.question-editor-form { padding: 26px; }
.question-editor-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; }
.question-editor-heading h2 { margin: 6px 0 0; font-family: Georgia, "Times New Roman", serif; font-size: 1.75rem; }
.question-editor-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.question-editor-shared { margin: 24px 0 18px; }
.localized-question-editor { min-width: 0; margin: 14px 0 0; padding: 16px; border: 1px solid #e3ddda; border-radius: 7px; background: #fcfbfa; }
.localized-question-editor > legend { padding: 0 7px; color: var(--ink); font-weight: 800; }
.localized-language-flag { width: 24px; height: 16px; margin-right: 3px; object-fit: cover; vertical-align: -3px; border: 1px solid rgba(45, 35, 31, 0.22); border-radius: 2px; }
.question-editor-grid .wide-field { grid-column: 1 / -1; }
.question-editor-grid textarea, .answer-editor textarea, .question-explanation-field textarea { resize: vertical; }
.question-editor-grid small { color: var(--muted); font-size: 0.68rem; }
.answer-editor { min-width: 0; margin: 20px 0 0; padding: 0; display: grid; gap: 9px; border: 0; }
.answer-editor legend { margin-bottom: 9px; color: #514b48; font-size: 0.76rem; font-weight: 800; }
.answer-editor legend span { color: var(--muted); font-weight: 400; }
.answer-editor-row { display: grid; grid-template-columns: 36px minmax(0, 1fr); gap: 9px; align-items: center; }
.answer-editor-row > input { width: 21px; height: 21px; margin: 0 auto; accent-color: var(--cgi-red); }
.answer-editor-row label { min-width: 0; position: relative; display: block; }
.answer-editor-row label > span { position: absolute; top: 10px; left: 11px; z-index: 1; color: var(--cgi-red-dark); font-size: 0.72rem; font-weight: 900; }
.answer-editor-row textarea { padding-left: 34px; }
.answer-editor-row:has(> input:checked) textarea { border-color: #92bea5; background: #f3faf6; }
.answer-editor-row.translation-answer > span { text-align: center; color: var(--cgi-red-dark); font-size: 0.72rem; font-weight: 900; }
.answer-editor-row.translation-answer textarea { width: 100%; min-width: 0; padding-left: 11px; grid-column: 2; }
.question-explanation-field { margin-top: 20px; }
.question-reference-field { margin-top: 14px; }
.question-illustration-editor { margin-top: 16px; padding: 16px; border: 1px solid #e3ddda; border-radius: 7px; background: #fcfbfa; }
.question-illustration-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; }
.question-illustration-heading > div:first-child { min-width: 0; }
.question-illustration-heading strong, .question-illustration-heading small { display: block; }
.question-illustration-heading strong { font-size: 0.86rem; }
.question-illustration-heading strong span { color: var(--muted); font-size: 0.68rem; font-weight: 500; }
.question-illustration-heading small { max-width: 500px; margin-top: 4px; color: var(--muted); font-size: 0.7rem; line-height: 1.45; }
.question-illustration-actions { flex: 0 0 auto; display: flex; align-items: center; gap: 10px; }
.question-illustration-actions .text-button { min-height: 34px; font-size: 0.72rem; }
.question-illustration-preview { width: min(100%, 520px); margin-top: 14px; overflow: hidden; border: 1px solid #ded7d3; border-radius: 6px; background: #f1eeeb; }
.question-illustration-preview img { width: 100%; aspect-ratio: 16 / 9; display: block; object-fit: cover; }
.question-illustration-status { margin: 12px 0 0; padding: 10px 12px; border-radius: 5px; background: var(--soft); color: var(--muted); font-size: 0.73rem; line-height: 1.45; }
.question-illustration-status.error { background: #fff1f3; color: var(--cgi-red-dark); }
.question-crop-editor { margin-top: 14px; padding-top: 14px; border-top: 1px solid #e5dfdb; }
.question-crop-canvas { width: min(100%, 640px); height: auto; margin: 14px auto 0; display: block; border-radius: 7px; background: #ece8e5; box-shadow: inset 0 0 0 1px rgba(45, 35, 31, 0.14); cursor: grab; touch-action: none; }
.question-crop-canvas.dragging { cursor: grabbing; }
.question-crop-canvas:focus-visible { outline: 3px solid rgba(227, 25, 55, 0.2); outline-offset: 3px; }
.question-editor-actions { margin-top: 24px; padding: 18px 0 0; display: flex; justify-content: flex-end; gap: 9px; border-top: 1px solid #eeeae7; background: transparent; }

.profile-dialog { width: min(620px, calc(100% - 28px)); max-height: calc(100vh - 28px); padding: 0; overflow-y: auto; border: 0; border-radius: 10px; background: #fff; color: var(--ink); box-shadow: 0 24px 70px rgba(30, 24, 21, 0.3); }
.profile-dialog::backdrop { background: rgba(35, 29, 27, 0.52); backdrop-filter: blur(2px); }
.profile-form { padding: 26px; }
.profile-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; }
.profile-heading h2 { margin: 6px 0 0; font-family: Georgia, "Times New Roman", serif; font-size: 1.65rem; }
.profile-close { width: 34px; height: 34px; padding: 0; border: 0; border-radius: 50%; background: var(--soft); color: #5d5652; font-size: 1.35rem; line-height: 1; }
.profile-onboarding-note { margin: 20px 0 0; padding: 12px 14px; border-left: 3px solid var(--cgi-red); border-radius: 4px; background: #fff5f6; color: #5c5551; font-size: 0.79rem; line-height: 1.55; }
.profile-required-marker { color: var(--cgi-red); }
.profile-photo-editor { margin-top: 24px; padding: 16px; display: grid; grid-template-columns: 78px 1fr; gap: 16px; align-items: center; border-radius: 7px; background: var(--soft); }
.profile-photo-editor img, .profile-photo-fallback { width: 78px; height: 78px; display: grid; place-items: center; object-fit: cover; border: 1px solid #d8d0cc; border-radius: 50%; background: #f5e8eb; color: var(--cgi-red-dark); font-weight: 800; }
.profile-photo-editor > div { min-width: 0; display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.profile-photo-editor small { width: 100%; color: var(--muted); line-height: 1.4; }
.profile-remove-photo { min-height: 34px; font-size: 0.72rem; }
.profile-photo-status { margin: 12px 0 0; padding: 10px 12px; border-radius: 5px; background: var(--soft); color: var(--muted); font-size: 0.75rem; line-height: 1.45; }
.profile-photo-status.error { background: #fff1f3; color: var(--cgi-red-dark); }
.profile-crop-editor { margin-top: 16px; padding: 16px; border: 1px solid #e2dcda; border-radius: 7px; background: #fbfaf9; }
.profile-crop-heading strong, .profile-crop-heading small { display: block; }
.profile-crop-heading strong { font-size: 0.86rem; }
.profile-crop-heading small { margin-top: 4px; color: var(--muted); font-size: 0.72rem; line-height: 1.45; }
.profile-crop-canvas { width: min(100%, 320px); height: auto; margin: 14px auto 0; display: block; border-radius: 7px; background: #ece8e5; box-shadow: inset 0 0 0 1px rgba(45, 35, 31, 0.14); cursor: grab; touch-action: none; }
.profile-crop-canvas.dragging { cursor: grabbing; }
.profile-crop-canvas:focus-visible { outline: 3px solid rgba(227, 25, 55, 0.2); outline-offset: 3px; }
.profile-crop-controls { margin-top: 14px; display: grid; grid-template-columns: 1.2fr 1fr 1fr; gap: 12px; }
.profile-crop-controls label { min-width: 0; display: grid; gap: 5px; color: #5c5551; font-size: 0.68rem; font-weight: 700; }
.profile-crop-controls input { width: 100%; accent-color: var(--cgi-red); }
.profile-crop-actions { margin-top: 15px; display: flex; justify-content: flex-end; gap: 8px; }
.profile-field { margin-top: 20px; display: grid; gap: 7px; }
.profile-field > span { color: #504a47; font-size: 0.75rem; font-weight: 800; }
.profile-field select { width: 100%; min-height: 44px; padding: 0 12px; border: 1px solid var(--line); border-radius: 5px; background: #fff; color: var(--ink); }
.language-picker { min-width: 0; }
.language-picker-button { width: 100%; min-height: 44px; padding: 0 13px 0 15px; display: flex; align-items: center; justify-content: space-between; gap: 14px; border: 1px solid var(--line); border-radius: 5px; background: #fff; color: var(--ink); text-align: left; }
.language-picker-button:hover, .language-picker-button.open { border-color: #aaa39e; }
.language-picker-button:focus-visible, .language-picker-menu button:focus-visible { border-color: var(--cgi-red); outline: 3px solid rgba(227, 25, 55, 0.1); outline-offset: 1px; }
.language-picker-button.placeholder { color: var(--muted); font-weight: 400; }
.language-picker-value { min-width: 0; display: flex; align-items: center; gap: 12px; font-weight: 700; }
.language-picker-value img, .language-picker-menu img { width: 27px; height: 18px; flex: 0 0 27px; object-fit: cover; border: 1px solid rgba(45, 35, 31, 0.22); border-radius: 2px; box-shadow: 0 1px 3px rgba(45, 35, 31, 0.12); }
.language-picker-chevron { width: 14px; height: 9px; flex: 0 0 14px; fill: none; stroke: currentColor; stroke-linecap: round; stroke-linejoin: round; stroke-width: 1.8; transition: transform 0.15s ease; }
.language-picker-button.open .language-picker-chevron { transform: rotate(180deg); }
.language-picker-menu { margin-top: 5px; display: grid; overflow: hidden; border: 1px solid #cfc9c5; border-radius: 5px; background: #fff; box-shadow: 0 12px 28px rgba(45, 35, 31, 0.12); }
.language-picker-menu button { min-height: 44px; padding: 0 14px; display: grid; grid-template-columns: 27px minmax(0, 1fr) 18px; align-items: center; gap: 12px; border: 0; background: #fff; color: var(--ink); text-align: left; }
.language-picker-menu button + button { border-top: 1px solid #eeeae7; }
.language-picker-menu button:hover, .language-picker-menu button:focus-visible { background: var(--soft); }
.language-picker-menu button[aria-checked="true"] { background: #fff4f6; color: var(--cgi-red-dark); font-weight: 800; }
.language-picker-check { color: var(--cgi-red-dark); font-weight: 900; opacity: 0; }
.language-picker-menu button[aria-checked="true"] .language-picker-check { opacity: 1; }
.profile-note { margin: 16px 0 0; color: var(--muted); font-size: 0.75rem; line-height: 1.5; }
.profile-actions { margin-top: 24px; display: flex; justify-content: flex-end; gap: 9px; }

.streak-nudge-dialog { width: min(540px, calc(100% - 28px)); padding: 0; border: 0; border-top: 4px solid var(--cgi-red); border-radius: 10px; background: #fff; color: var(--ink); box-shadow: 0 24px 70px rgba(30, 24, 21, 0.3); }
.streak-nudge-dialog::backdrop { background: rgba(35, 29, 27, 0.52); backdrop-filter: blur(2px); }
.streak-nudge-content { padding: 30px; }
.streak-nudge-content h2 { margin: 7px 0 14px; font-family: Georgia, "Times New Roman", serif; font-size: clamp(1.55rem, 4vw, 2rem); }
.streak-nudge-content > p:not(.eyebrow) { margin: 0 0 11px; color: var(--muted); line-height: 1.6; }
.streak-nudge-actions { margin-top: 24px; display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 9px; }

.toast { position: fixed; right: 24px; bottom: 24px; z-index: 40; max-width: min(420px, calc(100vw - 32px)); padding: 14px 17px; border-radius: 6px; background: #2d2927; color: #fff; box-shadow: 0 14px 36px rgba(0, 0, 0, 0.2); line-height: 1.45; }
.toast.error { background: #8c1628; }

footer { min-height: 50px; padding: 12px clamp(20px, 5vw, 72px); display: flex; align-items: center; gap: 20px; border-top: 1px solid var(--line); background: #fff; color: #777; font-size: 0.7rem; }

@media (max-width: 980px) {
  .path-grid { grid-template-columns: 1fr; }
  .path-card { min-height: 0; }
  .quiz-layout { grid-template-columns: 1fr; }
  .question-map { position: static; }
  .question-map > div { grid-template-columns: repeat(10, 1fr); }
}

@media (max-width: 1220px) {
  .leaderboard-matrix { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 760px) {
  .leaderboard-matrix { grid-template-columns: 1fr; }
}

@media (max-width: 700px) {
  .topbar { min-height: 62px; padding: 0 14px; display: grid; grid-template-columns: auto auto auto; justify-content: space-between; gap: 10px; }
  .account { gap: 5px; }
  .admin-trigger { width: 34px; height: 34px; flex-basis: 34px; padding: 7px; }
  .account .secondary-button.compact { width: 38px; padding: 0; overflow: hidden; font-size: 0; }
  .account .secondary-button.compact::after { content: "Exit"; font-size: 0.66rem; }
  .brand-logo { width: 62px; }
  .brand-divider, .brand-label, .profile-trigger strong { display: none; }
  .main-navigation { margin-left: 0; }
  .main-navigation button { width: 37px; padding: 0; overflow: hidden; font-size: 0; }
  .main-navigation button[data-view-target="home"]::after { content: "Play"; font-size: 0.68rem; }
  .main-navigation button[data-view-target="leaderboard"]::after { content: "Board"; font-size: 0.68rem; }
  .path-section { padding-top: 24px; }
  .streak-launch { align-items: stretch; flex-direction: column; gap: 12px; }
  .streak-launch::after { right: -20px; bottom: -28px; }
  .streak-launch button { width: 100%; }
  .streak-run-summary { align-items: stretch; flex-direction: column; gap: 6px; }
  .streak-run-summary > div { justify-content: space-between; }
  .streak-target-progress { grid-template-columns: 1fr; gap: 7px; }
  .streak-target-person > span:last-child { white-space: normal; }
  .streak-leaderboard > header { align-items: flex-start; flex-direction: column; gap: 10px; }
  .streak-board th:nth-child(3), .streak-board th:nth-child(4) { width: 110px; }
  .team-scoreboard > header { align-items: flex-start; flex-direction: column; gap: 10px; }
  .medal-points { width: 100%; }
  .team-score-table th, .team-score-table td { padding-right: 6px; padding-left: 6px; }
  .section-heading { align-items: start; flex-direction: column; gap: 12px; }
  .quiz-header { grid-template-columns: 1fr auto; }
  .quiz-identity { grid-row: 2; grid-column: 1 / -1; }
  .quiz-timer { grid-column: 2; }
  .question-map > div { grid-template-columns: repeat(6, 1fr); }
  .question-card { padding: 24px 18px; }
  .question-actions { flex-wrap: wrap; }
  .question-actions > span { width: 100%; order: -1; text-align: center; }
  .question-actions button { flex: 1; }
  .result-hero { grid-template-columns: 1fr; }
  .score-ring { margin: 0 auto; }
  .result-actions > button { width: 100%; }
  .review-item summary { grid-template-columns: 33px 1fr; }
  .review-item summary small { grid-column: 2; }
  .review-body { padding-left: 20px; }
  .leaderboard-heading { align-items: flex-start; flex-direction: column; }
  .admin-stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .admin-roster > div { grid-template-columns: 1fr; }
  .admin-roster-entry:nth-child(odd) { border-right: 0; }
  .admin-import-panel { grid-template-columns: 1fr; }
  .admin-import-actions { justify-content: flex-start; }
  .admin-filters { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .admin-search { grid-column: 1 / -1; }
  .admin-question-card > header { flex-direction: column; gap: 8px; }
  .admin-question-actions { flex-wrap: wrap; }
  .admin-question-actions button { flex: 1; }
  .admin-question-actions .admin-status-toggle { flex: 1; justify-content: center; }
  .admin-question-detail-body .question-resource-content { grid-template-columns: 1fr; }
  .question-editor-form { padding: 21px 18px; }
  .question-editor-grid { grid-template-columns: 1fr; }
  .question-editor-grid .wide-field { grid-column: auto; }
  .question-editor-actions button { flex: 1; }
  .question-preview-topbar { min-height: 68px; display: flex; grid-template-columns: none; }
  .question-preview-window-actions { margin-left: auto; }
  .question-preview-heading { align-items: flex-start; flex-direction: column; gap: 12px; }
  .question-illustration-heading { flex-direction: column; }
  .question-illustration-actions { width: 100%; justify-content: flex-start; }
  .profile-form { padding: 21px 18px; }
  .profile-photo-editor { grid-template-columns: 64px 1fr; }
  .profile-photo-editor img, .profile-photo-fallback { width: 64px; height: 64px; }
  .profile-crop-controls { grid-template-columns: 1fr; }
  .streak-nudge-actions { flex-direction: column-reverse; }
  .streak-nudge-actions button { width: 100%; }
  footer { align-items: flex-start; flex-direction: column; }
}

@media (max-width: 760px) {
  .leaderboard-help-panel { position: fixed; top: 82px; right: 18px; left: 18px; width: auto; max-height: calc(100vh - 100px); }
}

@media (max-width: 520px) {
  .topbar {
    min-height: 100px;
    padding-top: 8px;
    padding-bottom: 8px;
    grid-template-columns: auto minmax(0, 1fr);
    grid-template-areas: "brand account" "navigation navigation";
    row-gap: 7px;
  }
  .brand { grid-area: brand; }
  .account { grid-area: account; justify-self: end; }
  .main-navigation { grid-area: navigation; justify-self: center; }
  .path-section { padding-right: 14px; padding-left: 14px; }
  .path-card { padding-right: 16px; padding-left: 16px; }
  .track-actions { grid-template-columns: 1fr; }
  .admin-section-bar { align-items: stretch; }
  .admin-tabs { width: auto; flex: 1 1 220px; }
  .admin-tabs button { flex: 1; padding-right: 10px; padding-left: 10px; }
  .admin-section-bar > .primary-button { flex: 0 0 auto; }
  .admin-stat-grid { grid-template-columns: 1fr; }
  .admin-import-actions { align-items: stretch; flex-direction: column; }
  .admin-import-actions input[type="file"] { width: 100%; max-width: none; }
  .admin-import-actions .secondary-button { width: 100%; }
  .admin-filters { grid-template-columns: 1fr; }
  .admin-search { grid-column: auto; }
  .question-preview-topbar { min-height: 112px; flex-wrap: wrap; }
  .question-preview-window-actions { width: 100%; margin: 0; justify-content: space-between; }
  .question-preview-page { padding-top: 26px; }
  .question-preview-card { padding: 22px 16px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
}
