:root {
  --bg: #120c08;
  --ink: #f7efe4;
  --muted: #c9b8a3;
  --gold: #e2b657;
  --gold-2: #f0d48a;
  --card: #1d1510;
  --line: rgba(226, 182, 87, 0.35);
  --danger: #e07a6a;
  --ok: #8fca8a;
  --start: #0b0705;
  --start-mid: #1a120c;
  --start-glow: #3a2a18;
  --panel: #0d0907;
  --review: #1a140f;
  --wood: #2a2118;
  --wood-2: #241c16;
  --btn-ink: #24180c;
  --deep: #2a1d14;
  --slot: #140f0b;
  --tile: #16100c;
  --ring: rgba(226, 182, 87, 0.25);
  --glow: rgba(226, 182, 87, 0.16);
  font-family: "Trebuchet MS", "Segoe UI", sans-serif;
}

[data-theme="perak"] {
  --bg: #0e1218;
  --ink: #eef2f6;
  --muted: #b7c0cc;
  --gold: #c5d0dc;
  --gold-2: #f4f7fb;
  --card: #171c24;
  --line: rgba(197, 208, 220, 0.35);
  --start: #090c12;
  --start-mid: #141a24;
  --start-glow: #2a3544;
  --panel: #0c1016;
  --review: #151b24;
  --wood: #243041;
  --wood-2: #1c2530;
  --btn-ink: #121820;
  --deep: #1e2833;
  --slot: #121820;
  --tile: #161c24;
  --ring: rgba(197, 208, 220, 0.28);
  --glow: rgba(197, 208, 220, 0.16);
}
[data-theme="zamrud"] {
  --bg: #071410;
  --ink: #e7f6ef;
  --muted: #a9cbb8;
  --gold: #3dbe8a;
  --gold-2: #b6f3d4;
  --card: #0e241c;
  --line: rgba(61, 190, 138, 0.4);
  --start: #04110d;
  --start-mid: #0c221a;
  --start-glow: #14543a;
  --panel: #071611;
  --review: #0d241c;
  --wood: #1a3d30;
  --wood-2: #123028;
  --btn-ink: #062018;
  --deep: #12362c;
  --slot: #0c1f19;
  --tile: #10261f;
  --ring: rgba(61, 190, 138, 0.28);
  --glow: rgba(61, 190, 138, 0.16);
}
[data-theme="anggur"] {
  --bg: #1a0c12;
  --ink: #fbe8ee;
  --muted: #e2b8c4;
  --gold: #e07a9a;
  --gold-2: #f6c1d0;
  --card: #2a121a;
  --line: rgba(224, 122, 154, 0.4);
  --start: #12080c;
  --start-mid: #2a1218;
  --start-glow: #5a2438;
  --panel: #14090e;
  --review: #241018;
  --wood: #4a2432;
  --wood-2: #3a1c28;
  --btn-ink: #2a1018;
  --deep: #3a1824;
  --slot: #1c0e14;
  --tile: #241018;
  --ring: rgba(224, 122, 154, 0.28);
  --glow: rgba(224, 122, 154, 0.16);
}
[data-theme="laut"] {
  --bg: #07141c;
  --ink: #e7f4fb;
  --muted: #a9c6d6;
  --gold: #3aa0d8;
  --gold-2: #b9e6fb;
  --card: #0e2430;
  --line: rgba(58, 160, 216, 0.4);
  --start: #041018;
  --start-mid: #0c2230;
  --start-glow: #14506e;
  --panel: #061018;
  --review: #0c2432;
  --wood: #16485f;
  --wood-2: #12384a;
  --btn-ink: #06202c;
  --deep: #123444;
  --slot: #0c1e28;
  --tile: #102838;
  --ring: rgba(58, 160, 216, 0.28);
  --glow: rgba(58, 160, 216, 0.16);
}
[data-theme="sakura"] {
  --bg: #1c1016;
  --ink: #ffeef5;
  --muted: #e7c2d0;
  --gold: #f0a0c0;
  --gold-2: #ffd0e2;
  --card: #2c1822;
  --line: rgba(240, 160, 192, 0.4);
  --start: #140c10;
  --start-mid: #2a1620;
  --start-glow: #6a3050;
  --panel: #160e12;
  --review: #28141e;
  --wood: #5a3044;
  --wood-2: #462436;
  --btn-ink: #2a1420;
  --deep: #3a2030;
  --slot: #1c1218;
  --tile: #24141c;
  --ring: rgba(240, 160, 192, 0.28);
  --glow: rgba(240, 160, 192, 0.16);
}
[data-theme="senja"] {
  --bg: #1a100c;
  --ink: #fff1e6;
  --muted: #e6c2a8;
  --gold: #f08a4a;
  --gold-2: #ffd0a8;
  --card: #2a1a12;
  --line: rgba(240, 138, 74, 0.4);
  --start: #120c08;
  --start-mid: #2a1810;
  --start-glow: #6a3a20;
  --panel: #160e0a;
  --review: #26160e;
  --wood: #5a3824;
  --wood-2: #452c1c;
  --btn-ink: #2a160e;
  --deep: #3a2418;
  --slot: #1c120e;
  --tile: #241610;
  --ring: rgba(240, 138, 74, 0.28);
  --glow: rgba(240, 138, 74, 0.16);
}
[data-theme="arang"] {
  --bg: #101010;
  --ink: #f5f5f5;
  --muted: #bdbdbd;
  --gold: #e8e8e8;
  --gold-2: #ffffff;
  --card: #1a1a1a;
  --line: rgba(255, 255, 255, 0.22);
  --start: #070707;
  --start-mid: #161616;
  --start-glow: #3a3a3a;
  --panel: #0c0c0c;
  --review: #161616;
  --wood: #2a2a2a;
  --wood-2: #222222;
  --btn-ink: #111111;
  --deep: #242424;
  --slot: #141414;
  --tile: #181818;
  --ring: rgba(255, 255, 255, 0.2);
  --glow: rgba(255, 255, 255, 0.1);
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; background: var(--bg); color: var(--ink); }
button, input { font: inherit; }
img { max-width: 100%; }

