/* =============================================================================
   UI/UX Lab - one stylesheet, no framework.
   1. Tokens (light / dark)   2. Base   3. App shell   4. Components   5. Lessons
   ============================================================================= */

/* [lesson:308 Light tokens: every colour in the app comes from these variables] */
:root {
  --font-scale: 1;
  --primary: #4f46e5;
  --on-primary: #ffffff;

  --bg: #f5f6fb;
  --surface: #ffffff;
  --surface-2: #f2f4f9;
  --surface-3: #e8ebf3;
  --border: #e2e6ef;
  --border-strong: #cdd3e1;
  --text: #0f172a;
  --text-2: #475569;
  --text-3: #5f6b7f;
  --primary-text: color-mix(in srgb, var(--primary) 82%, #000);
  --primary-soft: color-mix(in srgb, var(--primary) 11%, var(--surface));
  --primary-soft-2: color-mix(in srgb, var(--primary) 20%, var(--surface));
  --primary-hover: color-mix(in srgb, var(--primary) 86%, #000);
  --ring: color-mix(in srgb, var(--primary) 45%, transparent);

  --success: #15803d; --success-soft: #dcfce7;
  --warning: #b45309; --warning-soft: #fef3c7;
  --danger: #dc2626;  --danger-soft: #fee2e2;
  --info: #2563eb;    --info-soft: #dbeafe;

  --shadow-sm: 0 1px 2px rgb(15 23 42 / .06);
  --shadow: 0 1px 3px rgb(15 23 42 / .06), 0 6px 16px -6px rgb(15 23 42 / .12);
  --shadow-lg: 0 10px 40px -10px rgb(15 23 42 / .28), 0 2px 8px rgb(15 23 42 / .08);

  --radius-sm: .5rem;
  --radius: .75rem;
  --radius-lg: 1.125rem;
  --sidebar-w: 16.5rem;
  --rail-w: 4.5rem;
  --topbar-h: 3.75rem;
  --font: "Segoe UI Variable Text", "Segoe UI", system-ui, -apple-system, "Noto Sans Thai", "Leelawadee UI", Roboto, sans-serif;
  --mono: "Cascadia Code", "JetBrains Mono", Consolas, ui-monospace, monospace;
  --ease: cubic-bezier(.2, .8, .2, 1);
  color-scheme: light;
}
/* [/lesson:308] */

/* [lesson:307 Dark tokens: same names, darker values. Components never change.] */
:root[data-theme="dark"] {
  --bg: #0a0f1d;
  --surface: #111829;
  --surface-2: #172036;
  --surface-3: #1f2a44;
  --border: #243050;
  --border-strong: #33406a;
  --text: #e6eaf5;
  --text-2: #b0b9d0;
  --text-3: #94a0bb;
  --primary-text: color-mix(in srgb, var(--primary) 62%, #fff);
  --primary-soft: color-mix(in srgb, var(--primary) 18%, var(--surface));
  --primary-soft-2: color-mix(in srgb, var(--primary) 30%, var(--surface));
  --primary-hover: color-mix(in srgb, var(--primary) 85%, #fff);

  --success: #4ade80; --success-soft: #12301f;
  --warning: #fbbf24; --warning-soft: #33270d;
  --danger: #f87171;  --danger-soft: #3a1418;
  --info: #60a5fa;    --info-soft: #132a4a;

  --shadow-sm: 0 0 0 1px rgb(255 255 255 / .03);
  --shadow: 0 0 0 1px rgb(255 255 255 / .04), 0 8px 24px -10px rgb(0 0 0 / .6);
  --shadow-lg: 0 0 0 1px rgb(255 255 255 / .06), 0 20px 50px -12px rgb(0 0 0 / .75);
  color-scheme: dark;
}
/* [/lesson:307] */

/* ---- 2. Base ------------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }
/* [lesson:309 One root size scales the whole interface (everything else is rem)] */
html {
  font-size: calc(100% * var(--font-scale));
  -webkit-text-size-adjust: 100%;
  scroll-padding-top: calc(var(--topbar-h) + 1rem);
}
/* [/lesson:309] */
body {
  margin: 0;
  font-family: var(--font);
  font-size: .9375rem;
  line-height: 1.6;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}
html.theme-anim body, html.theme-anim body * {
  transition: background-color .25s ease, border-color .25s ease, color .25s ease, fill .25s ease !important;
}
h1, h2, h3, h4 { line-height: 1.25; margin: 0 0 .5rem; letter-spacing: -.01em; }
h1 { font-size: 1.875rem; font-weight: 750; }
h2 { font-size: 1.125rem; font-weight: 700; }
h3 { font-size: 1rem; font-weight: 650; }
p { margin: 0 0 .75rem; }
a { color: var(--primary-text); text-decoration-thickness: .08em; text-underline-offset: .18em; }
code { font-family: var(--mono); font-size: .85em; background: var(--surface-2); border: 1px solid var(--border); padding: .05em .35em; border-radius: .35rem; }
kbd {
  font-family: var(--mono); font-size: .72rem; line-height: 1; padding: .22rem .4rem; border-radius: .35rem;
  border: 1px solid var(--border-strong); border-bottom-width: 2px; background: var(--surface); color: var(--text-2);
  white-space: nowrap;
}
img { max-width: 100%; display: block; }
:focus-visible { outline: 3px solid var(--ring); outline-offset: 2px; border-radius: .4rem; }
::selection { background: var(--primary-soft-2); }
.i { width: 1.15em; height: 1.15em; flex: none; display: inline-block; vertical-align: -.2em; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.scrim { display: none; }
.muted { color: var(--text-3); }
.small { font-size: .82rem; }
.w-full { width: 100%; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip-link { position: absolute; left: 1rem; top: -4rem; z-index: 200; background: var(--primary); color: var(--on-primary); padding: .6rem 1rem; border-radius: var(--radius-sm); }
.skip-link:focus { top: 1rem; }
[hidden] { display: none !important; }

/* ---- 3. App shell -------------------------------------------------------- */
/* [lesson:306,311 The shell: a two-column grid on desktop] */
.app {
  display: grid;
  grid-template-columns: var(--sidebar-w) minmax(0, 1fr);
  min-height: 100vh;
  transition: grid-template-columns .25s var(--ease);
}
html.sidebar-collapsed .app { grid-template-columns: var(--rail-w) minmax(0, 1fr); }
/* [/lesson:306,311] */

.sidebar {
  position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column;
  background: var(--surface); border-right: 1px solid var(--border); z-index: 40; overflow: hidden;
}
.brand { height: var(--topbar-h); display: flex; align-items: center; padding: 0 .9rem; border-bottom: 1px solid var(--border); flex: none; }
.brand-link { display: flex; align-items: center; gap: .7rem; text-decoration: none; color: var(--text); min-width: 0; }
.brand-logo {
  width: 2.25rem; height: 2.25rem; border-radius: .7rem; display: grid; place-items: center; flex: none;
  background: linear-gradient(135deg, var(--primary), color-mix(in srgb, var(--primary) 55%, #ec4899));
  color: #fff; box-shadow: 0 4px 12px -3px color-mix(in srgb, var(--primary) 60%, transparent);
}
.brand-text { display: flex; flex-direction: column; line-height: 1.15; white-space: nowrap; }
.brand-text b { font-size: 1rem; }
.brand-text small { color: var(--text-3); font-size: .72rem; }
.nav { flex: 1; overflow-y: auto; overflow-x: hidden; padding: .75rem .6rem 1rem; scrollbar-width: thin; }
.nav-group { margin-top: .9rem; }
.nav-title { font-size: .7rem; font-weight: 700; letter-spacing: .07em; text-transform: uppercase; color: var(--text-3); padding: 0 .65rem .35rem; white-space: nowrap; }
.nav-link {
  display: flex; align-items: center; gap: .7rem; width: 100%; padding: .48rem .65rem; border-radius: .6rem;
  color: var(--text-2); text-decoration: none; font: inherit; font-size: .875rem; background: none; border: 0; cursor: pointer;
  white-space: nowrap; position: relative;
}
.nav-link .i { width: 1.2rem; height: 1.2rem; }
.nav-link:hover { background: var(--surface-2); color: var(--text); }
.nav-link.active { background: var(--primary-soft); color: var(--primary-text); font-weight: 600; }
.nav-link.active::before { content: ""; position: absolute; left: -.6rem; top: .45rem; bottom: .45rem; width: 3px; border-radius: 0 3px 3px 0; background: var(--primary); }
.nav-text { flex: 1; overflow: hidden; text-overflow: ellipsis; text-align: left; }
.nav-no { font-size: .68rem; font-family: var(--mono); color: var(--text-3); background: var(--surface-2); padding: .05rem .35rem; border-radius: .3rem; }
.nav-link.active .nav-no { background: var(--surface); color: var(--primary-text); }
.nav-kbd { font-size: .65rem; }
.sidebar-foot { border-top: 1px solid var(--border); padding: .5rem .6rem; flex: none; }
.collapse-btn .i { transition: transform .25s var(--ease); }

/* [lesson:311 Collapsed rail: hide the words, keep the icons] */
html.sidebar-collapsed .sidebar .nav-text,
html.sidebar-collapsed .sidebar .nav-no,
html.sidebar-collapsed .sidebar .nav-kbd,
html.sidebar-collapsed .sidebar .brand-text { display: none; }
html.sidebar-collapsed .sidebar .nav-title { font-size: 0; height: 1px; margin: .55rem .6rem .7rem; padding: 0; background: var(--border); }
html.sidebar-collapsed .sidebar .nav-link { justify-content: center; padding: .6rem 0; }
html.sidebar-collapsed .sidebar .brand { justify-content: center; padding: 0; }
html.sidebar-collapsed .collapse-btn .i { transform: scaleX(-1); }
/* [/lesson:311] */

.main-col { min-width: 0; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 30; height: var(--topbar-h); display: flex; align-items: center; gap: .75rem;
  padding: 0 1.5rem; background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: saturate(1.6) blur(12px); -webkit-backdrop-filter: saturate(1.6) blur(12px);
  border-bottom: 1px solid var(--border);
}
.topbar-actions { margin-left: auto; display: flex; align-items: center; gap: .35rem; }
.search-btn {
  display: flex; align-items: center; gap: .55rem; height: 2.4rem; padding: 0 .55rem 0 .8rem; min-width: 15rem;
  border: 1px solid var(--border); border-radius: .7rem; background: var(--surface); color: var(--text-3); font: inherit; font-size: .85rem; cursor: pointer;
}
.search-btn:hover { border-color: var(--border-strong); color: var(--text-2); }
.search-btn kbd { margin-left: auto; }
.icon-btn {
  width: 2.4rem; height: 2.4rem; display: inline-grid; place-items: center; border-radius: .7rem; border: 1px solid transparent;
  background: none; color: var(--text-2); cursor: pointer; flex: none;
}
.icon-btn:hover { background: var(--surface-2); color: var(--text); border-color: var(--border); }
.icon-btn .i { width: 1.2rem; height: 1.2rem; }
html[data-theme="dark"] .only-light, html:not([data-theme="dark"]) .only-dark { display: none; }
.fs-on { display: none; }
html.is-fullscreen .fs-on { display: inline-block; }
html.is-fullscreen .fs-off { display: none; }
.mobile-only { display: none; }

main { flex: 1; outline: none; }
.page { max-width: 80rem; margin: 0 auto; padding: 1.75rem 1.5rem 3rem; }
.footer { display: flex; justify-content: space-between; flex-wrap: wrap; gap: .5rem 1.5rem; padding: 1.25rem 1.5rem; color: var(--text-3); font-size: .8rem; border-top: 1px solid var(--border); }

/* [lesson:312 Breadcrumb: chevrons between items, the middle collapses on phones] */
.breadcrumb { min-width: 0; flex: 1; }
.breadcrumb ol { display: flex; align-items: center; list-style: none; margin: 0; padding: 0; font-size: .875rem; min-width: 0; }
.breadcrumb li { display: flex; align-items: center; min-width: 0; order: 2; }
.breadcrumb li:first-child { order: 0; }
.breadcrumb li + li::before {
  content: ""; width: .45rem; height: .45rem; margin: 0 .6rem; flex: none; border-right: 1.5px solid var(--text-3); border-top: 1.5px solid var(--text-3);
  transform: rotate(45deg); opacity: .7;
}
.breadcrumb a { color: var(--text-2); text-decoration: none; white-space: nowrap; padding: .15rem .3rem; border-radius: .35rem; }
.breadcrumb a:hover { color: var(--text); background: var(--surface-2); }
.breadcrumb [aria-current] { color: var(--text); font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.breadcrumb .crumb-ellipsis { display: none; order: 1; color: var(--text-3); }
@media (max-width: 720px) {
  .breadcrumb ol.long li.middle { display: none; }
  .breadcrumb ol.long .crumb-ellipsis { display: flex; }
}
/* [/lesson:312] */

/* [lesson:306,311 Below 900px the sidebar becomes an off-canvas drawer] */
@media (max-width: 900px) {
  .app, html.sidebar-collapsed .app { grid-template-columns: minmax(0, 1fr); }
  .sidebar {
    position: fixed; inset: 0 auto 0 0; width: min(18rem, 85vw); transform: translateX(-100%);
    transition: transform .28s var(--ease); box-shadow: var(--shadow-lg);
  }
  html.drawer-open .sidebar { transform: none; }
  /* the rail makes no sense on a phone: always show names in the drawer */
  html.sidebar-collapsed .sidebar .nav-text, html.sidebar-collapsed .sidebar .nav-no, html.sidebar-collapsed .sidebar .brand-text { display: revert; }
  html.sidebar-collapsed .sidebar .nav-link { justify-content: flex-start; padding: .48rem .65rem; }
  html.sidebar-collapsed .sidebar .nav-title { font-size: .7rem; height: auto; background: none; margin: 0; padding: 0 .65rem .35rem; }
  html.sidebar-collapsed .sidebar .brand { justify-content: flex-start; padding: 0 .9rem; }
  .sidebar-foot { display: none; }
  .scrim { display: block; position: fixed; inset: 0; background: rgb(2 6 23 / .45); z-index: 35; opacity: 0; pointer-events: none; transition: opacity .25s; }
  html.drawer-open .scrim { opacity: 1; pointer-events: auto; }
  .mobile-only { display: inline-grid; }
  .search-btn { min-width: 0; width: 2.4rem; padding: 0; justify-content: center; }
  .search-btn span, .search-btn kbd { display: none; }
  .topbar { padding: 0 .75rem; gap: .4rem; }
  .page { padding: 1.25rem 1rem 2.5rem; }
}
@media (max-width: 480px) { .hide-xs { display: none !important; } h1 { font-size: 1.5rem; } }
/* [/lesson:306,311] */

/* ---- 4. Components ------------------------------------------------------- */
.btn {
  --btn-bg: var(--surface); --btn-fg: var(--text); --btn-bd: var(--border-strong);
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem; height: 2.4rem; padding: 0 1rem;
  border-radius: .65rem; border: 1px solid var(--btn-bd); background: var(--btn-bg); color: var(--btn-fg);
  font: inherit; font-size: .875rem; font-weight: 600; cursor: pointer; text-decoration: none; white-space: nowrap;
  transition: background-color .15s, border-color .15s, box-shadow .15s, transform .05s; user-select: none; position: relative;
}
.btn:hover { background: var(--surface-2); }
.btn:active { transform: translateY(1px); }
.btn:disabled, .btn[aria-disabled="true"] { opacity: .55; cursor: not-allowed; transform: none; }
.btn-primary { --btn-bg: var(--primary); --btn-fg: var(--on-primary); --btn-bd: transparent; box-shadow: 0 1px 2px rgb(0 0 0 / .1), inset 0 1px 0 rgb(255 255 255 / .12); }
.btn-primary:hover { background: var(--primary-hover); }
.btn-danger { --btn-bg: var(--danger); --btn-fg: #fff; --btn-bd: transparent; }
html[data-theme="dark"] .btn-danger { --btn-fg: #1a0505; }
.btn-danger:hover { background: color-mix(in srgb, var(--danger) 85%, #000); }
.btn-ghost { --btn-bg: transparent; --btn-bd: var(--border); }
.btn-soft { --btn-bg: var(--primary-soft); --btn-fg: var(--primary-text); --btn-bd: transparent; }
.btn-soft:hover { background: var(--primary-soft-2); }
.btn-light { --btn-bg: rgb(255 255 255 / .92); --btn-fg: #0f172a; --btn-bd: transparent; }
.btn-light:hover { background: #fff; }
.btn-sm { height: 2rem; padding: 0 .75rem; font-size: .8rem; border-radius: .55rem; }
.btn-xs { height: 1.65rem; padding: 0 .55rem; font-size: .75rem; border-radius: .45rem; gap: .3rem; }
.btn-lg { height: 2.85rem; padding: 0 1.3rem; font-size: .95rem; border-radius: .8rem; }
.btn-icon { width: 2.4rem; padding: 0; }
.btn-row { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }

.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow); padding: 1.25rem; margin-bottom: 1.25rem; min-width: 0; }
.card-head { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: .5rem 1rem; margin-bottom: 1rem; }
.card-head h2 { display: flex; align-items: center; gap: .55rem; margin: 0; font-size: 1.05rem; }
.card-head h2 .i { color: var(--primary-text); }
.card-foot { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: .75rem; margin-top: 1rem; padding-top: 1rem; border-top: 1px solid var(--border); }
.panel { background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius); padding: 1rem; min-width: 0; }
.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 22rem), 1fr)); gap: 0 1.25rem; }
.grid-3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 15rem), 1fr)); gap: 1rem; }
.stack { display: flex; flex-direction: column; gap: .75rem; }
.row { display: flex; align-items: center; gap: .75rem; flex-wrap: wrap; }
.spacer { flex: 1; }
.divider { height: 1px; background: var(--border); margin: 1.25rem 0; border: 0; }
.empty { text-align: center; color: var(--text-3); padding: 2rem 1rem; border: 1.5px dashed var(--border-strong); border-radius: var(--radius); }

.chip { display: inline-flex; align-items: center; gap: .3rem; font-size: .75rem; font-weight: 600; padding: .18rem .6rem; border-radius: 999px; background: var(--surface-2); color: var(--text-2); border: 1px solid var(--border); white-space: nowrap; }
.chip-primary { background: var(--primary-soft); color: var(--primary-text); border-color: transparent; }
.chip-success { background: var(--success-soft); color: var(--success); border-color: transparent; }
.chip-warning { background: var(--warning-soft); color: var(--warning); border-color: transparent; }
.chip-danger { background: var(--danger-soft); color: var(--danger); border-color: transparent; }
.chip-info { background: var(--info-soft); color: var(--info); border-color: transparent; }

.field { display: flex; flex-direction: column; gap: .35rem; font-size: .85rem; font-weight: 600; color: var(--text-2); min-width: 0; }
.field > span small { font-weight: 400; color: var(--text-3); }
.input, .select, .textarea {
  width: 100%; font: inherit; font-size: .9rem; color: var(--text); background: var(--surface); border: 1px solid var(--border-strong);
  border-radius: .6rem; padding: .55rem .75rem; min-height: 2.5rem; transition: border-color .15s, box-shadow .15s;
}
.textarea { resize: vertical; min-height: 5.5rem; }
.input:hover, .select:hover, .textarea:hover { border-color: var(--text-3); }
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--ring); }
.input[aria-invalid="true"], .select[aria-invalid="true"], .textarea[aria-invalid="true"] { border-color: var(--danger); box-shadow: 0 0 0 3px color-mix(in srgb, var(--danger) 22%, transparent); }
.field-error { color: var(--danger); font-size: .78rem; font-weight: 500; min-height: 1.1em; margin: 0; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 14rem), 1fr)); gap: .9rem 1rem; }
.check { width: 1.1rem; height: 1.1rem; accent-color: var(--primary); flex: none; }

