/* Шрифты лежат рядом — ничего не грузим с Google */
@font-face { font-family: "Inter"; font-style: normal; font-weight: 100 900; font-display: swap; src: url(fonts/inter-cyrillic-wght-normal.woff2) format("woff2"); unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: "Inter"; font-style: normal; font-weight: 100 900; font-display: swap; src: url(fonts/inter-latin-wght-normal.woff2) format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Playfair Display"; font-style: normal; font-weight: 400 900; font-display: swap; src: url(fonts/playfair-display-cyrillic-wght-normal.woff2) format("woff2"); unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: "Playfair Display"; font-style: normal; font-weight: 400 900; font-display: swap; src: url(fonts/playfair-display-latin-wght-normal.woff2) format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Playfair Display"; font-style: italic; font-weight: 400 900; font-display: swap; src: url(fonts/playfair-display-cyrillic-wght-italic.woff2) format("woff2"); unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: "Playfair Display"; font-style: italic; font-weight: 400 900; font-display: swap; src: url(fonts/playfair-display-latin-wght-italic.woff2) format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }

/* Палитра и шрифты — как у страницы-барабана ../slot */
:root {
  --bg: #1a110c;
  --bg-2: #24170f;
  --wood: #6b3f24;
  --wood-hi: #8a5532;
  --wood-lo: #3e2414;
  --brass: #e0b45c;
  --brass-lo: #9c7428;
  --cream: #f6ecd9;
  --cream-2: #eadbbf;
  --ink: #2a1a10;
  --ink-soft: #7a6450;
  --red: #d8412f;
  --red-lo: #9e2a1c;
  --text: #f6ecd9;
  --text-soft: #b89f84;
  --serif: "Playfair Display", Georgia, "Times New Roman", serif;
  --sans: Inter, system-ui, -apple-system, "Segoe UI", sans-serif;
  --emoji: "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji", sans-serif;
  --st: env(safe-area-inset-top, 0px);
  --sr: env(safe-area-inset-right, 0px);
  --sb: env(safe-area-inset-bottom, 0px);
  --sl: env(safe-area-inset-left, 0px);
  --view: 1.3846;           /* форма окна будки = форма кадра на полоске (540×390) */
  --vh: 100vh;
}
@supports (height: 100svh) { :root { --vh: 100svh; } }

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: radial-gradient(1200px 700px at 50% 35%, #3a2416 0%, var(--bg) 60%), var(--bg);
  color: var(--text);
  font-family: var(--sans);
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior: none;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
}
button { font: inherit; color: inherit; cursor: pointer; }
.hidden, [hidden] { display: none !important; }
.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
.i { width: 20px; height: 20px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
:focus-visible { outline: 2px solid var(--brass); outline-offset: 3px; }

/* ---------- кнопки ---------- */
.icon-btn {
  position: relative; width: 42px; height: 42px; border-radius: 12px; border: 1px solid #ffffff1f;
  background: #1a110cb8; display: grid; place-items: center; flex: none; padding: 0;
  transition: background .15s, border-color .15s, transform .08s;
}
.icon-btn:hover { background: #2a1a10d9; }
.icon-btn:active { transform: scale(.94); }
.icon-btn svg { width: 21px; height: 21px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.sound-btn .x { display: none; }
.sound-btn.off .x { display: block; stroke: #ff8a78; }
.sound-btn.off .wave { display: none; }
.badge {
  position: absolute; top: -6px; right: -6px; min-width: 19px; height: 19px; padding: 0 5px; border-radius: 10px;
  background: var(--red); color: #fff; font-size: 11px; font-weight: 700; line-height: 19px; text-align: center;
  box-shadow: 0 0 0 2px var(--bg);
}
.btn {
  height: 46px; padding: 0 20px; border-radius: 999px; border: 1px solid #ffffff26; background: #ffffff0f;
  font-weight: 600; white-space: nowrap; transition: filter .15s, transform .08s, opacity .2s;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
}
.btn:hover { filter: brightness(1.12); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .6; cursor: default; }
.btn.primary { background: var(--brass); color: var(--ink); border-color: transparent; box-shadow: 0 4px 0 var(--brass-lo); }
.btn.danger { color: #ff8a78; border-color: #d8412f66; }
.play {
  width: 100%; height: 60px; padding: 0 24px; border-radius: 999px; border: 0;
  background: linear-gradient(180deg, #ef5a45, var(--red) 55%, var(--red-lo));
  color: #fff; font-weight: 700; font-size: 19px; letter-spacing: .02em; white-space: nowrap;
  box-shadow: 0 6px 0 #6d1c12, 0 14px 30px -8px #d8412f99, inset 0 1px 0 #ffffff55;
  transition: transform .08s, box-shadow .08s;
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
}
.play .i { width: 23px; height: 23px; }
.play:active { transform: translateY(4px); box-shadow: 0 2px 0 #6d1c12, 0 8px 20px -8px #d8412f99, inset 0 1px 0 #ffffff55; }
.link {
  border: 0; background: none; color: var(--text-soft); font-size: 15px; padding: 8px 12px;
  text-decoration: underline; text-decoration-color: #b89f8466; text-underline-offset: 4px;
}
.link:hover { color: var(--cream); }
kbd { font-family: inherit; border: 1px solid #ffffff2a; border-bottom-width: 2px; border-radius: 5px; padding: 0 5px; }

/* ---------- экраны ---------- */
.screen {
  position: fixed; inset: 0; display: none; flex-direction: column; overflow-y: auto; -webkit-overflow-scrolling: touch;
  padding: 0 calc(16px + var(--sr)) calc(16px + var(--sb)) calc(16px + var(--sl));
}
body[data-screen="booth"] #booth,
body[data-screen="review"] #review,
body[data-screen="gallery"] #gallery { display: flex; }
.top {
  flex: none; display: flex; align-items: center; gap: 12px;
  width: 100%; max-width: 1180px; margin: 0 auto; padding: calc(12px + var(--st)) 0 0;
}
.brand { flex: 1; min-width: 0; font-family: var(--serif); font-style: italic; font-size: 19px; color: var(--brass); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.icons { display: flex; gap: 8px; }

/* ---------- будка ---------- */
.booth-wrap {
  flex: 1; width: 100%; max-width: 520px; margin: 0 auto; padding: 10px 0 0;
  display: grid; grid-template-columns: minmax(0, 1fr); grid-template-areas: "head" "cab" "ctl";
  align-content: center; justify-items: center; gap: 12px;
}
.head { grid-area: head; text-align: center; }
.kicker { font-size: 12px; letter-spacing: .18em; text-transform: uppercase; color: var(--brass); font-weight: 600; }
h1 {
  font-family: var(--serif); font-weight: 800; font-size: clamp(34px, 9.6vw, 44px); line-height: 1.02;
  margin: 4px 0 0; letter-spacing: -.01em;
}
h1 em { color: var(--brass); font-weight: 700; }

.cabinet {
  grid-area: cab; position: relative; display: flex; flex-direction: column; gap: 10px;
  width: clamp(248px, calc((var(--vh) - 424px) * var(--view) + 24px), 100%);
  border-radius: 24px; padding: 14px 12px 12px;
  background:
    repeating-linear-gradient(92deg, #ffffff06 0 2px, transparent 2px 9px),
    linear-gradient(180deg, var(--wood-hi), var(--wood) 40%, var(--wood-lo));
  box-shadow:
    inset 0 2px 0 #ffffff26, inset 0 -6px 12px #0006,
    0 30px 60px -20px #000c, 0 0 0 3px var(--brass-lo), 0 0 0 5px #0008;
  transition: box-shadow .3s;
}
.cabinet.lit { box-shadow: inset 0 2px 0 #ffffff26, inset 0 -6px 12px #0006, 0 0 90px 10px #ffe39a66, 0 0 0 3px var(--brass), 0 0 0 5px #0008; transition: none; }

/* лампочки по периметру */
.bulbs { position: absolute; display: flex; justify-content: space-between; pointer-events: none; }
.bulbs.bt { top: 4px; left: 16px; right: 16px; }
.bulbs.bb { bottom: 3px; left: 16px; right: 16px; flex-direction: row-reverse; }
.bulbs.bl { left: 3px; top: 22px; bottom: 20px; flex-direction: column-reverse; }
.bulbs.br { right: 3px; top: 22px; bottom: 20px; flex-direction: column; }
.bulb {
  width: 6px; height: 6px; border-radius: 50%; background: #6a4a2a; box-shadow: inset 0 -1px 2px #0006;
  animation: bulb 2.4s steps(1) infinite; animation-delay: calc(var(--k) * -.4s);
}
@keyframes bulb {
  0% { background: #ffe39a; box-shadow: 0 0 9px 2px #ffcf5a, inset 0 -1px 2px #fff8; }
  34% { background: #6a4a2a; box-shadow: inset 0 -1px 2px #0006; }
}
.cabinet.hot .bulb { animation-duration: .72s; animation-delay: calc(var(--k) * -.12s); }
.cabinet.lit .bulb { animation: none; background: #fff3c4; box-shadow: 0 0 12px 3px #ffcf5a, inset 0 -1px 2px #fff8; }

.marquee {
  display: flex; align-items: center; justify-content: center; min-height: 38px;
  background: linear-gradient(180deg, #2b1a10, #1b100a);
  border-radius: 12px; padding: 6px 12px;
  box-shadow: inset 0 2px 8px #000a, 0 1px 0 #ffffff1a;
}
.marquee span {
  font-family: var(--serif); font-weight: 800; letter-spacing: .08em; text-transform: uppercase;
  color: var(--brass); font-size: clamp(14px, 4.2vw, 19px); text-shadow: 0 0 12px #e0b45c66;
  font-variant-numeric: lining-nums; white-space: nowrap;
}
.marquee span.swap { animation: mswap .35s cubic-bezier(.2, 1.4, .4, 1); }
@keyframes mswap { from { transform: translateY(8px); opacity: 0; } }

/* окно: видоискатель за шторками */
.window {
  position: relative; aspect-ratio: 540 / 390; overflow: hidden; border-radius: 12px; background: #0d0806;
  box-shadow: inset 0 8px 18px #0000004d, 0 0 0 4px #1b100a, 0 0 0 6px var(--brass-lo);
  margin: 4px 6px 6px; container-type: inline-size;
}
body[data-phase="idle"] .window { cursor: pointer; }
#cam { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; background: #0d0806; }
#cam.flip { transform: scaleX(-1); }
.window::after {  /* тень от козырька и лёгкая виньетка поверх видео */
  content: ""; position: absolute; inset: 0; z-index: 2; pointer-events: none;
  box-shadow: inset 0 10px 22px -6px #000c, inset 0 0 40px #0006;
}
.corners { position: absolute; inset: 7%; z-index: 2; pointer-events: none; opacity: 0; transition: opacity .4s .6s; }
body[data-phase="live"] .corners { opacity: .7; }
.corners i { position: absolute; width: 9%; aspect-ratio: 1; border: 2px solid var(--cream); filter: drop-shadow(0 1px 2px #000a); }
.corners i:nth-child(1) { left: 0; top: 0; border-right: 0; border-bottom: 0; border-top-left-radius: 6px; }
.corners i:nth-child(2) { right: 0; top: 0; border-left: 0; border-bottom: 0; border-top-right-radius: 6px; }
.corners i:nth-child(3) { left: 0; bottom: 0; border-right: 0; border-top: 0; border-bottom-left-radius: 6px; }
.corners i:nth-child(4) { right: 0; bottom: 0; border-left: 0; border-top: 0; border-bottom-right-radius: 6px; }

.curtain {
  position: absolute; top: 0; bottom: 0; width: 50.5%; z-index: 3;
  background:
    linear-gradient(180deg, #0007 0, #0000 16%, #0000 78%, #0008 100%),
    repeating-linear-gradient(90deg, #0000 0 5.5%, #00000042 8.5% 10.5%, #ffffff1c 13.5% 15%, #0000 18.5%),
    linear-gradient(180deg, #e8553f, var(--red) 35%, var(--red-lo));
  transition: transform 1s cubic-bezier(.65, .02, .25, 1);
  will-change: transform;
}
.curtain.l { left: 0; transform-origin: 0 50%; box-shadow: inset -10px 0 14px -8px #0009; }
.curtain.r { right: 0; transform-origin: 100% 50%; box-shadow: inset 10px 0 14px -8px #0009; }
body[data-phase="live"] .curtain { transform: scaleX(.085); }
body[data-phase="starting"] .curtain { animation: sway 1.6s ease-in-out infinite; }
@keyframes sway { 50% { transform: scaleX(.975); } }
@media (hover: hover) {
  body[data-phase="idle"] .window:hover .curtain { transform: scaleX(.95); transition-duration: .5s; }
}

.count {
  position: absolute; inset: 0; z-index: 4; display: grid; place-items: center; pointer-events: none;
  font-family: var(--serif); font-weight: 800; font-style: italic; font-variant-numeric: lining-nums;
  font-size: clamp(90px, 30vw, 150px); font-size: 36cqw; line-height: 1; color: var(--cream);
  text-shadow: 0 .03em 0 var(--wood-lo), 0 .08em .3em #000c;
}
.count.pop { animation: countpop .45s cubic-bezier(.2, 1.5, .4, 1); }
@keyframes countpop { from { transform: scale(1.9); opacity: 0; filter: blur(4px); } }
.count.last { color: #ffe39a; text-shadow: 0 .03em 0 var(--red-lo), 0 0 .35em #d8412fcc, 0 .08em .3em #000; }

.pose {
  position: absolute; z-index: 4; left: 50%; bottom: 9%; transform: translateX(-50%);
  max-width: 92%; padding: 9px 18px; border-radius: 999px; white-space: nowrap;
  background: var(--cream); color: var(--ink); font-weight: 700; font-size: clamp(15px, 5.2cqw, 28px);
  box-shadow: 0 10px 24px -8px #000; animation: posein .4s cubic-bezier(.2, 1.6, .4, 1);
}
@keyframes posein { from { transform: translateX(-50%) scale(.4); opacity: 0; } }

.flash { position: absolute; inset: 0; z-index: 5; background: #fff; opacity: 0; pointer-events: none; }
.flash.go { animation: flash .65s ease-out; }
@keyframes flash { 0% { opacity: 1; } 18% { opacity: .95; } 100% { opacity: 0; } }

/* пульт под окном: в покое — настройки, во время съёмки — лоток с кадрами */
.console { display: grid; place-items: center; min-height: 50px; }
.settings { display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: 6px; }
body:not([data-phase="idle"]) .settings { display: none; }
.seg {
  display: flex; align-items: center; gap: 3px; padding: 4px; border-radius: 14px;
  background: linear-gradient(180deg, #2b1a10, #1b100a); box-shadow: inset 0 2px 8px #000a, 0 1px 0 #ffffff1a;
}
.seg button {
  height: 36px; min-width: 40px; padding: 0 8px; border: 0; border-radius: 10px; background: none;
  color: var(--text-soft); font-weight: 600; font-size: 14px; transition: background .15s, color .15s;
}
.seg button:hover { color: var(--cream); }
.seg button.on { background: linear-gradient(180deg, #f0c872, var(--brass)); color: var(--ink); box-shadow: 0 2px 0 var(--brass-lo), inset 0 1px 0 #fff8; }
.seg-ico { display: none; width: 30px; place-items: center; color: var(--brass); }
.seg-ico svg { width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.chip {
  height: 44px; padding: 0 12px 0 10px; border: 0; border-radius: 14px;
  background: linear-gradient(180deg, #2b1a10, #1b100a); box-shadow: inset 0 2px 8px #000a, 0 1px 0 #ffffff1a;
  color: var(--text-soft); font-weight: 600; font-size: 14px; display: inline-flex; align-items: center; gap: 7px;
  transition: color .15s;
}
.chip::before {  /* лампочка-индикатор */
  content: ""; width: 9px; height: 9px; border-radius: 50%; background: #6a4a2a; box-shadow: inset 0 -1px 2px #0006;
  transition: background .15s, box-shadow .15s;
}
.chip[aria-pressed="true"] { color: var(--cream); }
.chip[aria-pressed="true"]::before { background: #ffe39a; box-shadow: 0 0 8px 2px #ffcf5a, inset 0 -1px 2px #fff8; }

.tray {
  --slot-h: 38px;
  display: none; gap: 5px; padding: 5px; border-radius: 5px;
  background: linear-gradient(180deg, #fffaf0, var(--cream-2)); box-shadow: 0 8px 16px -8px #000d, 0 0 0 1px #0003;
  transform: rotate(-1.2deg);
}
body:not([data-phase="idle"]) .tray { display: flex; animation: trayin .45s cubic-bezier(.2, 1.4, .4, 1); }
@keyframes trayin { from { transform: translateY(14px) rotate(3deg); opacity: 0; } }
.slot {
  position: relative; height: var(--slot-h); aspect-ratio: 540 / 390; border-radius: 3px; overflow: hidden;
  background: #2a1a1024; display: grid; place-items: center;
  font-family: var(--serif); font-weight: 800; font-size: 17px; color: #7a645099; font-variant-numeric: lining-nums;
}
.slot canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.slot.now { box-shadow: 0 0 0 2px var(--red); color: var(--red); animation: slotnow 1s ease-in-out infinite; }
@keyframes slotnow { 50% { box-shadow: 0 0 0 2px #d8412f55; } }
.slot.pop { animation: slotpop .4s cubic-bezier(.2, 1.7, .4, 1); }
@keyframes slotpop { from { transform: scale(1.35); } }
.ghost {  /* снимок, который летит из окна в лоток */
  position: fixed; z-index: 40; pointer-events: none; border-radius: 10px;
  box-shadow: 0 0 0 5px #fffaf0, 0 24px 50px -14px #000; will-change: transform;
}

/* управление: в покое — большая кнопка, во время съёмки — что сейчас происходит */
.ctl { grid-area: ctl; width: 100%; max-width: 420px; display: grid; }
.idle-ui, .live-ui { grid-area: 1 / 1; display: flex; flex-direction: column; align-items: center; transition: opacity .3s; }
body:not([data-phase="idle"]) .idle-ui, body[data-phase="idle"] .live-ui { visibility: hidden; opacity: 0; pointer-events: none; }
.keyhint { margin-top: 12px; font-size: 12px; color: var(--text-soft); }
@media (hover: none) { .keyhint { display: none; } }
.idle-ui .link { margin-top: 4px; }
.note { margin: 2px 0 0; font-size: 12.5px; line-height: 1.4; color: var(--text-soft); text-align: center; }
.note .i { width: 14px; height: 14px; display: inline-block; vertical-align: -2px; margin-right: 6px; }
.status {
  font-family: var(--serif); font-weight: 800; font-size: clamp(26px, 7.6vw, 36px); line-height: 1.1; text-align: center;
  font-variant-numeric: lining-nums;
}
.status-sub { margin-top: 4px; min-height: 1.4em; font-size: 15px; color: var(--text-soft); text-align: center; }
.live-actions { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; margin-top: 12px; }

/* ---------- готовая полоска ---------- */
.review-wrap {
  /* высота полоски на экране: по высоте окна, но так, чтобы справа осталось место инструментам */
  --sh: clamp(240px, min(calc(var(--vh) - 276px), calc((100vw - 262px) * 3)), 600px);
  flex: 1; width: 100%; max-width: 560px; margin: 0 auto; padding: 12px 0 0;
  display: grid; grid-template-columns: auto minmax(0, 1fr); grid-template-areas: "printer tools" "acts acts";
  align-content: center; gap: 14px 12px;
}
.printer { grid-area: printer; position: relative; padding-top: 12px; align-self: start; }
.slot-bar {
  position: absolute; z-index: 2; top: 0; left: 0; right: 0; height: 22px; border-radius: 8px;
  background: linear-gradient(180deg, #f0c872, var(--brass) 45%, var(--brass-lo));
  box-shadow: 0 6px 14px -4px #000c, inset 0 1px 0 #fff8, 0 0 0 1px #0006;
}
.slot-bar::after {
  content: ""; position: absolute; left: 9px; right: 9px; top: 9px; height: 5px; border-radius: 3px;
  background: #0d0806; box-shadow: inset 0 1px 2px #000, 0 1px 0 #ffffff55;
}
.paper { overflow: hidden; padding: 0 12px 18px; }
.printer.done .paper { overflow: visible; }
.strip-holder {
  position: relative; width: calc(var(--sh) / 3); height: var(--sh); margin-top: 14px; transform-origin: 50% 0;
  box-shadow: 0 14px 26px -10px #000d, 0 0 0 1px #0000001f;
}
#strip { display: block; width: 100%; height: 100%; border-radius: 2px; }
.printer.wait .strip-holder { transform: translateY(calc(-100% - 20px)); }
.printer.printing .strip-holder { animation: feed 2.8s ease-in-out both; }
@keyframes feed {  /* бумага выходит рывками, как из настоящего принтера */
  0% { transform: translateY(calc(-100% - 20px)); }
  16%, 20% { transform: translateY(-80%); }
  36%, 40% { transform: translateY(-56%); }
  56%, 60% { transform: translateY(-31%); }
  78%, 82% { transform: translateY(-9%); }
  100% { transform: none; }
}
.printer.done .strip-holder { animation: settle .8s ease-out both; }
@keyframes settle { 0% { transform: rotate(0); } 30% { transform: rotate(1.8deg); } 62% { transform: rotate(-.9deg); } 100% { transform: rotate(0); } }
.strip-holder.swap { animation: swap .45s cubic-bezier(.2, 1.6, .4, 1) !important; }
@keyframes swap { from { transform: scale(.94) rotate(-1.5deg); filter: brightness(1.6); } }
.strip-holder.tug { animation: tug .5s ease-in-out !important; }
@keyframes tug { 35% { transform: translateY(-10px) rotate(-1.6deg); } 70% { transform: translateY(14px) rotate(1deg); } }

.retakes { position: absolute; inset: 0; }
.retake {
  position: absolute; border: 0; padding: 0; background: #1a110c00; color: #fff; border-radius: 2px;
  display: grid; place-items: center; transition: background .15s;
}
.retake .i { width: 26%; height: auto; aspect-ratio: 1; max-width: 34px; opacity: 0; transition: opacity .15s; filter: drop-shadow(0 1px 3px #000); }
.retake:hover, .retake:focus-visible { background: #1a110c8c; }
.retake:hover .i, .retake:focus-visible .i { opacity: 1; }
@media (hover: none) {
  .retake .i { opacity: .9; width: 14px; position: absolute; right: 3px; bottom: 3px; padding: 3px; border-radius: 50%; background: #1a110ca6; box-sizing: content-box; }
}
.printer:not(.done) .retakes, .printer.no-retake .retakes { display: none; }

.panel {
  position: relative; border-radius: 22px; padding: 14px 12px;
  background:
    repeating-linear-gradient(92deg, #ffffff06 0 2px, transparent 2px 9px),
    linear-gradient(180deg, var(--wood-hi), var(--wood) 40%, var(--wood-lo));
  box-shadow: inset 0 2px 0 #ffffff26, inset 0 -6px 12px #0006, 0 24px 50px -20px #000c, 0 0 0 3px var(--brass-lo), 0 0 0 5px #0008;
}
.tools { grid-area: tools; align-self: center; display: flex; flex-direction: column; gap: 12px; margin: 5px 5px 5px 0; }
.lbl { font-size: 11px; letter-spacing: .16em; text-transform: uppercase; color: var(--brass); font-weight: 700; }
.tool .lbl { display: block; margin-bottom: 7px; text-shadow: 0 1px 2px #0008; }
.tool .lbl span { letter-spacing: 0; text-transform: none; color: var(--cream-2); font-weight: 500; font-size: 12px; margin-left: 4px; }
.filters { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 9px 7px; }
.fchip {
  border: 0; background: none; padding: 0; min-width: 0; display: flex; flex-direction: column; align-items: center; gap: 5px;
  color: var(--cream-2); font-size: 10.5px; font-weight: 600; white-space: nowrap;
}
.fchip canvas { display: block; width: 100%; aspect-ratio: 540 / 390; border-radius: 6px; background: #1b100a; box-shadow: 0 0 0 2px #1b100a, 0 0 0 3px #ffffff2e; transition: box-shadow .15s, transform .1s; }
.fchip:active canvas { transform: scale(.95); }
.fchip.on { color: #ffe39a; }
.fchip.on canvas { box-shadow: 0 0 0 2px #1b100a, 0 0 0 4px var(--brass), 0 0 14px #e0b45c88; }
.swatches { display: flex; flex-wrap: wrap; gap: 9px 6px; padding: 2px 3px; }
.swatch {
  width: 26px; height: 26px; border-radius: 50%; border: 0; padding: 0; flex: none; background: var(--c);
  box-shadow: 0 0 0 2px #1b100a, 0 0 0 3px #ffffff40, inset 0 -3px 5px #0003; transition: box-shadow .15s, transform .1s;
}
.swatch:active { transform: scale(.9); }
.swatch.on { box-shadow: 0 0 0 2px #1b100a, 0 0 0 4px var(--brass), 0 0 12px #e0b45c99, inset 0 -3px 5px #0003; }
.swatch[data-v="filmstrip"] {
  background:
    repeating-linear-gradient(0deg, #0000 0 3px, #8a8a8a 3px 6px) 22% 0 / 3px 100% no-repeat,
    repeating-linear-gradient(0deg, #0000 0 3px, #8a8a8a 3px 6px) 78% 0 / 3px 100% no-repeat, #1a1a1a;
}
.swatch[data-v="confetti"] {
  background:
    radial-gradient(circle at 30% 30%, #e91e63 0 2px, #0000 2.6px), radial-gradient(circle at 70% 36%, #2196f3 0 2px, #0000 2.6px),
    radial-gradient(circle at 42% 68%, #ff9800 0 2px, #0000 2.6px), radial-gradient(circle at 74% 72%, #4caf50 0 2px, #0000 2.6px), #fff;
}
#caption {
  width: 100%; height: 44px; padding: 0 12px; border-radius: 12px; border: 1px solid #0000;
  background: linear-gradient(180deg, #2b1a10, #1b100a); box-shadow: inset 0 2px 8px #000a, 0 1px 0 #ffffff1a;
  color: var(--cream); font: 600 16px var(--sans); -webkit-user-select: text; user-select: text;
}
#caption::placeholder { color: #b89f8499; font-weight: 500; }
#caption:focus { outline: none; border-color: var(--brass); }
.tip { margin: 0; font-size: 12px; line-height: 1.35; color: var(--cream-2); display: flex; gap: 6px; align-items: center; }
.tip .i { width: 15px; height: 15px; }

.acts { grid-area: acts; display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 12px 8px; }
.acts .play, .acts .btn.primary { grid-column: span 3; height: 54px; padding: 0 12px; font-size: 17px; }
.acts .btn.primary { font-weight: 700; }
.acts .btn { grid-column: span 2; height: 42px; padding: 0 6px; font-size: 13px; gap: 5px; }
.acts .btn:not(.primary) .i { display: none; }
.acts.no-share .play { grid-column: span 6; }
.acts.no-live .btn:not(.primary) { grid-column: span 3; }

/* ---------- галерея ---------- */
.gal-wrap { flex: 1; width: 100%; max-width: 1180px; margin: 0 auto; padding: 22px 0 8px; display: flex; flex-direction: column; }
.gal-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 22px 16px; }
.gal-card { border: 0; background: none; padding: 0; display: flex; flex-direction: column; align-items: center; gap: 9px; color: var(--text-soft); font-size: 12px; font-variant-numeric: lining-nums; }
.gal-card img {
  display: block; width: 100%; aspect-ratio: 1 / 3; object-fit: cover; border-radius: 3px; background: var(--cream-2);
  box-shadow: 0 16px 30px -14px #000, 0 0 0 1px #0000001f; transition: transform .25s cubic-bezier(.2, 1.4, .4, 1);
}
.gal-card:nth-child(odd) img { transform: rotate(-1.4deg); }
.gal-card:nth-child(even) img { transform: rotate(1.1deg); }
.gal-card:hover img, .gal-card:focus-visible img { transform: translateY(-6px) rotate(0); }
.gal-card { animation: cardin .4s cubic-bezier(.2, 1.3, .4, 1) both; animation-delay: calc(var(--n, 0) * 40ms); }
.gal-empty { margin: auto; text-align: center; max-width: 320px; padding: 20px 0 60px; }
.gal-empty h2 { font-family: var(--serif); font-size: 30px; margin: 18px 0 6px; }
.gal-empty p { margin: 0 0 18px; color: var(--text-soft); line-height: 1.5; }
.gal-empty-strip {
  width: 74px; margin: 0 auto; padding: 6px 6px 18px; display: flex; flex-direction: column; gap: 5px; border-radius: 3px;
  background: linear-gradient(180deg, #fffaf0, var(--cream-2)); box-shadow: 0 16px 30px -14px #000; transform: rotate(-4deg);
}
.gal-empty-strip i { display: block; aspect-ratio: 540 / 390; border-radius: 2px; background: #2a1a1022; }

/* ---------- оверлеи ---------- */
.overlay {
  position: fixed; inset: 0; z-index: 30; display: grid; place-items: center;
  padding: calc(20px + var(--st)) calc(20px + var(--sr)) calc(20px + var(--sb)) calc(20px + var(--sl));
  background: #120b07d9; -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); overflow-y: auto;
}
.card {
  width: min(440px, 100%); padding: 26px 22px; border-radius: 22px; text-align: center;
  background: linear-gradient(180deg, #2e1d12, #22150d); border: 1px solid #e0b45c44;
  box-shadow: 0 20px 50px -20px #000; animation: cardin .4s cubic-bezier(.2, 1.3, .4, 1);
}
@keyframes cardin { from { transform: translateY(16px) scale(.97); opacity: 0; } }
.card h2 { font-family: var(--serif); font-size: clamp(26px, 7vw, 34px); margin: 6px 0 10px; line-height: 1.1; }
.card p { color: var(--text-soft); line-height: 1.5; margin: 0 auto 6px; max-width: 380px; }
.big-emoji { font-family: var(--emoji); font-size: 56px; line-height: 1; margin-bottom: 6px; }
.actions { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; margin-top: 18px; }
.actions.col { flex-direction: column; align-items: stretch; }

.viewer-in { display: flex; flex-direction: column; align-items: center; gap: 16px; width: min(360px, 100%); animation: cardin .4s cubic-bezier(.2, 1.3, .4, 1); }
#viewerImg { height: min(52vh, 560px); aspect-ratio: 1 / 3; border-radius: 3px; background: var(--cream-2); box-shadow: 0 24px 50px -16px #000; }
.viewer-side { width: 100%; text-align: center; }
.viewer-side h2 { font-family: var(--serif); font-size: 24px; margin: 4px 0 0; line-height: 1.15; overflow-wrap: anywhere; }
.viewer-side .actions { margin-top: 14px; display: grid; grid-template-columns: 1fr 1fr; }

.toast {
  position: fixed; z-index: 70; left: 50%; bottom: calc(24px + var(--sb)); transform: translate(-50%, 20px);
  padding: 12px 18px; border-radius: 14px; background: var(--cream); color: var(--ink); font-weight: 600; font-size: 15px;
  box-shadow: 0 14px 40px -12px #000; opacity: 0; pointer-events: none; transition: opacity .25s, transform .25s;
  max-width: calc(100% - 32px); text-align: center;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
#confetti { position: fixed; inset: 0; width: 100%; height: 100%; z-index: 60; pointer-events: none; }
.fatal { z-index: 80; }

/* ---------- телефоны пошире ---------- */
@media (min-width: 421px) {
  .seg-ico { display: grid; }
  .acts .btn:not(.primary) .i { display: block; width: 17px; height: 17px; }
}
/* узкие телефоны: настройки под окном должны помещаться в одну строку */
@media (max-width: 420px) {
  .seg button { min-width: 38px; padding: 0 6px; }
  .chip { padding: 0 10px 0 8px; gap: 6px; font-size: 13.5px; }
}
@media (max-width: 370px) {
  .seg button { min-width: 34px; padding: 0 5px; font-size: 13px; }
  .chip { font-size: 13px; padding: 0 9px 0 7px; }
  .tray { --slot-h: 34px; }
}
/* невысокие телефоны: стартовый экран должен влезать без прокрутки */
@media (max-height: 620px) and (max-width: 899px) and (orientation: portrait) {
  .kicker, .note, .tip { display: none; }
  h1 { font-size: 32px; margin: 0; }
  .cabinet { width: clamp(248px, calc((var(--vh) - 386px) * var(--view) + 24px), 100%); }
  .play { height: 54px; font-size: 18px; }
  .booth-wrap { gap: 10px; }
  .seg button { height: 32px; min-width: 30px; padding: 0 5px; font-size: 12.5px; }
  .chip { height: 40px; padding: 0 7px 0 6px; gap: 5px; font-size: 12.5px; }
  .settings { gap: 5px; flex-wrap: nowrap; }
}

/* ---------- компьютер, планшет и телефон боком: окно слева, управление справа ---------- */
@media (min-width: 900px), (orientation: landscape) and (max-height: 560px) and (min-width: 560px) {
  .booth-wrap {
    max-width: none; padding: 0;
    grid-template-columns: auto minmax(240px, 380px); grid-template-areas: "cab head" "cab ctl";
    justify-content: center; align-content: center; justify-items: stretch; gap: 22px clamp(24px, 5vw, 72px);
  }
  .head { align-self: end; text-align: left; }
  .ctl { align-self: start; max-width: none; }
  .cabinet { width: clamp(280px, min(calc(100vw - 520px), calc((var(--vh) - 300px) * var(--view))), 920px); padding: 20px 18px 16px; gap: 14px; border-radius: 28px; }
  .bulbs.bt { top: 7px; left: 22px; right: 22px; }
  .bulbs.bb { bottom: 5px; left: 22px; right: 22px; }
  .bulbs.bl { left: 6px; top: 28px; bottom: 26px; }
  .bulbs.br { right: 6px; top: 28px; bottom: 26px; }
  .bulb { width: 8px; height: 8px; }
  .marquee { min-height: 52px; border-radius: 14px; }
  .marquee span { font-size: clamp(18px, 2vw, 28px); }
  .window { border-radius: 16px; margin: 4px 8px 8px; }
  .console { min-height: 72px; }
  .tray { --slot-h: 56px; gap: 7px; padding: 7px; }
  .slot { font-size: 22px; }
  .seg button { height: 40px; min-width: 52px; font-size: 15px; }
  .chip { height: 48px; padding: 0 16px 0 14px; font-size: 15px; }
  h1 { font-size: clamp(48px, 5.4vw, 76px); }
  .kicker { font-size: 13px; }
  .idle-ui, .live-ui { align-items: flex-start; }
  .play { height: 66px; font-size: 21px; }
  .idle-ui .link { padding-left: 0; }
  .note { text-align: left; font-size: 13.5px; margin-top: 8px; }
  .status { font-size: clamp(34px, 3.6vw, 52px); text-align: left; }
  .status-sub { font-size: 18px; text-align: left; }
  .live-actions { justify-content: flex-start; margin-top: 18px; }
  .brand { font-size: 21px; }
  .top { max-width: none; padding-left: 8px; padding-right: 8px; }

  .review-wrap {
    --sh: clamp(300px, calc(var(--vh) - 150px), 860px);
    max-width: none; padding: 0;
    grid-template-columns: auto minmax(280px, 420px); grid-template-areas: "printer tools" "printer acts";
    justify-content: center; gap: 18px clamp(28px, 6vw, 96px);
  }
  .printer { align-self: center; }
  .tools { align-self: end; margin: 0; padding: 20px 18px; gap: 16px; }
  .acts { align-self: start; }
  .filters { grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 8px; }
  .fchip { font-size: 11.5px; }
  .swatch { width: 34px; height: 34px; }
  .swatches { gap: 12px; }
  .tip { font-size: 13px; }
  .acts .play, .acts .btn.primary { height: 60px; font-size: 19px; }
  .acts .btn { height: 46px; font-size: 14px; }
  .acts .btn:not(.primary) .i { display: block; width: 18px; height: 18px; }
  .slot-bar { height: 26px; }
  .slot-bar::after { top: 11px; }

  .gal-grid { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 34px 26px; }
  .gal-card { font-size: 13px; }
  .viewer-in { flex-direction: row; width: auto; gap: 40px; }
  #viewerImg { height: min(82vh, 780px); }
  .viewer-side { width: 280px; text-align: left; }
  .viewer-side .actions { display: flex; }
}
/* телефон боком и маленькие ноутбуки: всё компактнее */
@media (orientation: landscape) and (max-height: 560px) and (min-width: 560px) {
  .top { padding-top: calc(8px + var(--st)); }
  .cabinet { width: clamp(220px, min(calc(100vw - 340px), calc((var(--vh) - 176px) * var(--view))), 920px); padding: 12px 12px 10px; gap: 8px; border-radius: 20px; }
  .marquee { min-height: 30px; padding: 3px 10px; }
  .marquee span { font-size: 14px; }
  .console { min-height: 44px; }
  .tray { --slot-h: 30px; gap: 4px; padding: 4px; }
  .seg button { height: 32px; min-width: 38px; font-size: 13px; }
  .chip { height: 40px; font-size: 13px; padding: 0 10px 0 8px; }
  .booth-wrap { grid-template-columns: auto minmax(220px, 300px); gap: 10px 24px; }
  h1 { font-size: 40px; }
  .kicker, .keyhint { display: none; }
  .play { height: 52px; font-size: 17px; }
  .status { font-size: 28px; }
  .status-sub { font-size: 15px; }
  .review-wrap { --sh: clamp(200px, calc(var(--vh) - 110px), 600px); grid-template-columns: auto minmax(260px, 380px); gap: 10px 24px; align-content: start; }
  .tools { padding: 12px; gap: 10px; align-self: start; }
  .tip { display: none; }
  .acts .play, .acts .btn.primary { height: 48px; font-size: 16px; }
  .acts .btn { height: 40px; font-size: 13px; }
}
/* большие экраны: всё крупнее, чтобы на записи с компьютера читалось */
@media (min-width: 1280px) and (min-height: 760px) {
  .top { padding-top: calc(18px + var(--st)); }
  .icon-btn { width: 48px; height: 48px; border-radius: 14px; }
  .icon-btn svg { width: 23px; height: 23px; }
  .tray { --slot-h: 66px; }
  .console { min-height: 84px; }
}
@media (prefers-reduced-motion: reduce) {
  .bulb { animation: none; background: #caa560; }
  .curtain { transition-duration: .01s; }
  body[data-phase="starting"] .curtain { animation: none; }
  .printer.printing .strip-holder { animation-duration: .01s; }
  .printer.done .strip-holder, .count.pop, .pose, .slot.pop { animation: none; }
}
