/*
  System Design Academy
  A dependency-free, responsive learning application.
*/

:root {
  color-scheme: light;
  --bg: #f6f7fb;
  --surface: #ffffff;
  --surface-soft: #f0f2f9;
  --surface-strong: #e8ebf5;
  --text: #171a2b;
  --text-soft: #5f6478;
  --text-faint: #858a9d;
  --border: #dfe2ec;
  --border-strong: #cbd0df;
  --primary: #5b5ce2;
  --primary-strong: #4546c9;
  --primary-soft: #ececff;
  --secondary: #009f93;
  --secondary-soft: #e2f7f4;
  --accent: #ef7a36;
  --accent-soft: #fff0e7;
  --success: #18864b;
  --success-soft: #e7f7ed;
  --warning: #a96208;
  --warning-soft: #fff4d8;
  --danger: #c73b4b;
  --danger-soft: #fdebed;
  --info: #2b6db8;
  --info-soft: #e8f2ff;
  --shadow-xs: 0 1px 2px rgb(28 31 45 / 5%);
  --shadow-sm: 0 5px 18px rgb(28 31 45 / 8%);
  --shadow-md: 0 16px 40px rgb(28 31 45 / 12%);
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-xl: 28px;
  --topbar-height: 70px;
  --sidebar-width: 300px;
  --content-max: 1180px;
  --font-sans: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-mono: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
}

html[data-theme="dark"] {
  color-scheme: dark;
  --bg: #11131b;
  --surface: #191c27;
  --surface-soft: #222634;
  --surface-strong: #2a2f40;
  --text: #f4f5fb;
  --text-soft: #b0b6c8;
  --text-faint: #858da2;
  --border: #303646;
  --border-strong: #41495e;
  --primary: #8d8eff;
  --primary-strong: #abacff;
  --primary-soft: #292a50;
  --secondary: #41cdbf;
  --secondary-soft: #183d3a;
  --accent: #ff9b5f;
  --accent-soft: #4a2c1f;
  --success: #5bd68b;
  --success-soft: #193d2a;
  --warning: #f5bd57;
  --warning-soft: #49391e;
  --danger: #ff7d8d;
  --danger-soft: #4a232b;
  --info: #70aff3;
  --info-soft: #1b3550;
  --shadow-xs: 0 1px 2px rgb(0 0 0 / 18%);
  --shadow-sm: 0 8px 24px rgb(0 0 0 / 20%);
  --shadow-md: 0 18px 50px rgb(0 0 0 / 32%);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-width: 320px;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

button,
input,
textarea,
select {
  color: inherit;
  font: inherit;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

button {
  border: 0;
}

a {
  color: var(--primary-strong);
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}

a:hover {
  text-decoration-thickness: 2px;
}

img,
svg {
  display: block;
  max-width: 100%;
}

h1,
h2,
h3,
h4,
p,
ul,
ol,
blockquote,
figure {
  margin-top: 0;
}

h1,
h2,
h3,
h4 {
  line-height: 1.18;
  letter-spacing: -0.025em;
}

h1 {
  font-size: clamp(2rem, 4vw, 3.25rem);
}

h2 {
  font-size: clamp(1.45rem, 2.4vw, 2rem);
}

h3 {
  font-size: 1.2rem;
}

code,
pre,
kbd {
  font-family: var(--font-mono);
}

code {
  border-radius: 5px;
  background: var(--surface-soft);
  padding: 0.12rem 0.36rem;
  font-size: 0.9em;
}

pre {
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: #151827;
  color: #eef0ff;
  padding: 1rem 1.1rem;
  line-height: 1.55;
  white-space: pre-wrap;
}

kbd {
  border: 1px solid var(--border-strong);
  border-bottom-width: 2px;
  border-radius: 5px;
  background: var(--surface);
  color: var(--text-soft);
  padding: 0.08rem 0.35rem;
  font-size: 0.72rem;
}

::selection {
  background: var(--primary);
  color: #fff;
}

:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--primary) 45%, transparent);
  outline-offset: 2px;
}

.sr-only {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
}

.skip-link {
  position: fixed;
  z-index: 2000;
  top: 10px;
  left: 10px;
  transform: translateY(-160%);
  border-radius: var(--radius-sm);
  background: var(--text);
  color: var(--surface);
  padding: 0.7rem 1rem;
  font-weight: 700;
  text-decoration: none;
}

.skip-link:focus {
  transform: translateY(0);
}

.app-shell {
  min-height: 100vh;
}

.topbar {
  position: fixed;
  z-index: 800;
  inset: 0 0 auto;
  display: grid;
  grid-template-columns: minmax(230px, 1fr) auto minmax(150px, 1fr);
  align-items: center;
  height: var(--topbar-height);
  border-bottom: 1px solid var(--border);
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  padding: 0 1.25rem;
  backdrop-filter: blur(16px);
}

.topbar__left,
.topbar__actions,
.brand {
  display: flex;
  align-items: center;
}

.topbar__left {
  gap: 0.65rem;
}

.topbar__actions {
  justify-content: flex-end;
  gap: 0.4rem;
}

.brand {
  gap: 0.7rem;
  color: var(--text);
  text-decoration: none;
}

.brand:hover {
  text-decoration: none;
}

.brand__mark {
  display: grid;
  width: 40px;
  height: 40px;
  place-items: center;
  border-radius: 12px;
  background: linear-gradient(145deg, var(--primary), #7b63f0);
  box-shadow: 0 8px 18px color-mix(in srgb, var(--primary) 24%, transparent);
}

.brand__mark svg {
  width: 26px;
  height: 26px;
  fill: white;
  stroke: white;
  stroke-width: 2.4;
  stroke-linecap: round;
}

.brand__text {
  display: grid;
  line-height: 1.05;
}

.brand__text strong {
  font-size: 0.96rem;
  letter-spacing: -0.02em;
}

.brand__text small {
  margin-top: 0.2rem;
  color: var(--text-soft);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.13em;
  text-transform: uppercase;
}

.topnav {
  display: flex;
  align-items: center;
  gap: 0.2rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface-soft);
  padding: 0.25rem;
}

