:root {
  color-scheme: light;
  --bg: oklch(0.985 0.006 245);
  --surface: oklch(0.97 0.012 245);
  --surface-strong: oklch(0.94 0.028 245);
  --white: oklch(1 0 0);
  --ink: oklch(0.19 0.03 250);
  --muted: oklch(0.45 0.035 250);
  --line: oklch(0.88 0.02 245);
  --blue: oklch(0.53 0.2 255);
  --blue-dark: oklch(0.39 0.17 255);
  --red: oklch(0.58 0.21 27);
  --yellow: oklch(0.86 0.17 90);
  --yellow-soft: oklch(0.96 0.06 90);
  --green: oklch(0.62 0.17 145);
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --shadow-soft: 0 18px 44px oklch(0.19 0.03 250 / 0.11);
  --shadow-float: 0 18px 48px oklch(0.19 0.03 250 / 0.18);
  --focus: 0 0 0 3px oklch(0.86 0.17 90 / 0.56);
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  color: var(--ink);
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  scroll-behavior: smooth;
  text-rendering: optimizeLegibility;
}

body {
  min-height: 100%;
  margin: 0;
  background:
    radial-gradient(circle at 10% 3%, oklch(0.93 0.06 90 / 0.58), transparent 23rem),
    radial-gradient(circle at 92% 0%, oklch(0.92 0.08 255 / 0.42), transparent 25rem),
    linear-gradient(180deg, var(--bg), var(--white) 28rem);
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.65;
}

:focus-visible {
  outline: none;
  box-shadow: var(--focus);
}

.skip-link {
  position: fixed;
  top: 12px;
  left: 12px;
  z-index: 80;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  background: var(--blue);
  color: var(--white);
  transform: translateY(-140%);
  transition: transform 180ms ease-out;
}

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

.app-shell {
  width: min(1460px, calc(100% - 32px));
  margin: 0 auto;
  padding: 32px 0 64px;
}

.brand-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 16px;
  padding: 14px 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: oklch(1 0 0 / 0.9);
  color: var(--ink);
  box-shadow: var(--shadow-soft);
  backdrop-filter: blur(12px);
}

.brand-logo-frame {
  width: 260px;
  height: 62px;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  overflow: hidden;
}

.brand-logo-frame img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: contain;
  object-position: left center;
}

.brand-meta {
  display: grid;
  gap: 2px;
  text-align: right;
}

.brand-meta span {
  color: var(--blue-dark);
  font-size: 0.82rem;
  font-weight: 800;
}

.brand-meta strong {
  color: var(--ink);
  font-size: 1rem;
  letter-spacing: 0.02em;
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 386px;
  gap: 28px;
  align-items: stretch;
  padding: 28px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: oklch(1 0 0 / 0.86);
  box-shadow: var(--shadow-soft);
}

.hero-copy {
  min-height: 365px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.social-badges {
  display: flex;
  gap: 8px;
  margin-bottom: 22px;
}

.social-dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
}

.social-dot-blue {
  background: var(--blue);
}

.social-dot-red {
  background: var(--red);
}

.social-dot-yellow {
  background: var(--yellow);
}

.social-dot-green {
  background: var(--green);
}

.kicker,
.panel-label,
.dialog-label,
.filter-label {
  margin: 0 0 10px;
  color: var(--blue-dark);
  font-size: 0.92rem;
  font-weight: 780;
}

h1,
h2,
h3,
p {
  text-wrap: pretty;
}

h1 {
  max-width: 780px;
  margin: 0;
  font-size: clamp(2.1rem, 5vw, 4.65rem);
  line-height: 1.04;
  letter-spacing: -0.025em;
  text-wrap: balance;
}

.hero-text {
  max-width: 62ch;
  margin: 22px 0 0;
  color: var(--muted);
  font-size: 1.08rem;
  line-height: 1.72;
}

.notice {
  max-width: 72ch;
  margin-top: 22px;
  padding: 13px 15px;
  border: 1px solid oklch(0.86 0.1 90);
  border-radius: var(--radius-md);
  background: var(--yellow-soft);
  color: oklch(0.31 0.07 80);
  line-height: 1.62;
}

.action-panel,
.reference-panel,
.toolbar,
.category-toolbar,
.category {
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--white);
}

.action-panel {
  display: flex;
  flex-direction: column;
  gap: 20px;
  padding: 22px;
}

.save-state {
  margin: 0;
  color: var(--muted);
  line-height: 1.55;
}

.instructor-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  border: 1px solid oklch(0.88 0.08 90);
  border-radius: var(--radius-md);
  background: var(--yellow-soft);
}

.instructor-photo {
  width: 62px;
  height: 62px;
  flex: 0 0 auto;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--white);
}

.instructor-label,
.instructor-name {
  margin: 0;
}

.instructor-label {
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 720;
}

