@font-face { font-family: "Amatic SC"; font-weight: 700; font-display: swap; src: url(../fonts/amatic-sc-cyrillic.woff2) format("woff2"); unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: "Amatic SC"; font-weight: 700; font-display: swap; src: url(../fonts/amatic-sc-latin.woff2) format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+2000-206F, U+20AC, U+20BD, U+2122, U+2212; }
@font-face { font-family: "Caveat"; font-weight: 400 700; font-display: swap; src: url(../fonts/caveat-cyrillic.woff2) format("woff2"); unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: "Caveat"; font-weight: 400 700; font-display: swap; src: url(../fonts/caveat-latin.woff2) format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+2000-206F, U+20AC, U+20BD, U+2122, U+2212; }
@font-face { font-family: "Golos Text"; font-weight: 400 900; font-display: swap; src: url(../fonts/golos-text-cyrillic.woff2) format("woff2"); unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: "Golos Text"; font-weight: 400 900; font-display: swap; src: url(../fonts/golos-text-latin.woff2) format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+2000-206F, U+20AC, U+20BD, U+2122, U+2212; }

:root {
  --paper: #ead9bf;
  --paper-deep: #dcc6a4;
  --card: #fffaf1;
  --ink: #3b2a20;
  --ink-soft: #6a5545;
  --terra: #c8553d;
  --terra-dark: #a8432e;
  --mustard: #e0a526;
  --sage: #8a9a5b;
  --line: rgba(59, 42, 32, .28);
  --hand: "Amatic SC", "Comic Sans MS", cursive;
  --script: "Caveat", "Comic Sans MS", cursive;
  --text: "Golos Text", system-ui, sans-serif;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  font: 15px/1.45 var(--text);
  background-color: var(--paper);
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='160' height='160'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3'/><feColorMatrix values='0 0 0 0 .35  0 0 0 0 .25  0 0 0 0 .15  0 0 0 .09 0'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
}
img { max-width: 100%; display: block; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--terra-dark); }
[hidden] { display: none !important; }

.wrap { max-width: 720px; margin: 0 auto; padding: 0 18px calc(110px + var(--safe-bottom)); }

/* --- заголовки --- */
.hand { font-family: var(--hand); font-weight: 700; letter-spacing: .01em; }
.script { font-family: var(--script); font-weight: 700; }
.title { font: 700 46px/.9 var(--hand); margin: 0; }
.title-m { font: 700 34px/.95 var(--hand); margin: 0; }
.subtitle { font: 500 21px/1.1 var(--script); color: var(--terra); margin: 4px 0 0; }
.muted { color: var(--ink-soft); }
.small { font-size: 13px; }

.hero { position: relative; padding: 22px 0 6px; }
.hero .tape { position: absolute; right: 0; top: 20px; width: 92px; height: 26px; transform: rotate(8deg);
  background: repeating-linear-gradient(45deg, rgba(224,165,38,.75) 0 8px, rgba(224,165,38,.45) 8px 16px); }
.hero-logo { width: 54px; height: 54px; float: right; margin: 0 6px 0 12px; }

/* --- чипсы категорий --- */
.chips { display: flex; gap: 8px; padding: 12px 0; overflow-x: auto; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip { font: 700 20px/1 var(--hand); padding: 7px 13px 5px; border: 1.5px solid var(--ink); border-radius: 4px;
  white-space: nowrap; background: var(--card); cursor: pointer; }
.chip[aria-pressed="true"] { background: var(--ink); color: var(--paper); }

/* --- полароиды --- */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 22px 16px; padding: 10px 2px; }
.pol { background: var(--card); padding: 8px 8px 12px; box-shadow: 0 6px 12px -6px rgba(59,42,32,.4);
  position: relative; text-decoration: none; color: inherit; display: block; transition: transform .15s ease; }
.pol:nth-child(odd) { transform: rotate(-1.6deg); }
.pol:nth-child(even) { transform: rotate(1.4deg) translateY(6px); }
.pol:active { transform: scale(.98); }
.pol::before { content: ""; position: absolute; top: -9px; left: 50%; width: 54px; height: 16px; margin-left: -27px;
  background: rgba(138,154,91,.55); transform: rotate(-4deg); }