.topnav a {
  border-radius: 999px;
  color: var(--text-soft);
  padding: 0.42rem 0.7rem;
  font-size: 0.78rem;
  font-weight: 700;
  text-decoration: none;
  transition: background 160ms ease, color 160ms ease, box-shadow 160ms ease;
}

.topnav a:hover {
  color: var(--text);
  text-decoration: none;
}

.topnav a[aria-current="page"] {
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow-xs);
}

.icon-button {
  display: inline-grid;
  width: 40px;
  height: 40px;
  place-items: center;
  border: 1px solid transparent;
  border-radius: 11px;
  background: transparent;
  color: var(--text-soft);
  cursor: pointer;
  font-size: 1.28rem;
  transition: border-color 150ms ease, background 150ms ease, color 150ms ease, transform 150ms ease;
}

.icon-button:hover {
  border-color: var(--border);
  background: var(--surface-soft);
  color: var(--text);
}

.icon-button:active {
  transform: scale(0.96);
}

.workspace {
  display: grid;
  grid-template-columns: var(--sidebar-width) minmax(0, 1fr);
  min-height: 100vh;
  padding-top: var(--topbar-height);
}

.sidebar {
  position: fixed;
  z-index: 700;
  top: var(--topbar-height);
  bottom: 0;
  left: 0;
  width: var(--sidebar-width);
  overflow-y: auto;
  border-right: 1px solid var(--border);
  background: var(--surface);
  padding: 1rem 0.85rem 1.5rem;
  scrollbar-width: thin;
}

.sidebar__search,
.dialog-search {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--bg);
  padding: 0 0.7rem;
}

.sidebar__search:focus-within,
.dialog-search:focus-within {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 16%, transparent);
}

.sidebar__search input,
.dialog-search input {
  width: 100%;
  border: 0;
  outline: 0;
  background: transparent;
}

.sidebar__search input {
  height: 42px;
  font-size: 0.86rem;
}

.sidebar__progress {
  margin: 1rem 0 0.65rem;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, var(--primary-soft), color-mix(in srgb, var(--secondary-soft) 55%, var(--surface)));
  padding: 0.9rem;
}

.sidebar__progress > div:first-child {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 0.75rem;
}

.sidebar__progress strong {
  font-size: 0.75rem;
  white-space: nowrap;
}

.eyebrow {
  display: block;
  color: var(--text-soft);
  font-size: 0.67rem;
  font-weight: 800;
  letter-spacing: 0.11em;
  text-transform: uppercase;
}

.mini-progress,
.progress-track {
  overflow: hidden;
  border-radius: 999px;
  background: color-mix(in srgb, var(--text) 10%, transparent);
}

.mini-progress {
  height: 6px;
  margin-top: 0.65rem;
}

.mini-progress span,
.progress-track span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--primary), var(--secondary));
  transition: width 300ms ease;
}

.curriculum-nav {
  display: grid;
  gap: 0.35rem;
}

.curriculum-group {
  border-bottom: 1px solid var(--border);
  padding-bottom: 0.35rem;
}

.curriculum-group:last-child {
  border-bottom: 0;
}

.curriculum-group__toggle {
  display: flex;
  width: 100%;
  align-items: center;
  justify-content: space-between;
  border-radius: 9px;
  background: transparent;
  color: var(--text-soft);
  padding: 0.7rem 0.55rem;
  cursor: pointer;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.curriculum-group__toggle:hover {
  background: var(--surface-soft);
  color: var(--text);
}

.curriculum-group__toggle .chevron {
  transition: transform 180ms ease;
}

.curriculum-group__toggle[aria-expanded="false"] .chevron {
  transform: rotate(-90deg);
}

.curriculum-group__list {
  display: grid;
  gap: 0.14rem;
}

.curriculum-group__list[hidden] {
  display: none;
}

.lesson-nav-link {
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr) auto;
  align-items: center;
  gap: 0.45rem;
  border-radius: 9px;
  color: var(--text-soft);
  padding: 0.52rem 0.48rem;
  font-size: 0.82rem;
  text-decoration: none;
}

.lesson-nav-link:hover {
  background: var(--surface-soft);
  color: var(--text);
  text-decoration: none;
}

.lesson-nav-link[aria-current="page"] {
  background: var(--primary-soft);
  color: var(--primary-strong);
  font-weight: 700;
}

.lesson-nav-link__status {
  display: grid;
  width: 18px;
  height: 18px;
  place-items: center;
  border: 1px solid var(--border-strong);
  border-radius: 50%;
  color: transparent;
  font-size: 0.65rem;
}

.lesson-nav-link.is-complete .lesson-nav-link__status {
  border-color: var(--success);
  background: var(--success);
  color: white;
}

.lesson-nav-link__number {
  color: var(--text-faint);
  font-size: 0.68rem;
}

.sidebar__footer {
  display: grid;
  gap: 0.25rem;
  margin-top: 0.9rem;
  border-top: 1px solid var(--border);
  padding-top: 0.8rem;
}

.sidebar-link {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  border-radius: 9px;
  background: transparent;
  color: var(--text-soft);
  padding: 0.6rem;
  cursor: pointer;
  font-size: 0.8rem;
  text-align: left;
}

.sidebar-link:hover {
  background: var(--surface-soft);
  color: var(--text);
}

.count-badge {
  margin-left: auto;
  border-radius: 999px;
  background: var(--surface-strong);
  padding: 0.08rem 0.4rem;
  font-size: 0.68rem;
  font-weight: 800;
}

.main-content {
  grid-column: 2;
  min-width: 0;
  min-height: calc(100vh - var(--topbar-height));
  padding: 2rem clamp(1rem, 3.5vw, 3.2rem) 4rem;
}

.content-wrap {
  width: min(100%, var(--content-max));
  margin: 0 auto;
}

.content-wrap--narrow {
  width: min(100%, 920px);
}

.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1.5rem;
  margin-bottom: 1.6rem;
}

.page-header h1 {
  margin-bottom: 0.45rem;
}

.page-header p {
  max-width: 720px;
  margin-bottom: 0;
  color: var(--text-soft);
  font-size: 1.03rem;
}

.page-header__actions {
  display: flex;
  flex: 0 0 auto;
  gap: 0.55rem;
}