.booth {
  height: 100dvh;
  overflow: hidden;
  user-select: none;
  touch-action: manipulation;
}

.screen {
  display: none;
  position: absolute;
  inset: 0;
}
.screen.active { display: flex; flex-direction: column; }

#screen-start {
  flex-direction: row;
  align-items: stretch;
  justify-content: center;
  text-align: center;
  background: var(--start);
  overflow: hidden;
}
.start-main {
  position: relative;
  z-index: 2;
  flex: 1 1 100%;
  width: 100%;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}
#screen-start.is-showing-guest .start-main {
  flex: 3 1 75%;
  width: 75%;
}
#screen-start.is-showing-guest .event-title { max-width: 92%; }
#screen-start.is-showing-guest .start-header { max-width: 88%; }
#screen-start.is-showing-guest .btn-start-photo { min-width: min(78%, 520px); }
.start-bg {
  position: absolute;
  inset: -48px;
  z-index: 0;
  pointer-events: none;
  background:
    radial-gradient(circle at 50% 20%, var(--start-glow), transparent 45%),
    linear-gradient(180deg, var(--start-mid), var(--start));
  background-size: cover;
  background-position: center;
}
#screen-start.has-bg .vignette {
  box-shadow: inset 0 0 140px 50px rgba(0, 0, 0, 0.55);
}
#start-cam {
  position: absolute;
  inset: 0;
  z-index: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  background: #000;
  display: none;
}
#screen-start.is-live-cam {
  background: #000;
}
#screen-start.is-live-cam .start-bg {
  display: none !important;
  background-image: none !important;
}
#screen-start.is-live-cam #start-cam { display: block; }
#screen-start.is-live-cam .vignette {
  box-shadow: inset 0 0 180px 50px rgba(0, 0, 0, 0.5);
}
.vignette {
  pointer-events: none;
  position: absolute;
  inset: 0;
  z-index: 1;
  box-shadow: inset 0 0 120px 40px #000;
}
.eyebrow {
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: var(--gold);
  font-size: 0.85rem;
  margin: 0 0 0.6rem;
  z-index: 1;
}
h1, .event-title {
  font-size: calc(clamp(2.6rem, 8vw, 6.4rem) * var(--event-font-scale, 1));
  margin: 0 1.2rem;
  z-index: 1;
  font-weight: 800;
  line-height: 1.08;
  max-width: 92vw;
  text-shadow: 0 6px 24px rgba(0, 0, 0, 0.55);
}
.event-title.is-script {
  font-weight: 400;
  line-height: 1.2;
}
.start-header {
  z-index: 1;
  margin: 0.7rem 1.4rem 2.2rem;
  font-size: calc(clamp(1.4rem, 3.4vw, 2.5rem) * var(--header-font-scale, 1));
  line-height: 1.25;
  color: var(--gold-2);
  font-weight: 600;
  max-width: 80vw;
  text-shadow: 0 4px 18px rgba(0, 0, 0, 0.5);
  white-space: pre-wrap;
}
.start-header.is-script { font-weight: 400; }
.start-header:empty { display: none; }
.lead { color: var(--muted); z-index: 1; font-size: 1.2rem; }
.btn-start-photo {
  z-index: 2;
  appearance: none;
  border: 0;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.7rem;
  min-width: min(72vw, 560px);
  min-height: 108px;
  padding: 1.1rem 2.4rem;
  border-radius: 999px;
  font-size: clamp(2rem, 5vw, 3.4rem);
  font-weight: 800;
  letter-spacing: 0.04em;
  color: var(--btn-ink);
  background: linear-gradient(180deg, var(--gold-2), var(--gold));
  box-shadow: 0 14px 40px var(--line);
}
.btn-start-photo svg {
  width: 1.15em;
  height: 1.15em;
  flex-shrink: 0;
}

