:root {
  --bg: #f7f0e3;
  --bg-soft: #fbf7ef;
  --panel: rgba(255, 251, 244, 0.78);
  --panel-strong: #fff8ef;
  --line: rgba(59, 44, 31, 0.12);
  --ink: #24160f;
  --ink-soft: #5f4e44;
  --accent: #a44b1a;
  --accent-strong: #7f3213;
  --accent-soft: #f2b57f;
  --sea: #1c5f63;
  --shadow: 0 20px 60px rgba(77, 49, 25, 0.12);
  --radius-lg: 28px;
  --radius-md: 20px;
  --radius-sm: 14px;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  width: 100%;
  max-width: 100%;
  overflow-x: clip;
  overscroll-behavior-x: none;
}

body {
  background:
    radial-gradient(circle at top left, rgba(244, 171, 105, 0.2), transparent 28%),
    radial-gradient(circle at bottom right, rgba(28, 95, 99, 0.14), transparent 26%),
    #f7f1e6;
  color: var(--ink);
  font-family: "Manrope", "Noto Sans KR", sans-serif;
  overflow-x: hidden;
  touch-action: pan-y;
}

body.drawer-open {
  overflow: hidden;
  touch-action: none;
}

.ambient {
  position: fixed;
  inset: auto;
  pointer-events: none;
  filter: blur(60px);
  opacity: 0.55;
  z-index: 0;
}

.ambient-a {
  top: -60px;
  left: -80px;
  width: 300px;
  height: 300px;
  background: rgba(244, 171, 105, 0.4);
}

.ambient-b {
  right: -80px;
  bottom: -70px;
  width: 280px;
  height: 280px;
  background: rgba(77, 121, 126, 0.28);
}

#app {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 100%;
  overflow-x: clip;
}

.shell {
  min-height: 100vh;
  width: min(1240px, 100%);
  margin: 0 auto;
  padding: 20px 20px 40px;
  max-width: 100%;
  overflow-x: clip;
}

.stack {
  display: flex;
  flex-direction: column;
  gap: 18px;
  min-width: 0;
  max-width: 100%;
  overflow-x: clip;
}

.hero,
.panel,
.course-shell,
.viewer-panel,
.sidebar-panel,
.card {
  background: rgba(255, 251, 244, 0.92);
  border: 1px solid var(--line);
  box-shadow: 0 10px 30px rgba(77, 49, 25, 0.08);
  min-width: 0;
  max-width: 100%;
}

iframe,
img {
  max-width: 100%;
}

.hero {
  border-radius: 32px;
  padding: 28px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
}

.hero h1,
.auth-copy h1,
.viewer-copy h2,
.viewer-copy h3 {
  margin: 0;
  font-size: clamp(2rem, 3vw, 3rem);
  line-height: 0.98;
  letter-spacing: -0.05em;
}

.viewer-copy h2 {
  font-size: clamp(1.35rem, 2vw, 1.9rem);
  line-height: 1.08;
}

.hero p,
.auth-copy p,
.viewer-copy p,
.muted,
.product-note,
.empty-state p {
  color: var(--ink-soft);
  line-height: 1.6;
}

.kicker {
  margin: 0 0 12px;
  font-size: 0.76rem;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: var(--accent-strong);
  font-weight: 800;
}

.hero-actions,
.top-actions,
.inline-actions,
.auth-actions,
.lesson-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  width: 100%;
  min-width: 0;
}

.btn,
.ghost-btn,
.link-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 999px;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  transition:
    transform 0.18s ease,
    box-shadow 0.18s ease,
    background 0.18s ease,
    color 0.18s ease;
}