.button {
  display: inline-flex;
  min-height: 42px;
  align-items: center;
  justify-content: center;
  gap: 0.48rem;
  border: 1px solid transparent;
  border-radius: 10px;
  padding: 0.58rem 0.9rem;
  cursor: pointer;
  font-size: 0.82rem;
  font-weight: 800;
  line-height: 1.2;
  text-decoration: none;
  transition: transform 140ms ease, background 140ms ease, border-color 140ms ease, box-shadow 140ms ease;
}

.button:hover {
  text-decoration: none;
  transform: translateY(-1px);
}

.button:active {
  transform: translateY(0);
}

.button--primary {
  background: var(--primary);
  color: white;
  box-shadow: 0 8px 18px color-mix(in srgb, var(--primary) 22%, transparent);
}

.button--primary:hover {
  background: var(--primary-strong);
}

.button--secondary {
  border-color: color-mix(in srgb, var(--secondary) 35%, var(--border));
  background: var(--secondary-soft);
  color: color-mix(in srgb, var(--secondary) 72%, var(--text));
}

.button--ghost {
  border-color: var(--border);
  background: var(--surface);
  color: var(--text-soft);
}

.button--ghost:hover {
  border-color: var(--border-strong);
  color: var(--text);
}

.button--danger {
  border-color: color-mix(in srgb, var(--danger) 28%, var(--border));
  background: var(--danger-soft);
  color: var(--danger);
}

.button--small {
  min-height: 34px;
  padding: 0.4rem 0.65rem;
  font-size: 0.74rem;
}

.button[disabled],
.button[aria-disabled="true"] {
  opacity: 0.52;
  cursor: not-allowed;
  transform: none;
}

.hero {
  position: relative;
  overflow: hidden;
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(280px, 0.8fr);
  gap: 1.5rem;
  min-height: 330px;
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  background:
    radial-gradient(circle at 87% 12%, color-mix(in srgb, var(--secondary) 20%, transparent), transparent 30%),
    radial-gradient(circle at 8% 100%, color-mix(in srgb, var(--primary) 18%, transparent), transparent 34%),
    var(--surface);
  padding: clamp(1.4rem, 3.5vw, 2.8rem);
  box-shadow: var(--shadow-sm);
}

.hero::after {
  content: "";
  position: absolute;
  right: -70px;
  bottom: -100px;
  width: 280px;
  height: 280px;
  border: 1px solid color-mix(in srgb, var(--primary) 23%, transparent);
  border-radius: 50%;
  box-shadow: 0 0 0 35px color-mix(in srgb, var(--primary) 4%, transparent), 0 0 0 70px color-mix(in srgb, var(--primary) 3%, transparent);
}

.hero__content {
  position: relative;
  z-index: 2;
  align-self: center;
}

.hero__content h1 {
  max-width: 750px;
  margin: 0.35rem 0 0.8rem;
}

.hero__content p {
  max-width: 650px;
  color: var(--text-soft);
  font-size: 1.05rem;
}

.hero__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  margin-top: 1.2rem;
}

.hero__visual {
  position: relative;
  z-index: 2;
  display: grid;
  align-content: center;
  gap: 0.65rem;
}

.hero-flow {
  display: grid;
  grid-template-columns: 1fr 42px 1fr;
  align-items: center;
  gap: 0.3rem;
}

.hero-flow__node {
  border: 1px solid var(--border);
  border-radius: 14px;
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  padding: 0.85rem;
  box-shadow: var(--shadow-xs);
}

.hero-flow__node strong,
.hero-flow__node small {
  display: block;
}

.hero-flow__node small {
  color: var(--text-soft);
}

.hero-flow__arrow {
  position: relative;
  height: 2px;
  background: var(--border-strong);
}

.hero-flow__arrow::after {
  content: "";
  position: absolute;
  top: -4px;
  right: 0;
  border-width: 5px 0 5px 7px;
  border-style: solid;
  border-color: transparent transparent transparent var(--border-strong);
}

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

.hero-flow--wide .hero-flow__node {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.dashboard-grid,
.stat-grid,
.card-grid,
.skill-grid,
.calculator-grid,
.practice-grid,
.project-grid {
  display: grid;
  gap: 1rem;
}

.dashboard-grid {
  grid-template-columns: minmax(0, 1.3fr) minmax(300px, 0.7fr);
  margin-top: 1rem;
}

.stat-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin-top: 1rem;
}

.card,
.stat-card,
.panel {
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow-xs);
}

.card,
.panel {
  padding: 1.2rem;
}

.card--interactive {
  transition: transform 160ms ease, box-shadow 160ms ease, border-color 160ms ease;
}

.card--interactive:hover {
  transform: translateY(-3px);
  border-color: color-mix(in srgb, var(--primary) 30%, var(--border));
  box-shadow: var(--shadow-sm);
}

.stat-card {
  position: relative;
  overflow: hidden;
  min-height: 132px;
  padding: 1.05rem;
}

.stat-card__icon {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  border-radius: 11px;
  background: var(--primary-soft);
  color: var(--primary-strong);
  font-size: 1.1rem;
}

.stat-card strong {
  display: block;
  margin-top: 0.65rem;
  font-size: 1.65rem;
  letter-spacing: -0.04em;
  line-height: 1;
}

.stat-card span:last-child {
  display: block;
  margin-top: 0.28rem;
  color: var(--text-soft);
  font-size: 0.78rem;
}

.panel__header,
.section-heading,
.card__header,
.lesson-footer,
.project-card__footer,
.quiz-header,
.toolbar,
.playground-status,
.score-row,
.timer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.panel__header,
.section-heading {
  margin-bottom: 1rem;
}

.panel__header h2,
.panel__header h3,
.section-heading h2,
.section-heading h3 {
  margin-bottom: 0;
}

.panel__header p,
.section-heading p {
  margin-bottom: 0;
  color: var(--text-soft);
}

.section-heading {
  margin-top: 2rem;
}

.progress-ring {
  position: relative;
  display: grid;
  width: 112px;
  height: 112px;
  flex: 0 0 112px;
  place-items: center;
}

.progress-ring svg {
  transform: rotate(-90deg);
}

.progress-ring circle {
  fill: none;
  stroke-width: 10;
}

.progress-ring__track {
  stroke: var(--surface-strong);
}

.progress-ring__value {
  stroke: var(--primary);
  stroke-linecap: round;
  transition: stroke-dashoffset 400ms ease;
}

