:root {
  color-scheme: light;
  --bg: #f6f7f9;
  --surface: #ffffff;
  --surface-soft: #eef3f7;
  --ink: #1d2630;
  --muted: #667383;
  --line: #d7dee6;
  --accent: #0f766e;
  --accent-strong: #0b5f59;
  --warn: #a16207;
  --danger: #b42318;
  --ok: #147d45;
  --locked: #7b8190;
  --shadow: 0 8px 24px rgba(29, 38, 48, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: "Segoe UI", "Noto Sans KR", Arial, sans-serif;
  line-height: 1.6;
}

a {
  color: inherit;
}

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

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(12px);
}

.topbar-inner {
  display: flex;
  align-items: center;
  gap: 18px;
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 12px 0;
}

.brand {
  flex: 0 0 auto;
  font-weight: 800;
  letter-spacing: 0;
}

.brand span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}

.nav {
  display: flex;
  flex: 1 1 auto;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: flex-end;
}

.nav a {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 6px 10px;
  border: 1px solid transparent;
  border-radius: 6px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
  text-decoration: none;
}

.nav a:hover,
.nav a.active {
  border-color: var(--line);
  background: var(--surface-soft);
  color: var(--ink);
}

.nav a.locked {
  color: var(--locked);
}

.nav a.locked::after {
  margin-left: 6px;
  content: "LOCK";
  font-size: 10px;
  font-weight: 800;
}

.page {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 28px 0 56px;
}

.hero,
.lesson-header,
.section,
.locked-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.hero,
.lesson-header {
  padding: 24px;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--accent-strong);
  font-size: 13px;
  font-weight: 800;
}

h1,
h2,
h3 {
  margin: 0;
  line-height: 1.25;
  letter-spacing: 0;
}

h1 {
  max-width: 980px;
  font-size: 34px;
}

h2 {
  margin-bottom: 14px;
  font-size: 22px;
}

h3 {
  margin-bottom: 8px;
  font-size: 17px;
}

p {
  margin: 0 0 12px;
}

.lead {
  max-width: 920px;
  margin-top: 12px;
  color: var(--muted);
  font-size: 17px;
}

.meta-row,
.actions,
.status-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.meta-row {
  margin-top: 16px;
}

.pill {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 4px 9px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface-soft);
  color: var(--ink);
  font-size: 12px;
  font-weight: 800;
}

.pill.open {
  border-color: rgba(20, 125, 69, 0.24);
  background: #e9f7ef;
  color: var(--ok);
}

.pill.locked {
  border-color: rgba(161, 98, 7, 0.24);
  background: #fff7e6;
  color: var(--warn);
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  padding: 8px 12px;
  border: 1px solid var(--accent);
  border-radius: 6px;
  background: var(--accent);
  color: #fff;
  font-weight: 800;
  text-decoration: none;
}

.button.secondary {
  border-color: var(--line);
  background: var(--surface);
  color: var(--ink);
}

.button.disabled {
  border-color: var(--line);
  background: #eceff3;
  color: var(--locked);
  pointer-events: none;
}

.framework {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 8px;
  margin-top: 18px;
}

.framework-step {
  min-height: 58px;
  padding: 9px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface-soft);
  font-size: 12px;
  font-weight: 800;
  text-align: center;
}

.framework-step.active {
  border-color: var(--accent);
  background: #ddf4ef;
  color: var(--accent-strong);
}

.sections {
  display: grid;
  gap: 18px;
  margin-top: 18px;
}

.section {
  padding: 20px;
}

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

.compare-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(220px, 0.55fr) minmax(0, 1fr);
  gap: 14px;
}

.compare-panel,
.pain-panel,
.callout {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfd;
  padding: 16px;
}

.compare-panel.garbage {
  border-top: 5px solid var(--danger);
}

.compare-panel.diamond {
  border-top: 5px solid var(--ok);
}

.pain-panel {
  border-top: 5px solid var(--warn);
}

.same-data {
  margin-top: 14px;
  padding: 12px;
  border-left: 4px solid var(--accent);
  background: #effaf7;
  font-weight: 800;
}

ul,
ol {
  margin: 8px 0 0;
  padding-left: 22px;
}

li + li {
  margin-top: 6px;
}

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

table {
  width: 100%;
  min-width: 680px;
  border-collapse: collapse;
  background: var(--surface);
}

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

th {
  background: var(--surface-soft);
  font-size: 13px;
  font-weight: 800;
}

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

.prompt-box {
  position: relative;
}

pre {
  overflow-x: auto;
  margin: 0;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #17212b;
  color: #f6f7f9;
  white-space: pre-wrap;
  word-break: keep-all;
  font: 14px/1.65 Consolas, "Courier New", monospace;
}

.copy-button {
  margin-bottom: 10px;
}

.notice {
  border-left: 4px solid var(--warn);
  background: #fff8e8;
  padding: 12px;
}

.locked-panel {
  padding: 30px;
}

.lesson-nav {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

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

@media (max-width: 900px) {
  .topbar-inner {
    align-items: flex-start;
    flex-direction: column;
  }

  .nav {
    justify-content: flex-start;
  }

  h1 {
    font-size: 28px;
  }

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

  .grid-2,
  .compare-grid {
    grid-template-columns: 1fr;
  }

  .button {
    min-height: 46px;
  }
}

@media (max-width: 640px) {
  .page,
  .topbar-inner {
    width: min(100% - 20px, 1180px);
  }

  .hero,
  .lesson-header,
  .section,
  .locked-panel {
    padding: 16px;
  }

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

  .lesson-nav {
    flex-direction: column;
  }
}
