:root {
  color-scheme: light;
  --ink: #17202a;
  --muted: #586775;
  --navy: #17365d;
  --blue: #245c9f;
  --blue-soft: #edf4fb;
  --green: #187552;
  --green-soft: #edf8f3;
  --amber: #8a5400;
  --amber-soft: #fff7e8;
  --red: #9e2f35;
  --red-soft: #fff0f0;
  --line: #d5dde5;
  --line-strong: #aebbc7;
  --surface: #ffffff;
  --canvas: #f4f6f8;
  --shadow: 0 8px 24px rgba(23, 54, 93, 0.08);
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-width: 320px;
  background: var(--canvas);
  color: var(--ink);
  font-family: Inter, Pretendard, "Noto Sans KR", "Apple SD Gothic Neo", Arial, sans-serif;
  font-size: 16px;
  line-height: 1.6;
}

button,
input,
textarea,
select {
  font: inherit;
}

a {
  color: var(--blue);
}

button,
.button,
.header-link {
  min-height: 40px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--navy);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 8px 14px;
  font-weight: 700;
  line-height: 1.25;
  text-decoration: none;
  transition: background-color 120ms ease, border-color 120ms ease, color 120ms ease, transform 100ms ease;
}

button:hover,
.button:hover,
.header-link:hover {
  border-color: var(--navy);
  background: #f7fafc;
}

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

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

:focus-visible {
  outline: 2px solid #0d63c8;
  outline-offset: 2px;
}

.skip-link {
  position: fixed;
  z-index: 100;
  top: 8px;
  left: 8px;
  transform: translateY(-160%);
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  background: var(--navy);
  color: #fff;
  font-weight: 800;
}

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

.site-header,
.public-header {
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}

.header-inner,
.public-header {
  width: min(100% - 48px, 1240px);
  min-height: 68px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 24px;
}

.brand {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--navy);
  font-weight: 850;
  letter-spacing: -0.02em;
  text-decoration: none;
  white-space: nowrap;
}

.brand-mark {
  width: 28px;
  height: 28px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.main-nav {
  display: flex;
  align-items: center;
  gap: 4px;
  flex: 1;
}

.main-nav a,
.public-header nav a {
  flex: 0 0 auto;
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 720;
  text-decoration: none;
  white-space: nowrap;
}

.main-nav a:hover,
.main-nav a[aria-current="page"],
.public-header nav a:hover {
  background: var(--blue-soft);
  color: var(--navy);
}

.header-link {
  font-size: 14px;
}

.page-shell {
  width: min(100% - 48px, 1240px);
  min-height: calc(100vh - 160px);
  margin: 0 auto;
  padding: 48px 0 64px;
}

.page-heading {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 28px;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--green);
  font-size: 14px;
  font-weight: 800;
  letter-spacing: 0.02em;
}

h1,
h2,
h3,
p {
  overflow-wrap: anywhere;
}

h1 {
  margin: 0;
  color: var(--navy);
  font-size: clamp(30px, 4vw, 44px);
  line-height: 1.18;
  letter-spacing: -0.035em;
}

h2 {
  margin: 0;
  color: var(--navy);
  font-size: 21px;
  line-height: 1.35;
  letter-spacing: -0.02em;
}

h3 {
  margin: 0;
  color: var(--navy);
  font-size: 17px;
  line-height: 1.4;
}

.page-summary,
.public-lead {
  max-width: 760px;
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 16px;
}

.status-region:empty {
  display: none;
}

.status-region {
  margin-bottom: 20px;
  border-left: 4px solid var(--green);
  background: var(--green-soft);
  padding: 12px 16px;
  color: #164d39;
  font-size: 14px;
}

.loading-state,
.state-card,
.panel,
.metric-card,
.package-card,
.review-card,
.preview-panel {
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--surface);
}

.loading-state {
  min-height: 260px;
  display: grid;
  align-content: center;
  gap: 16px;
  padding: 32px;
}

.skeleton {
  width: 100%;
  height: 20px;
  border-radius: 5px;
  background: #e4e9ee;
  animation: pulse 1.2s ease-in-out infinite alternate;
}

.skeleton-title {
  width: 42%;
  height: 30px;
}

@keyframes pulse {
  to { opacity: 0.48; }
}

.state-card {
  padding: 32px;
  text-align: center;
}

.state-card p {
  max-width: 620px;
  margin: 10px auto 20px;
  color: var(--muted);
}

.error-state {
  border-color: #e5b9bc;
  background: var(--red-soft);
}

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

.primary-button:hover {
  border-color: #0d2540;
  background: #0d2540;
}

.dashboard-grid,
.builder-grid,
.package-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(320px, 0.8fr);
  gap: 24px;
  align-items: start;
}

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

.metric-card {
  padding: 18px;
}

.metric-card span {
  display: block;
  color: var(--muted);
  font-size: 14px;
}

