:root {
  --primary: #6366f1;
  --primary-hover: #4f46e5;
  --primary-tint: #eef2ff;
  --brand: #20970b;
  --neutral: #9c9c9c;
  --bg: #fafafa;
  --surface: #ffffff;
  --text: #0a0a0a;
  --text-2: #6b6b6b;
  --border: #e8e8ec;
  --alt: #f4f4f5;
  --success: #10b981;
  --warning: #f59e0b;
  --error: #ef4444;
  --radius-sm: 4px;
  --radius-control: 6px;
  --radius-panel: 8px;
  --radius-card: 12px;
  --radius-pill: 9999px;
  --shadow-hover: 0 8px 30px rgba(0, 0, 0, 0.08);
  --shadow-primary: 0 4px 12px rgba(99, 102, 241, 0.35);
  --shadow-popover: 0 16px 48px rgba(10, 10, 10, 0.14);
  --ring: 0 0 0 3px rgba(99, 102, 241, 0.12);
  --container: 1280px;
  --font-display: "General Sans", "DM Sans", "Pretendard", "Noto Sans KR", "Apple SD Gothic Neo", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-body: "DM Sans", "Pretendard", "Noto Sans KR", "Apple SD Gothic Neo", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-mono: "JetBrains Mono", "SFMono-Regular", ui-monospace, Consolas, monospace;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

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

body[data-view="deck"] {
  overflow: hidden;
}

body[data-view="deck"] .site-nav {
  display: none;
}

body[data-view="deck"] .site-foot {
  display: none;
}

[hidden] {
  display: none !important;
}

img {
  max-width: 100%;
}

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

button {
  font: inherit;
  color: inherit;
}

::selection {
  background: var(--primary-tint);
  color: var(--text);
}

:where(a, button, input, select, summary):focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

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

.skip {
  position: absolute;
  left: 16px;
  top: -64px;
  z-index: 100;
  padding: 10px 14px;
  border: 0;
  border-radius: var(--radius-control);
  background: var(--text);
  color: var(--bg);
  font: 500 13px/1 var(--font-body);
  cursor: pointer;
}

.skip:focus {
  top: 12px;
}

body[data-view="deck"] .skip {
  display: none;
}

.overline {
  margin: 0;
  font: 500 11px/1.4 var(--font-body);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-2);
}

kbd {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 22px;
  padding: 0 5px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--alt);
  color: var(--neutral);
  font: 400 11px/1 var(--font-mono);
}

/* ------------------------------------------------------------------- nav */

.site-nav {
  position: sticky;
  top: 0;
  z-index: 60;
  background: rgba(255, 255, 255, 0.82);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border);
}

.nav-inner {
  position: relative;
  display: flex;
  align-items: center;
  gap: 32px;
  max-width: var(--container);
  height: 56px;
  margin: 0 auto;
  padding: 0 24px;
}

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

.brand-word {
  font: 700 18px/1 var(--font-display);
  letter-spacing: -0.02em;
  color: var(--text);
}

.brand-highlight {
  color: var(--brand);
}

.nav-links {
  position: absolute;
  left: 50%;
  display: flex;
  gap: 4px;
  transform: translateX(-50%);
}

.nav-links a {
  padding: 8px 12px;
  border-radius: var(--radius-control);
  font: 500 14px/1 var(--font-body);
  color: var(--text-2);
  text-decoration: none;
  transition: background 0.2s ease, color 0.2s ease;
}

.nav-links a:hover {
  background: var(--alt);
  color: var(--text);
}

.nav-links a[aria-current="page"] {
  background: var(--primary-tint);
  color: var(--primary);
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: none;
  margin-left: auto;
}

.search-trigger {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 230px;
  height: 38px;
  padding: 0 8px 0 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  background: var(--surface);
  color: var(--text-2);
  font: 400 14px/1 var(--font-body);
  text-align: left;
  cursor: pointer;
  transition: border-color 0.2s ease, color 0.2s ease, box-shadow 0.2s ease;
}

.search-trigger svg {
  width: 16px;
  height: 16px;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.search-trigger:hover {
  border-color: #d4d4d8;
  color: var(--text);
}

.search-trigger kbd {
  margin-left: auto;
}

.menu-btn {
  display: none;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border: 1px solid var(--border);
  border-radius: var(--radius-control);
  background: var(--surface);
  color: var(--text-2);
  cursor: pointer;
}

.menu-btn svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
}

