:root {
  --bg: #fff6fb;
  --card: #ffffff;
  --ink: #2b1740;
  --muted: #7a6a8a;
  --accent: #8a4dff;
  --accent2: #ff5fa2;
  --line: #ecdff5;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.4 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  padding: env(safe-area-inset-top) 0 calc(env(safe-area-inset-bottom) + 24px);
}
[hidden] { display: none !important; }
header {
  background: linear-gradient(120deg, var(--accent2), var(--accent));
  color: #fff;
  padding: 14px 16px 16px;
  text-align: center;
}
header h1 { margin: 0; font-size: 1.5rem; font-weight: 900; letter-spacing: .3px; }
header p { margin: 4px 0 0; opacity: .9; font-size: .9rem; }
main { max-width: 640px; margin: 0 auto; padding: 0 16px; }
section {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 12px 14px 14px;
  margin-top: 10px;
}
h2 { font-size: .8rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin: 0 0 10px; }
h3 { font-size: .85rem; margin: 14px 0 6px; color: var(--muted); font-weight: 700; }

/* collapsible settings */
details.card {
  background: var(--card); border: 1px solid var(--line); border-radius: 16px; margin-top: 10px; overflow: hidden;
}
details.card > summary {
  list-style: none; cursor: pointer; display: flex; align-items: center; gap: 10px;
  padding: 13px 14px; font-weight: 800; font-size: .98rem; user-select: none;
}
details.card > summary::-webkit-details-marker { display: none; }
details.card > summary .val {
  margin-left: auto; font-weight: 600; font-size: .82rem; color: var(--muted);
  max-width: 55%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
details.card > summary::after {
  content: ""; width: 8px; height: 8px; flex: none; margin-left: 2px;
  border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted);
  transform: rotate(45deg) translateY(-3px); transition: transform .2s;
}
details.card[open] > summary::after { transform: rotate(-135deg) translate(-2px, -1px); }
details.card[open] > summary { border-bottom: 1px solid var(--line); }
details.card .body { padding: 12px 14px 14px; }
details.card .body > h3:first-child { margin-top: 0; }

/* swipeable rows instead of tall grids */
.hscroll {
  display: grid; grid-auto-flow: column; grid-template-rows: repeat(2, auto);
  grid-auto-columns: max-content; gap: 8px; overflow-x: auto; padding-bottom: 6px;
  -webkit-overflow-scrolling: touch; scrollbar-width: thin; scroll-snap-type: x proximity;
}
.hscroll > * { scroll-snap-align: start; }
.chips.hscroll { display: grid; flex-wrap: nowrap; }
#pmFilters { grid-template-rows: auto; }
.swipe-hint { font-size: .75rem; color: var(--muted); margin: 2px 0 8px; }

