:root {
  --paper: #fffaf2;
  --paper-deep: #f5eadb;
  --ink: #25201b;
  --muted: #756d64;
  --line: #d9cdbd;
  --orange: #f06a35;
  --orange-dark: #c9471d;
  --orange-soft: #fff0e7;
  --green: #236f55;
  --yellow: #f5c94c;
  --shadow: 0 18px 50px rgba(92, 65, 39, 0.1);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  min-width: 320px;
  background:
    radial-gradient(circle at 15% 6%, rgba(245, 201, 76, 0.17), transparent 24rem),
    radial-gradient(circle at 90% 33%, rgba(240, 106, 53, 0.11), transparent 22rem),
    var(--paper);
  color: var(--ink);
  font-family: "Apple SD Gothic Neo", "Noto Sans KR", system-ui, sans-serif;
  font-size: 16px;
  line-height: 1.55;
}

button, input, select { font: inherit; }
button, select { cursor: pointer; }
button:focus-visible, input:focus-visible, select:focus-visible, a:focus-visible {
  outline: 3px solid rgba(240, 106, 53, 0.35);
  outline-offset: 3px;
}

.site-header {
  width: min(100% - 32px, 920px);
  margin: 0 auto;
  padding: 18px 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}
.brand { display: inline-flex; align-items: center; gap: 8px; color: var(--ink); font-size: 1.15rem; font-weight: 900; text-decoration: none; }
.brand-mark { display: grid; place-items: center; width: 31px; height: 31px; border-radius: 50%; background: var(--orange); color: white; transform: rotate(-7deg); }
.local-badge { padding: 7px 10px; border: 1px solid var(--line); border-radius: 999px; color: var(--muted); background: rgba(255,255,255,.58); font-size: .76rem; }

.page-shell { width: min(100% - 28px, 720px); margin: 0 auto; }
.hero { padding: 68px 6px 74px; text-align: center; }
.eyebrow, .step-label { margin: 0 0 8px; color: var(--orange-dark); font-weight: 700; font-size: .77rem; letter-spacing: .12em; }
.hero h1 { margin: 0; font-size: clamp(3rem, 16vw, 5.5rem); font-weight: 900; line-height: .98; letter-spacing: -.06em; }
.hero h1 span { color: var(--orange); position: relative; }
.hero-copy { margin: 24px 0 28px; color: var(--muted); font-size: clamp(1rem, 4vw, 1.15rem); }
.start-link { display: inline-flex; align-items: center; gap: 10px; color: var(--ink); text-decoration-thickness: 1px; text-underline-offset: 5px; font-weight: 700; }

