@font-face { font-family: "Bricolage"; src: url(/fonts/bricolage-800.woff2) format("woff2"); font-weight: 800; font-display: swap; }
@font-face { font-family: "Atkinson"; src: url(/fonts/atkinson-400.woff2) format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Atkinson"; src: url(/fonts/atkinson-700.woff2) format("woff2"); font-weight: 700; font-display: swap; }

:root {
  --paper: #f2e9d6;
  --paper-2: #e9dcc1;
  --card: #fbf6ea;
  --ink: #1b1a17;
  --ink-2: #5b5547;
  --line: #d8c9a8;
  --tag: #ff5a1f;
  --tag-ink: #fff4ec;
  --ok: #1f7a4d;
  --warn: #c98a00;
  --bad: #c2321f;
  --busy: #3a5bd9;
  --r: 14px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
  --display: "Bricolage", "Atkinson", system-ui, sans-serif;
  --body: "Atkinson", system-ui, sans-serif;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; }
body {
  font-family: var(--body);
  font-size: 17px;
  line-height: 1.4;
  color: var(--ink);
  background:
    radial-gradient(1200px 600px at 110% -10%, #f8efdc 0%, transparent 60%),
    repeating-linear-gradient(115deg, rgba(120, 90, 40, .025) 0 2px, transparent 2px 7px),
    var(--paper);
  overscroll-behavior-y: none;
}
button, input, select, textarea { font: inherit; color: inherit; }
a { color: inherit; }
h1, h2, h3 { font-family: var(--display); font-weight: 800; letter-spacing: -.02em; margin: 0; line-height: 1.05; }

#app { min-height: 100%; padding-bottom: calc(76px + var(--safe-b)); }
.page { padding: calc(18px + var(--safe-t)) 16px 24px; max-width: 720px; margin: 0 auto; animation: rise .35s ease both; }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } }
.page > h1 { font-size: 40px; margin: 6px 0 16px; }
.page > h1 small { display: block; font-family: var(--body); font-weight: 400; font-size: 15px; color: var(--ink-2); letter-spacing: 0; margin-top: 6px; }

