:root {
  --page: #efe9df;
  --paper: #fbf8f2;
  --ink: #2a2522;
  --ink-2: #6f665f;
  --line: #cfc6b8;
  --btn: #2a2522;
  --btn-ink: #fbf8f2;
  --soft: #e4dccf;
  --warn: #6b3d22;
  --page-ink: #2a2522;
  --page-ink-2: #6f665f;
  --mono: 'Nanum Gothic Coding', ui-monospace, monospace;
  --serif: 'Gowun Batang', 'AppleMyungjo', serif;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --page: #1e1b18; --page-ink: #efe9df; --page-ink-2: #b4aaa0; --soft: #2e2a26; --btn: #efe9df; --btn-ink: #1e1b18;
  }
}
:root[data-theme="dark"] { --page: #1e1b18; --page-ink: #efe9df; --page-ink-2: #b4aaa0; --soft: #2e2a26; --btn: #efe9df; --btn-ink: #1e1b18; }

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--page); color: var(--page-ink);
  font-family: var(--mono); font-size: 16px; line-height: 1.6;
  min-height: 100dvh; display: flex; flex-direction: column;
  padding-bottom: env(safe-area-inset-bottom);
}
main { flex: 1; width: 100%; max-width: 480px; margin: 0 auto; padding: 8px 16px 32px; outline: none; }
a { color: inherit; }
.pad { padding: 16px; }

.top { display: flex; align-items: center; justify-content: space-between; gap: 12px; max-width: 480px; width: 100%; margin: 0 auto; padding: 14px 16px 6px; }
.logo { font-family: var(--serif); font-weight: 700; font-size: 20px; text-decoration: none; letter-spacing: -0.02em; }
.tabs { display: flex; gap: 4px; background: var(--soft); border-radius: 999px; padding: 3px; }
.tabs a { text-decoration: none; font-size: 14px; padding: 6px 12px; border-radius: 999px; color: var(--page-ink-2); }
.tabs a[aria-current="page"] { background: var(--btn); color: var(--btn-ink); }
.test-banner { max-width: 480px; margin: 4px auto 0; padding: 6px 16px; font-size: 13px; color: var(--page-ink-2); text-align: center; }

