:root {
  --bg: #0b1220;
  --card: #111827;
  --card-soft: #182235;
  --card-border: #253245;
  --text: #e5e7eb;
  --muted: #94a3b8;
  --accent: #60a5fa;
  --accent-soft: #172554;
  --warning: #f59e0b;
  --success: #86efac;
  --success-soft: rgba(34, 197, 94, 0.16);
  --error: #fca5a5;
  --error-soft: rgba(239, 68, 68, 0.16);
  --shadow: 0 10px 25px rgba(2, 6, 23, 0.35);
  --radius: 18px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: Inter, "Avenir Next", "Segoe UI", sans-serif;
  background:
    radial-gradient(circle at top left, rgba(37, 99, 235, 0.2), transparent 28%),
    linear-gradient(180deg, #0f172a 0%, var(--bg) 100%);
  color: var(--text);
}

button,
input,
select {
  font: inherit;
}

.app-shell {
  width: min(1120px, calc(100% - 2rem));
  margin: 0 auto;
  padding: 2rem 0 3rem;
}

.hero {
  display: grid;
  grid-template-columns: 1.6fr 1fr;
  gap: 1.25rem;
  align-items: start;
  margin-bottom: 1.5rem;
}

.eyebrow {
  margin: 0 0 0.45rem;
  font-size: 0.8rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent);
  font-weight: 700;
}

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

h1 {
  margin-bottom: 0.65rem;
  font-size: clamp(2rem, 4vw, 3.2rem);
  line-height: 1.02;
}

h2 {
  margin-bottom: 0.35rem;
  font-size: 1.35rem;
}

h3 {
  margin-bottom: 0.8rem;
  font-size: 1rem;
}

.intro,
.supporting-text {
  color: var(--muted);
}

.hero-note {
  padding: 1rem 1.1rem;
  border-radius: var(--radius);
  background: linear-gradient(135deg, #172554, #0f766e);
  border: 1px solid var(--card-border);
  color: #dbeafe;
  box-shadow: var(--shadow);
  font-weight: 600;
}

.back-link {
  color: #bfdbfe;
  font-weight: 600;
}

.card {
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  padding: 1.25rem;
  box-shadow: var(--shadow);
  margin-bottom: 1.25rem;
}

.controls,
.button-row,
.section-heading,
.input-block {
  display: flex;
}

.controls {
  justify-content: space-between;
  align-items: end;
  gap: 1rem;
}

.section-heading {
  flex-direction: column;
}

.control-group,
.input-block {
  flex-direction: column;
}

.control-group label,
.input-block label {
  margin-bottom: 0.4rem;
  font-weight: 600;
}

.button-row {
  flex-wrap: wrap;
  gap: 0.75rem;
}

button {
  border: 1px solid transparent;
  border-radius: 999px;
  padding: 0.8rem 1.15rem;
  background: var(--accent);
  color: white;
  cursor: pointer;
  font-weight: 700;
  transition: transform 160ms ease, opacity 160ms ease, background 160ms ease;
}

button:hover {
  transform: translateY(-1px);
}

button.secondary {
  background: #1e293b;
  color: var(--text);
  border-color: #334155;
}

button.ghost {
  background: transparent;
  color: var(--text);
  border-color: #334155;
}

select,
input {
  width: 100%;
  border: 1px solid #334155;
  border-radius: 12px;
  padding: 0.8rem 0.9rem;
  background: #f8fafc;
  color: #0f172a;
}

select:focus,
input:focus,
button:focus {
  outline: 3px solid rgba(96, 165, 250, 0.28);
  outline-offset: 2px;
}

.problem-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1.25rem;
}

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

table {
  width: 100%;
  border-collapse: collapse;
  background: var(--card-soft);
  border-radius: 14px;
  overflow: hidden;
}

th,
td {
  padding: 0.85rem;
  text-align: left;
  border-bottom: 1px solid #334155;
}

th {
  background: #1e293b;
  color: #e2e8f0;
}

td {
  color: #e5e7eb;
}

.practice-layout {
  display: grid;
  grid-template-columns: 0.95fr 1.25fr;
  gap: 1.25rem;
}

.prompt-list {
  margin: 0;
  padding-left: 1.1rem;
  line-height: 1.7;
}

.answer-content {
  display: grid;
  gap: 1rem;
}

.answer-block {
  padding: 1rem;
  border: 1px solid #334155;
  border-radius: 14px;
  background: #172033;
  color: var(--text);
}

.answer-block strong {
  color: #bfdbfe;
}

.equation {
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 0.95rem;
}

.check-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
  margin-bottom: 1rem;
}

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

.feedback-panel {
  margin-top: 1rem;
  padding: 1rem;
  border-radius: 14px;
  border: 1px solid #334155;
  background: #172033;
  color: var(--text);
}

.feedback-summary {
  font-weight: 700;
  margin-bottom: 0.75rem;
}

.feedback-item {
  padding: 0.8rem 0.9rem;
  border-radius: 12px;
  margin-bottom: 0.7rem;
}

.feedback-item.correct {
  background: var(--success-soft);
  color: var(--success);
}

.feedback-item.incorrect {
  background: var(--error-soft);
  color: var(--error);
}

.feedback-item.partial {
  background: rgba(245, 158, 11, 0.16);
  color: #fcd34d;
}

.hidden {
  display: none;
}

@media (max-width: 920px) {
  .hero,
  .practice-layout,
  .check-grid,
  .check-grid.compact,
  .controls,
  .problem-grid {
    grid-template-columns: 1fr;
    display: grid;
  }

  .controls {
    align-items: stretch;
  }

  .button-row {
    justify-content: flex-start;
  }
}

@media (max-width: 560px) {
  .app-shell {
    width: min(100% - 1rem, 1080px);
    padding-top: 1rem;
  }

  .card {
    padding: 1rem;
  }

  button {
    width: 100%;
  }
}
