:root {
  color-scheme: light;
  --ink: #172026;
  --muted: #63717c;
  --line: #d9e1e7;
  --bg: #f4f7f8;
  --panel: #ffffff;
  --teal: #147c7c;
  --green: #2f8f54;
  --coral: #d7644d;
  --yellow: #f0b83a;
  --blue: #3278b8;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button, select, input {
  font: inherit;
}

button {
  cursor: pointer;
}

.app {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 18px;
}

.screen {
  width: min(1040px, 100%);
  min-height: min(720px, calc(100vh - 36px));
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  display: grid;
  grid-template-rows: auto 1fr auto;
  overflow: hidden;
}

.topbar, .footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--line);
}

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

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

.brand-mark {
  width: 42px;
  height: 42px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  background: var(--teal);
  color: #fff;
  font-weight: 800;
  flex: 0 0 auto;
}

.brand strong, .brand span {
  display: block;
}

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

.content {
  padding: 24px;
  display: grid;
  align-content: center;
  gap: 18px;
}

h1 {
  margin: 0;
  font-size: 32px;
  letter-spacing: 0;
}

h2 {
  margin: 0;
  font-size: 24px;
  letter-spacing: 0;
}

p {
  line-height: 1.6;
}

.hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 280px;
  gap: 22px;
  align-items: center;
}

.study-graphic {
  min-height: 220px;
  border-radius: 8px;
  background: #edf5f5;
  position: relative;
  overflow: hidden;
  border: 1px solid var(--line);
}

.study-graphic span {
  position: absolute;
  display: block;
  border-radius: 8px;
}

.study-graphic span:nth-child(1) { left: 28px; top: 32px; width: 92px; height: 116px; background: var(--yellow); }
.study-graphic span:nth-child(2) { left: 136px; top: 52px; width: 104px; height: 14px; background: var(--teal); }
.study-graphic span:nth-child(3) { left: 136px; top: 84px; width: 82px; height: 14px; background: var(--blue); }
.study-graphic span:nth-child(4) { right: 32px; bottom: 32px; width: 60px; height: 60px; background: var(--coral); }

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

.grade-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.subject-grid, .unit-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.card-button, .primary, .secondary, .choice {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
}

.card-button {
  min-height: 86px;
  text-align: left;
  padding: 14px;
}

.card-button strong, .stat strong {
  display: block;
  margin-bottom: 6px;
}

.card-button.active {
  border-color: var(--teal);
  background: #e8f4f2;
}

.primary, .secondary {
  min-height: 42px;
  padding: 0 16px;
}

.primary {
  background: var(--ink);
  color: #fff;
  border-color: var(--ink);
}

.secondary {
  background: #fff;
}

.progress {
  height: 8px;
  border-radius: 999px;
  background: #e6edf0;
  overflow: hidden;
  min-width: 160px;
}

.progress div {
  height: 100%;
  background: var(--green);
}

.learn-card, .result-card, .question-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfd;
  padding: 18px;
}

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

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

.choices {
  display: grid;
  gap: 10px;
}

.choice {
  text-align: left;
  padding: 14px;
  min-height: 48px;
}

.choice.correct {
  border-color: var(--green);
  background: #ebf7ef;
}

.choice.wrong {
  border-color: var(--coral);
  background: #fff0ed;
}

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

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

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

.pill-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.pill {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 6px 10px;
  color: var(--muted);
  font-size: 13px;
}

input {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 12px;
}

@media (max-width: 760px) {
  .app { padding: 10px; }
  .screen { min-height: calc(100vh - 20px); }
  .topbar, .footer { padding: 12px; }
  .content { padding: 16px; align-content: start; }
  .hero-grid, .grade-grid, .subject-grid, .unit-grid, .point-list, .stat-grid {
    grid-template-columns: 1fr;
  }
  .study-graphic { min-height: 150px; }
  h1 { font-size: 26px; }
}
