:root {
  color-scheme: light;
  --bg: #e8edf3;
  --paper: #fffdf6;
  --paper-line: rgba(91, 149, 214, 0.16);
  --paper-margin: rgba(195, 76, 82, 0.28);
  --surface: #fffefa;
  --surface-2: #eef4fb;
  --surface-3: #f7eadf;
  --text: #202a35;
  --muted: #697386;
  --line: #cfd8e6;
  --primary: #1f6d5a;
  --primary-strong: #164d42;
  --accent: #b6503d;
  --warning: #b58900;
  --focus: #2f6fed;
  --shadow: 0 18px 50px rgba(31, 42, 53, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at top left, rgba(255, 255, 255, 0.75), transparent 32rem),
    linear-gradient(135deg, #e6ebf2 0%, #f2eee4 100%);
  color: var(--text);
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 16px;
  letter-spacing: 0;
}

a {
  color: var(--primary);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

button,
input,
textarea {
  font: inherit;
}

input,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 10px 12px;
  background: #fff;
  color: var(--text);
  box-shadow: inset 0 1px 0 rgba(31, 42, 53, 0.03);
}

input:focus,
textarea:focus,
button:focus,
a:focus {
  outline: 3px solid rgba(47, 111, 237, 0.18);
  outline-offset: 2px;
}

h1,
h2 {
  margin: 0;
  line-height: 1.15;
}

h1 {
  font-size: 32px;
}

h2 {
  font-size: 19px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  min-height: 64px;
  padding: 0 32px;
  border-bottom: 1px solid rgba(207, 216, 230, 0.88);
  background: rgba(255, 253, 246, 0.92);
  backdrop-filter: blur(14px);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.7);
}

.brand {
  color: var(--text);
  font-size: 20px;
  font-weight: 800;
}

.topnav,
.topnav form,
.actions,
.toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
}

.topnav form {
  margin: 0;
}

.username {
  color: var(--muted);
}

.page {
  position: relative;
  width: min(1240px, calc(100vw - 36px));
  margin: 24px auto 56px;
  padding: 32px clamp(24px, 4vw, 54px) 56px;
  overflow: hidden;
  border: 1px solid rgba(207, 216, 230, 0.9);
  border-radius: 8px;
  background-color: var(--paper);
  background-image:
    linear-gradient(to bottom, transparent 31px, var(--paper-line) 32px),
    linear-gradient(to right, transparent 72px, var(--paper-margin) 73px, transparent 74px);
  background-size: 100% 32px, 100% 100%;
  box-shadow: var(--shadow);
}

.page > * {
  position: relative;
  z-index: 1;
}

.muted {
  color: var(--muted);
}

.primary,
.icon-text,
.secondary-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  border-radius: 7px;
  padding: 8px 14px;
  border: 1px solid transparent;
  cursor: pointer;
  font-weight: 700;
  transition: background 0.16s ease, border-color 0.16s ease, transform 0.16s ease, box-shadow 0.16s ease;
}

.primary {
  background: var(--primary);
  color: #fff;
  box-shadow: 0 8px 18px rgba(31, 109, 90, 0.18);
}

.primary:hover {
  background: var(--primary-strong);
  text-decoration: none;
  transform: translateY(-1px);
  box-shadow: 0 12px 24px rgba(31, 109, 90, 0.26);
}

.primary:active {
  transform: translateY(0);
  box-shadow: 0 6px 14px rgba(31, 109, 90, 0.2);
}

button:disabled {
  cursor: default;
  opacity: 0.58;
  transform: none;
  box-shadow: none;
}

.icon-text,
.secondary-link {
  background: rgba(255, 254, 250, 0.92);
  border-color: var(--line);
  color: var(--text);
}

.icon-text:hover,
.secondary-link:hover {
  border-color: rgba(47, 111, 237, 0.36);
  background: #fff;
  color: var(--primary-strong);
  text-decoration: none;
  transform: translateY(-1px);
  box-shadow: 0 10px 20px rgba(31, 42, 53, 0.12);
}

