:root {
  --cream: #f8f3ec;
  --paper: #fffdf9;
  --ink: #3b2420;
  --ink-soft: #6f5a52;
  --line: #e6dbcf;
  --accent: #7a2e3a;
  --accent-soft: #f1e1e0;
  --ok: #3f6b4a;
  --warn: #9a5b12;
  --danger: #a23131;
  --radius: 16px;
  --serif: "Cormorant Garamond", Georgia, "Times New Roman", serif;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--cream); color: var(--ink);
  font: 16px/1.5 var(--sans); min-height: 100vh; min-height: 100dvh;
}
a { color: var(--accent); }
img, video { max-width: 100%; display: block; }
.wrap { max-width: 560px; margin: 0 auto; padding: 24px max(16px, env(safe-area-inset-right)) calc(64px + env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left)); }
.wrap.wide { max-width: 1100px; }

/* hero */
.hero { text-align: center; padding: 28px 8px 20px; }
.pill {
  display: inline-block; padding: 5px 14px; border-radius: 999px; background: var(--paper);
  border: 1px solid var(--line); font-size: 11px; letter-spacing: .14em; text-transform: uppercase;
}
.hero h1 { font: 500 44px/1.1 var(--serif); margin: 14px 0 8px; }
.meta { font-size: 12px; letter-spacing: .12em; text-transform: uppercase; color: var(--ink-soft); }
.lede { font: italic 20px/1.4 var(--serif); color: var(--ink-soft); margin: 18px 0 0; }

