:root {
  --canvas: #0F1216;
  --surface: #171B21;
  --raised: #1E242C;
  --ink: #E9EDF2;
  --ink-strong: #FFFFFF;
  --mute: #98A4B3;
  --mute-dim: #6B7684;
  --border: #2A313A;
  --border-strong: #3A434F;
  --accent: #DDA150;
  --accent-soft: #2C2418;
  --accent-ink: #1A1206;
  --danger: #E3766B;
  --ok: #6BBF8A;

  --ring: 0 0 0 3px rgba(221, 161, 80, .18);
  --ease: cubic-bezier(.16, 1, .3, 1);
  --fast: 140ms var(--ease);
  --slow: 380ms var(--ease);

  --font: 'Pretendard Variable', system-ui, -apple-system, 'Malgun Gothic', sans-serif;

  color-scheme: dark;
}

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

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  background: var(--canvas);
  color: var(--ink);
  font-family: var(--font);
  font-size: .9375rem;
  line-height: 1.7;
  word-break: keep-all;
  overflow-wrap: anywhere;
  -webkit-font-smoothing: antialiased;
}

h1,
h2 {
  margin: 0;
  font-weight: 700;
  letter-spacing: -.025em;
}

p {
  margin: 0;
}

fieldset {
  margin: 0;
  padding: 0;
  border: 0;
}

legend {
  padding: 0;
}

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

:where(button, input, a):focus-visible {
  outline: none;
  box-shadow: var(--ring);
  border-radius: 10px;
}

.ico {
  width: 1.125rem;
  height: 1.125rem;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.75;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* ─────────── 진행 막대 ─────────── */

.prog {
  position: fixed;
  inset: 0 0 auto;
  z-index: 10;
  height: 3px;
  background: var(--border);
}

.prog__bar {
  height: 100%;
  width: 0;
  background: var(--accent);
  transition: width var(--slow);
}

/* ─────────── 화면 ─────────── */

.wrap {
  flex: 1;
  width: 100%;
  max-width: 34rem;
  margin-inline: auto;
  padding: 40px 20px 32px;
  padding-inline: max(20px, env(safe-area-inset-left));
}

/* 대부분 휴대폰으로 들어온다 — 좁은 화면 기준으로 먼저 맞춤 */
@media (max-width: 400px) {
  .wrap {
    padding: 30px 16px 26px;
  }

  .opts--3,
  .opts--4 {
    gap: 6px;
  }

  .opts--3 .opt,
  .opts--4 .opt {
    padding-inline: 6px;
    font-size: .875rem;
  }

  .nav {
    gap: 7px;
  }

  .nav .btn--ghost {
    padding-inline: 15px;
  }

  .total {
    padding: 22px 16px;
  }

  .recap {
    padding-inline: 14px;
  }
}

/* 가로로 눕혔을 때 위아래 여백만 줄임 */
@media (orientation: landscape) and (max-height: 480px) {
  .wrap {
    padding-block: 22px 20px;
  }

  .prose {
    gap: 10px;
  }

  .check {
    margin: 4px 0 14px;
  }

  .check svg {
    width: 56px;
    height: 56px;
  }
}

.step {
  display: none;
}

.step.is-on {
  display: block;
  animation: stepIn var(--slow) both;
}

.step--center {
  text-align: center;
}

@keyframes stepIn {
  from {
    opacity: 0;
    transform: translateY(14px);
  }
}

/* 뒤로 갈 때는 반대쪽에서 들어온다 */
.step.is-on.is-back {
  animation-name: stepBack;
}

@keyframes stepBack {
  from {
    opacity: 0;
    transform: translateY(-14px);
  }
}

.eyebrow {
  color: var(--accent);
  font-size: .75rem;
  font-weight: 700;
  letter-spacing: .1em;
  text-transform: uppercase;
  margin-bottom: 10px;
}

.h1 {
  font-size: clamp(1.5rem, 6vw, 2rem);
  line-height: 1.35;
}

.h2 {
  font-size: clamp(1.25rem, 5vw, 1.5rem);
  line-height: 1.4;
}

.sub {
  color: var(--mute);
  font-size: .875rem;
  margin-top: 8px;
}

.sub b,
.prose strong {
  color: var(--ink);
  font-weight: 600;
}

.prose {
  margin-top: 20px;
  display: grid;
  gap: 13px;
}

.prose p {
  color: var(--mute);
  font-size: .9375rem;
  line-height: 1.8;
}

.note {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  margin-top: 22px;
  padding: 13px 15px;
  background: var(--accent-soft);
  border: 1px solid rgba(221, 161, 80, .28);
  border-radius: 13px;
  color: var(--accent);
  font-size: .8125rem;
  line-height: 1.65;
}

.note .ico {
  margin-top: 3px;
}

.note b {
  font-weight: 700;
}

.foot-note {
  margin-top: 12px;
  text-align: center;
  color: var(--mute-dim);
  font-size: .75rem;
}

/* ─────────── 버튼 ─────────── */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 48px;
  padding: 0 22px;
  background: var(--accent);
  border: 0;
  border-radius: 12px;
  color: var(--accent-ink);
  font-size: .9375rem;
  font-weight: 700;
  cursor: pointer;
  transition: transform var(--fast), opacity var(--fast);
}

