/* v22 «Подарунки гостям» — общее. Телефон: v22-m.css, компьютер: v22-d.css. */
:root {
  --bg: #f7f2ec;
  --bg2: #efe7dd;
  --card: #fffdf9;
  --paper: #fffaf2;
  --ink: #221c18;
  --ink2: #5f554c;
  --line: #e0d5c7;
  --ok: #2d7a4f;
  --bad: #b3361f;
  --wait: #9a6510;
  --accent: #9b3f5c;
  --on-accent: #fff8f4;
  --gold: #a8843f;
  --r: 14px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --serif: Georgia, "Times New Roman", serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #17131a;
    --bg2: #201b23;
    --card: #241f28;
    --paper: #2c2630;
    --ink: #f4ede6;
    --ink2: #bcb0a6;
    --line: #3d3540;
    --ok: #6cc595;
    --bad: #ff8a70;
    --wait: #e7b45a;
    --accent: #f08aa8;
    --on-accent: #23121a;
    --gold: #d8b46a;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 16px/1.45 var(--font); overflow-x: hidden; }
button, input, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
button:disabled { cursor: default; opacity: 0.55; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; border-radius: 6px; }
[hidden] { display: none !important; }
.skip { position: absolute; left: 8px; top: -60px; z-index: 50; background: var(--ink); color: var(--bg); padding: 8px 12px; border-radius: 8px; }
.skip:focus { top: 8px; }

/* ---------- шапка */
.top { display: flex; align-items: center; gap: 10px; padding: 10px 16px; padding-top: max(10px, env(safe-area-inset-top)); }
.logo { display: flex; align-items: baseline; gap: 6px; color: var(--ink); text-decoration: none; min-width: 0; }
.logo b { font-size: 19px; letter-spacing: -0.02em; }
.logo span { color: var(--ink2); font-size: 14px; white-space: nowrap; }
.demo-badge { font-size: 11px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; padding: 2px 8px; border-radius: 99px; border: 1px solid var(--line); color: var(--ink2); }
.lang { margin-left: auto; min-width: 44px; min-height: 36px; display: inline-grid; place-items: center; border: 1px solid var(--line); border-radius: 99px; color: var(--ink); text-decoration: none; font-weight: 600; font-size: 14px; }

/* ---------- заголовок: строки выезжают из масок */
.eyebrow { margin: 0 0 6px; font-size: 13px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--accent); }
.kin { margin: 0; font-family: var(--serif); font-weight: 400; letter-spacing: -0.02em; line-height: 1.06; }
.kin .ln { display: block; clip-path: inset(0 -0.3em); padding: 0.12em 0 0.2em; margin: -0.12em 0 -0.2em; }
.kin .ln > span { display: inline-block; animation: rise 0.9s cubic-bezier(.2,.75,.15,1) both; }
.kin .ln:nth-child(2) > span { animation-delay: 0.12s; }
.kin .ln:nth-child(3) > span { animation-delay: 0.24s; }
.kin .ln-accent { font-style: italic; color: var(--accent); }
@keyframes rise { from { transform: translateY(110%); } to { transform: none; } }
.lead { color: var(--ink2); margin: 12px 0 0; max-width: 34em; }

/* ---------- блоки */
.block { min-width: 0; background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 16px; }
.block-h { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-bottom: 6px; }
.block-h h2 { margin: 0; font-family: var(--serif); font-weight: 400; font-size: 22px; }
.count { color: var(--ink2); font-size: 14px; font-variant-numeric: tabular-nums; }
.label { display: block; font-size: 14px; font-weight: 600; margin: 10px 0 6px; }
.help { color: var(--ink2); font-size: 14px; margin: 6px 0 0; }
.privacy { font-size: 13px; }
.demo-note { color: var(--accent); font-weight: 600; }
.to-list { color: var(--accent); font-weight: 600; white-space: nowrap; }
.empty { color: var(--ink2); margin: 8px 0 0; }
textarea, input[type="text"], input[type="date"] {
  width: 100%; border: 1px solid var(--line); border-radius: 10px; background: var(--paper); padding: 10px 12px; min-height: 44px;
}
textarea { resize: vertical; line-height: 1.5; }
.row-btns { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; }
.field { display: block; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 44px; padding: 8px 16px; border-radius: 99px; border: 1px solid transparent; font-weight: 600; text-align: center; }
.btn-primary { background: var(--accent); color: var(--on-accent); }
.btn-ghost { background: transparent; border-color: var(--line); color: var(--ink); }
.btn.wide { width: 100%; margin-top: 10px; }
.tool { min-height: 36px; padding: 4px 12px; border-radius: 99px; border: 1px solid var(--line); background: var(--card); font-size: 14px; }