.metric-card strong {
  display: block;
  margin-top: 4px;
  color: var(--navy);
  font-size: 28px;
  line-height: 1.25;
}

.panel {
  overflow: hidden;
}

.panel-header {
  padding: 18px 20px;
  border-bottom: 1px solid var(--line);
}

.panel-header p,
.panel-body > p:first-child {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 14px;
}

.panel-body {
  padding: 20px;
}

.flow-list,
.chapter-list,
.package-list,
.review-list,
.plain-list {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 12px;
}

.flow-list li {
  display: grid;
  grid-template-columns: 32px minmax(0, 1fr);
  gap: 12px;
  align-items: start;
}

.flow-list b {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--blue-soft);
  color: var(--navy);
  display: grid;
  place-items: center;
}

.flow-list span {
  color: var(--muted);
  font-size: 14px;
}

.button-row,
.rating-row,
.export-row,
.preview-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.button-row {
  margin-top: 20px;
}

.form-grid {
  display: grid;
  gap: 18px;
}

label {
  color: var(--navy);
  font-size: 14px;
  font-weight: 760;
}

.field-help {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 450;
}

input,
textarea {
  width: 100%;
  min-height: 44px;
  margin-top: 7px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: #fff;
  color: var(--ink);
  padding: 10px 12px;
}

textarea {
  min-height: 118px;
  resize: vertical;
}

input:focus,
textarea:focus {
  border-color: var(--blue);
}

.field-error {
  margin: 6px 0 0;
  color: var(--red);
  font-size: 14px;
  font-weight: 650;
}

.chapter-list li,
.package-card,
.review-card {
  padding: 16px;
}

.chapter-list p,
.package-card p,
.review-card p {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 14px;
}

.package-card {
  display: grid;
  gap: 12px;
}

.package-card header,
.review-card header {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: start;
}

.meta-line {
  color: var(--muted);
  font-size: 14px;
}

.definition-list {
  display: grid;
  grid-template-columns: minmax(130px, 0.5fr) minmax(0, 1fr);
  margin: 0;
  border-top: 1px solid var(--line);
}

.definition-list dt,
.definition-list dd {
  margin: 0;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
}

.definition-list dt {
  color: var(--muted);
  font-size: 14px;
}

.definition-list dd {
  color: var(--ink);
  font-weight: 650;
}

.review-card[data-status="due"] {
  border-left: 4px solid var(--amber);
}

.review-card[data-status="scheduled"] {
  border-left: 4px solid var(--green);
}

.review-status {
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
}

.answer-panel {
  margin-top: 14px;
  border-top: 1px solid var(--line);
  padding-top: 14px;
}

.answer-panel[hidden],
.rating-row[hidden] {
  display: none;
}

.rating-row {
  margin-top: 14px;
}

.rating-row button {
  flex: 1 1 100px;
}

.notice {
  border-left: 4px solid var(--amber);
  background: var(--amber-soft);
  padding: 14px 16px;
  color: #5e3c07;
  font-size: 14px;
}

.notice strong {
  color: #4b2d00;
}

.text-link {
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  font-weight: 750;
  text-underline-offset: 3px;
}

.preview-panel {
  container-type: inline-size;
  overflow: hidden;
}

.preview-copy {
  padding: 20px 20px 0;
}

.preview-copy p {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 14px;
}

.motion-stage {
  position: relative;
  min-height: 330px;
  margin: 20px;
  overflow: hidden;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-md);
  background: #f9fbfd;
}

.motion-topbar {
  height: 42px;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 0 14px;
}

.motion-topbar span {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #aebbc7;
}

.motion-scene {
  position: absolute;
  inset: 58px 16px 16px;
  display: grid;
  align-content: center;
  gap: 14px;
  opacity: 0;
  transform: translateY(10px);
  pointer-events: none;
}

.motion-scene:first-of-type,
.motion-stage[data-step="1"] .scene-one,
.motion-stage[data-step="2"] .scene-two,
.motion-stage[data-step="3"] .scene-three {
  opacity: 1;
  transform: none;
}

.motion-label {
  color: var(--green);
  font-size: 14px;
  font-weight: 800;
}

.motion-field,
.motion-package,
.motion-review {
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: #fff;
  padding: 14px;
}

.motion-field strong,
.motion-review b {
  overflow-wrap: anywhere;
}

.motion-line {
  height: 10px;
  margin-top: 8px;
  border-radius: 3px;
  background: #dce4eb;
}

.motion-line.short {
  width: 58%;
}

.motion-action {
  width: 124px;
  min-height: 40px;
  border-radius: var(--radius-sm);
  background: var(--navy);
  color: #fff;
  display: grid;
  place-items: center;
  font-size: 14px;
  font-weight: 760;
}

.motion-package-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.motion-package {
  min-height: 82px;
  display: grid;
  align-content: center;
  gap: 4px;
  text-align: center;
}

.motion-package strong {
  color: var(--navy);
  font-size: 22px;
}

