:root {
  --blue: #1a87d4;
  --blue-dark: #0d5f9e;
  --ink: #172033;
  --muted: #637083;
  --line: #dfe6ef;
  --bg: #f5f8fb;
  --white: #fff;
  --danger: #b42318;
  --ok: #13795b;
}

* {
  box-sizing: border-box;
}

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

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

.topbar {
  min-height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 0 28px;
  background: var(--white);
  border-bottom: 1px solid var(--line);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--ink);
  font-weight: 800;
}

.brand-mark {
  width: 34px;
  height: 34px;
  display: inline-grid;
  place-items: center;
  color: var(--white);
  background: var(--blue);
  border-radius: 6px;
}

.nav {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  font-size: 14px;
}

.page {
  width: min(1120px, calc(100% - 32px));
  margin: 28px auto 64px;
}

.hero {
  display: grid;
  grid-template-columns: 1.3fr 0.7fr;
  gap: 24px;
  align-items: stretch;
}

.panel,
.card {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 24px;
}

.panel h1,
.panel h2,
.card h2,
.card h3 {
  margin: 0 0 12px;
}

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

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 16px;
  margin-top: 20px;
}

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

.button,
button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 0 16px;
  border: 1px solid var(--blue);
  border-radius: 6px;
  background: var(--blue);
  color: var(--white);
  font-weight: 700;
  cursor: pointer;
}

.button.secondary,
button.secondary {
  background: var(--white);
  color: var(--blue);
}

.button.danger,
button.danger {
  border-color: var(--danger);
  background: var(--danger);
}

input,
textarea,
select {
  width: 100%;
  min-height: 42px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--white);
  font: inherit;
}

textarea {
  min-height: 96px;
  resize: vertical;
}

label {
  display: grid;
  gap: 6px;
  font-size: 13px;
  font-weight: 700;
}

form {
  display: grid;
  gap: 14px;
}

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

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

