:root {
  color-scheme: light;
  --ink: #151515;
  --muted: #6f6f68;
  --paper: #f5f4ee;
  --card: #fffef8;
  --line: #d8d6cc;
  --accent: #d9ff43;
  --shadow: 0 24px 70px rgba(28, 28, 20, 0.09);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-width: 320px;
  color: var(--ink);
  background:
    radial-gradient(circle at 90% 8%, rgba(217, 255, 67, 0.28), transparent 28rem),
    var(--paper);
  font-family: Inter, Pretendard, "Noto Sans KR", system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}

button, input { font: inherit; }

.shell {
  width: min(1180px, calc(100% - 40px));
  margin: 0 auto;
  padding: 72px 0 56px;
}

.hero { max-width: 760px; margin-bottom: 52px; }
.eyebrow { margin: 0 0 18px; font-size: 0.75rem; font-weight: 800; letter-spacing: 0.2em; }

h1 {
  margin: 0;
  font-size: clamp(2.8rem, 7vw, 6.7rem);
  line-height: 0.92;
  letter-spacing: -0.07em;
  font-weight: 850;
}

h1 span { color: transparent; -webkit-text-stroke: 1.5px var(--ink); }
.intro { max-width: 640px; margin: 28px 0 0; color: var(--muted); font-size: 1.08rem; line-height: 1.75; }

