:root {
  color-scheme: light;
  --bg: #f6f7f4;
  --ink: #17201b;
  --muted: #617067;
  --line: #d8ded6;
  --panel: #ffffff;
  --accent: #0b6b57;
  --accent-strong: #08483d;
  --warn: #8b4d0b;
  --soft: #e8f2ee;
  --shadow: 0 18px 48px rgba(22, 32, 27, 0.1);
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.5;
}

button,
input,
textarea,
select {
  font: inherit;
}

button {
  border: 0;
  background: var(--accent);
  color: white;
  min-height: 42px;
  padding: 0 16px;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 700;
}

button:hover {
  background: var(--accent-strong);
}

button.secondary {
  background: #e6ece8;
  color: var(--ink);
}

button.secondary:hover {
  background: #d9e2dd;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

a {
  color: var(--accent-strong);
}

.shell {
  width: min(1120px, calc(100% - 32px));
  margin: 0 auto;
  padding: 28px 0 48px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 24px;
}

.brand-lockup {
  display: flex;
  align-items: center;
  gap: 16px;
  min-width: 0;
}

.brand-logo {
  display: inline-flex;
  align-items: center;
  flex: 0 0 auto;
}

.brand-logo img {
  display: block;
  width: min(220px, 34vw);
  height: auto;
  max-height: 72px;
  object-fit: contain;
}

.brand {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.brand h1 {
  margin: 0;
  font-size: 24px;
  letter-spacing: 0;
}

.brand span {
  color: var(--muted);
  font-size: 14px;
}

.brand-link {
  width: fit-content;
  font-size: 13px;
  font-weight: 700;
}

.grid {
  display: grid;
  grid-template-columns: minmax(320px, 0.9fr) minmax(360px, 1.1fr);
  gap: 18px;
  align-items: start;
}

.panel,
.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.panel {
  padding: 20px;
}

.card {
  padding: 16px;
  box-shadow: none;
}

.stack {
  display: grid;
  gap: 14px;
}

.assessment-body {
  min-height: 100vh;
  overflow: hidden;
}

.assessment-shell {
  height: 100vh;
  padding-bottom: 28px;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
}

.assessment-grid {
  min-height: 0;
  align-items: stretch;
}

.assessment-sidebar,
.assessment-stage {
  min-height: 0;
  max-height: 100%;
}

.assessment-sidebar {
  align-content: start;
  overflow: auto;
}

.section-timer-card {
  display: grid;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: #fbfcfb;
}

.timer-heading {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
}

.section-timer-card strong {
  display: block;
  font-size: 42px;
  line-height: 1;
  letter-spacing: 0;
}

.overall-progress {
  display: grid;
  gap: 7px;
}

.overall-progress p {
  margin: 0;
}

.progress-track {
  height: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: #e3e9e5;
}

.progress-fill {
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: var(--accent);
  transition: width 200ms ease;
}

.assessment-stage {
  position: relative;
  overflow: hidden;
}

.assessment-page {
  min-height: 100%;
  animation: assessment-page-in 160ms ease-out;
}

.assessment-question-page {
  height: 100%;
  min-height: 0;
  grid-template-rows: auto minmax(0, 1fr) auto;
}

.question-scroll {
  min-height: 0;
  overflow: auto;
  display: grid;
  gap: 14px;
  padding-right: 4px;
}

.answer-dock {
  display: grid;
  gap: 10px;
  border-top: 1px solid var(--line);
  padding-top: 14px;
  background: var(--panel);
}

@keyframes assessment-page-in {
  from {
    opacity: 0;
    transform: translateY(6px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.row {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

.split {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
}

.field {
  display: grid;
  gap: 6px;
}

.field label {
  font-weight: 700;
  font-size: 13px;
}

.field input,
.field textarea,
.field select {
  width: 100%;
  border: 1px solid var(--line);
  background: white;
  color: var(--ink);
  border-radius: 8px;
  min-height: 42px;
  padding: 10px 12px;
}

.field textarea {
  min-height: 150px;
  resize: vertical;
}

.field textarea.code-answer {
  min-height: 260px;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
  font-size: 13px;
  line-height: 1.55;
  tab-size: 2;
}

.hint,
.meta {
  color: var(--muted);
  font-size: 13px;
}

.status {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  background: var(--soft);
  color: var(--accent-strong);
  font-size: 13px;
  font-weight: 700;
}

.status.admin {
  background: #efe9fb;
  color: #4e247f;
}

.timer-strip {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.timer-box {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #fbfcfb;
}

.timer-box strong {
  display: block;
  font-size: 22px;
  line-height: 1.1;
}

.topic-list {
  display: grid;
  gap: 8px;
}

.topic-pill {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  background: #fbfcfb;
}

.topic-pill.active {
  border-color: var(--accent);
  background: var(--soft);
}

.topic-guide-card {
  display: grid;
  gap: 8px;
}

.topic-guide-toggle {
  width: 100%;
  color: var(--ink);
  font-weight: 700;
  text-align: left;
}

.topic-guide-toggle:hover {
  color: var(--ink);
}

.topic-guide-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #f7faf7;
}

.guide-columns {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin-top: 8px;
}

.guide-columns ul {
  margin: 6px 0 0;
  padding-left: 18px;
}

.guide-columns li {
  margin: 5px 0;
}

.prompt {
  white-space: pre-wrap;
  font-size: 17px;
}

.prompt strong {
  font-weight: 800;
}

.readable-text {
  white-space: normal;
  overflow-wrap: anywhere;
  border-radius: 8px;
  background: #f3f6f4;
  padding: 12px;
  line-height: 1.55;
}

.readable-text code {
  font-size: 0.95em;
}

.code-block {
  white-space: pre-wrap;
  overflow-x: auto;
  border-radius: 8px;
  background: #101715;
  color: #f2f7f4;
  padding: 12px;
}

.choice-panel {
  display: grid;
  gap: 10px;
}

.choice-option {
  display: grid;
  grid-template-columns: 24px 1fr;
  gap: 10px;
  align-items: start;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #fbfcfb;
  cursor: pointer;
}

.choice-option:hover,
.choice-option:has(input:checked) {
  border-color: var(--accent);
  background: var(--soft);
}

.choice-option input {
  margin-top: 4px;
}

.choice-panel.invalid .choice-option {
  border-color: #b42318;
  background: #fff3f1;
}

.field textarea.invalid {
  border-color: #b42318;
  box-shadow: 0 0 0 3px rgba(180, 35, 24, 0.14);
}

.blank-topic {
  min-height: 360px;
  display: grid;
  place-items: center;
  text-align: center;
}

.blank-topic h2 {
  margin: 0;
  font-size: 34px;
}

.results-panel {
  max-width: 760px;
  margin: 0 auto;
}

.topic-percentile-grid {
  display: grid;
  gap: 12px;
}

.topic-percentile-card {
  display: grid;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: #fbfcfb;
}

.topic-percentile-card p {
  margin: 0;
}

.timing-summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.timing-summary > div {
  display: grid;
  gap: 2px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  background: #ffffff;
}

.timing-summary strong {
  font-size: 14px;
}

.percentile-track {
  height: 14px;
  overflow: hidden;
  border-radius: 999px;
  background: #e3e9e5;
}

.percentile-fill {
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: var(--accent);
  transition: width 240ms ease;
}

.answer-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
}

.save-status {
  display: none;
  color: var(--muted);
  font-size: 13px;
}

.save-status:not(:empty) {
  display: inline-flex;
  align-items: center;
  min-height: 38px;
  padding: 8px 10px;
  border-radius: 8px;
}

.save-status.saving {
  background: #eef3ef;
  color: var(--muted);
}

.save-status.error {
  border: 1px solid #f3b5ad;
  background: #fff3f1;
  color: #971b12;
  font-weight: 800;
}

.notice {
  border: 1px solid #ecd8b8;
  background: #fff7e8;
  color: var(--warn);
  border-radius: 8px;
  padding: 12px;
}

.linkbox {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  align-items: center;
}

.linkbox input {
  min-width: 0;
}

.response-list {
  display: grid;
  gap: 12px;
}

.session-button {
  display: grid;
  gap: 2px;
  justify-items: start;
  text-align: left;
  border-left: 5px solid transparent;
}

.session-primary {
  width: 100%;
  display: flex;
  gap: 8px;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
}

.session-button.not-started {
  background: #f3f1ea;
  border-left-color: #97835e;
}

.session-button.in-progress {
  background: #e8f0f8;
  border-left-color: #3d6f9f;
}

.session-button.complete {
  background: #e5f0eb;
  border-left-color: var(--accent);
}

.review-filters {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.response-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #fbfcfb;
}

.response-card pre {
  white-space: pre-wrap;
  overflow: auto;
  max-height: 180px;
  background: #f1f4f1;
  padding: 10px;
  border-radius: 6px;
}

.review-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.response-review-table-wrap {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  background: white;
}

.response-review-table {
  width: 100%;
  table-layout: fixed;
  border-collapse: collapse;
  font-size: 14px;
}

.response-review-table th,
.response-review-table td {
  border-bottom: 1px solid var(--line);
  padding: 10px;
  text-align: left;
  vertical-align: top;
  overflow-wrap: anywhere;
}

.response-review-table th {
  background: #eef3ef;
  color: #334238;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.response-review-table th:nth-child(1),
.response-review-table td:nth-child(1) {
  width: 42px;
}

.response-review-table th:nth-child(3),
.response-review-table td:nth-child(3) {
  width: 74px;
}

.response-review-table th:nth-child(4),
.response-review-table td:nth-child(4) {
  width: 118px;
}

.response-review-table tr:last-child td {
  border-bottom: 0;
}

.response-detail-button {
  min-height: 32px;
  padding: 0 10px;
  white-space: nowrap;
}

.response-detail-row td {
  background: #fbfcfb;
}

.response-detail-grid {
  display: grid;
  gap: 10px;
  margin: 0;
}

.response-detail-grid p {
  margin: 6px 0 0;
}

.response-detail-grid pre {
  white-space: pre-wrap;
  overflow: auto;
  max-height: 220px;
  margin: 6px 0 0;
  background: #f1f4f1;
  padding: 10px;
  border-radius: 6px;
}

.score-chip {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  border-radius: 999px;
  padding: 0 8px;
  font-weight: 800;
  white-space: nowrap;
}

.score-chip.good {
  background: #dff3e7;
  color: #075331;
}

.score-chip.mid {
  background: #fff1c7;
  color: #684500;
}

.score-chip.bad {
  background: #f9dddd;
  color: #7b1e1e;
}

.score-chip.neutral {
  background: #e8ece9;
  color: #3e4b43;
}

.question-bank-search {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  align-items: end;
}

.topic-stat-table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
}

.topic-stat-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 640px;
  font-size: 14px;
}

.topic-stat-table th,
.topic-stat-table td {
  border-bottom: 1px solid var(--line);
  padding: 9px 12px;
  text-align: right;
  vertical-align: middle;
}

.topic-stat-table th {
  background: #eef3ef;
  color: #334238;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.topic-stat-table th:first-child,
.topic-stat-table td:first-child {
  text-align: left;
}

.topic-stat-table tr:last-child td {
  border-bottom: 0;
}

.topic-stat-row {
  cursor: pointer;
}

.topic-stat-row:hover,
.topic-stat-row:focus-within {
  background: var(--soft);
}

.topic-stat-name {
  min-height: auto;
  padding: 0;
  border-radius: 0;
  background: transparent;
  color: var(--accent-strong);
  text-align: left;
  font-weight: 800;
}

.topic-stat-name:hover {
  background: transparent;
  color: var(--accent);
  text-decoration: underline;
}

.overlap-mark {
  color: var(--warn);
  font-weight: 800;
}

.question-results {
  display: grid;
  gap: 12px;
}

.question-card {
  display: grid;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: #fbfcfb;
}

.question-card pre:not(.code-block) {
  white-space: pre-wrap;
  overflow: auto;
  max-height: 360px;
  background: #f1f4f1;
  padding: 10px;
  border-radius: 6px;
}

.question-card .code-block {
  max-height: 420px;
  background: #101715;
  color: #f2f7f4;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
  font-size: 13px;
  line-height: 1.55;
  tab-size: 2;
}

.question-card summary {
  cursor: pointer;
  font-weight: 800;
}

.question-meta,
.chip-list {
  display: flex;
  gap: 6px;
  align-items: center;
  flex-wrap: wrap;
}

.test-controls {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) 120px 150px;
  gap: 10px;
}

.test-samples {
  display: grid;
  gap: 12px;
}

.test-question pre,
.branch-grid pre {
  max-height: 260px;
}

.choice-preview {
  margin: 0;
  padding-left: 20px;
  color: var(--ink);
}

.branch-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

@media (max-width: 820px) {
  .assessment-body {
    overflow: auto;
  }

  .assessment-shell {
    height: auto;
    min-height: 100vh;
  }

  .grid,
  .timer-strip,
  .question-bank-search,
  .test-controls,
  .branch-grid,
  .guide-columns,
  .review-filters,
  .timing-summary {
    grid-template-columns: 1fr;
  }

  .topbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .brand-lockup {
    align-items: flex-start;
    flex-direction: column;
  }

  .brand-logo img {
    width: min(240px, 76vw);
  }

  .assessment-stage {
    min-height: 620px;
  }

  .review-actions {
    justify-content: flex-start;
  }

  .response-review-table {
    min-width: 0;
    font-size: 13px;
  }

  .response-review-table th,
  .response-review-table td {
    padding: 8px;
  }

  .linkbox {
    grid-template-columns: 1fr;
  }
}
