:root {
  --bg: #f4f4f5;
  --surface: #ffffff;
  --ink: #18181b;
  --muted: #52525b;
  --line: #d4d4d8;
  --accent: #1d4ed8;
  --accent-ink: #ffffff;
  --focus: #2563eb;

  --good: #15803d;
  --good-bg: #f0fdf4;
  --fair: #b45309;
  --fair-bg: #fffbeb;
  --poor: #b91c1c;
  --poor-bg: #fef2f2;
  --unknown: #52525b;
  --unknown-bg: #f4f4f5;

  --radius: 14px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Apple SD Gothic Neo", "Malgun Gothic",
    "Noto Sans KR", sans-serif;
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #09090b;
    --surface: #18181b;
    --ink: #f4f4f5;
    --muted: #a1a1aa;
    --line: #3f3f46;
    --accent: #60a5fa;
    --accent-ink: #09090b;
    --focus: #93c5fd;

    --good: #4ade80;
    --good-bg: #052e16;
    --fair: #fbbf24;
    --fair-bg: #3a2a06;
    --poor: #f87171;
    --poor-bg: #3b0d0d;
    --unknown: #a1a1aa;
    --unknown-bg: #27272a;
  }
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.5;
}

:lang(ko) body,
:lang(ko) {
  word-break: keep-all;
}

body,
p,
span,
dd,
dt,
label {
  overflow-wrap: anywhere;
}

.wrap {
  max-width: 440px;
  margin: 0 auto;
  padding: 20px 16px 32px;
}

.product {
  margin: 4px 0 12px;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--muted);
}

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 24px 20px;
}

.muted {
  color: var(--muted);
}

.small {
  font-size: 0.875rem;
}

/* ---------- controls ---------- */

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

button {
  cursor: pointer;
}

:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}

.primary,
.secondary {
  display: block;
  width: 100%;
  min-height: 52px;
  padding: 12px 16px;
  border-radius: 12px;
  font-size: 1.05rem;
  font-weight: 600;
}

.primary {
  background: var(--accent);
  color: var(--accent-ink);
  border: 2px solid var(--accent);
}

/* A link that is the screen's one action looks like the button it replaces. */
a.primary,
a.secondary {
  box-sizing: border-box;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  text-decoration: none;
}

.secondary {
  background: transparent;
  color: var(--ink);
  border: 2px solid var(--line);
  margin-top: 20px;
}

.secondary:disabled {
  opacity: 0.6;
}

.link {
  background: none;
  border: none;
  padding: 10px 0;
  min-height: 44px;
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 3px;
  text-align: left;
}

select,
input[type="text"] {
  width: 100%;
  min-height: 44px;
  padding: 8px 10px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
}

/* ---------- check screen ---------- */

.promise {
  margin: 0 0 24px;
  font-size: 1.3rem;
  font-weight: 600;
  line-height: 1.4;
}

#note {
  margin: 12px 0 0;
  text-align: center;
}

.bar {
  height: 10px;
  border-radius: 5px;
  background: var(--line);
  overflow: hidden;
}

.bar-fill {
  display: block;
  height: 100%;
  width: 0;
  background: var(--accent);
  transition: width 0.2s linear;
}

.step {
  margin: 12px 0 0;
  text-align: center;
  color: var(--muted);
}

/* ---------- result: verdict ---------- */

.card[data-level="good"] { --level: var(--good); --level-bg: var(--good-bg); }
.card[data-level="fair"] { --level: var(--fair); --level-bg: var(--fair-bg); }
.card[data-level="poor"] { --level: var(--poor); --level-bg: var(--poor-bg); }
.card[data-level="unknown"] { --level: var(--unknown); --level-bg: var(--unknown-bg); }

.verdict {
  margin: 0 0 24px;
  padding: 16px 16px 16px 18px;
  background: var(--level-bg);
  border-left: 8px solid var(--level);
  border-radius: 10px;
  font-size: 1.3rem;
  font-weight: 700;
  line-height: 1.4;
  min-height: 3em;
}

/* ---------- result: route ---------- */

.route {
  margin-bottom: 24px;
}

.route-svg {
  display: block;
  width: 100%;
  height: auto;
}

.route-svg .leg {
  stroke: var(--line);
  stroke-width: 3;
}

.route-svg .leg-hot {
  stroke: var(--level);
  stroke-width: 4;
}

.route-svg .node {
  fill: var(--surface);
  stroke: var(--muted);
  stroke-width: 3;
}

.route-svg .node-hot {
  stroke: var(--level);
}

.route-svg .leg-label {
  fill: var(--level);
  font-family: var(--font);
  font-size: 12px;
  font-weight: 700;
}

.route-labels {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin-top: 4px;
  text-align: center;
}

.route-col {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 0;
}

.route-head {
  font-size: 0.8rem;
  color: var(--muted);
}

.route-place {
  font-weight: 600;
  line-height: 1.3;
}

.route-place.hot {
  color: var(--level);
}

.route-sub {
  font-size: 0.8rem;
  color: var(--muted);
}

.route-col .link {
  text-align: center;
}

.route-col select {
  margin-top: 6px;
  font-size: 0.9rem;
  padding: 6px 4px;
}

/* ---------- result: numbers ---------- */

.numbers {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 24px;
  padding: 16px 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  text-align: center;
}

.num {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.num-label {
  font-size: 0.8rem;
  color: var(--muted);
}

.num-value {
  font-size: 1.25rem;
  font-weight: 700;
  line-height: 1.3;
  margin: 2px 0;
}

.num-word {
  font-size: 0.875rem;
  color: var(--muted);
  min-height: 1.3em;
}

/* ---------- result: action and question ---------- */

.action {
  margin-bottom: 24px;
}

.action-text {
  margin: 0;
  font-size: 1.1rem;
  font-weight: 600;
  text-align: center;
}

.action-note {
  margin: 12px 0 0;
  color: var(--muted);
  text-align: center;
}

.ask-q {
  margin: 0 0 8px;
  font-size: 0.95rem;
  color: var(--muted);
}

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

.chip {
  min-height: 44px;
  padding: 8px 14px;
  border-radius: 22px;
  border: 1px solid var(--line);
  background: transparent;
  font-size: 0.95rem;
}

.chip[aria-pressed="true"] {
  border: 2px solid var(--accent);
  color: var(--accent);
  font-weight: 600;
}

.brand {
  margin-top: 12px;
}

.brand label {
  display: block;
  margin-bottom: 4px;
  font-size: 0.875rem;
  color: var(--muted);
}

.ask p.small {
  margin: 8px 0 0;
}

/* ---------- result: details ---------- */

.details {
  margin-top: 20px;
  border-top: 1px solid var(--line);
  padding-top: 4px;
}

.details summary {
  min-height: 44px;
  padding: 10px 0;
  cursor: pointer;
  color: var(--muted);
  font-weight: 600;
}

.details dl {
  margin: 8px 0;
  font-size: 0.9rem;
}

.details dt {
  color: var(--muted);
  margin-top: 10px;
}

.details dd {
  margin: 0;
  font-variant-numeric: tabular-nums;
}

.details p {
  margin: 0;
}

/* ---------- footer line ---------- */

.privacy {
  margin: 16px 4px 0;
  text-align: center;
}
