:root {
  --ink: #17211b;
  --muted: #657268;
  --line: #d8dfd8;
  --paper: #fbfcf9;
  --surface: #ffffff;
  --soft: #edf4ed;
  --accent: #1f7a5c;
  --accent-dark: #155740;
  --warning: #a45d12;
  --danger: #a33a3a;
  --ok: #19744f;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: Arial, Helvetica, sans-serif;
  line-height: 1.45;
}

button,
input,
textarea {
  font: inherit;
}

.topbar {
  min-height: 86px;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 18px 28px;
  position: sticky;
  top: 0;
  z-index: 10;
}

.topbar h1,
.module-head h2,
.band h3,
.score-panel h3 {
  margin: 0;
  letter-spacing: 0;
}

.topbar h1 {
  font-size: 28px;
}

.eyebrow,
.label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0;
  margin: 0 0 4px;
  text-transform: uppercase;
}

.top-actions,
.score-actions {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

.layout {
  display: grid;
  grid-template-columns: 310px minmax(0, 1fr);
  min-height: calc(100vh - 86px);
}

.sidebar {
  border-right: 1px solid var(--line);
  background: #f4f7f1;
  padding: 22px;
}

.progress-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
  margin-bottom: 18px;
}

.meter {
  height: 10px;
  background: #e2e7df;
  border-radius: 999px;
  overflow: hidden;
  margin: 10px 0;
}

.meter span {
  display: block;
  height: 100%;
  width: 0;
  background: var(--accent);
}

.story-nav {
  display: grid;
  gap: 8px;
}

.story-tab {
  width: 100%;
  min-height: 54px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  border-radius: 8px;
  padding: 10px 12px;
  text-align: left;
  cursor: pointer;
  display: grid;
  gap: 2px;
}

.story-tab:hover,
.story-tab.active {
  border-color: var(--accent);
  outline: 2px solid rgba(31, 122, 92, 0.12);
}

.story-tab[disabled] {
  cursor: not-allowed;
  opacity: 0.55;
}

.story-tab small {
  color: var(--muted);
}

.workspace {
  padding: 28px;
  max-width: 1120px;
  width: 100%;
}

.module-head {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: flex-start;
  margin-bottom: 18px;
}

.module-head h2 {
  font-size: 30px;
}

.summary {
  color: var(--muted);
  max-width: 780px;
  margin: 8px 0 0;
}

.status-badge {
  min-width: 112px;
  text-align: center;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--soft);
  padding: 8px 12px;
  font-weight: 700;
}

.status-badge.passed {
  color: var(--ok);
  border-color: rgba(25, 116, 79, 0.35);
  background: #e8f5ee;
}

.status-badge.open {
  color: var(--warning);
  border-color: rgba(164, 93, 18, 0.35);
  background: #fff4e5;
}

.band,
.score-panel,
.locked-panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 20px;
  margin-bottom: 16px;
}

.band-title {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 18px;
  margin-bottom: 14px;
}

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

.check-item {
  display: grid;
  grid-template-columns: 22px 1fr;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fcfdfb;
}

.check-item input {
  margin-top: 3px;
}

.question-list,
.open-task-list {
  display: grid;
  gap: 14px;
}

.question {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: #fcfdfb;
}

.question p {
  margin: 0 0 10px;
  font-weight: 700;
}

.options {
  display: grid;
  gap: 8px;
}

.option {
  display: grid;
  grid-template-columns: 20px 1fr;
  gap: 8px;
  align-items: start;
}

.feedback {
  margin-top: 10px;
  font-weight: 700;
}

.feedback.good {
  color: var(--ok);
}

.feedback.bad {
  color: var(--danger);
}

textarea {
  width: 100%;
  min-height: 92px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  resize: vertical;
  background: var(--surface);
}

.task-hint {
  color: var(--muted);
  margin: 8px 0 0;
  font-size: 14px;
}

.score-panel {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 16px;
  align-items: center;
}

.result-box {
  grid-column: 1 / -1;
  border-top: 1px solid var(--line);
  padding-top: 14px;
  color: var(--muted);
}

.primary-btn,
.ghost-btn,
.icon-btn {
  border-radius: 8px;
  min-height: 40px;
  padding: 8px 14px;
  cursor: pointer;
}

.primary-btn {
  border: 1px solid var(--accent);
  background: var(--accent);
  color: white;
  font-weight: 700;
}

.primary-btn:hover {
  background: var(--accent-dark);
}

.ghost-btn,
.icon-btn {
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
}

.answer-key ul {
  margin: 8px 0 0;
  padding-left: 20px;
}

.locked-panel h3 {
  margin: 0 0 8px;
}

@media (max-width: 860px) {
  .topbar,
  .module-head,
  .score-panel {
    display: block;
  }

  .top-actions,
  .score-actions {
    margin-top: 12px;
  }

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

  .sidebar {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

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

  .workspace {
    padding: 18px;
  }
}

@media print {
  .top-actions,
  .sidebar,
  .score-actions {
    display: none;
  }

  .layout {
    display: block;
  }

  .topbar {
    position: static;
  }

  .workspace {
    max-width: none;
  }
}