.calculator, .result-panel {
  border: 1px solid var(--line);
  border-radius: 24px;
  background: rgba(255,255,255,.82);
  box-shadow: var(--shadow);
  padding: 24px 18px;
}
.section-heading, .people-header, .result-heading { display: flex; justify-content: space-between; align-items: flex-start; gap: 14px; }
h2 { margin: 0; font-size: clamp(1.45rem, 6vw, 2rem); font-weight: 900; line-height: 1.15; letter-spacing: -.04em; }
.text-button { border: 0; background: transparent; color: var(--muted); padding: 5px; text-decoration: underline; text-underline-offset: 3px; }
.total-field { margin: 24px 0 38px; padding: 20px; border-radius: 16px; background: var(--orange-soft); }
.total-field label { display: block; margin-bottom: 8px; font-weight: 700; }
.money-input { display: flex; align-items: center; gap: 8px; }
.money-input input { width: 100%; min-width: 0; border: 0; border-bottom: 1.5px solid var(--line); border-radius: 0; background: transparent; color: var(--ink); padding: 8px 2px; text-align: right; }
.money-input input:focus { border-color: var(--orange); outline: 0; }
.money-input--total input { font-size: clamp(1.75rem, 8vw, 2.7rem); font-weight: 900; }
.money-input span { flex: none; font-weight: 700; }
.field-hint { margin: 8px 0 0; color: var(--muted); font-size: .78rem; }
.add-button { flex: none; border: 1px solid var(--orange); border-radius: 999px; background: white; color: var(--orange-dark); padding: 8px 12px; font-weight: 700; }
.weight-guide { margin: 16px 0; padding: 12px 14px; border-left: 3px solid var(--yellow); background: #fffbdf; color: var(--muted); font-size: .79rem; }
.weight-guide strong { color: var(--ink); }
.people-list { display: grid; gap: 12px; }
.person-card { position: relative; padding: 16px; border: 1px solid var(--line); border-radius: 16px; background: #fff; }
.person-top { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 12px; align-items: center; }
.name-input { width: 100%; min-width: 0; border: 0; border-bottom: 1px dashed var(--line); color: var(--ink); background: transparent; padding: 8px 2px; font-weight: 700; }
.name-input:focus { outline: 0; border-color: var(--orange); }
.remove-button { width: 34px; height: 34px; border: 0; border-radius: 50%; background: var(--paper-deep); color: var(--muted); font-size: 1.1rem; }
.person-controls { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 14px; }
.control-group > label, .extra-label { display: block; margin-bottom: 6px; color: var(--muted); font-size: .73rem; font-weight: 700; }
.participation-select { width: 100%; border: 1px solid var(--line); border-radius: 10px; background: var(--paper); color: var(--ink); padding: 10px; }
.drink-toggle { display: flex; align-items: center; gap: 9px; min-height: 44px; padding: 9px 10px; border: 1px solid var(--line); border-radius: 10px; background: var(--paper); font-size: .86rem; }
.drink-toggle input { width: 18px; height: 18px; accent-color: var(--orange); }
.extra-row { margin-top: 12px; }
.extra-row .money-input { padding: 0 10px; border: 1px solid var(--line); border-radius: 10px; background: #fff; }
.extra-row input { padding: 9px 0; }
.person-weight { margin: 10px 0 0; color: var(--green); font-size: .76rem; font-weight: 700; text-align: right; }
.form-error { margin: 16px 0 0; padding: 12px 14px; border-radius: 10px; background: #fff0ee; color: #a72e22; font-weight: 700; font-size: .88rem; }
.primary-button, .share-button { width: 100%; border: 0; border-radius: 14px; padding: 15px 18px; font-weight: 700; transition: transform .15s ease, box-shadow .15s ease; }
.primary-button { margin-top: 22px; background: var(--ink); color: white; box-shadow: 0 8px 0 #000; }
.primary-button:hover, .share-button:hover { transform: translateY(-2px); }
.primary-button:active, .share-button:active { transform: translateY(1px); }

.result-panel { margin-top: 22px; background: var(--ink); color: white; border-color: var(--ink); }
.result-panel .step-label { color: var(--yellow); }
.result-stamp { flex: none; padding: 7px 10px; border: 1px solid var(--yellow); border-radius: 5px; color: var(--yellow); font-size: .72rem; font-weight: 700; transform: rotate(3deg); }
.result-list { margin: 24px 0 14px; padding: 0; list-style: none; border-top: 1px solid rgba(255,255,255,.18); }
.result-item { display: flex; justify-content: space-between; align-items: center; gap: 14px; padding: 15px 2px; border-bottom: 1px solid rgba(255,255,255,.18); }
.result-person { min-width: 0; }
.result-person strong { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.result-person small { color: #bbb4ac; }
.result-amount { flex: none; color: var(--yellow); font-size: 1.45rem; font-weight: 900; }
.sum-check { display: flex; justify-content: space-between; align-items: center; padding: 14px 0; }
.sum-check strong { font-size: 1.15rem; }
.result-note { margin: 0 0 15px; color: #bbb4ac; font-size: .75rem; }
.share-button { background: var(--yellow); color: var(--ink); box-shadow: 0 7px 0 #b99327; }
.share-status { min-height: 1.5em; margin: 12px 0 0; color: var(--yellow); text-align: center; font-size: .8rem; }
.privacy-note { display: flex; gap: 12px; margin: 24px 4px 60px; padding: 16px; color: var(--muted); font-size: .78rem; }
.privacy-note span { font-size: 1.25rem; }
.privacy-note strong { color: var(--ink); }
.privacy-note p { margin: 3px 0 0; }
footer { padding: 24px 16px 30px; border-top: 1px solid var(--line); color: var(--muted); text-align: center; font-size: .72rem; }
[hidden] { display: none !important; }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }

@media (min-width: 650px) {
  .site-header { padding-top: 24px; }
  .calculator, .result-panel { padding: 34px; }
  .person-card { padding: 18px 20px; }
  .person-controls { grid-template-columns: 1.15fr .85fr; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition-duration: .01ms !important; }
}