.instructor-name {
  margin-top: 2px;
  color: var(--ink);
  font-size: 1rem;
  font-weight: 850;
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.summary-grid div {
  padding: 14px;
  border-radius: var(--radius-md);
  background: var(--surface);
}

.summary-grid span {
  display: block;
  color: var(--ink);
  font-size: 1.55rem;
  font-weight: 850;
  line-height: 1;
}

.summary-grid small {
  display: block;
  margin-top: 7px;
  color: var(--muted);
  line-height: 1.35;
}

.action-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.button {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 11px 15px;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  font-weight: 780;
  transition: transform 160ms ease-out, background 160ms ease-out, border-color 160ms ease-out;
}

.button:active {
  transform: translateY(1px);
}

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

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

.button.secondary {
  background: var(--white);
  color: var(--blue-dark);
  border-color: oklch(0.75 0.09 255);
}

.button.secondary:hover,
.button.ghost:hover {
  background: var(--surface);
}

.button.ghost {
  width: 100%;
  background: transparent;
  color: var(--muted);
  border-color: var(--line);
}

.button.danger {
  background: var(--red);
  color: var(--white);
}

.button.danger:hover {
  background: oklch(0.49 0.19 27);
}

.toolbar {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) auto;
  gap: 18px;
  align-items: end;
  margin-top: 22px;
  padding: 18px;
}

.search-field {
  display: grid;
  gap: 8px;
  color: var(--ink);
  font-weight: 780;
}

.search-field input {
  width: 100%;
  min-height: 46px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--surface);
  color: var(--ink);
  padding: 0 14px;
}

.search-field input::placeholder {
  color: oklch(0.5 0.035 250);
}

.filter-stack {
  display: grid;
  gap: 8px;
}

.filter-label {
  margin: 0;
}

.filter-group,
.category-filter-group {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.filter-button,
.category-filter-button {
  min-height: 42px;
  padding: 9px 13px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--white);
  color: var(--muted);
  font-weight: 740;
  transition: background 160ms ease-out, color 160ms ease-out, border-color 160ms ease-out;
}

.filter-button:hover,
.category-filter-button:hover {
  background: var(--surface);
}

.filter-button.active,
.category-filter-button.active {
  background: var(--yellow-soft);
  color: var(--ink);
  border-color: oklch(0.8 0.12 90);
}

.category-toolbar {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  gap: 18px;
  align-items: start;
  margin-top: 18px;
  padding: 18px;
}

.toolbar-help {
  margin: 0;
  color: var(--muted);
  line-height: 1.55;
}

.content-grid {
  display: grid;
  grid-template-columns: minmax(320px, 420px) minmax(0, 1fr);
  gap: 24px;
  margin-top: 22px;
}

.reference-panel {
  align-self: stretch;
  border: 0;
  border-radius: 0;
  background: transparent;
  overflow: visible;
}

.reference-sticky {
  position: sticky;
  top: 16px;
  align-self: start;
  display: grid;
  gap: 14px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--white);
}

.reference-panel-header {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 14px;
}

.reference-panel-header h2 {
  margin: 0;
  font-size: 1.18rem;
  line-height: 1.35;
}

.reference-count {
  flex: 0 0 auto;
  padding: 5px 9px;
  border-radius: 999px;
  background: var(--surface);
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 780;
}

.reference-figure {
  margin: 0;
  display: grid;
  gap: 9px;
}

.reference-figure img {
  width: 100%;
  max-height: calc(100vh - 206px);
  display: block;
  object-fit: contain;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--surface);
  box-shadow: 0 10px 24px oklch(0.19 0.03 250 / 0.08);
  transition: opacity 160ms ease-out, transform 160ms ease-out;
}

.reference-figure img.is-switching {
  opacity: 0.35;
  transform: translateY(4px);
}

.reference-figure figcaption,
.reference-help {
  margin: 0;
  color: var(--muted);
  line-height: 1.5;
}

.reference-figure figcaption {
  font-size: 0.92rem;
}

.reference-switcher {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.reference-switch {
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--white);
  color: var(--muted);
  font-weight: 780;
  transition: background 160ms ease-out, color 160ms ease-out, border-color 160ms ease-out;
}

.reference-switch:hover {
  background: var(--surface);
}

.reference-switch.active {
  border-color: oklch(0.8 0.12 90);
  background: var(--yellow-soft);
  color: var(--ink);
}

.reference-help {
  padding: 11px 12px;
  border-radius: var(--radius-md);
  background: var(--surface);
  font-size: 0.92rem;
}

.checklist-list {
  display: grid;
  gap: 18px;
}

.category {
  overflow: clip;
}

.category-header {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 20px 20px 18px;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}

.category-title {
  margin: 0;
  font-size: 1.2rem;
  line-height: 1.35;
}

.category-subtitle {
  margin: 5px 0 0;
  color: var(--muted);
  line-height: 1.55;
}

.category-count {
  flex: 0 0 auto;
  color: var(--muted);
  font-size: 0.94rem;
  font-weight: 740;
}

.items {
  display: grid;
}

.checklist-item {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 14px;
  padding: 18px 20px;
  border-bottom: 1px solid var(--line);
  transition: background 160ms ease-out;
}

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

.checklist-item:hover {
  background: oklch(0.99 0.004 252);
}

.checklist-item.is-checked {
  background: oklch(0.98 0.016 255);
}