/* Switch (a styled checkbox) */
.switch { appearance: none; width: 2.6rem; height: 1.5rem; border-radius: 999px; background: var(--border-strong); position: relative; cursor: pointer; flex: none; transition: background .2s; margin: 0; }
.switch::after { content: ""; position: absolute; top: .19rem; left: .19rem; width: 1.12rem; height: 1.12rem; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgb(0 0 0 / .3); transition: transform .2s var(--ease); }
.switch:checked { background: var(--primary); }
.switch:checked::after { transform: translateX(1.1rem); }
.switch-row { display: flex; align-items: center; justify-content: space-between; gap: 1rem; cursor: pointer; }
.switch-row span { display: flex; flex-direction: column; }
.switch-row small { color: var(--text-3); font-size: .78rem; }

/* Segmented control */
.seg { display: inline-flex; padding: .2rem; gap: .2rem; border-radius: .75rem; background: var(--surface-2); border: 1px solid var(--border); flex-wrap: wrap; }
.seg button { display: inline-flex; align-items: center; gap: .4rem; border: 0; background: none; font: inherit; font-size: .82rem; font-weight: 600; color: var(--text-2); padding: .4rem .75rem; border-radius: .55rem; cursor: pointer; }
.seg button:hover { color: var(--text); }
.seg button[aria-checked="true"], .seg button[aria-pressed="true"] { background: var(--surface); color: var(--primary-text); box-shadow: var(--shadow-sm), 0 0 0 1px var(--border); }