.topbar {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  padding: 0.8rem 1rem;
  border-bottom: 1px solid var(--line);
}
.topbar h2 { margin: 0; font-size: 1.1rem; }
.link, .btn {
  appearance: none;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--ink);
  padding: 0.7rem 1rem;
  border-radius: 999px;
  text-decoration: none;
  display: inline-flex;
  justify-content: center;
  cursor: pointer;
}
.btn.primary {
  background: linear-gradient(180deg, var(--gold-2), var(--gold));
  color: var(--btn-ink);
  border-color: transparent;
  font-weight: 700;
}
.btn.ghost { background: rgba(255,255,255,0.04); }
.topbar .link { justify-self: start; }

.frame-grid {
  flex: 1;
  overflow: auto;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 1rem;
  padding: 1rem;
}
.frame-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 18px;
  overflow: hidden;
  padding: 0;
  color: inherit;
  cursor: pointer;
}
.frame-card img {
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: contain;
  background: var(--wood);
}
.frame-card span { display: block; padding: 0.6rem; }

#screen-camera.active,
#screen-review.active {
  display: flex;
  flex-direction: column;
}
.review-top {
  flex-shrink: 0;
  padding: 0.4rem 1rem 0.45rem;
  text-align: center;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
}
.review-top .hint {
  margin: 0.2rem auto 0;
  max-width: 44rem;
}
.review-event {
  flex-shrink: 0;
  margin: 0;
  padding: 0.55rem 1.2rem 0.45rem;
  text-align: center;
  z-index: 2;
  font-size: calc(clamp(1.15rem, 3.2vw, 2.1rem) * var(--event-font-scale, 1));
  font-weight: 800;
  line-height: 1.15;
  max-width: 100%;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
  text-shadow: 0 4px 16px rgba(0, 0, 0, 0.45);
}
.review-event.is-script { font-weight: 400; }
#screen-camera .cam-layout,
#screen-review .review-layout {
  flex: 1;
  min-height: 0;
  width: 100%;
}
.cam-layout {
  display: grid;
  grid-template-columns: 1fr;
  grid-template-rows: 1fr auto;
  height: 100%;
  min-height: 0;
}
.review-layout {
  display: grid;
  grid-template-columns: 1fr 300px;
  grid-template-rows: 1fr;
  background: var(--review);
}
.strip-wrap {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 0;
  overflow: auto;
  padding: 0.8rem;
  background:
    repeating-linear-gradient(
      90deg,
      var(--wood) 0 12px,
      var(--wood-2) 12px 24px
    );
}
#review-strip {
  display: block;
  background: #fff6ea;
  border-radius: 6px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.45);
  touch-action: none;
}
#review-strip.is-croppable { cursor: grab; }
#review-strip.is-croppable:active { cursor: grabbing; }
.review-side {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 0.7rem;
  padding: 1.2rem;
  border-left: 1px solid var(--line);
  background: var(--panel);
}
.review-side h2 { margin: 0; }
.review-side .btn { width: 100%; }
.stage-fit {
  container-type: size;
  container-name: stagefit;
  min-width: 0;
  min-height: 0;
  width: 100%;
  height: 100%;
  display: grid;
  place-items: center;
  background: #000;
}
.stage {
  position: relative;
  background: #000;
  overflow: hidden;
  aspect-ratio: 16 / 9;
  width: 100%;
  max-height: 100%;
}
body[data-orient="portrait"] .stage {
  aspect-ratio: 3 / 4;
}
body[data-orient="portrait"] .review-layout {
  grid-template-columns: 1fr;
  grid-template-rows: 1fr auto;
}
body[data-orient="portrait"] .review-side {
  border-left: 0;
  border-top: 1px solid var(--line);
}
@container stagefit (min-aspect-ratio: 16/9) {
  .stage {
    width: auto;
    height: 100%;
    max-width: 100%;
    max-height: none;
  }
}
#cam, #live-frame {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
#live-frame { pointer-events: none; }