.progress-ring__label {
  position: absolute;
  display: grid;
  text-align: center;
}

.progress-ring__label strong {
  font-size: 1.45rem;
  line-height: 1;
}

.progress-ring__label span {
  margin-top: 0.2rem;
  color: var(--text-soft);
  font-size: 0.66rem;
  font-weight: 700;
  text-transform: uppercase;
}

.continue-card {
  display: flex;
  align-items: center;
  gap: 1.2rem;
}

.continue-card__content {
  flex: 1;
}

.continue-card__content h3 {
  margin: 0.3rem 0 0.4rem;
}

.continue-card__content p {
  margin-bottom: 0.8rem;
  color: var(--text-soft);
}

.skill-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.skill-row {
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 0.85rem;
}

.skill-row__top {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.48rem;
  font-size: 0.8rem;
}

.skill-row__top span:last-child {
  color: var(--text-soft);
  font-weight: 700;
}

.progress-track {
  height: 7px;
}

.activity-list,
.simple-list,
.check-list,
.feature-list,
.toc-list,
.project-section-list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.activity-list {
  display: grid;
  gap: 0.65rem;
}

.activity-item {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) auto;
  align-items: center;
  gap: 0.7rem;
  border-bottom: 1px solid var(--border);
  padding-bottom: 0.65rem;
}

.activity-item:last-child {
  border-bottom: 0;
  padding-bottom: 0;
}

.activity-item__icon {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border-radius: 10px;
  background: var(--surface-soft);
}

.activity-item strong,
.activity-item span {
  display: block;
}

.activity-item span,
.activity-item time {
  color: var(--text-soft);
  font-size: 0.75rem;
}

.level-tabs,
.filter-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
}

.level-tabs {
  margin-bottom: 1rem;
}

.pill,
.badge,
.level-badge,
.tag {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  font-weight: 800;
  line-height: 1;
}

.pill {
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-soft);
  padding: 0.52rem 0.78rem;
  cursor: pointer;
  font-size: 0.75rem;
}

.pill:hover,
.pill.is-active {
  border-color: color-mix(in srgb, var(--primary) 42%, var(--border));
  background: var(--primary-soft);
  color: var(--primary-strong);
}

.badge,
.level-badge,
.tag {
  padding: 0.32rem 0.55rem;
  font-size: 0.66rem;
  letter-spacing: 0.02em;
}

.badge {
  background: var(--surface-soft);
  color: var(--text-soft);
}

.level-badge[data-level="Beginner"] {
  background: var(--success-soft);
  color: var(--success);
}

.level-badge[data-level="Intermediate"] {
  background: var(--warning-soft);
  color: var(--warning);
}

.level-badge[data-level="Advanced"] {
  background: var(--danger-soft);
  color: var(--danger);
}

.tag {
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-soft);
}

.card-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.lesson-card,
.project-card {
  display: flex;
  min-height: 260px;
  flex-direction: column;
}

.lesson-card__icon,
.project-card__icon {
  display: grid;
  width: 46px;
  height: 46px;
  place-items: center;
  border-radius: 14px;
  background: var(--primary-soft);
  color: var(--primary-strong);
  font-size: 1.35rem;
}

.lesson-card h3,
.project-card h3 {
  margin: 0.9rem 0 0.45rem;
}

.lesson-card p,
.project-card p {
  color: var(--text-soft);
  font-size: 0.86rem;
}

.lesson-card__footer,
.project-card__footer {
  margin-top: auto;
  border-top: 1px solid var(--border);
  padding-top: 0.8rem;
}

.lesson-card__meta,
.project-card__meta,
.lesson-meta,
.tag-list {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.45rem;
}

.lesson-card__meta,
.project-card__meta,
.lesson-meta {
  color: var(--text-soft);
  font-size: 0.74rem;
}

.empty-state {
  grid-column: 1 / -1;
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius-lg);
  background: var(--surface);
  padding: 2.2rem;
  text-align: center;
}

.empty-state__icon {
  display: grid;
  width: 58px;
  height: 58px;
  margin: 0 auto 0.8rem;
  place-items: center;
  border-radius: 18px;
  background: var(--surface-soft);
  font-size: 1.5rem;
}

.empty-state p {
  max-width: 540px;
  margin-right: auto;
  margin-left: auto;
  color: var(--text-soft);
}

.lesson-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 250px;
  gap: 2.2rem;
  align-items: start;
}

.lesson-main {
  min-width: 0;
}

.lesson-header {
  margin-bottom: 1.4rem;
}

.breadcrumbs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.38rem;
  margin-bottom: 0.8rem;
  color: var(--text-soft);
  font-size: 0.76rem;
}

.breadcrumbs a {
  color: inherit;
  text-decoration: none;
}

.breadcrumbs a:hover {
  color: var(--primary-strong);
}

.lesson-title-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
}

.lesson-title-row h1 {
  margin-bottom: 0.6rem;
}

.bookmark-button {
  flex: 0 0 auto;
}

.bookmark-button.is-bookmarked {
  border-color: color-mix(in srgb, var(--warning) 35%, var(--border));
  background: var(--warning-soft);
  color: var(--warning);
}

.lesson-lead {
  max-width: 800px;
  color: var(--text-soft);
  font-size: 1.08rem;
}

.learning-objectives {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.55rem;
  margin: 1.2rem 0;
  border: 1px solid color-mix(in srgb, var(--primary) 20%, var(--border));
  border-radius: var(--radius-lg);
  background: var(--primary-soft);
  padding: 1rem;
}

.learning-objectives h2 {
  grid-column: 1 / -1;
  margin: 0 0 0.35rem;
  font-size: 0.82rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.objective-item {
  display: flex;
  gap: 0.5rem;
  color: color-mix(in srgb, var(--text) 82%, var(--primary));
  font-size: 0.85rem;
}

.objective-item span:first-child {
  color: var(--success);
  font-weight: 900;
}

.lesson-section {
  scroll-margin-top: calc(var(--topbar-height) + 20px);
  margin: 1.6rem 0;
}

.lesson-section h2 {
  margin-bottom: 0.75rem;
}

.lesson-section h3 {
  margin-top: 1.2rem;
}

.lesson-section p,
.lesson-section li {
  color: color-mix(in srgb, var(--text) 88%, var(--text-soft));
}

.lesson-section ul,
.lesson-section ol {
  padding-left: 1.25rem;
}

.lesson-section li + li {
  margin-top: 0.35rem;
}

.analogy-card,
.callout,
.exercise-card,
.quiz-card,
.interview-note {
  border-radius: var(--radius-lg);
  padding: 1.1rem;
}

.analogy-card {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr);
  gap: 0.8rem;
  border: 1px solid color-mix(in srgb, var(--accent) 22%, var(--border));
  background: var(--accent-soft);
}