.btn {
  background: linear-gradient(135deg, var(--accent) 0%, #ca6f34 100%);
  color: #fffaf3;
  padding: 13px 18px;
  box-shadow: 0 12px 24px rgba(164, 75, 26, 0.28);
  text-decoration: none;
}

.btn:hover,
.ghost-btn:hover,
.link-btn:hover {
  transform: translateY(-1px);
}

.ghost-btn {
  padding: 12px 18px;
  background: rgba(255, 250, 243, 0.74);
  color: var(--ink);
  border: 1px solid rgba(59, 44, 31, 0.14);
}

.link-btn {
  background: transparent;
  color: var(--sea);
  padding: 0;
}

.auth-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.auth-panel-single {
  width: min(420px, 100%);
  padding: 24px;
  border-radius: 24px;
}

.auth-panel-single h1 {
  margin: 0 0 18px;
  font-size: 2rem;
  letter-spacing: -0.05em;
}

.auth-card {
  width: min(960px, 100%);
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  gap: 20px;
}

.auth-copy,
.auth-panel {
  border-radius: var(--radius-lg);
  padding: 28px;
}

.auth-copy {
  background:
    linear-gradient(145deg, rgba(28, 95, 99, 0.94), rgba(23, 57, 62, 0.98)),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140' viewBox='0 0 140 140'%3E%3Cg fill='none' stroke='rgba(255,255,255,0.08)'%3E%3Cpath d='M10 70h120'/%3E%3Cpath d='M70 10v120'/%3E%3Ccircle cx='70' cy='70' r='46'/%3E%3C/g%3E%3C/svg%3E");
  color: #fef8ef;
}

.auth-copy p,
.auth-copy li {
  color: rgba(254, 248, 239, 0.8);
}

.auth-panel {
  background: var(--panel-strong);
  border: 1px solid rgba(59, 44, 31, 0.12);
}

.auth-list {
  margin: 18px 0 0;
  padding-left: 18px;
}

.auth-list li {
  margin: 0 0 10px;
}

form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

label {
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--ink-soft);
}

input {
  width: 100%;
  border: 1px solid rgba(59, 44, 31, 0.14);
  background: rgba(255, 255, 255, 0.82);
  border-radius: 16px;
  padding: 14px 16px;
  font: inherit;
  color: var(--ink);
}

input:focus {
  outline: 2px solid rgba(164, 75, 26, 0.18);
  border-color: rgba(164, 75, 26, 0.28);
}

.status {
  border-radius: 16px;
  padding: 12px 14px;
  font-size: 0.92rem;
}

.status.info {
  background: rgba(28, 95, 99, 0.1);
  color: #0f4b4f;
}

.status.error {
  background: rgba(177, 58, 30, 0.12);
  color: #842f19;
}

.status.success {
  background: rgba(39, 111, 74, 0.12);
  color: #195734;
}

.support-notice {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 16px 18px;
  border-radius: 20px;
  border: 1px solid rgba(59, 44, 31, 0.1);
  background: rgba(255, 250, 243, 0.78);
}

.support-notice p {
  margin: 0;
  color: var(--ink-soft);
  line-height: 1.55;
}

.support-label {
  font-size: 0.82rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent-strong);
}

.support-contact {
  color: var(--accent-strong);
  font-weight: 800;
  text-decoration: none;
  word-break: break-all;
}

.support-contact:hover {
  text-decoration: underline;
}

.auth-support {
  margin-top: 18px;
  align-items: flex-start;
  flex-direction: column;
}

.page-support {
  margin-top: 4px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 18px;
  position: sticky;
  top: 12px;
  z-index: 20;
  padding: 16px 18px;
  border-radius: 26px;
  background: rgba(255, 250, 243, 0.82);
  border: 1px solid rgba(59, 44, 31, 0.08);
  box-shadow: 0 10px 28px rgba(77, 49, 25, 0.08);
  backdrop-filter: blur(14px);
  width: 100%;
  max-width: 100%;
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
}

.brand-mark {
  width: 44px;
  height: 44px;
  border-radius: 16px;
  display: grid;
  place-items: center;
  font-weight: 800;
  background: linear-gradient(135deg, rgba(164, 75, 26, 0.98), rgba(224, 144, 78, 0.94));
  color: #fffaf3;
  letter-spacing: -0.08em;
}

.brand-copy h2,
.brand-copy p {
  margin: 0;
}

.brand-copy h2 {
  font-size: 1.1rem;
  letter-spacing: -0.04em;
}

.brand-copy p {
  color: var(--ink-soft);
  font-size: 0.9rem;
  overflow-wrap: anywhere;
}

.hero-metrics {
  display: grid;
  grid-template-columns: repeat(3, minmax(100px, 1fr));
  gap: 12px;
  width: min(360px, 100%);
}

.metric {
  border-radius: 22px;
  padding: 16px;
  background: rgba(255, 248, 240, 0.74);
  border: 1px solid rgba(59, 44, 31, 0.1);
}

.metric strong {
  display: block;
  font-size: 1.55rem;
  line-height: 1;
  letter-spacing: -0.06em;
}