.menu-btn:hover {
  background: var(--alt);
  color: var(--text);
}

.mobile-menu {
  position: absolute;
  top: 56px;
  left: 0;
  right: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
  max-height: calc(100vh - 56px);
  padding: 8px;
  overflow-y: auto;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  box-shadow: var(--shadow-popover);
}

.mobile-menu a,
.mobile-menu button {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  border: 0;
  border-radius: var(--radius-control);
  background: transparent;
  color: var(--text);
  font: 500 14px/1 var(--font-body);
  text-align: left;
  text-decoration: none;
  cursor: pointer;
}

.mobile-menu a:hover,
.mobile-menu button:hover {
  background: var(--alt);
}

.mobile-menu > a[aria-current="page"] {
  background: var(--primary-tint);
  color: var(--primary);
}

.mobile-course-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-bottom: 6px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--border);
}

.mobile-course-list a {
  padding: 10px 14px;
  border-radius: var(--radius-control);
  color: var(--text-2);
  font: 500 13px/1.2 var(--font-body);
  text-decoration: none;
}

.mobile-course-list a:hover {
  background: var(--alt);
  color: var(--text);
}

.mobile-course-list a[aria-current="page"] {
  background: var(--primary-tint);
  color: var(--primary);
}

/* ------------------------------------------------------------------ hero */

.hero {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 0.95fr);
  align-items: center;
  gap: 64px;
  max-width: var(--container);
  margin: 0 auto;
  padding: 96px 24px 80px;
}

.hero-copy,
.hero-preview {
  position: relative;
  z-index: 1;
}

