:root { --bg: #000; --panel: #161616; --line: #3a3a3a; --ink: #fff; --muted: #b3b3b3; --violet: #F2D6FF; --head: 'Marcellus', Georgia, serif; }
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--ink); font-family: Jost, system-ui, sans-serif; }
body { min-height: 100vh; padding-bottom: env(safe-area-inset-bottom); }
.top { display: flex; justify-content: center; padding: calc(14px + env(safe-area-inset-top)) 16px 10px; border-bottom: 1px solid #222; }
.lockup { height: 40px; width: auto; }
main { max-width: 560px; margin: 0 auto; padding: 18px 16px 40px; }
h1 { font-family: var(--head); font-weight: 400; font-size: 2.2rem; margin: 4px 0 6px; }
.lead { color: var(--muted); line-height: 1.5; margin: 0 0 18px; }
.themes { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.theme { position: relative; border: 1px solid var(--line); background: var(--panel); color: var(--ink); padding: 0; cursor: pointer; font: inherit; overflow: hidden; text-align: left; }
.theme canvas { display: block; width: 100%; aspect-ratio: 4 / 5; height: auto; }
.theme span { position: absolute; left: 0; right: 0; bottom: 0; padding: 8px 10px; background: linear-gradient(transparent, rgba(0,0,0,.8)); font-size: .95rem; }
.theme.on { outline: 2px solid #fff; outline-offset: -2px; }
.themes.small { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; margin: 12px 0; }
.themes.small .theme span { font-size: .7rem; padding: 4px 5px; }
.own { display: block; text-align: center; border: 1px dashed var(--line); padding: 14px; margin-top: 12px; cursor: pointer; color: var(--muted); }
.stage { position: relative; background: #111; aspect-ratio: 4 / 5; overflow: hidden; }
.stage { touch-action: none; }
.stage video { width: 100%; height: 100%; object-fit: contain; background: #000; transform: scaleX(-1); display: block; transform-origin: center; }
.count { position: absolute; inset: 0; display: grid; place-items: center; font-family: var(--head); font-size: 9rem; text-shadow: 0 2px 30px rgba(0,0,0,.6); pointer-events: none; }
.bar { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 16px 0 6px; }
.shutter { width: 76px; height: 76px; border-radius: 50%; border: 4px solid #fff; background: transparent; padding: 0; cursor: pointer; }
.shutter::after { content: ""; display: block; width: 58px; height: 58px; margin: 5px auto; border-radius: 50%; background: #fff; }
.ghost, .solid { min-height: 48px; padding: 0 18px; border: 1px solid #fff; background: transparent; color: #fff; font: inherit; letter-spacing: .08em; text-transform: uppercase; font-size: .85rem; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; }
.solid { background: #fff; color: #000; }
.hint { text-align: center; color: var(--muted); margin: 6px 0 0; }
.result { position: relative; }
.result canvas { width: 100%; height: auto; display: block; background: #111; }
.working { position: absolute; inset: 0; display: grid; place-items: center; background: rgba(0,0,0,.6); font-family: var(--head); font-size: 1.4rem; }
.controls { display: grid; gap: 10px; }
.ctl { display: grid; grid-template-columns: 56px minmax(0, 1fr); align-items: center; gap: 10px; }
.ctl span { color: var(--muted); font-size: .85rem; letter-spacing: .1em; text-transform: uppercase; }
.ctl input[type=text] { min-height: 46px; background: #0e0e0e; color: #fff; border: 1px solid var(--line); padding: 0 12px; font: inherit; font-size: 16px; }
.ctl input[type=range] { width: 100%; accent-color: var(--violet); }
.note { color: var(--muted); font-size: .85rem; margin: 10px 0 0; }
.actions { display: grid; grid-template-columns: 1fr 2fr; gap: 10px; margin-top: 16px; }
[hidden] { display: none !important; }

.stage video.back { transform: none; }
.flip { position: absolute; top: 12px; right: 12px; min-height: 44px; padding: 0 16px; border-radius: 999px; border: 1px solid rgba(255,255,255,.7); background: rgba(0,0,0,.5); color: #fff; font: inherit; letter-spacing: .08em; text-transform: uppercase; font-size: .8rem; cursor: pointer; }

.result canvas { touch-action: none; cursor: grab; }
.adjust { display: flex; align-items: center; gap: 8px; margin: 10px 0 2px; }
.adjust span { flex: 1; color: var(--muted); font-size: .85rem; }
.adjust button { min-width: 48px; min-height: 44px; border: 1px solid #fff; background: transparent; color: #fff; font: inherit; font-size: 1.1rem; cursor: pointer; }
.adjust #resetPos { font-size: .8rem; letter-spacing: .08em; text-transform: uppercase; padding: 0 12px; }

.camzoom { position: absolute; bottom: 12px; left: 50%; transform: translateX(-50%); display: flex; align-items: center; gap: 6px; background: rgba(0,0,0,.55); border-radius: 999px; padding: 4px; }
.camzoom button { width: 44px; height: 44px; border-radius: 50%; border: 1px solid rgba(255,255,255,.7); background: transparent; color: #fff; font: inherit; font-size: 1.3rem; cursor: pointer; }
.camzoom span { min-width: 44px; text-align: center; font-size: .9rem; color: #fff; }

.modes { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; margin-top: 12px; }
.modes button { min-height: 44px; border: 1px solid #555; background: transparent; color: #fff; font: inherit; font-size: .8rem; letter-spacing: .08em; text-transform: uppercase; cursor: pointer; }
.modes button.on { background: #fff; color: #000; border-color: #fff; }
.brushrow { margin-top: 8px; }

/* Camera screen: 4:5 preview like the final photo, compact so it fits an iPhone screen */
#s-cam .stage { aspect-ratio: 4 / 5; width: min(100%, calc((100svh - 190px) * 0.8)); margin: 0 auto; }
#s-cam .stage video { object-fit: contain; }
body:has(#s-cam:not([hidden])) .top { padding: calc(4px + env(safe-area-inset-top)) 16px 4px; border-bottom: 0; }
body:has(#s-cam:not([hidden])) .lockup { height: 26px; }
body:has(#s-cam:not([hidden])) main { padding-top: 4px; padding-bottom: 8px; }
#s-cam .bar { padding: 8px 0 2px; }
#s-cam .shutter { width: 64px; height: 64px; }
#s-cam .shutter::after { width: 48px; height: 48px; margin: 4px auto; }
#s-cam .ghost { min-height: 40px; padding: 0 12px; font-size: .75rem; }
#s-cam .hint { font-size: .8rem; margin-top: 2px; }
#s-cam .flip { top: 8px; right: 8px; min-height: 36px; padding: 0 12px; }
#s-cam .camzoom { bottom: 8px; }
#s-cam .camzoom button { width: 38px; height: 38px; }

.cats { display: flex; gap: 8px; overflow-x: auto; padding: 2px 0 12px; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
.cats::-webkit-scrollbar { display: none; }
.cat { flex: 0 0 auto; min-height: 40px; padding: 0 14px; border: 1px solid #555; border-radius: 999px; background: transparent; color: #fff; font: inherit; font-size: .85rem; cursor: pointer; white-space: nowrap; }
.cat.on { background: #fff; color: #000; border-color: #fff; }
#cats2 { margin-top: 12px; padding-bottom: 0; }

#s-cam .hq { display: flex; width: 100%; margin-top: 6px; }

/* Result screen: settings and buttons first, backgrounds in one swipeable row below */
#s-result .controls { margin-top: 12px; }
.bgtitle { font-family: var(--head); font-weight: 400; font-size: 1.2rem; margin: 22px 0 8px; }
.themes.small { display: grid; grid-auto-flow: column; grid-template-columns: none; grid-auto-columns: 30%; overflow-x: auto; scroll-snap-type: x mandatory; padding-bottom: 6px; scrollbar-width: none; }
.themes.small::-webkit-scrollbar { display: none; }
.themes.small .theme { scroll-snap-align: start; }

.theme img { display: block; width: 100%; aspect-ratio: 4 / 5; height: auto; object-fit: cover; background: #111; }

/* Start screen sections: one per category, each a sideways-swipe row */
.themes.sections { display: block; }
.bgsec { margin: 6px 0 22px; }
.bgsec-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; border-bottom: 1px solid #2a2a2a; padding-bottom: 6px; margin-bottom: 10px; }
.bgsec-head h2 { font-family: var(--head); font-weight: 400; font-size: 1.35rem; margin: 0; }
.seeall { background: none; border: 0; color: var(--muted); font: inherit; font-size: .85rem; cursor: pointer; padding: 6px 0; }
.bgrow { display: grid; grid-auto-flow: column; grid-auto-columns: 42%; gap: 10px; overflow-x: auto; scroll-snap-type: x mandatory; padding-bottom: 4px; scrollbar-width: none; }
.bgrow::-webkit-scrollbar { display: none; }
.bgrow .theme { scroll-snap-align: start; }

.stickers { margin-top: 14px; }
.stickers .lab { font-size: .85rem; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); margin-bottom: 6px; }
.stickers .lab span { text-transform: none; letter-spacing: 0; opacity: .8; }
.stickerrow { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; padding-bottom: 4px; }
.stickerrow::-webkit-scrollbar { display: none; }
.stickerrow button { flex: 0 0 auto; width: 48px; height: 48px; font-size: 28px; line-height: 1; background: #161616; border: 1px solid #333; border-radius: 10px; cursor: pointer; }
#removeSticker { margin-top: 8px; width: 100%; min-height: 40px; font-size: .75rem; }
.modes button:disabled { opacity: .35; }

.privacy { font-size: .85rem; line-height: 1.5; color: var(--muted); border: 1px solid #2a2a2a; padding: 10px 12px; margin: 0 0 16px; }
.privacy strong { color: #fff; font-weight: 500; }
.privacy.small { border: 0; padding: 0; margin: 12px 0 0; text-align: center; font-size: .8rem; }

/* Presented-by line, booking card, flying plane */
.top { position: relative; overflow: hidden; flex-direction: column; align-items: center; gap: 6px; }
.presented { font-size: .7rem; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); text-align: center; }
body:has(#s-cam:not([hidden])) .presented, body:has(#s-cam:not([hidden])) .plane { display: none; }
@keyframes fly { 0% { transform: translateX(-110%); opacity: 1; } 90% { opacity: 1; } 100% { transform: translateX(110vw); opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .plane { display: none; } }
.bookcard { border: 1px solid #fff; padding: 18px 16px; margin: 22px 0 8px; text-align: center; }
.bk-kicker { font-size: .72rem; letter-spacing: .16em; text-transform: uppercase; color: var(--violet); }
.bookcard h2 { font-family: var(--head); font-weight: 400; font-size: 1.5rem; margin: 6px 0 6px; }
.bookcard p { color: var(--muted); line-height: 1.5; margin: 0 0 14px; font-size: .92rem; }
.bookcard .solid { width: 100%; text-decoration: none; }
.bk-info { display: grid; gap: 6px; margin-top: 12px; font-size: .88rem; }
.bk-info a { color: #fff; text-decoration: none; }

.top { padding-top: calc(112px + env(safe-area-inset-top)); }
img.plane { position: absolute; top: calc(8px + env(safe-area-inset-top)); left: 0; width: min(340px, 85vw); height: auto; pointer-events: none; transform: translateX(-105%); animation: flyloop 14s linear .3s infinite; }
@keyframes flyloop { 0% { transform: translateX(-105%); } 62% { transform: translateX(110vw); } 100% { transform: translateX(110vw); } }
@media (prefers-reduced-motion: reduce) { img.plane { display: block; animation: none; transform: none; left: 50%; margin-left: calc(min(340px, 85vw) / -2); } }

.touchhelp { font-size: .82rem; line-height: 1.45; color: var(--muted); margin: 8px 0 0; }
.touchhelp b { color: #fff; font-weight: 500; }
.linkbtn { background: none; border: 0; padding: 0; color: #fff; text-decoration: underline; font: inherit; cursor: pointer; }

.legal { max-width: 560px; margin: 8px auto 0; padding: 18px 16px calc(28px + env(safe-area-inset-bottom)); border-top: 1px solid #222; color: #8a8a8a; font-size: .75rem; line-height: 1.5; text-align: center; }
.legal p { margin: 0 0 6px; }
body:has(#s-cam:not([hidden])) .legal { display: none; }

/* Computer screens: use the full width like the rest of bellagaia.us */
@media (min-width: 900px) {
  main { max-width: 1240px; padding: 28px 40px 60px; }
  .legal { max-width: 1240px; padding-left: 40px; padding-right: 40px; }
  #s-pick h1 { font-size: 3.2rem; margin-bottom: 6px; }
  #s-pick .lead { font-size: 1.15rem; }
  #s-pick .privacy { max-width: 820px; }
  .bgsec-head h2 { font-size: 1.7rem; }
  .bgrow { grid-auto-columns: calc((100% - 50px) / 6); gap: 10px; }
  .own { max-width: 520px; margin: 18px auto 0; }
  .bookcard { max-width: 640px; margin-left: auto; margin-right: auto; padding: 26px 28px; }
  img.plane { width: 460px; }
  .top { padding-top: calc(150px + env(safe-area-inset-top)); }
  .lockup { height: 52px; }
  .presented { font-size: .8rem; }
  /* Camera: centered, as big as the screen allows */
  #s-cam { max-width: 720px; margin: 0 auto; }
  /* Result: photo on the left, tools on the right */
  #s-result { display: grid; grid-template-columns: minmax(0, 560px) minmax(0, 1fr); column-gap: 40px; align-items: start; }
  #s-result > .result { grid-column: 1; grid-row: 1 / span 12; position: sticky; top: 16px; }
  #s-result > *:not(.result) { grid-column: 2; }
  #s-result .bookcard { max-width: none; }
  .themes.small { grid-auto-columns: 22%; }
}
