/* Fotokapee App. Calm and plain: warm paper, pond green, one accent. System fonts only (no font downloads). */
:root {
  --paper: #F7F4EE; --card: #FFFFFF; --ink: #22302F; --muted: #5F6F6C; --line: #E3DED3;
  --pond: #2E7D73; --pond-dark: #23645C; --pond-soft: #DDEEEA; --capy: #B8895B;
  --danger: #A8433A; --warn-bg: #FBEFD9; --warn-ink: #6B4A12;
  --radius: 14px; --tap: 48px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Apple SD Gothic Neo", "Malgun Gothic", "Noto Sans KR", sans-serif;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; margin: 0; }
body { font: 16px/1.45 var(--font); color: var(--ink); background: var(--paper); overscroll-behavior: none; }
h1, h2, h3, p { margin: 0; }
h1 { font-size: 30px; letter-spacing: -0.01em; }
h2 { font-size: 18px; font-weight: 700; }
h3 { font-size: 17px; font-weight: 700; }
button, input, select { font: inherit; color: inherit; }
button { border: 0; background: none; cursor: pointer; min-height: var(--tap); border-radius: var(--radius); padding: 0 16px; touch-action: manipulation; }
button:disabled { opacity: .45; cursor: default; }
:focus-visible { outline: 3px solid var(--pond); outline-offset: 2px; }
input, select { width: 100%; min-height: var(--tap); border: 1.5px solid var(--line); border-radius: 12px; padding: 0 14px; background: var(--card); }
input:focus, select:focus { border-color: var(--pond); outline: none; }
label { display: block; font-weight: 600; font-size: 14px; margin: 14px 0 6px; }
a { color: var(--pond-dark); }
.hidden { display: none !important; }
.vh { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; margin: 0; }
.fine { font-size: 13.5px; color: var(--muted); }
.note { font-size: 14px; color: var(--danger); min-height: 20px; margin-top: 10px; }
.note.ok { color: var(--pond-dark); }
.lead { color: var(--muted); margin: 6px 0 18px; }
.primary { background: var(--pond); color: #fff; font-weight: 700; }
.primary:active { background: var(--pond-dark); }
.outline { border: 1.5px solid var(--pond); color: var(--pond-dark); font-weight: 600; background: var(--card); }
.ghost { color: var(--pond-dark); font-weight: 600; padding: 0 10px; }
.ghost.danger, .link.danger { color: var(--danger); }
.link { color: var(--pond-dark); text-decoration: underline; min-height: 32px; padding: 0 4px; font-weight: 500; }
.icon { width: var(--tap); padding: 0; display: grid; place-items: center; color: var(--ink); }
.icon svg { width: 24px; height: 24px; }
.wide { width: 100%; margin-top: 14px; }
.spacer { width: 64px; }
.or { text-align: center; color: var(--muted); margin: 16px 0 2px; font-size: 14px; }

.view { display: none; position: fixed; inset: 0; flex-direction: column; background: var(--paper); padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left); }
.view.on { display: flex; }
.view.dark { background: #101514; color: #fff; }
.view.dark .ghost { color: #fff; }
.center { margin: auto; text-align: center; padding: 24px; width: 100%; }
.center.narrow { max-width: 400px; text-align: left; }
.center.narrow h1, .center.narrow h2, .center.narrow .lead, .center.narrow .logo-lg { text-align: center; display: block; margin-left: auto; margin-right: auto; }
.logo-lg { width: 84px; height: 84px; margin-bottom: 10px; }
.logo-sm { width: 32px; height: 32px; }
.code { font-size: 26px; letter-spacing: .3em; text-align: center; font-variant-numeric: tabular-nums; }
.spin { width: 30px; height: 30px; margin: 18px auto; border: 3px solid var(--pond-soft); border-top-color: var(--pond); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spin { animation-duration: 2.4s; } .sheet .panel, .toast { transition: none !important; } }

header, .topbar { display: flex; align-items: center; gap: 6px; padding: 6px 10px; min-height: 56px; }
header .brand { font-weight: 800; font-size: 19px; flex: 1; letter-spacing: -0.01em; }
.topbar h2 { flex: 1; text-align: center; }
main { flex: 1; overflow-y: auto; padding: 8px 16px 18px; -webkit-overflow-scrolling: touch; }
.banner { display: flex; align-items: center; gap: 8px; margin: 0 12px 6px; padding: 8px 8px 8px 14px; border-radius: 12px; background: var(--warn-bg); color: var(--warn-ink); font-size: 14.5px; }
.banner span { flex: 1; }
.banner .ghost { color: var(--warn-ink); text-decoration: underline; min-height: 36px; }

.empty { min-height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; text-align: center; padding: 20px 0; }
.scanbig { width: 172px; height: 172px; border-radius: 50%; background: var(--pond); color: #fff; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; font-size: 22px; font-weight: 800; box-shadow: 0 10px 28px rgba(46, 125, 115, .32); }
.scanbig svg { width: 58px; height: 58px; }
.scanbig:active { background: var(--pond-dark); transform: scale(.98); }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 12px; }
.tile { position: relative; aspect-ratio: 3 / 4; padding: 0; background: var(--card); border: 1.5px solid var(--line); border-radius: 10px; overflow: hidden; min-height: 0; }
.tile img { width: 100%; height: 100%; object-fit: contain; display: block; background: #fff; }
.tile .n { position: absolute; left: 6px; bottom: 6px; background: rgba(34, 48, 47, .82); color: #fff; font-size: 12px; font-weight: 700; border-radius: 9px; padding: 1px 7px; }
.tile .chk { position: absolute; right: 6px; top: 6px; background: var(--warn-bg); color: var(--warn-ink); font-size: 11.5px; font-weight: 700; border-radius: 9px; padding: 1px 7px; }
.details { margin-top: 16px; background: var(--card); border: 1.5px solid var(--line); border-radius: var(--radius); padding: 4px 14px 14px; }
.markrow { display: flex; gap: 8px; align-items: center; margin: 12px 0 0; flex-wrap: wrap; }
.markrow.scrollx { flex-wrap: nowrap; overflow-x: auto; padding-bottom: 4px; margin-bottom: 10px; scrollbar-width: none; }
.markrow.pad, .seg.pad, .fine.pad { margin-left: 16px; margin-right: 16px; }
.dot { width: 36px; height: 36px; min-height: 36px; padding: 0; border-radius: 50%; border: 3px solid transparent; flex: none; display: grid; place-items: center; color: #fff; font-weight: 800; font-size: 15px; }
.dot[aria-pressed="true"] { border-color: var(--ink); }
.dot.none { background: var(--card); border: 1.5px dashed var(--muted); color: var(--muted); font-size: 12px; font-weight: 600; }
.dot.none[aria-pressed="true"] { border: 3px solid var(--ink); }
.chip { min-height: 34px; padding: 0 12px; border-radius: 17px; border: 1.5px solid var(--line); background: var(--card); font-size: 14px; white-space: nowrap; flex: none; }
.chip[aria-pressed="true"] { background: var(--pond-soft); border-color: var(--pond); color: var(--pond-dark); font-weight: 700; }
.seg { display: flex; background: #ECE7DC; border-radius: 12px; padding: 3px; gap: 2px; margin-top: 12px; }
.seg button { flex: 1; min-height: 40px; padding: 0 6px; border-radius: 10px; font-size: 14px; font-weight: 600; color: var(--muted); }
.seg button[aria-pressed="true"] { background: var(--card); color: var(--ink); box-shadow: 0 1px 3px rgba(0, 0, 0, .12); }
#saveMeta { margin-top: 10px; }

.bar { display: flex; align-items: center; gap: 8px; padding: 8px 12px calc(8px + env(safe-area-inset-bottom)); border-top: 1.5px solid var(--line); background: var(--card); }
.bar button { display: flex; flex-direction: column; align-items: center; justify-content: center; font-size: 12.5px; font-weight: 600; color: var(--muted); min-width: 76px; padding: 4px 8px; }
.bar button svg { width: 24px; height: 24px; }
.bar .save { flex: 1; flex-direction: row; font-size: 18px; color: #fff; min-height: 54px; }
.view.dark .bar { background: #101514; border-top-color: #26302E; justify-content: space-between; }
.view.dark .bar button { color: #fff; }
.side { width: 96px; display: flex; justify-content: center; }
.side button[aria-pressed="true"], #liveMulti[aria-pressed="true"] { color: #7FE0CF; }
.shutter { width: 74px; height: 74px; min-width: 74px !important; border-radius: 50%; background: #fff; color: #101514 !important; border: 5px solid #5B6966; }
.shutter svg { width: 34px; height: 34px; }

.stage { flex: 1; position: relative; overflow: hidden; }
#video, #liveCanvas, #cropCanvas { position: absolute; inset: 0; width: 100%; height: 100%; }
#video { object-fit: contain; background: #000; }
#cropCanvas { touch-action: none; }
#liveMsg { text-align: center; padding: 6px 12px; font-weight: 600; min-height: 34px; }
.flash { position: absolute; inset: 0; background: #fff; opacity: 0; pointer-events: none; }
.flash.go { animation: flash .28s ease-out; }
@keyframes flash { from { opacity: .75; } to { opacity: 0; } }
#liveErr { position: absolute; inset: 0; display: none; flex-direction: column; align-items: center; justify-content: center; gap: 12px; padding: 24px; text-align: center; background: #101514; }
#liveErr.on { display: flex; }
.hint { display: none; margin: 0 14px 8px; padding: 8px 12px; border-radius: 10px; background: var(--warn-bg); color: var(--warn-ink); font-size: 14px; }
.hint.on { display: block; }
.tools { display: flex; gap: 6px; padding: 8px 10px calc(8px + env(safe-area-inset-bottom)); }
.tools .t { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; font-size: 12.5px; font-weight: 600; padding: 6px 2px; min-height: 56px; border-radius: 12px; background: var(--card); border: 1.5px solid var(--line); }
.view.dark .tools .t { background: #1B2321; border-color: #2C3835; color: #fff; }
.tools .t svg { width: 22px; height: 22px; }
.tools .t.primary { background: var(--pond); border-color: var(--pond); color: #fff; }
.tools .t[aria-pressed="true"] { border-color: var(--pond); color: var(--pond-dark); background: var(--pond-soft); }
.pv { flex: 1; position: relative; margin: 0 14px; background: #ECE7DC; border-radius: 12px; overflow: hidden; display: grid; place-items: center; min-height: 0; }
.pv img { max-width: 100%; max-height: 100%; object-fit: contain; box-shadow: 0 2px 14px rgba(0, 0, 0, .18); }
.busy { position: absolute; inset: 0; display: none; flex-direction: column; align-items: center; justify-content: center; background: rgba(247, 244, 238, .86); font-weight: 600; }
.busy.on { display: flex; }
#page .seg { margin: 10px 14px 0; }

.cards { flex: 1; overflow-y: auto; padding: 4px 14px 28px; display: flex; flex-direction: column; gap: 12px; }
.card { background: var(--card); border: 1.5px solid var(--line); border-radius: var(--radius); padding: 14px; }
.card h3 { margin-bottom: 8px; }
.row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 8px 0; }
.row > div:first-child { min-width: 0; flex: 1; }
.row label { margin: 0; }
.row select, .row input[type="number"] { width: auto; min-width: 120px; }
.btns { display: flex; gap: 8px; align-items: center; }
.btns.wrap { flex-wrap: wrap; margin-top: 8px; }
.btns button, .row button { min-height: 42px; white-space: nowrap; }
.check { display: flex; align-items: center; gap: 10px; font-weight: 500; font-size: 15px; margin: 6px 0; min-height: 40px; }
.check input { width: 22px; height: 22px; min-height: 0; accent-color: var(--pond); flex: none; padding: 0; }
.inline { display: flex; gap: 8px; margin-top: 12px; }
.inline input { flex: 1; min-width: 0; }
.inline button { white-space: nowrap; }
.rowend { display: flex; justify-content: flex-end; gap: 8px; margin-top: 10px; }
.list { list-style: none; margin: 0; padding: 0 14px; overflow-y: auto; flex: 1; }
.list.tight { padding: 0; overflow: visible; flex: none; }
.list li { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1.5px solid var(--line); min-height: 56px; }
.list li:last-child { border-bottom: 0; }
.list .main { flex: 1; min-width: 0; }
.list .main b { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list .main span { display: block; font-size: 13px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list .tag { width: 10px; align-self: stretch; border-radius: 5px; background: var(--line); flex: none; }
.list button.open { text-align: left; flex: 1; min-width: 0; padding: 0; display: flex; gap: 10px; align-items: center; border-radius: 8px; }
.pill { font-size: 12px; font-weight: 700; border-radius: 10px; padding: 2px 8px; background: var(--pond-soft); color: var(--pond-dark); white-space: nowrap; }

.sheet { position: fixed; inset: 0; display: none; align-items: flex-end; justify-content: center; background: rgba(20, 28, 27, .45); z-index: 20; }
.sheet.on { display: flex; }
.panel { width: 100%; max-width: 520px; max-height: 92%; overflow-y: auto; background: var(--paper); border-radius: 20px 20px 0 0; padding: 18px 16px calc(14px + env(safe-area-inset-bottom)); }
@media (min-width: 640px) { .sheet { align-items: center; } .panel { border-radius: 20px; } }
.plans { display: grid; gap: 8px; margin-top: 12px; }
.plan { display: flex; align-items: center; gap: 12px; text-align: left; width: 100%; padding: 12px 14px; background: var(--card); border: 2px solid var(--line); border-radius: var(--radius); min-height: 64px; }
.plan[aria-pressed="true"] { border-color: var(--pond); background: var(--pond-soft); }
.plan .main { flex: 1; }
.plan .main b { display: block; }
.plan .main span { font-size: 13.5px; color: var(--muted); }
.plan .price { font-weight: 800; font-size: 18px; white-space: nowrap; }
.plan .price small { font-weight: 500; font-size: 12.5px; color: var(--muted); }
.summary { margin-top: 12px; font-size: 14.5px; min-height: 22px; }
.infobody { margin: 10px 0; font-size: 15px; }
.infobody p { margin: 8px 0; }
.infobody ol, .infobody ul { padding-left: 20px; margin: 8px 0; }
.infobody pre { background: var(--card); border: 1.5px solid var(--line); border-radius: 10px; padding: 10px; overflow-x: auto; font-size: 12.5px; white-space: pre-wrap; word-break: break-word; }
.toast { position: fixed; left: 50%; bottom: calc(92px + env(safe-area-inset-bottom)); transform: translate(-50%, 20px); opacity: 0; pointer-events: none; transition: opacity .18s, transform .18s; z-index: 30;
  background: var(--ink); color: #fff; border-radius: 14px; padding: 10px 14px; display: flex; align-items: center; gap: 10px; max-width: min(92vw, 460px); font-size: 15px; }
.toast.on { opacity: 1; transform: translate(-50%, 0); pointer-events: auto; }
.toast button { color: #9FE8D9; font-weight: 700; min-height: 36px; padding: 0 6px; }

/* friendlier home screen */
.how { list-style: none; counter-reset: how; display: flex; gap: 14px; padding: 0; margin: 6px 0 0; color: var(--muted); font-size: 14px; flex-wrap: wrap; justify-content: center; }
.how li { counter-increment: how; display: flex; align-items: center; gap: 6px; }
.how li::before { content: counter(how); display: grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; background: var(--pond-soft); color: var(--pond-dark); font-weight: 800; font-size: 12.5px; }
.saved { background: var(--pond-soft); color: var(--pond-dark); font-weight: 600; border-radius: 12px; padding: 10px 14px; max-width: 420px; }
.saved::before { content: "\2713  "; font-weight: 800; }
.grid.single { grid-template-columns: minmax(0, 320px); justify-content: center; }
.grid.single .tile { aspect-ratio: auto; height: min(52vh, 440px); }
.tip { text-align: center; margin-top: 8px; }
.sum { font-weight: 600; margin: 10px 0 0; min-height: 22px; }
.more { width: 100%; text-align: left; color: var(--pond-dark); font-weight: 600; padding: 0; min-height: 44px; display: flex; align-items: center; justify-content: space-between; }
.more::after { content: "+"; font-size: 22px; font-weight: 500; }
.more[aria-expanded="true"]::after { content: "\2212"; }
.tipbox { background: var(--card); border: 1.5px solid var(--line); border-radius: 12px; padding: 10px 14px; max-width: 420px; }
.tipbox .link { display: inline; min-height: 0; padding: 0 0 0 6px; }
.how { gap: 12px; }
#fmts button { white-space: normal; line-height: 1.15; font-size: 14px; padding: 6px 4px; }
#fmts button[data-fmt="spdf"] { flex: 1.6; }
