:root {
  --red: #B22A22;
  --red-deep: #8A1A15;
  --mustard: #EFB036;
  --mustard-deep: #CD8F20;
  --ink: #1E1208;
  --night: #14090A;
  --cream: #F6E8CE;
  --noise: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='220' height='220'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.8' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .2 0 0 0 0 .1 0 0 0 0 .05 0 0 0 .32 0'/%3E%3C/filter%3E%3Crect width='220' height='220' filter='url(%23n)'/%3E%3C/svg%3E");
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; min-height: 100%; background: var(--night); color: var(--cream); }
body { font-family: "Barlow Condensed", system-ui, sans-serif; font-size: 18px; -webkit-font-smoothing: antialiased; overscroll-behavior-y: none; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
label { cursor: pointer; }
[hidden] { display: none !important; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
.defs { position: absolute; }
.file { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.fx { position: fixed; inset: 0; z-index: 25; width: 100%; height: 100%; pointer-events: none; }

/* Light the diya */

@property --glow { syntax: "<length>"; inherits: false; initial-value: 0px; }

.intro {
  --glow: -30vh;
  position: fixed; inset: 0; z-index: 20;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 22px;
  background: radial-gradient(90% 60% at 50% 62%, #3B1409 0%, #1A0806 52%, #080303 100%);
  -webkit-mask-image: radial-gradient(circle at 50% 56%, transparent var(--glow), #000 calc(var(--glow) + 26vh));
  mask-image: radial-gradient(circle at 50% 56%, transparent var(--glow), #000 calc(var(--glow) + 26vh));
  cursor: pointer; user-select: none; -webkit-user-select: none;
}
.intro.skip { display: none; }
.greeting { min-height: 110px; text-align: center; opacity: 0; transform: translateY(12px); transition: opacity .6s, transform .6s; }
.intro.greet-on .greeting { opacity: 1; transform: none; }
.greet { margin: 0; font: 400 clamp(38px, 12vw, 60px) / 1.1 "Rozha One", serif; color: var(--mustard); text-shadow: 0 0 24px rgba(255, 170, 60, .55); }
.welcome { margin: 8px 0 0; font: 400 clamp(26px, 8vw, 38px) "Sacramento", cursive; color: var(--cream); }
.diyas { display: flex; align-items: flex-end; justify-content: center; gap: 2px; width: min(96vw, 520px); }
.lamp { flex: none; overflow: visible; width: 15vw; max-width: 74px; }
.lamp:nth-child(2), .lamp:nth-child(4) { width: 19vw; max-width: 92px; }
.lamp:nth-child(3) { width: 30vw; max-width: 142px; }
.halo { opacity: 0; transform-origin: 0 -26px; transform: scale(.4); transition: opacity .35s, transform .5s; }
.fire { opacity: 0; transform-origin: 0 2px; transform: scale(.1); transition: opacity .2s, transform .35s cubic-bezier(.2, 1.7, .4, 1); }
.lamp.lit .halo { opacity: 1; transform: scale(1); }
.lamp.lit .fire { opacity: 1; transform: scale(1); animation: flicker .42s ease-in-out infinite alternate; }
.ring { fill: none; stroke: #FFC55A; stroke-width: 1.6; transform-origin: 0 10px; animation: ping 1.9s ease-out infinite; }
.intro.lit .ring { display: none; }
.intro-hint { margin: 0; padding: 9px 22px; font-weight: 700; font-size: 21px; letter-spacing: .14em; text-transform: uppercase; color: var(--ink); background: var(--mustard); box-shadow: 0 0 26px rgba(255, 176, 60, .55); animation: breathe 1.7s ease-in-out infinite; }
.intro.lit .intro-hint { opacity: 0; animation: none; transition: opacity .2s; }
.intro.open { transition: --glow 1.1s cubic-bezier(.5, 0, .3, 1), opacity .35s linear .85s; --glow: 150vh; opacity: 0; pointer-events: none; }

@keyframes breathe { 50% { transform: scale(1.05); box-shadow: 0 0 40px rgba(255, 176, 60, .8); } }
@keyframes flicker { to { transform: scale(1.06, .94) rotate(1.8deg); } }
@keyframes ping { from { transform: scale(.7); opacity: .9; } to { transform: scale(1.5); opacity: 0; } }

/* Home */

.home {
  position: relative; min-height: 100vh; min-height: 100dvh;
  background: var(--noise), radial-gradient(120% 70% at 50% 24%, #C5332A 0%, var(--red) 46%, var(--red-deep) 100%);
  background-attachment: fixed;
  overflow-x: hidden;
}
.rail { position: fixed; top: 0; bottom: 0; z-index: 2; width: 20px; overflow: hidden; background: var(--mustard); color: var(--ink); }
.rail-left { left: 0; border-right: 2px solid var(--ink); }
.rail-right { right: 0; border-left: 2px solid var(--ink); }
/* A repeating picture, not a long strip of text: iPhones stop painting very tall moving layers. */
.rail { background-repeat: repeat-y; animation: rail 16s linear infinite; }
.rail-left { animation-direction: reverse; }
@keyframes rail { to { background-position-y: var(--unit, 0); } }

.home-body {
  position: relative; display: flex; flex-direction: column; align-items: center;
  padding: max(14px, env(safe-area-inset-top)) 30px calc(112px + env(safe-area-inset-bottom));
}
.lockup { display: block; width: 80%; max-width: 300px; aspect-ratio: 1 / .78; }

.hosts {
  position: relative; display: block; width: min(47vw, 200px); margin: 6px 0 0; padding: 7px 7px 0;
  background: #FBF7EF; box-shadow: 5px 6px 0 rgba(30, 18, 8, .55); transform: rotate(-2.5deg);
  transition: transform .35s cubic-bezier(.2, 1.6, .4, 1);
}
.hosts:active { transform: rotate(1.5deg) scale(1.03); }
.hosts img { display: block; width: 100%; height: auto; aspect-ratio: 800 / 819; object-fit: cover; }
.hosts-name { display: block; padding: 4px 0 6px; font: 400 22px / 1.15 "Sacramento", cursive; color: #5B3F2C; text-align: center; white-space: nowrap; }
.hosts-tape { position: absolute; top: -11px; left: 50%; width: 92px; height: 24px; margin-left: -46px; background: rgba(226, 208, 176, .92); transform: rotate(-3deg); }

.themes { width: 100%; max-width: 520px; margin-top: 16px; text-align: center; }
.themes h2 { margin: 0; font: 400 30px / 1.1 "Knewave", sans-serif; color: var(--mustard); text-shadow: 2px 2px 0 var(--ink); }
.themes p { margin: 2px 0 10px; font-weight: 500; font-size: 19px; }
.theme-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.theme-card { position: relative; display: block; width: 100%; padding: 0; text-align: center; }
.theme-card img { display: block; width: 100%; aspect-ratio: 9 / 16; object-fit: cover; background: #5A1410; box-shadow: 2px 3px 0 rgba(30, 18, 8, .5); }
.theme-card span { display: block; padding: 5px 0 2px; font-weight: 700; font-size: 16px; line-height: 1.1; color: var(--cream); }
.theme-card[aria-pressed="true"] img { outline: 4px solid var(--mustard); outline-offset: 0; }
.theme-card[aria-pressed="true"] span { color: var(--mustard); }
.theme-card[aria-pressed="true"]::after { content: "✓"; position: absolute; top: 6px; right: 6px; display: grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; background: var(--mustard); color: var(--ink); font-weight: 700; font-size: 17px; }
.theme-card .pics, .strip-card .pics { position: absolute; top: 6px; left: 6px; padding: 2px 6px; background: var(--ink); color: var(--mustard); font-size: 13px; font-weight: 700; }
.strip-card .pics { top: 3px; left: 3px; padding: 1px 4px; font-size: 11px; }

.wall-link { display: flex; align-items: center; gap: 10px; margin-top: 18px; color: var(--mustard); font-weight: 700; letter-spacing: .05em; text-decoration: none; text-transform: uppercase; }
.wall-thumbs { display: flex; }
.wall-thumbs img { width: 30px; height: 40px; object-fit: cover; margin-left: -8px; border: 2px solid var(--mustard); transform: rotate(-4deg); }
.wall-thumbs img:first-child { margin-left: 0; }
.wall-thumbs img:nth-child(even) { transform: rotate(5deg); }

.dock {
  position: fixed; left: 20px; right: 20px; bottom: 0; z-index: 3;
  display: grid; grid-template-columns: 1fr 112px; gap: 8px; padding: 14px 10px max(8px, env(safe-area-inset-bottom));
  background: linear-gradient(to top, var(--red-deep) 62%, rgba(138, 26, 21, 0));
}
.shoot { display: grid; justify-items: center; min-height: 66px; padding: 8px 12px 7px; background: var(--mustard); color: var(--ink); box-shadow: 4px 4px 0 var(--ink); }
.shoot:active { transform: translate(3px, 3px); box-shadow: 1px 1px 0 var(--ink); }
.shoot-main { font: 400 25px / 1.1 "Alfa Slab One", serif; text-transform: uppercase; }
.shoot-theme { font-weight: 700; font-size: 16px; }
.alts { display: grid; gap: 6px; }
.alt { display: grid; place-items: center; min-height: 30px; font-weight: 700; font-size: 14px; letter-spacing: .04em; text-transform: uppercase; color: var(--cream); border: 2px solid var(--cream); background: rgba(30, 18, 8, .28); }
.alt:active { background: var(--cream); color: var(--ink); }

/* Editor */

.editor {
  position: fixed; inset: 0; z-index: 10; display: flex; flex-direction: column;
  background: var(--noise), var(--night);
  padding: max(6px, env(safe-area-inset-top)) 0 max(10px, env(safe-area-inset-bottom));
}
.editor-top { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 8px; padding: 0 12px 6px; }
.top-btn { justify-self: start; min-height: 38px; font-weight: 700; font-size: 17px; letter-spacing: .04em; color: var(--cream); }
#fit { justify-self: end; color: var(--mustard); }
.formats { display: flex; border: 2px solid var(--cream); }
.format { padding: 4px 16px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--cream); }
.format[aria-checked="true"] { background: var(--cream); color: var(--ink); }

.stage { position: relative; flex: 1 1 0; min-height: 0; display: flex; align-items: center; justify-content: center; overflow: hidden; touch-action: none; cursor: grab; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; }
.preview { display: block; box-shadow: 0 8px 28px rgba(0, 0, 0, .6); }
.hint { position: absolute; left: 50%; bottom: 10px; margin: 0; padding: 5px 13px; transform: translateX(-50%); white-space: nowrap; background: rgba(20, 9, 10, .82); color: var(--cream); font-weight: 700; font-size: 17px; pointer-events: none; transition: opacity .4s; }
.hint.off { opacity: 0; }

.zoom { display: grid; grid-template-columns: 30px 1fr 30px auto; align-items: center; gap: 4px; padding: 3px 14px 0; }
.name-btn { max-width: 132px; min-height: 34px; margin-left: 6px; padding: 0 10px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; font-weight: 700; font-size: 15px; color: var(--ink); background: var(--cream); }
.flip-btn { flex: none; min-height: 36px; padding: 0 12px; font-weight: 700; font-size: 16px; color: var(--cream); border: 2px solid var(--cream); }
.flip-btn:active { background: var(--cream); color: var(--ink); }
.zoom-btn { height: 36px; font-size: 26px; line-height: 1; color: var(--mustard); }
#zoomBar { width: 100%; height: 30px; margin: 0; accent-color: var(--mustard); }

.strip { flex: none; display: flex; align-items: flex-start; gap: 8px; padding: 6px 14px 4px; overflow-x: auto; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
.strip::-webkit-scrollbar { display: none; }
.strip-card { position: relative; flex: 0 0 72px; width: 72px; padding: 0; text-align: center; }
.strip-card img { display: block; width: 72px; height: 96px; object-fit: cover; object-position: center 30%; background: #2A1810; }
.strip-card > span:not(.pics) { display: block; padding-top: 3px; font-weight: 500; font-size: 13px; line-height: 1.05; color: var(--cream); }
.strip-card[aria-pressed="true"] img { outline: 3px solid var(--mustard); outline-offset: -1px; }
.strip-card[aria-pressed="true"] > span:not(.pics) { color: var(--mustard); font-weight: 700; }

.tray { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 4px 16px; }
.thumbs { display: flex; gap: 8px; }
.thumb { position: relative; width: 40px; height: 48px; padding: 0; border: 2px solid transparent; background: #2A1810; }
.thumb.on { border-color: var(--mustard); }
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.thumb.add { display: grid; place-items: center; font-size: 24px; color: var(--mustard); border: 2px dashed var(--mustard); }
.thumb-x { position: absolute; top: -8px; right: -8px; display: grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; background: var(--cream); color: var(--ink); font-size: 13px; font-weight: 700; line-height: 1; }
.check { display: flex; align-items: center; gap: 8px; font-weight: 500; font-size: 17px; }
.check input { width: 20px; height: 20px; margin: 0; accent-color: var(--mustard); }

.actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; padding: 4px 16px 0; }
.actions.one { grid-template-columns: 1fr; }
#update { grid-column: 1 / -1; }
.btn { display: grid; place-items: center; min-height: 52px; padding: 0 10px; font: 400 18px "Alfa Slab One", serif; text-transform: uppercase; white-space: nowrap; }
.btn.primary { background: var(--mustard); color: var(--ink); box-shadow: 4px 4px 0 var(--red); }
.btn.primary:active { transform: translate(3px, 3px); box-shadow: 1px 1px 0 var(--red); }
.btn.ghost { color: var(--cream); border: 2px solid var(--cream); font-size: 16px; }
.btn[disabled] { opacity: .6; }

.hold { position: fixed; inset: 0; z-index: 22; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; padding: max(14px, env(safe-area-inset-top)) 16px max(14px, env(safe-area-inset-bottom)); background: rgba(10, 5, 4, .97); }
.hold img { flex: 0 1 auto; min-height: 0; max-width: 100%; max-height: 66vh; -webkit-touch-callout: default; -webkit-user-select: auto; user-select: auto; }
.ask { background: rgba(10, 5, 4, .9); }
.hold-text { margin: 0; font: 400 21px / 1.25 "Alfa Slab One", serif; text-align: center; color: var(--mustard); text-wrap: balance; }
.hold-actions { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 10px; width: 100%; max-width: 420px; }

.selfie { position: fixed; inset: 0; z-index: 21; background: #000; }
.selfie video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; transform: scaleX(-1); }
.selfie.flash::after { content: ""; position: absolute; inset: 0; background: #fff; animation: selfie-flash .3s ease-out forwards; }
@keyframes selfie-flash { from { opacity: .9; } to { opacity: 0; } }
.selfie-close { position: absolute; top: max(14px, env(safe-area-inset-top)); left: 14px; width: 46px; height: 46px; border-radius: 50%; font-size: 21px; color: #fff; background: rgba(0, 0, 0, .55); }
.selfie-shoot { position: absolute; left: 50%; bottom: calc(26px + env(safe-area-inset-bottom)); width: 80px; height: 80px; margin-left: -40px; border: 6px solid #fff; border-radius: 50%; background: var(--mustard); }
.selfie-shoot:active { transform: scale(.92); }

/* Top and height follow the part of the screen left above the keyboard, so the box stays centred. */
.name-sheet { position: fixed; left: 0; right: 0; top: 0; height: 100%; z-index: 23; display: flex; align-items: center; justify-content: center; padding: 16px; background: rgba(10, 5, 4, .84); }
.name-box { display: grid; gap: 8px; width: 100%; max-width: 420px; padding: 18px; background: var(--night); border: 3px solid var(--mustard); box-shadow: 0 10px 34px rgba(0, 0, 0, .6); }
.name-sheet label { font: 400 20px "Alfa Slab One", serif; color: var(--mustard); }
.name-sheet input { width: 100%; height: 50px; padding: 0 12px; border: 0; border-radius: 0; font: 700 20px "Barlow Condensed", sans-serif; color: var(--ink); background: var(--cream); }
.name-sheet p { margin: 0; font-weight: 500; }

.toast {
  position: fixed; left: 50%; bottom: calc(120px + env(safe-area-inset-bottom)); z-index: 30; transform: translateX(-50%);
  width: max-content; max-width: calc(100vw - 40px);
  padding: 9px 16px; background: var(--cream); color: var(--ink); font-weight: 700; font-size: 18px; text-align: center;
  box-shadow: 3px 3px 0 var(--ink);
}

@media (prefers-reduced-motion: reduce) {
  .rail, .intro-hint, .ring, .lamp.lit .fire { animation: none; }
}
