: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;
  font-size: 15px;
  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;
}

.main.main-problem {
  width: min(1680px, calc(100% - 40px));
}

.topbar-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 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: 18px 0 48px;
}

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

.hero.compact {
  padding: 18px 22px;
}

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

.hero h1 {
  margin: 0 0 8px;
  font-size: clamp(1.7rem, 2.2vw, 2.45rem);
  line-height: 1.1;
}

.lead {
  margin: 0;
  font-size: 0.96rem;
  line-height: 1.5;
  max-width: 110ch;
}

.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: 18px 20px;
  margin-bottom: 14px;
}

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

.field-label {
  display: block;
  margin-bottom: 6px;
  font-size: 0.88rem;
  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: 10px 12px;
  font-size: 0.95rem;
}

.response-box {
  min-height: 140px;
  padding: 12px 14px;
  font-size: 0.94rem;
  line-height: 1.45;
  resize: vertical;
}

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

.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: 10px 0 8px;
  font-size: 1.35rem;
}

.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: 9px 14px;
  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: 14px;
  padding: 6px 10px;
  margin: 0;
  box-shadow: var(--shadow);
}

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

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

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

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

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

.pager-card-compact {
  margin-top: 10px;
}

.pager-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px 12px;
  flex-wrap: wrap;
}

.pager-summary,
.sticky-actions,
.pager-actions-compact {
  display: flex;
  align-items: center;
  gap: 6px 8px;
  flex-wrap: wrap;
}

.pager-label {
  font-weight: 700;
  font-size: 0.9rem;
}

.pager-meta-item {
  color: var(--muted);
  font-size: 0.82rem;
}

.sticky-problem-hero {
  position: sticky;
  top: 58px;
  z-index: 9;
  padding: 14px 18px 10px;
  margin-bottom: 10px;
}

.sticky-problem-row {
  display: flex;
  justify-content: space-between;
  align-items: start;
  gap: 14px 20px;
}

.sticky-problem-copy h1 {
  margin: 0 0 4px;
  font-size: clamp(1.2rem, 1.7vw, 1.6rem);
}

.sticky-problem-copy .eyebrow {
  margin-bottom: 6px;
}

.sticky-problem-copy .lead {
  font-size: 0.86rem;
  line-height: 1.3;
}

.sticky-problem-controls {
  min-width: 300px;
  max-width: 520px;
}

.sticky-actions {
  justify-content: flex-end;
}

.compact-input {
  padding: 8px 10px;
}

.button.button-small {
  padding: 7px 10px;
  font-size: 0.84rem;
}

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

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

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

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

.prompt {
  font-size: 0.96rem;
  line-height: 1.45;
}

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

.sheet-grid,
.review-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin: 14px 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: 10px;
  font-size: 0.9rem;
}

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

.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: 16px;
  margin: 14px 0;
}

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

.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);
  }

  .main.main-problem {
    width: min(100% - 20px, 1680px);
  }

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

  .toolbar,
  .toolbar-meta,
  .topbar-inner,
  .nav-row,
  .sticky-problem-row,
  .pager-row {
    flex-direction: column;
    align-items: stretch;
  }

  .sticky-problem-hero {
    top: 54px;
  }

  .sticky-problem-controls {
    min-width: 0;
    max-width: none;
  }

  .sticky-actions,
  .pager-actions-compact {
    justify-content: flex-start;
  }
}
