:root {
  --ink: #222735;
  --muted: #697083;
  --line: #dfe4ec;
  --surface: #ffffff;
  --surface-soft: #f5f7fa;
  --accent: #ef4b3f;
  --accent-soft: #fff0ed;
  --navy: #182a4a;
  --shadow: 0 18px 45px rgba(28, 37, 53, 0.08);
  font-family: Inter, Pretendard, "Apple SD Gothic Neo", "Noto Sans KR", sans-serif;
  color: var(--ink);
  background: #eef1f5;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 320px;
  background:
    radial-gradient(circle at 90% -10%, rgba(60, 105, 180, 0.13), transparent 38rem),
    #eef1f5;
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

.loading {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  background: rgba(238, 241, 245, 0.94);
  color: var(--navy);
  font-size: 1.05rem;
  font-weight: 750;
  backdrop-filter: blur(8px);
}

.loading.done {
  display: none;
}

.hero {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 2rem;
  padding: 3rem clamp(1.25rem, 4vw, 4.5rem) 2.1rem;
  color: white;
  background: linear-gradient(130deg, #142441 0%, #263f69 64%, #365c97 100%);
}

.hero h1,
.section-heading h2,
.panel-title h2,
.preview-heading h2 {
  margin: 0;
  letter-spacing: -0.035em;
}

.hero h1 {
  font-size: clamp(2rem, 4vw, 3.8rem);
  line-height: 1.06;
}

.hero .caption {
  margin: 0.95rem 0 0;
  color: #d7e3f6;
}

.eyebrow {
  margin: 0 0 0.55rem;
  color: var(--accent);
  font-size: 0.72rem;
  font-weight: 850;
  letter-spacing: 0.16em;
}

.hero .eyebrow {
  color: #ff968e;
}

.hero-badge {
  flex: 0 0 auto;
  padding: 0.72rem 1rem;
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  font-weight: 750;
}

main {
  width: min(1920px, 100%);
  margin: 0 auto;
  padding: 1.4rem clamp(1rem, 3vw, 3rem) 4rem;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 0.8rem;
  margin-bottom: 1rem;
}

.metric,
.sample-metrics article {
  border: 1px solid rgba(255, 255, 255, 0.8);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.9);
  box-shadow: 0 8px 24px rgba(28, 37, 53, 0.04);
}

.metric {
  padding: 1rem 1.1rem;
}

.metric span,
.sample-metrics span {
  display: block;
  margin-bottom: 0.38rem;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
}

.metric strong {
  font-size: clamp(1.2rem, 2vw, 1.7rem);
}

.workspace {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  gap: 1rem;
  align-items: start;
}

.filters,
.review {
  border: 1px solid rgba(255, 255, 255, 0.9);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: var(--shadow);
}

.filters {
  position: sticky;
  top: 1rem;
  display: grid;
  gap: 1rem;
  padding: 1.2rem;
}

.filters label,
.sample-picker label {
  display: grid;
  gap: 0.42rem;
  color: #464d5c;
  font-size: 0.82rem;
  font-weight: 750;
}

input,
select {
  width: 100%;
  min-height: 42px;
  padding: 0.62rem 0.7rem;
  border: 1px solid var(--line);
  border-radius: 9px;
  outline: none;
  color: var(--ink);
  background: white;
}

input:focus,
select:focus {
  border-color: #6587bb;
  box-shadow: 0 0 0 3px rgba(72, 116, 181, 0.12);
}

.two-fields {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.6rem;
}

.filter-result {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem;
  border-radius: 10px;
  color: var(--navy);
  background: #eef3fa;
  font-size: 0.82rem;
}

.filter-result strong {
  font-size: 1.1rem;
}

.page-control {
  display: grid;
  grid-template-columns: 38px 1fr auto 38px;
  align-items: center;
  gap: 0.35rem;
}

.page-control button,
.secondary {
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--navy);
  background: white;
  font-weight: 750;
}

.page-control button:hover,
.secondary:hover {
  border-color: #9fb0c9;
  background: #f5f8fc;
}