.dot-grid {
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background-image: radial-gradient(circle, #d4d4d8 1px, transparent 1.3px);
  background-size: 24px 24px;
  opacity: 0.7;
  -webkit-mask-image: linear-gradient(90deg, transparent 0%, transparent 38%, #000 62%, #000 100%);
  mask-image: linear-gradient(90deg, transparent 0%, transparent 38%, #000 62%, #000 100%);
}

.dot-grid::after {
  content: "";
  position: absolute;
  inset: 0;
  background-image: radial-gradient(circle, rgba(99, 102, 241, 0.55) 1px, transparent 1.4px);
  background-size: 24px 24px;
  opacity: 0;
  transition: opacity 0.25s ease;
  -webkit-mask-image: radial-gradient(190px circle at var(--mx, 72%) var(--my, 32%), #000 0%, transparent 70%);
  mask-image: radial-gradient(190px circle at var(--mx, 72%) var(--my, 32%), #000 0%, transparent 70%);
}

.hero:hover .dot-grid::after {
  opacity: 1;
}

.hero-copy .overline {
  margin-bottom: 20px;
}

.hero h1 {
  margin: 0 0 24px;
  font: 700 clamp(44px, 6vw, 72px) / 1.02 var(--font-display);
  letter-spacing: -0.04em;
  color: var(--text);
  word-break: keep-all;
}

.lede {
  max-width: 50ch;
  margin: 0 0 32px;
  font: 400 15px/1.7 var(--font-body);
  color: var(--text-2);
  word-break: keep-all;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.hero-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 24px 40px;
  margin: 48px 0 0;
  padding: 20px 0 0;
  border-top: 1px solid var(--border);
}

.hero-stats > div {
  flex: 1 1 0;
  min-width: 96px;
}

.hero-stats dt {
  font: 500 11px/1.4 var(--font-body);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-2);
}

.hero-stats dd {
  margin: 8px 0 0;
  font: 700 24px/1 var(--font-display);
  letter-spacing: -0.03em;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

.hero-preview {
  justify-self: end;
  width: 100%;
  max-width: 460px;
}

.preview-card {
  display: block;
  margin: 0;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  background: var(--surface);
  color: var(--text);
  text-decoration: none;
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.preview-card:hover {
  transform: translateY(-2px);
  border-color: #dcdce2;
  box-shadow: var(--shadow-hover);
}

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 18px;
  font: 500 13px/1 var(--font-body);
  color: var(--text-2);
  text-decoration: none;
}

.back-link:hover {
  color: var(--primary);
}

.preview-media {
  aspect-ratio: 16 / 9;
  overflow: hidden;
  border-bottom: 1px solid var(--border);
  background: var(--alt);
}

.preview-media img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: top left;
}

.preview-body {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 16px;
}

.preview-body .overline {
  margin-bottom: 6px;
}

.preview-body strong {
  font: 700 18px/1.2 var(--font-display);
  letter-spacing: -0.02em;
  color: var(--text);
}

.preview-meta {
  flex: none;
  font: 400 13px/1.3 var(--font-body);
  color: var(--text-2);
  white-space: nowrap;
}

.preview-hint {
  margin: 12px 0 0;
  font: 400 12px/1.5 var(--font-body);
  color: var(--neutral);
  text-align: right;
}

/* --------------------------------------------------------------- buttons */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 44px;
  padding: 0 24px;
  border: 1px solid transparent;
  border-radius: var(--radius-control);
  font: 500 14px/1 var(--font-body);
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  transition: background 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
}

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

.btn-primary:hover {
  background: var(--primary-hover);
  border-color: var(--primary-hover);
  box-shadow: var(--shadow-primary);
  transform: translateY(-1px);
}

.btn-secondary {
  background: transparent;
  border-color: var(--border);
  color: var(--text);
}

.btn-secondary:hover {
  background: var(--alt);
  border-color: #d4d4d8;
  transform: translateY(-1px);
}

/* ------------------------------------------------------------- collection */

.collection {
  max-width: var(--container);
  margin: 0 auto;
  padding: 64px 24px 0;
  scroll-margin-top: 72px;
}

.section-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 32px;
  margin-bottom: 32px;
}

.section-head h2 {
  margin: 8px 0 10px;
  font: 700 32px/1.15 var(--font-display);
  letter-spacing: -0.03em;
  color: var(--text);
}

.section-desc {
  max-width: 62ch;
  margin: 0;
  font: 400 15px/1.65 var(--font-body);
  color: var(--text-2);
  word-break: keep-all;
}

.chip-tabs {
  display: inline-flex;
  flex: none;
  gap: 4px;
  padding: 4px;
  border-radius: var(--radius-pill);
  background: var(--alt);
}

.chip-tabs button {
  height: 32px;
  padding: 0 14px;
  border: 0;
  border-radius: var(--radius-pill);
  background: transparent;
  color: var(--text-2);
  font: 500 13px/1 var(--font-body);
  white-space: nowrap;
  cursor: pointer;
  transition: background 0.2s ease, color 0.2s ease;
}

.chip-tabs button:hover {
  color: var(--text);
}

.chip-tabs button[aria-selected="true"] {
  background: var(--primary);
  color: #fff;
}

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

.kit-card {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  background: var(--surface);
  color: var(--text);
  text-decoration: none;
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.kit-card:hover {
  transform: translateY(-2px);
  border-color: #dcdce2;
  box-shadow: var(--shadow-hover);
}

.kit-card:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

.kit-cover {
  height: 200px;
  overflow: hidden;
  border-bottom: 1px solid var(--border);
  background: var(--alt);
}

.kit-cover img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: top center;
  transition: transform 0.2s ease;
}

.kit-card:hover .kit-cover img {
  transform: scale(1.02);
}

.kit-body {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 16px;
}

.kit-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}

.kit-title {
  margin: 0;
  font: 700 20px/1.25 var(--font-display);
  letter-spacing: -0.03em;
  color: var(--text);
}

.kit-en {
  flex: none;
  font: 400 12px/1.2 var(--font-body);
  color: var(--neutral);
}

.kit-topics {
  margin: 0;
  overflow: hidden;
  font: 400 13px/1.5 var(--font-body);
  color: var(--text-2);
  white-space: nowrap;
  text-overflow: ellipsis;
}

.kit-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 2px;
  font: 400 12px/1.4 var(--font-body);
  color: var(--neutral);
}

.avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: none;
  width: 24px;
  height: 24px;
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  background: var(--alt);
  color: var(--text-2);
  font: 500 9px/1 var(--font-body);
  letter-spacing: 0.02em;
}

.kit-progress {
  margin-left: auto;
  color: var(--text-2);
  font-weight: 500;
  font-variant-numeric: tabular-nums;
}

.kit-bar {
  height: 3px;
  margin-top: 2px;
  overflow: hidden;
  border-radius: 2px;
  background: var(--alt);
}