.icon-text:active,
.secondary-link:active {
  transform: translateY(0);
  box-shadow: 0 5px 12px rgba(31, 42, 53, 0.1);
}

.auth-shell {
  display: grid;
  grid-template-columns: minmax(220px, 0.8fr) minmax(320px, 1.2fr);
  gap: 28px;
  align-items: start;
}

.auth-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.panel,
.trainer-card,
.result-panel {
  background: rgba(255, 254, 250, 0.92);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 18px;
  box-shadow: 0 10px 28px rgba(31, 42, 53, 0.06);
}

.panel {
  display: grid;
  gap: 14px;
}

.panel label,
.wide-label,
.task-card label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-weight: 700;
}

.captcha-field {
  align-items: start;
}

.captcha-image {
  width: min(230px, 100%);
  height: auto;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--surface);
  box-shadow: inset 4px 0 0 rgba(195, 76, 82, 0.24);
}

.error {
  margin: 0;
  color: var(--accent);
  font-weight: 700;
}

.dashboard-head,
.trainer-head,
.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 24px;
}

.trainer-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 14px;
}

.trainer-card {
  position: relative;
  display: grid;
  gap: 16px;
  min-height: 184px;
  align-content: space-between;
  overflow: hidden;
  background:
    linear-gradient(135deg, rgba(31, 109, 90, 0.08), transparent 36%),
    rgba(255, 254, 250, 0.94);
}

.trainer-card::before {
  content: "";
  position: absolute;
  top: 0;
  right: 18px;
  width: 38px;
  height: 7px;
  border-radius: 0 0 6px 6px;
  background: rgba(47, 111, 237, 0.22);
}

.trainer-card > * {
  position: relative;
  z-index: 1;
}

.score-line {
  margin: 0;
  width: fit-content;
  border-radius: 999px;
  padding: 7px 10px;
  font-size: 14px;
  font-weight: 800;
}

.score-line--done {
  border: 1px solid rgba(31, 109, 90, 0.22);
  background: rgba(31, 109, 90, 0.1);
  color: var(--primary-strong);
}

.score-line--empty {
  border: 1px solid rgba(105, 115, 134, 0.18);
  background: rgba(238, 244, 251, 0.72);
  color: var(--muted);
}

.section-band {
  margin-top: 26px;
  padding: 18px;
  background: rgba(255, 254, 250, 0.82);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 10px 28px rgba(31, 42, 53, 0.05);
}

.rank-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--surface);
}

.rank-table th,
.rank-table td {
  padding: 11px 10px;
  border-bottom: 1px solid var(--line);
  text-align: left;
}

.rank-table th {
  background: var(--surface-2);
  color: var(--muted);
  font-size: 14px;
}

.timer-box {
  display: grid;
  gap: 4px;
  min-width: 150px;
  padding: 14px 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 254, 250, 0.94);
  text-align: right;
  box-shadow: 0 12px 32px rgba(31, 42, 53, 0.08);
}

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

.timer-box strong {
  font-size: 28px;
  font-variant-numeric: tabular-nums;
}

.trainer-form {
  display: grid;
  gap: 20px;
}

.toolbar {
  position: sticky;
  top: 12px;
  z-index: 2;
  justify-content: space-between;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 253, 246, 0.96);
  backdrop-filter: blur(12px);
  box-shadow: 0 12px 30px rgba(31, 42, 53, 0.08);
}

.toolbar-progress {
  margin-left: auto;
  color: var(--muted);
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

.task-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 10px;
}

