:root {
  --ink: #15130f;
  --muted: #6d6559;
  --paper: #f5efe2;
  --card: #fffaf0;
  --line: #ded1bb;
  --accent: #0f6b5f;
  --accent-2: #d76635;
  --accent-3: #263f77;
  --warn: #a43d2f;
  --ok: #1e7356;
  --shadow: 0 24px 70px rgba(55, 43, 24, 0.16);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at 18% 5%, rgba(215, 102, 53, 0.18), transparent 32rem),
    radial-gradient(circle at 82% 0%, rgba(15, 107, 95, 0.18), transparent 30rem),
    linear-gradient(180deg, #efe3cf 0%, var(--paper) 45%, #fbf7ee 100%);
  font-family: "Arita Buri", "Noto Serif KR", "Source Serif 4", Georgia, serif;
}

button,
input,
textarea {
  font: inherit;
}

code {
  padding: 0.08rem 0.28rem;
  border-radius: 0.35rem;
  background: rgba(15, 107, 95, 0.1);
}

.hero {
  position: relative;
  min-height: 540px;
  overflow: hidden;
  padding: 5rem 5vw 3rem;
  border-bottom: 1px solid var(--line);
}

.hero__grid {
  position: absolute;
  inset: 0;
  opacity: 0.45;
  background-image:
    linear-gradient(rgba(21, 19, 15, 0.08) 1px, transparent 1px),
    linear-gradient(90deg, rgba(21, 19, 15, 0.08) 1px, transparent 1px);
  background-size: 46px 46px;
  mask-image: linear-gradient(180deg, black, transparent 80%);
}

.hero__content {
  position: relative;
  max-width: 980px;
}

.eyebrow,
.section-kicker {
  margin: 0 0 0.7rem;
  color: var(--accent-2);
  font-family: "Noto Sans KR", "Apple SD Gothic Neo", sans-serif;
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

h1,
h2 {
  margin: 0;
  letter-spacing: -0.055em;
  line-height: 0.98;
}

h1 {
  max-width: 880px;
  font-size: clamp(3.1rem, 9vw, 7.8rem);
}

h2 {
  font-size: clamp(2rem, 4vw, 3.3rem);
}

.lede {
  max-width: 760px;
  margin: 1.35rem 0 0;
  color: var(--muted);
  font-size: clamp(1.05rem, 2vw, 1.35rem);
  line-height: 1.75;
}

.hero__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.85rem;
  margin-top: 2rem;
}

.primary,
.ghost {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 0.78rem 1.15rem;
  border-radius: 999px;
  border: 1px solid transparent;
  cursor: pointer;
  font-family: "Noto Sans KR", "Apple SD Gothic Neo", sans-serif;
  font-weight: 800;
  text-decoration: none;
  transition: transform 160ms ease, box-shadow 160ms ease, background 160ms ease;
}

.primary {
  color: #fffaf0;
  background: var(--accent);
  box-shadow: 0 12px 30px rgba(15, 107, 95, 0.25);
}

.primary:hover,
.ghost:hover {
  transform: translateY(-2px);
}

.ghost {
  color: var(--ink);
  border-color: var(--line);
  background: rgba(255, 250, 240, 0.62);
}

.small {
  min-height: 38px;
  padding: 0.45rem 0.8rem;
  font-size: 0.9rem;
}

.full {
  width: 100%;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(0, 1.55fr) minmax(320px, 0.7fr);
  gap: 1.1rem;
  max-width: 1480px;
  margin: -5rem auto 5rem;
  padding: 0 5vw;
  position: relative;
}

.panel,
.metrics-grid > article {
  border: 1px solid rgba(222, 209, 187, 0.9);
  border-radius: 28px;
  background: rgba(255, 250, 240, 0.88);
  box-shadow: var(--shadow);
  backdrop-filter: blur(14px);
}

.panel {
  padding: clamp(1.1rem, 2.4vw, 2rem);
}

.setup-panel,
.results-panel,
.stats-panel,
.detail-panel,
.metrics-grid {
  grid-column: 1 / -1;
}

.control-panel {
  align-self: start;
}

.panel__heading {
  margin-bottom: 1.2rem;
}

.panel__heading p:not(.section-kicker) {
  max-width: 760px;
  color: var(--muted);
  line-height: 1.65;
}

.row-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
}

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

.field {
  display: grid;
  gap: 0.42rem;
  color: var(--muted);
  font-family: "Noto Sans KR", "Apple SD Gothic Neo", sans-serif;
  font-size: 0.92rem;
  font-weight: 700;
}

.field span {
  color: var(--ink);
}

.field.wide {
  grid-column: 1 / -1;
}

.field.compact {
  min-width: 0;
}