.count {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-size: 28vh;
  font-weight: 800;
  color: #fff;
  text-shadow: 0 8px 24px #000;
  z-index: 3;
}
.flash {
  position: absolute;
  inset: 0;
  background: #fff;
  opacity: 0.92;
  pointer-events: none;
  z-index: 4;
}
.ready-msg {
  position: absolute;
  inset: 0;
  z-index: 5;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  background: rgba(8, 5, 3, 0.55);
  padding: 1.5rem;
  pointer-events: auto;
}
.ready-msg p {
  margin: 0;
  color: #fff;
  font-weight: 800;
  font-size: clamp(2.2rem, 6vw, 4.4rem);
  line-height: 1.15;
  text-shadow: 0 8px 28px #000;
}
.ready-msg .ready-sub {
  margin-top: 0.6rem;
  font-size: clamp(1.4rem, 3.4vw, 2.4rem);
  font-weight: 600;
  color: var(--gold-2);
}
.btn-cancel-ready {
  appearance: none;
  margin-top: 1.6rem;
  min-width: 180px;
  min-height: 56px;
  padding: 0.7rem 1.8rem;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.5);
  background: rgba(0, 0, 0, 0.5);
  color: #fff;
  font-size: 1.25rem;
  font-weight: 700;
  cursor: pointer;
  z-index: 6;
}
.btn-cancel-ready:active {
  background: rgba(224, 122, 106, 0.85);
}
#screen-camera.is-full {
  background: #000;
}
#screen-camera.is-full .cam-layout {
  grid-template-rows: 1fr;
}
#screen-camera.is-full .stage-fit,
#screen-camera.is-full .stage {
  aspect-ratio: auto;
  width: 100%;
  height: 100%;
  max-width: none;
  max-height: none;
}
#screen-camera.is-full .process-panel {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 6;
  grid-template-columns: 1fr;
  padding: 2.2rem 1rem 0.8rem;
  background: linear-gradient(transparent, rgba(0, 0, 0, 0.55));
  border-top: 0;
  pointer-events: none;
}
#screen-camera.is-full .process-kicker,
#screen-camera.is-full .shot-slots { display: none; }
#screen-camera.is-full .process-panel h2 {
  color: #fff;
  font-size: 1.15rem;
  text-shadow: 0 2px 12px #000;
}
#screen-camera.is-full .process-actions { pointer-events: auto; }
.ready-msg.hidden { display: none !important; }
.hidden { display: none !important; }

.process-panel {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 0.9rem;
  padding: 0.75rem 1rem 0.9rem;
  background: var(--panel);
  border-top: 1px solid var(--line);
  align-items: stretch;
}
.process-copy {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  min-width: 0;
}
.process-kicker {
  margin: 0;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--gold);
  font-size: 0.75rem;
}
.process-panel h2 {
  margin: 0;
  font-size: 1.05rem;
  line-height: 1.3;
}
.process-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-top: auto;
}
.process-actions .btn { flex: 1; min-width: 110px; }
.shot-slots {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 0.55rem;
  min-height: 0;
}
.slot {
  position: relative;
  border: 2px dashed var(--line);
  border-radius: 12px;
  overflow: hidden;
  background: var(--start-mid);
  min-height: 110px;
}
.slot img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: none;
}
.slot em {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: var(--muted);
  font-style: normal;
  font-size: 0.85rem;
}
.slot-num {
  position: absolute;
  left: 8px;
  top: 8px;
  z-index: 1;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: #000;
  color: var(--gold);
  display: grid;
  place-items: center;
  font-size: 0.8rem;
  font-weight: 700;
}
.slot.active {
  border-style: solid;
  border-color: var(--gold);
  box-shadow: 0 0 0 3px var(--ring);
  animation: pulse 1s ease-in-out infinite;
}
.slot.done {
  border-style: solid;
  border-color: var(--ok);
}
.slot.done img { display: block; }
.slot.done em { display: none; }
@keyframes pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.015); }
}
.btn-shoot {
  padding: 0.8rem 1rem;
  font-size: 1rem;
}

.review-actions {
  display: flex;
  justify-content: center;
  gap: 1rem;
  padding: 0.9rem 1rem 1.1rem;
  background: var(--panel);
  border-top: 1px solid var(--line);
}

#screen-done {
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 1.5rem;
  gap: 1.4rem;
  flex-direction: row;
  flex-wrap: wrap;
}
.qr {
  width: min(32vw, 280px);
  height: min(32vw, 280px);
  background: #fff;
  padding: 12px;
  border-radius: 16px;
}
.qr canvas, .qr img { width: 100%; height: 100%; }
.qr-wait {
  margin: 0;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #1a120c;
  font-size: 1rem;
  line-height: 1.35;
}
.done-actions {
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
  min-width: min(72vw, 360px);
}
.done-actions .btn { width: 100%; }
.hint { color: var(--muted); max-width: 28rem; }
#done-return:empty { display: none; }