.btn:active {
  transform: scale(.975);
}

.btn:disabled {
  opacity: .35;
  cursor: not-allowed;
}

.btn--lg {
  width: 100%;
  margin-top: 24px;
  min-height: 54px;
  font-size: 1rem;
}

.btn--sm {
  min-height: 44px;
  padding: 0 16px;
  font-size: .875rem;
}

.btn--ghost {
  background: var(--raised);
  color: var(--ink);
  border: 1px solid var(--border-strong);
}

.btn--busy {
  pointer-events: none;
  opacity: .7;
}

.linkbtn {
  background: none;
  border: 0;
  padding: 6px 0;
  color: var(--mute);
  font-size: .8125rem;
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}

.linkbtn:hover {
  color: var(--accent);
}

.nav {
  display: flex;
  gap: 9px;
  margin-top: 28px;
}

.nav .btn {
  flex: 1;
}

.nav .btn--ghost {
  flex: 0 0 auto;
  padding-inline: 20px;
}

.nav--center {
  justify-content: center;
}

/* ─────────── 선택지 ─────────── */

.field {
  margin-top: 24px;
}

.field legend {
  color: var(--mute);
  font-size: .8125rem;
  font-weight: 600;
  margin-bottom: 9px;
}

.opts {
  display: grid;
  gap: 8px;
  margin-top: 16px;
}

.field .opts {
  margin-top: 0;
}

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

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

.opts--3 {
  grid-template-columns: repeat(3, 1fr);
}

.opts--4 {
  grid-template-columns: repeat(4, 1fr);
}

.opt {
  position: relative;
  display: flex;
  align-items: center;
  gap: 9px;
  min-height: 52px;
  padding: 10px 15px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 13px;
  color: var(--ink);
  font-size: .9375rem;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
  transition: border-color var(--fast), background var(--fast), transform var(--fast);
}

.opts--4 .opt,
.opts--3 .opt,
.opts--2 .opt {
  justify-content: center;
}

.opt:hover:not(:disabled) {
  border-color: var(--border-strong);
}

.opt:active:not(:disabled) {
  transform: scale(.985);
}

.opt.is-on {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--accent);
}

.opt:disabled {
  opacity: .45;
  cursor: not-allowed;
}

.opt__sub {
  display: block;
  color: var(--mute-dim);
  font-size: .75rem;
  font-weight: 500;
}

.opt.is-on .opt__sub {
  color: var(--accent);
  opacity: .8;
}

.opt__tick {
  margin-left: auto;
  width: 1.125rem;
  height: 1.125rem;
  opacity: 0;
  transition: opacity var(--fast);
}

.opt.is-on .opt__tick {
  opacity: 1;
}

.opts--2 .opt__tick,
.opts--3 .opt__tick,
.opts--4 .opt__tick {
  display: none;
}

.hint {
  color: var(--mute-dim);
  font-size: .75rem;
  margin-top: 8px;
}

.legend__x {
  margin-left: 6px;
  padding: 1px 7px;
  background: var(--raised);
  border-radius: 999px;
  color: var(--mute-dim);
  font-size: .6875rem;
  font-weight: 600;
}

/* 자동으로 정해지는 칸은 눌러도 안 바뀐다는 걸 알아보게 */
.opt:disabled.is-on {
  opacity: 1;
}

/* ─────────── 입력 ─────────── */

.inp {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 22px;
  padding: 4px 16px;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: 14px;
  transition: border-color var(--fast), box-shadow var(--fast);
}

.inp:focus-within {
  border-color: var(--accent);
  box-shadow: var(--ring);
}

.inp__l {
  flex: none;
  color: var(--mute);
  font-size: .8125rem;
  font-weight: 600;
}