/* 영수증 종이 */
.receipt {
  position: relative; background: var(--paper); color: var(--ink);
  padding: 22px 20px 26px; margin: 12px 0 18px;
  filter: drop-shadow(0 2px 6px rgba(40, 30, 20, .12));
  --zig: 8px;
  -webkit-mask: conic-gradient(from -45deg at bottom, #0000, #000 1deg 89deg, #0000 90deg) 50% / calc(var(--zig) * 2) 100%;
  mask: conic-gradient(from -45deg at bottom, #0000, #000 1deg 89deg, #0000 90deg) 50% / calc(var(--zig) * 2) 100%;
  padding-bottom: calc(26px + var(--zig));
}
.receipt.top-edge {
  -webkit-mask: conic-gradient(from 135deg at top, #0000, #000 1deg 89deg, #0000 90deg) top / calc(var(--zig) * 2) 51% repeat-x,
                conic-gradient(from -45deg at bottom, #0000, #000 1deg 89deg, #0000 90deg) bottom / calc(var(--zig) * 2) 51% repeat-x;
  mask: conic-gradient(from 135deg at top, #0000, #000 1deg 89deg, #0000 90deg) top / calc(var(--zig) * 2) 51% repeat-x,
        conic-gradient(from -45deg at bottom, #0000, #000 1deg 89deg, #0000 90deg) bottom / calc(var(--zig) * 2) 51% repeat-x;
  padding-top: calc(22px + var(--zig));
}
.r-head { text-align: center; }
.r-shop { font-family: var(--serif); font-weight: 700; font-size: 22px; letter-spacing: .08em; }
.r-sub { font-size: 12px; color: var(--ink-2); }
.dash { border: 0; border-top: 1.5px dashed var(--line); margin: 14px 0; }
.r-row { display: flex; justify-content: space-between; gap: 12px; font-size: 15px; }
.r-row .k { color: var(--ink-2); }
.r-big { text-align: center; margin: 6px 0 2px; }
.r-big .hanja { font-family: var(--serif); font-size: 44px; letter-spacing: .12em; line-height: 1.2; }
.r-big .kor { font-size: 15px; color: var(--ink-2); }
.r-line { font-family: var(--serif); font-size: 18px; line-height: 1.55; text-align: center; margin: 10px 4px 0; word-break: keep-all; }
.pillars { display: grid; grid-template-columns: repeat(4, 1fr); text-align: center; gap: 4px; }
.pillars .p-k { font-size: 12px; color: var(--ink-2); }
.pillars .p-v { font-family: var(--serif); font-size: 22px; line-height: 1.2; }
.pillars .p-s { font-size: 12px; color: var(--ink-2); }
.bars { display: grid; gap: 6px; }
.bar { display: grid; grid-template-columns: 52px 1fr 28px; align-items: center; gap: 8px; font-size: 14px; }
.bar .track { height: 10px; background: repeating-linear-gradient(90deg, var(--line) 0 6px, transparent 6px 9px); }
.bar .fill { height: 10px; background: var(--ink); }
.r-note { font-size: 14px; color: var(--ink); word-break: keep-all; }
.r-foot { text-align: center; font-size: 12px; color: var(--ink-2); margin-top: 12px; }
.barcode { height: 34px; margin: 10px auto 4px; width: 70%; background: repeating-linear-gradient(90deg, var(--ink) 0 2px, transparent 2px 4px, var(--ink) 4px 5px, transparent 5px 8px, var(--ink) 8px 11px, transparent 11px 12px); }
.stamp { display: inline-block; border: 2px solid var(--ink); border-radius: 6px; padding: 2px 10px; font-family: var(--serif); font-weight: 700; transform: rotate(-4deg); }
.score { font-family: var(--serif); font-size: 54px; text-align: center; line-height: 1; }
.score small { font-size: 18px; }

/* 입력 */
.hero { text-align: center; margin: 14px 0 4px; }
.hero h1 { font-family: var(--serif); font-size: 26px; line-height: 1.35; margin: 0 0 6px; word-break: keep-all; }
.hero p { margin: 0; color: var(--page-ink-2); font-size: 14px; word-break: keep-all; }
.form { display: grid; gap: 14px; }
.field label, .field .label { display: block; font-size: 14px; margin-bottom: 6px; color: var(--ink); }
.field .hint { font-size: 12px; color: var(--ink-2); margin-top: 4px; }
.input {
  width: 100%; font: inherit; font-size: 20px; letter-spacing: .04em; color: var(--ink);
  background: #fff; border: 1.5px solid var(--line); border-radius: 10px; padding: 12px 14px; min-height: 52px;
}
.input:focus { outline: 2px solid var(--ink); outline-offset: 1px; border-color: var(--ink); }
.input[aria-invalid="true"] { border-color: var(--warn); }
.err { color: var(--warn); font-size: 13px; margin-top: 6px; min-height: 0; }
.seg { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 0; border: 1.5px solid var(--line); border-radius: 10px; overflow: hidden; }
.seg button { font: inherit; font-size: 15px; padding: 10px 6px; min-height: 46px; border: 0; background: #fff; color: var(--ink-2); }
.seg button + button { border-left: 1.5px solid var(--line); }
.seg button[aria-pressed="true"] { background: var(--ink); color: var(--paper); }
.row { display: flex; gap: 8px; align-items: stretch; }
.row .input { flex: 1; }
.chip { font: inherit; font-size: 15px; border: 1.5px solid var(--line); background: #fff; color: var(--ink); border-radius: 10px; padding: 0 14px; min-height: 52px; white-space: nowrap; }
.chip[aria-pressed="true"] { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.check, .field label.check { display: flex; gap: 10px; align-items: flex-start; font-size: 14px; color: var(--ink); }
.check input { width: 22px; height: 22px; margin: 1px 0 0; accent-color: var(--ink); flex: none; }

.btn {
  display: flex; align-items: center; justify-content: center; gap: 8px; width: 100%;
  font: inherit; font-size: 17px; font-weight: 700; text-decoration: none;
  background: var(--btn); color: var(--btn-ink); border: 0; border-radius: 12px; padding: 14px 16px; min-height: 54px; cursor: pointer;
}
.btn:disabled { opacity: .45; cursor: default; }
.btn.ghost { background: transparent; color: var(--page-ink); border: 1.5px solid currentColor; }
.receipt .btn { background: var(--ink); color: var(--paper); }
.receipt .btn.ghost { background: transparent; color: var(--ink); }
.actions { display: grid; gap: 10px; margin: 6px 0 18px; }
.actions .sub { font-size: 13px; color: var(--page-ink-2); text-align: center; margin-top: -4px; }
.linkish { background: none; border: 0; font: inherit; font-size: 14px; color: var(--page-ink-2); text-decoration: underline; padding: 8px; cursor: pointer; }
.center { text-align: center; }
.muted { color: var(--page-ink-2); font-size: 14px; }
.small { font-size: 13px; }
.card-img { width: 100%; border-radius: 6px; display: block; margin: 10px 0; }
.sheet { background: var(--soft); border-radius: 12px; padding: 14px; margin: 10px 0; font-size: 14px; word-break: keep-all; }
.sheet h3 { margin: 0 0 6px; font-size: 15px; }
.sheet ul { margin: 0; padding-left: 18px; }
.steps { list-style: none; padding: 0; margin: 10px 0; display: grid; gap: 8px; }
.steps li { display: flex; gap: 10px; align-items: center; color: var(--ink-2); }
.steps li.on { color: var(--ink); font-weight: 700; }
.steps li.done { color: var(--ink); }
.steps li::before { content: '○'; width: 1em; }
.steps li.on::before { content: '◐'; animation: spin 1s linear infinite; display: inline-block; }
.steps li.done::before { content: '●'; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .steps li.on::before { animation: none; } }
.reading h2 { font-family: var(--serif); font-size: 19px; margin: 18px 0 6px; }
.reading p { margin: 0; word-break: keep-all; }
.months { list-style: none; padding: 0; margin: 0; display: grid; gap: 4px; font-size: 14px; }
.months li { display: grid; grid-template-columns: 44px 1fr; gap: 6px; }
.toast { position: fixed; left: 50%; bottom: calc(20px + env(safe-area-inset-bottom)); transform: translateX(-50%); background: var(--btn); color: var(--btn-ink); padding: 10px 16px; border-radius: 999px; font-size: 14px; opacity: 0; pointer-events: none; transition: opacity .2s; max-width: calc(100% - 32px); text-align: center; }
.toast.show { opacity: 1; }

.foot { max-width: 480px; margin: 0 auto; padding: 20px 16px 28px; font-size: 12px; color: var(--page-ink-2); line-height: 1.7; word-break: keep-all; }
.foot a { color: var(--page-ink-2); }
.foot .links { display: flex; flex-wrap: wrap; gap: 4px 14px; margin-bottom: 8px; }
.foot .todo { border-bottom: 1px dashed currentColor; }
.doc { background: var(--paper); color: var(--ink); padding: 18px; border-radius: 6px; font-size: 14px; word-break: keep-all; }
.doc h1 { font-family: var(--serif); font-size: 22px; margin: 0 0 10px; }
.doc h2 { font-size: 16px; margin: 18px 0 6px; }
.doc table { border-collapse: collapse; width: 100%; font-size: 13px; }
.doc td, .doc th { border: 1px solid var(--line); padding: 6px; vertical-align: top; text-align: left; }
#pay-methods, #pay-agreement { background: #fff; border-radius: 10px; margin: 8px 0; }
@media (min-width: 720px) {
  main, .top, .foot, .test-banner { max-width: 520px; }
  .hero h1 { font-size: 30px; }
}
/* 영수증 종이 안은 다크 모드에서도 종이색 */
.receipt .sheet { background: #efe8dc !important; color: var(--ink); }
.receipt a { color: var(--ink); }