input[type="file"],
input[type="number"],
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 18px;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.62);
  outline: none;
}

input[type="file"] {
  padding: 0.85rem;
}

input[type="number"] {
  padding: 0.85rem 1rem;
}

textarea {
  resize: vertical;
  min-height: 120px;
  padding: 1rem;
  line-height: 1.65;
}

input:focus,
textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px rgba(15, 107, 95, 0.12);
}

.schema-card {
  margin-top: 1rem;
  border: 1px dashed var(--line);
  border-radius: 20px;
  padding: 1rem;
  background: rgba(255, 255, 255, 0.36);
}

.schema-card summary {
  cursor: pointer;
  font-family: "Noto Sans KR", "Apple SD Gothic Neo", sans-serif;
  font-weight: 800;
}

pre {
  overflow: auto;
  margin: 1rem 0 0;
  padding: 1rem;
  border-radius: 16px;
  background: #1d201d;
  color: #f7efd9;
}

.weights {
  display: grid;
  gap: 0.75rem;
  margin: 1rem 0;
}

.weights label {
  display: grid;
  grid-template-columns: 7rem 1fr 3rem;
  align-items: center;
  gap: 0.7rem;
  font-family: "Noto Sans KR", "Apple SD Gothic Neo", sans-serif;
  font-weight: 800;
}

input[type="range"] {
  accent-color: var(--accent);
}

.checkline {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  font-family: "Noto Sans KR", "Apple SD Gothic Neo", sans-serif;
  font-weight: 800;
}

.note,
small {
  color: var(--muted);
  line-height: 1.55;
}

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

.metrics-grid > article {
  padding: 1.2rem;
}

.metric-label {
  color: var(--muted);
  font-family: "Noto Sans KR", "Apple SD Gothic Neo", sans-serif;
  font-size: 0.85rem;
  font-weight: 800;
}

.metric-value {
  margin-top: 0.4rem;
  font-size: clamp(2rem, 4vw, 3.6rem);
  font-weight: 900;
  letter-spacing: -0.06em;
}

.reference-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.chip {
  display: inline-flex;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.35rem 0.65rem;
  background: rgba(255, 255, 255, 0.48);
  color: var(--muted);
  font-family: "Noto Sans KR", "Apple SD Gothic Neo", sans-serif;
  font-size: 0.82rem;
  font-weight: 800;
}

.table-wrap {
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 20px;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 1020px;
  background: rgba(255, 255, 255, 0.48);
}

th,
td {
  padding: 0.82rem 0.9rem;
  border-bottom: 1px solid rgba(222, 209, 187, 0.75);
  vertical-align: top;
  text-align: left;
}

th {
  position: sticky;
  top: 0;
  z-index: 1;
  color: #fffaf0;
  background: var(--ink);
  font-family: "Noto Sans KR", "Apple SD Gothic Neo", sans-serif;
  font-size: 0.84rem;
}

td {
  line-height: 1.45;
}

.flag {
  color: #fff;
  border-radius: 999px;
  padding: 0.18rem 0.5rem;
  background: var(--warn);
  font-family: "Noto Sans KR", "Apple SD Gothic Neo", sans-serif;
  font-size: 0.82rem;
  font-weight: 900;
}

.flag.ok {
  background: var(--ok);
}

.stats-output {
  display: grid;
  gap: 1rem;
}

.stat-table {
  min-width: 520px;
}

.empty-state {
  color: var(--muted);
  border: 1px dashed var(--line);
  border-radius: 18px;
  padding: 1rem;
  background: rgba(255, 255, 255, 0.38);
}

.review-list {
  display: grid;
  gap: 0.75rem;
}

.review-card {
  border-left: 5px solid var(--warn);
  border-radius: 16px;
  padding: 0.95rem 1rem;
  background: rgba(164, 61, 47, 0.08);
}

.review-card b {
  display: block;
  margin-bottom: 0.25rem;
}

@media (max-width: 980px) {
  .workspace,
  .upload-grid,
  .form-grid,
  .score-controls,
  .metrics-grid {
    grid-template-columns: 1fr;
  }

  .workspace {
    margin-top: -3rem;
  }

  .control-panel {
    grid-column: 1 / -1;
  }

  .weights label {
    grid-template-columns: 1fr;
  }
}

@media (prefers-reduced-motion: no-preference) {
  .panel,
  .metrics-grid > article {
    animation: rise 560ms ease both;
  }

  .panel:nth-of-type(2) {
    animation-delay: 80ms;
  }

  @keyframes rise {
    from {
      opacity: 0;
      transform: translateY(16px);
    }
    to {
      opacity: 1;
      transform: translateY(0);
    }
  }
}