.task-card {
  min-height: 92px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.task-stage {
  display: grid;
  gap: 18px;
  min-height: 560px;
  padding: clamp(18px, 3vw, 30px);
  border: 1px solid rgba(207, 216, 230, 0.96);
  border-radius: 8px;
  background:
    linear-gradient(to bottom, rgba(255, 255, 255, 0.5), rgba(255, 253, 246, 0.86)),
    linear-gradient(to bottom, transparent 35px, rgba(91, 149, 214, 0.13) 36px);
  background-size: 100% 100%, 100% 36px;
  box-shadow: inset 4px 0 0 rgba(195, 76, 82, 0.28), 0 12px 30px rgba(31, 42, 53, 0.06);
}

.stage-meta,
.task-stage-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.stage-meta {
  color: var(--muted);
  font-size: 14px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

.focus-task-card {
  display: grid;
  align-content: center;
  justify-items: center;
  gap: 22px;
  min-height: 330px;
  padding: clamp(20px, 4vw, 42px);
  border: 1px solid rgba(207, 216, 230, 0.95);
  border-radius: 8px;
  background: rgba(255, 254, 250, 0.82);
  box-shadow: 0 18px 44px rgba(31, 42, 53, 0.09);
}

.task-kicker {
  color: var(--muted);
  font-size: 13px;
  font-weight: 900;
  text-transform: uppercase;
}

.focus-task-label {
  min-height: 70px;
  color: var(--text);
  font-size: 54px;
  font-weight: 900;
  line-height: 1.05;
  text-align: center;
}

.focus-task-inputs {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 14px;
  width: min(560px, 100%);
}

.answer-field {
  display: grid;
  gap: 8px;
  min-width: min(230px, 100%);
  color: var(--muted);
  font-weight: 800;
}

.answer-field input {
  height: 72px;
  padding: 8px 14px;
  border-color: #bfcbe0;
  background: #fff;
  font-size: 34px;
  font-weight: 850;
  text-align: center;
  font-variant-numeric: tabular-nums;
}

.task-stage-footer {
  align-items: start;
}

.task-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  max-height: 96px;
  overflow: auto;
  padding: 2px;
}

.task-dot {
  width: 28px;
  height: 28px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: rgba(255, 254, 250, 0.82);
  color: var(--muted);
  cursor: pointer;
  font-size: 12px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  transition: background 0.14s ease, border-color 0.14s ease, color 0.14s ease, transform 0.14s ease, box-shadow 0.14s ease;
  user-select: none;
}

.task-dot:hover {
  border-color: rgba(47, 111, 237, 0.42);
  background: rgba(238, 244, 251, 0.98);
  color: var(--text);
  transform: translateY(-1px);
  box-shadow: 0 8px 16px rgba(31, 42, 53, 0.12);
}

.task-dot:active {
  transform: translateY(0) scale(0.96);
  box-shadow: 0 4px 10px rgba(31, 42, 53, 0.1);
}

.task-dot[data-state="answered"] {
  border-color: rgba(31, 109, 90, 0.45);
  background: rgba(31, 109, 90, 0.12);
  color: var(--primary-strong);
}

.task-dot[aria-current="step"] {
  border-color: var(--focus);
  background: var(--primary);
  color: #fff;
  transform: translateY(-1px);
  box-shadow: 0 0 0 4px rgba(47, 111, 237, 0.16), 0 12px 22px rgba(31, 109, 90, 0.24);
}

.task-dot[aria-current="step"]:hover {
  background: var(--primary-strong);
  color: #fff;
  box-shadow: 0 0 0 4px rgba(47, 111, 237, 0.16), 0 14px 24px rgba(31, 109, 90, 0.3);
}

.next-task-button {
  min-width: 150px;
  min-height: 48px;
}

.task-card span,
.missing-label {
  color: var(--text);
  font-weight: 800;
}

.compact-label {
  margin-top: 8px;
}

.symbol-map,
.word-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(92px, 1fr));
  gap: 8px;
  margin-bottom: 18px;
}

.symbol-map span,
.word-grid span {
  padding: 10px;
  border-radius: 6px;
  background: var(--surface);
  border: 1px solid var(--line);
  text-align: center;
}

