:root {
  --bg: #F5F3EE;
  --paper: #F9F7F3;
  --panel: #FFFFFF;
  --ink: #1C1814;
  --muted: #4A423C;
  --line: #E6E1D9;
  --brand: #7EB5E8;
  --brand-2: #00704A;
  --gold: #F4DC59;
  --shadow: 0 24px 70px rgba(28, 24, 20, 0.1);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at top left, rgba(126, 181, 232, 0.12), transparent 30%),
    radial-gradient(circle at top right, rgba(0, 112, 74, 0.08), transparent 26%),
    var(--bg);
  color: var(--ink);
  font-family: "Pretendard", "Noto Sans KR", "Apple SD Gothic Neo", sans-serif;
  line-height: 1.62;
}

a {
  color: inherit;
}

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

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

.skip-link {
  position: absolute;
  top: 12px;
  left: 12px;
  z-index: 30;
  transform: translateY(-140%);
  padding: 10px 14px;
  border-radius: 999px;
  background: var(--ink);
  color: var(--paper);
  text-decoration: none;
  font-weight: 700;
}

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

.room-header,
.classroom-page,
.room-footer {
  width: min(1120px, calc(100% - 32px));
  margin: 0 auto;
}

.room-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 22px 0 12px;
}

.brand-link {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--ink);
  text-decoration: none;
  font-size: 14px;
  font-weight: 800;
}

.brand-link img {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  filter: invert(1);
}

.room-nav,
.room-footer nav {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px;
}

.room-nav a,
.room-footer a {
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
  border-bottom: 1px solid transparent;
}

.room-nav a:hover,
.room-nav a:focus-visible,
.room-footer a:hover,
.room-footer a:focus-visible {
  color: var(--ink);
  border-color: var(--ink);
}

.progress-shell {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 12px;
  background: rgba(245, 243, 238, 0.92);
  border-top: 1px solid rgba(230, 225, 217, 0.72);
  border-bottom: 1px solid rgba(230, 225, 217, 0.86);
  backdrop-filter: blur(16px);
}

.progress-shell strong {
  min-width: 132px;
  color: var(--ink);
  font-size: 12px;
  font-weight: 800;
  text-align: center;
  white-space: nowrap;
}

.progress-button,
.primary-button,
.secondary-button,
.copy-button,
.ai-open-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  padding: 9px 15px;
  border: 1px solid var(--line);
  border-radius: 999px;
  font: inherit;
  font-size: 13px;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
}

.primary-button {
  background: var(--brand);
  border-color: var(--brand);
  color: var(--ink);
}

.secondary-button,
.progress-button,
.copy-button {
  background: var(--panel);
  color: var(--ink);
}

.ai-open-button {
  background: var(--ink);
  border-color: var(--ink);
  color: var(--paper);
}

.progress-button:disabled {
  cursor: default;
  opacity: 0.42;
}

.class-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(260px, 380px);
  gap: clamp(28px, 6vw, 76px);
  align-items: center;
  min-height: clamp(610px, 78vh, 760px);
  padding: 48px 0 70px;
  border-bottom: 1px solid var(--line);
}

.room-label,
.section-heading p,
.panel-label,
.item-index {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.class-hero h1 {
  max-width: 760px;
  margin: 12px 0 18px;
  font-size: clamp(44px, 6vw, 72px);
  line-height: 1.06;
  font-weight: 800;
  word-break: keep-all;
  text-wrap: balance;
}

.hero-line {
  max-width: 720px;
  margin: 0;
  color: var(--muted);
  font-size: clamp(20px, 2.4vw, 29px);
  line-height: 1.55;
  font-weight: 600;
  word-break: keep-all;
}

.hero-actions,
.finish-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 28px;
}

.hero-card {
  margin: 0;
}

.hero-card img {
  width: 100%;
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}

.hero-card figcaption {
  margin-top: 14px;
  color: var(--muted);
  font-size: 13px;
}