.kit-bar span {
  display: block;
  height: 100%;
  border-radius: 2px;
  background: var(--success);
}

/* ------------------------------------------------------------ course list */

.course-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.course-card {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr) auto;
  gap: 24px;
  align-items: center;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  background: var(--surface);
  color: var(--text);
  text-decoration: none;
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.course-card:hover {
  transform: translateY(-2px);
  border-color: #dcdce2;
  box-shadow: var(--shadow-hover);
}

.course-card:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

.course-cover {
  height: 158px;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: var(--radius-panel);
  background: var(--alt);
}

.course-cover img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: top center;
}

.course-body {
  display: flex;
  flex-direction: column;
  gap: 5px;
  min-width: 0;
}

.course-topline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.course-count {
  flex: none;
  font: 400 12px/1.4 var(--font-body);
  color: var(--neutral);
}

.course-title {
  margin: 0;
  font: 700 26px/1.2 var(--font-display);
  letter-spacing: -0.03em;
  color: var(--text);
}

.course-en {
  margin: 0;
  font: 400 13px/1.4 var(--font-body);
  color: var(--neutral);
}

.course-desc {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  overflow: hidden;
  max-width: 72ch;
  margin: 2px 0 0;
  font: 400 14px/1.6 var(--font-body);
  color: var(--text-2);
  word-break: keep-all;
}

.course-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-top: 4px;
  font: 400 12px/1.4 var(--font-body);
  color: var(--text-2);
}

.chip-tag {
  display: inline-flex;
  align-items: center;
  height: 24px;
  padding: 0 10px;
  border-radius: var(--radius-pill);
  background: var(--alt);
  color: var(--text-2);
  font: 500 11px/1 var(--font-body);
  white-space: nowrap;
}

.course-progress {
  display: flex;
  flex-direction: column;
  gap: 5px;
  max-width: 360px;
  margin-top: 6px;
}

.course-progress-row {
  display: grid;
  grid-template-columns: 54px minmax(0, 1fr) 34px;
  align-items: center;
  gap: 8px;
  font: 400 11px/1 var(--font-body);
  color: var(--neutral);
}

.course-progress-row .bar {
  height: 3px;
  overflow: hidden;
  border-radius: 2px;
  background: var(--alt);
}

.course-progress-row .bar span {
  display: block;
  height: 100%;
  border-radius: 2px;
  background: var(--success);
}

.course-arrow {
  font: 400 20px/1 var(--font-body);
  color: var(--neutral);
  transition: color 0.2s ease, transform 0.2s ease;
}

.course-card:hover .course-arrow {
  color: var(--primary);
  transform: translateX(2px);
}

/* ----------------------------------------------------------------- footer */

.site-foot {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  flex-wrap: wrap;
  max-width: var(--container);
  margin: 96px auto 0;
  padding: 24px;
  border-top: 1px solid var(--border);
  font: 400 13px/1.6 var(--font-body);
  color: var(--text-2);
}

.site-foot .overline {
  margin-bottom: 6px;
}

.site-foot p {
  margin: 0;
}

.foot-meta {
  color: var(--neutral);
  text-align: right;
  font-variant-numeric: tabular-nums;
}

/* ----------------------------------------------------------------- viewer */

#viewer {
  position: fixed;
  inset: 0;
  z-index: 70;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--text);
}

.viewer-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: none;
  min-height: 56px;
  padding: 9px 20px;
  border-bottom: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: none;
  width: 38px;
  height: 38px;
  border: 1px solid var(--border);
  border-radius: var(--radius-control);
  background: var(--surface);
  color: var(--text-2);
  text-decoration: none;
  cursor: pointer;
  transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

.icon-btn svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.icon-btn:hover {
  background: var(--alt);
  border-color: #d4d4d8;
  color: var(--primary);
}

.icon-btn:disabled {
  opacity: 0.4;
  cursor: default;
  background: var(--surface);
  border-color: var(--border);
  color: var(--neutral);
}

.viewer-ident {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1;
  min-width: 0;
}

.deck-num {
  display: inline-flex;
  align-items: center;
  flex: none;
  height: 24px;
  padding: 0 7px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--alt);
  color: var(--text-2);
  font: 500 11px/1 var(--font-body);
  letter-spacing: 0.03em;
}

.viewer-titles {
  min-width: 0;
}