.analogy-card__icon {
  display: grid;
  width: 44px;
  height: 44px;
  place-items: center;
  border-radius: 13px;
  background: color-mix(in srgb, var(--accent) 18%, var(--surface));
  font-size: 1.3rem;
}

.analogy-card h2,
.analogy-card h3 {
  margin-bottom: 0.3rem;
}

.analogy-card p:last-child {
  margin-bottom: 0;
}

.callout {
  margin: 1rem 0;
  border-left: 4px solid var(--info);
  background: var(--info-soft);
}

.callout--warning {
  border-left-color: var(--warning);
  background: var(--warning-soft);
}

.callout--success {
  border-left-color: var(--success);
  background: var(--success-soft);
}

.callout strong {
  display: block;
  margin-bottom: 0.25rem;
}

.callout p:last-child {
  margin-bottom: 0;
}

.architecture-diagram {
  overflow-x: auto;
  margin: 1rem 0;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background:
    linear-gradient(var(--border) 1px, transparent 1px),
    linear-gradient(90deg, var(--border) 1px, transparent 1px),
    var(--surface);
  background-size: 24px 24px;
  padding: 1.1rem;
}

.architecture-flow {
  display: flex;
  min-width: max-content;
  align-items: center;
  justify-content: center;
  gap: 0.55rem;
  padding: 0.8rem;
}

.architecture-node {
  min-width: 135px;
  max-width: 190px;
  border: 1px solid var(--border-strong);
  border-radius: 13px;
  background: var(--surface);
  padding: 0.75rem;
  text-align: center;
  box-shadow: var(--shadow-xs);
}

.architecture-node__icon {
  display: grid;
  width: 34px;
  height: 34px;
  margin: 0 auto 0.45rem;
  place-items: center;
  border-radius: 10px;
  background: var(--primary-soft);
  font-size: 1rem;
}

.architecture-node strong,
.architecture-node small {
  display: block;
}

.architecture-node small {
  margin-top: 0.15rem;
  color: var(--text-soft);
  font-size: 0.68rem;
}

.architecture-arrow {
  position: relative;
  width: 38px;
  height: 2px;
  flex: 0 0 38px;
  background: var(--primary);
}

.architecture-arrow::after {
  content: "";
  position: absolute;
  top: -4px;
  right: -1px;
  border-width: 5px 0 5px 8px;
  border-style: solid;
  border-color: transparent transparent transparent var(--primary);
}

.tradeoff-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.8rem;
}

.tradeoff-card {
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface);
  padding: 0.9rem;
}

.tradeoff-card h3 {
  margin: 0 0 0.5rem;
  font-size: 0.95rem;
}

.tradeoff-card p {
  margin-bottom: 0;
  font-size: 0.84rem;
}

.check-list {
  display: grid;
  gap: 0.55rem;
}

.check-list li {
  display: flex;
  gap: 0.55rem;
}

.check-list li::before {
  content: "✓";
  color: var(--success);
  font-weight: 900;
}

.exercise-card {
  margin: 1.4rem 0;
  border: 1px solid color-mix(in srgb, var(--secondary) 28%, var(--border));
  background: var(--secondary-soft);
}

.exercise-card__header {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  margin-bottom: 0.7rem;
}

.exercise-card__header span:first-child {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  border-radius: 11px;
  background: color-mix(in srgb, var(--secondary) 18%, var(--surface));
}

.exercise-card h2,
.exercise-card h3 {
  margin-bottom: 0;
}

.exercise-answer {
  margin-top: 0.8rem;
  border-top: 1px solid color-mix(in srgb, var(--secondary) 26%, var(--border));
  padding-top: 0.8rem;
}

.exercise-answer[hidden] {
  display: none;
}

.quiz-card {
  margin: 1.4rem 0;
  border: 1px solid var(--border);
  background: var(--surface);
  box-shadow: var(--shadow-xs);
}

.quiz-header {
  margin-bottom: 0.8rem;
}

.quiz-header h2,
.quiz-header h3 {
  margin-bottom: 0;
}

.quiz-options {
  display: grid;
  gap: 0.55rem;
}

.quiz-option {
  display: grid;
  grid-template-columns: 26px minmax(0, 1fr);
  align-items: center;
  gap: 0.7rem;
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 11px;
  background: var(--surface);
  padding: 0.72rem;
  cursor: pointer;
  text-align: left;
}

.quiz-option:hover {
  border-color: var(--primary);
  background: var(--primary-soft);
}

.quiz-option__letter {
  display: grid;
  width: 26px;
  height: 26px;
  place-items: center;
  border-radius: 8px;
  background: var(--surface-soft);
  color: var(--text-soft);
  font-size: 0.72rem;
  font-weight: 900;
}

.quiz-option.is-correct {
  border-color: var(--success);
  background: var(--success-soft);
}

.quiz-option.is-incorrect {
  border-color: var(--danger);
  background: var(--danger-soft);
}

.quiz-option[disabled] {
  cursor: default;
}

.quiz-feedback {
  margin-top: 0.75rem;
  border-radius: 10px;
  padding: 0.75rem;
  font-size: 0.85rem;
}

.quiz-feedback--correct {
  background: var(--success-soft);
  color: color-mix(in srgb, var(--success) 76%, var(--text));
}

.quiz-feedback--incorrect {
  background: var(--danger-soft);
  color: color-mix(in srgb, var(--danger) 76%, var(--text));
}

.lesson-toc {
  position: sticky;
  top: calc(var(--topbar-height) + 1.5rem);
  border-left: 1px solid var(--border);
  padding-left: 1rem;
}