input[type="range"] { accent-color: var(--primary); width: 100%; }

.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius); }
.table { width: 100%; border-collapse: collapse; font-size: .86rem; }
.table th { text-align: left; font-size: .72rem; text-transform: uppercase; letter-spacing: .05em; color: var(--text-3); font-weight: 700; background: var(--surface-2); }
.table th, .table td { padding: .6rem .8rem; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr:hover td { background: color-mix(in srgb, var(--surface-2) 60%, transparent); }
.table .num { text-align: right; font-variant-numeric: tabular-nums; }

/* [lesson:313 Spinners: a rotating border, three sizes, paused for reduced motion] */
.spinner {
  --size: 1.15rem; width: var(--size); height: var(--size); border-radius: 50%; display: inline-block; flex: none;
  border: calc(var(--size) / 7) solid color-mix(in srgb, currentColor 22%, transparent); border-top-color: currentColor;
  animation: spin .7s linear infinite; vertical-align: -.2em;
}
.spinner-sm { --size: .85rem; }
.spinner-lg { --size: 2.6rem; color: var(--primary); }
.spinner-xl { --size: 3.5rem; color: var(--primary); }
@keyframes spin { to { transform: rotate(360deg); } }
.dots { display: inline-flex; gap: .3rem; }
.dots span { width: .5rem; height: .5rem; border-radius: 50%; background: currentColor; animation: bounce 1s infinite ease-in-out; }
.dots span:nth-child(2) { animation-delay: .15s; }
.dots span:nth-child(3) { animation-delay: .3s; }
@keyframes bounce { 0%, 80%, 100% { transform: scale(.5); opacity: .4; } 40% { transform: scale(1); opacity: 1; } }
.btn.is-loading { color: transparent !important; pointer-events: none; }
.btn.is-loading::after {
  content: ""; position: absolute; inset: 0; margin: auto; width: 1.1rem; height: 1.1rem; border-radius: 50%;
  border: 2px solid color-mix(in srgb, var(--btn-fg) 30%, transparent); border-top-color: var(--btn-fg); animation: spin .7s linear infinite;
}
.loading-overlay { position: fixed; inset: 0; z-index: 150; display: grid; place-items: center; background: color-mix(in srgb, var(--bg) 70%, transparent); backdrop-filter: blur(3px); animation: fade-in .2s; }
.loading-box { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-lg); padding: 1.75rem 2.25rem; text-align: center; display: flex; flex-direction: column; align-items: center; gap: .9rem; }
.loading-box p { margin: 0; font-weight: 600; }
/* [/lesson:313] */

/* [lesson:314 Skeleton: grey blocks with a moving shimmer] */
.skeleton {
  background: var(--surface-3); border-radius: .45rem; position: relative; overflow: hidden; color: transparent !important;
}
.skeleton::after {
  content: ""; position: absolute; inset: 0; transform: translateX(-100%);
  background: linear-gradient(90deg, transparent, color-mix(in srgb, var(--surface) 65%, transparent), transparent);
  animation: shimmer 1.3s infinite;
}
@keyframes shimmer { to { transform: translateX(100%); } }
.sk-line { height: .8rem; margin: .45rem 0; }
.sk-line.w-60 { width: 60%; } .sk-line.w-40 { width: 40%; } .sk-line.w-80 { width: 80%; }
/* [/lesson:314] */

/* [lesson:315 Progress bars: determinate, striped and indeterminate] */
.progress { height: .65rem; background: var(--surface-3); border-radius: 999px; overflow: hidden; position: relative; }
.progress-bar { height: 100%; width: 0; background: var(--primary); border-radius: inherit; transition: width .25s var(--ease); }
.progress.striped .progress-bar {
  background-image: linear-gradient(45deg, rgb(255 255 255 / .22) 25%, transparent 25%, transparent 50%, rgb(255 255 255 / .22) 50%, rgb(255 255 255 / .22) 75%, transparent 75%);
  background-size: 1rem 1rem; animation: stripes .8s linear infinite;
}
@keyframes stripes { to { background-position: 1rem 0; } }
.progress.indeterminate .progress-bar { width: 35%; position: absolute; animation: indeterminate 1.3s infinite var(--ease); }
@keyframes indeterminate { from { left: -35%; } to { left: 100%; } }
.progress.success .progress-bar { background: var(--success); }
.progress.danger .progress-bar { background: var(--danger); }
.top-progress { position: fixed; top: 0; left: 0; right: 0; height: 3px; z-index: 300; pointer-events: none; }
.top-progress span { display: block; height: 100%; width: 0; background: var(--primary); box-shadow: 0 0 10px var(--primary); opacity: 0; transition: width .3s ease, opacity .3s; }
.top-progress.active span { opacity: 1; }
/* [/lesson:315] */

/* [lesson:316 Toasts: slide in, stack, a timer line that pauses on hover] */
.toast-stack { position: fixed; z-index: 250; display: flex; flex-direction: column; gap: .6rem; width: min(24rem, calc(100vw - 2rem)); pointer-events: none; }
.toast-stack[data-pos="bottom-right"] { right: 1rem; bottom: 1rem; flex-direction: column-reverse; }
.toast-stack[data-pos="top-right"] { right: 1rem; top: calc(var(--topbar-h) + .75rem); }
.toast-stack[data-pos="top-center"] { left: 50%; transform: translateX(-50%); top: calc(var(--topbar-h) + .75rem); }
.toast-stack[data-pos="bottom-center"] { left: 50%; transform: translateX(-50%); bottom: 1rem; flex-direction: column-reverse; }
.toast {
  --tone: var(--info); pointer-events: auto; display: grid; grid-template-columns: auto 1fr auto; gap: .2rem .75rem; align-items: start;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-lg);
  padding: .85rem .85rem .95rem 1rem; position: relative; overflow: hidden; animation: toast-in .35s var(--ease);
}
.toast.success { --tone: var(--success); } .toast.warning { --tone: var(--warning); } .toast.error { --tone: var(--danger); }
.toast::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: var(--tone); }
.toast-icon { color: var(--tone); margin-top: .1rem; }
.toast-icon .i { width: 1.3rem; height: 1.3rem; }
.toast-title { font-weight: 700; font-size: .9rem; }
.toast-msg { color: var(--text-2); font-size: .84rem; grid-column: 2; margin-top: -.1rem; }
.toast-actions { grid-column: 2; display: flex; gap: .4rem; margin-top: .45rem; }
.toast-close { grid-column: 3; grid-row: 1; width: 1.8rem; height: 1.8rem; margin: -.3rem -.3rem 0 0; }
.toast-timer { position: absolute; left: 0; bottom: 0; height: 3px; width: 100%; background: var(--tone); opacity: .55; transform-origin: left; animation: toast-timer linear forwards; }
.toast:hover .toast-timer, .toast:focus-within .toast-timer { animation-play-state: paused; }
.toast.leaving { animation: toast-out .25s ease forwards; }
@keyframes toast-in { from { opacity: 0; transform: translateY(12px) scale(.97); } }
@keyframes toast-out { to { opacity: 0; transform: translateX(30px); } }
@keyframes toast-timer { from { transform: scaleX(1); } to { transform: scaleX(0); } }
/* [/lesson:316] */