.metric span {
  display: block;
  margin-top: 8px;
  color: var(--ink-soft);
  font-size: 0.84rem;
}

.product-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 18px;
  width: 100%;
  min-width: 0;
}

.card {
  border-radius: var(--radius-lg);
  padding: 22px;
}

.library-page {
  width: min(1080px, 100%);
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

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

.course-button {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  width: 100%;
  border: 1px solid rgba(59, 44, 31, 0.08);
  border-radius: 28px;
  padding: 20px 22px;
  background:
    linear-gradient(180deg, rgba(255, 252, 247, 0.98), rgba(249, 240, 227, 0.9));
  color: var(--ink);
  text-align: left;
  box-shadow:
    0 14px 36px rgba(77, 49, 25, 0.08),
    inset 0 1px 0 rgba(255, 255, 255, 0.72);
  transition:
    transform 0.18s ease,
    box-shadow 0.18s ease,
    border-color 0.18s ease;
}

.course-button:hover {
  transform: translateY(-1px);
}

.course-button:disabled,
.course-button.locked {
  opacity: 0.62;
  cursor: not-allowed;
  box-shadow: none;
}

.course-button-copy {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
}

.course-button-copy strong {
  min-width: 0;
  font-size: 1.15rem;
  line-height: 1.2;
  letter-spacing: -0.04em;
}

.course-button-state {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  min-width: 72px;
  min-height: 40px;
  border-radius: 999px;
  padding: 0 14px;
  background: rgba(36, 22, 15, 0.06);
  color: var(--ink-soft);
  font-size: 0.8rem;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.course-button:focus-visible {
  outline: 2px solid rgba(164, 75, 26, 0.24);
  outline-offset: 2px;
}

.library-header {
  border-radius: 30px;
  padding: 24px 26px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  background:
    linear-gradient(135deg, rgba(255, 252, 247, 0.96), rgba(249, 240, 227, 0.88));
}

.library-header-copy {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.library-header-kicker {
  color: var(--accent-strong);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.22em;
  text-transform: uppercase;
}

.library-header h1 {
  margin: 0;
  font-size: clamp(1.9rem, 4vw, 3rem);
  line-height: 0.96;
  letter-spacing: -0.06em;
}

.library-header-count {
  display: inline-flex;
  min-width: 68px;
  height: 68px;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  background: rgba(36, 22, 15, 0.06);
  color: var(--ink);
  font-size: 1.5rem;
  font-weight: 800;
  letter-spacing: -0.06em;
}

.library-card {
  display: flex;
  min-height: 220px;
  flex-direction: column;
  justify-content: space-between;
  gap: 28px;
  padding: 24px;
  border-radius: 30px;
  background:
    linear-gradient(180deg, rgba(255, 252, 247, 0.98), rgba(249, 240, 227, 0.9));
  box-shadow:
    0 14px 36px rgba(77, 49, 25, 0.08),
    inset 0 1px 0 rgba(255, 255, 255, 0.72);
}

.library-card .btn {
  align-self: flex-start;
}

.library-card .btn[disabled],
.library-card .btn.disabled {
  opacity: 0.46;
  cursor: not-allowed;
  pointer-events: none;
  box-shadow: none;
}

.library-card-head {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.library-card-meta {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.library-card-meta span {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 8px 12px;
  background: rgba(36, 22, 15, 0.05);
  color: var(--ink-soft);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.04em;
}

.library-card-product1 {
  background:
    linear-gradient(180deg, rgba(255, 250, 245, 0.98), rgba(248, 237, 226, 0.92));
}

.library-card-product2 {
  background:
    linear-gradient(180deg, rgba(252, 250, 246, 0.98), rgba(239, 246, 244, 0.92));
}

.library-card-product2Pdf {
  background:
    linear-gradient(180deg, rgba(252, 249, 244, 0.98), rgba(244, 239, 233, 0.92));
}

.library-card-index {
  display: inline-flex;
  width: fit-content;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  padding: 6px 10px;
  background: rgba(36, 22, 15, 0.05);
  color: var(--ink-soft);
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0.16em;
}

.card h3,
.card p {
  margin-top: 0;
}

.library-card h3 {
  margin: 0;
  font-size: clamp(1.5rem, 2.6vw, 2.1rem);
  line-height: 1.08;
  letter-spacing: -0.05em;
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 18px;
  border-radius: 999px;
  padding: 8px 12px;
  background: rgba(36, 22, 15, 0.06);
  color: var(--ink-soft);
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.12em;
}

.card h3 {
  margin-bottom: 8px;
  font-size: 1.45rem;
  letter-spacing: -0.04em;
}

.product-note {
  min-height: 72px;
}

.course-shell {
  display: grid;
  grid-template-columns: 360px minmax(0, 1fr);
  gap: 18px;
  border-radius: 32px;
  padding: 18px;
  width: 100%;
  min-width: 0;
}

.mobile-sidebar-overlay,
.mobile-toc-sheet,
.floating-toc-btn {
  display: none;
}

.floating-toc-btn {
  position: fixed;
  right: 16px;
  top: calc(env(safe-area-inset-top, 0px) + 16px);
  z-index: 70;
  min-width: 92px;
  min-height: 48px;
  padding: 12px 16px;
  border: 0;
  border-radius: 999px;
  background: linear-gradient(135deg, var(--accent) 0%, #ca6f34 100%);
  color: #fffaf3;
  font: inherit;
  font-weight: 800;
  box-shadow: 0 16px 32px rgba(164, 75, 26, 0.28);
}

.mobile-toc-sheet {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: min(460px, 100vw);
  z-index: 60;
  padding: calc(env(safe-area-inset-top, 0px) + 16px) 16px calc(env(safe-area-inset-bottom, 0px) + 16px);
  background: #fff8ef;
  box-shadow: -18px 0 40px rgba(36, 22, 15, 0.16);
  overflow: hidden;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-y;
}

.mobile-toc-header {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-bottom: 14px;
}

.mobile-toc-copy {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.mobile-toc-copy h3 {
  margin: 0;
  font-size: 1.8rem;
  letter-spacing: -0.05em;
}

.mobile-toc-actions {
  display: flex;
  gap: 10px;
}

.mobile-toc-actions .ghost-btn {
  flex: 1 1 0;
}

.mobile-toc-list {
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding-right: 4px;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-y;
}

.mobile-toc-section {
  flex: 0 0 auto;
  border: 1px solid rgba(59, 44, 31, 0.08);
  border-radius: 22px;
  background: rgba(255, 252, 247, 0.96);
  overflow: hidden;
}

.mobile-toc-section.open {
  background: rgba(255, 248, 242, 0.96);
}

.mobile-toc-section-header {
  display: flex;
  width: 100%;
  border: 0;
  padding: 16px 16px 14px;
  font: inherit;
  -webkit-appearance: none;
  appearance: none;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  background: transparent;
  color: var(--ink);
  text-align: left;
  cursor: pointer;
}

.mobile-toc-section-title {
  flex: 1 1 auto;
  font-size: 1rem;
  line-height: 1.45;
  letter-spacing: -0.03em;
}

.mobile-toc-section-meta {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  flex: 0 0 auto;
  padding-left: 8px;
}

.mobile-toc-section-count {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 30px;
  min-height: 30px;
  border-radius: 999px;
  background: rgba(36, 22, 15, 0.06);
  color: var(--ink-soft);
  font-size: 0.78rem;
  font-weight: 800;
}

.mobile-toc-section-caret {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 999px;
  background: rgba(164, 75, 26, 0.08);
  color: var(--accent-strong);
  font-size: 1rem;
  font-weight: 800;
}

.mobile-toc-lessons {
  display: none;
  padding: 0 14px 14px;
}

.mobile-toc-lessons.open {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.mobile-lesson-btn {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 14px;
  border: 1px solid rgba(59, 44, 31, 0.08);
  background: #fbf7f0;
  box-shadow: none;
}

.mobile-lesson-btn.active {
  border-color: rgba(164, 75, 26, 0.16);
  background: rgba(164, 75, 26, 0.12);
}

.mobile-lesson-text {
  min-width: 0;
  color: var(--ink);
  font-size: 0.95rem;
  font-weight: 700;
  line-height: 1.45;
  letter-spacing: -0.03em;
}

body.drawer-open .floating-toc-btn {
  opacity: 0;
  pointer-events: none;
  transform: translateY(-10px);
}

.sidebar-kicker {
  display: inline-flex;
  margin-bottom: 4px;
  color: var(--accent-strong);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.2em;
  text-transform: uppercase;
}

.mobile-course-summary {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.mobile-course-label {
  color: var(--ink-soft);
  font-size: 0.74rem;
  font-weight: 800;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.mobile-course-summary strong {
  display: block;
  min-width: 0;
  color: var(--ink);
  font-size: 0.96rem;
  line-height: 1.35;
  letter-spacing: -0.03em;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sidebar-heading h3,
.sidebar-heading p,
.viewer-copy h2,
.viewer-copy p {
  margin: 0;
}

.chapter-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-height: calc(100vh - 220px);
  overflow: auto;
  padding-right: 4px;
}

.chapter {
  border: 1px solid rgba(59, 44, 31, 0.08);
  background: rgba(255, 255, 255, 0.55);
  border-radius: 20px;
  overflow: clip;
}

.chapter.open {
  background: rgba(255, 248, 242, 0.92);
}

.chapter-toggle {
  width: 100%;
  border: 0;
  appearance: none;
  -webkit-appearance: none;
  background: transparent;
  color: var(--ink);
  text-align: left;
  cursor: pointer;
  font: inherit;
  line-height: 1.35;
  padding: 15px 16px;
  font-weight: 800;
  position: relative;
  display: block;
  padding-right: 86px;
  white-space: normal;
}

.chapter-toggle:hover {
  background: rgba(164, 75, 26, 0.06);
}

.chapter-toggle:focus-visible {
  outline: 2px solid rgba(164, 75, 26, 0.28);
  outline-offset: -2px;
}

.chapter-title {
  display: block;
  width: 100%;
  min-width: 0;
  padding-right: 4px;
  color: var(--ink);
  -webkit-text-fill-color: var(--ink);
  font-size: 0.96rem;
  line-height: 1.45;
  white-space: normal;
  word-break: keep-all;
  overflow-wrap: anywhere;
}

.chapter-meta {
  position: absolute;
  top: 50%;
  right: 12px;
  transform: translateY(-50%);
  display: flex;
  align-items: center;
  gap: 6px;
  min-height: 34px;
  padding: 4px 8px;
  border-radius: 999px;
  background: rgba(164, 75, 26, 0.06);
}

.chapter-count {
  color: var(--ink-soft);
  font-size: 0.78rem;
}

.chapter-caret {
  width: 24px;
  height: 24px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(164, 75, 26, 0.08);
  color: var(--accent);
  font-size: 0.92rem;
  line-height: 1;
}

.lesson-list {
  padding: 0 8px 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.lesson-list.closed {
  display: none;
}

.lesson-btn {
  width: 100%;
  text-align: left;
  border: 0;
  cursor: pointer;
  border-radius: 16px;
  padding: 12px 14px;
  background: rgba(36, 22, 15, 0.04);
  transition: background 0.18s ease, transform 0.18s ease;
}

.lesson-btn:hover {
  background: rgba(164, 75, 26, 0.08);
  transform: translateX(2px);
}

.lesson-btn.active {
  background: rgba(164, 75, 26, 0.14);
  box-shadow: inset 0 0 0 1px rgba(164, 75, 26, 0.12);
}

.lesson-title {
  display: block;
  min-width: 0;
  color: var(--ink);
  font-size: 0.92rem;
  font-weight: 700;
  line-height: 1.45;
}

.viewer-copy {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.viewer-copy.compact {
  gap: 0;
}

.viewer-frame {
  margin-top: 16px;
  border-radius: 24px;
  overflow: hidden;
  border: 1px solid rgba(59, 44, 31, 0.1);
  background: #16110e;
  width: 100%;
  max-width: 100%;
}

.viewer-frame iframe {
  display: block;
  width: 100%;
  min-height: 70vh;
  border: 0;
}

.local-pdf-frame {
  display: block;
  width: 100%;
  min-height: 70vh;
  border: 0;
  background: #16110e;
}

.pdf-viewer-root {
  width: 100%;
  min-height: 70vh;
}

.pdf-canvas-list {
  display: flex;
  flex-direction: column;
  gap: 18px;
  width: 100%;
  min-height: inherit;
}

.pdf-page-shell {
  position: relative;
  width: 100%;
  padding: 0;
  border-radius: 18px;
  overflow: hidden;
  background: #ffffff;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.16);
}

.pdf-page-canvas {
  display: block;
  width: 100%;
  height: auto;
  background: #ffffff;
}

.pdf-viewer-root.standalone {
  min-height: 82vh;
}

.pdf-guard-host {
  position: relative;
  overflow: hidden;
}

.pdf-guard-host,
.pdf-guard-host * {
  user-select: none;
  -webkit-user-select: none;
}

.pdf-page-watermark {
  position: absolute;
  inset: 0;
  z-index: 3;
  pointer-events: none;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.pdf-page-watermark-stamp {
  max-width: 92%;
  color: rgba(36, 22, 15, 0.14);
  font-size: clamp(0.72rem, 1.4vw, 0.96rem);
  font-weight: 800;
  letter-spacing: 0.08em;
  transform: rotate(-22deg);
  text-transform: none;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.viewer-note {
  margin-top: 16px;
  border-radius: 20px;
  padding: 16px;
  background: rgba(36, 22, 15, 0.04);
  border: 1px solid rgba(59, 44, 31, 0.08);
}

.viewer-note.compact {
  display: inline-flex;
  align-items: center;
  min-height: 48px;
}

.inline-status {
  margin: 12px 2px 0;
  color: var(--ink-soft);
  font-size: 0.92rem;
}

.assignment-view {
  margin-top: 18px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.assignment-question {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.assignment-label {
  color: var(--ink);
  font-size: 0.95rem;
  font-weight: 700;
  line-height: 1.5;
}

.assignment-textarea {
  width: 100%;
  resize: vertical;
  min-height: 120px;
  border: 1px solid rgba(59, 44, 31, 0.14);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.86);
  padding: 14px 16px;
  font: inherit;
  color: var(--ink);
  line-height: 1.6;
}

.assignment-textarea:focus {
  outline: 2px solid rgba(164, 75, 26, 0.18);
  border-color: rgba(164, 75, 26, 0.28);
}

.assignment-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.assignment-save-btn[disabled],
.assignment-submit-btn[disabled] {
  cursor: wait;
  opacity: 0.72;
}

.assignment-status {
  margin: 0;
  color: var(--ink-soft);
  font-size: 0.92rem;
}

.assignment-status.success {
  color: #195734;
}

.assignment-status.error {
  color: #842f19;
}

.empty-state {
  border-radius: var(--radius-lg);
  padding: 30px;
  text-align: left;
}

.empty-state h3,
.empty-state p {
  margin-top: 0;
}

.footer-note {
  padding: 0 2px;
  color: var(--ink-soft);
  font-size: 0.92rem;
}

.loading-screen {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.loading-card {
  width: min(420px, 100%);
  border-radius: 30px;
  padding: 28px;
  text-align: center;
}

.spinner {
  width: 46px;
  height: 46px;
  margin: 0 auto 16px;
  border: 4px solid rgba(36, 22, 15, 0.09);
  border-top-color: var(--accent);
  border-radius: 999px;
  animation: spin 0.85s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.viewer-standalone-body {
  min-height: 100vh;
}

.viewer-standalone-shell {
  min-height: 100vh;
  padding: 18px;
  display: grid;
  gap: 18px;
}

.viewer-standalone-header,
.viewer-standalone-panel {
  max-width: 1400px;
  width: 100%;
  margin: 0 auto;
}

.viewer-standalone-header h1 {
  margin: 0;
}

.viewer-heading {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.viewer-standalone-panel {
  padding: 14px;
}

@media print {
  body.pdf-print-locked > * {
    display: none !important;
  }

  body.pdf-print-locked::before {
    content: "Protected PDF";
    display: block;
    padding: 48px;
    color: #24160f;
    font-family: "Manrope", "Noto Sans KR", sans-serif;
    font-size: 20px;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
  }
}

@media (max-width: 1080px) {
  .product-grid,
  .auth-card,
  .hero {
    grid-template-columns: 1fr;
  }

  .hero {
    align-items: stretch;
  }

  .hero-metrics {
    width: 100%;
  }
}

@media (max-width: 980px) {
  .course-shell {
    grid-template-columns: 320px minmax(0, 1fr);
  }
}

@media (max-width: 720px) {
  .shell,
  .auth-shell {
    padding: 12px;
  }

  .hero,
  .card,
  .sidebar-panel,
  .viewer-panel,
  .auth-copy,
  .auth-panel,
  .loading-card {
    padding: 20px;
    border-radius: 22px;
  }

  .course-shell {
    display: block;
    width: 100%;
    padding: 0;
    border: 0;
    background: transparent;
    box-shadow: none;
  }

  .hero h1,
  .auth-copy h1,
  .viewer-copy h2 {
    font-size: 1.8rem;
  }

  .viewer-copy h2 {
    font-size: 1.2rem;
    line-height: 1.22;
  }

  .topbar {
    top: 8px;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    border-radius: 20px;
  }

  .brand {
    align-items: center;
    gap: 10px;
    min-width: 0;
  }

  .brand-mark {
    width: 38px;
    height: 38px;
    border-radius: 14px;
    font-size: 0.92rem;
  }

  .brand-copy h2 {
    font-size: 1rem;
  }

  .brand-copy p {
    font-size: 0.76rem;
    line-height: 1.2;
  }

  .top-actions {
    width: auto;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
    flex-wrap: nowrap;
  }

  .top-actions.single {
    justify-content: flex-end;
  }

  .top-actions .ghost-btn,
  .lesson-actions .btn,
  .lesson-actions .ghost-btn,
  .assignment-actions .btn,
  .assignment-actions .ghost-btn {
    width: 100%;
    justify-content: center;
  }

  .top-actions .ghost-btn {
    width: auto;
    min-height: 40px;
    padding: 10px 14px;
    font-size: 0.88rem;
  }

  .top-actions .nav-library-btn {
    display: none;
  }

  .library-page {
    display: flex;
    gap: 14px;
  }

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

  .course-button {
    min-height: 92px;
    padding: 18px;
    border-radius: 26px;
  }

  .course-button-copy strong {
    font-size: 1.08rem;
  }

  .course-button-state {
    min-width: 64px;
    min-height: 38px;
    padding: 0 12px;
    font-size: 0.72rem;
    letter-spacing: 0.12em;
  }

  .library-header {
    padding: 18px;
    border-radius: 24px;
  }

  .library-header-count {
    min-width: 56px;
    width: 56px;
    height: 56px;
    font-size: 1.2rem;
  }

  .product-grid {
    grid-template-columns: 1fr;
    gap: 14px;
  }

  .library-card {
    min-height: 0;
    gap: 18px;
    padding: 20px;
    border-radius: 24px;
  }

  .library-card .btn {
    width: 100%;
  }

  .chapter-list {
    max-height: calc(100dvh - 108px);
    padding-right: 0;
  }

  .mobile-toc-list {
    flex: 1 1 auto;
    min-height: 0;
    gap: 10px;
    padding: 4px 2px 12px;
  }

  .mobile-toc-section {
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.94);
    box-shadow: 0 10px 22px rgba(77, 49, 25, 0.05);
  }

  .mobile-toc-section.open {
    background: rgba(255, 248, 241, 0.98);
  }

  .mobile-toc-section-header {
    padding: 14px 14px 13px;
  }

  .mobile-toc-section-title {
    font-size: 0.94rem;
    font-weight: 800;
    line-height: 1.4;
    overflow-wrap: anywhere;
    word-break: keep-all;
  }

  .mobile-toc-section-meta {
    gap: 8px;
    padding-left: 4px;
  }

  .mobile-toc-section-count {
    min-width: 28px;
    min-height: 28px;
    font-size: 0.74rem;
  }

  .mobile-toc-section-caret {
    width: 26px;
    height: 26px;
    font-size: 0.9rem;
  }

  .mobile-toc-lessons {
    padding: 0 12px 12px;
  }

  .mobile-lesson-btn {
    padding: 13px 12px;
    border-radius: 16px;
  }

  .mobile-lesson-text {
    font-size: 0.9rem;
  }

  .mobile-sidebar-overlay.visible {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 58;
    border: 0;
    padding: 0;
    background: rgba(36, 22, 15, 0.34);
    backdrop-filter: blur(6px);
    touch-action: none;
  }

  .course-sidebar {
    display: none;
  }

  .course-shell {
    grid-template-columns: 1fr;
    gap: 0;
    padding: 0;
  }

  .mobile-toc-sheet {
    width: 100vw;
    max-width: 100vw;
    height: 100dvh;
    padding:
      calc(env(safe-area-inset-top, 0px) + 12px)
      12px
      calc(env(safe-area-inset-bottom, 0px) + 12px);
    background: linear-gradient(180deg, rgba(255, 250, 244, 0.98), rgba(246, 236, 223, 0.98));
  }

  .mobile-toc-sheet.visible {
    display: flex;
    flex-direction: column;
  }

  .mobile-toc-header {
    position: relative;
    top: 0;
    z-index: 1;
    flex: 0 0 auto;
    background: transparent;
    padding: 4px 4px 14px;
    margin-bottom: 2px;
  }

  .mobile-toc-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    align-items: stretch;
  }

  .mobile-toc-actions .ghost-btn {
    flex: 1 1 0;
    justify-content: center;
    min-height: 44px;
  }

  .mobile-toc-copy h3 {
    font-size: 1.45rem;
  }

  .viewer-panel {
    border-radius: 24px;
    padding: 16px;
    width: 100%;
    max-width: 100%;
    min-width: 0;
  }

  .viewer-toolbar {
    margin-bottom: 14px;
    justify-content: flex-start;
    width: 100%;
    min-width: 0;
  }

  .viewer-chip {
    font-size: 0.74rem;
    letter-spacing: 0.12em;
  }

  .chapter-list,
  .chapter,
  .chapter-toggle,
  .lesson-list,
  .lesson-btn,
  .viewer-copy,
  .viewer-frame,
  .assignment-view,
  .assignment-question,
  .assignment-textarea,
  .lesson-actions {
    width: 100%;
    max-width: 100%;
    min-width: 0;
  }

  .chapter-list {
    flex: 1 1 auto;
    min-height: 0;
    padding-top: 6px;
    padding-bottom: 28px;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
    touch-action: pan-y;
  }

  .chapter {
    border: 1px solid rgba(59, 44, 31, 0.1);
    background: #fffdf9;
    border-radius: 18px;
    box-shadow: none;
  }

  .chapter-toggle {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: flex-start;
    gap: 10px;
    padding: 16px 14px;
    background: transparent;
  }

  .chapter-title {
    display: block;
    font-size: 0.95rem;
    line-height: 1.4;
    width: 100%;
    flex: 1 1 auto;
    color: var(--ink);
    -webkit-text-fill-color: var(--ink);
    white-space: normal;
    overflow-wrap: anywhere;
    word-break: keep-all;
  }

  .chapter-meta {
    position: static;
    transform: none;
    min-height: 0;
    padding: 0 0 0 8px;
    background: transparent;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    flex: 0 0 auto;
    margin-top: 0;
  }

  .chapter-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 24px;
    color: var(--ink-soft);
    font-size: 0.74rem;
    font-weight: 800;
  }

  .chapter-caret {
    width: 28px;
    height: 28px;
    font-size: 1rem;
    flex: 0 0 auto;
  }

  .floating-toc-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    top: calc(env(safe-area-inset-top, 0px) + 72px);
    z-index: 70;
    min-width: 76px;
    min-height: 44px;
    padding: 10px 14px;
    border-radius: 20px;
    font-size: 0.9rem;
  }

  .lesson-list {
    padding: 0 12px 12px;
    gap: 10px;
  }

  .lesson-btn {
    padding: 14px 12px;
    border: 1px solid rgba(59, 44, 31, 0.08);
    background: #fbf7f0;
    box-shadow: none;
  }

  .lesson-title {
    color: var(--ink);
    font-size: 0.92rem;
    line-height: 1.45;
  }

  .viewer-frame iframe {
    min-height: 46vh;
  }

  .pdf-viewer-root {
    min-height: 46vh;
  }

  .pdf-viewer-root.standalone {
    min-height: 68vh;
  }

  .pdf-page-watermark {
    padding: 16px;
  }

  .pdf-page-watermark-stamp {
    max-width: 86%;
    font-size: 0.72rem;
  }

  .viewer-standalone-shell {
    padding: 12px;
  }

  .viewer-standalone-header {
    position: sticky;
    top: 8px;
    z-index: 10;
    backdrop-filter: blur(12px);
  }
}

@media (max-width: 520px) {
  .topbar {
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .top-actions {
    gap: 6px;
  }

  .support-notice {
    flex-direction: column;
    align-items: flex-start;
  }

  .floating-toc-btn {
    right: 12px;
    top: calc(env(safe-area-inset-top, 0px) + 68px);
    min-width: 72px;
  }
}