.lesson-toc h2 {
  margin-bottom: 0.7rem;
  color: var(--text-soft);
  font-size: 0.72rem;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

.toc-list {
  display: grid;
  gap: 0.45rem;
}

.toc-list a {
  color: var(--text-soft);
  font-size: 0.78rem;
  text-decoration: none;
}

.toc-list a:hover,
.toc-list a.is-active {
  color: var(--primary-strong);
}

.lesson-footer {
  margin-top: 2.2rem;
  border-top: 1px solid var(--border);
  padding-top: 1.2rem;
}

.lesson-nav-button {
  display: grid;
  max-width: 42%;
  gap: 0.12rem;
}

.lesson-nav-button span {
  color: var(--text-soft);
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
}

.lesson-nav-button strong {
  font-size: 0.82rem;
}

.project-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.project-card {
  min-height: 330px;
}

.project-card__progress {
  margin: 0.4rem 0 0.8rem;
}

.project-detail-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 260px;
  gap: 1.6rem;
  align-items: start;
}

.project-content section {
  scroll-margin-top: calc(var(--topbar-height) + 20px);
  margin-bottom: 1.4rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
  padding: 1.15rem;
}

.project-content section h2 {
  margin-bottom: 0.8rem;
  font-size: 1.25rem;
}

.project-content section p:last-child,
.project-content section ul:last-child {
  margin-bottom: 0;
}

.project-sidebar {
  position: sticky;
  top: calc(var(--topbar-height) + 1.3rem);
  display: grid;
  gap: 0.9rem;
}

.project-section-list {
  display: grid;
  gap: 0.35rem;
}

.project-section-list a {
  color: var(--text-soft);
  font-size: 0.76rem;
  text-decoration: none;
}

.project-section-list a:hover {
  color: var(--primary-strong);
}

.data-table-wrap {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.82rem;
}

.data-table th,
.data-table td {
  border-bottom: 1px solid var(--border);
  padding: 0.75rem;
  text-align: left;
  vertical-align: top;
}

.data-table th {
  background: var(--surface-soft);
  color: var(--text-soft);
  font-size: 0.7rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.data-table tr:last-child td {
  border-bottom: 0;
}

.practice-grid {
  grid-template-columns: minmax(0, 1.15fr) minmax(300px, 0.85fr);
}

.scenario-card {
  min-height: 510px;
}

.scenario-context {
  border-left: 4px solid var(--primary);
  background: var(--primary-soft);
  padding: 0.85rem;
}

.scenario-options {
  display: grid;
  gap: 0.65rem;
  margin-top: 1rem;
}

.scenario-option {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface);
  padding: 0.85rem;
  cursor: pointer;
  text-align: left;
}

.scenario-option:hover {
  border-color: var(--primary);
  background: var(--primary-soft);
}

.scenario-option.is-selected {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 13%, transparent);
}

.scenario-feedback {
  margin-top: 0.9rem;
  border-radius: var(--radius-md);
  padding: 0.9rem;
}

.scenario-feedback--good {
  background: var(--success-soft);
}

.scenario-feedback--mixed {
  background: var(--warning-soft);
}

.scenario-feedback--poor {
  background: var(--danger-soft);
}

.scenario-progress-list {
  display: grid;
  gap: 0.55rem;
}

.scenario-progress-item {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr) auto;
  align-items: center;
  gap: 0.55rem;
  border-radius: 10px;
  padding: 0.55rem;
}

.scenario-progress-item.is-current {
  background: var(--primary-soft);
}

.scenario-progress-item__number {
  display: grid;
  width: 28px;
  height: 28px;
  place-items: center;
  border-radius: 8px;
  background: var(--surface-soft);
  font-size: 0.72rem;
  font-weight: 800;
}

.scenario-progress-item.is-complete .scenario-progress-item__number {
  background: var(--success);
  color: white;
}

.calculator-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.calculator-card {
  display: flex;
  min-height: 420px;
  flex-direction: column;
}

.calculator-card__icon {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border-radius: 12px;
  background: var(--primary-soft);
  font-size: 1.15rem;
}

.calculator-card h2 {
  margin: 0.7rem 0 0.35rem;
  font-size: 1.2rem;
}

.calculator-card > p {
  color: var(--text-soft);
  font-size: 0.84rem;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.7rem;
}

.field {
  display: grid;
  gap: 0.35rem;
}

.field > span,
.field > label {
  color: var(--text-soft);
  font-size: 0.72rem;
  font-weight: 800;
}

.field input,
.field select,
.field textarea,
.notes-area {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 10px;
  outline: 0;
  background: var(--bg);
  padding: 0.65rem 0.7rem;
}

.field input:focus,
.field select:focus,
.field textarea:focus,
.notes-area:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 14%, transparent);
}

.field textarea,
.notes-area {
  resize: vertical;
}

.calculator-results {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.55rem;
  margin-top: auto;
  border-top: 1px solid var(--border);
  padding-top: 0.9rem;
}

.result-tile {
  border-radius: 11px;
  background: var(--surface-soft);
  padding: 0.7rem;
}

.result-tile strong,
.result-tile span {
  display: block;
}

.result-tile strong {
  font-size: 1.15rem;
  letter-spacing: -0.02em;
}

.result-tile span {
  margin-top: 0.18rem;
  color: var(--text-soft);
  font-size: 0.68rem;
}

.formula-note {
  margin: 0.75rem 0 0;
  color: var(--text-soft);
  font-size: 0.72rem;
}

.playground-shell {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr) 250px;
  min-height: 650px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow-xs);
}

.component-palette,
.inspector-panel {
  padding: 1rem;
}

.component-palette {
  border-right: 1px solid var(--border);
}

.inspector-panel {
  border-left: 1px solid var(--border);
}

.component-palette h2,
.inspector-panel h2 {
  margin-bottom: 0.3rem;
  font-size: 0.9rem;
}

.component-palette > p,
.inspector-panel > p {
  color: var(--text-soft);
  font-size: 0.73rem;
}

.palette-list {
  display: grid;
  gap: 0.45rem;
}

.palette-item {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  padding: 0.58rem;
  cursor: pointer;
  font-size: 0.76rem;
  font-weight: 700;
  text-align: left;
}

.palette-item:hover {
  border-color: var(--primary);
  background: var(--primary-soft);
}