/* [lesson:317 Native <dialog> styled as a modal] */
.modal {
  border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 0; width: min(36rem, calc(100vw - 2rem)); max-height: min(85vh, 48rem);
  background: var(--surface); color: var(--text); box-shadow: var(--shadow-lg);
}
.modal[open] { animation: modal-in .25s var(--ease); display: flex; flex-direction: column; }
.modal::backdrop { background: rgb(2 6 23 / .5); backdrop-filter: blur(2px); animation: fade-in .2s; }
.modal > form, .modal > .modal-inner { display: flex; flex-direction: column; min-height: 0; flex: 1; }
.modal-sm { width: min(26rem, calc(100vw - 2rem)); }
.modal-sm form { padding: 1.5rem; }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 1rem 1.25rem; border-bottom: 1px solid var(--border); gap: 1rem; flex: none; }
.modal-head h2 { margin: 0; }
.modal-body { padding: 1.25rem; overflow-y: auto; flex: 1; min-height: 0; }
.modal-actions { display: flex; justify-content: flex-end; gap: .5rem; margin-top: 1.25rem; flex-wrap: wrap; }
.modal-foot { display: flex; justify-content: flex-end; gap: .5rem; padding: 1rem 1.25rem; border-top: 1px solid var(--border); background: var(--surface-2); flex: none; flex-wrap: wrap; }
.modal-note { padding: 0 1.25rem 1rem; margin: 0; }
@keyframes modal-in { from { opacity: 0; transform: translateY(14px) scale(.97); } }
@keyframes fade-in { from { opacity: 0; } }
/* [/lesson:317] */
/* [lesson:318 The confirm dialog: a warning icon and a red button] */
.confirm-icon { width: 3rem; height: 3rem; border-radius: 50%; display: grid; place-items: center; background: var(--danger-soft); color: var(--danger); margin-bottom: 1rem; }
.confirm-icon .i { width: 1.5rem; height: 1.5rem; }
#confirmDialog.safe .confirm-icon { background: var(--primary-soft); color: var(--primary-text); }
#confirmDialog h2 { font-size: 1.15rem; }
#confirmDialog .field { margin-top: .5rem; }
/* [/lesson:318] */

