:root {
  color-scheme: light;
  --bg: #f4f6f5;
  --panel: #ffffff;
  --ink: #17201d;
  --muted: #62706b;
  --line: #d9e1de;
  --accent: #0f766e;
  --accent-strong: #075f59;
  --good: #146c43;
  --bad: #9d2f2f;
  --soft: #e8f4f2;
  --shadow: 0 18px 50px rgba(29, 45, 53, 0.10);
}

body[data-theme="dark"] {
  color-scheme: dark;
  --bg: #111614;
  --panel: #1a211f;
  --ink: #eef5f2;
  --muted: #a9b8b3;
  --line: #33413d;
  --accent: #39b8a9;
  --accent-strong: #78d9ce;
  --good: #5ed097;
  --bad: #f08a84;
  --soft: #17332f;
  --shadow: 0 18px 50px rgba(0, 0, 0, 0.28);
}

* {
  box-sizing: border-box;
}

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

button {
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 16px;
  background: var(--panel);
  color: var(--ink);
  font: inherit;
  font-weight: 750;
  cursor: pointer;
}

button:hover {
  border-color: var(--accent);
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.58;
}

input,
select {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 12px;
  background: var(--panel);
  color: var(--ink);
  font: inherit;
}

label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 750;
}

.primary {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

.app {
  width: min(980px, calc(100vw - 28px));
  margin: 0 auto;
  padding: 18px 0 42px;
}

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

.top-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 8px;
}

.session-pill {
  min-height: 34px;
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0 12px;
  color: var(--accent-strong);
  background: var(--soft);
  font-size: 13px;
  font-weight: 850;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--accent-strong);
  font-weight: 850;
  text-transform: uppercase;
  letter-spacing: 0;
  font-size: 12px;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: 28px;
  line-height: 1.15;
}

h2 {
  font-size: 22px;
  line-height: 1.25;
}

.subtitle {
  margin-top: 6px;
  color: var(--muted);
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: 22px;
}

.auth-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 22px;
}

.auth-block {
  display: grid;
  align-content: start;
  gap: 14px;
}

.auth-copy,
.auth-message {
  color: var(--muted);
  line-height: 1.45;
}

.auth-message {
  min-height: 22px;
  font-size: 14px;
}

.auth-actions {
  justify-content: flex-start;
  margin-top: 0;
}

.paypal-box {
  min-height: 48px;
}

.inline-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.timer {
  color: var(--accent-strong);
  font-size: 13px;
  font-weight: 850;
}

.hidden {
  display: none;
}

.progress-line,
.actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.progress-line {
  color: var(--muted);
  margin-bottom: 18px;
}

.lesson-content {
  display: grid;
  gap: 16px;
  margin-bottom: 22px;
}

.lesson-content p {
  line-height: 1.65;
  font-size: 18px;
}

.takeaways {
  margin: 0;
  padding: 0 0 0 22px;
  display: grid;
  gap: 8px;
  color: var(--ink);
  line-height: 1.48;
}

.takeaways li::marker {
  color: var(--accent);
}

.focus {
  border-left: 4px solid var(--accent);
  background: var(--soft);
  padding: 14px;
  border-radius: 8px;
  line-height: 1.45;
}

.quiz-panel h2 {
  margin-bottom: 18px;
}

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

.option {
  width: 100%;
  min-height: 54px;
  text-align: left;
  display: flex;
  align-items: center;
  gap: 10px;
  line-height: 1.35;
}

.option.selected {
  border-color: var(--accent);
  background: var(--soft);
}

.option.correct {
  border-color: var(--good);
  background: #eaf6ef;
}

.option.wrong {
  border-color: var(--bad);
  background: #faecec;
}

.marker {
  color: var(--accent-strong);
  flex: 0 0 auto;
}

.feedback {
  margin-top: 16px;
  padding: 16px;
  border-radius: 8px;
  line-height: 1.5;
}

.feedback p {
  margin-top: 8px;
}

.feedback.ok {
  border: 1px solid #9bd5b8;
  background: #edf8f2;
}

.feedback.bad {
  border: 1px solid #e2aaa5;
  background: #fff1f0;
}

body[data-theme="dark"] .feedback.ok,
body[data-theme="dark"] .option.correct {
  background: #163326;
}

body[data-theme="dark"] .feedback.bad,
body[data-theme="dark"] .option.wrong {
  background: #3a2020;
}

.quiz-panel .actions,
.lesson-panel .actions {
  margin-top: 20px;
}

.final-panel:not(.hidden) {
  display: grid;
  gap: 12px;
}

.class-list {
  display: grid;
  gap: 10px;
  margin-top: 16px;
}

.class-item {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  text-decoration: none;
}

.class-item:hover {
  border-color: var(--accent);
  background: var(--soft);
}

.class-item span,
.empty {
  color: var(--muted);
}

@media (max-width: 700px) {
  .topbar,
  .actions,
  .progress-line,
  .class-item {
    align-items: stretch;
    flex-direction: column;
  }

  .auth-grid {
    grid-template-columns: 1fr;
  }

  .top-actions {
    justify-content: flex-start;
  }

  .panel {
    padding: 16px;
  }

  h1 {
    font-size: 24px;
  }

  .lesson-content p {
    font-size: 16px;
  }
}