th,
td {
  padding: 12px 10px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

th {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.alert {
  padding: 12px 14px;
  border-radius: 8px;
  margin-bottom: 16px;
  background: var(--white);
  border: 1px solid var(--line);
}

.alert.success {
  border-color: #a8dbc8;
  color: var(--ok);
}

.alert.error {
  border-color: #f2b8b5;
  color: var(--danger);
}

.progress {
  height: 10px;
  border-radius: 999px;
  background: #edf2f7;
  overflow: hidden;
}

.progress span {
  display: block;
  height: 100%;
  background: var(--blue);
}

.tabs {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.tab {
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--white);
  color: var(--ink);
}

.tab.active {
  background: var(--blue);
  color: var(--white);
  border-color: var(--blue);
}

.badge {
  display: inline-flex;
  width: fit-content;
  padding: 6px 10px;
  border-radius: 999px;
  background: #e8f6f0;
  color: var(--ok);
  font-size: 13px;
  font-weight: 800;
}

.lesson-hero {
  display: grid;
  gap: 10px;
}

.lesson-content {
  margin-top: 16px;
  font-size: 16px;
  line-height: 1.9;
}

.lesson-content h2 {
  margin-top: 34px;
  padding-top: 20px;
  border-top: 1px solid var(--line);
}

.lesson-content h3 {
  margin-top: 24px;
}

.lesson-intro {
  padding: 16px 18px;
  border-left: 4px solid var(--blue);
  background: #f2f8fd;
  color: var(--ink);
}

.lesson-content pre {
  overflow-x: auto;
  padding: 16px;
  border-radius: 8px;
  background: #111827;
  color: #f9fafb;
  line-height: 1.6;
}

.lesson-content code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

.content-callout {
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-left: 4px solid var(--blue);
  border-radius: 8px;
  background: #f8fbff;
}

.content-callout.tip {
  border-left-color: var(--ok);
  background: #f3fbf7;
}

.content-callout.warn {
  border-left-color: #b7791f;
  background: #fffaf0;
}

.link-resource,
.file-resource {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fbff;
}

.link-resource p,
.file-resource p {
  margin: 6px 0 0;
}

.os-steps,
.formula-example {
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfe;
}

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

.content-table {
  margin: 18px 0;
}

.try-it {
  margin-top: 18px;
  background: #111827;
  color: #f9fafb;
}

.try-it h2 {
  margin: 0 0 8px;
  color: #f9fafb;
}

.try-it .muted {
  color: #cbd5e1;
}

.try-it-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.try-it-kicker {
  margin: 0 0 8px;
  color: #8fd14f;
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0;
}

.try-it-status {
  min-width: 86px;
  padding: 8px 10px;
  border-radius: 6px;
  background: #fff0ec;
  color: #bc3c22;
  text-align: center;
}

.try-it-status.ok {
  background: #eef8d8;
  color: #527500;
}

.try-it label {
  color: #e5edf5;
}

.try-it-code {
  min-height: 220px;
  margin-top: 8px;
  border-color: #324256;
  background: #0b1220;
  color: #e5edf5;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  line-height: 1.6;
}

.try-it-code.sql {
  min-height: 180px;
}

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

.try-it-output,
.try-it-checks,
.try-it-preview {
  margin-top: 14px;
}

.try-it-output {
  max-height: 360px;
  overflow: auto;
  padding: 14px;
  border: 1px solid #324256;
  border-radius: 8px;
  background: #0b1220;
}

.try-it-output .content-table th,
.try-it-output .content-table td {
  border-bottom-color: #324256;
}

.try-it-error {
  color: #ffb4a8;
}

.try-it-checks {
  display: grid;
  gap: 8px;
}

.try-it-checks div {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid #324256;
  border-radius: 6px;
  background: #1f2937;
  color: #dbe7ef;
}

.try-it-checks span {
  min-width: 34px;
  color: #ffb4a8;
  font-weight: 900;
}

.try-it-checks .passed span {
  color: #b6e46d;
}

.try-it-preview {
  width: 100%;
  min-height: 300px;
  border: 1px solid #324256;
  border-radius: 8px;
  background: #fff;
}

.try-it-checks small {
  display: block;
  margin-top: 4px;
  color: #9fb3c5;
  font-size: 12px;
}

.office-sheet-wrap {
  overflow-x: auto;
  border: 1px solid #324256;
  border-radius: 8px;
  background: #0b1220;
}

.office-sheet {
  min-width: 820px;
  border-collapse: collapse;
}

.office-sheet th {
  background: #1f2937;
  color: #cbd5e1;
  text-align: center;
}

.office-sheet td {
  padding: 0;
  background: #0b1220;
}

.office-sheet td.selected-formula {
  background: #0d3b49;
  box-shadow: inset 0 0 0 2px #16a9c7;
}

.excel-cell {
  position: relative;
}

.office-sheet input {
  min-height: 44px;
  border: 0;
  border-radius: 0;
  background: #0f172a;
  color: #e5edf5;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

.office-sheet td.selected-formula input,
.office-sheet input:focus {
  background: #123143;
  outline: 2px solid #16a9c7;
  outline-offset: -2px;
}

.fill-handle {
  position: absolute;
  right: 3px;
  bottom: 3px;
  width: 11px;
  height: 11px;
  min-height: 0;
  padding: 0;
  border: 1px solid #dff8ff;
  border-radius: 2px;
  background: #16a9c7;
  cursor: ns-resize;
}

.fill-handle[hidden] {
  display: none;
}

.formula-result {
  display: none;
  padding: 5px 10px;
  border-top: 1px solid #26364b;
  background: #111c2c;
  color: #6ee7f7;
  font-size: 12px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

.excel-cell.has-formula .formula-result {
  display: block;
}

.small {
  font-size: 13px;
}

.word-practice-grid {
  display: grid;
  gap: 16px;
}

.word-toolbar {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  padding: 12px;
  border: 1px solid #324256;
  border-radius: 8px;
  background: #0b1220;
}

.word-toolbar button.active {
  border-color: #b6e46d;
  color: #527500;
  background: #eef8d8;
}

.word-paper {
  display: grid;
  gap: 14px;
  padding: 20px;
  border: 1px solid #324256;
  border-radius: 8px;
  background: #f8fbfd;
  color: var(--ink);
}

.word-paper label {
  color: var(--ink);
}

.passport-questions {
  display: grid;
  gap: 16px;
}

.passport-question {
  border: 1px solid #324256;
  border-radius: 8px;
  padding: 16px;
  background: #0b1220;
}

.passport-question legend {
  padding: 0 4px;
  font-weight: 800;
}

.passport-question.passed {
  border-color: #b6e46d;
}

.passport-question.failed {
  border-color: #ffb4a8;
}

.choice {
  display: flex;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 10px;
  margin-top: 10px;
  padding: 10px;
  border: 1px solid #324256;
  border-radius: 8px;
  background: #111827;
  font-size: 14px;
}

.choice input {
  width: auto;
  min-height: auto;
}

.lesson-nav {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 12px;
  align-items: stretch;
  margin: 16px 0;
}

.lesson-nav-link,
.lesson-nav-index {
  display: grid;
  align-content: center;
  min-height: 64px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--white);
  color: var(--ink);
}

.lesson-nav-link span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.lesson-nav-link.next {
  text-align: right;
}

.lesson-nav-index {
  justify-content: center;
  color: var(--blue);
  font-weight: 800;
}

.lesson-nav-link.disabled {
  opacity: 0.45;
  pointer-events: none;
}

@media (max-width: 760px) {
  .topbar {
    align-items: flex-start;
    flex-direction: column;
    padding: 14px 16px;
  }

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

  .link-resource,
  .file-resource {
    align-items: flex-start;
    flex-direction: column;
  }

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

  .try-it-header {
    flex-direction: column;
  }

  .try-it-grid {
    grid-template-columns: 1fr;
  }

  .lesson-nav {
    grid-template-columns: 1fr;
  }

  .lesson-nav-link.next {
    text-align: left;
  }

  table {
    display: block;
    overflow-x: auto;
    white-space: nowrap;
  }
}