.check-control {
  width: 24px;
  height: 24px;
  margin-top: 5px;
  accent-color: var(--blue);
}

.item-main {
  min-width: 0;
  max-width: 76ch;
}

.item-heading {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.item-number {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 34px;
  min-height: 26px;
  padding: 0 8px;
  border-radius: 999px;
  background: var(--yellow-soft);
  color: var(--ink);
  font-size: 0.82rem;
  font-weight: 850;
}

.item-formula {
  color: var(--ink);
  font-weight: 850;
}

.item-hint {
  margin: 9px 0 0;
  color: var(--ink);
  line-height: 1.62;
}

.item-example {
  margin: 10px 0 0;
  padding: 10px 12px;
  border-left: 3px solid var(--blue);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  background: oklch(0.97 0.018 255);
  color: var(--muted);
  line-height: 1.58;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 10px;
  padding: 5px 10px;
  border-radius: 999px;
  background: var(--surface);
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 760;
}

.checklist-item.is-checked .status-pill {
  background: oklch(0.94 0.06 145);
  color: oklch(0.35 0.13 145);
}

.empty-state {
  display: grid;
  gap: 6px;
  padding: 28px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--white);
  color: var(--muted);
  text-align: center;
}

.empty-state strong {
  color: var(--ink);
}

.back-to-top {
  position: fixed;
  right: 20px;
  z-index: 50;
  width: 52px;
  height: 52px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 50%;
  background: var(--blue);
  color: var(--white);
  box-shadow: var(--shadow-float);
  transition: opacity 180ms ease-out, transform 180ms ease-out, background 180ms ease-out;
}

.back-to-top {
  bottom: 20px;
  opacity: 0;
  pointer-events: none;
  transform: translateY(8px);
}

.back-to-top.visible {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

.back-to-top:hover {
  background: var(--blue-dark);
}

.back-to-top svg {
  width: 24px;
  height: 24px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.toast {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 90;
  max-width: min(360px, calc(100% - 40px));
  padding: 12px 14px;
  border-radius: var(--radius-md);
  background: var(--ink);
  color: var(--white);
  opacity: 0;
  pointer-events: none;
  transform: translateY(8px);
  transition: opacity 180ms ease-out, transform 180ms ease-out;
}

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

.confirm-dialog {
  border: 0;
  padding: 0;
  background: transparent;
}

.confirm-dialog::backdrop {
  background: oklch(0.16 0.025 255 / 0.58);
}

.dialog-content {
  width: min(460px, calc(100vw - 32px));
  padding: 22px;
  border-radius: var(--radius-lg);
  background: var(--white);
  box-shadow: var(--shadow-float);
}

.dialog-content h2 {
  margin: 0;
}

.dialog-content p {
  color: var(--muted);
  line-height: 1.58;
}

.dialog-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 18px;
}

@media (max-width: 920px) {
  .app-shell {
    width: min(100% - 20px, 760px);
    padding-top: 16px;
  }

  .hero,
  .toolbar,
  .category-toolbar,
  .content-grid {
    grid-template-columns: 1fr;
  }

  .hero {
    padding: 20px;
  }

  .hero-copy {
    min-height: auto;
    padding: 8px 0 4px;
  }

  .reference-sticky {
    position: static;
  }

  .reference-figure img {
    max-height: min(72vh, 680px);
  }
}

@media (max-width: 560px) {
  .app-shell {
    width: min(100% - 16px, 520px);
  }

  .brand-bar {
    gap: 10px;
    padding: 10px 12px;
  }

  .brand-logo-frame {
    width: min(58vw, 220px);
    height: 48px;
  }

  .brand-meta span {
    font-size: 0.72rem;
  }

  .brand-meta strong {
    font-size: 0.9rem;
  }

  .hero,
  .action-panel,
  .toolbar,
  .category-toolbar,
  .reference-panel {
    border-radius: var(--radius-md);
  }

  .hero {
    padding: 16px;
    gap: 16px;
  }

  .social-badges {
    margin-bottom: 14px;
  }

  h1 {
    font-size: 2rem;
    line-height: 1.08;
  }

  .hero-text {
    margin-top: 16px;
    font-size: 1rem;
  }

  .notice {
    margin-top: 16px;
  }

  .action-panel {
    gap: 14px;
    padding: 16px;
  }

  .summary-grid {
    gap: 8px;
  }

  .summary-grid div {
    padding: 10px 8px;
  }

  .summary-grid span {
    font-size: 1.35rem;
  }

  .button {
    min-height: 42px;
    padding: 10px 12px;
    font-size: 0.94rem;
  }

  .toolbar,
  .category-toolbar {
    padding: 14px;
  }

  .category-header {
    display: grid;
  }

  .checklist-item {
    grid-template-columns: 1fr;
    gap: 10px;
    padding: 16px;
  }

  .check-control {
    width: 28px;
    height: 28px;
  }

  .reference-sticky {
    padding: 14px;
  }

  .reference-panel-header {
    display: grid;
  }

  .reference-figure img {
    max-height: 68vh;
  }

  .back-to-top {
    right: 14px;
    width: 48px;
    height: 48px;
  }
}

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