:root {
  color-scheme: light;
  --sber-green: #21a038;
  --sber-green-dark: #0b7f32;
  --sber-green-soft: #e8f7ec;
  --ink: #14201a;
  --muted: #66736d;
  --line: #dbe7df;
  --bg: #f4f7f4;
  --card: #ffffff;
  --blue: #1b77d2;
  --yellow: #ffcf33;
  --red: #d63b3b;
  --shadow: 0 16px 50px rgba(11, 127, 50, 0.14);
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background:
    linear-gradient(135deg, rgba(33, 160, 56, 0.14), rgba(27, 119, 210, 0.08)),
    var(--bg);
  color: var(--ink);
}

button {
  font: inherit;
}

.app-shell {
  width: min(720px, 100%);
  min-height: 100vh;
  margin: 0 auto;
  padding: max(18px, env(safe-area-inset-top)) 16px max(20px, env(safe-area-inset-bottom));
  display: grid;
  grid-template-rows: auto 1fr auto;
  gap: 16px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--sber-green-dark);
  font-size: 13px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0;
}

h1 {
  margin: 0;
  font-size: 30px;
  line-height: 1.05;
  letter-spacing: 0;
}

.score {
  flex: 0 0 auto;
  min-width: 68px;
  height: 44px;
  border: 1px solid var(--line);
  border-radius: 8px;
  display: grid;
  place-items: center;
  background: rgba(255, 255, 255, 0.78);
  color: var(--sber-green-dark);
  font-weight: 800;
}

.card {
  align-self: center;
  min-height: min(520px, calc(100vh - 210px));
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 22px;
  background: var(--card);
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
}

.topic-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 22px;
}

.topic,
.mode {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 0 10px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 800;
}

.topic {
  background: var(--sber-green-soft);
  color: var(--sber-green-dark);
}

.mode {
  background: rgba(255, 207, 51, 0.2);
  color: #725600;
}

.question {
  margin: 0;
  font-size: 28px;
  line-height: 1.2;
  letter-spacing: 0;
}

.answer-panel {
  margin-top: 22px;
  padding: 18px;
  border-left: 5px solid var(--blue);
  border-radius: 8px;
  background: #f3f8ff;
}

.answer-label {
  margin: 0 0 8px;
  color: var(--blue);
  font-size: 13px;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0;
}

.answer {
  margin: 0;
  color: #1d3144;
  font-size: 18px;
  line-height: 1.45;
}

.actions {
  margin-top: auto;
  padding-top: 26px;
}

.primary-btn,
.secondary-btn {
  width: 100%;
  min-height: 54px;
  border: 0;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 900;
  transition: transform 0.12s ease, filter 0.12s ease, background 0.12s ease;
}

.primary-btn {
  background: var(--sber-green);
  color: white;
}

.primary-btn:active,
.secondary-btn:active {
  transform: translateY(1px);
  filter: brightness(0.96);
}

.grade-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.secondary-btn {
  border: 1px solid var(--line);
  background: white;
}

.secondary-btn.success {
  background: var(--sber-green);
  color: white;
}

.secondary-btn.danger {
  background: #fff5f5;
  color: var(--red);
}

.stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.stats div {
  min-height: 72px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  background: rgba(255, 255, 255, 0.82);
}

.stats span {
  display: block;
  color: var(--sber-green-dark);
  font-size: 24px;
  line-height: 1;
  font-weight: 900;
}

.stats p {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

@media (max-width: 430px) {
  .app-shell {
    padding-left: 12px;
    padding-right: 12px;
  }

  .card {
    padding: 18px;
  }

  .question {
    font-size: 23px;
  }

  .grade-actions {
    grid-template-columns: 1fr;
  }
}
