:root {
  color-scheme: light dark;
  --paper: #f8f5ef;
  --card: #fffcf6;
  --ink: #332c26;
  --muted: #695f55;
  --rule: #ddd3c6;
  --accent: #89472f;
  --button: #8c4a33;
  background: var(--paper);
  color: var(--ink);
  font-family: 'Villa Sans Web', Pretendard, system-ui, sans-serif;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; line-height: 1.55; word-break: keep-all; overflow-wrap: anywhere; }
.shell { max-width: 38rem; margin-inline: auto; padding-inline: clamp(18px, 5vw, 32px); }
header { border-bottom: 1px solid var(--rule); }
.top, .row, .heading, dl > div, .actions { display: flex; align-items: center; gap: 12px; }
.top, .row, dl > div { justify-content: space-between; }
.top { min-height: 76px; }
a { color: inherit; text-decoration: none; }
.wordmark { font-family: Georgia, serif; font-size: 23px; line-height: 1.25; padding-block: 7px; }
.wordmark small { display: block; font: 9px/1.6 system-ui; letter-spacing: .18em; }
.back,.text-link { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; color: var(--accent); }
main { padding-block: clamp(32px, 7vw, 56px) 64px; }
h1,h2,h3,p,dl,dd { margin: 0; }
.heading img { border-radius: 50%; }
h1 { font-size: clamp(26px, 5vw, 34px); letter-spacing: -.045em; }
h2 { font-size: 21px; line-height: 1.4; }
h3 { margin-top: 24px; }
.intro { margin: 14px 0 24px; color: var(--muted); }
.panel { border: 1px solid var(--rule); padding: clamp(18px, 5vw, 30px); background: var(--card); border-radius: 12px; }
form { margin: 20px 0 6px; }
label,summary { font-weight: 650; }
.hint,.network { color: var(--muted); font-size: 14px; }
input,button,.primary { font: inherit; font-size: 16px; min-height: 46px; border-radius: 7px; }
input,button { border: 1px solid var(--rule); background: var(--paper); color: var(--ink); }
input { width: 100%; padding: 9px 12px; margin: 8px 0 14px; }
button,summary { cursor: pointer; }
button { padding: 8px 14px; }
button:disabled { opacity: .6; }
.primary { background: var(--button); color: white; width: 100%; display: flex; justify-content: space-between; align-items: center; padding: 10px 16px; border: 0; font-weight: 650; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; }
.text-link,.small { font-size: 14px; }
.status,.message:not(:empty) { padding-block: 11px; color: var(--accent); }
.message:empty { display: none; }
dl { margin-top: 16px; }
dl > div { padding-block: 8px; align-items: baseline; }
dt { color: var(--muted); font-size: 14px; }
dd { text-align: right; font-weight: 600; font-variant-numeric: tabular-nums; }
.sum { margin-top: 6px; border-block: 1px solid var(--rule); padding-block: 14px; }
#instructions { margin-top: 16px; }
.fee { margin-top: 8px; }
details { border-top: 1px solid var(--rule); margin-top: 18px; }
summary { padding-block: 13px; min-height: 46px; }
.bank { margin-top: 20px; font-size: 14px; color: var(--muted); }
.bank dl { margin-top: 6px; max-width: 30rem; }
#qr { display: block; width: min(100%, 230px); height: auto; margin: 6px auto 12px; image-rendering: pixelated; }
code { display: block; overflow-wrap: anywhere; font-size: 14px; margin-block: 4px 8px; }
.network,.actions { margin-top: 16px; }
.actions { flex-wrap: wrap; gap: 8px; }
.actions button { flex: 1 1 12rem; }
#estimate {
  margin-bottom: 28px;
  border-block: 1px solid var(--rule);
}
#estimate-toggle { display: flex; justify-content: space-between; align-items: center; gap: 12px; min-height: 54px; }
#estimate-toggle::-webkit-details-marker { display: none; }
#estimate-toggle::after { content: ""; width: 8px; height: 8px; margin-inline-end: 4px; border: solid var(--accent); border-width: 0 1.5px 1.5px 0; transform: rotate(45deg); }
#estimate[open] > summary::after { transform: rotate(225deg); }
.estimate-layout { display: grid; gap: 20px; padding-bottom: 20px; }
#estimate-controls,.estimate-layout .stay-line { margin-top: 0; }
.estimate-summary {
  background: var(--card);
  border: 1px solid var(--rule);
  border-radius: 10px;
  padding: clamp(16px, 4vw, 24px);
}
.summary-heading { display: flex; flex-wrap: wrap; gap: 4px 15px; align-items: baseline; justify-content: space-between; }
.summary-heading h2 { margin: 0; font-size: 16px; }
#estimate-total { font-size: clamp(27px, 7vw, 36px); line-height: 1.2; letter-spacing: -.045em; }
.split { display: grid; grid-template-columns: 1fr 1fr; border-top: 1px solid var(--rule); padding-top: 10px; gap: 16px; }
.split > div { display: grid; gap: 2px; padding-block: 2px; }
.split > div + div { border-inline-start: 1px solid var(--rule); padding-inline-start: 16px; }
.split dd { text-align: start; font-size: 19px; }
#estimate-ducky { color: var(--accent); }
#code-shortcut,#entry-bank { margin-top: 12px; }
#entry-followup { color: var(--ink); font-weight: 500; }
.stay-line,.amount-line,.number-unit { display: flex; align-items: center; gap: 10px; }
.stay-line { justify-content: space-between; margin-top: 20px; }
.stay-line p { margin-top: 2px; }
.number-unit { border: 1px solid var(--rule); border-radius: 7px; padding-inline-end: 12px; background: var(--card); min-width: 0; }
.number-unit input { margin: 0; padding-inline-end: 0; border: 0; min-width: 0; background: transparent; text-align: right; font-variant-numeric: tabular-nums; }
.number-unit span { color: var(--muted); }
.number-unit.nights { width: 6rem; flex-shrink: 0; }
#estimate input:is([type="checkbox"], [type="radio"]) { flex: 0 0 auto; width: 18px; height: 18px; min-height: 0; margin: 0; accent-color: var(--button); }
.amount-line { margin-top: 6px; }
#limit-note { margin-top: 5px; }
.methods,.extras { min-width: 0; margin: 16px 0; padding: 0; border: 0; }
.methods legend,.extras legend { padding: 0; font-weight: 650; }
.extras legend span { font-weight: 400; }
.extra-options { display: grid; margin-top: 6px; border: 1px solid var(--rule); border-radius: 8px; overflow: hidden; }
.extra-options label { display: flex; align-items: center; gap: 10px; min-height: 44px; padding: 7px 12px; cursor: pointer; }
.extra-options label + label { border-top: 1px solid var(--rule); }
.extra-options label:has(:checked) { background: var(--card); color: var(--accent); }
.extra-options label:focus-within { outline: 2px solid var(--accent); outline-offset: -2px; }
.extra-options strong { margin-inline-start: auto; font-variant-numeric: tabular-nums; }
.method-options { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 6px; }
.method-options label { display: flex; flex: 1 1 max-content; align-items: center; gap: 7px; min-height: 46px; padding: 8px 10px; border: 1px solid var(--rule); border-radius: 7px; cursor: pointer; }
.method-options label:has(:checked) { border-color: var(--accent); color: var(--accent); background: var(--card); }
.amount-line .number-unit { flex: 1; }
.amount-line button { flex: none; }
#bank-estimate-note,#continue-payment,#payment-step,#payment-step .panel,#difference .primary { margin-top: 16px; }
.review { margin-top: 20px; }
.review .row { margin-bottom: 16px; }
.review dl { margin: 0; }
.review .sum { margin-block: 8px; align-items: baseline; }
.review .sum dt { color: var(--ink); font-weight: 650; }
#review-total { font-size: clamp(22px, 6vw, 30px); letter-spacing: -.035em; }
#review-ducky { color: var(--accent); }
#review-details,.transfer { margin-top: 20px; }
.transfer .panel,.transfer .primary { margin-top: 16px; }
.transfer .summary-heading h3 { margin: 0; }
.transfer .summary-heading strong { color: var(--accent); font-size: clamp(20px, 5vw, 26px); }
.transfer .hint { margin-top: 8px; }
.transfer-status { margin-top: 12px; color: var(--accent); font-weight: 650; }
.followup-link { display: inline-flex; align-items: center; gap: 10px; min-height: 44px; margin-top: 6px; padding-inline: 0; border: 0; background: transparent; color: var(--accent); font-weight: 650; }
.followup-panel { margin-top: 20px; }
.transfer-legs { display: flex; gap: 8px; margin-block: 18px 14px; }
.transfer-legs button[aria-pressed="true"] { border-color: var(--accent); color: var(--accent); font-weight: 650; }
.followup-panel .hint { margin-block: 12px; }
.followup-panel .text-link { display: flex; width: fit-content; }

