:root {
  --cream: #f7f0df;
  --ink: #151515;
  --green: #124732;
  --gold: #b56b12;
  --soft: #fffaf0;
  --wrong: #8d1f1f;
  --right: #12613f;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at 20px 20px, rgba(21, 21, 21, 0.08) 1px, transparent 1px),
    var(--cream);
  background-size: 18px 18px;
  color: var(--ink);
  font-family: Georgia, "Times New Roman", serif;
}

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

.hero {
  border: 4px solid var(--ink);
  background: var(--soft);
  box-shadow: 8px 8px 0 var(--ink);
  padding: 28px;
  margin-bottom: 26px;
}

.eyebrow,
.label,
.tab,
button {
  font-family: Impact, "Arial Narrow", sans-serif;
  letter-spacing: 2px;
  text-transform: uppercase;
}

.eyebrow {
  color: var(--gold);
  margin: 0 0 8px;
  font-size: 14px;
}

h1 {
  margin: 0;
  font-family: Impact, "Arial Narrow", sans-serif;
  font-size: clamp(42px, 9vw, 84px);
  line-height: 0.95;
  letter-spacing: 0;
}

.subhead {
  margin: 14px 0 0;
  max-width: 680px;
  color: #4d4638;
  font-size: 21px;
  line-height: 1.45;
}

.mode-tabs {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(135px, 1fr));
  gap: 12px;
  margin-bottom: 22px;
}

.tab,
button {
  border: 3px solid var(--ink);
  background: var(--soft);
  color: var(--ink);
  box-shadow: 5px 5px 0 var(--ink);
  min-height: 48px;
  cursor: pointer;
  font-size: 15px;
}

.tab.active,
.primary-button {
  background: var(--green);
  color: white;
}

.practice-card {
  border: 4px solid var(--ink);
  background: var(--soft);
  box-shadow: 8px 8px 0 var(--ink);
  padding: 22px;
}

.dashboard {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 14px;
  margin-bottom: 18px;
}

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

.mini-card,
.goals-panel {
  border: 2px solid var(--ink);
  background: #fffdf7;
  padding: 12px;
}

.mini-card strong {
  display: block;
  font-family: Impact, "Arial Narrow", sans-serif;
  font-size: 24px;
  line-height: 1.05;
  word-break: break-word;
}

.mini-card small {
  color: #665e4d;
}

.goals-panel {
  display: grid;
  gap: 8px;
}

.goals-panel label {
  display: grid;
  gap: 4px;
  font-family: Impact, "Arial Narrow", sans-serif;
  letter-spacing: 1px;
  text-transform: uppercase;
  font-size: 12px;
}

.score-row {
  display: grid;
  grid-template-columns: 1fr 1fr auto;
  gap: 12px;
  align-items: center;
  border-bottom: 2px solid rgba(21, 21, 21, 0.18);
  padding-bottom: 16px;
  margin-bottom: 18px;
}

.score-row > div {
  border: 2px solid var(--ink);
  padding: 12px;
  background: #fffdf7;
}

.label {
  display: block;
  color: var(--gold);
  font-size: 12px;
  margin-bottom: 5px;
}

.score-row strong {
  font-family: Impact, "Arial Narrow", sans-serif;
  font-size: 30px;
}

.small-button {
  padding: 0 18px;
}

.lesson {
  color: #514937;
  line-height: 1.55;
  font-size: 18px;
  margin: 0 0 18px;
}

.problem-box {
  border: 3px solid var(--ink);
  background: #fffdf7;
  padding: 22px;
}

.prompt {
  font-size: clamp(30px, 8vw, 56px);
  line-height: 1.05;
  margin: 0 0 20px;
  font-family: Impact, "Arial Narrow", sans-serif;
}

.answer-area {
  display: grid;
  gap: 10px;
  margin-bottom: 18px;
}