.review {
  min-width: 0;
  padding: clamp(1rem, 2.4vw, 2rem);
}

.sample-picker {
  margin-bottom: 1rem;
}

.sample-picker select {
  min-height: 48px;
  font-weight: 700;
}

.sample-metrics {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 0.65rem;
  margin-bottom: 1.2rem;
}

.sample-metrics article {
  padding: 0.85rem;
}

.sample-metrics strong {
  font-size: 1.02rem;
}

.input-panel,
.source-panel {
  overflow: hidden;
  margin-top: 1rem;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
}

.panel-title,
.preview-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem 1.1rem;
}

pre {
  overflow: auto;
  margin: 0;
  padding: 1rem;
  color: #263044;
  background: var(--surface-soft);
  font: 0.8rem/1.58 "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

#input-content {
  max-height: 28rem;
}

.preview-heading {
  padding: 1.6rem 0 0.8rem;
}

.preview-heading .secondary {
  padding: 0.55rem 0.85rem;
}

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

.preview-grid.single {
  grid-template-columns: 1fr;
}

.preview-card {
  overflow: hidden;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: white;
  box-shadow: 0 10px 28px rgba(28, 37, 53, 0.06);
}

.preview-title {
  min-height: 66px;
  padding: 0.9rem 1rem;
  border-bottom: 1px solid var(--line);
}

.preview-title h3 {
  margin: 0;
  font-size: 1rem;
}

.preview-card a {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 390px;
  padding: 0.5rem;
  background:
    linear-gradient(45deg, #f7f8fa 25%, transparent 25%),
    linear-gradient(-45deg, #f7f8fa 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #f7f8fa 75%),
    linear-gradient(-45deg, transparent 75%, #f7f8fa 75%);
  background-size: 20px 20px;
  background-position: 0 0, 0 10px, 10px -10px, -10px 0;
}

.preview-card img {
  display: block;
  width: 100%;
  height: auto;
  border: 1px solid #edf0f4;
  background: white;
}

.preview-grid.single .preview-card a {
  min-height: 640px;
}

.error-text {
  display: block;
  margin-top: 0.35rem;
  color: #b32921;
  font-size: 0.74rem;
}

.tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
  padding: 0.65rem;
  border-bottom: 1px solid var(--line);
}

.tab {
  padding: 0.58rem 0.78rem;
  border: 0;
  border-radius: 8px;
  color: var(--muted);
  background: transparent;
  font-weight: 750;
}

.tab.active {
  color: var(--accent);
  background: var(--accent-soft);
}

.tab-panel {
  display: none;
}

.tab-panel.active {
  display: block;
}

.tab-panel .secondary {
  margin: 0.75rem 0.75rem 0;
  padding: 0.48rem 0.75rem;
}

.tab-panel pre {
  max-height: 42rem;
  margin-top: 0.75rem;
}

.fatal-error {
  position: fixed;
  right: 1rem;
  bottom: 1rem;
  left: 1rem;
  z-index: 30;
  padding: 1rem;
  border: 1px solid #ef9d96;
  border-radius: 12px;
  color: #8e2019;
  background: #fff0ef;
  box-shadow: var(--shadow);
  font-weight: 700;
}

@media (max-width: 1180px) {
  .workspace {
    grid-template-columns: 1fr;
  }

  .filters {
    position: static;
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .section-heading,
  .filter-result,
  .filters > label:last-child {
    grid-column: 1 / -1;
  }

  .sample-metrics {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 820px) {
  .hero {
    align-items: flex-start;
    flex-direction: column;
  }

  .metric-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

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

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

  .preview-card a,
  .preview-grid.single .preview-card a {
    min-height: 260px;
  }
}

@media (max-width: 560px) {
  .metric-grid,
  .sample-metrics,
  .two-fields {
    grid-template-columns: 1fr;
  }

  main {
    padding-inline: 0.65rem;
  }

  .review {
    padding: 0.75rem;
  }
}
