:root {
  --ink: #17212b;
  --muted: #607080;
  --panel: #ffffff;
  --line: #d9e2e7;
  --soft: #eef5f1;
  --accent: #0f766e;
  --accent-dark: #0b5f59;
  --gold: #b7791f;
  --bad: #b42318;
  --good: #13795b;
  --shadow: 0 18px 50px rgba(27, 45, 57, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background:
    linear-gradient(120deg, rgba(15, 118, 110, 0.12), rgba(245, 158, 11, 0.08)),
    #f7faf8;
  font-family: Arial, Helvetica, sans-serif;
}

button,
input {
  font: inherit;
}

button {
  border: 0;
  border-radius: 8px;
  background: var(--accent);
  color: #fff;
  cursor: pointer;
  font-weight: 700;
  min-height: 44px;
  padding: 0 18px;
}

button:hover {
  background: var(--accent-dark);
}

button:disabled {
  background: #a8b6bd;
  cursor: not-allowed;
}

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

.top-panel {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 20px;
  align-items: center;
  padding: 28px;
  background: var(--panel);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}

.kicker {
  margin: 0 0 8px;
  color: var(--accent);
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 10px;
  font-size: clamp(2rem, 4vw, 3.8rem);
  line-height: 1.04;
}

.intro {
  max-width: 680px;
  margin-bottom: 0;
  color: var(--muted);
  font-size: 1.05rem;
  line-height: 1.5;
}

.parent-tools,
.answer-row,
.action-strip,
.review-head {
  display: flex;
  gap: 10px;
  align-items: center;
}

.ghost-button {
  background: #eef4f4;
  color: var(--accent-dark);
  border: 1px solid #c7dcda;
}

.ghost-button:hover {
  background: #dceceb;
  color: var(--accent-dark);
}

.status-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin: 18px 0;
}

.status-row > div {
  padding: 16px 18px;
  background: var(--panel);
  border: 1px solid var(--line);
}

.label {
  display: block;
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 0.86rem;
}

.status-row strong {
  font-size: 1.3rem;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(300px, 0.75fr);
  gap: 18px;
  align-items: start;
}

.question-card,
.feedback-panel,
.review-panel {
  background: var(--panel);
  border: 1px solid var(--line);
}

.question-card {
  padding: 28px;
  min-height: 430px;
}

.topic-line {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 16px;
}

.topic-line span {
  border-radius: 999px;
  padding: 7px 10px;
  background: var(--soft);
  color: var(--accent-dark);
  font-weight: 700;
  font-size: 0.88rem;
}

.question-card h2 {
  font-size: clamp(1.45rem, 2.6vw, 2.2rem);
  line-height: 1.2;
  margin-bottom: 18px;
}

.question-body {
  color: #24313a;
  font-size: 1.08rem;
  line-height: 1.65;
}

.math-box,
.option-grid,
.data-table {
  margin: 16px 0;
}

.math-box {
  display: inline-block;
  min-width: 220px;
  padding: 18px 20px;
  background: #f8fbfb;
  border: 1px solid var(--line);
  font-size: 1.45rem;
  font-weight: 800;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 1rem;
}

.data-table th,
.data-table td {
  text-align: left;
  border: 1px solid var(--line);
  padding: 10px 12px;
}

.data-table th {
  background: #f1f7f5;
}

.answer-area {
  margin-top: 24px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

.answer-area label {
  display: block;
  margin-bottom: 9px;
  font-weight: 800;
}

.answer-row input {
  width: 100%;
  min-height: 48px;
  border: 2px solid #c9d7dd;
  border-radius: 8px;
  padding: 0 14px;
  background: #fff;
}

.answer-row input:focus {
  outline: 3px solid rgba(15, 118, 110, 0.18);
  border-color: var(--accent);
}

.hint {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 0.92rem;
}

.feedback-panel {
  padding: 18px;
  min-height: 430px;
}

.feedback {
  border-radius: 8px;
  padding: 16px;
  background: #f5f8fa;
  border: 1px solid var(--line);
}

.feedback.correct {
  background: #edf8f3;
  border-color: #b8ded0;
}

.feedback.wrong {
  background: #fff3f1;
  border-color: #fac6be;
}

.feedback-title {
  margin-bottom: 6px;
  font-size: 1.15rem;
  font-weight: 800;
}

.steps-box {
  margin-top: 16px;
  padding: 16px;
  border-radius: 8px;
  background: #fffaf0;
  border: 1px solid #f1d8a8;
}

.steps-box h3 {
  margin-bottom: 12px;
  color: #7c4a03;
}

.steps-box li {
  margin-bottom: 10px;
  line-height: 1.45;
}

.hidden {
  display: none;
}

.action-strip {
  justify-content: flex-end;
  margin: 18px 0;
}

.review-panel {
  padding: 22px;
}

.review-head {
  justify-content: space-between;
  margin-bottom: 14px;
}

.review-head h2 {
  margin-bottom: 0;
}

.review-list {
  display: grid;
  gap: 10px;
}

.review-item {
  display: grid;
  grid-template-columns: 42px 1fr;
  gap: 12px;
  align-items: start;
  padding: 12px;
  background: #f8fbfb;
  border: 1px solid var(--line);
}

.review-status {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 999px;
  background: #e9eef1;
  color: var(--muted);
  font-weight: 900;
}

.review-status.good {
  background: #dff4eb;
  color: var(--good);
}

.review-status.bad {
  background: #ffe1dc;
  color: var(--bad);
}

.review-answer {
  margin: 5px 0 0;
  color: var(--muted);
}

@media (max-width: 820px) {
  .app-shell {
    width: min(100% - 20px, 680px);
    padding-top: 10px;
  }

  .top-panel,
  .workspace {
    grid-template-columns: 1fr;
  }

  .top-panel,
  .question-card,
  .feedback-panel,
  .review-panel {
    padding: 18px;
  }

  .status-row {
    grid-template-columns: 1fr;
  }

  .parent-tools,
  .answer-row,
  .action-strip,
  .review-head {
    align-items: stretch;
    flex-direction: column;
  }

  .parent-tools button,
  .answer-row button,
  .action-strip button,
  .review-head button {
    width: 100%;
  }
}