.counting-panel {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.stroop-grid {
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.stroop-word {
  margin-bottom: 10px;
  font-size: 24px;
  font-weight: 900;
}

.color-options {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  width: min(520px, 100%);
}

.color-choice {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 52px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.84);
  color: var(--text);
  font-size: 15px;
  font-weight: 800;
}

.color-choice input {
  width: auto;
}

.metrics {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 12px;
  margin: 18px 0;
}

.metrics div {
  padding: 14px;
  border-radius: 8px;
  background: var(--surface-2);
}

.metrics dt {
  color: var(--muted);
  font-size: 13px;
}

.metrics dd {
  margin: 6px 0 0;
  font-size: 24px;
  font-weight: 800;
}

.article-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(270px, 1fr));
  gap: 14px;
}

.article-card {
  position: relative;
  display: grid;
  gap: 14px;
  align-content: space-between;
  min-height: 260px;
  padding: 20px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(182, 80, 61, 0.08), transparent 42%),
    rgba(255, 254, 250, 0.93);
  box-shadow: 0 14px 34px rgba(31, 42, 53, 0.08);
}

.article-card::before {
  content: "";
  position: absolute;
  top: 16px;
  right: 16px;
  width: 46px;
  height: 46px;
  border: 1px solid rgba(47, 111, 237, 0.22);
  border-radius: 50%;
  background: rgba(238, 244, 251, 0.78);
}

.article-card > * {
  position: relative;
  z-index: 1;
}

.article-card p {
  margin: 0;
  color: var(--muted);
  line-height: 1.55;
}

.article-eyebrow {
  margin: 0;
  color: var(--accent);
  font-size: 13px;
  font-weight: 900;
  text-transform: uppercase;
}

.article-page {
  display: grid;
  gap: 24px;
  max-width: 860px;
}

.article-hero {
  display: grid;
  gap: 14px;
}

.article-hero .secondary-link {
  width: fit-content;
}

.article-lead {
  max-width: 760px;
  margin: 0;
  color: var(--muted);
  font-size: 18px;
  line-height: 1.6;
}

.article-note,
.article-takeaways {
  display: grid;
  gap: 8px;
  padding: 16px 18px;
  border: 1px solid rgba(31, 109, 90, 0.22);
  border-radius: 8px;
  background: rgba(31, 109, 90, 0.08);
}

.article-note span {
  color: var(--muted);
  overflow-wrap: anywhere;
}

.article-section {
  display: grid;
  gap: 10px;
}

.article-section p,
.article-takeaways li {
  margin: 0;
  line-height: 1.7;
}

.article-takeaways ul {
  display: grid;
  gap: 8px;
  margin: 0;
  padding-left: 22px;
}

@media (max-width: 760px) {
  .topbar,
  .topnav,
  .dashboard-head,
  .trainer-head,
  .section-head,
  .auth-shell,
  .auth-grid {
    display: grid;
    grid-template-columns: 1fr;
  }

  .topbar {
    padding: 14px 16px;
  }

  .topnav form {
    justify-content: space-between;
  }

  .page {
    width: min(100vw - 18px, 1180px);
    margin-top: 10px;
    padding: 22px 16px 36px;
    background-image:
      linear-gradient(to bottom, transparent 31px, var(--paper-line) 32px),
      linear-gradient(to right, transparent 30px, var(--paper-margin) 31px, transparent 32px);
  }

  .toolbar {
    top: 8px;
  }

  .task-stage {
    min-height: 500px;
    padding: 16px;
  }

  .focus-task-card {
    min-height: 280px;
    padding: 20px 14px;
  }

  .focus-task-label {
    min-height: 56px;
    font-size: 40px;
  }

  .answer-field input {
    height: 64px;
    font-size: 30px;
  }

  .task-stage-footer {
    display: grid;
    grid-template-columns: 1fr;
  }

  .next-task-button {
    width: 100%;
  }
}
