:root {
  color-scheme: dark;
  --bg: #050711;
  --panel: rgba(13, 18, 32, 0.82);
  --panel-strong: rgba(18, 25, 43, 0.92);
  --line: rgba(158, 181, 255, 0.22);
  --text: #f5f7fb;
  --muted: #b8c2d8;
  --soft: #7e8cad;
  --cyan: #5ee6ff;
  --mint: #8fffc7;
  --rose: #ff8bb4;
  --warning: #ffd166;
  --shadow: 0 24px 80px rgba(0, 0, 0, 0.42);
  --radius: 8px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  overflow-x: hidden;
  background:
    radial-gradient(circle at 18% 18%, rgba(94, 230, 255, 0.18), transparent 28rem),
    radial-gradient(circle at 78% 10%, rgba(255, 139, 180, 0.15), transparent 24rem),
    linear-gradient(140deg, #050711 0%, #0b1020 48%, #111522 100%);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans KR", Arial, sans-serif;
  line-height: 1.6;
}

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

a {
  color: inherit;
  text-decoration: none;
}

.starfield {
  position: fixed;
  inset: 0;
  z-index: -1;
  width: 100%;
  height: 100%;
}

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

.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 18px 0;
  backdrop-filter: blur(16px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 800;
  letter-spacing: 0;
}

.brand-mark {
  width: 28px;
  height: 28px;
  border: 1px solid rgba(143, 255, 199, 0.5);
  border-radius: 50%;
  background:
    radial-gradient(circle at 62% 38%, #f5f7fb 0 3px, transparent 4px),
    radial-gradient(circle at 48% 54%, var(--cyan), #2d5bff 62%, #111a33 63%);
  box-shadow: 0 0 28px rgba(94, 230, 255, 0.45);
}

.site-nav {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 0.95rem;
}

.site-nav a {
  padding: 8px 10px;
  border-radius: 6px;
}

.site-nav a:hover,
.site-nav a:focus-visible {
  color: var(--text);
  background: rgba(255, 255, 255, 0.08);
  outline: none;
}

.hero {
  min-height: 38vh;
  display: grid;
  align-items: center;
  padding: 54px 0 32px;
}

.hero-copy {
  max-width: 760px;
}

.eyebrow,
.panel-kicker {
  margin: 0 0 8px;
  color: var(--mint);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

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

h1 {
  margin: 0;
  max-width: 800px;
  font-size: clamp(2.25rem, 5.2vw, 5.6rem);
  line-height: 1.02;
  letter-spacing: 0;
}

.hero-description {
  max-width: 720px;
  margin: 22px 0 0;
  color: var(--muted);
  font-size: 1.08rem;
}

.tool-section,
.content-grid,
.info-section {
  padding: 56px 0;
}

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

.section-heading h2 {
  margin: 0;
  font-size: clamp(1.6rem, 3vw, 2.35rem);
  line-height: 1.18;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(320px, 0.85fr);
  gap: 18px;
  align-items: stretch;
}

.result-panel,
.upload-panel,
.content-grid article,
.info-section {
  border: 1px solid var(--line);
  background: var(--panel);
  box-shadow: var(--shadow);
  backdrop-filter: blur(20px);
}

.result-panel,
.upload-panel {
  position: relative;
  min-height: 560px;
  border-radius: var(--radius);
  padding: 20px;
}

.upload-panel {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.panel-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}

.panel-header h3 {
  margin: 0;
  font-size: 1.25rem;
}

.panel-actions {
  display: flex;
  gap: 8px;
}

.icon-button {
  min-width: 64px;
  height: 36px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
  cursor: pointer;
}

.icon-button:hover,
.icon-button:focus-visible {
  border-color: rgba(94, 230, 255, 0.75);
  outline: none;
}

#resultText {
  display: block;
  width: 100%;
  height: calc(100% - 76px);
  min-height: 452px;
  resize: vertical;
  border: 1px solid rgba(255, 255, 255, 0.11);
  border-radius: 6px;
  padding: 16px;
  background: rgba(4, 8, 18, 0.7);
  color: var(--text);
  caret-color: var(--cyan);
  outline: none;
}

#resultText:focus {
  border-color: rgba(94, 230, 255, 0.8);
  box-shadow: 0 0 0 3px rgba(94, 230, 255, 0.13);
}

.status-pill {
  flex: 0 0 auto;
  border: 1px solid rgba(143, 255, 199, 0.32);
  border-radius: 999px;
  padding: 5px 10px;
  color: var(--mint);
  background: rgba(143, 255, 199, 0.08);
  font-size: 0.82rem;
  font-weight: 700;
}

.drop-zone {
  display: grid;
  place-items: center;
  min-height: 210px;
  border: 1px dashed rgba(94, 230, 255, 0.45);
  border-radius: var(--radius);
  padding: 24px;
  text-align: center;
  background:
    linear-gradient(180deg, rgba(94, 230, 255, 0.08), rgba(143, 255, 199, 0.035)),
    rgba(255, 255, 255, 0.04);
  cursor: pointer;
}

.drop-zone.is-dragging,
.drop-zone:hover {
  border-color: var(--mint);
  background: rgba(94, 230, 255, 0.12);
}

.drop-zone input {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
}

.drop-icon {
  width: 54px;
  height: 54px;
  margin-bottom: 12px;
  border-radius: 50%;
  border: 1px solid rgba(94, 230, 255, 0.45);
  background:
    radial-gradient(circle at center, rgba(245, 247, 251, 0.9) 0 3px, transparent 4px),
    conic-gradient(from 90deg, var(--cyan), var(--rose), var(--mint), var(--cyan));
  box-shadow: 0 0 34px rgba(94, 230, 255, 0.25);
}

.drop-title {
  display: block;
  color: var(--text);
  font-weight: 800;
}

.drop-help {
  display: block;
  margin-top: 6px;
  color: var(--muted);
  font-size: 0.92rem;
}

.preview-frame {
  margin: 0;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: var(--radius);
  background: rgba(0, 0, 0, 0.22);
}

.preview-frame img {
  display: block;
  width: 100%;
  max-height: 210px;
  object-fit: contain;
  background: rgba(255, 255, 255, 0.04);
}

.preview-frame figcaption {
  padding: 10px 12px;
  color: var(--muted);
  font-size: 0.88rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.settings-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.settings-row label {
  color: var(--muted);
  font-weight: 700;
}

.settings-row select {
  min-width: 158px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 6px;
  padding: 9px 10px;
  background: #11182a;
  color: var(--text);
}

.progress-wrap {
  margin-top: auto;
}

.progress-label {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  color: var(--muted);
  font-size: 0.9rem;
}

.progress-track {
  height: 8px;
  margin-top: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.09);
}

.progress-bar {
  display: block;
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--cyan), var(--mint));
  transition: width 180ms ease;
}