.panel.page-panel { display: grid; grid-template-columns: minmax(240px, 0.75fr) minmax(340px, 1.25fr); gap: 42px; align-items: center; margin-bottom: 20px; color: white; background: var(--ink); border-color: var(--ink); }
.page-panel-copy h2 { margin: 12px 0 8px; font-size: clamp(1.6rem, 3vw, 2.35rem); letter-spacing: -0.045em; }
.page-panel-copy p { margin: 0; color: #b8b8b1; font-size: 0.88rem; line-height: 1.65; }
.experiment-badge { display: inline-flex; border: 1px solid #696961; border-radius: 999px; padding: 5px 9px; color: var(--accent); font-size: 0.64rem; font-weight: 800; letter-spacing: 0.12em; }
.page-form label { display: block; margin-bottom: 9px; color: #d7d7d1; font-size: 0.82rem; font-weight: 750; }
.page-form .input-row input { min-width: 0; flex: 1; height: 52px; border: 1px solid #505049; border-radius: 12px; color: white; background: #262624; padding: 0 15px; outline: none; }
.page-form input::placeholder { color: #85857e; }
.page-form .input-row input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(217, 255, 67, 0.16); }
.page-note { margin: 10px 0 0; color: #96968f; font-size: 0.73rem; line-height: 1.5; }

.page-viewer { margin-bottom: 52px; overflow: hidden; border: 1px solid var(--line); border-radius: 22px; background: white; box-shadow: var(--shadow); }
.page-viewer[hidden] { display: none; }
.viewer-bar { min-height: 54px; display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 10px 18px; color: white; background: var(--ink); }
.viewer-bar > div { display: flex; align-items: center; gap: 10px; }
.viewer-bar strong { font-size: 0.82rem; }
.viewer-bar p { margin: 0; color: #aaa9a2; font-size: 0.74rem; text-align: right; }
.viewer-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 4px rgba(217, 255, 67, 0.13); }
#page-frame { display: block; width: 100%; height: min(72vh, 760px); min-height: 480px; border: 0; background: white; filter: invert(1); }
.viewer-meta { min-width: 0; display: flex; flex-direction: column; align-items: flex-end; gap: 3px; }
.viewer-actions { min-width: 0; display: flex; align-items: center; justify-content: flex-end; gap: 18px; }
#page-source { max-width: min(52vw, 680px); overflow: hidden; color: var(--accent); font-size: 0.75rem; text-overflow: ellipsis; white-space: nowrap; }
#site-home { flex: 0 0 auto; color: white; font-size: 0.8rem; font-weight: 800; text-decoration: none; }
#site-home:hover { color: var(--accent); }
#site-home:focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; border-radius: 2px; }
.preview-mode { overflow: hidden; background: var(--ink); }
.preview-mode .hero,
.preview-mode .page-panel,
.preview-mode .image-heading,
.preview-mode .workspace,
.preview-mode footer { display: none; }
.preview-mode .shell { width: 100%; padding: 0; }
.preview-mode .page-viewer { min-height: 100vh; margin: 0; border: 0; border-radius: 0; box-shadow: none; }
.preview-mode #page-frame { height: calc(100vh - 64px); min-height: 0; }
.image-heading { margin: 58px 0 22px; }
.image-heading .eyebrow { margin-bottom: 8px; }
.image-heading h2 { margin: 0; font-size: clamp(1.8rem, 4vw, 3.3rem); letter-spacing: -0.055em; }

.workspace { display: grid; grid-template-columns: minmax(0, 0.86fr) minmax(0, 1.14fr); gap: 20px; align-items: start; }
.panel { background: var(--card); border: 1px solid var(--line); border-radius: 24px; box-shadow: var(--shadow); padding: clamp(24px, 4vw, 42px); }

.section-heading { display: flex; gap: 16px; align-items: flex-start; }
.section-heading h2 { margin: 0 0 6px; font-size: 1.35rem; letter-spacing: -0.03em; }
.section-heading p { margin: 0; color: var(--muted); font-size: 0.9rem; line-height: 1.5; }
.step { display: grid; place-items: center; flex: 0 0 36px; height: 36px; border: 1px solid var(--ink); border-radius: 50%; font-size: 0.7rem; font-weight: 800; }

.url-form { margin-top: 36px; }
.url-form label { display: block; margin-bottom: 9px; font-size: 0.82rem; font-weight: 750; }
.input-row { display: flex; gap: 8px; }
.input-row input { min-width: 0; flex: 1; height: 52px; border: 1px solid var(--line); border-radius: 12px; background: white; padding: 0 15px; outline: none; }
.input-row input:focus { border-color: var(--ink); box-shadow: 0 0 0 3px rgba(21, 21, 21, 0.08); }
.hint, .paste-hint { margin: 9px 0 0; color: var(--muted); font-size: 0.76rem; line-height: 1.5; }

.button { min-height: 48px; border: 1px solid var(--ink); border-radius: 12px; padding: 0 18px; display: inline-flex; align-items: center; justify-content: center; gap: 9px; color: var(--ink); cursor: pointer; font-weight: 750; text-decoration: none; transition: transform 150ms ease, box-shadow 150ms ease, background 150ms ease; }
.button:hover:not(:disabled) { transform: translateY(-2px); box-shadow: 0 7px 0 rgba(21, 21, 21, 0.14); }
.button:active:not(:disabled) { transform: translateY(0); box-shadow: none; }
.button:focus-visible { outline: 3px solid rgba(36, 86, 255, 0.3); outline-offset: 2px; }
.button:disabled { opacity: 0.42; cursor: not-allowed; }
.button svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.button-dark { color: white; background: var(--ink); }
.button-light { background: white; }
.button-accent { background: var(--accent); }

.divider { display: flex; align-items: center; gap: 12px; margin: 26px 0; color: #96968f; font-size: 0.7rem; }
.divider::before, .divider::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.source-actions { display: grid; grid-template-columns: 1fr; gap: 10px; }
.file-button { width: 100%; }
.paste-hint { text-align: center; }
kbd { border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 4px; background: white; padding: 1px 5px; font-size: 0.7rem; }

.result-panel { min-width: 0; }
.preview { display: grid; place-items: center; min-height: 410px; margin-top: 28px; overflow: hidden; border: 1px dashed #bdbbb1; border-radius: 16px; background-color: #ebeae3; background-image: linear-gradient(45deg, #dfded7 25%, transparent 25%), linear-gradient(-45deg, #dfded7 25%, transparent 25%), linear-gradient(45deg, transparent 75%, #dfded7 75%), linear-gradient(-45deg, transparent 75%, #dfded7 75%); background-size: 24px 24px; background-position: 0 0, 0 12px, 12px -12px, -12px 0; }
.preview:not(.empty) { padding: 18px; }
.empty-state { display: flex; flex-direction: column; align-items: center; text-align: center; padding: 32px; }
.empty-state[hidden] { display: none; }
.empty-icon { display: grid; place-items: center; width: 62px; height: 62px; margin-bottom: 18px; border-radius: 50%; color: white; background: var(--ink); font-size: 2rem; }
.empty-state strong { font-size: 1rem; }
.empty-state span { margin-top: 7px; color: var(--muted); font-size: 0.8rem; }
#result-canvas { display: block; max-width: 100%; max-height: 580px; width: auto; height: auto; box-shadow: 0 12px 35px rgba(20, 20, 15, 0.15); }
#result-canvas[hidden] { display: none; }
.result-footer { display: flex; align-items: center; justify-content: space-between; gap: 18px; margin-top: 18px; }
#status { flex: 1; margin: 0; color: var(--muted); font-size: 0.8rem; line-height: 1.5; }
#status.error { color: #b42318; }

footer { padding: 0 20px 32px; text-align: center; color: var(--muted); font-size: 0.76rem; }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }

@media (max-width: 820px) {
  .shell { padding-top: 48px; }
  .panel.page-panel { grid-template-columns: 1fr; gap: 24px; }
  .workspace { grid-template-columns: 1fr; }
  .preview { min-height: 360px; }
}

@media (max-width: 520px) {
  .shell { width: min(100% - 24px, 1180px); padding-top: 32px; }
  .hero { margin-bottom: 34px; }
  .intro { font-size: 0.96rem; }
  .panel { border-radius: 18px; padding: 22px 18px; }
  .input-row { flex-direction: column; }
  .input-row .button { width: 100%; }
  .page-viewer { border-radius: 16px; margin-bottom: 38px; }
  .viewer-bar { align-items: flex-start; flex-direction: column; gap: 5px; }
  .viewer-meta { align-items: flex-start; min-width: 0; }
  .viewer-actions { width: 100%; justify-content: space-between; gap: 12px; }
  #page-source { max-width: calc(100vw - 130px); }
  .viewer-bar p { text-align: left; }
  #page-frame { min-height: 420px; height: 68vh; }
  .preview-mode #page-frame { height: calc(100vh - 100px); min-height: 0; }
  .image-heading { margin-top: 42px; }
  .preview { min-height: 300px; }
  .result-footer { align-items: stretch; flex-direction: column; }
  .result-footer .button { width: 100%; }
}

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