.palette-item__icon {
  display: grid;
  width: 30px;
  height: 30px;
  place-items: center;
  border-radius: 8px;
  background: var(--surface-soft);
}

.canvas-column {
  display: grid;
  min-width: 0;
  grid-template-rows: auto minmax(0, 1fr) auto;
}

.toolbar {
  flex-wrap: wrap;
  border-bottom: 1px solid var(--border);
  padding: 0.65rem;
}

.toolbar__group {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.canvas-wrap {
  position: relative;
  overflow: auto;
  min-height: 540px;
  background:
    radial-gradient(circle, var(--border-strong) 1px, transparent 1.5px),
    var(--bg);
  background-size: 24px 24px;
}

.architecture-canvas {
  position: relative;
  width: 1200px;
  height: 760px;
  isolation: isolate;
}

.edge-layer {
  position: absolute;
  z-index: 1;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.edge-layer line,
.edge-layer path {
  stroke: var(--primary);
  stroke-width: 2.2;
  fill: none;
}

.edge-label {
  fill: var(--text-soft);
  font-family: var(--font-sans);
  font-size: 12px;
  paint-order: stroke;
  stroke: var(--bg);
  stroke-width: 5px;
  stroke-linejoin: round;
}

.canvas-node {
  position: absolute;
  z-index: 2;
  width: 150px;
  min-height: 76px;
  border: 2px solid var(--border-strong);
  border-radius: 14px;
  background: var(--surface);
  padding: 0.62rem;
  cursor: grab;
  user-select: none;
  box-shadow: var(--shadow-sm);
  touch-action: none;
}

.canvas-node:active {
  cursor: grabbing;
}

.canvas-node:hover,
.canvas-node.is-selected {
  border-color: var(--primary);
}

.canvas-node.is-connection-source {
  border-color: var(--secondary);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--secondary) 20%, transparent);
}

.canvas-node__top {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.canvas-node__icon {
  display: grid;
  width: 30px;
  height: 30px;
  flex: 0 0 30px;
  place-items: center;
  border-radius: 8px;
  background: var(--primary-soft);
}

.canvas-node strong {
  overflow: hidden;
  font-size: 0.78rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.canvas-node p {
  overflow: hidden;
  display: -webkit-box;
  margin: 0.42rem 0 0;
  color: var(--text-soft);
  font-size: 0.65rem;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.playground-status {
  border-top: 1px solid var(--border);
  padding: 0.55rem 0.75rem;
  color: var(--text-soft);
  font-size: 0.72rem;
}

.inspector-empty {
  display: grid;
  min-height: 270px;
  place-items: center;
  color: var(--text-soft);
  text-align: center;
}

.inspector-empty span {
  display: block;
  font-size: 2rem;
}

.inspector-details {
  display: grid;
  gap: 0.75rem;
}

.inspector-details__icon {
  display: grid;
  width: 48px;
  height: 48px;
  place-items: center;
  border-radius: 14px;
  background: var(--primary-soft);
  font-size: 1.35rem;
}

.inspector-details h3 {
  margin-bottom: 0.2rem;
}

.inspector-details p {
  color: var(--text-soft);
  font-size: 0.8rem;
}

.inspector-actions {
  display: grid;
  gap: 0.45rem;
}

.template-list {
  display: grid;
  gap: 0.45rem;
  margin-top: 0.9rem;
}

.template-button {
  border: 1px solid var(--border);
  border-radius: 9px;
  background: var(--surface);
  padding: 0.55rem;
  cursor: pointer;
  font-size: 0.72rem;
  font-weight: 700;
  text-align: left;
}

.template-button:hover {
  border-color: var(--primary);
  background: var(--primary-soft);
}

.interview-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(320px, 0.8fr);
  gap: 1rem;
}

.framework-timeline {
  display: grid;
  gap: 0.65rem;
  counter-reset: framework;
}

.framework-step {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr);
  gap: 0.75rem;
  counter-increment: framework;
}

.framework-step::before {
  content: counter(framework);
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border-radius: 12px;
  background: var(--primary-soft);
  color: var(--primary-strong);
  font-weight: 900;
}

.framework-step h3 {
  margin: 0 0 0.25rem;
  font-size: 0.95rem;
}

.framework-step p {
  margin-bottom: 0;
  color: var(--text-soft);
  font-size: 0.8rem;
}

.timer-card {
  position: sticky;
  top: calc(var(--topbar-height) + 1rem);
}

.timer-display {
  margin: 1rem 0;
  border-radius: var(--radius-lg);
  background: #171a2b;
  color: white;
  padding: 1.2rem;
  font-family: var(--font-mono);
  font-size: clamp(2.2rem, 7vw, 4rem);
  font-weight: 800;
  letter-spacing: -0.06em;
  text-align: center;
}

.timer-display.is-warning {
  color: #ffd166;
}

.timer-display.is-expired {
  color: #ff7d8d;
}

.timer-controls {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.45rem;
}

.mock-prompt {
  margin: 0.85rem 0;
  border-radius: var(--radius-md);
  background: var(--primary-soft);
  padding: 0.85rem;
}

.mock-prompt strong {
  display: block;
  margin-bottom: 0.25rem;
}

.hint-box {
  margin-top: 0.75rem;
  border-left: 4px solid var(--warning);
  background: var(--warning-soft);
  padding: 0.75rem;
}

.score-form {
  display: grid;
  gap: 0.65rem;
}

.score-row {
  border-bottom: 1px solid var(--border);
  padding-bottom: 0.55rem;
}

.score-row label {
  font-size: 0.78rem;
  font-weight: 700;
}

.score-row select {
  width: 84px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg);
  padding: 0.4rem;
}

.score-total {
  border-radius: var(--radius-md);
  background: var(--surface-soft);
  padding: 0.85rem;
  text-align: center;
}

.score-total strong {
  display: block;
  font-size: 2rem;
  line-height: 1;
}

.search-dialog,
.edit-dialog {
  width: min(calc(100% - 2rem), 720px);
  max-height: min(80vh, 780px);
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
  color: var(--text);
  padding: 0;
  box-shadow: var(--shadow-md);
}

.search-dialog::backdrop,
.edit-dialog::backdrop {
  background: rgb(10 12 20 / 56%);
  backdrop-filter: blur(4px);
}