.viewer-titles h1 {
  margin: 0 0 3px;
  overflow: hidden;
  font: 700 16px/1.2 var(--font-display);
  letter-spacing: -0.02em;
  color: var(--text);
  white-space: nowrap;
  text-overflow: ellipsis;
}

.viewer-titles p {
  margin: 0;
  overflow: hidden;
  font: 500 10px/1.2 var(--font-body);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-2);
  white-space: nowrap;
  text-overflow: ellipsis;
}

.viewer-controls {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: none;
  min-width: 0;
}

.select-wrap {
  position: relative;
  min-width: 0;
}

.select-wrap::after {
  content: "";
  position: absolute;
  top: 50%;
  right: 12px;
  width: 6px;
  height: 6px;
  border-right: 1.5px solid var(--text-2);
  border-bottom: 1.5px solid var(--text-2);
  transform: translateY(-70%) rotate(45deg);
  pointer-events: none;
}

.select-wrap select {
  height: 38px;
  max-width: 200px;
  padding: 0 32px 0 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-control);
  background: var(--surface);
  color: var(--text);
  font: 400 14px/1 var(--font-body);
  appearance: none;
  cursor: pointer;
}

.select-wrap select:hover {
  border-color: #d4d4d8;
}

.chip-tabs-sm {
  padding: 3px;
}

.chip-tabs-sm button {
  height: 30px;
  padding: 0 12px;
  font-size: 12px;
}

.deck-stage {
  position: relative;
  flex: 1;
  min-height: 0;
  background: var(--alt);
  overflow: hidden;
}

.deck-stage.mode-paged {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px;
}

.slide-frame {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
}

.slide-frame img {
  width: auto;
  height: auto;
  max-width: 100%;
  max-height: 100%;
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  background: var(--surface);
  opacity: 0;
  transition: opacity 0.2s ease;
}

.slide-frame img.is-ready {
  opacity: 1;
}

.deck-stage.mode-scroll {
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  scroll-behavior: smooth;
  scroll-snap-type: y mandatory;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.deck-stage.mode-scroll::-webkit-scrollbar {
  display: none;
}

.scroll-track {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0;
  width: 100%;
  padding: 0;
}

.scroll-card {
  display: flex;
  align-items: center;
  justify-content: center;
  flex: none;
  width: 100%;
  height: var(--stage-height, 100dvh);
  margin: 0;
  padding: 24px;
  border: 0;
  border-radius: 0;
  background: transparent;
  scroll-snap-align: start;
  scroll-snap-stop: always;
}

.scroll-card img {
  display: block;
  width: auto;
  height: auto;
  max-width: 100%;
  max-height: 100%;
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  background: var(--surface);
}

.viewer-foot {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: none;
  padding: 10px 20px;
  border-top: 1px solid var(--border);
  background: var(--surface);
}

.nav-btn {
  width: 38px;
  height: 38px;
}

.page-rail {
  display: flex;
  align-items: center;
  gap: 14px;
  flex: 1;
  min-width: 0;
}

#page-range {
  flex: 1;
  min-width: 0;
  height: 20px;
  accent-color: var(--primary);
  cursor: pointer;
}

.page-label {
  min-width: 76px;
  text-align: right;
  font: 500 13px/1 var(--font-body);
  font-variant-numeric: tabular-nums;
  color: var(--text-2);
}

/* --------------------------------------------------------------- dialogs */

.dialog {
  padding: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius-panel);
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow-popover);
}

.dialog::backdrop {
  background: rgba(10, 10, 10, 0.38);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
}

.overview-dialog {
  width: min(1120px, 94vw);
  max-height: 88vh;
}

.dialog-head {
  position: sticky;
  top: 0;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 20px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}

.dialog-head .overline {
  margin-bottom: 6px;
}

.dialog-head h2 {
  margin: 0;
  font: 700 20px/1.2 var(--font-display);
  letter-spacing: -0.02em;
}

.thumb-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(132px, 1fr));
  gap: 12px;
  max-height: calc(88vh - 78px);
  padding: 20px;
  overflow-y: auto;
}

