:root {
  color-scheme: light dark;
  --bg: #eef1ef;
  --panel: #fbfaf7;
  --panel-strong: #ffffff;
  --text: #152027;
  --muted: #637179;
  --line: #d7dedc;
  --accent: #a85222;
  --accent-2: #2f6f73;
  --danger: #a33d36;
  --warn: #8a651e;
  --ok: #2d6b45;
  --shadow: 0 18px 48px rgba(21, 32, 39, .12);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #14191d;
    --panel: #1d2429;
    --panel-strong: #232c31;
    --text: #eef3f2;
    --muted: #a3b0b5;
    --line: #354148;
    --shadow: none;
  }
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
input,
select {
  font: inherit;
}

button {
  border: 1px solid var(--line);
  background: var(--panel-strong);
  color: var(--text);
  border-radius: 8px;
  cursor: pointer;
}

button:focus-visible,
input:focus-visible,
select:focus-visible,
.card-surface:focus-visible {
  outline: 3px solid rgba(47, 111, 115, .35);
  outline-offset: 2px;
}

.app-shell {
  display: grid;
  grid-template-columns: minmax(280px, 340px) minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  border-right: 1px solid var(--line);
  background: var(--panel);
  padding: 22px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 22px;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border-radius: 8px;
  background: var(--accent-2);
  color: white;
  font-weight: 800;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: 24px;
}

.brand p,
.source,
.eyebrow {
  color: var(--muted);
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  margin-bottom: 22px;
}

.metric-grid div {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: var(--panel-strong);
}

.metric-grid strong {
  display: block;
  font-size: 26px;
}

.metric-grid span {
  color: var(--muted);
  font-size: 13px;
}

.field {
  display: grid;
  gap: 7px;
  margin-bottom: 14px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

input,
select {
  width: 100%;
  border: 1px solid var(--line);
  background: var(--panel-strong);
  color: var(--text);
  border-radius: 8px;
  padding: 11px 12px;
}

.mode-control {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  margin: 16px 0;
}

.mode-control button,
.side-actions button {
  min-height: 40px;
  padding: 9px 10px;
}

.mode-control .active {
  background: var(--accent-2);
  border-color: var(--accent-2);
  color: white;
}

.side-actions {
  display: grid;
  gap: 8px;
}

.trainer {
  display: grid;
  grid-template-rows: auto minmax(360px, 1fr) auto;
  gap: 18px;
  padding: 28px;
}

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

.eyebrow {
  font-size: 13px;
  font-weight: 800;
  text-transform: uppercase;
}

h2 {
  font-size: 28px;
}

.primary {
  min-width: 154px;
  min-height: 44px;
  background: var(--accent);
  border-color: var(--accent);
  color: white;
  font-weight: 800;
}

.card-surface {
  display: grid;
  align-content: center;
  gap: 22px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-strong);
  box-shadow: var(--shadow);
  padding: clamp(22px, 5vw, 54px);
  min-height: 360px;
}

.card-text {
  font-size: 24px;
  line-height: 1.5;
  max-width: 860px;
}

.card-text strong {
  color: var(--accent);
}

.card-text ol,
.card-text ul {
  margin: 14px 0 0 1.25em;
  padding: 0;
}

.card-text li {
  margin: 8px 0;
  padding-left: 4px;
}

.card-text em {
  color: var(--muted);
}

.answer-panel {
  border-top: 1px solid var(--line);
  padding-top: 22px;
}

.source {
  margin-top: 16px;
  font-size: 13px;
}

.rating-panel {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
}

.rating-panel button {
  min-height: 72px;
  padding: 12px;
  text-align: left;
}

.rating-panel strong,
.rating-panel span {
  display: block;
}

.rating-panel span {
  margin-top: 4px;
  color: var(--muted);
  font-size: 13px;
}

.again {
  border-color: rgba(163, 61, 54, .45);
}

.hard {
  border-color: rgba(138, 101, 30, .45);
}

.good {
  border-color: rgba(45, 107, 69, .45);
}

.easy {
  border-color: rgba(47, 111, 115, .45);
}

@media (max-width: 820px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .trainer {
    padding: 18px;
  }

  .trainer-header {
    align-items: stretch;
    flex-direction: column;
  }

  .primary {
    width: 100%;
  }

  .card-text {
    font-size: 20px;
  }

  .rating-panel {
    grid-template-columns: repeat(2, 1fr);
  }
}
