@font-face {
  font-family: 'Marck Script';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('/fonts/marck-cyrillic.woff2') format('woff2');
  unicode-range: U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
@font-face {
  font-family: 'Marck Script';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('/fonts/marck-latin.woff2') format('woff2');
}

:root {
  --bg: #f3ece4;
  --bg2: #ece2d6;
  --card: #fbf7f1;
  --ink: #4a4038;
  --muted: #9a8f82;
  --accent: #b7a184;
  --accent-ink: #6f5f49;
  --line: #e2d6c6;
  --ok: #7fa07a;
  --warn: #c58a6a;
  --shadow: 0 8px 30px rgba(120, 100, 78, 0.12);
  --radius: 18px;
  --font: 'Segoe UI', -apple-system, 'Helvetica Neue', Roboto, sans-serif;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }

body {
  margin: 0;
  font-family: var(--font);
  color: var(--ink);
  background:
    radial-gradient(ellipse at top, #f8f2ea, var(--bg)) fixed,
    var(--bg);
  min-height: 100dvh;
  line-height: 1.5;
}

#app { max-width: 480px; margin: 0 auto; padding: 24px 20px 48px; }

.screen {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 28px 22px 32px;
  position: relative;
  animation: fade .35s ease;
}
@keyframes fade { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; } }

.ornament { display: flex; justify-content: center; margin-bottom: 6px; pointer-events: none; }
.ornament .swan {
  display: block; width: 170px; height: 84px;
  background: var(--accent);
  -webkit-mask: url('/icons/swans.png') center / contain no-repeat;
  mask: url('/icons/swans.png') center / contain no-repeat;
}
.ornament.small .swan { width: 120px; height: 59px; }

h1.names {
  text-align: center;
  font-family: 'Marck Script', cursive;
  font-weight: 400;
  font-size: 2.5rem;
  line-height: 1.15;
  letter-spacing: .5px;
  margin: 2px 0 2px;
  color: var(--accent-ink);
}
.subtitle { text-align: center; color: var(--muted); margin: 0 0 22px; }
.muted { color: var(--muted); font-size: .9rem; }

.steps { list-style: none; padding: 0; margin: 0 0 22px; display: grid; gap: 14px; }
.steps li { display: flex; gap: 14px; align-items: flex-start; }
.steps .num {
  flex: none; width: 30px; height: 30px; border-radius: 50%;
  background: var(--bg2); color: var(--accent-ink);
  display: grid; place-items: center; font-weight: 600;
}
.steps b { display: block; margin-bottom: 2px; }
.steps p { margin: 0; color: var(--muted); font-size: .92rem; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  width: 100%; padding: 15px 18px; border-radius: 14px;
  font-size: 1.02rem; font-weight: 600; cursor: pointer;
  border: 1px solid transparent; text-decoration: none; user-select: none;
  transition: transform .08s ease, background .2s ease;
}
.btn:active { transform: scale(.98); }
.btn.primary { background: var(--accent); color: #fff; }
.btn.primary:hover { background: #a98f6f; }
.btn.ghost { background: transparent; color: var(--accent-ink); border-color: var(--line); }
.btn.big { padding: 18px; font-size: 1.08rem; }

.capture-row { display: grid; gap: 10px; margin-bottom: 8px; }

.onb-title { font-weight: 600; color: var(--accent-ink); font-size: 1.15rem; margin: 4px 0 18px; }
.notice { color: var(--warn); font-size: .9rem; text-align: center; margin: 4px 0 8px; }
.sent-note { color: var(--ok); font-size: .95rem; text-align: center; margin-top: 14px; }

.queue-head {
  display: flex; justify-content: space-between; align-items: center;
  margin: 18px 0 8px; font-weight: 600; color: var(--accent-ink);
}
.counter {
  background: var(--bg2); border-radius: 999px; padding: 2px 12px;
  font-size: .9rem; color: var(--accent-ink);
}
.queue {
  list-style: none; margin: 0; display: grid; gap: 8px;
  max-height: 42vh; overflow-y: auto; overflow-x: hidden;
  padding: 2px; scrollbar-width: thin;
}
.queue li {
  display: flex; align-items: center; gap: 12px; min-width: 0;
  background: var(--bg); border: 1px solid var(--line);
  border-radius: 12px; padding: 8px 10px;
}
.queue .thumb {
  width: 46px; height: 46px; border-radius: 8px; object-fit: cover;
  flex: none; background: var(--bg2);
}
.queue .info { flex: 1 1 auto; min-width: 0; overflow: hidden; }
.queue .info .name { font-size: .82rem; color: var(--muted);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.queue .status { font-size: .85rem; font-weight: 600; }
.queue .status.up { color: var(--muted); }
.queue .status.ok { color: var(--ok); }
.queue .status.err { color: var(--warn); }
.queue .retry {
  border: none; background: none; color: var(--warn);
  font-weight: 600; cursor: pointer; font-size: .85rem; text-decoration: underline;
}
.queue .del {
  flex: none; width: 30px; height: 30px; border-radius: 50%;
  border: 1px solid var(--line); background: var(--card);
  color: var(--muted); font-size: 1.2rem; line-height: 1; cursor: pointer;
}
.queue .del:active { transform: scale(.92); }

#send-btn { margin-top: 14px; }

.spin { width: 16px; height: 16px; border: 2px solid var(--line);
  border-top-color: var(--accent); border-radius: 50%;
  display: inline-block; animation: rot .8s linear infinite; vertical-align: -3px; }
@keyframes rot { to { transform: rotate(360deg); } }

.corner-btn {
  position: absolute; top: 14px; z-index: 5;
  width: 40px; height: 40px; border-radius: 50%;
  display: grid; place-items: center;
  border: 1px solid var(--line); background: var(--bg);
  color: var(--accent-ink); font-weight: 700; font-size: 1.15rem; cursor: pointer;
  -webkit-tap-highlight-color: rgba(0,0,0,.05);
}
.corner-btn:active { transform: scale(.94); }
.corner-left { left: 14px; }
.corner-right { right: 14px; }
.corner-btn svg { width: 22px; height: 22px; fill: none; stroke: var(--accent-ink); stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

.photos-title {
  text-align: center; color: var(--accent-ink); font-weight: 500;
  font-size: 1.3rem; margin: 6px 0 2px;
}
.photos-state { text-align: center; padding: 20px 0; }
.photos-strip {
  display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px;
  max-height: 62vh; overflow-y: auto; padding: 6px 2px 2px;
  scrollbar-width: thin; -webkit-overflow-scrolling: touch;
}
.photos-strip .pthumb {
  width: 100%; aspect-ratio: 1 / 1; border-radius: 12px; overflow: hidden;
  background: var(--bg2); cursor: pointer; border: 1px solid var(--line);
}
.photos-strip .pthumb img { width: 100%; height: 100%; object-fit: cover; display: block; }

.photo-viewer { position: fixed; inset: 0; z-index: 38; background: #000; overflow: hidden; }
#viewer-img {
  position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain;
  will-change: transform;
}
#viewer-img.slide-l { animation: slideL .22s ease; }
#viewer-img.slide-r { animation: slideR .22s ease; }
.viewer-spin { position: absolute; inset: 0; display: grid; place-items: center; z-index: 1; }
.viewer-spin .spin { width: 34px; height: 34px; border-width: 3px; }

.overlay {
  position: fixed; inset: 0; background: rgba(60, 50, 40, .45);
  display: grid; place-items: end center; z-index: 20; padding: 0;
}
.sheet {
  background: var(--card); width: 100%; max-width: 480px;
  border-radius: 20px 20px 0 0; padding: 24px 22px 30px;
  animation: up .3s ease;
}
@keyframes up { from { transform: translateY(30px); opacity: .6; } }
.sheet h2 { margin: 0 0 10px; color: var(--accent-ink); font-weight: 500; }
.sheet p { margin: 0 0 12px; font-size: .95rem; }

a.btn:visited { color: #fff; }
a.btn.ghost:visited { color: var(--accent-ink); }

/* ---- Встроенная камера ---- */
.cam { position: fixed; inset: 0; z-index: 30; background: #000; }
.cam-preview { position: fixed; inset: 0; z-index: 35; background: #000; }
#cam-modal { z-index: 40; }
#cam-video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; background: #000; }
.cam-preview img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; background: #000; }

.cam-bar {
  position: absolute; top: 0; left: 0; right: 0; z-index: 2;
  display: flex; justify-content: space-between;
  padding: calc(env(safe-area-inset-top, 0px) + 12px) 14px 12px;
}
.cam-icon {
  width: 46px; height: 46px; border-radius: 50%; border: none;
  background: rgba(0, 0, 0, .4); color: #fff; display: grid; place-items: center;
  cursor: pointer; position: relative; -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px);
}
.cam-icon svg { width: 24px; height: 24px; fill: none; stroke: #fff; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.cam-icon:active { transform: scale(.92); }
.cam-badge {
  position: absolute; top: -3px; right: -3px; min-width: 20px; height: 20px; padding: 0 5px;
  background: var(--accent); color: #fff; border-radius: 999px;
  font-size: .72rem; font-weight: 700; display: grid; place-items: center;
}

.cam-foot {
  position: absolute; left: 0; right: 0; bottom: 0; z-index: 2;
  padding: 14px 14px calc(env(safe-area-inset-bottom, 0px) + 18px);
  display: flex; flex-direction: column; align-items: center; gap: 12px;
}
.cam-shutter {
  flex: none; width: 74px; height: 74px; border-radius: 50%;
  border: 5px solid #fff; background: rgba(255, 255, 255, .3); cursor: pointer;
}
.cam-shutter:active { transform: scale(.94); background: rgba(255, 255, 255, .6); }
.cam-strip { display: flex; gap: 8px; width: 100%; overflow-x: auto; padding: 2px; scrollbar-width: none; }
.cam-strip::-webkit-scrollbar { display: none; }
.cam-strip .t {
  position: relative; flex: none; width: 56px; height: 56px; border-radius: 10px;
  border: 2px solid #fff; cursor: pointer; box-shadow: 0 2px 8px rgba(0, 0, 0, .4);
  animation: thumbIn .35s cubic-bezier(.2, .7, .3, 1);
}
.cam-strip .t img { width: 100%; height: 100%; object-fit: cover; display: block; border-radius: 8px; }
.cam-strip .tdel {
  position: absolute; top: 1px; right: 1px; width: 20px; height: 20px; border-radius: 50%;
  border: none; background: rgba(0, 0, 0, .6); color: #fff;
  font-size: 14px; line-height: 1; padding: 0; cursor: pointer;
  display: grid; place-items: center;
}
.cam-strip .tdel:active { transform: scale(.9); }
@keyframes thumbIn { from { transform: translateY(70px) scale(.8); opacity: 0; } to { transform: none; opacity: 1; } }

#cam-modal .btn { margin-top: 10px; }

.cam-count { color: #fff; font-weight: 600; align-self: center; text-shadow: 0 1px 4px rgba(0, 0, 0, .6); }
#cam-prev-img.slide-l { animation: slideL .22s ease; }
#cam-prev-img.slide-r { animation: slideR .22s ease; }
@keyframes slideL { from { transform: translateX(40px); opacity: .3; } to { transform: none; opacity: 1; } }
@keyframes slideR { from { transform: translateX(-40px); opacity: .3; } to { transform: none; opacity: 1; } }
.cam-focus {
  position: absolute; z-index: 3; width: 72px; height: 72px; margin: -36px 0 0 -36px;
  border: 2px solid #fff; border-radius: 50%; opacity: 0; pointer-events: none;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, .3);
}
.cam-focus.on { animation: focusPulse .6s ease; }
@keyframes focusPulse {
  0% { opacity: 0; transform: scale(1.4); }
  30% { opacity: 1; }
  100% { opacity: 0; transform: scale(1); }
}