/* ------------------------------------------------------------ tabs */
#tabs {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  display: grid; grid-template-columns: repeat(3, 1fr);
  padding: 6px 10px calc(6px + var(--safe-b));
  background: rgba(27, 26, 23, .94); backdrop-filter: blur(10px);
}
#tabs a { position: relative; display: grid; justify-items: center; gap: 2px; padding: 6px 0; text-decoration: none; color: #b9b19f; font-size: 12px; font-weight: 700; letter-spacing: .03em; text-transform: uppercase; }
#tabs svg { width: 26px; height: 26px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linejoin: round; }
#tabs a.on { color: #fff; }
#tabs a.on svg { stroke: var(--tag); }
.badge { position: absolute; top: 0; left: calc(50% + 8px); min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px; background: var(--tag); color: #fff; font-size: 12px; line-height: 20px; text-align: center; }
body.camera #tabs { background: rgba(0, 0, 0, .55); }

/* ------------------------------------------------------------ camera */
.cam { position: fixed; inset: 0; background: #000; color: #fff; overflow: hidden; }
.cam video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.cam .flash { position: absolute; inset: 0; background: #fff; opacity: 0; pointer-events: none; }
.cam .flash.go { animation: flash .22s ease-out; }
@keyframes flash { 0% { opacity: .75; } 100% { opacity: 0; } }
.cam .top {
  position: absolute; left: 0; right: 0; top: 0; padding: calc(10px + var(--safe-t)) 14px 10px;
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  background: linear-gradient(rgba(0,0,0,.6), transparent);
}
.chip {
  display: inline-flex; align-items: center; gap: 6px; padding: 8px 12px; border-radius: 999px; border: 0;
  background: rgba(255,255,255,.16); color: #fff; font-size: 14px; font-weight: 700; backdrop-filter: blur(6px);
}
.chip.on { background: #fff; color: var(--ink); }
.chip.rec { background: var(--bad); }
.chip.rec::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: #fff; animation: blink 1s infinite; }
@keyframes blink { 50% { opacity: .2; } }
.cam .counter { margin-left: auto; font-family: var(--display); font-size: 15px; background: var(--tag); padding: 6px 12px; border-radius: 999px; }
.cam .strip {
  position: absolute; left: 0; right: 0; bottom: calc(196px + var(--safe-b)); padding: 0 14px;
  display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none;
}
.cam .strip .th { position: relative; flex: none; width: 58px; height: 58px; border-radius: 10px; overflow: hidden; border: 2px solid rgba(255,255,255,.85); animation: pop .25s ease both; }
@keyframes pop { from { transform: scale(.4); opacity: 0; } }
.cam .strip img { width: 100%; height: 100%; object-fit: cover; display: block; }
.cam .strip .x { position: absolute; top: 2px; right: 2px; width: 20px; height: 20px; border-radius: 50%; border: 0; background: rgba(0,0,0,.7); color: #fff; font-size: 13px; line-height: 20px; padding: 0; }
.cam .controls {
  position: absolute; left: 0; right: 0; bottom: calc(70px + var(--safe-b)); padding: 18px 20px 22px;
  display: grid; grid-template-columns: 1fr auto 1fr; align-items: center;
  background: linear-gradient(transparent, rgba(0,0,0,.65) 35%);
}
.shutter {
  width: 86px; height: 86px; border-radius: 50%; border: 5px solid #fff; background: transparent; padding: 5px;
  box-shadow: 0 0 0 1px rgba(0,0,0,.3);
}
.shutter::after { content: ""; display: block; width: 100%; height: 100%; border-radius: 50%; background: #fff; transition: transform .08s; }
.shutter:active::after { transform: scale(.86); background: #ddd; }
.side { display: flex; gap: 10px; align-items: center; }
.side.r { justify-content: flex-end; }
.round { width: 52px; height: 52px; border-radius: 50%; border: 0; background: rgba(255,255,255,.18); color: #fff; display: grid; place-items: center; backdrop-filter: blur(6px); }
.round svg { width: 26px; height: 26px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.round.rec { background: var(--bad); }
.next {
  border: 0; border-radius: 999px; padding: 14px 18px; background: var(--tag); color: #fff;
  font-family: var(--display); font-size: 18px; letter-spacing: -.01em; white-space: nowrap;
  box-shadow: 0 6px 20px rgba(255, 90, 31, .45);
}
.next:disabled { background: rgba(255,255,255,.2); box-shadow: none; color: rgba(255,255,255,.6); }
.cam .nocam { position: absolute; inset: 0; display: grid; place-content: center; gap: 14px; padding: 30px; text-align: center; }
.cam .handed {
  position: absolute; left: 50%; top: 40%; transform: translate(-50%, -50%) rotate(-4deg);
  background: var(--tag); color: #fff; padding: 12px 22px; border-radius: 6px; font-family: var(--display); font-size: 26px;
  opacity: 0; pointer-events: none;
}
.cam .handed.go { animation: handed 1.1s ease both; }
@keyframes handed { 0% { opacity: 0; transform: translate(-50%, -30%) rotate(-4deg) scale(.8); } 20% { opacity: 1; transform: translate(-50%, -50%) rotate(-4deg) scale(1); } 75% { opacity: 1; } 100% { opacity: 0; transform: translate(-50%, -80%) rotate(-4deg); } }
.cam .queue { font-size: 13px; opacity: .9; }

/* ------------------------------------------------------------ sheet */
.sheet-bg { position: fixed; inset: 0; z-index: 50; background: rgba(0,0,0,.45); display: flex; align-items: flex-end; animation: fade .2s both; }
@keyframes fade { from { opacity: 0; } }
.sheet { width: 100%; background: var(--card); color: var(--ink); border-radius: 20px 20px 0 0; padding: 18px 16px calc(18px + var(--safe-b)); animation: up .25s ease both; max-height: 85vh; overflow: auto; }
@keyframes up { from { transform: translateY(40px); } }
.sheet h3 { font-size: 22px; margin-bottom: 10px; }

/* ------------------------------------------------------------ list */
.banner { display: flex; flex-direction: column; gap: 2px; padding: 12px 14px; border-radius: var(--r); margin-bottom: 14px; background: var(--ink); color: #fff; text-decoration: none; }
.banner.warn { background: var(--warn); color: #1b1a17; }
.banner.bad { background: var(--bad); }
.banner b { font-family: var(--display); }
.section { margin: 22px 0 10px; display: flex; align-items: baseline; gap: 10px; }
.section h2 { font-size: 22px; }
.section .n { font-family: var(--display); font-size: 15px; color: var(--ink-2); }
.cards { display: grid; gap: 10px; }
.tagcard {
  position: relative; display: grid; grid-template-columns: 76px 1fr auto; gap: 12px; align-items: center;
  padding: 10px 14px 10px 10px; background: var(--card); border: 1px solid var(--line); border-radius: var(--r);
  text-decoration: none; box-shadow: 0 1px 0 rgba(0,0,0,.04), 0 6px 14px -10px rgba(60,40,10,.35);
  animation: rise .3s ease both;
}
.tagcard img, .tagcard .ph { width: 76px; height: 76px; border-radius: 10px; object-fit: cover; background: var(--paper-2); display: block; }
.tagcard .t { font-weight: 700; line-height: 1.2; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.tagcard .sub { font-size: 14px; color: var(--ink-2); margin-top: 3px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.tagcard .sub.err { color: var(--bad); }
.price {
  position: relative; font-family: var(--display); font-size: 20px; padding: 6px 10px 6px 18px; white-space: nowrap;
  background: var(--tag); color: var(--tag-ink); border-radius: 4px 8px 8px 4px;
  clip-path: polygon(10px 0, 100% 0, 100% 100%, 10px 100%, 0 50%);
}
.price::before { content: ""; position: absolute; left: 9px; top: 50%; width: 5px; height: 5px; margin-top: -2.5px; border-radius: 50%; background: var(--card); }
.price.muted { background: var(--ink-2); }
.stamp {
  display: inline-block; margin-top: 6px; padding: 2px 8px; border: 2px solid currentColor; border-radius: 4px;
  font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; transform: rotate(-2deg);
}
.s-review { color: var(--warn); } .s-failed { color: var(--bad); } .s-published { color: var(--ok); }
.s-busy { color: var(--busy); } .s-ready { color: var(--ink); } .s-done { color: var(--ink-2); }
.spin { display: inline-block; width: 10px; height: 10px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spin .8s linear infinite; vertical-align: -1px; margin-right: 4px; }
@keyframes spin { to { transform: rotate(360deg); } }
.empty { padding: 40px 20px; text-align: center; color: var(--ink-2); border: 2px dashed var(--line); border-radius: var(--r); }
.empty h2 { color: var(--ink); margin-bottom: 8px; }
details.done > summary { cursor: pointer; list-style: none; }
details.done > summary::-webkit-details-marker { display: none; }

/* ------------------------------------------------------------ item */
.back { display: inline-flex; align-items: center; gap: 4px; text-decoration: none; font-weight: 700; color: var(--ink-2); margin-bottom: 8px; }
.gallery { display: flex; gap: 8px; overflow-x: auto; margin: 0 -16px 14px; padding: 0 16px; scroll-snap-type: x mandatory; scrollbar-width: none; }
.gallery img { flex: none; height: 260px; max-width: 86vw; border-radius: var(--r); object-fit: cover; scroll-snap-align: start; background: var(--paper-2); }
.box { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 14px; margin-bottom: 12px; }
.box.alert { border: 2px solid var(--warn); background: #fff6df; }
.box.danger { border: 2px solid var(--bad); background: #fdebe6; }
.box.ok { border: 2px solid var(--ok); background: #e9f5ec; }
.box h3 { font-size: 19px; margin-bottom: 8px; }
.box p { margin: 6px 0; }
.box ul { margin: 6px 0; padding-left: 20px; }
label.f { display: block; margin: 12px 0 0; }
label.f > span { display: flex; justify-content: space-between; font-size: 13px; font-weight: 700; color: var(--ink-2); text-transform: uppercase; letter-spacing: .05em; margin-bottom: 4px; }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=search], select, textarea {
  width: 100%; padding: 12px; border-radius: 10px; border: 1.5px solid var(--line); background: #fff; outline: none;
}
input:focus, select:focus, textarea:focus { border-color: var(--ink); }
textarea { min-height: 120px; resize: vertical; line-height: 1.45; }
textarea.desc { min-height: 260px; }
.row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.seg { display: flex; padding: 3px; gap: 3px; border-radius: 12px; background: var(--paper-2); }
.seg button { flex: 1; border: 0; border-radius: 9px; padding: 10px 6px; background: transparent; font-weight: 700; font-size: 15px; }
.seg button.on { background: var(--ink); color: #fff; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 0; border-radius: 12px; padding: 14px 18px; font-weight: 700; background: var(--ink); color: #fff; text-decoration: none; }
.btn.tag { background: var(--tag); font-family: var(--display); font-weight: 800; font-size: 19px; }
.btn.ghost { background: transparent; color: var(--ink); border: 1.5px solid var(--line); }
.btn.bad { background: transparent; color: var(--bad); border: 1.5px solid currentColor; }
.btn.small { padding: 8px 12px; font-size: 14px; border-radius: 10px; }
.btn:disabled { opacity: .5; }
.actions { display: grid; gap: 10px; margin: 16px 0; }
.actions .row { gap: 10px; }
.hint { font-size: 14px; color: var(--ink-2); }
.catlist { max-height: 260px; overflow: auto; border: 1.5px solid var(--line); border-radius: 10px; margin-top: 6px; background: #fff; }
.catlist button { display: block; width: 100%; text-align: left; border: 0; border-bottom: 1px solid #eee; background: none; padding: 10px 12px; font-size: 15px; }
.comps a { display: flex; justify-content: space-between; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--line); text-decoration: none; font-size: 15px; }
.comps a b { white-space: nowrap; }
.log { font-size: 13px; color: var(--ink-2); }
.log div { padding: 3px 0; border-bottom: 1px dotted var(--line); }
.log .error { color: var(--bad); } .log .warn { color: #8a5d00; }
summary { font-weight: 700; padding: 4px 0; }
.shot { width: 100%; border-radius: 10px; border: 1px solid var(--line); margin-top: 8px; }

/* ------------------------------------------------------------ login */
.login { min-height: 100vh; display: grid; place-content: center; padding: 24px; gap: 14px; max-width: 380px; margin: 0 auto; }
.login h1 { font-size: 54px; transform: rotate(-3deg); }
.login h1 span { background: var(--tag); color: #fff; padding: 0 10px; border-radius: 6px; }

#toast { position: fixed; left: 50%; bottom: calc(96px + var(--safe-b)); transform: translateX(-50%) translateY(20px); z-index: 60; background: var(--ink); color: #fff; padding: 10px 16px; border-radius: 999px; font-weight: 700; font-size: 15px; opacity: 0; pointer-events: none; transition: .25s; max-width: 90vw; text-align: center; }
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
#toast.bad { background: var(--bad); }

@media (min-width: 760px) {
  .cam .controls { padding-bottom: 30px; }
}