#access-form { margin: 0; }
.difference h3 { margin: 0; }
.difference { margin-top: 15px; padding: 14px; border-inline-start: 3px solid var(--accent); background: var(--paper); }
.difference dl > div { flex-wrap: wrap; gap: 4px 12px; }
.difference dd { text-align: start; }
#access { scroll-margin-block-start: 12px; }
#receipt { margin-top: 20px; }
h2[tabindex="-1"] { scroll-margin-block-start: 20px; }
#access .hint { margin-top: 6px; }
#retry-access { margin-top: 8px; }
@media (prefers-color-scheme: dark) {
  :root { --paper: #24201d; --card: #302923; --ink: #f5eee5; --muted: #d0c2b4; --rule: #635447; --accent: #efbba4; --button: #89482e; }
}

.issued-leg { margin-block-start: 18px; }
.issued-leg + .issued-leg { border-top: 1px solid var(--rule); padding-block-start: 18px; }
.issued-leg h3 { margin: 0; }
.issued-leg dl { margin-top: 6px; }
.leg-status { color: var(--accent); font-size: 14px; }
#receipt .sum dd { color: var(--ink); font-size: 20px; }
#selected-account .hint { margin-top: 4px; }
.issued-qr { margin: 16px 0; text-align: center; }
.issued-qr figcaption { color: var(--muted); font-size: 14px; }
#instructions .network { margin: 0; }
#recipient { padding: 8px 12px; background: var(--paper); border-radius: 6px; }

.after-transfer { margin-top: 12px; }
.after-transfer { width: 100%; color: var(--accent); font-weight: 650; border-color: var(--accent); }
#bank-report-form,#direct-report-form { border-top: 1px solid var(--rule); padding-top: 14px; }
.bank-form-actions { display: flex; gap: 8px; margin-top: 12px; }
.bank-form-actions .primary { width: auto; flex: 1; justify-content: center; }
#coin-followup,#bank-report-history { margin-top: 10px; }
.issued-leg h3[tabindex] { scroll-margin-block-start: 16px; }

.receipt-state { margin-top: 16px; padding: 14px 16px; border-inline-start: 3px solid var(--accent); background: var(--paper); }
.receipt-state .status { padding: 0; font-weight: 650; }
#wallet-return-actions { margin-block: 10px 16px; }
#wallet-return-actions .followup-link { display: flex; text-align: start; }
#status[tabindex] { scroll-margin-block-start: 16px; }
#payment-balances { width: 100%; table-layout: fixed; border-collapse: collapse; margin-top: 12px; font-size: 14px; line-height: 1.4; font-variant-numeric: tabular-nums; }
#payment-balances th,#payment-balances td { padding: 6px 0 6px 6px; text-align: end; vertical-align: top; }
#payment-balances th:first-child { padding-inline-start: 0; width: 25%; text-align: start; }
#payment-balances thead th { border-block: 1px solid var(--rule); }
#payment-balances tbody th { color: var(--muted); font-weight: 500; }
#payment-balances .balance-total > * { border-top: 1px solid var(--rule); color: var(--ink); font-weight: 650; }
#coin-review { border-top: 1px solid var(--rule); margin-top: 8px; padding-top: 12px; }
#coin-review h3 { margin: 0; color: var(--accent); font-size: 16px; }
#coin-review dl,#bank-overage-row dl { margin-top: 4px; }
#coin-review dl > div,#bank-overage-row dl > div { padding-block: 4px; }
#coin-review .hint { margin-top: 8px; }
.receipt-state dd { font-size: 16px; }
@media (min-width: 52rem) {
  body:has(#estimate[open]:not([hidden])) .shell { max-width: 64rem; }
  .estimate-layout { grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); align-items: start; gap: clamp(24px, 5vw, 56px); }
  .estimate-summary { position: sticky; top: 24px; }
  #estimate-intro .primary { max-width: 32rem; }
}

.pay-icon { width: 20px; height: 20px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; pointer-events: none; }
.receipt-tools,.state-heading,.copy-value { display: flex; align-items: center; gap: 8px; }
.receipt-tools { gap: 4px; }
.receipt-header { gap: 4px; }
.receipt-header h2 { font-size: clamp(18px, 5vw, 21px); }
.icon-action { display: inline-grid; place-items: center; width: 44px; height: 44px; min-height: 44px; padding: 0; flex: none; border: 1px solid transparent; background: transparent; color: var(--ink); }
@media (hover: hover) { .icon-action:hover { background: var(--paper); border-color: var(--rule); } }
.icon-action:active { background: var(--paper); border-color: var(--accent); }
.receipt-state { border: 1px solid var(--rule); border-radius: 8px; }
.receipt-state .status { color: var(--ink); }
.state-mark { display: inline-grid; place-items: center; flex: none; color: var(--accent); }
#mark-complete { width: 26px; height: 26px; border: 1px solid currentColor; border-radius: 50%; }
.receipt-meta { margin: 8px 0 0; }
.receipt-meta > div { align-items: baseline; }
.receipt-meta dt { flex-shrink: 0; }
.receipt-meta dd { font-size: 14px; }
.copy-value { justify-content: flex-end; flex-wrap: wrap; gap: 0 4px; }
.breakdown-control { display: flex; justify-content: space-between; align-items: center; gap: 8px; width: 100%; margin-top: 12px; padding-inline: 0; border: 0; border-top: 1px solid var(--rule); border-radius: 0; background: transparent; font-weight: 600; }
.breakdown-control .pay-icon { transform: rotate(90deg); }
.breakdown-control[aria-expanded="true"] .pay-icon { transform: rotate(-90deg); }
