:root {
  --bg: #f5f2ea;
  --paper: #fffdf8;
  --paper-strong: #ffffff;
  --ink: #1f2a37;
  --muted: #5f6b7a;
  --line: #d9d2c3;
  --accent: #113f67;
  --accent-soft: #dce9f5;
  --warm: #b85c38;
  --ok: #2f7d32;
  --error: #b42318;
  --shadow: 0 10px 30px rgba(24, 35, 54, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  color: var(--ink);
  background:
    radial-gradient(circle at top left, rgba(184, 92, 56, 0.08), transparent 26%),
    radial-gradient(circle at top right, rgba(17, 63, 103, 0.08), transparent 24%),
    var(--bg);
}

a {
  color: var(--accent);
  text-decoration: none;
}

.page-shell {
  min-height: 100vh;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  background: rgba(245, 242, 234, 0.92);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid rgba(17, 63, 103, 0.08);
}

.topbar-inner,
.main {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
}

.topbar-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 0;
}

.brand-link {
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.topbar-links {
  display: flex;
  gap: 16px;
}

.main {
  padding: 28px 0 64px;
}

.hero {
  background: linear-gradient(135deg, rgba(17, 63, 103, 0.96), rgba(34, 75, 118, 0.92));
  color: #fff;
  padding: 32px;
  border-radius: 24px;
  box-shadow: var(--shadow);
  margin-bottom: 24px;
}

.hero.compact {
  padding: 24px 28px;
}

.eyebrow {
  margin: 0 0 12px;
  font-size: 0.78rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  opacity: 0.78;
}

.hero h1 {
  margin: 0 0 12px;
  font-size: clamp(2rem, 3vw, 3rem);
  line-height: 1.1;
}

.lead {
  margin: 0;
  font-size: 1.02rem;
  line-height: 1.7;
  max-width: 78ch;
}

.card,
.problem-card,
.schedule-card {
  background: var(--paper);
  border: 1px solid rgba(17, 63, 103, 0.08);
  border-radius: 22px;
  box-shadow: var(--shadow);
}

.card,
.problem-card {
  padding: 24px;
  margin-bottom: 20px;
}

.name-card {
  display: grid;
  gap: 10px;
}

.field-label {
  display: block;
  margin-bottom: 8px;
  font-size: 0.95rem;
  font-weight: 700;
}

.text-input,
.response-box {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--paper-strong);
  color: var(--ink);
  font: inherit;
}

.text-input {
  padding: 14px 16px;
  font-size: 1rem;
}

.response-box {
  min-height: 180px;
  padding: 16px;
  font-size: 0.98rem;
  line-height: 1.6;
  resize: vertical;
}

.response-box.note-box {
  min-height: 120px;
}

.muted,
.note {
  color: var(--muted);
  line-height: 1.6;
}

.schedule-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 18px;
  margin-bottom: 24px;
}

.schedule-card {
  display: block;
  padding: 22px;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.schedule-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 14px 30px rgba(24, 35, 54, 0.12);
}

.schedule-top,
.counts-row,
.problem-header,
.toolbar,
.toolbar-meta,
.review-grid,
.submission-meta,
.nav-row {
  display: flex;
  gap: 12px;
}

.schedule-top,
.counts-row,
.submission-meta,
.nav-row {
  justify-content: space-between;
  align-items: center;
}

.date-badge,
.problem-number,
.released-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  font-weight: 700;
}

.date-badge {
  min-width: 78px;
  padding: 8px 14px;
  background: var(--accent-soft);
  color: var(--accent);
}

.released-pill {
  padding: 6px 12px;
  background: rgba(47, 125, 50, 0.12);
  color: var(--ok);
  font-size: 0.82rem;
}

.schedule-card h2,
.problem-card h2,
.card h2 {
  margin: 12px 0 10px;
  font-size: 1.55rem;
}

.counts-row {
  margin-top: 16px;
  color: var(--muted);
  font-size: 0.92rem;
}

.toolbar {
  justify-content: space-between;
  align-items: end;
  flex-wrap: wrap;
}

.toolbar-meta {
  align-items: center;
  flex-wrap: wrap;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  padding: 12px 18px;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

.button.button-secondary {
  background: transparent;
  border: 1px solid var(--accent);
  color: var(--accent);
}

.button.button-disabled {
  opacity: 0.45;
  cursor: default;
  pointer-events: none;
}

.mini-link {
  font-weight: 700;
}

.nav-card {
  background: rgba(255, 253, 248, 0.88);
  border: 1px solid rgba(17, 63, 103, 0.08);
  border-radius: 18px;
  padding: 16px 20px;
  margin: 0 0 20px;
  box-shadow: var(--shadow);
}

.save-status {
  font-weight: 700;
  color: var(--muted);
}

.status-ok {
  color: var(--ok);
}

.status-error {
  color: var(--error);
}

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

.section-heading h2 {
  margin: 0;
  font-size: 1.55rem;
}

.pager-card,
.page-map-card,
.day-summary-card {
  margin-bottom: 20px;
}

.pager-status {
  display: grid;
  gap: 8px;
  justify-items: end;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 8px 14px;
  background: rgba(17, 63, 103, 0.08);
  color: var(--accent);
  font-weight: 700;
  font-size: 0.88rem;
}

.status-pill-started {
  background: rgba(47, 125, 50, 0.12);
  color: var(--ok);
}

.pager-actions,
.page-chip-grid {
  display: grid;
  gap: 12px;
}

.pager-actions {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin-bottom: 16px;
}

.nav-row-tight {
  gap: 16px;
}

.page-chip-grid {
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}

.page-chip {
  display: grid;
  gap: 6px;
  padding: 16px 18px;
  border-radius: 18px;
  border: 1px solid rgba(17, 63, 103, 0.1);
  background: var(--paper-strong);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.5);
  transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}

