* {
  box-sizing: border-box;
}

:root {
  --bg: #0b1020;
  --panel: rgba(16, 24, 45, 0.86);
  --panel-2: rgba(255, 255, 255, 0.04);
  --text: #eef2ff;
  --muted: #aab4d6;
  --border: rgba(255, 255, 255, 0.1);
  --accent: #8b5cf6;
  --good: #22c55e;
  --bad: #ef4444;
  --warn: #f59e0b;
  --shadow: 0 20px 50px rgba(0, 0, 0, 0.35);
}

html, body {
  margin: 0;
  min-height: 100%;
  background:
    radial-gradient(circle at top left, rgba(139, 92, 246, 0.18), transparent 30%),
    radial-gradient(circle at top right, rgba(34, 197, 94, 0.12), transparent 30%),
    linear-gradient(180deg, #070b16 0%, #0b1020 100%);
  color: var(--text);
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

body {
  padding: 32px 16px 48px;
}

.app {
  width: min(920px, 100%);
  margin: 0 auto;
  display: grid;
  gap: 18px;
}

.hero {
  padding: 10px 4px 6px;
}

.eyebrow {
  margin: 0 0 8px;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: var(--muted);
  font-size: 0.78rem;
}

h1 {
  margin: 0;
  font-size: clamp(2rem, 5vw, 3.75rem);
  line-height: 1.03;
  max-width: 14ch;
}

.subhead {
  margin: 12px 0 0;
  max-width: 62ch;
  color: var(--muted);
  line-height: 1.6;
  font-size: 1rem;
}

.card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 24px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(16px);
  padding: 20px;
}

.card-head {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
}

.label {
  margin: 0;
  font-size: 0.82rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
}

.progress {
  margin: 6px 0 0;
  font-size: 1.1rem;
  font-weight: 600;
}

.hint {
  margin: 6px 0 0;
  color: var(--muted);
}

.status {
  min-width: 92px;
  padding: 10px 14px;
  border-radius: 999px;
  text-align: center;
  font-weight: 700;
  border: 1px solid var(--border);
  background: var(--panel-2);
}

.status.idle { color: var(--muted); }
.status.good {
  color: #d9ffe7;
  background: rgba(34, 197, 94, 0.18);
  border-color: rgba(34, 197, 94, 0.42);
}
.status.bad {
  color: #ffe3e3;
  background: rgba(239, 68, 68, 0.18);
  border-color: rgba(239, 68, 68, 0.42);
}
.status.warn {
  color: #fff5d6;
  background: rgba(245, 158, 11, 0.16);
  border-color: rgba(245, 158, 11, 0.38);
}

.problem-field,
.answer-field {
  width: 100%;
  min-height: 74px;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.04);
  padding: 14px 16px;
  font-size: 1.45rem;
}

.problem-field {
  cursor: default;
  user-select: text;
  background: rgba(255, 255, 255, 0.03);
}

.answer-field {
  transition: border-color 160ms ease, box-shadow 160ms ease, transform 160ms ease;
}

.answer-field:focus-within {
  border-color: rgba(139, 92, 246, 0.75);
  box-shadow: 0 0 0 4px rgba(139, 92, 246, 0.16);
}

.answer-field.correct {
  border-color: rgba(34, 197, 94, 0.75);
  box-shadow: 0 0 0 4px rgba(34, 197, 94, 0.14);
}

.answer-field.wrong {
  border-color: rgba(239, 68, 68, 0.75);
  box-shadow: 0 0 0 4px rgba(239, 68, 68, 0.14);
}

.nav,
.actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 16px;
}

button {
  appearance: none;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
  border-radius: 14px;
  padding: 11px 16px;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  transition: transform 120ms ease, background 120ms ease, border-color 120ms ease;
}

button:hover {
  transform: translateY(-1px);
  background: rgba(255, 255, 255, 0.09);
}

button:active {
  transform: translateY(0);
}

button.primary {
  background: linear-gradient(135deg, rgba(139, 92, 246, 0.96), rgba(99, 102, 241, 0.96));
  border-color: rgba(255, 255, 255, 0.08);
}

button.primary:hover {
  background: linear-gradient(135deg, rgba(139, 92, 246, 1), rgba(99, 102, 241, 1));
}

.feedback {
  margin: 16px 0 0;
  padding: 13px 14px;
  border-radius: 16px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.04);
  line-height: 1.5;
}

.feedback.neutral { color: var(--muted); }
.feedback.good { color: #dcffe8; border-color: rgba(34, 197, 94, 0.4); background: rgba(34, 197, 94, 0.14); }
.feedback.bad { color: #ffe0e0; border-color: rgba(239, 68, 68, 0.4); background: rgba(239, 68, 68, 0.12); }
.feedback.warn { color: #fff1cd; border-color: rgba(245, 158, 11, 0.4); background: rgba(245, 158, 11, 0.12); }

.notes p:last-child {
  margin-bottom: 0;
}

.mono {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
}

/* MathLive styling */
math-field {
  color: white;
  --caret-color: white;
  --selection-background-color: rgba(255, 255, 255, 0.3);
}

/* Force rendered math glyphs to be white */
math-field::part(content),
math-field::part(content) * {
  color: white !important;
  fill: white !important;
  stroke: white !important;
}
/* Keep the outer container white too */
math-field::part(container) {
  color: white;
}



@media (max-width: 640px) {
  body {
    padding: 18px 12px 30px;
  }

  .card {
    padding: 16px;
    border-radius: 20px;
  }

  .card-head {
    flex-direction: column;
  }

  .status {
    align-self: flex-start;
  }

  .problem-field,
  .answer-field {
    font-size: 1.28rem;
    min-height: 66px;
  }
}