.thumb {
  position: relative;
  display: block;
  padding: 0;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: var(--radius-panel);
  background: var(--alt);
  text-align: left;
  cursor: pointer;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.thumb img {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: var(--thumb-aspect, 16 / 9);
  object-fit: cover;
  object-position: top center;
  opacity: 0.96;
}

.thumb:hover {
  border-color: var(--primary);
}

.thumb.is-current {
  border-color: var(--primary);
  box-shadow: var(--ring);
}

.thumb span {
  position: absolute;
  left: 6px;
  bottom: 6px;
  padding: 3px 5px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text-2);
  font: 500 9px/1 var(--font-mono);
}

.thumb.is-current span {
  border-color: var(--primary);
  background: var(--primary);
  color: #fff;
}

/* ---------------------------------------------------------------- search */

.search-dialog {
  width: min(640px, calc(100vw - 32px));
  margin: 10vh auto auto;
  border-radius: var(--radius-card);
}

.search-box {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
}

.search-box svg {
  width: 18px;
  height: 18px;
  flex: none;
  fill: none;
  stroke: var(--text-2);
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.search-box input {
  flex: 1;
  min-width: 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--text);
  font: 400 16px/1.5 var(--font-body);
}

.search-box input::placeholder {
  color: var(--neutral);
}

.search-results {
  max-height: min(52vh, 460px);
  padding: 8px;
  overflow-y: auto;
}

.search-result {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 10px 12px;
  border: 0;
  border-radius: var(--radius-panel);
  background: transparent;
  color: var(--text);
  text-align: left;
  cursor: pointer;
}

.search-result + .search-result {
  margin-top: 2px;
}

.search-result:hover,
.search-result.is-active {
  background: var(--alt);
}

.search-result .avatar {
  width: 32px;
  height: 32px;
  font-size: 10px;
}

.search-result-body {
  display: flex;
  flex-direction: column;
  gap: 3px;
  flex: 1;
  min-width: 0;
}

.search-result-title {
  overflow: hidden;
  font: 500 15px/1.3 var(--font-body);
  color: var(--text);
  white-space: nowrap;
  text-overflow: ellipsis;
}

.search-result-title em {
  margin-left: 6px;
  color: var(--neutral);
  font-size: 12px;
  font-style: normal;
}

.search-result-meta {
  overflow: hidden;
  font: 400 12px/1.4 var(--font-body);
  color: var(--text-2);
  white-space: nowrap;
  text-overflow: ellipsis;
}

.search-result-format {
  flex: none;
  padding: 4px 8px;
  border-radius: var(--radius-pill);
  background: var(--alt);
  color: var(--text-2);
  font: 500 11px/1 var(--font-mono);
}

.search-result.is-active .search-result-format {
  background: var(--primary-tint);
  color: var(--primary);
}

.search-empty {
  margin: 0;
  padding: 32px 16px;
  text-align: center;
  font: 400 14px/1.6 var(--font-body);
  color: var(--text-2);
}

.search-foot {
  display: flex;
  gap: 18px;
  flex-wrap: wrap;
  padding: 10px 16px;
  border-top: 1px solid var(--border);
  font: 400 11px/1.4 var(--font-body);
  color: var(--neutral);
}

.search-foot span {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.search-foot kbd {
  min-width: 18px;
  height: 20px;
  font-size: 10px;
}

/* ------------------------------------------------------------- fullscreen */

#deck-stage:fullscreen {
  padding: 0;
  background: var(--alt);
}

#deck-stage:fullscreen .slide-frame img {
  max-height: 100vh;
  border: 0;
  border-radius: 0;
}

#deck-stage:fullscreen .scroll-card {
  padding: 16px;
}

.fs-indicator {
  display: none;
}

#deck-stage:fullscreen .fs-indicator {
  position: fixed;
  right: 20px;
  bottom: 18px;
  z-index: 5;
  display: block;
  padding: 7px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text-2);
  font: 500 12px/1 var(--font-mono);
}

/* ------------------------------------------------------------------- fatal */

.fatal {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: grid;
  place-items: center;
  padding: 24px;
  background: var(--bg);
}

.fatal-card {
  width: min(520px, 100%);
  padding: 32px;
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  background: var(--surface);
}

.fatal-card h1 {
  margin: 8px 0 12px;
  font: 700 28px/1.2 var(--font-display);
  letter-spacing: -0.03em;
}

.fatal-card p {
  margin: 0;
  font: 400 14px/1.7 var(--font-body);
  color: var(--text-2);
}