/* [lesson:319 One shared tooltip element with an arrow] */
.tooltip {
  position: fixed; z-index: 400; max-width: 16rem; padding: .4rem .65rem; border-radius: .45rem; pointer-events: none;
  background: #0f172a; color: #f8fafc; font-size: .78rem; font-weight: 500; line-height: 1.4; box-shadow: var(--shadow);
  animation: tip-in .12s ease;
}
html[data-theme="dark"] .tooltip { background: #e8ecf6; color: #0f172a; }
.tooltip::after { content: ""; position: absolute; width: .55rem; height: .55rem; background: inherit; transform: rotate(45deg); }
.tooltip[data-pos="top"]::after { bottom: -.25rem; left: calc(var(--arrow, 50%) - .275rem); }
.tooltip[data-pos="bottom"]::after { top: -.25rem; left: calc(var(--arrow, 50%) - .275rem); }
.tooltip[data-pos="left"]::after { right: -.25rem; top: calc(50% - .275rem); }
.tooltip[data-pos="right"]::after { left: -.25rem; top: calc(50% - .275rem); }
@keyframes tip-in { from { opacity: 0; } }
/* [/lesson:319] */

/* Drawer (appearance panel) */
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; width: min(22rem, 92vw); z-index: 120; background: var(--surface); border-left: 1px solid var(--border);
  box-shadow: var(--shadow-lg); transform: translateX(105%); transition: transform .3s var(--ease); display: flex; flex-direction: column;
}
.drawer.open { transform: none; }
.drawer-head { display: flex; align-items: center; justify-content: space-between; height: var(--topbar-h); padding: 0 1rem 0 1.25rem; border-bottom: 1px solid var(--border); }
.drawer-head h2 { margin: 0; }
.drawer-body { padding: 1.25rem; overflow-y: auto; display: flex; flex-direction: column; gap: 1.4rem; }
.setting h3 { display: flex; justify-content: space-between; font-size: .8rem; text-transform: uppercase; letter-spacing: .06em; color: var(--text-3); margin-bottom: .65rem; }
.setting output { color: var(--primary-text); font-family: var(--mono); }
.font-row { display: flex; align-items: center; gap: .6rem; }
.swatches { display: flex; flex-wrap: wrap; gap: .55rem; }
.swatch {
  width: 2.1rem; height: 2.1rem; border-radius: 50%; border: 0; background: var(--sw); cursor: pointer; position: relative;
  box-shadow: inset 0 0 0 1px rgb(0 0 0 / .12); transition: transform .15s;
}
.swatch:hover { transform: scale(1.1); }
.swatch[aria-pressed="true"]::after { content: ""; position: absolute; inset: -4px; border-radius: 50%; border: 2px solid var(--sw); }
.swatch[aria-pressed="true"]::before { content: ""; position: absolute; left: 50%; top: 45%; width: .35rem; height: .65rem; border: solid var(--on-primary); border-width: 0 2px 2px 0; transform: translate(-50%, -50%) rotate(45deg); }
.swatch-custom { background: conic-gradient(#ef4444, #f59e0b, #84cc16, #10b981, #06b6d4, #6366f1, #d946ef, #ef4444); display: grid; place-items: center; overflow: hidden; }
.swatch-custom input { opacity: 0; position: absolute; inset: 0; width: 100%; height: 100%; cursor: pointer; }

/* Command palette */
.palette { width: min(38rem, calc(100vw - 2rem)); margin-top: 12vh; }
.palette-search { display: flex; align-items: center; gap: .7rem; padding: .9rem 1.1rem; border-bottom: 1px solid var(--border); }
.palette-search .i { color: var(--text-3); width: 1.25rem; height: 1.25rem; }
.palette-search input { flex: 1; border: 0; outline: none; background: none; font: inherit; font-size: 1rem; color: var(--text); }
.palette-list { list-style: none; margin: 0; padding: .45rem; overflow-y: auto; max-height: 55vh; }
.palette-list li { display: flex; align-items: center; gap: .75rem; padding: .55rem .75rem; border-radius: .6rem; cursor: pointer; font-size: .9rem; }
.palette-list li .pal-no { font-family: var(--mono); font-size: .72rem; color: var(--text-3); width: 2.2rem; }
.palette-list li .pal-group { margin-left: auto; font-size: .72rem; color: var(--text-3); }
.palette-list li .pal-thai { color: var(--text-3); font-size: .8rem; }
.palette-list li[aria-selected="true"] { background: var(--primary-soft); color: var(--primary-text); }
.palette-list .pal-head { font-size: .7rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--text-3); cursor: default; padding: .6rem .75rem .25rem; }
.palette-list mark { background: none; color: var(--primary-text); font-weight: 700; }
.palette-foot { display: flex; gap: 1rem; padding: .6rem 1rem; border-top: 1px solid var(--border); font-size: .75rem; color: var(--text-3); flex-wrap: wrap; }
.palette-foot kbd { margin-right: .2rem; }
.shortcut-table td:first-child { width: 9rem; }
.keys { display: inline-flex; gap: .25rem; align-items: center; flex-wrap: wrap; }
.keys .then { font-size: .72rem; color: var(--text-3); }

/* [lesson:329 Back-to-top button with a progress ring] */
.back-to-top {
  position: fixed; right: 1.25rem; bottom: 1.25rem; z-index: 90; width: 3rem; height: 3rem; border-radius: 50%; border: 0; cursor: pointer;
  display: grid; place-items: center; background: var(--surface); color: var(--primary-text); box-shadow: var(--shadow-lg);
  opacity: 0; transform: translateY(1rem) scale(.9); pointer-events: none; transition: opacity .25s, transform .25s var(--ease);
}
.back-to-top.show { opacity: 1; transform: none; pointer-events: auto; }
.back-to-top:hover { background: var(--primary); color: var(--on-primary); }
.back-to-top .ring { position: absolute; inset: 0; transform: rotate(-90deg); }
.ring circle { fill: none; stroke-width: 3; }
.ring-bg { stroke: var(--surface-3); }
.ring-fg { stroke: var(--primary); stroke-linecap: round; stroke-dasharray: 132; stroke-dashoffset: 132; }
.back-to-top .i { position: relative; width: 1.25rem; height: 1.25rem; }
body:has(.toast-stack[data-pos="bottom-right"] .toast) .back-to-top { opacity: 0; pointer-events: none; }
/* [/lesson:329] */

/* [lesson:321 Tabs: an underline under the selected tab] */
.tabs { min-width: 0; }
.tab-list { display: flex; gap: .25rem; border-bottom: 1px solid var(--border); overflow-x: auto; scrollbar-width: thin; }
.tab {
  display: inline-flex; align-items: center; gap: .45rem; padding: .6rem .9rem; border: 0; background: none; font: inherit; font-size: .86rem; font-weight: 600;
  color: var(--text-3); cursor: pointer; white-space: nowrap; position: relative; border-radius: .5rem .5rem 0 0;
}
.tab:hover { color: var(--text); background: var(--surface-2); }
.tab[aria-selected="true"] { color: var(--primary-text); }
.tab[aria-selected="true"]::after { content: ""; position: absolute; left: .5rem; right: .5rem; bottom: -1px; height: 2.5px; border-radius: 2px; background: var(--primary); }
.tab-panel { padding-top: 1rem; outline: none; }
.tab-panel:focus-visible { box-shadow: inset 0 0 0 2px var(--ring); border-radius: .5rem; }
.tab-badge { font-size: .68rem; background: var(--surface-2); color: var(--text-3); padding: 0 .4rem; border-radius: 999px; }
/* [/lesson:321] */

/* Code blocks */
.code-head { display: flex; align-items: center; gap: .75rem; flex-wrap: wrap; margin-bottom: .5rem; }
.code-path { font-family: var(--mono); font-size: .78rem; color: var(--text-3); word-break: break-all; }
.code-title { font-size: .8rem; font-weight: 600; color: var(--text-2); }
.code-head .btn { margin-left: auto; }
.code {
  margin: 0; background: #0d1326; color: #dbe3f5; border-radius: var(--radius); padding: 1rem 0; overflow: auto; max-height: 34rem;
  font-family: var(--mono); font-size: .8rem; line-height: 1.65; tab-size: 4; border: 1px solid #1d2742;
}
.code code { background: none; border: 0; padding: 0; font-size: inherit; display: block; counter-reset: line; color: inherit; }
.code .ln { display: block; padding: 0 1rem 0 3.6rem; position: relative; white-space: pre; }
.code .ln::before { counter-increment: line; content: counter(line); position: absolute; left: 0; width: 2.6rem; text-align: right; color: #4d5a7c; user-select: none; }
.code .ln:hover { background: rgb(255 255 255 / .04); }
.tok-c { color: #6f7fa6; font-style: italic; }
.tok-s { color: #a5e3a1; }
.tok-k { color: #c4a7ff; }
.tok-n { color: #ffb86b; }
.tok-a { color: #7dd3fc; }
.tok-t { color: #ff8fa3; }
.lang { font-family: var(--mono); font-size: .65rem; text-transform: uppercase; padding: .05rem .35rem; border-radius: .3rem; background: var(--surface-2); color: var(--text-3); }
.lang-java { background: #fde7d9; color: #9a3412; } .lang-sql { background: #dbeafe; color: #1e40af; } .lang-html { background: #fee2e2; color: #b91c1c; }
.lang-css { background: #ede9fe; color: #6d28d9; } .lang-js { background: #fef9c3; color: #854d0e; }
html[data-theme="dark"] .lang { filter: saturate(.8) brightness(.9); }

/* ---- 5. Pages and lessons ------------------------------------------------ */
.hero { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); gap: 2rem; align-items: center; margin-bottom: 2.5rem; }
.eyebrow { display: inline-flex; align-items: center; gap: .4rem; font-size: .8rem; font-weight: 700; color: var(--primary-text); background: var(--primary-soft); padding: .3rem .75rem; border-radius: 999px; margin-bottom: 1rem; }
.hero h1 { font-size: 2.4rem; line-height: 1.12; letter-spacing: -.025em; margin-bottom: 1rem; }
.lead { font-size: 1.05rem; color: var(--text-2); max-width: 40rem; }
.hero-actions { display: flex; gap: .75rem; flex-wrap: wrap; margin: 1.5rem 0; }
.hero-stats { display: flex; gap: 2rem; margin: 0; flex-wrap: wrap; }
.hero-stats div { display: flex; flex-direction: column-reverse; }
.hero-stats dt { font-size: .78rem; color: var(--text-3); }
.hero-stats dd { margin: 0; font-size: 1.6rem; font-weight: 800; letter-spacing: -.02em; }
@media (max-width: 1000px) { .hero { grid-template-columns: minmax(0, 1fr); } .hero h1 { font-size: 2rem; } }

.home-group { margin-bottom: 2.25rem; scroll-margin-top: calc(var(--topbar-h) + 1rem); }
.section-head { display: flex; align-items: center; gap: .75rem; margin-bottom: 1rem; }
.section-head h2 { margin: 0; font-size: 1.3rem; }
/* [lesson:306 Mobile first: one column, auto-fill adds more when there is room] */
.lesson-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 16.5rem), 1fr)); gap: 1rem; }
/* [/lesson:306] */
.lesson-card {
  display: flex; flex-direction: column; gap: .2rem; padding: 1.15rem; border-radius: var(--radius-lg); text-decoration: none; color: var(--text);
  background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow-sm); position: relative; transition: transform .2s var(--ease), box-shadow .2s, border-color .2s;
}
.lesson-card:hover { transform: translateY(-3px); box-shadow: var(--shadow); border-color: color-mix(in srgb, var(--primary) 35%, var(--border)); }
.lesson-icon { width: 2.6rem; height: 2.6rem; border-radius: .8rem; display: grid; place-items: center; background: var(--primary-soft); color: var(--primary-text); margin-bottom: .6rem; }
.lesson-icon .i { width: 1.35rem; height: 1.35rem; }
.lesson-no { position: absolute; top: 1.1rem; right: 1.1rem; font-family: var(--mono); font-size: .75rem; color: var(--text-3); }
.lesson-card h3 { margin: 0; }
.lesson-thai { font-size: .8rem; color: var(--text-3); }
.lesson-card p { font-size: .84rem; color: var(--text-2); margin: .5rem 0 .75rem; flex: 1; }
.lesson-go { font-size: .8rem; font-weight: 700; color: var(--primary-text); display: inline-flex; align-items: center; gap: .2rem; }
.lesson-card:hover .lesson-go .i { transform: translateX(3px); }
.lesson-go .i { transition: transform .2s; }
.how-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 13rem), 1fr)); gap: 1.25rem; }
.how-grid p { font-size: .85rem; color: var(--text-2); margin: 0; }

