:root {
  color-scheme: light;
  --ink: #182026;
  --muted: #64717d;
  --line: #d8e0e6;
  --panel: #ffffff;
  --page: #eef4f1;
  --green: #167b5f;
  --green-soft: #dcefe8;
  --blue: #265fa7;
  --blue-soft: #dce8f8;
  --gold: #a86f13;
  --gold-soft: #faebcf;
  --red: #b63b3b;
  --red-soft: #f7dddd;
  --shadow: 0 18px 48px rgba(29, 49, 58, 0.12);
  --radius: 8px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-width: 320px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.9), rgba(238, 244, 241, 0.96)),
    repeating-linear-gradient(90deg, rgba(22, 123, 95, 0.05) 0 1px, transparent 1px 54px),
    var(--page);
  color: var(--ink);
  font-family: Pretendard, "Apple SD Gothic Neo", "Malgun Gothic", "Segoe UI", sans-serif;
  letter-spacing: 0;
}

button,
input,
select,
textarea {
  font: inherit;
  letter-spacing: 0;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

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

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

.app-shell {
  width: min(1440px, 100%);
  margin: 0 auto;
  padding: 18px;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 0 18px;
  background: rgba(238, 244, 241, 0.9);
  backdrop-filter: blur(16px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.brand-mark {
  display: grid;
  width: 44px;
  height: 44px;
  place-items: center;
  border-radius: var(--radius);
  background: linear-gradient(135deg, #166f58, #2d6eb3);
  color: #fff;
  font-size: 0.78rem;
  font-weight: 900;
}

.brand strong,
.brand small {
  display: block;
}

.brand strong {
  font-size: 1rem;
}

.brand small {
  margin-top: 2px;
  color: var(--muted);
  font-size: 0.78rem;
}

.top-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.top-actions a,
.sample-button,
.secondary-action,
.icon-button {
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.86);
  color: var(--ink);
  cursor: pointer;
}

.top-actions a {
  display: inline-flex;
  align-items: center;
  padding: 0 13px;
  color: #36505d;
  font-size: 0.9rem;
}

.product-strip {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(360px, 0.82fr);
  gap: 24px;
  align-items: stretch;
  min-height: 320px;
  padding: 34px 0 26px;
}

.product-copy {
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-width: 0;
}

.eyebrow {
  margin: 0 0 10px;
  color: var(--green);
  font-size: 0.78rem;
  font-weight: 900;
  text-transform: uppercase;
}

.product-copy h1 {
  max-width: 860px;
  margin: 0;
  font-size: clamp(2rem, 4vw, 4.25rem);
  line-height: 1.06;
}

.product-copy p:last-child {
  max-width: 760px;
  margin: 20px 0 0;
  color: #455560;
  font-size: 1.05rem;
  line-height: 1.75;
}

.signal-board,
.sample-row,
.result-sequence,
.metric-grid,
.source-grid,
.action-panel {
  display: grid;
  gap: 12px;
}

.signal-board {
  grid-template-columns: 1fr 1fr;
  align-self: end;
}

.signal-node,
.result-card,
.metric-card,
.source-card,
.json-output,
.report-paper,
.input-panel,
.result-panel,
.score-panel,
.verdict-stage {
  border: 1px solid rgba(132, 153, 164, 0.34);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.95);
}

.signal-node {
  min-height: 136px;
  padding: 16px;
  box-shadow: 0 10px 28px rgba(32, 55, 65, 0.08);
}

.signal-node span,
.card-index,
.section-badge {
  display: inline-grid;
  min-width: 34px;
  min-height: 26px;
  place-items: center;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 900;
}

.signal-node strong,
.signal-node small {
  display: block;
}

.signal-node strong {
  margin-top: 22px;
  font-size: 1.08rem;
}

.signal-node small {
  margin-top: 8px;
  color: var(--muted);
  line-height: 1.45;
}

.signal-node.strong span,
.card-index {
  background: var(--green-soft);
  color: var(--green);
}

.signal-node.warning span {
  background: var(--red-soft);
  color: var(--red);
}

.signal-node.calm span {
  background: var(--blue-soft);
  color: var(--blue);
}

.signal-node.action span {
  background: var(--gold-soft);
  color: var(--gold);
}

.workbench {
  display: grid;
  grid-template-columns: minmax(340px, 0.9fr) minmax(0, 1.36fr);
  gap: 18px;
  align-items: start;
  margin-top: 10px;
}

.input-panel {
  position: sticky;
  top: 88px;
  display: grid;
  gap: 16px;
  padding: 20px;
  box-shadow: var(--shadow);
}

.panel-head,
.card-head,
.json-head,
.section-title,
.score-summary {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.panel-head h2,
.section-title h2,
.score-summary h2 {
  margin: 0;
  font-size: 1.34rem;
}

.icon-button {
  display: inline-grid;
  width: 38px;
  padding: 0;
  place-items: center;
  font-weight: 900;
}

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

.sample-button {
  padding: 8px 10px;
  color: #334852;
  font-size: 0.86rem;
}

.sample-button:hover,
.top-actions a:hover,
.secondary-action:hover,
.icon-button:hover {
  border-color: rgba(22, 123, 95, 0.5);
  background: #f6fbf8;
}

.form-section-label {
  width: fit-content;
  padding: 5px 8px;
  border-radius: 999px;
  background: #edf5f1;
  color: #1f6f59;
  font-size: 0.78rem;
  font-weight: 900;
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

label {
  display: grid;
  gap: 7px;
  min-width: 0;
}

label span {
  color: #344650;
  font-size: 0.86rem;
  font-weight: 900;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fbfdfc;
  color: var(--ink);
  outline: none;
}

input,
select {
  min-height: 44px;
  padding: 0 12px;
}

textarea {
  min-height: 128px;
  resize: vertical;
  padding: 12px;
  line-height: 1.55;
}

.textarea-field.compact textarea {
  min-height: 78px;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--green);
  box-shadow: 0 0 0 3px rgba(22, 123, 95, 0.14);
}

.form-actions {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
}

.primary-action,
.secondary-action {
  min-height: 48px;
  border-radius: var(--radius);
  cursor: pointer;
  font-weight: 900;
}

.primary-action {
  border: 0;
  background: #126e56;
  color: #fff;
}

.primary-action:hover {
  background: #0f5f4a;
}

.primary-action:disabled {
  cursor: wait;
  opacity: 0.72;
}

.primary-action.slim {
  min-height: 42px;
  padding: 0 16px;
}

.secondary-action {
  padding: 0 14px;
}

.secondary-action.full-width {
  width: 100%;
  margin-top: 14px;
}

.result-panel {
  display: grid;
  gap: 16px;
  padding: 18px;
  box-shadow: var(--shadow);
}

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

.result-card,
.metric-card,
.source-card {
  min-width: 0;
  padding: 16px;
}

.card-head {
  justify-content: flex-start;
  align-items: center;
  margin-bottom: 14px;
}

.card-head h3,
.json-head h3 {
  margin: 0;
  font-size: 1rem;
}

.fact-list {
  display: grid;
  gap: 9px;
}

.fact-row {
  display: grid;
  grid-template-columns: minmax(120px, 0.42fr) minmax(0, 1fr);
  gap: 12px;
  align-items: start;
  padding: 9px 0;
  border-top: 1px solid #edf2f4;
}

.fact-row:first-child {
  border-top: 0;
}

.fact-row span {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 900;
}

.fact-row strong {
  min-width: 0;
  font-size: 0.92rem;
  line-height: 1.45;
}

.risk-stack {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.risk-pill {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 6px 10px;
  border-radius: 999px;
  background: var(--red-soft);
  color: #8b2626;
  font-size: 0.84rem;
  font-weight: 900;
  line-height: 1.35;
}

.risk-pill.low {
  background: var(--green-soft);
  color: var(--green);
}

.highlight-box {
  margin-top: 12px;
  padding: 12px;
  border: 1px solid #f0d0d0;
  border-radius: var(--radius);
  background: #fffafa;
  color: #3c4e58;
  line-height: 1.65;
}

mark {
  padding: 2px 4px;
  border-radius: 4px;
  background: #ffd9d5;
  color: #8b2626;
  font-weight: 900;
}

.score-panel {
  display: grid;
  gap: 16px;
  padding: 18px;
}

.score-summary h2 {
  font-size: 2.2rem;
}

.score-summary p:last-child {
  margin: 8px 0 0;
  color: var(--muted);
  line-height: 1.5;
}

.score-ring {
  --score: 50;
  display: grid;
  width: 116px;
  aspect-ratio: 1;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 50%;
  background:
    radial-gradient(circle at center, #ffffff 0 58%, transparent 59%),
    conic-gradient(var(--ring-color, #a86f13) calc(var(--score) * 1%), #dce4e9 0);
}

.score-ring span,
.score-ring small {
  grid-area: 1 / 1;
}

.score-ring span {
  transform: translateY(-8px);
  font-size: 1.72rem;
  font-weight: 900;
}

.score-ring small {
  transform: translateY(22px);
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 900;
}

.breakdown-list {
  display: grid;
  gap: 10px;
}

.breakdown-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px 12px;
  align-items: center;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fbfdfc;
}

.breakdown-row strong,
.breakdown-row small {
  display: block;
}

.breakdown-row small {
  margin-top: 3px;
  color: var(--muted);
  line-height: 1.45;
}

.breakdown-row > span {
  font-weight: 900;
}

.breakdown-row .meter {
  grid-column: 1 / -1;
}

.meter {
  height: 10px;
  overflow: hidden;
  border-radius: 999px;
  background: #e6edf1;
}

.meter span {
  display: block;
  width: var(--width, 50%);
  height: 100%;
  border-radius: inherit;
  background: var(--green);
}

.verdict-stage {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(240px, 0.58fr);
  gap: 18px;
  align-items: center;
  min-height: 168px;
  padding: 22px;
  background: linear-gradient(135deg, #ffffff 0%, #f4fbf7 100%);
}

.verdict-stage[data-level="safe"] {
  background: linear-gradient(135deg, #ffffff 0%, #e9f7ef 100%);
}

.verdict-stage[data-level="conditional"] {
  background: linear-gradient(135deg, #ffffff 0%, #eef5ff 100%);
}

.verdict-stage[data-level="private"] {
  background: linear-gradient(135deg, #ffffff 0%, #fff4dd 100%);
}

.verdict-stage[data-level="warning"],
.verdict-stage[data-level="danger"] {
  background: linear-gradient(135deg, #ffffff 0%, #ffe9e5 100%);
}

.verdict-main h2 {
  margin: 0;
  font-size: 2rem;
}

.verdict-main p:last-child {
  margin: 12px 0 0;
  color: #4a5b65;
  line-height: 1.6;
}

.reason-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

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

.reason-chip {
  min-height: 42px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.72);
  color: #3c4e58;
  line-height: 1.42;
  font-weight: 800;
}

.action-panel {
  grid-template-columns: 1fr 1fr;
}

.action-list {
  display: grid;
  gap: 9px;
  margin: 0;
  padding-left: 18px;
  color: #394a54;
  line-height: 1.5;
}

.checklist {
  display: grid;
  gap: 9px;
}

.check-row {
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 9px;
  padding: 9px 10px;
  border: 1px solid #edf2f4;
  border-radius: var(--radius);
  background: #fbfdfc;
}

.check-row input {
  width: 18px;
  min-height: 18px;
}

.evidence-layout,
.ai-report-section,
.source-section {
  display: grid;
  gap: 16px;
  margin-top: 48px;
}

.section-badge {
  padding: 5px 10px;
  background: var(--blue-soft);
  color: var(--blue);
}

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

.metric-card,
.source-card {
  display: grid;
  gap: 12px;
}

.metric-card strong {
  font-size: 1.4rem;
}

.metric-card p,
.source-card p {
  margin: 0;
  color: #52636e;
  line-height: 1.55;
}

.json-output {
  overflow: hidden;
}

.json-head {
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
}

.json-head span {
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 900;
}

pre {
  max-height: 360px;
  margin: 0;
  overflow: auto;
  padding: 16px;
  background: #111a20;
  color: #e8f3ee;
  font-size: 0.86rem;
  line-height: 1.55;
}

.report-paper {
  min-height: 320px;
  padding: 22px;
  box-shadow: var(--shadow);
}

.report-paper h1 {
  margin: 0 0 18px;
  font-size: 1.55rem;
}

.report-paper h2 {
  margin: 22px 0 8px;
  font-size: 1.08rem;
}

.report-paper p {
  margin: 7px 0;
  color: #344650;
  line-height: 1.6;
}

.report-paper .md-list {
  padding-left: 12px;
}

.report-meta {
  display: inline-flex;
  padding: 6px 9px;
  border-radius: 999px;
  background: var(--gold-soft);
  color: var(--gold);
  font-size: 0.82rem;
  font-weight: 900;
}

.disclaimer {
  margin: 0;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fbfdfc;
  color: #52636e;
  line-height: 1.55;
}

.source-card a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  width: fit-content;
  padding: 0 12px;
  border: 1px solid rgba(38, 95, 167, 0.26);
  border-radius: var(--radius);
  color: var(--blue);
  font-weight: 900;
}

.source-card ul {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.source-card li {
  padding: 5px 8px;
  border-radius: 999px;
  background: #edf3f7;
  color: #49606c;
  font-size: 0.78rem;
  font-weight: 900;
}

.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 50;
  max-width: min(360px, calc(100vw - 36px));
  padding: 12px 14px;
  border: 1px solid rgba(22, 123, 95, 0.28);
  border-radius: var(--radius);
  background: #ffffff;
  box-shadow: var(--shadow);
  color: #263640;
  font-weight: 900;
}

@media (max-width: 1120px) {
  .product-strip,
  .workbench {
    grid-template-columns: 1fr;
  }

  .input-panel {
    position: static;
  }
}

@media (max-width: 820px) {
  .topbar,
  .panel-head,
  .section-title,
  .score-summary {
    align-items: stretch;
    flex-direction: column;
  }

  .top-actions {
    justify-content: stretch;
  }

  .top-actions a {
    flex: 1 1 0;
    justify-content: center;
  }

  .signal-board,
  .form-grid,
  .result-sequence,
  .metric-grid,
  .source-grid,
  .action-panel,
  .verdict-stage,
  .reason-list {
    grid-template-columns: 1fr;
  }

  .sample-row {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 520px) {
  .app-shell {
    padding: 12px;
  }

  .product-strip {
    min-height: auto;
    padding-top: 18px;
  }

  .form-actions {
    grid-template-columns: 1fr;
  }

  .fact-row {
    grid-template-columns: 1fr;
    gap: 4px;
  }

  .score-ring {
    justify-self: start;
  }
}

@media print {
  body {
    background: #fff;
  }

  .topbar,
  .product-strip,
  .input-panel,
  .json-output,
  .source-section,
  .toast,
  #generateAiReportButton {
    display: none !important;
  }

  .app-shell {
    padding: 0;
  }

  .workbench {
    display: block;
  }

  .result-panel,
  .report-paper,
  .score-panel,
  .verdict-stage,
  .result-card {
    box-shadow: none;
    break-inside: avoid;
  }
}

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