:root {
  --bg: #eef2ee;
  --paper: #f8f8f4;
  --ink: #122229;
  --muted: #5f6d73;
  --line: #d7dfda;
  --brand: #0d6c78;
  --brand-dark: #0a4f58;
  --accent: #f1b544;
  --warn: #d65d43;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  display: grid;
  place-items: center;
  background: radial-gradient(circle at 20% 10%, #d8ece5, #dbe6df 45%, #c8d8d0);
  color: var(--ink);
  font-family: "Segoe UI", Tahoma, Verdana, sans-serif;
}

button {
  border: 0;
  font: inherit;
}

.app-shell {
  width: min(100vw, 430px);
  min-height: 100vh;
  background: var(--paper);
  position: relative;
  overflow: hidden;
  box-shadow: 0 24px 70px rgba(16, 34, 41, .2);
}

.screen {
  display: none;
  min-height: 100vh;
  overflow-y: auto;
  padding: 18px 16px 94px;
}

.screen.active {
  display: block;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 14px;
}

.eyebrow {
  margin: 0 0 4px;
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
  color: var(--brand-dark);
}

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

h1 {
  margin-bottom: 0;
  font-size: 28px;
  line-height: 1.1;
}

h2 {
  font-size: 22px;
  margin-bottom: 10px;
}

h3 {
  margin-bottom: 8px;
  font-size: 17px;
}

.icon-btn {
  width: 42px;
  height: 42px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  color: var(--brand-dark);
  background: #fff;
  border: 1px solid var(--line);
}

.hero {
  border-radius: 8px;
  padding: 16px;
  color: #fff;
  background: linear-gradient(140deg, #0b4550 0%, #0f7d8c 55%, #35a2aa 100%);
}

.hero p {
  line-height: 1.45;
  margin-bottom: 14px;
  color: rgba(255, 255, 255, .9);
}

.primary-btn {
  min-height: 44px;
  border-radius: 8px;
  padding: 0 14px;
  font-weight: 800;
  color: #2b1f08;
  background: var(--accent);
}

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

.panel-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

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

.chips span {
  border-radius: 999px;
  border: 1px solid #bde0d7;
  background: #ebfaf5;
  color: #0c5f69;
  padding: 5px 10px;
  font-size: 12px;
  font-weight: 700;
}

.list {
  margin: 0;
  padding-left: 18px;
  color: var(--muted);
}

.list li {
  line-height: 1.45;
  margin-bottom: 8px;
}

.segmented {
  margin-bottom: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 4px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 4px;
  background: #fff;
}

.segmented button {
  min-height: 36px;
  border-radius: 7px;
  background: transparent;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.segmented button.active {
  background: var(--brand);
  color: #fff;
}

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

.card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 12px;
  cursor: pointer;
}

.card p {
  color: var(--muted);
  line-height: 1.45;
}

.card small {
  color: var(--brand-dark);
  font-weight: 700;
}

.card:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
}

.grid.two {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.tile {
  min-height: 54px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: #f7faf8;
  color: var(--ink);
  font-weight: 700;
  padding: 8px;
  text-align: left;
}

.quiz-panel .quiz-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.quiz-step {
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
  color: var(--brand-dark);
}

.quiz-answers {
  display: grid;
  gap: 8px;
}

.quiz-answers button {
  min-height: 50px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: #f6f8f7;
  text-align: left;
  padding: 10px;
  color: var(--ink);
  font-weight: 700;
}

.quiz-answers button.correct {
  border-color: #59a084;
  background: #e9f8f0;
}

.quiz-answers button.wrong {
  border-color: var(--warn);
  background: #ffebe5;
}

.quiz-feedback {
  min-height: 24px;
  margin-top: 10px;
  font-weight: 800;
  color: var(--brand-dark);
}

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

.stats div {
  border: 1px solid var(--line);
  border-radius: 8px;
  text-align: center;
  padding: 10px 6px;
}

.stats strong {
  display: block;
  font-size: 21px;
}

.stats span {
  color: var(--muted);
  font-size: 12px;
}

.bottom-nav {
  position: absolute;
  left: 8px;
  right: 8px;
  bottom: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 6px;
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 5px;
  background: rgba(255, 255, 255, .97);
}

.bottom-nav button {
  min-height: 52px;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
}

.bottom-nav button.active {
  background: #0f3a45;
  color: #fff;
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 20;
  background: rgba(16, 34, 41, .45);
  display: grid;
  align-items: end;
}

.modal[hidden] {
  display: none;
}

.modal-card {
  max-height: 80vh;
  overflow: auto;
  border-radius: 8px 8px 0 0;
  background: var(--paper);
  padding: 14px;
}

.modal-card header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}

.modal-card p {
  line-height: 1.45;
  color: var(--muted);
}

.modal-card ul {
  margin: 0;
  padding-left: 18px;
}

.modal-card li {
  margin-bottom: 8px;
  line-height: 1.4;
}

@media (min-width: 520px) {
  body {
    padding: 24px;
  }

  .app-shell {
    min-height: 860px;
    border-radius: 22px;
  }
}