.start-show {
  position: relative;
  z-index: 2;
  flex: 1 1 25%;
  width: 25%;
  height: 100%;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 1.25rem 1.25rem 1.25rem 0.4rem;
  pointer-events: none;
}
.start-show[hidden] { display: none !important; }
.start-show img {
  display: block;
  width: 100%;
  height: calc(100% - 1.6rem);
  max-width: none;
  object-fit: contain;
  background: #fff6ea;
  border-radius: 16px;
  border: 3px solid var(--gold-2);
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.4);
  transition: opacity 0.45s ease;
}
.start-show img.is-out { opacity: 0; }
.start-show p {
  margin: 0.45rem 0 0;
  text-align: center;
  color: var(--gold-2);
  font-size: 0.95rem;
}

#btn-flip[hidden],
.kiosk-hit[hidden] { display: none !important; }
a.gear-btn { text-decoration: none; color: var(--gold-2); }
.gear-btn {
  position: absolute;
  left: 1rem;
  bottom: 1rem;
  z-index: 6;
  width: 58px;
  height: 58px;
  padding: 0;
  display: grid;
  place-items: center;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: rgba(12, 8, 6, 0.72);
  color: var(--gold-2);
  cursor: pointer;
}
.gear-btn svg { width: 30px; height: 30px; }
button.gear-btn { font: inherit; }
.local-form {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.8rem 1rem;
}
.local-form label { display: grid; gap: 0.25rem; font-size: 0.85rem; color: var(--muted); }
.local-form input, .local-form select {
  width: 100%;
  border: 1px solid var(--line);
  background: rgba(0, 0, 0, 0.28);
  color: var(--ink);
  border-radius: 10px;
  padding: 0.55rem 0.7rem;
  font: inherit;
}
.local-check { align-content: end; }
.sync-choice {
  display: grid;
  gap: 0.7rem;
  padding: 0.9rem;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(0, 0, 0, 0.28);
}
.sync-choice[hidden] { display: none !important; }
.gear-menu {
  position: absolute;
  left: 1rem;
  bottom: 5rem;
  z-index: 7;
  width: min(72vw, 280px);
  display: grid;
  gap: 0.45rem;
  padding: 0.7rem;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: var(--card);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.45);
}
.gear-menu.hidden { display: none; }
.gear-menu button,
.gear-menu a {
  display: block;
  width: 100%;
  text-align: left;
  text-decoration: none;
  padding: 0.85rem 1rem;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--panel);
  color: inherit;
  font: inherit;
  cursor: pointer;
}
.field { display: grid; gap: 0.35rem; color: var(--muted); }
.field select {
  min-height: 48px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--ink);
  font: inherit;
  padding: 0 0.8rem;
}
.kiosk-hit {
  position: absolute;
  top: 0;
  left: 0;
  z-index: 4;
  width: 72px;
  height: 72px;
  border: 0;
  background: transparent;
  opacity: 0;
}
.operator-title { margin: 0.4rem 0 0; font-size: 1.15rem; }
.operator-photos { display: grid; gap: 0.6rem; }
.operator-photo {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}
.operator-photo img {
  width: 54px;
  height: 78px;
  object-fit: cover;
  border-radius: 8px;
  background: #fff6ea;
}
.operator-photo .btn { margin-left: auto; }

.pin-modal {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.62);
  padding: 1rem;
}
.pin-modal.hidden { display: none; }
.pin-card {
  width: min(92vw, 420px);
  padding: 1.2rem;
  text-align: center;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 20px;
}
.print-tune-modal { z-index: 80; }
.print-tune-card {
  width: min(94vw, 440px);
  max-height: 94vh;
  overflow: auto;
  padding: 1.1rem 1.2rem 1.2rem;
  text-align: center;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 20px;
}
.print-tune-card h2 { margin: 0.15rem 0 0.7rem; font-size: 1.35rem; }
.print-tune-preview-wrap {
  margin: 0 auto 0.85rem;
  width: 100%;
  max-width: 320px;
  border-radius: 12px;
  overflow: hidden;
  background: #1a120c;
  border: 1px solid var(--line);
}
#print-tune-preview {
  display: block;
  width: 100%;
  height: auto;
  max-height: 42vh;
  object-fit: contain;
}
.print-tune-row {
  display: block;
  margin: 0.55rem 0;
  text-align: left;
  font-size: 0.92rem;
  color: var(--ink);
}
.print-tune-row span {
  float: right;
  opacity: 0.75;
  font-variant-numeric: tabular-nums;
}
.print-tune-row input[type="range"] {
  display: block;
  width: 100%;
  margin-top: 0.35rem;
}
.print-tune-actions {
  display: flex;
  gap: 0.6rem;
  justify-content: center;
  margin-top: 1rem;
}
.print-tune-actions .btn { min-width: 7.5rem; }
.pin-card h2 { margin: 0.2rem 0 0.4rem; }
.pin-dots {
  min-height: 2.4rem;
  margin: 0;
  letter-spacing: 0.35em;
  font-size: 2rem;
}
.pin-pad {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.5rem;
  margin: 0.8rem 0 1rem;
}
.pin-pad button {
  min-height: 64px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--ink);
  font-size: 1.4rem;
}