.dialog-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  border-bottom: 1px solid var(--border);
  padding: 1rem 1.1rem;
}

.dialog-header h2 {
  margin: 0.15rem 0 0;
  font-size: 1.2rem;
}

.dialog-search {
  margin: 1rem;
}

.dialog-search input {
  height: 50px;
  font-size: 1rem;
}

.search-results {
  max-height: 58vh;
  overflow-y: auto;
  padding: 0 1rem 1rem;
}

.search-result {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) auto;
  align-items: center;
  gap: 0.75rem;
  border-bottom: 1px solid var(--border);
  color: var(--text);
  padding: 0.75rem 0;
  text-decoration: none;
}

.search-result:hover {
  color: var(--primary-strong);
  text-decoration: none;
}

.search-result__icon {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border-radius: 12px;
  background: var(--surface-soft);
}

.search-result strong,
.search-result small {
  display: block;
}

.search-result small {
  margin-top: 0.15rem;
  color: var(--text-soft);
}

.search-result mark {
  background: var(--warning-soft);
  color: inherit;
}

.edit-dialog form {
  padding-bottom: 1rem;
}

.edit-dialog .field {
  margin: 1rem;
}

.dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.55rem;
  border-top: 1px solid var(--border);
  padding: 1rem;
}

.form-error {
  min-height: 1.3em;
  margin: 0 1rem;
  color: var(--danger);
  font-size: 0.78rem;
}

.toast {
  position: fixed;
  z-index: 2200;
  right: 1.2rem;
  bottom: 1.2rem;
  max-width: min(360px, calc(100% - 2rem));
  transform: translateY(160%);
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--text);
  color: var(--surface);
  padding: 0.8rem 1rem;
  box-shadow: var(--shadow-md);
  font-size: 0.82rem;
  opacity: 0;
  transition: transform 220ms ease, opacity 220ms ease;
}

.toast.is-visible {
  transform: translateY(0);
  opacity: 1;
}

.sidebar-scrim {
  display: none;
}

.mobile-only {
  display: none;
}

@media (max-width: 1180px) {
  .topbar {
    grid-template-columns: minmax(210px, 1fr) auto;
  }

  .topnav {
    display: none;
  }

  .topbar__actions {
    grid-column: 2;
  }

  .stat-grid,
  .card-grid,
  .project-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .playground-shell {
    grid-template-columns: 190px minmax(0, 1fr);
  }

  .inspector-panel {
    grid-column: 1 / -1;
    border-top: 1px solid var(--border);
    border-left: 0;
  }

  .inspector-details {
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
  }

  .inspector-actions {
    grid-template-columns: repeat(3, auto);
  }
}

@media (max-width: 920px) {
  .mobile-only {
    display: inline-grid;
  }

  .workspace {
    grid-template-columns: minmax(0, 1fr);
  }

  .sidebar {
    transform: translateX(-105%);
    box-shadow: var(--shadow-md);
    transition: transform 200ms ease;
  }

  body.sidebar-open {
    overflow: hidden;
  }

  body.sidebar-open .sidebar {
    transform: translateX(0);
  }

  .sidebar-scrim {
    position: fixed;
    z-index: 650;
    inset: var(--topbar-height) 0 0;
    display: block;
    visibility: hidden;
    border: 0;
    background: rgb(10 12 20 / 42%);
    opacity: 0;
    transition: opacity 180ms ease, visibility 180ms ease;
  }

  body.sidebar-open .sidebar-scrim {
    visibility: visible;
    opacity: 1;
  }

  .main-content {
    grid-column: 1;
  }

  .hero,
  .dashboard-grid,
  .lesson-layout,
  .project-detail-grid,
  .practice-grid,
  .interview-grid {
    grid-template-columns: 1fr;
  }

  .hero__visual {
    max-width: 520px;
  }

  .lesson-toc,
  .project-sidebar,
  .timer-card {
    position: static;
  }

  .lesson-toc {
    display: none;
  }

  .project-sidebar {
    order: -1;
  }

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

@media (max-width: 680px) {
  :root {
    --topbar-height: 62px;
    --sidebar-width: min(88vw, 320px);
  }

  .topbar {
    padding: 0 0.7rem;
  }

  .brand__mark {
    width: 36px;
    height: 36px;
  }

  .brand__text small {
    display: none;
  }

  .main-content {
    padding: 1.2rem 0.8rem 3rem;
  }

  .page-header,
  .lesson-title-row,
  .continue-card {
    align-items: stretch;
    flex-direction: column;
  }

  .page-header__actions,
  .hero__actions {
    width: 100%;
  }

  .page-header__actions .button,
  .hero__actions .button {
    flex: 1;
  }

  .hero {
    min-height: 0;
    border-radius: var(--radius-lg);
    padding: 1.2rem;
  }

  .hero__visual {
    display: none;
  }

  .stat-grid,
  .card-grid,
  .project-grid,
  .skill-grid,
  .learning-objectives,
  .tradeoff-grid,
  .form-grid,
  .calculator-results {
    grid-template-columns: 1fr;
  }

  .learning-objectives h2 {
    grid-column: 1;
  }

  .stat-card {
    min-height: 112px;
  }

  .lesson-card,
  .project-card {
    min-height: 0;
  }

  .lesson-footer {
    align-items: stretch;
    flex-direction: column;
  }

  .lesson-nav-button {
    max-width: none;
  }

  .architecture-flow {
    justify-content: flex-start;
  }

  .playground-shell {
    grid-template-columns: 1fr;
  }

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

  .palette-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .canvas-wrap {
    min-height: 480px;
  }

  .inspector-details {
    grid-template-columns: 1fr;
  }

  .inspector-actions {
    grid-template-columns: 1fr;
  }

  .timer-controls {
    grid-template-columns: 1fr;
  }

  .search-dialog,
  .edit-dialog {
    width: calc(100% - 1rem);
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }
}

@media print {
  .topbar,
  .sidebar,
  .page-header__actions,
  .lesson-toc,
  .sidebar-scrim,
  .toast {
    display: none !important;
  }

  .workspace,
  .lesson-layout,
  .project-detail-grid {
    display: block;
  }

  .main-content {
    padding: 0;
  }

  .card,
  .panel,
  .project-content section {
    break-inside: avoid;
    box-shadow: none;
  }
}