.toc-section,
.lesson-section,
.finish-section {
  padding: 74px 0;
  border-bottom: 1px solid var(--line);
  scroll-margin-top: 72px;
}

.section-heading {
  display: flex;
  align-items: baseline;
  gap: 14px;
  margin-bottom: 24px;
}

.section-heading h2 {
  margin: 0;
  font-size: clamp(30px, 4vw, 46px);
  line-height: 1.18;
  font-weight: 750;
  word-break: keep-all;
}

.section-lead {
  max-width: 840px;
  margin: 0 0 34px;
  color: var(--ink);
  font-size: 21px;
  line-height: 1.58;
  font-weight: 650;
  word-break: keep-all;
}

.toc-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(136px, 1fr));
  gap: 1px;
  margin: 0;
  padding: 0;
  list-style: none;
  border: 1px solid var(--line);
  background: var(--line);
  overflow-x: auto;
}

.toc-grid a {
  display: grid;
  min-height: 154px;
  align-content: space-between;
  gap: 16px;
  padding: 17px;
  background: var(--paper);
  text-decoration: none;
}

.toc-grid span,
.toc-grid em {
  color: var(--muted);
  font-size: 12px;
  font-style: normal;
}

.toc-grid strong {
  color: var(--ink);
  font-size: 17px;
  line-height: 1.25;
  word-break: keep-all;
}

.practice-guide {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 0.48fr);
  gap: 28px;
  align-items: start;
  margin-bottom: 24px;
  padding: 24px;
  background: rgba(255, 255, 255, 0.68);
  border: 1px solid var(--line);
  border-left: 4px solid var(--brand-2);
}

.practice-guide h3 {
  margin: 8px 0 0;
  color: var(--ink);
  font-size: clamp(23px, 2.5vw, 30px);
  line-height: 1.3;
  word-break: keep-all;
}

.practice-guide ol {
  margin: 18px 0 0;
  padding-left: 22px;
  color: var(--muted);
  font-size: 17px;
  font-weight: 600;
  word-break: keep-all;
}

.practice-guide li + li {
  margin-top: 7px;
}

.ai-button-panel {
  display: grid;
  gap: 14px;
  padding-top: 2px;
}

.ai-button-panel p {
  margin: 0;
  color: var(--muted);
  font-size: 16px;
  line-height: 1.5;
  font-weight: 650;
  word-break: keep-all;
}

.ai-link-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(128px, 1fr));
  gap: 10px;
}

.practice-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 0.48fr);
  gap: 34px;
  align-items: start;
}

.prompt-panel,
.practice-note,
.resource-card,
.preview-card {
  background: var(--paper);
  border: 1px solid var(--line);
}

.prompt-panel {
  padding: 24px;
  border-top: 4px solid var(--brand);
}

.prompt-panel pre {
  margin: 14px 0 18px;
  white-space: pre-wrap;
  color: var(--ink);
  font-family: inherit;
  font-size: clamp(18px, 2.1vw, 24px);
  line-height: 1.65;
  font-weight: 650;
  word-break: keep-all;
}

.practice-note {
  padding: 24px;
}

.practice-note h3,
.resource-card h3,
.preview-card h3 {
  margin: 0;
  color: var(--ink);
  font-size: 25px;
  line-height: 1.25;
  word-break: keep-all;
}

.practice-note p,
.practice-note li,
.resource-card p,
.preview-card p,
.finish-layout p {
  color: var(--muted);
}

.practice-note p {
  margin: 12px 0 0;
}

.practice-note ul {
  margin: 18px 0 0;
  padding-left: 18px;
}

.practice-note li + li {
  margin-top: 8px;
}

.resource-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 22px;
  margin-bottom: 28px;
}

.resource-card {
  display: grid;
  align-content: start;
  gap: 12px;
  padding: 24px;
}

.resource-card p {
  margin: 0;
}

.resource-card .secondary-button {
  justify-self: start;
}

.pdf-viewer {
  min-height: 620px;
  border: 1px solid var(--line);
  background: var(--panel);
}

.pdf-viewer object {
  width: 100%;
  min-height: 620px;
}

