:root {
  --bg: #f4f4f1;
  --card: #ffffff;
  --ink: #111214;
  --ink2: #55585f;
  --ink3: #8b8f97;
  --line: #e7e7e3;
  --accent: #2e55ff;
  --accent-soft: #eef1ff;
  --radius: 22px;
  font-family: Pretendard, -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", "Malgun Gothic", system-ui, sans-serif;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}
* { box-sizing: border-box; }
body { margin: 0; }
button { font: inherit; color: inherit; cursor: pointer; }

.top { padding: 18px 22px; }
.brand { display: flex; align-items: center; gap: 8px; font-weight: 800; letter-spacing: -0.02em; }
.logo { width: 18px; height: 18px; border-radius: 6px; background: linear-gradient(135deg, var(--accent), #8aa0ff); }
.beta { font-size: 11px; font-weight: 600; color: var(--ink3); border: 1px solid var(--line); border-radius: 99px; padding: 1px 7px; }

.wrap { max-width: 1120px; margin: 0 auto; padding: 4px 18px 60px; display: grid; gap: 22px; }
@media (min-width: 920px) {
  .wrap { grid-template-columns: 1fr 1.05fr; gap: 40px; padding-top: 24px; align-items: start; }
  .result { position: sticky; top: 20px; }
}

h1 { font-size: clamp(26px, 6vw, 38px); letter-spacing: -0.04em; line-height: 1.15; margin: 6px 0 8px; }
.sub { color: var(--ink2); margin: 0 0 18px; font-size: 15px; }

.search { display: flex; align-items: center; gap: 10px; background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 0 14px; margin-bottom: 14px; }
.search svg { width: 18px; height: 18px; fill: none; stroke: var(--ink3); stroke-width: 2; stroke-linecap: round; flex: none; }
.search input { border: 0; outline: 0; background: transparent; font: inherit; font-size: 15px; padding: 13px 0; width: 100%; color: var(--ink); }

.group-title { font-size: 12px; font-weight: 700; color: var(--ink3); margin: 14px 0 8px; letter-spacing: 0.02em; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { border: 1px solid var(--line); background: var(--card); border-radius: 99px; padding: 9px 14px; font-size: 14px; font-weight: 600; transition: background .15s, color .15s, border-color .15s, transform .1s; display: inline-flex; align-items: center; gap: 6px; }
.chip:active { transform: scale(0.97); }
.chip[aria-pressed="true"] { background: var(--ink); color: #fff; border-color: var(--ink); }
.chip[aria-pressed="true"]::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: #7d95ff; }
.chips .group { width: 100%; display: flex; flex-wrap: wrap; gap: 8px; }
.nohit { color: var(--ink3); font-size: 14px; padding: 6px 2px; }
.chip.ai-chip::after { content: "✦"; font-size: 11px; color: var(--accent); margin-left: 2px; }
.chip.ai-chip[aria-pressed="true"]::after { color: #9db0ff; }
.ai-find { width: 100%; margin-top: 4px; }
.ai-btn { border: 0; background: var(--accent); color: #fff; font-weight: 700; font-size: 14px; padding: 11px 15px; border-radius: 12px; transition: opacity .15s; }
.ai-btn.ghost { background: var(--accent-soft); color: var(--accent); }
.ai-btn:disabled { opacity: .7; cursor: wait; }
.ai-msg { font-size: 13px; color: #a15c00; margin: 8px 2px 0; }
.ai-msg:empty { display: none; }
.more { margin-top: 12px; border: 0; background: none; color: var(--ink2); font-size: 14px; font-weight: 600; padding: 6px 2px; text-decoration: underline; text-underline-offset: 3px; }

.card { background: var(--card); border-radius: var(--radius); padding: 22px 22px 18px; box-shadow: 0 1px 0 rgba(0,0,0,.03), 0 12px 40px -18px rgba(20,30,80,.18); }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.ai { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 700; color: var(--accent); background: var(--accent-soft); padding: 6px 10px; border-radius: 99px; }
.ai svg { width: 14px; height: 14px; fill: currentColor; }

.tiers, .seg { display: inline-flex; background: #f1f1ee; border-radius: 12px; padding: 3px; }
.tiers button, .seg button { border: 0; background: none; padding: 7px 12px; border-radius: 9px; font-size: 13px; font-weight: 600; color: var(--ink2); transition: background .15s, color .15s; }
.tiers button[aria-selected="true"], .seg button[aria-pressed="true"] { background: var(--card); color: var(--ink); box-shadow: 0 1px 3px rgba(0,0,0,.08); }

.total { display: flex; align-items: baseline; gap: 4px; margin: 22px 0 6px; font-variant-numeric: tabular-nums; }
.total .approx { font-size: 18px; font-weight: 600; color: var(--ink2); margin-right: 4px; }
#total { font-size: clamp(54px, 15vw, 76px); font-weight: 800; letter-spacing: -0.05em; line-height: 1; }
.total .won { font-size: 22px; font-weight: 700; letter-spacing: -0.02em; }

.lines { list-style: none; padding: 0; margin: 4px 0 0; display: flex; flex-wrap: wrap; gap: 6px; }
.lines li { font-size: 13px; font-weight: 600; color: var(--ink2); background: #f4f4f1; border-radius: 8px; padding: 5px 9px; }
.warn { margin: 12px 0 0; font-size: 13px; color: #a15c00; background: #fff6e6; border-radius: 10px; padding: 9px 11px; }

.res { display: flex; align-items: center; gap: 10px; margin: 12px 0 0; font-size: 13px; color: var(--ink2); font-weight: 600; }
.res .seg button { padding: 5px 10px; font-size: 12px; }
.hint { border: 0; background: none; color: var(--ink3); font-size: 12px; text-decoration: underline; text-underline-offset: 3px; padding: 4px; }
.resnote { font-size: 12px; color: var(--ink2); margin: 8px 0 0; }

.parts { list-style: none; padding: 0; margin: 18px 0 0; border-top: 1px solid var(--line); }
.part { border-bottom: 1px solid var(--line); }
.part-row { display: grid; grid-template-columns: 74px 1fr auto 28px; align-items: center; gap: 10px; width: 100%; text-align: left; border: 0; background: none; padding: 13px 0; }
.part-label { font-size: 12px; font-weight: 700; color: var(--ink3); }
.part-name { font-size: 14.5px; font-weight: 600; letter-spacing: -0.01em; line-height: 1.35; }
.part-price { font-size: 14px; font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
.part-go { width: 28px; height: 28px; border-radius: 8px; display: grid; place-items: center; color: var(--ink3); text-decoration: none; }
.part-go:hover { background: #f1f1ee; color: var(--ink); }
.part-go svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.part-why { display: none; font-size: 13px; color: var(--ink2); line-height: 1.5; padding: 0 0 13px 84px; margin-top: -4px; }
.part.open .part-why { display: block; }
.part-why b { color: var(--accent); font-weight: 700; }
.part-go.cp { width: auto; height: 28px; padding: 0 9px; font-size: 12px; font-weight: 700; color: #fff; background: #e4352b; border-radius: 8px; }
.part-go.cp:hover { background: #c92c23; color: #fff; }
.part-row { grid-template-columns: 74px 1fr auto auto; }
.why-link { display: inline-block; margin-top: 6px; color: var(--ink2); font-weight: 600; text-decoration: underline; text-underline-offset: 3px; }
.disclose { font-size: 12px; color: var(--ink2); background: #f7f7f4; border-radius: 10px; padding: 9px 11px; margin: 12px 0 0; line-height: 1.5; }
.part-name::after { content: " ⓘ"; color: #c2c5cc; font-size: 12px; }

.extras { display: flex; gap: 16px; flex-wrap: wrap; margin: 16px 0 0; font-size: 13.5px; color: var(--ink2); font-weight: 600; }
.extras label { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; }
.extras input { accent-color: var(--accent); width: 16px; height: 16px; margin: 0; }
.extras em { font-style: normal; color: var(--ink3); font-weight: 500; }

.actions { margin-top: 18px; }
.primary { width: 100%; border: 0; background: var(--ink); color: #fff; font-weight: 700; font-size: 15px; padding: 15px; border-radius: 14px; transition: transform .1s, opacity .15s; }
.primary:active { transform: scale(0.99); opacity: .9; }
.foot { font-size: 12px; color: var(--ink3); line-height: 1.55; margin: 12px 2px 0; }
.empty { text-align: center; color: var(--ink2); background: var(--card); border-radius: var(--radius); padding: 40px 20px; margin: 0; }

.toast { position: fixed; left: 50%; bottom: 28px; transform: translate(-50%, 20px); background: var(--ink); color: #fff; padding: 11px 16px; border-radius: 12px; font-size: 14px; font-weight: 600; opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }

@media (max-width: 420px) {
  .card { padding: 18px 16px 16px; }
  .part-row { grid-template-columns: 62px 1fr auto auto; gap: 8px; }
  .part-why { padding-left: 70px; }
  .part-name { font-size: 13.5px; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
.res > span:first-child { min-width: 42px; }