.setup-body { padding: 1.2rem; display: grid; gap: 1rem; align-content: start; }
.setup-body .btn,
.setup-body a.btn { text-align: center; text-decoration: none; }
.printer-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 0.6rem; }
.printer-list button {
  width: 100%;
  text-align: left;
  padding: 0.9rem 1rem;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: var(--card);
  color: inherit;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 1.2rem;
  transform: translateX(-50%);
  background: var(--deep);
  border: 1px solid var(--line);
  padding: 0.7rem 1rem;
  border-radius: 12px;
  z-index: 20;
}

.save-overlay {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: grid;
  place-items: center;
  padding: 1.2rem;
  background: rgba(8, 5, 3, 0.78);
  backdrop-filter: blur(8px);
}
.save-overlay.hidden { display: none !important; }
.save-card {
  width: min(88vw, 420px);
  padding: 2rem 1.5rem 1.6rem;
  border-radius: 24px;
  text-align: center;
  background: var(--card);
  border: 1px solid var(--line);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.45);
}
.save-card h2 { margin: 0.2rem 0 0.35rem; font-size: 1.7rem; }
.save-card p { margin: 0; color: var(--muted); }
.load-ring {
  width: 86px;
  height: 86px;
  margin: 0 auto 1rem;
  border-radius: 50%;
  background: conic-gradient(from 0deg, transparent 0 25%, var(--gold) 70%, var(--gold-2));
  -webkit-mask: radial-gradient(farthest-side, transparent calc(100% - 9px), #000 0);
  mask: radial-gradient(farthest-side, transparent calc(100% - 9px), #000 0);
  animation: spin 0.85s linear infinite;
}
@keyframes spin { to { transform: rotate(1turn); } }

.print-anim {
  display: flex;
  align-items: center;
  gap: 0.9rem;
  width: min(92vw, 460px);
  padding: 0.85rem 1rem;
  border-radius: 18px;
  text-align: left;
  background: var(--card);
  border: 1px solid var(--line);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.28);
}
.print-anim.hidden { display: none !important; }
.sync-modal {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: grid;
  place-items: center;
  padding: 1.5rem;
  background: rgba(8, 5, 3, 0.72);
}
.sync-modal.hidden { display: none !important; }
.sync-card {
  width: min(92vw, 440px);
  padding: 1.4rem 1.3rem 1.2rem;
  border-radius: 22px;
  text-align: center;
  background: var(--card);
  border: 1px solid var(--line);
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.35);
}
.sync-spinner {
  width: 64px;
  height: 64px;
  margin: 0 auto 0.8rem;
  border-radius: 50%;
  border: 4px solid rgba(240, 212, 138, 0.25);
  border-top-color: var(--gold-2);
  animation: spin 0.8s linear infinite;
}
.sync-modal.is-offline .sync-spinner,
.sync-modal.is-online .sync-spinner { animation: none; border-color: var(--gold-2); }
.sync-card h2 { margin: 0 0 0.35rem; font-size: 1.45rem; }
.sync-card p { margin: 0; color: var(--muted); }
.sync-bar {
  height: 8px;
  margin: 1rem 0 0.4rem;
  border-radius: 99px;
  overflow: hidden;
  background: rgba(0, 0, 0, 0.12);
}
.sync-bar b {
  display: block;
  height: 100%;
  width: 0;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--gold), var(--gold-2));
  transition: width 0.25s ease;
}
.sync-percent { margin-top: 0.35rem; font-weight: 700; color: var(--gold); }
.offline-chip {
  position: absolute;
  top: 0.8rem;
  left: 50%;
  transform: translateX(-50%);
  z-index: 8;
  max-width: min(92vw, 560px);
  margin: 0;
  padding: 0.45rem 0.8rem;
  border-radius: 999px;
  background: rgba(18, 8, 6, 0.88);
  color: #f0d48a;
  border: 1px solid rgba(240, 212, 138, 0.45);
  text-align: center;
  font-size: 0.92rem;
}
.offline-chip.hidden { display: none !important; }
.mini-printer { width: 74px; flex: none; }
.paper-window {
  height: 46px;
  margin: 0 14px;
  overflow: hidden;
  display: flex;
  align-items: flex-end;
}
.paper {
  width: 100%;
  height: 44px;
  padding-top: 4px;
  background: #fffaf3;
  border: 1px solid #e6d7c4;
  border-bottom: 0;
  animation: feed 1.6s ease-in-out infinite;
}
.paper i {
  display: block;
  height: 4px;
  margin: 4px 6px 0;
  border-radius: 2px;
  background: #d9cbb8;
}
.mini-printer-body {
  position: relative;
  height: 48px;
  border-radius: 8px 8px 12px 12px;
  background: linear-gradient(180deg, var(--gold-2), var(--gold));
  box-shadow: inset 0 -6px 0 rgba(0, 0, 0, 0.12);
}
.printer-mouth {
  position: absolute;
  left: 14px;
  right: 14px;
  top: -2px;
  height: 6px;
  border-radius: 2px;
  background: #2a2118;
}
.led {
  position: absolute;
  right: 10px;
  bottom: 12px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #7dff9a;
  box-shadow: 0 0 8px #7dff9a;
  animation: blink 1s steps(2) infinite;
}
@keyframes feed {
  0% { transform: translateY(42px); }
  65% { transform: translateY(0); }
  100% { transform: translateY(0); opacity: 0.35; }
}
@keyframes blink { 50% { opacity: 0.2; } }
.print-copy { min-width: 0; flex: 1; }
.print-copy h2 { margin: 0; font-size: 1.15rem; }
.print-copy p { margin: 0.2rem 0 0; color: var(--muted); font-size: 0.92rem; }
.print-bar {
  margin-top: 0.55rem;
  height: 8px;
  border-radius: 99px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.12);
}
.print-bar b {
  display: block;
  height: 100%;
  width: 0%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--gold), var(--gold-2));
  transition: width 0.15s linear;
}