.choice {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 12px;
  align-items: start;
  border: 2px solid var(--ink);
  background: white;
  padding: 12px;
  cursor: pointer;
  font-size: 18px;
  line-height: 1.35;
}

.choice input {
  width: 18px;
  min-height: 18px;
  margin-top: 4px;
}

.passage {
  border: 2px solid rgba(21, 21, 21, 0.25);
  background: rgba(255, 255, 255, 0.6);
  padding: 14px;
  margin: 0 0 16px;
  color: #3f382d;
  line-height: 1.55;
  font-size: 18px;
}

input {
  border: 3px solid var(--ink);
  background: white;
  min-height: 48px;
  padding: 8px 12px;
  font-size: 22px;
  width: min(100%, 180px);
}

select {
  border: 3px solid var(--ink);
  background: white;
  min-height: 48px;
  padding: 8px 12px;
  font-size: 18px;
}

.test-panel {
  display: grid;
  grid-template-columns: 1fr 1fr auto;
  gap: 12px;
  align-items: end;
  border: 3px solid var(--ink);
  background: #fffdf7;
  padding: 14px;
  margin-bottom: 18px;
}

.test-panel strong {
  display: block;
  font-family: Impact, "Arial Narrow", sans-serif;
  font-size: 34px;
}

.test-panel small {
  display: block;
  color: #665e4d;
}

.fraction-input {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.fraction-input span {
  font-family: Impact, "Arial Narrow", sans-serif;
  font-size: 28px;
}

.primary-button {
  width: min(100%, 240px);
}

.feedback {
  margin-top: 18px;
  padding: 16px;
  border: 3px solid var(--ink);
  line-height: 1.5;
  font-size: 18px;
}

.feedback.good {
  background: #e5f3dc;
  color: var(--right);
}

.feedback.bad {
  background: #f8ded8;
  color: var(--wrong);
}

.install-strip {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  border: 3px solid var(--ink);
  background: #fffdf7;
  margin-top: 18px;
  padding: 14px;
}

.install-strip strong,
.install-strip span {
  display: block;
}

.install-strip strong {
  font-family: Impact, "Arial Narrow", sans-serif;
  letter-spacing: 1px;
  text-transform: uppercase;
}

.install-strip span {
  color: #5b5343;
  margin-top: 3px;
}

.hidden {
  display: none;
}

.hint-box {
  margin-top: 18px;
  border: 2px solid rgba(21, 21, 21, 0.35);
  padding: 14px 16px;
  background: rgba(255, 255, 255, 0.45);
  line-height: 1.55;
}

.hint-box summary {
  cursor: pointer;
  font-family: Impact, "Arial Narrow", sans-serif;
  letter-spacing: 1px;
}

.step-list {
  display: grid;
  gap: 10px;
  margin: 12px 0;
}

.step-card {
  border-left: 5px solid var(--green);
  background: white;
  padding: 12px;
}

.help-meter {
  color: #665e4d;
  margin: 10px 0;
}

.hint-box code {
  display: block;
  margin: 8px 0;
  padding: 10px;
  background: white;
  border-left: 4px solid var(--green);
  font-size: 18px;
}

.table-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(86px, 1fr));
  gap: 8px;
  margin-top: 12px;
}

.table-grid span {
  border: 2px solid rgba(21, 21, 21, 0.25);
  background: #fffdf7;
  padding: 8px;
  text-align: center;
  font-family: Impact, "Arial Narrow", sans-serif;
}

.source-note {
  margin-top: 18px;
  color: #665e4d;
  line-height: 1.45;
  font-size: 14px;
}

.source-note a {
  color: var(--green);
  font-weight: 700;
}

@media (max-width: 680px) {
  .mode-tabs,
  .score-row,
  .install-strip,
  .dashboard,
  .progress-panel,
  .test-panel {
    grid-template-columns: 1fr;
    display: grid;
  }

  .hero,
  .practice-card {
    padding: 18px;
    box-shadow: 5px 5px 0 var(--ink);
  }
}