.page-chip:hover {
  transform: translateY(-1px);
  box-shadow: 0 10px 20px rgba(24, 35, 54, 0.08);
  border-color: rgba(17, 63, 103, 0.22);
}

.page-chip-number {
  font-weight: 700;
  font-size: 1rem;
}

.page-chip-meta {
  color: var(--muted);
  font-size: 0.88rem;
}

.page-chip-started {
  border-color: rgba(47, 125, 50, 0.28);
  background: rgba(47, 125, 50, 0.06);
}

.page-chip-current {
  border-color: rgba(17, 63, 103, 0.32);
  background: rgba(17, 63, 103, 0.08);
}

.problem-card {
  border-top: 6px solid rgba(17, 63, 103, 0.22);
}

.problem-header {
  align-items: start;
  margin-bottom: 14px;
}

.problem-number {
  width: 42px;
  height: 42px;
  background: var(--accent);
  color: #fff;
  flex: 0 0 42px;
}

.problem-tag {
  margin: 2px 0 6px;
  color: var(--warm);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.75rem;
}

.prompt {
  font-size: 1.03rem;
  line-height: 1.7;
}

.guide-list {
  margin: 0 0 18px;
  padding-left: 22px;
  line-height: 1.8;
}

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

.review-grid {
  align-items: start;
}

.table-wrap {
  overflow-x: auto;
}

.balance-sheet,
.data-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--paper-strong);
  border-radius: 18px;
  overflow: hidden;
}

.balance-sheet caption {
  background: rgba(17, 63, 103, 0.08);
  color: var(--accent);
  font-weight: 700;
  padding: 14px;
}

.balance-sheet th,
.balance-sheet td,
.data-table th,
.data-table td {
  padding: 10px 12px;
  border-bottom: 1px solid rgba(17, 63, 103, 0.08);
  text-align: right;
}

.balance-sheet th:first-child,
.balance-sheet td:first-child,
.data-table th:first-child,
.data-table td:first-child {
  text-align: left;
}

.section-row td,
.sub-row td,
.total-row td,
.totalish td {
  font-weight: 700;
}

.section-row td {
  background: rgba(17, 63, 103, 0.06);
  color: var(--accent);
}

.sub-row td {
  color: var(--muted);
}

.total-row td {
  border-top: 2px solid rgba(17, 63, 103, 0.16);
}

.indent {
  padding-left: 28px !important;
}

.extra-card {
  background: rgba(184, 92, 56, 0.06);
  border: 1px solid rgba(184, 92, 56, 0.16);
  border-radius: 20px;
  padding: 20px;
  margin: 18px 0;
}

.answer-sheet,
.submission-panel {
  background: rgba(17, 63, 103, 0.04);
  border-radius: 20px;
  padding: 20px;
}

.rubric-card {
  margin-bottom: 18px;
  padding: 18px;
  border-radius: 18px;
  background: rgba(184, 92, 56, 0.06);
  border: 1px solid rgba(184, 92, 56, 0.16);
}

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

.rubric-header h3,
.rubric-block h4 {
  margin: 0;
}

.rubric-total {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 68px;
  padding: 8px 12px;
  border-radius: 999px;
  background: rgba(17, 63, 103, 0.1);
  color: var(--accent);
  font-weight: 700;
}

.rubric-block + .rubric-block {
  margin-top: 16px;
}

.answer-steps {
  margin: 0 0 16px;
  padding-left: 22px;
  line-height: 1.8;
}

.answer-block + .answer-block {
  margin-top: 18px;
}

.answer-block h3,
.submission-panel h3,
.extra-card h3 {
  margin-top: 0;
}

.submission-card {
  background: var(--paper-strong);
  border: 1px solid rgba(17, 63, 103, 0.08);
  border-radius: 16px;
  padding: 14px;
  margin-bottom: 12px;
}

.submission-card pre {
  margin: 10px 0 0;
  white-space: pre-wrap;
  font: inherit;
  line-height: 1.6;
}

.feedback-grid {
  display: grid;
  gap: 12px;
}

.feedback-item {
  padding: 14px;
  border-radius: 14px;
  background: rgba(17, 63, 103, 0.06);
}

.feedback-item h4 {
  margin: 0 0 8px;
}

.feedback-item p {
  margin: 0;
  line-height: 1.6;
}

.review-note {
  margin-top: 16px;
  padding: 14px;
  background: rgba(184, 92, 56, 0.08);
  border-radius: 14px;
}

code {
  font-family: Consolas, "Courier New", monospace;
  background: rgba(17, 63, 103, 0.08);
  padding: 2px 6px;
  border-radius: 6px;
}

@media (max-width: 900px) {
  .sheet-grid,
  .review-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 700px) {
  .main,
  .topbar-inner {
    width: min(100% - 20px, 1180px);
  }

  .hero,
  .card,
  .problem-card,
  .schedule-card {
    border-radius: 18px;
  }

  .toolbar,
  .toolbar-meta,
  .topbar-inner,
  .nav-row,
  .section-heading {
    flex-direction: column;
    align-items: stretch;
  }

  .pager-status {
    justify-items: start;
  }

  .pager-actions {
    grid-template-columns: 1fr;
  }
}