.inp input {
  flex: 1;
  min-width: 0;
  width: 100%;
  min-height: 52px;
  padding: 0;
  background: none;
  border: 0;
  outline: none;
  font-size: 1.375rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  text-align: right;
}

.inp input::-webkit-outer-spin-button,
.inp input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.inp input[type=number] {
  -moz-appearance: textfield;
  appearance: textfield;
}

.inp input::placeholder {
  color: var(--mute-dim);
  font-size: 1rem;
  font-weight: 500;
}

.inp__u {
  flex: none;
  color: var(--mute-dim);
  font-size: .875rem;
  font-weight: 600;
}

.search {
  display: flex;
  gap: 8px;
  margin-top: 22px;
}

.search+.hint {
  margin-top: 10px;
}

.search+.hint b {
  color: var(--mute);
  font-weight: 600;
}

.search input {
  flex: 1;
  min-width: 0;
  min-height: 52px;
  padding: 0 16px;
  font-size: 1rem;
  /* 16px 미만이면 iOS가 포커스할 때 화면을 확대한다 */
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: 14px;
  outline: none;
  font-weight: 500;
  transition: border-color var(--fast), box-shadow var(--fast);
}

.search input:focus {
  border-color: var(--accent);
  box-shadow: var(--ring);
}

.search input::placeholder {
  color: var(--mute-dim);
}

.search .btn {
  flex: none;
  min-height: 52px;
}

.err {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-top: 10px;
  color: var(--danger);
  font-size: .8125rem;
  font-weight: 600;
}

.err::before {
  content: '!';
  flex: none;
  display: grid;
  place-items: center;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 1.5px solid currentColor;
  font-size: .6875rem;
}

/* 검색 결과 여러 건 */
.picks {
  display: grid;
  gap: 7px;
  margin-top: 14px;
}

.pick {
  padding: 12px 15px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  text-align: left;
  cursor: pointer;
  transition: border-color var(--fast);
}

.pick:hover {
  border-color: var(--accent);
}

.pick b {
  display: block;
  font-size: .9375rem;
  font-weight: 600;
}

.pick span {
  display: block;
  color: var(--mute-dim);
  font-size: .8125rem;
  line-height: 1.5;
}

.confirm {
  margin-top: 16px;
  padding: 14px 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: 0 13px 13px 0;
}

.confirm__l {
  color: var(--mute);
  font-size: .75rem;
  font-weight: 600;
}

.confirm__b {
  margin-top: 4px;
  color: var(--accent);
  font-size: 1.0625rem;
  font-weight: 700;
}

.confirm__a {
  font-size: 1rem;
  font-weight: 600;
  margin-top: 3px;
}

.confirm__b+.confirm__a {
  font-size: .9375rem;
  font-weight: 500;
  color: var(--mute);
}

.confirm__r {
  color: var(--mute);
  font-size: .8125rem;
}

/* ─────────── 점수 게이지 ─────────── */

.gauge {
  margin-top: 20px;
  padding: 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  animation: stepIn var(--slow) both;
}

.gauge__top {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 11px;
  color: var(--mute);
  font-size: .8125rem;
  font-weight: 600;
}