.lesson-hero { display: flex; gap: 1.25rem; align-items: flex-start; margin-bottom: 1.5rem; flex-wrap: wrap; }
.lesson-hero-icon {
  width: 3.6rem; height: 3.6rem; border-radius: 1.1rem; display: grid; place-items: center; flex: none; color: #fff;
  background: linear-gradient(135deg, var(--primary), color-mix(in srgb, var(--primary) 50%, #ec4899));
  box-shadow: 0 10px 24px -10px var(--primary);
}
.lesson-hero-icon .i { width: 1.75rem; height: 1.75rem; }
.lesson-hero-text { flex: 1; min-width: min(100%, 18rem); }
.lesson-meta { display: flex; gap: .4rem; margin-bottom: .5rem; flex-wrap: wrap; }
.lesson-hero h1 small { font-size: 1rem; font-weight: 500; color: var(--text-3); }
.lesson-hero .lead { margin: 0; }
.lesson-pager { display: flex; gap: .4rem; }
.notice-list, .try-list { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: .65rem; font-size: .9rem; }
.notice-list li { padding-left: 1.6rem; position: relative; color: var(--text-2); }
.notice-list li::before { content: ""; position: absolute; left: .3rem; top: .55rem; width: .5rem; height: .5rem; border-radius: 50%; background: var(--primary); box-shadow: 0 0 0 4px var(--primary-soft); }
.try-list label { display: flex; gap: .65rem; align-items: flex-start; cursor: pointer; color: var(--text-2); }
.try-list input { margin-top: .25rem; }
.try-list input:checked + span { text-decoration: line-through; color: var(--text-3); }
.pager-foot { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; margin-top: 1.5rem; }
.pager-link { display: flex; flex-direction: column; padding: 1rem 1.25rem; border: 1px solid var(--border); border-radius: var(--radius-lg); text-decoration: none; color: var(--text); background: var(--surface); }
.pager-link:hover { border-color: var(--primary); }
.pager-link small { color: var(--text-3); }
.pager-link span { font-weight: 650; }
.pager-link.next { text-align: right; }
.demo { min-width: 0; }
.demo-card { border-top: 3px solid var(--primary); }
.demo-section + .demo-section { margin-top: 1.5rem; padding-top: 1.5rem; border-top: 1px solid var(--border); }
.demo-section > h3 { display: flex; align-items: center; gap: .5rem; font-size: .95rem; margin-bottom: .35rem; }
.demo-section > p.muted { font-size: .85rem; margin-bottom: 1rem; }
.stat { display: flex; flex-direction: column; padding: .85rem 1rem; border-radius: var(--radius); background: var(--surface-2); border: 1px solid var(--border); }
.stat b { font-size: 1.35rem; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.stat span { font-size: .75rem; color: var(--text-3); }
.log { font-family: var(--mono); font-size: .76rem; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius); padding: .65rem .8rem; max-height: 10rem; overflow: auto; margin: 0; list-style: none; }
.log li { padding: .1rem 0; color: var(--text-2); }
.log li b { color: var(--text); font-weight: 600; }

/* 306 responsive preview */
.device-bar { display: flex; flex-wrap: wrap; align-items: center; gap: .75rem; margin-bottom: 1rem; }
.device-stage { background: repeating-linear-gradient(45deg, var(--surface-2), var(--surface-2) 10px, var(--surface-3) 10px, var(--surface-3) 20px); border-radius: var(--radius); padding: 1rem; overflow: hidden; border: 1px solid var(--border); }
.device-frame { position: relative; margin: 0 auto; max-width: 100%; height: 34rem; transition: width .35s var(--ease); background: var(--surface); border-radius: .75rem; box-shadow: var(--shadow-lg); border: 1px solid var(--border-strong); }
.device-frame.dragging { transition: none; }
.device-frame iframe { width: 100%; height: 100%; border: 0; border-radius: inherit; display: block; }
.device-frame.dragging iframe { pointer-events: none; }
.device-handle { position: absolute; top: 50%; right: -.85rem; width: 1rem; height: 3.5rem; margin-top: -1.75rem; border-radius: .5rem; background: var(--surface); border: 1px solid var(--border-strong); cursor: ew-resize; box-shadow: var(--shadow); touch-action: none; display: grid; place-items: center; }
.device-handle::before { content: ""; width: 2px; height: 1.4rem; border-left: 2px dotted var(--text-3); }
.bp-badge { font-family: var(--mono); font-size: .8rem; }
/* [lesson:306 Container query: the card changes by its own width] */
.cq-wrap { container-type: inline-size; resize: horizontal; overflow: auto; border: 1.5px dashed var(--border-strong); border-radius: var(--radius); padding: .75rem; min-width: 14rem; max-width: 100%; width: 100%; }
.cq-card { display: grid; gap: .9rem; grid-template-columns: 1fr; align-items: center; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: .9rem; }
.cq-card img { border-radius: .6rem; width: 100%; aspect-ratio: 16 / 9; object-fit: cover; }
.cq-card .cq-label::after { content: "narrow (< 28rem): stacked"; }
@container (min-width: 28rem) {
  .cq-card { grid-template-columns: 10rem 1fr; }
  .cq-card .cq-label::after { content: "wide (>= 28rem): side by side"; }
}
@container (min-width: 44rem) {
  .cq-card { grid-template-columns: 16rem 1fr auto; }
  .cq-card .cq-label::after { content: "very wide (>= 44rem): three columns"; }
}
/* [/lesson:306] */

/* 307/308 mode cards and contrast */
.mode-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 11rem), 1fr)); gap: 1rem; }
.mode-card { border: 2px solid var(--border); border-radius: var(--radius-lg); padding: .6rem; background: var(--surface); cursor: pointer; text-align: left; font: inherit; color: var(--text); }
.mode-card[aria-checked="true"] { border-color: var(--primary); box-shadow: 0 0 0 4px var(--ring); }
.mode-card b { display: flex; align-items: center; gap: .4rem; margin-top: .6rem; padding: 0 .2rem; }
.mode-card small { display: block; color: var(--text-3); padding: 0 .2rem .2rem; }
.mode-thumb { height: 6rem; border-radius: .7rem; display: grid; grid-template-columns: 30% 1fr; overflow: hidden; border: 1px solid rgb(0 0 0 / .08); }
.mode-thumb i { display: block; }
.mode-thumb.light { background: #f5f6fb; } .mode-thumb.light i:first-child { background: #fff; border-right: 1px solid #e5e7eb; }
.mode-thumb.dark { background: #0a0f1d; } .mode-thumb.dark i:first-child { background: #111829; border-right: 1px solid #243050; }
.mode-thumb.system { background: linear-gradient(105deg, #f5f6fb 50%, #0a0f1d 50%); }
.mode-thumb .bars { padding: .6rem; display: flex; flex-direction: column; gap: .35rem; }
.mode-thumb .bars span { height: .4rem; border-radius: 1rem; background: var(--primary); width: 60%; }
.mode-thumb .bars span + span { background: #94a3b8; width: 80%; opacity: .5; }
.token-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 9.5rem), 1fr)); gap: .6rem; }
.token { border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; font-size: .75rem; background: var(--surface); }
.token i { display: block; height: 2.6rem; border-bottom: 1px solid var(--border); }
.token span { display: block; padding: .35rem .55rem; font-family: var(--mono); }
.token small { display: block; padding: 0 .55rem .4rem; color: var(--text-3); font-family: var(--mono); font-size: .68rem; }
.ratio { font-family: var(--mono); font-weight: 700; }

/* 309 font demo */
.type-scale { display: flex; flex-direction: column; gap: .4rem; }
.type-scale div { display: flex; align-items: baseline; gap: 1rem; border-bottom: 1px dashed var(--border); padding-bottom: .4rem; }
.type-scale code { flex: none; width: 7.5rem; font-size: .72rem; }

/* 310 palette */
.tint-strip { display: grid; grid-template-columns: repeat(6, 1fr); border-radius: var(--radius); overflow: hidden; border: 1px solid var(--border); }
.tint-strip div { height: 3.5rem; display: flex; align-items: flex-end; padding: .3rem .4rem; font-size: .65rem; font-family: var(--mono); }
.preview-grid { display: flex; flex-wrap: wrap; gap: .6rem; align-items: center; }
.big-swatches .swatch { width: 2.75rem; height: 2.75rem; }

/* 311 mini layout */
.mini-shell { display: grid; grid-template-columns: 7rem 1fr; height: 9rem; border-radius: var(--radius); overflow: hidden; border: 1px solid var(--border); transition: grid-template-columns .3s var(--ease); background: var(--bg); }
.mini-shell.collapsed { grid-template-columns: 2.2rem 1fr; }
.mini-shell aside { background: var(--surface); border-right: 1px solid var(--border); padding: .5rem .45rem; display: flex; flex-direction: column; gap: .4rem; overflow: hidden; }
.mini-shell aside span { display: flex; align-items: center; gap: .35rem; font-size: .68rem; white-space: nowrap; color: var(--text-2); }
.mini-shell aside span i { width: 1.2rem; height: 1.2rem; border-radius: .3rem; background: var(--primary-soft-2); flex: none; }
.mini-shell div { padding: .6rem; display: flex; flex-direction: column; gap: .4rem; }
.mini-shell div i { height: .5rem; background: var(--surface-3); border-radius: 1rem; }

/* 312 product browser */
.cat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 10rem), 1fr)); gap: .75rem; }
.cat-tile { display: flex; flex-direction: column; gap: .2rem; padding: 1rem; border-radius: var(--radius); background: var(--surface-2); border: 1px solid var(--border); text-decoration: none; color: var(--text); font-weight: 650; }
.cat-tile:hover, .cat-tile.active { border-color: var(--primary); background: var(--primary-soft); color: var(--primary-text); }
.cat-tile small { color: var(--text-3); font-weight: 500; }
.crumb-variants { display: flex; flex-direction: column; gap: .75rem; }
.crumb-demo { display: flex; align-items: center; flex-wrap: wrap; gap: .35rem; font-size: .85rem; list-style: none; margin: 0; padding: 0; }
.crumb-demo.slash li + li::before { content: "/"; color: var(--text-3); margin-right: .35rem; }
.crumb-demo.pill a, .crumb-demo.pill span { padding: .2rem .7rem; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--border); text-decoration: none; color: var(--text-2); display: inline-block; }
.crumb-demo.pill span { background: var(--primary); color: var(--on-primary); border-color: transparent; }
.crumb-demo.arrow li + li::before { content: "→"; color: var(--text-3); margin-right: .35rem; }
.product-detail { display: grid; grid-template-columns: minmax(0, 18rem) minmax(0, 1fr); gap: 1.25rem; align-items: start; }
.product-detail img { border-radius: var(--radius); width: 100%; aspect-ratio: 3 / 2; object-fit: cover; }
@media (max-width: 640px) { .product-detail { grid-template-columns: minmax(0, 1fr); } }

/* 314 / 324 product cards */
.product-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 13rem), 1fr)); gap: 1rem; }
.product-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; display: flex; flex-direction: column; }
.product-card .pc-img { aspect-ratio: 3 / 2; width: 100%; object-fit: cover; background: var(--surface-3); }
.product-card .pc-body { padding: .75rem .85rem .9rem; display: flex; flex-direction: column; gap: .15rem; }
.product-card .pc-cat { font-size: .7rem; text-transform: uppercase; letter-spacing: .05em; color: var(--text-3); font-weight: 700; }
.product-card .pc-name { font-weight: 650; font-size: .9rem; }
.product-card .pc-row { display: flex; justify-content: space-between; align-items: center; margin-top: .35rem; font-size: .85rem; }
.product-card .pc-price { font-weight: 800; }
.product-card .pc-rating { color: var(--warning); font-weight: 600; font-size: .8rem; }
.product-card.fade-in { animation: fade-in .4s ease; }