/* ---------- подарок: карточки изделий */
.gifts { display: flex; gap: 10px; overflow-x: auto; scroll-snap-type: x mandatory; padding: 2px 2px 8px; margin: 0 -2px; overscroll-behavior-x: contain; }
.gift { flex: 0 0 132px; scroll-snap-align: start; display: grid; gap: 4px; padding: 8px; border-radius: 12px; border: 1px solid var(--line); background: var(--paper); text-align: left; }
.gift img, .gift .thumb-ph { width: 100%; height: auto; aspect-ratio: 1; border-radius: 8px; object-fit: cover; display: block; background: var(--bg2); }
.gift[aria-checked="true"] { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent) inset; }
.g-t { font-size: 14px; font-weight: 600; line-height: 1.25; }
.g-tag { font-size: 12px; color: var(--ink2); }
.g-tag.is-name { color: var(--ok); font-weight: 600; }

.swatches { display: flex; flex-wrap: wrap; gap: 8px; }
.sw { width: 44px; height: 44px; border-radius: 50%; border: 1px solid var(--line); padding: 4px; background: var(--card); }
.sw i { display: block; width: 100%; height: 100%; border-radius: 50%; background: var(--c); box-shadow: inset 0 0 0 1px rgb(0 0 0 / 0.12); }
.sw[aria-checked="true"] { border: 2px solid var(--ink); }