.guest, .admin {
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 1.2rem;
}
body.guest {
  position: relative;
  background:
    radial-gradient(circle at 50% 0%, var(--start-glow), transparent 48%),
    linear-gradient(180deg, var(--start-mid), var(--start));
}
.guest-glow {
  pointer-events: none;
  position: fixed;
  inset: 0;
  background: radial-gradient(circle at 50% 18%, var(--glow), transparent 42%);
}
.guest-card, .admin-wrap {
  width: min(720px, 100%);
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 24px;
  padding: 1.4rem;
}
.guest-card {
  position: relative;
  z-index: 1;
  text-align: center;
  padding: 1.6rem 1.4rem 1.5rem;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.35);
  background:
    linear-gradient(180deg, rgba(255, 244, 220, 0.04), transparent 28%),
    var(--card);
}
.guest-kicker {
  margin: 0 0 0.45rem;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  font-size: 0.72rem;
  color: var(--gold);
  font-weight: 700;
}
.guest-event {
  margin: 0 0.4rem 0.35rem;
  font-size: clamp(1.6rem, 6vw, 2.4rem);
  line-height: 1.15;
  font-weight: 800;
}
.guest-event.is-script,
.guest-header.is-script,
.guest-footer.is-script { font-weight: 400; }
.guest-header {
  margin: 0 0 1rem;
  color: var(--gold-2);
  font-size: 1.05rem;
  white-space: pre-wrap;
}
.guest-title {
  margin: 0.4rem 0 0.9rem;
  font-size: 1.35rem;
}
.guest-photo-wrap {
  padding: 0.45rem;
  border-radius: 18px;
  background: var(--panel);
  border: 1px solid var(--line);
  margin: 0 auto 1rem;
}
.guest-footer {
  margin: 0 0 1rem;
  color: var(--muted);
  white-space: pre-wrap;
  font-size: 0.95rem;
}
.guest-qr-box {
  display: flex;
  align-items: center;
  gap: 1rem;
  text-align: left;
  margin: 1.2rem 0 0.4rem;
  padding: 0.9rem;
  border-radius: 18px;
  border: 1px solid var(--line);
  background: var(--slot);
}
.guest-qr {
  flex: 0 0 168px;
  width: 168px;
  height: 168px;
  padding: 8px;
  border-radius: 14px;
  background: #fff;
}
.guest-qr canvas,
.guest-qr img {
  width: 100%;
  height: 100%;
  display: block;
}
.guest-qr-title {
  margin: 0 0 0.3rem;
  font-weight: 800;
  color: var(--gold-2);
}
.guest-ttl { margin-top: 0.8rem; }
@media (max-width: 560px) {
  .guest-qr-box {
    flex-direction: column;
    text-align: center;
  }
}
.admin-wide { width: min(980px, 100%); }
.admin-nav { margin-top: 0; }
.admin-form, .admin-card { display: grid; gap: 0.75rem; }
.admin-card {
  margin: 1.1rem 0;
  padding: 1rem 1.1rem 1.15rem;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--tile);
}
.admin-card h2 { margin: 0 0 0.2rem; font-size: 1.15rem; }
.admin-card label, .admin-form label {
  display: grid;
  gap: 0.35rem;
  color: var(--muted);
  font-size: 0.92rem;
}
.admin-card textarea,
.admin-card select,
.admin-card input:not([type="checkbox"]):not([type="file"]),
.stack textarea {
  background: var(--bg);
  border: 1px solid var(--line);
  color: var(--ink);
  padding: 0.7rem 0.8rem;
  border-radius: 12px;
  width: 100%;
  font: inherit;
}
.check {
  display: flex !important;
  flex-direction: row !important;
  align-items: center;
  gap: 0.55rem;
}
.template-box {
  display: grid;
  grid-template-columns: minmax(180px, 280px) 1fr;
  gap: 1rem;
  align-items: center;
}
.template-box img {
  width: 100%;
  border-radius: 10px;
  background: #000;
  border: 1px solid var(--line);
}
.guest-photo {
  width: 100%;
  border-radius: 16px;
  margin: 1rem 0;
}
.guest-actions {
  margin: 1.2rem 0 0;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.7rem;
}
.guest-actions .btn {
  display: inline-flex;
  min-width: 180px;
  justify-content: center;
}
.stack { display: grid; gap: 0.8rem; }
.stack label { display: grid; gap: 0.35rem; color: var(--muted); font-size: 0.92rem; }
.stack input {
  background: var(--bg);
  border: 1px solid var(--line);
  color: var(--ink);
  padding: 0.7rem 0.8rem;
  border-radius: 12px;
}
.error { color: var(--danger); }
.ok { color: var(--ok); }
.frame-list { list-style: none; padding: 0; }
.frame-list li {
  display: grid;
  grid-template-columns: 64px 1fr auto;
  gap: 0.7rem;
  align-items: center;
  margin: 0.6rem 0;
}
.frame-list img {
  width: 96px;
  height: 54px;
  object-fit: contain;
  background: #000;
  border-radius: 8px;
}
.admin a { color: var(--gold); }