/* 315 upload */
.dropzone { border: 2px dashed var(--border-strong); border-radius: var(--radius-lg); padding: 1.5rem; text-align: center; color: var(--text-2); cursor: pointer; transition: border-color .15s, background .15s; display: block; }
.dropzone:hover, .dropzone.over { border-color: var(--primary); background: var(--primary-soft); }
.dropzone .i { width: 2rem; height: 2rem; color: var(--primary-text); margin: 0 auto .5rem; display: block; }
.dropzone input { position: absolute; opacity: 0; pointer-events: none; width: 1px; }
.progress-meta { display: flex; justify-content: space-between; font-size: .8rem; color: var(--text-3); margin: .4rem 0 0; font-variant-numeric: tabular-nums; gap: 1rem; flex-wrap: wrap; }

/* [lesson:319 Demo targets for the four tooltip positions] */
.tip-grid { display: grid; grid-template-columns: repeat(3, auto); gap: .75rem; justify-content: center; align-items: center; padding: 2rem 0; }
.tip-grid .center { width: 7rem; height: 4rem; display: grid; place-items: center; border-radius: var(--radius); background: var(--surface-2); color: var(--text-3); font-size: .8rem; border: 1px dashed var(--border-strong); }
/* [/lesson:319] */

/* [lesson:320 Accordion built on <details>] */
.accordion { border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; background: var(--surface); }
.acc-item + .acc-item { border-top: 1px solid var(--border); }
.acc-item summary {
  list-style: none; display: flex; align-items: center; gap: .75rem; padding: .9rem 1rem; cursor: pointer; font-weight: 600; font-size: .92rem;
}
.acc-item summary::-webkit-details-marker { display: none; }
.acc-item summary:hover { background: var(--surface-2); }
.acc-item summary .chev { margin-left: auto; transition: transform .25s var(--ease); color: var(--text-3); }
.acc-item[open] summary .chev { transform: rotate(180deg); }
.acc-item[open] summary { color: var(--primary-text); }
.acc-body { overflow: hidden; }
.acc-body p { padding: 0 1rem 1rem 3.25rem; margin: 0; color: var(--text-2); font-size: .9rem; }
.acc-num { width: 1.6rem; height: 1.6rem; flex: none; border-radius: .45rem; display: grid; place-items: center; font-size: .72rem; background: var(--surface-2); color: var(--text-3); }
.acc-item[open] .acc-num { background: var(--primary); color: var(--on-primary); }
.acc-cat { font-size: .78rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--text-3); margin: 1.25rem 0 .5rem; }
mark.hl { background: color-mix(in srgb, var(--warning) 35%, transparent); color: inherit; border-radius: .2rem; padding: 0 .1rem; }
/* [/lesson:320] */

/* [lesson:322 Stepper: circles joined by a line that fills as you go] */
.stepper { display: flex; list-style: none; margin: 0 0 1.5rem; padding: 0; counter-reset: step; }
.step { flex: 1; position: relative; display: flex; flex-direction: column; align-items: center; text-align: center; gap: .4rem; font-size: .8rem; color: var(--text-3); }
.step::before {
  counter-increment: step; content: counter(step); width: 2.3rem; height: 2.3rem; border-radius: 50%; display: grid; place-items: center; font-weight: 700;
  background: var(--surface); border: 2px solid var(--border-strong); color: var(--text-3); position: relative; z-index: 1; transition: all .25s;
}
.step + .step::after { content: ""; position: absolute; top: 1.15rem; right: 50%; width: 100%; height: 2px; background: var(--border-strong); }
.step.done::before { content: "✓"; background: var(--primary); border-color: var(--primary); color: var(--on-primary); }
.step.done, .step.current { color: var(--text); }
.step.current::before { border-color: var(--primary); color: var(--primary-text); box-shadow: 0 0 0 5px var(--ring); }
.step.done + .step::after, .step.current::after { background: var(--primary); }
.step button { all: unset; cursor: pointer; font-weight: 600; }
.step button:focus-visible { outline: 3px solid var(--ring); border-radius: .3rem; }
.step-panel { animation: step-in .3s var(--ease); }
@keyframes step-in { from { opacity: 0; transform: translateX(14px); } }
.plan-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 11rem), 1fr)); gap: .75rem; }
.plan-card { border: 2px solid var(--border); border-radius: var(--radius); padding: 1rem; cursor: pointer; display: flex; flex-direction: column; gap: .2rem; position: relative; }
.plan-card:has(input:checked) { border-color: var(--primary); background: var(--primary-soft); }
.plan-card input { position: absolute; opacity: 0; }
.plan-card:has(input:focus-visible) { box-shadow: 0 0 0 4px var(--ring); }
.plan-card b { font-size: 1rem; }
.plan-card .price { font-size: 1.35rem; font-weight: 800; }
.plan-card small { color: var(--text-3); }
.review-list { display: grid; grid-template-columns: max-content 1fr; gap: .45rem 1.25rem; margin: 0; font-size: .9rem; }
.review-list dt { color: var(--text-3); }
.review-list dd { margin: 0; font-weight: 600; word-break: break-word; }
@media (max-width: 560px) { .step { font-size: 0; } .step::before { font-size: .85rem; } }
/* [/lesson:322] */