.extract-button {
  align-self: flex-end;
  min-width: 132px;
  min-height: 48px;
  border: 0;
  border-radius: 8px;
  padding: 0 22px;
  color: #03101a;
  background: linear-gradient(135deg, var(--cyan), var(--mint));
  font-weight: 900;
  cursor: pointer;
  box-shadow: 0 14px 32px rgba(94, 230, 255, 0.28);
}

.extract-button:disabled {
  cursor: not-allowed;
  opacity: 0.58;
  box-shadow: none;
}

.extract-button:not(:disabled):hover,
.extract-button:not(:disabled):focus-visible {
  transform: translateY(-1px);
  outline: none;
}

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

.content-grid .section-heading {
  grid-column: 1 / -1;
}

.content-grid article,
.info-section {
  border-radius: var(--radius);
  padding: 22px;
}

.content-grid h3 {
  margin: 0 0 10px;
}

.content-grid p,
.info-section p {
  margin: 0;
  color: var(--muted);
}

.info-section p + p {
  margin-top: 14px;
}

.site-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 36px 0 44px;
  color: var(--soft);
}

.site-footer p {
  margin: 0;
}

.site-footer a {
  color: var(--mint);
  font-weight: 800;
}

@media (max-width: 860px) {
  .page-shell {
    width: min(100% - 24px, 720px);
  }

  .site-header {
    position: static;
    align-items: flex-start;
    flex-direction: column;
  }

  .site-nav {
    width: 100%;
    overflow-x: auto;
    padding-bottom: 4px;
  }

  .hero {
    min-height: auto;
    padding-top: 34px;
  }

  .workspace,
  .content-grid {
    grid-template-columns: 1fr;
  }

  .result-panel,
  .upload-panel {
    min-height: auto;
  }

  .upload-panel {
    order: -1;
  }

  #resultText {
    min-height: 320px;
  }
}

@media (max-width: 520px) {
  .panel-header,
  .settings-row,
  .site-footer {
    flex-direction: column;
    align-items: stretch;
  }

  .panel-actions {
    width: 100%;
  }

  .icon-button,
  .extract-button {
    width: 100%;
  }

  .extract-button {
    align-self: stretch;
  }
}