body.dash {
  display: block;
  padding: 0;
  min-height: 100dvh;
}
.dash-shell {
  display: grid;
  grid-template-columns: 240px 1fr;
  min-height: 100dvh;
}
.dash-side {
  background: var(--panel);
  border-right: 1px solid var(--line);
  padding: 1.2rem 0.9rem;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}
.dash-brand {
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--gold);
  margin: 0 0.6rem 0.8rem;
}
.dash-side nav { display: grid; gap: 0.25rem; }
.dash-side nav a {
  color: var(--ink);
  text-decoration: none;
  padding: 0.7rem 0.8rem;
  border-radius: 12px;
}
.dash-side nav a.active,
.dash-side nav a:hover {
  background: var(--card);
  color: var(--gold);
}
.dash-side-foot {
  margin-top: auto;
  display: grid;
  gap: 0.4rem;
  padding: 0.8rem;
}
.dash-main {
  padding: 1.4rem 1.6rem 2.4rem;
  overflow: auto;
}
.dash-main h1 { margin: 0 0 0.8rem; font-size: 1.8rem; }
.stat-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.8rem;
  margin-bottom: 1.2rem;
}
.stat {
  background: var(--tile);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 0.9rem 1rem;
}
.stat strong { display: block; font-size: 1.4rem; }
.stat span { color: var(--muted); font-size: 0.85rem; }
.dash-tiles {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.9rem;
}
.dash-tile {
  display: block;
  background: var(--tile);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 1.1rem 1.15rem;
  color: inherit;
  text-decoration: none;
  min-height: 110px;
}
.dash-tile.accent { border-color: var(--gold); }
.dash-tile strong { display: block; font-size: 1.15rem; margin-bottom: 0.35rem; color: var(--gold); }
.dash-tile span { color: var(--muted); font-size: 0.92rem; }
.frame-pick {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 0.8rem;
}
.frame-pick-card {
  display: grid;
  gap: 0.4rem;
  padding: 0.5rem;
  border: 2px solid var(--line);
  border-radius: 14px;
  background: var(--bg);
  cursor: pointer;
}
.frame-pick-card.selected,
.frame-pick-card:has(input:checked) {
  border-color: var(--gold);
}
.frame-pick-card img {
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: contain;
  background: #000;
  border-radius: 8px;
}
.frame-pick-card input { accent-color: var(--gold); }
.photo-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 1rem;
}
.photo-card {
  background: var(--tile);
  border: 1px solid var(--line);
  border-radius: 14px;
  overflow: hidden;
}
.photo-card img {
  width: 100%;
  aspect-ratio: 3 / 4;
  object-fit: cover;
  background: #000;
  display: block;
}
.photo-card p { margin: 0.45rem 0.7rem; font-size: 0.88rem; }
.photo-actions { display: flex; gap: 0.7rem; flex-wrap: wrap; }
@media (max-width: 900px) {
  .dash-shell { grid-template-columns: 1fr; }
  .stat-row, .dash-tiles { grid-template-columns: 1fr 1fr; }
}