button, .btn {
  font: inherit; font-weight: 700; border: 0; border-radius: 999px; padding: 12px 18px;
  cursor: pointer; background: #f1e8fb; color: var(--ink);
}
.row { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.row > * { flex: 1 1 auto; text-align: center; white-space: nowrap; }
.primary { background: linear-gradient(120deg, var(--accent2), var(--accent)); color: #fff; }
.primary:disabled { opacity: .45; cursor: not-allowed; }

.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip {
  padding: 8px 14px; border-radius: 999px; border: 2px solid var(--line); background: #fff;
  font-weight: 700; font-size: .9rem;
}
.chip[aria-pressed="true"] { border-color: var(--accent); background: #f4ecff; }

/* photo slots */
.slots { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 12px; }
.slot {
  position: relative; aspect-ratio: 1; border-radius: 12px; overflow: hidden;
  border: 2px dashed #d7c3ea; background: #faf5ff; cursor: pointer;
  display: flex; align-items: center; justify-content: center; flex-direction: column;
  color: var(--muted); font-weight: 600; font-size: .9rem; padding: 0; font-family: inherit;
}
.slot.filled { border-style: solid; border-color: var(--accent); }
.slot img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.slot .num {
  position: absolute; top: 6px; left: 6px; z-index: 2; background: var(--accent); color: #fff;
  width: 24px; height: 24px; border-radius: 50%; font-size: .8rem; display: flex; align-items: center; justify-content: center;
}
.slot .plus { font-size: 1.6rem; line-height: 1; }
.slot .plus + span { font-size: .75rem; }
.slot input { display: none; }
.slot .adj {
  position: absolute; right: 5px; bottom: 5px; z-index: 2; padding: 5px 9px; font-size: .75rem; font-weight: 700;
  border-radius: 999px; background: rgba(255,255,255,.92); color: var(--ink); box-shadow: 0 2px 8px rgba(0,0,0,.2);
}

/* background tiles */
.tgrid {
  display: grid; grid-auto-flow: column; grid-template-rows: repeat(2, auto); grid-auto-columns: 82px;
  gap: 8px; overflow-x: auto; padding-bottom: 6px; -webkit-overflow-scrolling: touch; scrollbar-width: thin;
}
.tile {
  padding: 0; border: 2px solid var(--line); border-radius: 12px; overflow: hidden; background: #fff;
  display: flex; flex-direction: column; font-size: .68rem; font-weight: 700; color: var(--ink);
}
.tile canvas { width: 100%; aspect-ratio: 3/4; display: block; }
.tile span { padding: 4px 2px; text-align: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tile[aria-pressed="true"] { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent); }
.panel { background: #faf5ff; border-radius: 12px; padding: 10px 12px 12px; margin-top: 12px; }

/* form fields */
label.field { display: block; font-size: .85rem; color: var(--muted); margin-top: 10px; }
label.field input[type=text], select {
  display: block; width: 100%; margin-top: 4px; font: inherit; font-size: 16px; color: var(--ink);
  padding: 10px 12px; border: 2px solid var(--line); border-radius: 12px; background: #fff;
}
.pair { display: flex; gap: 6px; margin-top: 4px; align-items: stretch; }
.pair select { margin-top: 0; flex: 1; min-width: 0; }
input[type=color] {
  width: 48px; min-width: 48px; height: 46px; padding: 3px; border: 2px solid var(--line);
  border-radius: 12px; background: #fff;
}
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 10px; }
input[type=range] { width: 100%; accent-color: var(--accent); }
label.check { display: flex; align-items: center; gap: 8px; margin-top: 12px; font-size: .95rem; }
label.check input { width: 20px; height: 20px; accent-color: var(--accent); }

/* icons */
.iconrow { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.iconbox { font-size: .8rem; color: var(--muted); text-align: center; }
.iconbox input {
  display: block; width: 100%; margin-top: 4px; font-size: 28px; text-align: center; padding: 6px;
  border: 2px solid var(--line); border-radius: 12px; background: #fff; color: var(--ink);
}
.iconbox.active input { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent); }
.emojis {
  display: grid; grid-auto-flow: column; grid-template-rows: repeat(3, auto); grid-auto-columns: 44px;
  gap: 4px; margin-top: 10px; overflow-x: auto; padding-bottom: 6px; -webkit-overflow-scrolling: touch; scrollbar-width: thin;
}
.emojis button { padding: 6px 0; font-size: 1.35rem; background: #faf5ff; border-radius: 10px; font-weight: 400; }
.emojis button.none { font-size: .7rem; font-weight: 700; color: var(--muted); }

.preview-wrap { display: flex; justify-content: center; background: #f6f0fb; border-radius: 12px; padding: 10px; }
#preview { max-width: 100%; max-height: 70vh; height: auto; border-radius: 6px; box-shadow: 0 6px 20px rgba(60,20,90,.2); cursor: pointer; }
.hint { font-size: .8rem; color: var(--muted); text-align: center; margin: 8px 0 0; }

.sticky-save {
  position: sticky; bottom: calc(env(safe-area-inset-bottom) + 10px); margin-top: 14px; z-index: 5;
  display: flex; gap: 8px;
}
.sticky-save button { font-size: 1.05rem; padding: 15px; box-shadow: 0 8px 24px rgba(138,77,255,.3); }
.sticky-save #save { flex: 1; }
.sticky-save #jump { background: #fff; border: 2px solid var(--line); padding: 3px; display: flex; align-items: center; justify-content: center; }
.sticky-save #jump canvas { display: block; height: 50px; width: auto; border-radius: 6px; }
#stItems button.txt[aria-pressed="true"] { box-shadow: inset 0 0 0 3px var(--accent); background: #fdf0ff; color: #2b1740; }

#toast {
  position: fixed; left: 50%; bottom: 90px; transform: translateX(-50%); background: #2b1740; color: #fff;
  padding: 10px 16px; border-radius: 999px; font-size: .9rem; opacity: 0; transition: opacity .25s; pointer-events: none; z-index: 60;
}
#toast.show { opacity: 1; }
.design-chip { display: inline-flex; align-items: center; gap: 2px; }
.design-chip .x { border: 0; background: none; color: var(--muted); padding: 4px 6px; font-size: .8rem; }
.field.slider { display: grid; grid-template-columns: 110px 1fr; align-items: center; gap: 8px; margin-top: 6px; }
.opt-search { width: 100%; padding: 9px 14px; border-radius: 999px; border: 2px solid var(--line); font: inherit; font-size: .9rem; margin: 0 0 8px; background: #fff; }
.opt-search:focus { outline: none; border-color: var(--accent); }
.chips.seg { justify-content: center; margin-bottom: 8px; }
.counts-row { display: flex; align-items: center; gap: 8px; justify-content: center; flex-wrap: wrap; }
.counts-row #countsLabel { font-size: .85rem; font-weight: 700; color: var(--muted); }
.chips.nums { gap: 5px; }
.chips.nums .chip { padding: 6px 11px; min-width: 34px; }
.app-mode { display: inline-flex; margin-top: 10px; background: rgba(255,255,255,.22); border-radius: 999px; padding: 4px; }
.app-mode button { border: 0; background: none; color: #fff; font-weight: 800; font-size: .95rem; padding: 8px 18px; border-radius: 999px; }
.app-mode button[aria-selected="true"] { background: #fff; color: var(--accent); box-shadow: 0 2px 8px rgba(0,0,0,.12); }
body.mode-video .only-photo, body.mode-photo .only-video { display: none !important; }
body:not(.mode-booth) .only-booth, body:not(.mode-collage) .only-collage { display: none !important; }
.app-mode button { padding: 8px 12px; }
.sticky-save .vidbtn { flex: 1; }
.app-foot { text-align: center; font-size: .8rem; color: var(--muted); padding: 18px 16px 90px; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 10px; }
.grid3 input[type=color] { width: 100%; height: 38px; }
.palettes .chip { border-width: 0; color: #fff; text-shadow: 0 1px 2px rgba(0,0,0,.35); font-size: .82rem; padding: 8px 12px; }
.palettes .chip[aria-pressed="true"] { box-shadow: 0 0 0 3px var(--accent); }
.linkbtn { background: none; border: 0; padding: 0; color: var(--accent); font: inherit; font-weight: 700; text-decoration: underline; cursor: pointer; }
#updateBar {
  position: fixed; left: 50%; top: calc(env(safe-area-inset-top) + 10px); transform: translateX(-50%); z-index: 60;
  display: flex; align-items: center; gap: 10px; background: #2b1740; color: #fff; font-size: .9rem;
  padding: 6px 6px 6px 14px; border-radius: 999px; box-shadow: 0 6px 20px rgba(0,0,0,.25); white-space: nowrap;
}
#updateBar button { padding: 7px 12px; font-size: .85rem; }

/* save sheet */
#saveSheet, .overlay {
  position: fixed; inset: 0; z-index: 25; background: rgba(20,10,31,.85);
  display: flex; align-items: center; justify-content: center; padding: 16px;
}
.sheet {
  background: #fff; border-radius: 18px; padding: 14px; width: 100%; max-width: 520px;
  max-height: 92vh; overflow: auto; text-align: center;
}
.sheet h2 { font-size: 1rem; color: var(--ink); text-transform: none; letter-spacing: 0; margin: 2px 0 10px; }
#savedImg {
  display: block; width: 100%; max-height: 55vh; object-fit: contain; border-radius: 8px;
  background: #f6f0fb; -webkit-touch-callout: default; user-select: auto;
}
.sheet .hint { font-size: .9rem; color: var(--ink); background: #faf5ff; border-radius: 10px; padding: 8px 10px; margin-top: 10px; }
.sheet a.btn { text-decoration: none; display: inline-flex; align-items: center; justify-content: center; }
.save-modes { justify-content: center; margin-bottom: 10px; flex-wrap: nowrap; }
.save-modes.music .chip { flex: none; white-space: nowrap; }
.save-modes.music { flex-wrap: nowrap; overflow-x: auto; justify-content: flex-start; margin: 10px 0 0; scrollbar-width: none; }
.size-row { display: flex; gap: 6px; justify-content: center; margin: 8px 0 0; flex-wrap: wrap; }
.size-row select { font: inherit; font-size: .82rem; padding: 6px 8px; border-radius: 10px; border: 2px solid var(--line); background: #fff; color: var(--ink); max-width: 100%; }
.size-chips { display: flex; gap: 6px; overflow-x: auto; padding: 10px 2px 4px; scrollbar-width: thin; }
.size-chips button {
  flex: none; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; gap: 4px;
  min-width: 64px; height: 70px; padding: 6px 6px 5px; border-radius: 12px; border: 2px solid var(--line);
  background: #fff; color: var(--ink); font: inherit; font-size: .72rem; line-height: 1.1;
}
.size-chips button[aria-pressed="true"] { border-color: var(--accent); background: #fdf0ff; font-weight: 700; }
.size-chips .shape { display: block; border: 2px solid currentColor; border-radius: 3px; opacity: .75; }
.size-chips .shape.orig { border-style: dashed; }
.fit-chips { justify-content: center; margin-top: 6px; }
.fit-chips .chip { padding: 5px 10px; font-size: .78rem; }
.crop-cv { display: block; max-width: 100%; max-height: 55vh; margin: 0 auto; border-radius: 8px; touch-action: none; cursor: grab; background: #f6f0fb; }
#vidPreview.draggable { touch-action: none; cursor: grab; }
.crop-cv:active { cursor: grabbing; }
.linkish { background: none; border: 0; padding: 0; font: inherit; color: var(--accent); text-decoration: underline; cursor: pointer; }
.size-note { font-size: .78rem; color: #6b5a7a; margin: 4px 0 0; min-height: 1em; }
.save-modes .chip { padding: 7px 12px; font-size: .85rem; }
.save-picks { display: flex; gap: 8px; justify-content: center; margin-top: 8px; overflow-x: auto; }
.save-picks button { flex: none; padding: 0; width: 56px; height: 56px; border-radius: 10px; overflow: hidden; border: 3px solid transparent; background: none; }
.save-picks button[aria-pressed="true"] { border-color: var(--accent); }
.save-picks img { width: 100%; height: 100%; object-fit: cover; display: block; }
#sheetClose, .sheet .cancel { margin-top: 8px; width: 100%; background: transparent; color: var(--muted); }
#pmImg { display: block; margin: 0 auto; max-width: 100%; max-height: 32vh; border-radius: 10px; object-fit: contain; }
.menu-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 12px; }
.menu-grid button { padding: 13px 8px; }
.menu-grid .wide { grid-column: 1 / -1; }
.menu-grid .danger { background: #ffe3e8; color: #b0103a; }
.menu-grid button:disabled { opacity: .35; }

.ftiles .tile canvas { aspect-ratio: 1; }
.btnrow { display: flex; gap: 8px; margin-top: 10px; }
.btnrow > * { flex: 1; }

/* camera */
#camera { position: fixed; inset: 0; z-index: 40; background: #000; color: #fff; overflow: hidden; }
#camVideo { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; background: #000; }
#camOverlay { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
#camPropsBtn[aria-pressed="true"] { background: #ff5fa2; }
.cam-strip.props button { padding: 3px; width: 52px; height: 52px; border-radius: 14px; display: flex; align-items: center; justify-content: center; font-size: 1.6rem; }
.cam-strip.props button canvas, .cam-strip.props button img { width: 44px; height: 44px; object-fit: contain; pointer-events: none; }
.cam-strip.props button.paint { width: auto; min-width: 56px; padding: 3px 6px; }
.cam-strip.props .pt { display: flex; flex-direction: column; align-items: center; line-height: 1; pointer-events: none; }
.cam-strip.props .pt b { font-size: 1.35rem; font-weight: 400; }
.cam-strip.props .pt small { font-size: .58rem; font-weight: 700; margin-top: 3px; white-space: nowrap; }
.cam-strip.props .sep { flex: none; width: 2px; margin: 8px 4px; background: rgba(255,255,255,.35); border-radius: 2px; }
.cam-strip.props button[aria-pressed="true"] { background: #fff; box-shadow: 0 0 0 3px #ff5fa2 inset; }
.cam-top {
  position: absolute; top: 0; left: 0; right: 0; display: flex; align-items: center; gap: 8px;
  padding: calc(env(safe-area-inset-top) + 10px) 12px 18px; background: linear-gradient(rgba(0,0,0,.6), transparent);
}
.cam-top .title { flex: 1; text-align: center; font-weight: 800; font-size: .95rem; text-shadow: 0 1px 3px rgba(0,0,0,.6); }
.cam-btn {
  background: rgba(0,0,0,.45); color: #fff; border: 0; border-radius: 999px; padding: 10px 14px; font-weight: 700;
  -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
}
.cam-bottom {
  position: absolute; left: 0; right: 0; bottom: 0;
  padding: 24px 12px calc(env(safe-area-inset-bottom) + 14px); background: linear-gradient(transparent, rgba(0,0,0,.7) 35%);
}
.cam-strip { display: flex; gap: 6px; overflow-x: auto; padding: 2px 2px 8px; scrollbar-width: none; }
.cam-strip::-webkit-scrollbar { display: none; }
.cam-strip button {
  flex: none; padding: 7px 12px; font-size: .85rem; border-radius: 999px; background: rgba(255,255,255,.18); color: #fff; border: 0;
}
.cam-strip button[aria-pressed="true"] { background: #fff; color: #2b1740; }
.cam-strip.small button { padding: 5px 10px; font-size: .75rem; }
.cam-controls { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; margin-top: 6px; }
.cam-controls .left { justify-self: start; }
.cam-controls .right { justify-self: end; }
#camShutter {
  width: 78px; height: 78px; border-radius: 50%; background: #fff; padding: 0;
  border: 5px solid rgba(255,255,255,.45); background-clip: padding-box; transition: transform .15s;
}
#camShutter.video { background-color: #ff3b5c; }
#camShutter.busy { transform: scale(.86); }
.cam-zoom { display: flex; justify-content: center; gap: 6px; margin-bottom: 8px; }
.cam-zoom button { width: 40px; height: 40px; border-radius: 50%; border: 0; background: rgba(0,0,0,.45); color: #fff; font-weight: 800; font-size: .78rem; padding: 0; }
.cam-zoom button[aria-pressed="true"] { background: #fff; color: #2b1740; width: 46px; height: 46px; margin-top: -3px; font-size: .85rem; }
#camZoomLabel { position: absolute; left: 50%; top: 42%; transform: translate(-50%, -50%); background: rgba(0,0,0,.55); color: #fff;
  font-weight: 900; font-size: 1.6rem; padding: 8px 18px; border-radius: 999px; pointer-events: none; }
.cam-kind { display: flex; justify-content: center; gap: 0; margin: 0 auto 8px; background: rgba(0,0,0,.45); border-radius: 999px; padding: 3px; width: max-content; }
.cam-kind button { border: 0; background: none; color: #fff; font-weight: 800; padding: 7px 16px; border-radius: 999px; font-size: .9rem; }
.cam-kind button[aria-selected="true"] { background: #fff; color: #2b1740; }
.vidbtn { background: linear-gradient(120deg, #ff8a3d, #ff5fa2) !important; }
.preview-wrap.vid canvas { max-height: 60vh; }
#vidPrevHint.dirty { background: #fff4d6; color: #7a4b00; border-radius: 10px; padding: 8px 10px; }
#camShots { display: flex; gap: 6px; justify-content: center; margin-bottom: 6px; min-height: 0; }
#camShots span {
  width: 40px; height: 40px; border-radius: 8px; border: 2px solid rgba(255,255,255,.7);
  background: rgba(255,255,255,.12) center / cover no-repeat;
}
#camHint { text-align: center; font-size: .8rem; opacity: .9; margin-top: 8px; text-shadow: 0 1px 2px #000; }
#camCount {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; pointer-events: none;
  font-size: 34vw; font-weight: 900; color: #fff; text-shadow: 0 6px 30px rgba(0,0,0,.5);
}
#camCount.pulse { animation: camPulse 1s ease-out; }
@keyframes camPulse { from { transform: scale(1.5); opacity: 0; } 25% { opacity: 1; } to { transform: scale(.92); opacity: .9; } }
#camRec {
  position: absolute; top: calc(env(safe-area-inset-top) + 64px); left: 50%; transform: translateX(-50%);
  background: #ff3b5c; padding: 6px 14px; border-radius: 999px; font-weight: 800;
}
#camFlash { position: absolute; inset: 0; background: #fff; opacity: 0; pointer-events: none; }
#camFlash.go { animation: camFlash .4s ease-out; }
@keyframes camFlash { from { opacity: 1; } to { opacity: 0; } }
#camReview, #camError {
  position: absolute; inset: 0; background: #140a1f; display: flex; flex-direction: column; align-items: center;
  justify-content: center; padding: 24px 16px; text-align: center; gap: 14px; overflow: auto;
}
#camReview h2, #camError h2 { color: #fff; text-transform: none; letter-spacing: 0; font-size: 1.1rem; margin: 0; }
#reviewGrid { display: grid; gap: 10px; width: 100%; max-width: 440px; }
#reviewGrid button {
  padding: 0; border-radius: 12px; overflow: hidden; position: relative; aspect-ratio: 3/4; background: #000;
  border: 2px solid rgba(255,255,255,.3);
}
#reviewGrid img { width: 100%; height: 100%; object-fit: cover; display: block; }
#reviewGrid span {
  position: absolute; left: 6px; bottom: 6px; background: rgba(0,0,0,.65); color: #fff; font-size: .75rem;
  padding: 4px 8px; border-radius: 999px;
}
#camReview .btnrow, #camError .btnrow { width: 100%; max-width: 440px; }
#camReview button:not(.primary), #camError button:not(.primary) { background: rgba(255,255,255,.14); color: #fff; }

#making {
  position: fixed; inset: 0; z-index: 45; background: #140a1f; color: #fff; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 14px; padding: 20px; text-align: center;
}
#makingWrap canvas { display: block; max-width: 78vw; max-height: 68vh; border-radius: 10px; box-shadow: 0 10px 40px rgba(0,0,0,.5); }
#videoSheet { z-index: 26; }
#saveSheet { z-index: 30; }
#textSheet { z-index: 50; background: rgba(20,10,31,.55); align-items: flex-end; }
#txtInput { width: 100%; font: inherit; font-size: 1.1rem; padding: 10px 12px; border-radius: 12px; border: 2px solid var(--line); resize: vertical; }
#outVideo { display: block; width: 100%; max-height: 50vh; border-radius: 8px; background: #000; }
.sheet .btnrow button, .sheet .btnrow a { padding: 12px 8px; font-size: .92rem; }

/* party mode */
#party { position: fixed; inset: 0; z-index: 38; color: #fff; background: linear-gradient(140deg, #ff5fa2, #8a4dff 60%, #3d1a8a);
  display: flex; align-items: center; justify-content: center; padding: env(safe-area-inset-top) 16px env(safe-area-inset-bottom); overflow: hidden; }
.party-attract { text-align: center; display: flex; flex-direction: column; align-items: center; gap: 14px; }
.party-emoji { font-size: clamp(64px, 16vmin, 140px); animation: partybob 1.6s ease-in-out infinite; }
@keyframes partybob { 50% { transform: translateY(-12px) rotate(-6deg); } }
.party-title { font-size: clamp(28px, 7vmin, 64px); font-weight: 900; text-shadow: 0 3px 0 rgba(0,0,0,.15); line-height: 1.1; }
.party-title.small { font-size: clamp(22px, 4.5vmin, 36px); }
.party-sub { font-size: clamp(16px, 3vmin, 24px); opacity: .9; }
.party-go { margin-top: 10px; font-size: clamp(22px, 5vmin, 40px); font-weight: 900; padding: .7em 1.6em; border-radius: 999px; border: 0;
  background: #fff; color: #8a4dff; box-shadow: 0 10px 30px rgba(0,0,0,.25); animation: partypulse 1.4s ease-in-out infinite; }
@keyframes partypulse { 50% { transform: scale(1.06); } }
.party-note { font-size: .9rem; opacity: .8; min-height: 1.2em; }
.party-result { display: flex; gap: 24px; align-items: center; justify-content: center; width: 100%; height: 100%; padding: 16px 0; }
.party-result img { max-height: 100%; max-width: 55%; border-radius: 10px; box-shadow: 0 12px 40px rgba(0,0,0,.35); object-fit: contain; }
.party-side { display: flex; flex-direction: column; gap: 10px; align-items: stretch; min-width: 200px; text-align: center; }
.party-btn { font-size: 1.1rem; font-weight: 800; padding: 14px 18px; border-radius: 16px; border: 0; background: rgba(255,255,255,.2); color: #fff; }
.party-btn.primary { background: #fff; color: #8a4dff; }
.party-qr { display: flex; flex-direction: column; align-items: center; gap: 6px; font-size: .85rem; margin-top: 6px; }
.party-qr canvas { background: #fff; border-radius: 10px; padding: 6px; width: 120px; height: 120px; }
@media (max-aspect-ratio: 1/1) { .party-result { flex-direction: column; } .party-result img { max-width: 100%; max-height: 55%; } }
.party-exit { position: absolute; top: calc(env(safe-area-inset-top) + 10px); right: 12px; width: 40px; height: 40px; border-radius: 50%;
  border: 0; background: rgba(0,0,0,.2); color: rgba(255,255,255,.7); font-size: 1rem; }
.party-exit.holding { background: conic-gradient(#fff var(--p, 0%), rgba(0,0,0,.2) 0); color: #8a4dff; }
#camera.party #camModes, #camera.party #camFilters, #camera.party #camTimer, #camera.party #camExtra { display: none !important; }
.gallery-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(80px, 1fr)); gap: 8px; max-height: 50vh; overflow-y: auto; margin: 10px 0; }
.gallery-grid button { padding: 0; border: 0; background: #eee; border-radius: 8px; overflow: hidden; aspect-ratio: 3 / 4; }
.gallery-grid img { width: 100%; height: 100%; object-fit: cover; display: block; }
@media print { @page { margin: 0; } body { padding: 0 !important; background: #fff !important; } body > *:not(#printArea) { display: none !important; } #printArea { display: block !important; } #printArea img { width: 100%; display: block; } }
#printArea { display: none; }

/* collage cut editor */
#cutEd { position: fixed; inset: 0; z-index: 44; background: #140a1f; color: #fff; display: flex; flex-direction: column;
  padding: env(safe-area-inset-top) 0 env(safe-area-inset-bottom); }
#cutEd .ed-top button { background: rgba(255,255,255,.14); color: #fff; }
#cutEd .ed-top button.primary { background: linear-gradient(120deg, var(--accent2), var(--accent)); }
#cutEd .ed-left { display: flex; gap: 6px; }
#cutCanvas { flex: 1 1 auto; width: 100%; min-height: 0; touch-action: none; }
.cut-bar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; justify-content: center; padding: 10px; }
.cut-bar button { background: rgba(255,255,255,.16); color: #fff; }

/* sticker studio */
#stickerEd {
  position: fixed; inset: 0; z-index: 35; background: #140a1f; color: #fff; display: flex; flex-direction: column;
  padding: env(safe-area-inset-top) 0 env(safe-area-inset-bottom);
}
#stickerEd .ed-top button { background: rgba(255,255,255,.14); color: #fff; }
#stickerEd .ed-left { display: flex; gap: 6px; }
#stickerEd .ed-left button { padding: 8px 11px; min-width: 40px; }
#stickerEd .ed-top button:disabled { opacity: .35; }
#stickerEd .ed-top button.primary { background: linear-gradient(120deg, var(--accent2), var(--accent)); }
.dlbar { height: 4px; background: rgba(255,255,255,.12); margin: 0 14px; border-radius: 4px; overflow: hidden; }
.dlbar i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--accent2), var(--accent)); transition: width .3s; }
#stCanvas { flex: 1 1 auto; width: 100%; min-height: 0; touch-action: none; }
.st-panel { background: #1a1029; padding: 4px 0 6px; }
.st-tools { display: flex; gap: 6px; padding: 4px 10px; overflow-x: auto; scrollbar-width: none; }
.st-tools::-webkit-scrollbar { display: none; }
.st-tools button { flex: none; }
@media (min-width: 560px) { .st-tools { justify-content: center; } }
.st-style { padding: 2px 10px 0; }
.st-row { display: flex; align-items: center; gap: 8px; margin-top: 4px; min-width: 0; }
.st-row .lbl { flex: none; width: 52px; font-size: .75rem; font-weight: 700; opacity: .7; }
.st-row .chips, .swatches { display: flex; gap: 6px; overflow-x: auto; flex-wrap: nowrap; scrollbar-width: none; padding: 2px; }
.st-row .chips .chip { flex: none; background: transparent; color: #fff; border-color: rgba(255,255,255,.25); padding: 5px 11px; font-size: .85rem; }
.st-row .chips .chip[aria-pressed="true"] { background: #fff; color: var(--ink); }
.swatch {
  flex: none; width: 30px; height: 30px; min-width: 0; padding: 0; border-radius: 50%; border: 2px solid rgba(255,255,255,.35);
  display: inline-flex; align-items: center; justify-content: center; font-size: 1rem; color: #fff; cursor: pointer; position: relative;
}
.swatch.none { background: transparent; }
.swatch[aria-pressed="true"] { border-color: #fff; box-shadow: 0 0 0 2px #ff5fa2; }
.swatch.custom { background: conic-gradient(#ff595e, #ffca3a, #8ac926, #1982c4, #6a4c93, #ff595e); overflow: hidden; }
.swatch.custom input { position: absolute; inset: 0; opacity: 0; width: 100%; height: 100%; cursor: pointer; border: 0; padding: 0; }
.st-tools button { background: rgba(255,255,255,.16); color: #fff; padding: 9px 12px; font-size: 1rem; min-width: 44px; }
.st-tools button.danger { background: #b0103a; }
.st-tools button[aria-pressed="true"] { background: #ff5fa2; }
.st-tray { background: #1f1330; padding: 8px 10px 10px; }
.st-tabs { margin-bottom: 8px; }
.st-tabs .chip { background: transparent; color: #fff; border-color: rgba(255,255,255,.25); padding: 6px 12px; font-size: .85rem; }
.st-tabs .chip[aria-pressed="true"] { background: #fff; color: var(--ink); border-color: #fff; }
.st-items {
  display: grid; grid-auto-flow: column; grid-template-rows: repeat(2, 64px); grid-auto-columns: 64px; gap: 6px;
  overflow-x: auto; padding-bottom: 4px; -webkit-overflow-scrolling: touch;
}
.st-items button {
  padding: 0; border-radius: 12px; background: rgba(255,255,255,.1); color: #fff; font-size: 2rem; font-weight: 400;
  display: flex; align-items: center; justify-content: center; overflow: hidden;
}
.st-items button canvas { width: 56px; height: 56px; }
.st-items button.txt { font-size: .7rem; font-weight: 800; line-height: 1.15; padding: 4px; }
.st-items button.wide { grid-row: span 2; grid-column: span 2; font-size: .8rem; }
.st-items button img { width: 54px; height: 54px; object-fit: contain; pointer-events: none; }
.st-items.grid {
  grid-auto-flow: row; grid-template-rows: none; grid-template-columns: repeat(auto-fill, minmax(44px, 1fr)); grid-auto-rows: 44px;
  overflow-x: hidden; overflow-y: auto; height: 140px; gap: 4px;
}
.st-items.grid button { font-size: 1.7rem; border-radius: 10px; }
.st-items.grid button.wide { grid-column: 1 / -1; grid-row: auto; width: auto; }
.st-cats { display: flex; flex-direction: column; gap: 6px; margin-bottom: 6px; }
.st-cats input { width: 100%; padding: 8px 12px; border-radius: 999px; border: 0; font: inherit; font-size: .9rem; }
.st-cats .chips { display: flex; gap: 4px; overflow-x: auto; flex-wrap: nowrap; scrollbar-width: none; }
.st-cats .chip { flex: none; background: transparent; border-color: rgba(255,255,255,.2); padding: 4px 9px; font-size: 1.1rem; }
.st-cats .chip[aria-pressed="true"] { background: rgba(255,255,255,.9); }

/* editor */
#editor {
  position: fixed; inset: 0; z-index: 20; background: #140a1f; color: #fff;
  display: flex; flex-direction: column;
  padding: env(safe-area-inset-top) 0 env(safe-area-inset-bottom);
}
.ed-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 12px 16px; }
.ed-top .title { font-weight: 800; }
.ed-top .sub { font-size: .8rem; opacity: .75; }
.ed-top button { background: rgba(255,255,255,.14); color: #fff; padding: 8px 14px; }
#edCanvas { flex: 1 1 auto; width: 100%; min-height: 0; touch-action: none; cursor: grab; }
.ed-controls { padding: 10px 16px 14px; }
.zoomrow { display: flex; align-items: center; gap: 10px; font-size: 1.1rem; }
.zoomrow input { flex: 1; accent-color: #ff5fa2; height: 28px; }
.ed-controls .row button:not(.primary) { background: rgba(255,255,255,.14); color: #fff; }

.paint-badge { margin: 0 0 8px; padding: 6px 10px; border-radius: 10px; background: #fff3e0; color: #7a4a00; font-size: .85rem; font-weight: 700; text-align: center; }
.paint-badge .linkbtn { font-size: .85rem; }

/* the bottom of the sticker studio shows either the tray (to add) or the selected sticker's tools, at a steady height,
   so the picture above never jumps in size */
.st-bottom { flex: none; height: min(290px, 44vh); display: flex; flex-direction: column; background: #1f1330; }
.st-bottom > .st-panel, .st-bottom > .st-tray { flex: 1 1 auto; min-height: 0; overflow-y: auto; }
.st-bottom > .st-tray { display: flex; flex-direction: column; }
.st-bottom > .st-tray .st-items { flex: 1 1 auto; min-height: 0; }
.st-bottom > .st-tray .st-items.grid { height: auto; }
.st-tools button { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 6px 9px; min-width: 54px; }
.st-tools button b { font-weight: 400; font-size: 1.05rem; line-height: 1.1; }
.st-tools button small { font-size: .62rem; font-weight: 700; opacity: .85; white-space: nowrap; }
.st-tools button.add { background: #fff; color: #2b1740; }

.reset-list { display: flex; flex-direction: column; gap: 8px; margin-top: 12px; }
.reset-list button { display: flex; flex-direction: column; align-items: flex-start; text-align: left; gap: 3px; padding: 12px 14px; border-radius: 14px; }
.reset-list button b { font-size: .98rem; }
.reset-list button small { font-weight: 600; font-size: .78rem; opacity: .75; line-height: 1.3; }
.reset-list button.danger { background: #fde8ee; color: #a3123a; }