.gauge__top>b {
  color: var(--accent);
  font-size: 1.375rem;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

.gauge__top em {
  color: var(--mute-dim);
  font-size: .8125rem;
  font-style: normal;
  font-weight: 600;
}

.gauge__top b b {
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}

.gauge__track {
  height: 8px;
  background: var(--raised);
  border-radius: 4px;
  overflow: hidden;
}

.gauge__fill {
  height: 100%;
  width: 0;
  background: var(--accent);
  border-radius: 4px;
  transition: width var(--slow);
}

/* 산출 근거 접기 */
.why {
  margin-top: 13px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}

.why summary {
  color: var(--mute);
  font-size: .8125rem;
  font-weight: 600;
  cursor: pointer;
  list-style: none;
  display: flex;
  align-items: center;
  gap: 6px;
  min-height: 28px;
}

.why summary::-webkit-details-marker {
  display: none;
}

.why summary::before {
  content: '';
  flex: none;
  width: 6px;
  height: 6px;
  margin-left: 2px;
  border-right: 1.5px solid currentColor;
  border-bottom: 1.5px solid currentColor;
  transform: rotate(-45deg);
  transition: transform var(--fast);
}

.why[open] summary::before {
  transform: rotate(45deg);
}

.why summary:hover {
  color: var(--ink);
}

.why>p {
  color: var(--mute);
  font-size: .8125rem;
  line-height: 1.7;
  margin-top: 9px;
}

.why>p b {
  color: var(--ink);
  font-weight: 600;
}

.why__f {
  padding: 9px 12px;
  background: var(--raised);
  border-radius: 9px;
  color: var(--accent) !important;
  font-size: .875rem !important;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.why__warn b {
  color: var(--accent) !important;
}

.why--flat {
  margin-top: 16px;
  padding: 14px 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

/* ─────────── 결과 ─────────── */

.total {
  margin-top: 24px;
  padding: 26px 20px;
  background: var(--surface);
  border: 1px solid var(--accent);
  border-radius: 18px;
  text-align: center;
  animation: pop var(--slow) both;
}

@keyframes pop {
  from {
    opacity: 0;
    transform: scale(.96);
  }
}

.total__l {
  color: var(--mute);
  font-size: .8125rem;
  font-weight: 600;
}

.total__v {
  margin-top: 4px;
  color: var(--accent);
  font-size: clamp(2.5rem, 12vw, 3.25rem);
  font-weight: 800;
  line-height: 1.1;
  letter-spacing: -.03em;
  font-variant-numeric: tabular-nums;
}

.total__v em {
  color: var(--mute-dim);
  font-size: 1rem;
  font-style: normal;
  font-weight: 700;
  letter-spacing: 0;
}

.total__split {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-top: 12px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
  color: var(--mute);
  font-size: .875rem;
  font-weight: 600;
}

.total__split b {
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}

.total__plus {
  color: var(--mute-dim);
}

.recap {
  margin: 18px 0 0;
  padding: 4px 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
}

.recap>div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 11px 0;
  border-bottom: 1px solid var(--border);
}

.recap>div:last-child {
  border-bottom: 0;
}

.recap dt {
  color: var(--mute);
  font-size: .8125rem;
  font-weight: 600;
}

.recap dd {
  margin: 0;
  font-size: .9375rem;
  font-weight: 600;
}

/* ─────────── 완료 ─────────── */

.check {
  display: grid;
  place-items: center;
  margin: 12px 0 22px;
}

.check svg {
  width: 72px;
  height: 72px;
  fill: none;
  stroke: var(--ok);
  stroke-width: 3;
}

.check circle {
  stroke-dasharray: 152;
  stroke-dashoffset: 152;
  animation: draw 520ms var(--ease) forwards;
}

.check path {
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-dasharray: 40;
  stroke-dashoffset: 40;
  animation: draw 320ms var(--ease) 380ms forwards;
}

@keyframes draw {
  to {
    stroke-dashoffset: 0;
  }
}

/* 완료 화면 — 보낸 점수 */
.sent {
  margin-top: 22px;
  padding: 20px 18px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
}

.sent__l {
  color: var(--mute);
  font-size: .75rem;
  font-weight: 600;
}

.sent__v {
  margin-top: 2px;
  color: var(--accent);
  font-size: 2.25rem;
  font-weight: 800;
  line-height: 1.15;
  letter-spacing: -.03em;
  font-variant-numeric: tabular-nums;
}

.sent__v em {
  color: var(--mute-dim);
  font-size: .875rem;
  font-style: normal;
  font-weight: 700;
  letter-spacing: 0;
}

.sent__d {
  margin-top: 6px;
  color: var(--mute);
  font-size: .8125rem;
  font-weight: 600;
}

.sent__d b {
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}

.thanks-note {
  display: grid;
  gap: 10px;
  margin-top: 20px;
  text-align: left;
}

.thanks-note p {
  color: var(--mute);
  font-size: .875rem;
  line-height: 1.75;
}

.thanks-note b {
  color: var(--ink);
  font-weight: 600;
}

.nav--stack {
  flex-direction: column;
  margin-top: 24px;
}

.nav--stack .btn {
  width: 100%;
  flex: none;
}

/* ─────────── 바닥 ─────────── */

.foot {
  padding: 22px 20px calc(34px + env(safe-area-inset-bottom));
  text-align: center;
  color: var(--mute-dim);
  font-size: .75rem;
}

#gcdormSink {
  display: none;
}

/* ─────────── 모션 줄이기 ─────────── */

@media (prefers-reduced-motion: reduce) {

  *,
  *::before,
  *::after {
    animation-duration: .01ms !important;
    animation-delay: 0ms !important;
    transition-duration: .01ms !important;
  }

  .check circle,
  .check path {
    stroke-dashoffset: 0;
  }
}