/* cards & forms */
.card { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; }
.stack > * + * { margin-top: 14px; }
label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 6px; }
input[type=text], input[type=password], input[type=date], textarea {
  width: 100%; padding: 12px 14px; border-radius: 12px; border: 1px solid var(--line);
  background: var(--field, #fff); color: var(--ink); font: 16px var(--sans);
}
textarea { min-height: 84px; resize: vertical; }
input:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: 1px; border-color: transparent; }
.hint { font-size: 12px; color: var(--ink-soft); margin-top: 6px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 14px 18px; border-radius: 999px; border: 1px solid transparent; cursor: pointer;
  font: 600 15px var(--sans); text-decoration: none; background: var(--accent); color: var(--on-accent, #fff);
  -webkit-tap-highlight-color: transparent;
}
.btn:active { transform: scale(.98); }
.btn[disabled] { opacity: .5; cursor: default; }
.btn.block { width: 100%; }
.btn.ghost { background: var(--paper); color: var(--ink); border-color: var(--line); }
.btn.small { padding: 8px 12px; font-size: 13px; }
.btn.danger { background: var(--paper); color: var(--danger); border-color: #e9c9c9; }
.row { display: flex; gap: 10px; }
.row > * { flex: 1; }
.center { text-align: center; }
.muted { color: var(--ink-soft); }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* upload queue */
.queue { list-style: none; padding: 0; margin: 0; }
.queue li { display: flex; gap: 12px; align-items: center; padding: 10px 0; border-top: 1px solid var(--line); }
.queue li:first-child { border-top: 0; }
.queue .thumb { width: 52px; height: 52px; border-radius: 10px; background: var(--accent-soft); object-fit: cover; flex: none; }
.queue .info { flex: 1; min-width: 0; }
.queue .name { font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.queue .status { font-size: 12px; color: var(--ink-soft); }
.queue .status.ok { color: var(--ok); }
.queue .status.err { color: var(--danger); }
.bar { height: 6px; background: var(--accent-soft); border-radius: 99px; overflow: hidden; margin-top: 6px; }
.bar i { display: block; height: 100%; width: 0; background: var(--accent); transition: width .2s; }

.toast {
  position: fixed; left: 50%; bottom: calc(20px + env(safe-area-inset-bottom)); transform: translateX(-50%) translateY(140px);
  background: #2a201d; color: #fff; padding: 12px 18px; border-radius: 999px; font-size: 14px;
  transition: transform .25s; z-index: 50; max-width: calc(100% - 32px); text-align: center;
}
.toast.show { transform: translateX(-50%) translateY(0); }

/* gallery */
.grid { columns: 2; column-gap: 10px; }
@media (min-width: 700px) { .grid { columns: 3; } }
@media (min-width: 1000px) { .grid { columns: 4; } }
.tile {
  break-inside: avoid; margin-bottom: 10px; border-radius: 14px; overflow: hidden; background: var(--paper);
  border: 1px solid var(--line); position: relative; cursor: pointer;
}
.tile img, .tile video { width: 100%; height: auto; background: var(--accent-soft); }
.tile .play {
  position: absolute; top: 10px; right: 10px; background: rgba(0,0,0,.55); color: #fff; border-radius: 99px;
  font-size: 11px; padding: 3px 9px;
}
.tile .cap { padding: 8px 10px 10px; font-size: 12px; color: var(--ink-soft); }
.tile .cap b { display: block; font-weight: 600; color: var(--ink); }
.tile .cap i { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; margin-top: 2px; font: italic 15px/1.3 var(--serif); color: var(--ink); }
.tile.wish { padding: 16px; cursor: default; background: var(--accent-soft); border-color: transparent; }
.tile.wish p { font: italic 19px/1.35 var(--serif); margin: 0 0 8px; color: var(--ink); }
.tile.wish span { font-size: 12px; color: var(--ink-soft); }
.tile.noprev { aspect-ratio: 1; display: flex; align-items: center; justify-content: center; text-align: center; padding: 12px; font-size: 13px; color: var(--ink-soft); }
.tile.new { animation: pop .5s ease; }
@keyframes pop { from { transform: scale(.94); opacity: 0; } to { transform: none; opacity: 1; } }

.lightbox {
  position: fixed; inset: 0; background: rgba(20,12,10,.94); z-index: 40; display: none;
  flex-direction: column; align-items: center; justify-content: center; padding: 56px 12px 16px;
}
.lightbox.open { display: flex; }
.lightbox .media { flex: 1; min-height: 0; display: flex; align-items: center; justify-content: center; width: 100%; }
.lightbox img, .lightbox video { max-height: 100%; max-width: 100%; object-fit: contain; border-radius: 8px; }
.lightbox .lb-cap { color: #f3e8e0; text-align: center; padding: 12px 8px 4px; font-size: 14px; }
.lightbox .lb-cap em { font: italic 18px var(--serif); display: block; }
.lb-btn {
  position: absolute; background: rgba(255,255,255,.12); color: #fff; border: 0; width: 44px; height: 44px;
  border-radius: 99px; font-size: 22px; cursor: pointer;
}
.lb-close { top: 10px; right: 10px; }
.lb-prev { left: 10px; top: 50%; }
.lb-next { right: 10px; top: 50%; }

.empty { text-align: center; padding: 48px 16px; color: var(--ink-soft); }
.empty h2 { font: 500 28px var(--serif); color: var(--ink); margin: 0 0 6px; }

/* admin */
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.stat { background: var(--paper); border: 1px solid var(--line); border-radius: 12px; padding: 10px; text-align: center; }
.stat b { display: block; font: 600 22px var(--serif); }
.stat span { font-size: 11px; color: var(--ink-soft); text-transform: uppercase; letter-spacing: .08em; }
.switch { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 6px 0; }
.switch input { width: 46px; height: 26px; accent-color: var(--accent); flex: none; }
.switch .hint { display: block; margin-top: 2px; }
.admin-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
@media (min-width: 700px) { .admin-grid { grid-template-columns: repeat(4, 1fr); } }
.aitem { background: var(--paper); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; display: flex; flex-direction: column; }
.aitem.hidden { opacity: .55; }
.aitem .pv { text-decoration: none; color: var(--ink); aspect-ratio: 1; background: var(--accent-soft); display: flex; align-items: center; justify-content: center; overflow: hidden; }
.aitem .pv img, .aitem .pv video { width: 100%; height: 100%; object-fit: cover; }
.aitem .pv p { font: italic 15px var(--serif); padding: 10px; margin: 0; }
.aitem .ab { padding: 8px; font-size: 12px; }
.aitem { min-width: 0; }
.aitem .acts { display: flex; gap: 6px; padding: 0 8px 8px; margin-top: auto; }
.aitem .acts .btn { flex: 1 1 0; min-width: 0; padding: 8px 4px; font-size: 12px; }
.tabs { display: flex; gap: 6px; flex-wrap: wrap; }
.tabs button { border: 1px solid var(--line); background: var(--paper); border-radius: 99px; padding: 7px 14px; font: 600 13px var(--sans); color: var(--ink); cursor: pointer; }
.tabs button.on { background: var(--ink); color: var(--on-ink, #fff); border-color: var(--ink); }
.linkrow { display: flex; gap: 8px; align-items: center; }
.linkrow code { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; background: #fff; border: 1px solid var(--line); border-radius: 8px; padding: 8px; font-size: 12px; }
.qr { width: 160px; border-radius: 12px; border: 1px solid var(--line); background: #fff; }
.evlist .card + .card { margin-top: 10px; }
.evlist h3 { font: 500 24px var(--serif); margin: 0; }

/* guest cancel / remove */
.qact {
  flex: none; width: 40px; height: 40px; border-radius: 99px; border: 1px solid var(--line); background: var(--paper);
  color: var(--ink-soft); font-size: 15px; cursor: pointer; -webkit-tap-highlight-color: transparent;
}
.qact.text { width: auto; padding: 0 12px; font: 600 13px var(--sans); color: var(--danger); border-color: #e9c9c9; }
.qact[disabled] { opacity: .5; }
.queue li.gone { opacity: .5; }
.queue .wishthumb { display: flex; align-items: center; justify-content: center; font-size: 22px; }
.queue .retry { margin-top: 8px; }
.tile .mine {
  position: absolute; top: 8px; left: 8px; z-index: 2; border: 0; border-radius: 99px; padding: 5px 10px;
  background: rgba(255,255,255,.92); color: var(--danger); font: 600 12px var(--sans); cursor: pointer;
}
.tile.wish .mine { top: auto; bottom: 8px; left: auto; right: 8px; }
.tile.removing { opacity: .4; pointer-events: none; }
.lb-cap .lb-remove { margin-top: 10px; background: rgba(255,255,255,.14); color: #fff; border: 0; border-radius: 99px; padding: 8px 14px; font: 600 13px var(--sans); cursor: pointer; }

select {
  width: 100%; padding: 12px 14px; border-radius: 12px; border: 1px solid var(--line); background: var(--field, #fff);
  color: var(--ink); font: 16px var(--sans); appearance: auto;
}
.evlist .settings select { padding: 8px 10px; font-size: 13px; border-radius: 99px; }
.hint.warn, .banner.warn { color: var(--warn); }
.banner { background: var(--paper); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; font-size: 14px; }
.banner.warn { background: #fbf1e2; border-color: #ecd6b3; }

/* language switch */
.wrap { position: relative; }
.langsw { position: absolute; top: 14px; right: 16px; display: flex; background: var(--paper); border: 1px solid var(--line); border-radius: 99px; padding: 3px; z-index: 3; }
.langsw button { border: 0; background: transparent; color: var(--ink-soft); font: 600 12px var(--sans); letter-spacing: .06em; padding: 6px 11px; border-radius: 99px; cursor: pointer; }
.langsw button.on { background: var(--ink); color: var(--on-ink, #fff); }

/* themes: hide the page until its theme is applied (theme.js removes this, max 2.5s) */
html.theming body { visibility: hidden; }
html.dark-theme input::placeholder, html.dark-theme textarea::placeholder { color: var(--ink-soft); opacity: .8; }
html.dark-theme select { color-scheme: dark; }

/* theme picker */
.tp-wrap { display: grid; grid-template-columns: minmax(0, 1fr) 220px; gap: 18px; align-items: start; }
.tp-left { min-width: 0; }
@media (max-width: 640px) {
  .tp-wrap { grid-template-columns: minmax(0, 1fr); }
  .tp-preview { justify-self: center; order: -1; transform: scale(.85); transform-origin: top center; margin-bottom: -54px; }
}
.tp-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); gap: 8px; }
.tp-sw {
  border: 2px solid var(--line); border-radius: 12px; background: var(--p); color: var(--i); padding: 10px 8px 8px;
  cursor: pointer; display: flex; flex-direction: column; align-items: center; gap: 6px; -webkit-tap-highlight-color: transparent;
}
.tp-sw[aria-checked="true"] { border-color: var(--ink); box-shadow: 0 0 0 2px var(--paper), 0 0 0 4px var(--ink); }
.tp-dots { display: flex; }
.tp-dots i { width: 20px; height: 20px; border-radius: 50%; border: 2px solid var(--p); margin-left: -6px; box-shadow: 0 0 0 1px rgba(0,0,0,.08); }
.tp-dots i:first-child { margin-left: 0; }
.tp-name { font-size: 14px; line-height: 1.15; text-align: center; }
.tp-colour { display: flex; gap: 8px; align-items: center; }
.tp-colour input[type=color] { width: 48px; height: 42px; border: 1px solid var(--line); border-radius: 10px; padding: 2px; background: #fff; }
.tp-preview { width: 220px; border-radius: 28px; padding: 8px; background: #1b1b1b; box-shadow: 0 10px 30px rgba(0,0,0,.18); }
.tp-screen { border-radius: 21px; background: var(--cream); color: var(--ink); padding: 18px 12px 14px; text-align: center; min-height: 360px; }
.tp-screen .pill { font-size: 9px; padding: 3px 9px; background: var(--paper); border-color: var(--line); color: var(--ink); }
.tp-h { font: 500 28px/1.1 var(--serif); margin: 10px 0 6px; }
.tp-lede { font: italic 14px var(--serif); color: var(--ink-soft); margin-bottom: 12px; }
.tp-card { background: var(--paper); border: 1px solid var(--line); border-radius: 12px; padding: 10px; text-align: left; }
.tp-field { background: var(--field, #fff); border: 1px solid var(--line); border-radius: 8px; padding: 7px 9px; font-size: 11px; color: var(--ink-soft); margin-bottom: 8px; }
.tp-btn { padding: 9px 10px; font-size: 11px; }
.tp-wish { margin-top: 10px; background: var(--accent-soft); border-radius: 10px; padding: 10px; text-align: left; }
.tp-wish i { display: block; font: italic 15px/1.3 var(--serif); color: var(--ink); }
.tp-wish span { font-size: 10px; color: var(--ink-soft); }
.tp-opts { display: grid; grid-template-columns: 1fr auto; gap: 12px; margin-top: 14px; align-items: end; }
@media (max-width: 640px) { .tp-opts { grid-template-columns: 1fr; } }

/* ============ Design styles (themes.json → styles). Classic = the base look above. ============ */
/* Backgrounds apply to the page body or the picker's phone preview — never to the dark live wall. */

/* Minimal: no boxes, hairlines, lots of air */
.style-minimal :is(.card, .tp-card) { background: transparent; border-color: transparent; box-shadow: none; }
.style-minimal .card { padding-left: 2px; padding-right: 2px; }
.style-minimal .pill { border-color: transparent; background: transparent; padding: 0; }
.style-minimal :is(input[type=text], textarea, .tp-field) { background: transparent; border-width: 0 0 1px; border-radius: 0; padding-left: 0; }
.style-minimal :is(.btn, .tp-btn) { border-radius: 10px; }
.style-minimal :is(.hero h1, .tp-h) { font-weight: 400; }
.style-minimal .tile { border-color: transparent; border-radius: 6px; }

/* Gradient: colour fade background, frosted cards, gradient buttons */
.style-gradient:is(body:not(.wall), .tp-screen) {
  background: var(--cream);
  background: linear-gradient(165deg, var(--accent-soft) 0%, var(--cream) 45%, color-mix(in srgb, var(--accent) 18%, var(--cream)) 100%);
}
body.style-gradient:not(.wall) { background-attachment: fixed; }
.style-gradient :is(.card, .tp-card, .tile:not(.wish), .pill) {
  background: color-mix(in srgb, var(--paper) 70%, transparent);
  border-color: color-mix(in srgb, #ffffff 50%, transparent);
  -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px);
}
.style-gradient :is(.card, .tp-card) { box-shadow: 0 10px 30px rgba(0,0,0,.07); }
.style-gradient :is(.btn:not(.ghost):not(.danger), .tp-btn) {
  background: linear-gradient(135deg, var(--accent), color-mix(in srgb, var(--accent) 62%, #000));
}
.wall.style-gradient { background: linear-gradient(160deg, var(--wbg) 30%, color-mix(in srgb, var(--accent) 35%, var(--wbg))); }

/* Elegant: dotted paper, ornament under the title, double-framed cards */
.style-elegant:is(body:not(.wall), .tp-screen) {
  background-color: var(--cream);
  background-image: radial-gradient(color-mix(in srgb, var(--accent) 16%, transparent) 1px, transparent 1.5px);
  background-size: 18px 18px;
}
.style-elegant .hero::before {
  content: ""; display: block; width: 140px; height: 1px; margin: 0 auto 16px;
  background: linear-gradient(90deg, transparent, var(--accent), transparent);
}
.style-elegant :is(.hero h1, .tp-h)::after {
  content: "❦"; display: block; font-size: .42em; line-height: 1; margin-top: .35em; color: var(--accent); font-style: normal;
}
.style-elegant :is(.card, .tp-card) {
  border-color: color-mix(in srgb, var(--accent) 55%, transparent);
  box-shadow: inset 0 0 0 4px var(--paper), inset 0 0 0 5px color-mix(in srgb, var(--accent) 30%, transparent);
}
.style-elegant .card { padding: 22px; }
.style-elegant .pill { border-color: var(--accent); }
.style-elegant .tile { border-color: color-mix(in srgb, var(--accent) 40%, transparent); }
.wall.style-elegant .w-side { background-image: radial-gradient(color-mix(in srgb, var(--wgold) 18%, transparent) 1px, transparent 1.5px); background-size: 18px 18px; }

/* Modern: bold ink borders and offset block shadows */
.style-modern :is(.card, .tp-card, .tile) { border: 2px solid var(--ink); border-radius: 8px; box-shadow: 5px 5px 0 var(--accent); }
.style-modern .tile.wish { box-shadow: 5px 5px 0 var(--ink); }
.style-modern :is(.btn, .tp-btn) { border-radius: 8px; border: 2px solid var(--ink); }
.style-modern :is(input[type=text], textarea, .tp-field) { border: 2px solid var(--ink); border-radius: 6px; }
.style-modern .pill { border: 2px solid var(--ink); border-radius: 6px; font-weight: 600; }
.style-modern :is(.hero h1, .tp-h) { font-weight: 700; letter-spacing: -.01em; }
.style-modern .langsw { border: 2px solid var(--ink); }

/* Songket: woven diamond lattice, accent bands */
.style-songket:is(body:not(.wall), .tp-screen) {
  background-color: var(--cream);
  background-image:
    repeating-linear-gradient(45deg, color-mix(in srgb, var(--accent) 11%, transparent) 0 1px, transparent 1px 15px),
    repeating-linear-gradient(-45deg, color-mix(in srgb, var(--accent) 11%, transparent) 0 1px, transparent 1px 15px);
}
.style-songket :is(.card, .tp-card) { border-top: 4px solid var(--accent); }
.style-songket .pill { background: var(--accent); color: var(--on-accent); border-color: var(--accent); }
.style-songket :is(.hero h1, .tp-h) { text-shadow: 0 1px 0 var(--paper); }
.wall.style-songket .w-side {
  background-image:
    repeating-linear-gradient(45deg, color-mix(in srgb, var(--wgold) 12%, transparent) 0 1px, transparent 1px 15px),
    repeating-linear-gradient(-45deg, color-mix(in srgb, var(--wgold) 12%, transparent) 0 1px, transparent 1px 15px);
}
.tp-styles { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 8px; }
.tp-st {
  border: 2px solid var(--line); border-radius: 12px; background: var(--paper); color: var(--ink); padding: 10px 12px;
  text-align: left; cursor: pointer; display: flex; flex-direction: column; gap: 2px; -webkit-tap-highlight-color: transparent;
}
.tp-st b { font-size: 14px; }
.tp-st span { font-size: 11px; color: var(--ink-soft); }
.tp-st[aria-checked="true"] { border-color: var(--ink); box-shadow: 0 0 0 2px var(--paper), 0 0 0 4px var(--ink); }
.tp-screen { overflow: hidden; }


/* ============ Layout pieces added in the audit ============ */
.hero.compact { padding: 12px 8px 4px; }
.hero.compact h1 { font-size: 38px; margin: 10px 0 6px; }

/* Form rows that stack on narrow screens instead of squeezing text */
.fields { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; }

/* Button groups: equal widths, never wrap mid-label */
.btn-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 8px; }
.btn-grid.two { grid-template-columns: 1fr 1fr; }
.btn-grid .btn { white-space: nowrap; }

/* Folded setup sections on the event admin page */
.sections { display: grid; grid-template-columns: minmax(0, 1fr); gap: 10px; }
.sec, .sec-body, .card { min-width: 0; }
.sec { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); }
.sec > summary {
  list-style: none; cursor: pointer; padding: 16px 18px; display: flex; align-items: center; justify-content: space-between; gap: 12px;
  -webkit-tap-highlight-color: transparent; border-radius: var(--radius);
}
.sec > summary::-webkit-details-marker { display: none; }
.sec > summary b { display: block; font-size: 15px; }
.sec > summary .hint { display: block; margin-top: 2px; }
.sec > summary::after {
  content: ""; flex: none; width: 9px; height: 9px; margin-right: 4px;
  border-right: 2px solid var(--ink-soft); border-bottom: 2px solid var(--ink-soft); transform: rotate(45deg) translateY(-3px); transition: transform .2s;
}
.sec[open] > summary::after { transform: rotate(-135deg) translateY(-2px); }
.sec[open] > summary { border-bottom: 1px solid var(--line); border-radius: var(--radius) var(--radius) 0 0; }
.sec-body { padding: 16px 18px 18px; }
.share { display: flex; gap: 16px; align-items: flex-start; flex-wrap: wrap; margin-bottom: 14px; }
.share .qr { width: 132px; flex: none; }
@media (max-width: 480px) { .share .qr { width: 160px; margin: 0 auto; } .share > .stack { flex-basis: 100%; } }

.media-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 10px; }
.media-head h2 { font: 500 26px var(--serif); margin: 0; }
.tabs { overflow-x: auto; flex-wrap: nowrap; padding-bottom: 2px; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tabs button { flex: none; }

/* Events page cards */
.ev h3 { margin-bottom: 2px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chips a {
  font: 600 13px var(--sans); color: var(--ink); text-decoration: none; padding: 7px 12px;
  border: 1px solid var(--line); border-radius: 99px; background: var(--paper);
}
.settings { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.mini { display: block; margin: 0; }
.mini > span { display: block; font-size: 11px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--ink-soft); margin-bottom: 4px; }
.evlist .settings select { width: 100%; padding: 9px 10px; font-size: 14px; border-radius: 10px; }
.linklike { justify-self: start; align-self: flex-start; background: none; border: 0; padding: 4px 0; font: 600 13px var(--sans); cursor: pointer; color: var(--ink-soft); }
.linklike.danger { color: var(--danger); }

/* Accessibility */
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.sec > summary:focus-visible { outline-offset: -3px; }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}

/* Never let the page scroll sideways on a phone ("clip" keeps sticky headers working; "hidden" is the fallback) */
html, body { overflow-x: hidden; }
@supports (overflow-x: clip) { html, body { overflow-x: clip; } }


/* ============ Phase 1: cover, gallery polish, frames, blessings ============ */

/* Cover photo behind the guest-page title */
body.cover-banner .hero {
  position: relative; isolation: isolate; color: #fff; margin: -24px calc(-1 * max(16px, env(safe-area-inset-left))) 18px;
  padding: calc(76px + env(safe-area-inset-top)) 22px 34px; min-height: 340px; min-height: min(62vh, 520px);
  display: flex; flex-direction: column; justify-content: flex-end;
  background: #222 var(--cover) center / cover no-repeat;
  border-radius: 0 0 28px 28px; overflow: hidden;
}
body.cover-banner .hero::after {
  content: ""; position: absolute; inset: 0; z-index: -1;
  background: linear-gradient(180deg, rgba(0,0,0,.18) 0%, rgba(0,0,0,.05) 35%, rgba(0,0,0,.62) 100%);
}
body.has-cover .hero::before { display: none; }
body.has-cover .hero h1 { color: #fff; text-shadow: 0 2px 18px rgba(0,0,0,.35); }
body.has-cover .hero h1::after { color: #fff !important; }
body.has-cover .hero .meta, body.has-cover .hero .lede { color: rgba(255,255,255,.9); }
body.has-cover .hero .pill { align-self: center; background: rgba(255,255,255,.18); border-color: rgba(255,255,255,.5); color: #fff; -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); }
body.has-cover .wrap > .langsw { background: rgba(255,255,255,.9); }
@media (min-width: 600px) { body.cover-banner .hero { margin-left: 0; margin-right: 0; border-radius: 0 0 28px 28px; } }

/* Admin cover picker */
.cover-row { display: flex; gap: 14px; align-items: flex-start; flex-wrap: wrap; }
.cover-pv { width: 180px; aspect-ratio: 16 / 10; border-radius: 12px; background: var(--accent-soft); overflow: hidden; display: flex; align-items: center; justify-content: center; flex: none; border: 1px solid var(--line); }
.cover-pv img { width: 100%; height: 100%; object-fit: cover; }
.cover-pv span { font-size: 12px; color: var(--ink-soft); }
@media (max-width: 480px) { .cover-pv { width: 100%; } }

/* Checkbox row */
.check { display: flex; gap: 8px; align-items: flex-start; font-weight: 500; font-size: 13px; color: var(--ink-soft); margin: 8px 0 0; cursor: pointer; }
.check input { width: 18px; height: 18px; margin: 1px 0 0; accent-color: var(--accent); flex: none; }

/* Gallery: sticky header + sticky share button */
.topbar {
  position: sticky; top: 0; z-index: 20; display: grid; grid-template-columns: 44px minmax(0, 1fr) auto; align-items: center; gap: 8px;
  padding: calc(8px + env(safe-area-inset-top)) max(12px, env(safe-area-inset-right)) 8px max(12px, env(safe-area-inset-left));
  background: color-mix(in srgb, var(--cream) 88%, transparent); border-bottom: 1px solid var(--line);
  -webkit-backdrop-filter: saturate(1.4) blur(12px); backdrop-filter: saturate(1.4) blur(12px);
}
.tb-back { width: 40px; height: 40px; border-radius: 99px; display: flex; align-items: center; justify-content: center; text-decoration: none; color: var(--ink); font-size: 30px; line-height: 1; padding-bottom: 3px; }
.tb-back:hover { background: var(--accent-soft); }
.tb-title { min-width: 0; text-align: center; line-height: 1.2; }
.tb-title b { display: block; font: 500 19px var(--serif); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tb-title span { font-size: 10px; letter-spacing: .14em; text-transform: uppercase; color: var(--ink-soft); }
.topbar .langsw { position: static; }
.gallery-page { padding-top: 6px; padding-bottom: calc(110px + env(safe-area-inset-bottom)); }
body.no-cta .gallery-page { padding-bottom: calc(40px + env(safe-area-inset-bottom)); }
.cta-bar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; display: flex; justify-content: center;
  padding: 12px max(16px, env(safe-area-inset-right)) calc(12px + env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left));
  background: linear-gradient(180deg, transparent, color-mix(in srgb, var(--cream) 92%, transparent) 35%);
  pointer-events: none;
}
.cta-bar .btn { max-width: 420px; pointer-events: auto; box-shadow: 0 8px 24px rgba(0,0,0,.18); }
.lightbox { z-index: 40; }
body.lb-open :is(.cta-bar, .topbar) { visibility: hidden; }

/* Captions + likes */
.cap-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-width: 0; }
.cap-row > b, .cap-row > span:first-child { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tile .cap b.anon { font-size: 10px; letter-spacing: .14em; text-transform: uppercase; color: var(--ink-soft); font-weight: 600; }
.like {
  flex: none; display: inline-flex; align-items: center; gap: 4px; border: 0; background: transparent; color: var(--ink-soft);
  font: 600 12px var(--sans); padding: 6px 4px 6px 8px; margin: -6px -4px -6px 0; cursor: pointer; -webkit-tap-highlight-color: transparent; border-radius: 99px;
}
.like .heart { font-size: 17px; line-height: 1; }
.like[aria-pressed="true"] { color: #d23b5a; }
.like[aria-pressed="true"] .heart { animation: beat .3s ease; }
@keyframes beat { 50% { transform: scale(1.3); } }
.tile.wish .cap-row { margin-top: 4px; }
.lb-row { display: flex; align-items: center; justify-content: center; gap: 14px; margin-top: 4px; }
.lightbox .like { color: #f3e8e0; font-size: 14px; }
.lightbox .like[aria-pressed="true"] { color: #ff7d97; }

/* Shared modal sheet (frame chooser, blessing recorder) */
.fr-modal {
  position: fixed; inset: 0; z-index: 60; background: rgba(15,10,8,.6); display: flex; align-items: flex-end; justify-content: center;
  -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px); animation: fadein .2s ease;
}
@keyframes fadein { from { opacity: 0; } }
.fr-sheet {
  width: 100%; max-width: 520px; max-height: 100%; max-height: 100dvh; overflow-y: auto; background: var(--paper); color: var(--ink);
  border-radius: 24px 24px 0 0; padding: 16px 18px calc(18px + env(safe-area-inset-bottom)); animation: up .25s ease;
}
@keyframes up { from { transform: translateY(40px); } }
@media (min-width: 600px) { .fr-modal { align-items: center; padding: 20px; } .fr-sheet { border-radius: 24px; } }
.fr-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.fr-head b { font: 500 24px var(--serif); }
.fr-x { width: 38px; height: 38px; border-radius: 99px; border: 1px solid var(--line); background: var(--paper); color: var(--ink); font-size: 15px; cursor: pointer; }
.fr-stage { display: grid; grid-template-columns: 36px minmax(0, 1fr) 36px; align-items: center; gap: 4px; }
.fr-view { display: flex; justify-content: center; min-width: 0; }
.fr-canvas { max-width: 100%; max-height: 52vh; max-height: 52dvh; width: auto; height: auto; border-radius: 6px; box-shadow: 0 10px 30px rgba(0,0,0,.22); }
.fr-arrow { width: 36px; height: 36px; border-radius: 99px; border: 1px solid var(--line); background: var(--paper); color: var(--ink); font-size: 22px; line-height: 1; cursor: pointer; padding-bottom: 3px; }
.fr-note { text-align: center; font-size: 12px; color: var(--ink-soft); margin: 10px 0 0; min-height: 1em; }
.fr-chips { display: flex; gap: 6px; overflow-x: auto; padding: 10px 2px 14px; scrollbar-width: none; justify-content: safe center; }
.fr-chips::-webkit-scrollbar { display: none; }
.fr-chip { flex: none; border: 1px solid var(--line); background: var(--paper); color: var(--ink); border-radius: 99px; padding: 8px 14px; font: 600 13px var(--sans); cursor: pointer; }
.fr-chip[aria-checked="true"] { background: var(--ink); color: var(--on-ink, #fff); border-color: var(--ink); }

/* Blessing entry + recorder */
button.blessing {
  width: 100%; margin-top: 14px; display: flex; align-items: center; gap: 14px; text-align: left; cursor: pointer; color: var(--ink); font: inherit;
  -webkit-tap-highlight-color: transparent;
}
button.blessing b { display: block; font-size: 15px; }
button.blessing .hint { display: block; margin: 2px 0 0; }
.bl-ico { width: 46px; height: 46px; flex: none; border-radius: 99px; background: var(--accent-soft); display: flex; align-items: center; justify-content: center; font-size: 22px; }
button.blessing > span:nth-child(2) { flex: 1; min-width: 0; }
.bl-go { font-size: 24px; color: var(--ink-soft); }
.bl-tabs { justify-content: center; margin-bottom: 12px; }
.bl-stage { display: flex; justify-content: center; align-items: center; min-height: 140px; border-radius: 16px; background: var(--accent-soft); overflow: hidden; }
.bl-live { width: 100%; max-height: 46vh; max-height: 46dvh; object-fit: cover; background: #000; transform: scaleX(-1); }
.bl-live[controls] { transform: none; object-fit: contain; }
.bl-mic { font-size: 52px; }
.bl-audio { width: calc(100% - 24px); }
.bl-status { text-align: center; font-size: 14px; color: var(--ink-soft); margin: 12px 0 4px; min-height: 1.5em; }
.bl-ctrl { display: flex; justify-content: center; padding: 6px 0 12px; }
.bl-rec { width: 74px; height: 74px; border-radius: 99px; border: 4px solid var(--ink); background: var(--paper); display: flex; align-items: center; justify-content: center; cursor: pointer; padding: 0; }
.bl-rec i { width: 50px; height: 50px; border-radius: 99px; background: #d23b3b; transition: all .2s; }
.bl-rec.on i { width: 26px; height: 26px; border-radius: 6px; }
.bl-rec[disabled] { opacity: .4; }

/* Admin: private + voice cards */
.aitem.private { border-color: color-mix(in srgb, var(--accent) 45%, var(--line)); }
.badge { display: inline-block; font-size: 10px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; background: var(--accent); color: var(--on-accent); border-radius: 99px; padding: 2px 8px; margin: 0 4px 4px 0; }
.badge.soft { background: var(--accent-soft); color: var(--ink); }
.voice-pv { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; width: 100%; padding: 10px; }
.voice-pv span { font-size: 34px; }
.voice-pv audio { width: 100%; }
.stats { grid-template-columns: repeat(auto-fit, minmax(64px, 1fr)); }

/* Cover as the whole page background: photo stays put, the page scrolls over a darkening fade */
body.cover-full { background: #171210; }
body.cover-full::before {
  content: ""; position: fixed; inset: 0; z-index: 0;
  background: #171210 var(--cover) center 30% / cover no-repeat;
}
body.cover-full::after {
  content: ""; position: fixed; inset: 0; z-index: 0; pointer-events: none;
  background: linear-gradient(180deg, rgba(10,6,5,.22) 0%, rgba(10,6,5,.08) 28%, rgba(10,6,5,.55) 52%, rgba(10,6,5,.82) 75%, rgba(10,6,5,.9) 100%);
}
body.cover-full .wrap { position: relative; z-index: 1; }
body.cover-full .hero {
  min-height: 58vh; min-height: 58svh; display: flex; flex-direction: column; justify-content: flex-end;
  padding-bottom: 26px; background: none; color: #fff;
}
body.cover-full .hero::before { display: none; }
body.cover-full .hero h1 { color: #fff; text-shadow: 0 2px 18px rgba(0,0,0,.4); }
body.cover-full .hero h1::after { color: #fff !important; }
body.cover-full .hero .meta, body.cover-full .hero .lede { color: rgba(255,255,255,.9); }
body.cover-full .hero .pill { align-self: center; background: rgba(255,255,255,.92); border-color: transparent; color: #2a201d; }
body.cover-full .wrap > .langsw { background: rgba(255,255,255,.92); }
body.cover-full :is(.card, button.blessing) { box-shadow: 0 12px 34px rgba(0,0,0,.28); border-color: transparent; }
body.cover-full .style-minimal .card, body.cover-full.style-minimal .card { background: var(--paper); padding-left: 18px; padding-right: 18px; }
body.cover-full .wrap > .hint, body.cover-full .wrap > p.hint { color: rgba(255,255,255,.82); }
body.cover-full.style-gradient :is(.card, button.blessing) { background: color-mix(in srgb, var(--paper) 94%, transparent); }