/* ---------- стол гостей */
.seats { list-style: none; margin: 10px 0 0; padding: 0; display: grid; grid-template-columns: repeat(var(--cols, 3), minmax(0, 1fr)); gap: 10px 8px; }
.seat { container-type: inline-size; width: 100%; min-width: 0; display: grid; grid-template-columns: minmax(0, 1fr); justify-items: center; gap: 0; padding: 8px 4px 6px; border-radius: 14px; border: 1px solid transparent; background: transparent; }
.seat[aria-pressed="true"] { background: var(--bg2); border-color: var(--line); }
.plate {
  width: 88%; aspect-ratio: 1; border-radius: 50%; display: grid; place-items: center; overflow: hidden;
  background: radial-gradient(circle at 50% 45%, var(--paper) 52%, color-mix(in srgb, var(--theme, #e79fb0) 55%, var(--paper)) 53%, var(--paper) 72%);
  box-shadow: 0 6px 14px -8px rgb(0 0 0 / 0.35);
}
.plate img.snap { width: 100%; height: auto; aspect-ratio: 1; display: block; animation: pop 0.45s cubic-bezier(.2,.75,.15,1) both; }
@keyframes pop { from { transform: scale(0.7); opacity: 0; } }
.plate .thumb-ph { animation: blink 1.4s ease-in-out infinite; }
.seat.is-bad .plate .thumb-ph, .seat.is-off .plate .thumb-ph { animation: none; }
.plate .thumb-ph { width: 74%; height: auto; aspect-ratio: 1; border-radius: 50%; object-fit: cover; display: block; background: var(--bg2); }
.seat.is-bad .plate { box-shadow: 0 0 0 2px var(--bad), 0 6px 14px -8px rgb(0 0 0 / 0.35); }
/* бирка-«домик» с именем: контур → заливка буква за буквой */
.tent {
  position: relative; margin-top: -2px; max-width: 100%; padding: 5px 8px 4px; border-radius: 4px;
  background: var(--paper); border: 1px solid var(--line); box-shadow: 0 3px 8px -5px rgb(0 0 0 / 0.4);
  font-family: var(--serif); font-style: italic; font-size: 16px; line-height: 1.15;
  white-space: nowrap;
}
/* имя целиком всегда: шрифт ужимается по длине имени (--n) и ширине места */
.nm { font-size: min(17px, calc(140cqw / var(--n, 6))); }
.nm { display: inline; }
.ch { display: inline-block; color: transparent; -webkit-text-stroke: 0.6px var(--ink2); }
.seat.is-building .ch { animation: pen 1.6s ease-in-out infinite; animation-delay: calc(var(--i) * 70ms); }
.seat.grown .ch { animation: fill 0.5s cubic-bezier(.2,.7,.2,1) both; animation-delay: calc(var(--d, 0ms) + var(--i) * 55ms); }
.seat.grown.instant .ch { animation: none; color: var(--ink); -webkit-text-stroke: 0 transparent; }
.seat.is-bad .ch { color: var(--bad); -webkit-text-stroke: 0 transparent; }
@keyframes pen { 0%, 100% { -webkit-text-stroke-color: var(--line); } 50% { -webkit-text-stroke-color: var(--gold); } }
@keyframes fill {
  0% { color: transparent; -webkit-text-stroke-color: var(--gold); transform: translateY(0.35em) scale(0.6); opacity: 0; }
  60% { opacity: 1; }
  100% { color: var(--ink); -webkit-text-stroke-color: transparent; transform: none; opacity: 1; }
}
.st { display: inline-flex; align-items: center; gap: 4px; margin-top: 4px; font-size: 12px; color: var(--ink2); max-width: 100%; }
.st-t { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dot, .pill-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--wait); flex: none; }
.seat.is-ok .dot, .seat.is-card .dot { background: var(--ok); }
.seat.is-bad .dot { background: var(--bad); }
.seat.is-bad .st { color: var(--bad); font-weight: 600; }
.seat.is-off .dot { background: var(--ink2); }
.seat.is-building .dot { animation: blink 1s ease-in-out infinite; }
@keyframes blink { 50% { opacity: 0.3; } }
.thumb-ph { display: block; background: var(--bg2); }

/* ---------- сцена */
.stage { position: relative; border-radius: var(--r); overflow: hidden; touch-action: none; background: radial-gradient(120% 90% at 50% 30%, #fffaf3, #e8ddcf); }
.stage.on-dark { background: radial-gradient(120% 90% at 50% 30%, #3a3038, #1c171d); }
.stage.on-light { background: radial-gradient(120% 90% at 50% 30%, #fffaf3, #e4d8c8); }
.stage-canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; outline: none; }
.stage-ph { position: absolute; inset: 0; display: grid; place-items: center; }
.stage-ph span { width: 30%; aspect-ratio: 3 / 2; border-radius: 12px; background: rgb(255 255 255 / 0.25); animation: blink 1.4s ease-in-out infinite; }
.stage.ready .stage-ph { display: none; }
.stage.is-bad::after { content: ""; position: absolute; inset: 0; pointer-events: none; box-shadow: inset 0 0 0 3px var(--bad); border-radius: var(--r); }
.pill {
  position: absolute; left: 50%; top: 10px; transform: translateX(-50%); z-index: 2; max-width: calc(100% - 24px);
  display: inline-flex; align-items: center; gap: 8px; padding: 6px 12px; border-radius: 99px;
  background: rgb(255 253 249 / 0.9); color: #221c18; font-size: 14px; font-weight: 600; touch-action: pan-y;
  box-shadow: 0 4px 14px -6px rgb(0 0 0 / 0.35); white-space: nowrap;
}
#pill-text { overflow: hidden; text-overflow: ellipsis; }
.pill[data-state="ok"] .pill-dot, .pill[data-state="card"] .pill-dot { background: #2d7a4f; }
.pill[data-state="bad"] .pill-dot { background: #b3361f; }
.pill[data-state="off"] .pill-dot, .pill[data-state="empty"] .pill-dot { background: #8a8079; }
.pill[data-state="building"] .pill-dot { animation: blink 1s ease-in-out infinite; }
.edge { position: absolute; top: 50%; z-index: 2; width: 44px; height: 44px; margin-top: -22px; border-radius: 50%; border: 0; background: rgb(255 253 249 / 0.82); color: #221c18; display: grid; place-items: center; }
.edge svg, .tool-icon svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.edge-l { left: 8px; }
.edge-r { right: 8px; }
.stage .tool-icon { position: absolute; right: 10px; bottom: 10px; z-index: 2; width: 40px; height: 40px; padding: 0; display: grid; place-items: center; background: rgb(255 253 249 / 0.85); color: #221c18; border: 0; }
.nameplate { position: absolute; left: 10px; bottom: 10px; z-index: 2; max-width: calc(100% - 70px); padding: 5px 10px; border-radius: 4px; background: #fffaf2; color: #221c18; font: italic 15px/1.2 var(--serif); box-shadow: 0 3px 8px -4px rgb(0 0 0 / 0.4); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; touch-action: pan-y; }
.hint { position: absolute; left: 0; right: 0; bottom: 14px; margin: 0; text-align: center; font-size: 13px; color: rgb(34 28 24 / 0.7); pointer-events: none; transition: opacity 0.4s; }
.stage.on-dark .hint { color: rgb(255 250 243 / 0.75); }
.stage.touched .hint, .stage.no-3d .hint, .stage:has(.nameplate:not([hidden])) .hint { opacity: 0; }
.no3d { position: absolute; inset: auto 16px 50% 16px; margin: 0; text-align: center; color: var(--ink2); }
.attr { margin: 6px 2px 0; font-size: 11px; color: var(--ink2); line-height: 1.3; overflow-wrap: anywhere; }

/* ---------- протокол */
.p-sum { display: grid; grid-template-columns: minmax(0, 8.5em) minmax(0, 1fr); gap: 6px 12px; margin: 10px 0 0; font-size: 14px; }
.p-sum dt { color: var(--ink2); }
.p-sum dd { margin: 0; font-variant-numeric: tabular-nums; }
.tips { margin: 0; padding-left: 1.2em; font-size: 14px; color: var(--ink2); }
.fix-h { margin: 16px 0 6px; font-family: var(--serif); font-weight: 400; font-size: 19px; }
.fix { border: 1px solid var(--line); border-left: 4px solid var(--bad); border-radius: 12px; padding: 12px; margin-top: 10px; background: var(--paper); }
.fix h4 { margin: 0 0 8px; font-size: 16px; }
.why-viz { width: 100%; height: auto; display: block; }
.why-field { fill: none; stroke: var(--line); stroke-width: 1.5; stroke-dasharray: 5 4; }
.why-dim { stroke: var(--ink2); stroke-width: 1; }
.why-dim-t, .why-cap { fill: var(--ink2); font: 12px var(--font); }
.why-ref { fill: var(--ok); font-family: var(--serif); font-style: italic; }
.why-bad { fill: var(--ink); font-family: var(--serif); font-style: italic; stroke: var(--ink); stroke-width: 1.2; transition: fill 0.6s, stroke-width 0.6s, stroke 0.6s; }
.why-viz.thin .why-bad { fill: transparent; stroke: var(--bad); stroke-width: 0.35; }
.why-x { fill: var(--bad); stroke: var(--bad); text-decoration: underline; }
.why-list { margin: 8px 0 0; padding-left: 1.2em; font-size: 14px; }
.fix-short { display: flex; gap: 8px; align-items: flex-end; }
.fix-l { flex: 1; min-width: 0; display: grid; gap: 4px; font-size: 13px; color: var(--ink2); }
.fix-acts { display: grid; gap: 8px; margin-top: 8px; }
.fix-acts .btn { justify-content: flex-start; text-align: left; }
.offbox { margin-top: 12px; padding: 12px; border-radius: 12px; background: var(--bg2); font-size: 14px; }
.offbox p { margin: 0 0 8px; }
.changed { list-style: none; padding: 0; margin: 12px 0 0; display: grid; gap: 6px; font-size: 14px; }
.changed li { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; }

/* ---------- листы */
.sheet { border: 0; padding: 0 16px 16px; background: var(--card); color: var(--ink); max-height: 88vh; overflow: auto; overscroll-behavior: contain; }
.sheet::backdrop { background: rgb(0 0 0 / 0.4); }
.grip { display: grid; place-items: center; height: 26px; touch-action: none; cursor: grab; }
.grip span { width: 44px; height: 5px; border-radius: 3px; background: var(--line); }
.sheet-h { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.sheet-h h2 { margin: 0; font-family: var(--serif); font-weight: 400; font-size: 22px; }
.kp-sum { display: grid; grid-template-columns: minmax(0, 7.5em) minmax(0, 1fr); gap: 6px 12px; margin: 12px 0; font-size: 15px; }
.kp-sum dt { color: var(--ink2); }
.kp-sum dd { margin: 0; }
.kp-open { color: var(--wait); font-weight: 600; }
.kp-status { min-height: 1.4em; margin: 8px 0 0; font-size: 14px; color: var(--ink2); }

.foot { color: var(--ink2); font-size: 13px; padding: 8px 2px 16px; }
.foot a { color: var(--accent); }
.fatal { padding: 16px; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .kin .ln > span { transform: none; }
  .seat.grown .ch { color: var(--ink); -webkit-text-stroke: 0 transparent; }
  .seat.is-bad .ch { color: var(--bad); }
}

/* ---------- v22.2: выбор общей надписи */
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.insc-now { font-family: var(--serif); font-style: italic; font-size: 18px; color: var(--accent); }
.insc-now[data-state="bad"] { color: var(--bad); }
.tabs { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 4px; padding: 4px; margin: 8px 0 4px; border-radius: 99px; background: var(--bg2); }
.tab { min-height: 40px; border: 0; border-radius: 99px; background: transparent; font-size: 14px; font-weight: 600; color: var(--ink2); padding: 4px 6px; }
.tab[aria-selected="true"] { background: var(--card); color: var(--ink); box-shadow: 0 2px 6px -3px rgb(0 0 0 / 0.35); }
.pane { padding-top: 4px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { min-height: 44px; min-width: 44px; padding: 6px 14px; border-radius: 99px; border: 1px solid var(--line); background: var(--paper); font-family: var(--serif); font-size: 18px; }
.chip[aria-checked="true"] { border-color: var(--accent); background: var(--accent); color: var(--on-accent); }
.init-row { display: flex; align-items: center; gap: 10px; }
.sel select { min-height: 52px; min-width: 76px; padding: 6px 10px; border: 1px solid var(--line); border-radius: 12px; background: var(--paper); color: var(--ink); font: 24px var(--serif); }
.amp { font: italic 28px var(--serif); color: var(--accent); }
.g-tag.is-no { color: var(--bad); font-weight: 600; }
.stepper { display: inline-flex; align-items: stretch; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; background: var(--paper); }
.stepper button { width: 48px; min-height: 48px; border: 0; background: transparent; font-size: 22px; }
.stepper input { width: 84px; border: 0; border-left: 1px solid var(--line); border-right: 1px solid var(--line); border-radius: 0; text-align: center; font-size: 18px; font-variant-numeric: tabular-nums; -moz-appearance: textfield; }
.stepper input::-webkit-inner-spin-button { -webkit-appearance: none; }
.sub-h { margin: 16px 0 0; font-family: var(--serif); font-weight: 400; font-size: 19px; }
.tent .no { display: inline-block; margin-right: 5px; font: 600 10px/1 var(--font); font-style: normal; color: var(--ink2); vertical-align: middle; }
.seat.more { display: grid; place-items: center; aspect-ratio: 1; width: 88%; margin: 8px auto 0; border-radius: 50%; border: 1px dashed var(--line); }
.more-n { font: 22px var(--serif); color: var(--ink2); }
.pre { list-style: none; padding: 0; margin: 0; display: grid; gap: 4px; font-size: 14px; }
.pre li { display: flex; justify-content: space-between; gap: 10px; padding: 6px 10px; border-radius: 8px; background: var(--bg2); }
.pre li.yes b { color: var(--ok); }
.pre li.no b { color: var(--bad); }
.pre b { font-weight: 600; text-align: right; }
.wait { color: var(--wait); font-weight: 600; }
.why-viz.tall .why-bad { fill: var(--ink); }