.pol .img, .photo-box { aspect-ratio: 1; background: #f3e6d0; overflow: hidden; display: grid; place-items: center; color: var(--terra); }
.pol .img img, .photo-box img { width: 100%; height: 100%; object-fit: cover; }
.pol b { display: block; font: 700 22px/1 var(--hand); margin-top: 8px; }
.pol .price { font: 700 21px/1 var(--script); color: var(--terra); }
.pol .note { display: block; margin-top: 2px; font: 600 16px/1.1 var(--script); color: var(--sage); }
.pol.off { opacity: .55; }
.placeholder-heart { width: 46%; opacity: .7; }

/* --- кнопки --- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 0; cursor: pointer;
  background: var(--terra); color: #fff8ec; font: 700 26px/1 var(--hand); padding: 13px 20px 11px;
  border-radius: 6px; box-shadow: 3px 3px 0 var(--ink); text-decoration: none; }
.btn:active { transform: translate(2px, 2px); box-shadow: 1px 1px 0 var(--ink); }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.btn.block { display: flex; width: 100%; }
.btn.ghost { background: var(--card); color: var(--ink); }
.btn.dark { background: var(--ink); color: var(--paper); box-shadow: 3px 3px 0 var(--terra); }
.btn.sm { font-size: 20px; padding: 7px 12px 5px; box-shadow: 2px 2px 0 var(--ink); }
.link-btn { background: none; border: 0; padding: 0; color: var(--terra-dark); font: 600 15px var(--text);
  text-decoration: underline; cursor: pointer; }

/* --- нижняя панель корзины --- */
.cartbar { position: fixed; left: 16px; right: 16px; bottom: calc(16px + var(--safe-bottom)); max-width: 688px; margin: 0 auto;
  display: flex; justify-content: space-between; align-items: center; background: var(--terra); color: #fff8ec;
  font: 700 26px/1 var(--hand); padding: 13px 18px 11px; border-radius: 6px; box-shadow: 3px 3px 0 var(--ink);
  text-decoration: none; z-index: 10; }

/* --- страница изделия --- */
.pd-photo { margin: 16px 2px 0; background: var(--card); padding: 10px 10px 42px; transform: rotate(-1.2deg);
  box-shadow: 0 10px 18px -10px rgba(59,42,32,.5); position: relative; }
.pd-photo .photo-box { aspect-ratio: 1 / .92; }
.pd-photo .cap { position: absolute; bottom: 9px; left: 14px; font: 700 22px var(--script); }
.dots { position: absolute; bottom: 16px; right: 14px; display: flex; gap: 6px; }
.dots button { width: 9px; height: 9px; border-radius: 50%; border: 0; padding: 0; background: rgba(59,42,32,.25); cursor: pointer; }
.dots button[aria-current="true"] { background: var(--terra); }
.pd-body { padding: 20px 4px 4px; }
.pd-body .price { font: 700 34px var(--script); color: var(--terra); }
.tag { display: inline-block; font: 600 19px var(--script); border-bottom: 2px solid var(--sage); margin-left: 8px; }
.desc { white-space: pre-line; margin-top: 10px; }
.qty { display: inline-flex; align-items: center; gap: 4px; background: var(--card); border: 1.5px solid var(--ink); border-radius: 4px; }
.qty button { width: 36px; height: 36px; border: 0; background: none; font: 700 22px var(--hand); cursor: pointer; }
.qty span { min-width: 26px; text-align: center; font: 700 22px var(--script); }

/* --- листочки (карточки) --- */
.sheet { background: var(--card); padding: 16px 16px 18px; margin: 14px 0; box-shadow: 0 6px 12px -8px rgba(59,42,32,.5); position: relative; }
.sheet.lined { background-image: repeating-linear-gradient(var(--card) 0 27px, rgba(138,154,91,.22) 27px 28px); }
.sheet h3 { margin: 0 0 8px; font: 700 26px/1 var(--hand); }
.row { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.line-item { display: grid; grid-template-columns: 54px 1fr auto; gap: 12px; align-items: center; padding: 8px 0; border-bottom: 1.5px dashed var(--line); }
.line-item:last-child { border-bottom: 0; }
a.line-item { color: inherit; text-decoration: none; }
.line-item .photo-box { width: 54px; }
.line-item b { font: 700 21px/1 var(--hand); display: block; }
.total { font: 700 26px var(--script); color: var(--terra); }
.row > .hand { font-size: 23px; }
.row > .right { text-align: right; }
.back + .title, .back + .title-m { margin-top: 8px; }

/* --- формы --- */
.field { display: block; margin: 12px 0; }
.field > span:first-child { display: block; font: 700 20px/1 var(--hand); margin-bottom: 5px; }
.field > small { display: block; margin-top: 4px; }
.input, textarea.input, select.input { width: 100%; padding: 11px 12px; background: #fffdf8; border: 1.5px solid var(--ink);
  border-radius: 4px; outline: none; font-size: 16px; }
.input:focus { box-shadow: 3px 3px 0 var(--mustard); }
textarea.input { min-height: 96px; resize: vertical; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.check { display: flex; gap: 10px; align-items: flex-start; margin: 14px 0; font-size: 14px; }
.check input { width: 22px; height: 22px; margin: 0; accent-color: var(--terra); flex: none; }
.suggest { list-style: none; margin: 4px 0 0; padding: 0; background: #fffdf8; border: 1.5px solid var(--ink); border-radius: 4px; max-height: 240px; overflow-y: auto; }
.suggest li { padding: 10px 12px; cursor: pointer; border-bottom: 1px dashed var(--line); font-size: 14px; }
.suggest li:last-child { border-bottom: 0; }
.suggest li[aria-disabled="true"] { color: var(--ink-soft); cursor: default; }
.suggest li:not([aria-disabled="true"]):hover { background: #f6ead6; }

/* --- статусы --- */
.st { display: inline-block; font: 700 17px/1 var(--script); color: var(--st, var(--ink)); border: 1.5px solid var(--st, var(--ink));
  padding: 3px 8px 2px; border-radius: 3px; transform: rotate(-2deg); }
.st-new { --st: #c8553d; } .st-awaiting_payment { --st: #c28a12; } .st-paid { --st: #6c7f3a; } .st-in_work { --st: #6c7f3a; }
.st-ready { --st: #2f6b8a; } .st-courier { --st: #3b2a20; } .st-delivered { --st: #6a5545; } .st-cancelled { --st: #8c7b6e; }
.order-card { border-left: 5px solid var(--st, var(--ink)); }

/* --- уведомления --- */
.toast { position: fixed; left: 50%; top: 16px; transform: translateX(-50%); background: var(--ink); color: var(--paper);
  padding: 10px 16px; border-radius: 6px; font-size: 14px; z-index: 50; max-width: 90vw; box-shadow: 3px 3px 0 var(--terra); }
.toast.err { background: var(--terra-dark); box-shadow: 3px 3px 0 var(--ink); }
.empty { text-align: center; padding: 40px 10px; }
.empty .script { font-size: 26px; color: var(--terra); }
.banner { background: var(--card); border: 1.5px dashed var(--ink); padding: 12px 14px; margin: 10px 0; font-size: 14px; }
.back { display: inline-flex; align-items: center; gap: 6px; margin-top: 14px; font: 700 22px var(--hand); color: var(--ink); text-decoration: none; }
.footer { text-align: center; padding: 26px 0 8px; font-size: 12px; }
.footer a { color: var(--ink-soft); }

/* --- общие элементы форм и списков --- */
.toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin: 14px 0 4px; }
.toolbar .spacer { flex: 1; }
.badge { display: inline-block; font-size: 12px; padding: 1px 7px; border-radius: 10px; background: var(--paper-deep); margin-right: 4px; }
.badge.warn { background: #f3d2c8; color: var(--terra-dark); }
.badge.ok { background: #dfe5c6; color: #4d5c22; }
.kv { font-size: 14px; }
.kv > span:first-child { display: block; font: 700 18px/1 var(--hand); color: var(--ink-soft); }
.copy { display: flex; gap: 8px; align-items: center; }
.copy code { flex: 1; background: #fffdf8; border: 1px dashed var(--line); padding: 8px; font-size: 13px; word-break: break-all; }
.seg { display: inline-flex; border: 1.5px solid var(--ink); border-radius: 4px; overflow: hidden; }
.seg label { padding: 9px 14px 7px; cursor: pointer; font: 700 20px/1 var(--hand); }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg label:has(input:checked) { background: var(--ink); color: var(--paper); }
.seg label:has(input:focus-visible) { outline: 2px solid var(--mustard); }
.photos { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 12px; margin: 8px 0; }
.photo-tile { background: var(--card); padding: 6px; box-shadow: 0 4px 10px -8px rgba(59,42,32,.6); }
.photo-tile .tools { display: flex; justify-content: space-between; margin-top: 6px; }
.photo-tile .tools button { border: 1px solid var(--line); background: #fffdf8; border-radius: 4px; width: 32px; height: 28px; cursor: pointer; }
.upload { display: grid; place-items: center; border: 2px dashed var(--ink); min-height: 110px; cursor: pointer; text-align: center; font: 700 20px var(--hand); padding: 8px; }
.upload input { display: none; }

/* --- деньги продавца --- */
.stats { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px 16px; }
.stats .kv b { display: block; font: 700 24px/1.1 var(--script); }
.stats .kv.main b { font-size: 34px; color: var(--terra); }
.stats .full { grid-column: 1 / -1; }
.ledger { width: 100%; border-collapse: collapse; font-size: 13px; }
.ledger td { padding: 6px 4px; border-bottom: 1px dashed var(--line); vertical-align: top; }
.ledger td:last-child { text-align: right; white-space: nowrap; }
.ledger .void td { color: var(--ink-soft); text-decoration: line-through; }
.terms { margin: 8px 0 0; padding-left: 18px; font-size: 14px; }
.terms li { margin: 4px 0; }

@media (prefers-reduced-motion: reduce) { .pol, .btn { transition: none; } }