/* [lesson:323 Carousel: CSS scroll-snap does the sliding] */
.carousel { position: relative; border-radius: var(--radius-lg); overflow: hidden; background: #0f172a; outline-offset: 3px; }
.carousel-track { display: flex; overflow-x: auto; scroll-snap-type: x mandatory; scroll-behavior: smooth; scrollbar-width: none; overscroll-behavior-x: contain; }
.carousel-track::-webkit-scrollbar { display: none; }
.slide { flex: 0 0 100%; min-width: 0; scroll-snap-align: start; position: relative; aspect-ratio: 16 / 8; min-height: 15rem; }
.carousel-compact .slide { aspect-ratio: 16 / 10; }
.slide img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.slide-caption { position: absolute; left: 0; right: 0; bottom: 0; padding: 3.5rem 1.5rem 2.6rem; color: #fff; background: linear-gradient(transparent, rgb(2 6 23 / .78)); }
.slide-caption h3 { font-size: 1.35rem; margin-bottom: .3rem; }
.slide-caption p { color: rgb(255 255 255 / .85); font-size: .9rem; max-width: 34rem; }
.carousel-btn { position: absolute; top: 50%; transform: translateY(-50%); width: 2.6rem; height: 2.6rem; border-radius: 50%; border: 0; display: grid; place-items: center; cursor: pointer; background: rgb(255 255 255 / .9); color: #0f172a; box-shadow: var(--shadow); opacity: 0; transition: opacity .2s; }
.carousel:hover .carousel-btn, .carousel:focus-within .carousel-btn { opacity: 1; }
.carousel-btn.prev { left: .9rem; } .carousel-btn.next { right: .9rem; }
.carousel-dots { position: absolute; bottom: .9rem; left: 0; right: 0; display: flex; justify-content: center; gap: .45rem; }
.carousel-dots button { width: .55rem; height: .55rem; border-radius: 999px; border: 0; padding: 0; background: rgb(255 255 255 / .5); cursor: pointer; transition: width .3s var(--ease), background .3s; }
.carousel-dots button[aria-current="true"] { width: 1.6rem; background: #fff; }
.carousel-progress { position: absolute; top: 0; left: 0; height: 3px; background: var(--primary); width: 0; z-index: 2; }
.carousel-play { position: absolute; top: .8rem; right: .8rem; z-index: 2; }
@media (hover: none) { .carousel-btn { opacity: 1; width: 2.2rem; height: 2.2rem; } }
/* [/lesson:323] */

/* [lesson:324 Gallery: the image box keeps its size before the picture arrives] */
.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 11rem), 1fr)); gap: .75rem; }
.gallery figure { margin: 0; border-radius: var(--radius); overflow: hidden; position: relative; background: var(--surface-3); aspect-ratio: 4 / 3; }
.gallery img { width: 100%; height: 100%; object-fit: cover; opacity: 0; transition: opacity .5s ease, transform .4s var(--ease); }
.gallery img.loaded { opacity: 1; }
.gallery figure:hover img { transform: scale(1.04); }
.gallery figcaption { position: absolute; left: 0; right: 0; bottom: 0; padding: 1.2rem .6rem .45rem; font-size: .75rem; color: #fff; background: linear-gradient(transparent, rgb(0 0 0 / .65)); }
.gallery button { all: unset; display: block; width: 100%; height: 100%; cursor: zoom-in; }
.gallery button:focus-visible { outline: 3px solid var(--ring); outline-offset: -3px; }
.infinite-sentinel { display: flex; justify-content: center; padding: 1.25rem; color: var(--text-3); font-size: .85rem; gap: .6rem; align-items: center; }
.scroll-box { max-height: 32rem; overflow-y: auto; border: 1px solid var(--border); border-radius: var(--radius); padding: 1rem; background: var(--surface-2); }
/* [/lesson:324] */

/* [lesson:326 Notes and the context menu] */
.notes { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 13rem), 1fr)); gap: .9rem; }
.note {
  --nc: #fef3c7; --nt: #713f12; background: var(--nc); color: var(--nt); border-radius: var(--radius); padding: .9rem 1rem; min-height: 8.5rem;
  display: flex; flex-direction: column; gap: .35rem; position: relative; box-shadow: 0 1px 2px rgb(0 0 0 / .08), 0 8px 18px -12px rgb(0 0 0 / .35);
  cursor: context-menu; user-select: none; -webkit-touch-callout: none; transition: transform .15s;
}
.note:hover { transform: rotate(-.6deg) translateY(-2px); }
.note.green { --nc: #dcfce7; --nt: #14532d; } .note.blue { --nc: #dbeafe; --nt: #1e3a8a; } .note.pink { --nc: #fce7f3; --nt: #831843; }
.note.purple { --nc: #ede9fe; --nt: #4c1d95; } .note.gray { --nc: #e5e7eb; --nt: #1f2937; }
html[data-theme="dark"] .note { --nc: #4a3a12; --nt: #fde68a; }
html[data-theme="dark"] .note.green { --nc: #16361f; --nt: #bbf7d0; } html[data-theme="dark"] .note.blue { --nc: #172a4f; --nt: #bfdbfe; }
html[data-theme="dark"] .note.pink { --nc: #4a1a35; --nt: #fbcfe8; } html[data-theme="dark"] .note.purple { --nc: #2e2257; --nt: #ddd6fe; }
html[data-theme="dark"] .note.gray { --nc: #2a3242; --nt: #e5e7eb; }
.note h4 { margin: 0; font-size: .95rem; padding-right: 1.4rem; word-break: break-word; }
.note p { margin: 0; font-size: .82rem; opacity: .85; word-break: break-word; }
.note .pin { position: absolute; top: .7rem; right: .7rem; opacity: .8; }
.note:focus-visible { outline: 3px solid var(--primary); outline-offset: 3px; }
.note.flash { animation: flash .6s; }
@keyframes flash { 50% { transform: scale(1.04); } }
.context-menu {
  position: fixed; z-index: 500; min-width: 12.5rem; padding: .35rem; border-radius: .75rem; background: var(--surface); border: 1px solid var(--border);
  box-shadow: var(--shadow-lg); animation: menu-in .12s ease; font-size: .86rem;
}
.context-menu [role="menuitem"] { display: flex; align-items: center; gap: .65rem; width: 100%; padding: .48rem .65rem; border: 0; border-radius: .5rem; background: none; color: var(--text); font: inherit; cursor: pointer; text-align: left; }
.context-menu [role="menuitem"]:hover, .context-menu [role="menuitem"]:focus { background: var(--primary-soft); color: var(--primary-text); outline: none; }
.context-menu [role="menuitem"].danger { color: var(--danger); }
.context-menu [role="menuitem"].danger:hover, .context-menu [role="menuitem"].danger:focus { background: var(--danger-soft); }
.context-menu [role="menuitem"] kbd { margin-left: auto; font-size: .65rem; }
.context-menu hr { border: 0; height: 1px; background: var(--border); margin: .3rem .2rem; }
.context-menu .menu-colors { display: flex; gap: .4rem; padding: .4rem .65rem .5rem; }
.context-menu .menu-colors button { width: 1.35rem; height: 1.35rem; border-radius: 50%; border: 2px solid transparent; cursor: pointer; background: var(--nc); padding: 0; }
.context-menu .menu-colors button:focus, .context-menu .menu-colors button[aria-pressed="true"] { border-color: var(--text); outline: none; }
.context-menu .menu-label { font-size: .7rem; color: var(--text-3); padding: .35rem .65rem 0; text-transform: uppercase; letter-spacing: .05em; font-weight: 700; }
@keyframes menu-in { from { opacity: 0; transform: scale(.96); } }
/* [/lesson:326] */

/* [lesson:327 Kanban board, the drag ghost and the drop placeholder] */
.board { display: grid; grid-template-columns: repeat(3, minmax(12.5rem, 1fr)); gap: .85rem; overflow-x: auto; padding-bottom: .25rem; }
.column { background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: .75rem; display: flex; flex-direction: column; gap: .6rem; min-height: 18rem; }
.column-head { display: flex; align-items: center; gap: .5rem; font-weight: 700; font-size: .85rem; padding: .1rem .25rem .3rem; }
.column-head .dot { width: .6rem; height: .6rem; border-radius: 50%; }
.column-head .count { margin-left: auto; font-size: .72rem; background: var(--surface); padding: 0 .5rem; border-radius: 999px; color: var(--text-3); border: 1px solid var(--border); }
.column-body { display: flex; flex-direction: column; gap: .6rem; flex: 1; border-radius: var(--radius); transition: background .15s; min-height: 3rem; }
.column.over .column-body { background: var(--primary-soft); }
.task {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: .7rem .8rem; box-shadow: var(--shadow-sm);
  cursor: grab; touch-action: none; display: flex; gap: .55rem; align-items: flex-start; font-size: .88rem; user-select: none;
}
.task .grip { color: var(--text-3); margin-top: .1rem; }
.task:focus-visible { outline: 3px solid var(--ring); }
.task-title { font-weight: 600; flex: 1; }
.task.lifted { opacity: .35; }
.task-ghost { position: fixed; z-index: 600; pointer-events: none; transform: rotate(2.5deg); box-shadow: var(--shadow-lg); cursor: grabbing; opacity: .95; }
.placeholder { border: 2px dashed var(--primary); border-radius: var(--radius); background: var(--primary-soft); flex: none; }
.label { font-size: .68rem; font-weight: 700; padding: .05rem .45rem; border-radius: 999px; }
.label-Design { background: #fce7f3; color: #9d174d; } .label-Feature { background: #dbeafe; color: #1e40af; } .label-Bug { background: #fee2e2; color: #b91c1c; }
.label-Docs { background: #fef9c3; color: #854d0e; } .label-Backend { background: #dcfce7; color: #166534; }
html[data-theme="dark"] .label { filter: brightness(.85) saturate(.9); }
body.dragging, body.dragging * { cursor: grabbing !important; }
/* [/lesson:327] */

/* [lesson:328 Lightbox: only transform changes while zooming] */
.lightbox { position: fixed; inset: 0; z-index: 450; background: rgb(2 6 23 / .92); display: flex; flex-direction: column; animation: fade-in .2s; color: #fff; }
.lb-bar { display: flex; align-items: center; gap: .4rem; padding: .6rem .9rem; flex-wrap: wrap; }
.lb-bar .lb-title { font-weight: 600; margin-right: auto; font-size: .9rem; }
.lb-bar button { width: 2.4rem; height: 2.4rem; border-radius: .6rem; border: 0; background: rgb(255 255 255 / .1); color: #fff; display: grid; place-items: center; cursor: pointer; }
.lb-bar button:hover { background: rgb(255 255 255 / .2); }
.lb-zoom { font-family: var(--mono); font-size: .8rem; width: 3.5rem; text-align: center; }
.lb-stage { flex: 1; overflow: hidden; position: relative; touch-action: none; cursor: grab; display: grid; place-items: center; }
.lb-stage.panning { cursor: grabbing; }
.lb-stage img { max-width: 92%; max-height: 92%; transform-origin: 0 0; user-select: none; -webkit-user-drag: none; will-change: transform; position: absolute; left: 0; top: 0; }
.lb-hint { text-align: center; font-size: .75rem; color: rgb(255 255 255 / .6); padding: .5rem; }
/* [/lesson:328] */

/* [lesson:330 :fullscreen styles the element while it fills the screen] */
.fs-card:fullscreen { background: var(--surface); padding: 2rem; overflow: auto; display: flex; flex-direction: column; justify-content: center; }
.fs-card:fullscreen .chart { max-width: 70rem; margin: 0 auto; width: 100%; }
::backdrop { background: var(--bg); }
.chart { width: 100%; height: auto; }
.chart .bar { fill: var(--primary); transition: opacity .2s; }
.chart .bar:hover { opacity: .8; }
.chart text { fill: var(--text-2); font-size: 12px; font-family: var(--font); }
.chart .grid-line { stroke: var(--border); }
/* [/lesson:330] */

.kbd-view { display: flex; align-items: center; justify-content: center; gap: .4rem; min-height: 4.5rem; font-size: 1.1rem; border: 1.5px dashed var(--border-strong); border-radius: var(--radius); color: var(--text-3); }
.kbd-view kbd { font-size: 1rem; padding: .45rem .7rem; }
.article { max-width: 46rem; }
.article h3 { margin-top: 1.75rem; }
.article p { color: var(--text-2); }
.scroll-meter { position: sticky; top: calc(var(--topbar-h) + .5rem); z-index: 5; display: flex; align-items: center; gap: .75rem; padding: .5rem .75rem; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow-sm); margin-bottom: 1rem; font-size: .82rem; }
.scroll-meter .progress { flex: 1; }

/* [lesson:313,323,329 Respect "reduce motion": no animation, no smooth scrolling] */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; scroll-behavior: auto !important; }
  .spinner, .btn.is-loading::after { animation: spin 1.5s linear infinite !important; animation-duration: 1.5s !important; animation-iteration-count: infinite !important; }
}
/* [/lesson:313,323,329] */

@media print { .sidebar, .topbar, .back-to-top, .toast-stack, .footer { display: none !important; } .app { display: block; } }