.fatal-card code {
  padding: 2px 5px;
  border-radius: var(--radius-sm);
  background: var(--alt);
  font: 400 12px/1 var(--font-mono);
}

/* --------------------------------------------------------------- responsive */

@media (max-width: 1120px) {
  .hero {
    gap: 40px;
  }

  .hero-stats {
    gap: 32px;
  }

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

@media (max-width: 900px) {
  .nav-links {
    display: none;
  }

  .menu-btn {
    display: inline-flex;
  }

  .search-trigger {
    min-width: 190px;
  }

  .hero {
    grid-template-columns: 1fr;
    gap: 48px;
    padding: 64px 24px 56px;
  }

  .hero-preview {
    justify-self: start;
    max-width: 560px;
  }

  .dot-grid {
    opacity: 0.55;
    -webkit-mask-image: linear-gradient(180deg, transparent 0%, transparent 42%, #000 68%, #000 100%);
    mask-image: linear-gradient(180deg, transparent 0%, transparent 42%, #000 68%, #000 100%);
  }

  .section-head {
    align-items: flex-start;
    flex-direction: column;
    gap: 20px;
  }
}

@media (max-width: 720px) {
  .nav-inner {
    gap: 12px;
    padding: 0 16px;
  }

  .brand-word {
    font-size: 17px;
  }

  .search-trigger {
    width: 38px;
    min-width: 38px;
    padding: 0;
    justify-content: center;
  }

  .search-trigger .search-label,
  .search-trigger kbd {
    display: none;
  }

  .hero {
    padding: 48px 24px 40px;
  }

  .hero h1 {
    font-size: clamp(40px, 11vw, 56px);
  }

  .hero-actions .btn {
    flex: 1 1 auto;
  }

  .hero-stats {
    gap: 16px 24px;
  }

  .hero-stats > div {
    flex: 1 1 calc(50% - 24px);
    min-width: 0;
  }

  .hero-stats dd {
    font-size: 20px;
  }

  .course-card {
    grid-template-columns: 1fr;
    gap: 14px;
    padding: 14px;
  }

  .course-cover {
    height: auto;
    aspect-ratio: 16 / 9;
  }

  .course-title {
    font-size: 22px;
  }

  .course-arrow {
    display: none;
  }

  .collection {
    padding: 48px 24px 0;
  }

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

  .kit-cover {
    height: 200px;
  }

  .site-foot {
    margin-top: 64px;
    padding: 24px;
  }

  .viewer-bar {
    flex-wrap: wrap;
    gap: 8px;
    padding: 8px 12px;
  }

  .viewer-ident {
    gap: 10px;
  }

  .viewer-titles h1 {
    font-size: 14px;
  }

  .viewer-controls {
    width: 100%;
    gap: 6px;
  }

  .select-wrap {
    flex: 1 1 auto;
  }

  .select-wrap select {
    width: 100%;
    max-width: none;
  }

  .icon-btn {
    width: 34px;
    height: 34px;
  }

  .icon-btn svg {
    width: 16px;
    height: 16px;
  }

  .chip-tabs-sm button {
    height: 28px;
    padding: 0 10px;
    font-size: 11px;
  }

  .deck-stage.mode-paged {
    padding: 12px;
  }

  .slide-frame img {
    border-radius: var(--radius-panel);
  }

  .scroll-card {
    padding: 12px;
  }

  .scroll-card img {
    border-radius: var(--radius-panel);
  }

  .viewer-foot {
    gap: 8px;
    padding: 10px 12px;
  }

  .nav-btn {
    width: 34px;
    height: 34px;
  }

  .page-label {
    min-width: 66px;
    font-size: 12px;
  }

  .overview-dialog {
    width: 96vw;
    max-height: 90vh;
  }

  .dialog-head {
    padding: 14px 16px;
  }

  .thumb-grid {
    grid-template-columns: repeat(auto-fill, minmax(96px, 1fr));
    gap: 8px;
    padding: 12px;
    max-height: calc(90vh - 72px);
  }

  .search-dialog {
    margin-top: 7vh;
  }

  .search-results {
    max-height: 56vh;
  }

  .search-foot {
    gap: 12px;
  }
}

@media (max-width: 360px) {
  .hero-stats {
    gap: 18px;
  }

  .kit-en {
    display: none;
  }

  .search-result-format {
    display: none;
  }
}

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

  .dot-grid::after {
    display: none;
  }
}