.motion-package span,
.motion-review span {
  color: var(--muted);
  font-size: 14px;
}

.motion-review {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  align-items: center;
}

.motion-review b {
  color: var(--navy);
}

.motion-due {
  color: var(--amber);
  font-size: 14px;
  font-weight: 800;
}

.motion-stage[data-playing="true"] .scene-one {
  animation: scene-one 4.8s ease both;
}

.motion-stage[data-playing="true"] .scene-two {
  animation: scene-two 4.8s ease both;
}

.motion-stage[data-playing="true"] .scene-three {
  animation: scene-three 4.8s ease both;
}

@keyframes scene-one {
  0%, 25% { opacity: 1; transform: none; }
  32%, 100% { opacity: 0; transform: translateY(-8px); }
}

@keyframes scene-two {
  0%, 28% { opacity: 0; transform: translateY(10px); }
  36%, 60% { opacity: 1; transform: none; }
  68%, 100% { opacity: 0; transform: translateY(-8px); }
}

@keyframes scene-three {
  0%, 64% { opacity: 0; transform: translateY(10px); }
  72%, 100% { opacity: 1; transform: none; }
}

.preview-controls {
  justify-content: space-between;
  padding: 0 20px 20px;
}

.preview-description {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
}

.site-footer {
  width: min(100% - 48px, 1240px);
  min-height: 72px;
  margin: 0 auto;
  border-top: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 24px;
  color: var(--muted);
  font-size: 14px;
}

.site-footer p {
  margin: 0;
}

.site-footer div {
  display: flex;
  gap: 18px;
}

.site-footer a {
  min-height: 40px;
  display: inline-flex;
  align-items: center;
}

.public-page {
  background: #fff;
}

.public-header {
  justify-content: space-between;
}

.public-header nav {
  display: flex;
  gap: 4px;
}

.public-shell {
  width: min(100% - 48px, 1040px);
  margin: 0 auto;
  padding: 64px 0 80px;
}

.public-shell > h1 {
  max-width: 820px;
}

.public-lead {
  margin-bottom: 32px;
}

.poster-section {
  display: grid;
  grid-template-columns: minmax(260px, 0.65fr) minmax(0, 1.35fr);
  gap: 28px;
  align-items: center;
  margin-top: 64px;
}

.poster-section p {
  color: var(--muted);
}

.poster-section img {
  width: 100%;
  height: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
}

.public-footer {
  width: min(100% - 48px, 1040px);
}

@container (max-width: 560px) {
  .motion-package-grid {
    grid-template-columns: 1fr;
  }

  .motion-package {
    min-height: 54px;
    grid-template-columns: auto 1fr;
    gap: 8px;
    align-items: center;
    text-align: left;
  }
}

@media (max-width: 900px) {
  .header-inner {
    width: min(100% - 32px, 1240px);
    flex-wrap: wrap;
    gap: 8px 16px;
    padding: 12px 0;
  }

  .main-nav {
    order: 3;
    flex-basis: 100%;
    overflow-x: auto;
    padding-bottom: 2px;
  }

  .dashboard-grid,
  .builder-grid,
  .package-layout,
  .poster-section {
    grid-template-columns: 1fr;
  }

  .poster-section {
    margin-top: 48px;
  }
}

@media (max-width: 600px) {
  .header-inner,
  .public-header,
  .page-shell,
  .site-footer,
  .public-shell,
  .public-footer {
    width: min(100% - 32px, 1240px);
  }

  .header-link {
    min-height: 44px;
  }

  .main-nav a,
  .public-header nav a,
  button,
  .button {
    min-height: 44px;
  }

  .page-shell {
    padding: 32px 0 48px;
  }

  .public-shell {
    padding: 40px 0 56px;
  }

  .public-header {
    min-height: 0;
    flex-wrap: wrap;
    gap: 8px;
    padding: 12px 0;
  }

  .public-header nav {
    width: 100%;
    overflow-x: auto;
  }

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

  .page-heading {
    margin-bottom: 22px;
  }

  .panel-header,
  .panel-body,
  .state-card {
    padding: 18px;
  }

  .definition-list {
    grid-template-columns: 1fr;
  }

  .definition-list dt {
    padding-bottom: 0;
    border-bottom: 0;
  }

  .definition-list dd {
    padding-top: 4px;
  }

  .motion-stage {
    min-height: 390px;
    margin: 16px;
  }

  .motion-review {
    grid-template-columns: 1fr;
  }

  .preview-controls {
    align-items: stretch;
    padding: 0 16px 16px;
  }

  .preview-controls button {
    width: 100%;
  }

  .site-footer {
    align-items: flex-start;
    flex-direction: column;
    padding: 20px 0;
  }

  .site-footer div {
    flex-wrap: wrap;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
    transition-duration: 0.001ms !important;
  }

  .skeleton {
    animation: none;
  }
}