.pdf-viewer p {
  margin: 0;
  padding: 24px;
  color: var(--muted);
}

.cardnews-rail {
  display: grid;
  grid-template-columns: repeat(7, minmax(220px, 1fr));
  gap: 16px;
  overflow-x: auto;
  padding-bottom: 16px;
}

.cardnews-rail a {
  display: block;
  min-width: 220px;
  border: 1px solid var(--line);
  background: var(--paper);
}

.cardnews-rail img {
  width: 100%;
}

.video-panel {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(240px, 0.35fr);
  gap: 28px;
  align-items: end;
}

.video-panel video {
  width: 100%;
  aspect-ratio: 16 / 9;
  border: 1px solid var(--line);
  background: var(--ink);
}

.video-panel p {
  margin: 0;
  color: var(--muted);
  font-size: 18px;
  line-height: 1.58;
  font-weight: 600;
  word-break: keep-all;
}

.preview-grid {
  display: grid;
  gap: 28px;
}

.preview-card {
  display: grid;
  grid-template-columns: minmax(250px, 0.36fr) minmax(0, 1fr);
  gap: 28px;
  align-items: center;
  padding: 24px;
}

.preview-card p:not(.item-index) {
  margin: 12px 0 0;
}

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

.preview-pages img {
  width: 100%;
  border: 1px solid var(--line);
  background: var(--panel);
}

.finish-section {
  border-bottom: 0;
}

.finish-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 26px;
  align-items: center;
  padding: 30px 0 0;
  border-top: 1px solid var(--line);
}

.finish-layout p {
  max-width: 760px;
  margin: 0;
  font-size: 22px;
  line-height: 1.56;
  font-weight: 650;
  word-break: keep-all;
}

.finish-actions {
  margin-top: 0;
  justify-content: flex-end;
}

.room-footer {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  padding: 28px 0 46px;
  color: var(--muted);
  font-size: 13px;
  border-top: 1px solid var(--line);
}

.room-footer p {
  margin: 0;
}

@media (max-width: 980px) {
  .class-hero,
  .practice-guide,
  .practice-layout,
  .resource-grid,
  .video-panel,
  .preview-card,
  .finish-layout {
    grid-template-columns: 1fr;
  }

  .class-hero {
    min-height: auto;
  }

  .finish-actions {
    justify-content: flex-start;
  }
}

@media (max-width: 680px) {
  .room-header,
  .room-footer {
    align-items: flex-start;
    flex-direction: column;
  }

  .room-nav,
  .room-footer nav {
    gap: 12px;
  }

  .progress-shell {
    justify-content: flex-start;
    overflow-x: auto;
  }

  .progress-button,
  .primary-button,
  .secondary-button,
  .copy-button,
  .ai-open-button {
    min-height: 38px;
    padding: 8px 12px;
    font-size: 12px;
    white-space: nowrap;
  }

  .class-hero {
    padding: 36px 0 52px;
  }

  .class-hero h1 {
    font-size: 38px;
  }

  .hero-line,
  .section-lead,
  .finish-layout p {
    font-size: 17px;
  }

  .toc-section,
  .lesson-section,
  .finish-section {
    padding: 54px 0;
  }

  .section-heading {
    display: block;
  }

  .section-heading h2 {
    margin-top: 6px;
    font-size: 30px;
  }

  .prompt-panel,
  .practice-guide,
  .practice-note,
  .resource-card,
  .preview-card {
    padding: 18px;
  }

  .practice-guide h3 {
    font-size: 23px;
  }

  .practice-guide ol,
  .ai-button-panel p {
    font-size: 15px;
  }

  .ai-link-grid {
    grid-template-columns: 1fr 1fr;
  }

  .prompt-panel pre {
    font-size: 16px;
    line-height: 1.7;
  }

  .pdf-viewer,
  .pdf-viewer object {
    min-height: 440px;
  }

  .preview-pages {
    grid-template-columns: 1fr 1fr;
    gap: 10px;
  }
}

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