/* =============================================================
   Video Guestbook — styles (iPad landscape first, works portrait)
   ============================================================= */
:root {
  --accent: #C9A96E;
  --bg: #0d0c0b;
  --ink: #f7f3ec;
  --muted: rgba(247, 243, 236, .62);
  --card: rgba(20, 18, 16, .78);
  --line: rgba(247, 243, 236, .16);
  --danger: #e5484d;
  --rec: #ff3b30;
  --font-head: "Snell Roundhand", "Savoye LET", cursive;
  --font-body: "Avenir Next", "Helvetica Neue", system-ui, -apple-system, sans-serif;
  --radius: 22px;
  --safe-t: env(safe-area-inset-top, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; overflow: hidden; background: var(--bg); color: var(--ink);
  font-family: var(--font-body); -webkit-user-select: none; user-select: none; touch-action: manipulation;
  overscroll-behavior: none; }
input, textarea, select { -webkit-user-select: text; user-select: text; font: inherit; }
button { font: inherit; color: inherit; cursor: pointer; }
[hidden] { display: none !important; }

/* ---------- stage ---------- */
#cam { position: fixed; width: 2px; height: 2px; opacity: 0; pointer-events: none; left: 0; top: 0; }
#backdrop { position: fixed; inset: 0; background: var(--bg) center / cover no-repeat; display: none; }
#backdrop::after { content: ""; position: absolute; inset: 0;
  background: radial-gradient(ellipse at center, rgba(0,0,0,.25), rgba(0,0,0,.7)); }
#stage { position: fixed; inset: 0; display: none; align-items: center; justify-content: center; background: #000; overflow: hidden; }
#view { width: 100%; height: 100%; object-fit: contain; display: block; transition: filter .6s ease, transform .6s ease; }

body[data-screen="live"] #stage { display: flex; }
body[data-screen="live"][data-mode="audio"] #stage { display: none; }
body[data-screen="attract"][data-bg="live"] #stage,
body[data-screen="name"][data-bg="live"] #stage,
body[data-screen="prompt"][data-bg="live"] #stage,
body[data-screen="thanks"][data-bg="live"] #stage { display: flex; }
body:not([data-screen="live"]) #view { filter: blur(28px) brightness(.5) saturate(1.1); transform: scale(1.12); object-fit: cover; }
body[data-bg="image"] #backdrop, body[data-bg="color"] #backdrop { display: block; }
body[data-screen="live"] #backdrop { display: none; }
body[data-screen="live"][data-mode="audio"] #backdrop { display: block; }

/* ---------- screens ---------- */
.screen { position: fixed; inset: 0; display: none; align-items: center; justify-content: center;
  padding: calc(24px + var(--safe-t)) 32px calc(24px + var(--safe-b)); }
.screen.active { display: flex; animation: fadeIn .35s ease; }
@keyframes fadeIn { from { opacity: 0 } to { opacity: 1 } }
.center-col { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 14px; max-width: 900px; position: relative; z-index: 1; }

.eyebrow { margin: 0; letter-spacing: .32em; text-transform: uppercase; font-size: 14px; color: var(--accent); font-weight: 600; }
.names { margin: 0; font-family: var(--font-head); font-weight: 400; font-size: clamp(56px, 10vmin, 120px); line-height: 1.05;
  text-shadow: 0 4px 30px rgba(0,0,0,.45); }
.names.small { font-size: clamp(36px, 6vmin, 64px); }
.headline { margin: 0; font-weight: 500; font-size: clamp(22px, 3.4vmin, 34px); letter-spacing: .02em; }
.sub { margin: 0; color: var(--muted); font-size: clamp(16px, 2.4vmin, 22px); }
.pulse { animation: pulse 2.2s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .35 } }
.a-logo { max-height: 90px; max-width: 260px; object-fit: contain; margin-bottom: 6px; }
.corner-note { position: fixed; bottom: calc(18px + var(--safe-b)); left: 28px; margin: 0; color: var(--muted); font-size: 15px; letter-spacing: .08em; }
.corner-note.right { left: auto; right: 28px; }
.studio { display: flex; align-items: center; }
.studio img { height: 40px; width: auto; opacity: .85; }
.cam-error { color: #ffb4b4; background: rgba(120, 20, 20, .5); padding: 10px 16px; border-radius: 12px; font-size: 15px; }

/* mode buttons */
.modes { display: flex; gap: 18px; flex-wrap: wrap; justify-content: center; margin-top: 10px; }
.mode-btn { width: 170px; height: 170px; border-radius: 28px; border: 1px solid var(--line); background: var(--card);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); display: flex; flex-direction: column; align-items: center;
  justify-content: center; gap: 12px; font-size: 18px; font-weight: 600; transition: transform .15s ease, border-color .15s; }
.mode-btn svg { width: 54px; height: 54px; stroke: var(--accent); }
.mode-btn:active { transform: scale(.96); border-color: var(--accent); }
.mode-btn small, .btn small { display: block; font-size: .78em; font-weight: 500; opacity: .8; margin-top: 2px; }

/* buttons */
.btn { border: 1px solid var(--line); background: rgba(255,255,255,.06); padding: 16px 28px; border-radius: 999px;
  font-size: 19px; font-weight: 600; min-height: 60px; line-height: 1.15; transition: transform .12s ease; }
.btn:active { transform: scale(.97); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #17130d; }
.btn.danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn.ghost { background: rgba(0,0,0,.35); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); }
.btn.small { padding: 10px 18px; min-height: 44px; font-size: 16px; }
.btn.big { padding: 20px 40px; font-size: 22px; }
.btn:disabled { opacity: .4; }
.link { background: none; border: 0; color: var(--muted); text-decoration: underline; font-size: 17px; padding: 12px; }
.row { display: flex; gap: 14px; justify-content: center; flex-wrap: wrap; }

/* cards */
.card { background: var(--card); backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 36px; width: min(680px, 100%); display: flex; flex-direction: column; gap: 22px; align-items: stretch; text-align: center; position: relative; z-index: 1; }
.card-title { margin: 0; font-size: 28px; font-weight: 600; }
#guest-name { width: 100%; padding: 20px 22px; font-size: 24px; border-radius: 16px; border: 1px solid var(--line);
  background: rgba(0,0,0,.35); color: var(--ink); text-align: center; outline: none; }
#guest-name:focus { border-color: var(--accent); }
.consent { display: flex; gap: 14px; align-items: flex-start; text-align: left; font-size: 17px; color: var(--muted); }
.consent input { width: 28px; height: 28px; accent-color: var(--accent); flex: none; }
.prompt-card { width: min(760px, 100%); }
.prompt-text { margin: 0; font-family: var(--font-head); font-size: clamp(30px, 5vmin, 50px); line-height: 1.25; min-height: 2.5em;
  display: flex; align-items: center; justify-content: center; }
.prompt-text.swap { animation: swap .35s ease; }
@keyframes swap { from { opacity: 0; transform: translateY(10px) } to { opacity: 1; transform: none } }

/* ---------- live ---------- */
#s-live { padding: 0; align-items: stretch; justify-content: space-between; flex-direction: column; }
#s-live.active { display: flex; }
.progress { position: absolute; top: 0; left: 0; right: 0; height: 6px; background: rgba(255,255,255,.12); z-index: 3; }
#rec-progress { height: 100%; width: 0; background: var(--rec); transition: width .2s linear; }
.live-top { display: flex; align-items: flex-start; gap: 16px; padding: calc(20px + var(--safe-t)) 24px 40px;
  background: linear-gradient(rgba(0,0,0,.55), transparent); z-index: 2; }
.live-prompt { flex: 1; text-align: center; font-size: clamp(20px, 3vmin, 30px); font-weight: 600; text-shadow: 0 2px 12px rgba(0,0,0,.6); padding-top: 6px; }
.live-prompt small { display: block; font-weight: 500; opacity: .85; }
.rec-badge { display: flex; align-items: center; gap: 10px; background: rgba(0,0,0,.55); padding: 10px 16px; border-radius: 999px;
  font-variant-numeric: tabular-nums; font-weight: 700; font-size: 20px; }
.rec-badge .dot { width: 14px; height: 14px; border-radius: 50%; background: var(--rec); animation: blink 1s steps(2) infinite; }
@keyframes blink { 50% { opacity: .2 } }
body[data-rec="1"] #live-back, body[data-busy="1"] #live-back, body[data-rec="1"] .filters { visibility: hidden; }

.live-bottom { padding: 40px 24px calc(26px + var(--safe-b)); background: linear-gradient(transparent, rgba(0,0,0,.6)); z-index: 2; display: flex; flex-direction: column; gap: 18px; align-items: center; }
.filters { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; }
.chip { padding: 10px 18px; border-radius: 999px; border: 1px solid var(--line); background: rgba(0,0,0,.45); font-size: 16px; font-weight: 600; }
.chip.on { background: var(--ink); color: #111; border-color: var(--ink); }
.shutter-row { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; width: 100%; gap: 20px; }
.meter { justify-self: end; width: 14px; height: 90px; border-radius: 8px; background: rgba(255,255,255,.15); overflow: hidden; display: flex; align-items: flex-end; }
#meter { width: 100%; height: 0; background: linear-gradient(to top, #3ddc84, #e8d44d 70%, #ff5a4f); transition: height .06s linear; }
.live-hint { justify-self: start; font-size: 18px; color: var(--ink); text-shadow: 0 2px 10px rgba(0,0,0,.7); max-width: 320px; }
.shutter { width: 116px; height: 116px; border-radius: 50%; border: 6px solid #fff; background: rgba(0,0,0,.25); padding: 0;
  display: grid; place-items: center; transition: transform .12s ease; }
.shutter:active { transform: scale(.94); }
.shutter span { width: 86px; height: 86px; border-radius: 50%; background: var(--rec); transition: all .25s ease; }
body[data-mode="photo"] .shutter span, body[data-mode="boomerang"] .shutter span { background: #fff; }
body[data-rec="1"] .shutter span { width: 44px; height: 44px; border-radius: 10px; background: var(--rec); }
body[data-busy="1"] .shutter { opacity: .4; }

.audio-stage { display: none; position: absolute; inset: 0; flex-direction: column; align-items: center; justify-content: center; gap: 10px; pointer-events: none; }
body[data-mode="audio"] .audio-stage { display: flex; }
#audio-viz { width: min(900px, 86vw); height: auto; }

.countdown { position: absolute; inset: 0; display: grid; place-items: center; font-size: 34vmin; font-weight: 700; pointer-events: none;
  text-shadow: 0 10px 50px rgba(0,0,0,.6); z-index: 4; }
.countdown.pop { animation: pop .9s ease forwards; }
@keyframes pop { 0% { transform: scale(1.6); opacity: 0 } 25% { transform: scale(1); opacity: 1 } 80% { opacity: 1 } 100% { opacity: 0; transform: scale(.85) } }
.flash { position: absolute; inset: 0; background: #fff; opacity: 0; pointer-events: none; z-index: 5; }
.flash.go { animation: flash .5s ease-out; }
@keyframes flash { 0% { opacity: .95 } 100% { opacity: 0 } }

/* ---------- processing / review ---------- */
.proc-canvas { max-width: 70vw; max-height: 60vh; border-radius: 18px; box-shadow: 0 20px 60px rgba(0,0,0,.5); }
#s-review { flex-direction: column; gap: 20px; background: #000; }
.review-media { flex: 1; width: 100%; display: flex; align-items: center; justify-content: center; min-height: 0; }
.review-media video, .review-media img { max-width: 100%; max-height: 100%; border-radius: 16px; background: #000; }
.review-media .audio-review { display: flex; flex-direction: column; align-items: center; gap: 24px; }
.review-media audio { width: min(560px, 80vw); }
.review-bar { display: flex; gap: 18px; justify-content: center; }
.autosave { margin: 0; color: var(--muted); font-size: 15px; min-height: 1.2em; }

/* ---------- thanks ---------- */
#confetti { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.qr { background: #fff; padding: 12px; border-radius: 16px; margin-top: 18px; line-height: 0; }
.qr svg { width: 180px; height: 180px; }

/* ---------- modals ---------- */
.modal { position: fixed; inset: 0; background: rgba(0,0,0,.6); display: flex; align-items: center; justify-content: center; z-index: 50; padding: 24px; }
.pin-card { width: 360px; align-items: center; }
.pin-dots { display: flex; gap: 14px; justify-content: center; min-height: 20px; }
.pin-dots i { width: 16px; height: 16px; border-radius: 50%; border: 2px solid var(--ink); }
.pin-dots i.f { background: var(--ink); }
.pin-card.shake { animation: shake .4s; }
@keyframes shake { 25% { transform: translateX(-10px) } 75% { transform: translateX(10px) } }
.keypad { display: grid; grid-template-columns: repeat(3, 80px); gap: 14px; justify-content: center; }
.keypad button { height: 80px; border-radius: 50%; border: 1px solid var(--line); background: rgba(255,255,255,.07); font-size: 28px; }
.player-card { width: min(900px, 100%); }
.player-card video, .player-card img { width: 100%; max-height: 65vh; border-radius: 12px; background: #000; }
.player-card audio { width: 100%; }

#toast { position: fixed; left: 50%; bottom: 30px; transform: translateX(-50%) translateY(150%); background: #222; color: #fff;
  padding: 14px 22px; border-radius: 14px; font-size: 16px; z-index: 60; transition: transform .3s ease; max-width: 90vw; text-align: center; }
#toast.show { transform: translateX(-50%) translateY(0); }
#toast.error { background: #8a1c1c; }
#hotspot { position: fixed; top: 0; left: 0; width: 90px; height: 90px; z-index: 40; }
body[data-screen="admin"] #hotspot { display: none; }

/* ---------- admin ---------- */
.screen.admin { padding: 0; flex-direction: column; align-items: stretch; justify-content: flex-start; background: #111; -webkit-user-select: text; user-select: text; }
.admin-head { display: flex; align-items: center; gap: 18px; padding: calc(14px + var(--safe-t)) 22px 14px; border-bottom: 1px solid var(--line); background: #161616; flex-wrap: wrap; }
.admin-head h2 { margin: 0; font-size: 20px; }
#admin-tabs { display: flex; gap: 6px; flex: 1; flex-wrap: wrap; }
#admin-tabs button { border: 0; background: transparent; padding: 10px 16px; border-radius: 999px; font-size: 16px; color: var(--muted); }
#admin-tabs button.on { background: #2a2a2a; color: var(--ink); }
.admin-body { flex: 1; overflow-y: auto; -webkit-overflow-scrolling: touch; padding: 22px 22px 80px; }
.fieldset { max-width: 860px; margin: 0 auto; display: flex; flex-direction: column; gap: 2px; }
.field { display: grid; grid-template-columns: 260px 1fr; gap: 18px; align-items: center; padding: 14px 0; border-bottom: 1px solid #222; }
.field > label { font-weight: 600; font-size: 16px; }
.field .help { display: block; font-weight: 400; font-size: 13px; color: var(--muted); margin-top: 4px; }
.field input[type=text], .field input[type=number], .field input[type=url], .field select, .field textarea {
  width: 100%; padding: 12px 14px; border-radius: 10px; border: 1px solid #333; background: #1c1c1c; color: var(--ink); font-size: 16px; }
.field textarea { min-height: 200px; resize: vertical; line-height: 1.5; }
.field input[type=color] { width: 70px; height: 44px; border: 0; background: none; padding: 0; }
.switch { position: relative; width: 58px; height: 34px; display: inline-block; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch span { position: absolute; inset: 0; background: #3a3a3a; border-radius: 999px; transition: .2s; }
.switch span::after { content: ""; position: absolute; left: 4px; top: 4px; width: 26px; height: 26px; background: #fff; border-radius: 50%; transition: .2s; }
.switch input:checked + span { background: var(--accent); }
.switch input:checked + span::after { transform: translateX(24px); }
.file-row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.file-row img { height: 54px; max-width: 120px; object-fit: contain; background: #222; border-radius: 8px; }
.section-title { max-width: 860px; margin: 26px auto 6px; font-size: 13px; letter-spacing: .2em; text-transform: uppercase; color: var(--accent); }
.status-box { background: #1a1a1a; border: 1px solid #2a2a2a; border-radius: 12px; padding: 14px 16px; font: 13px/1.6 ui-monospace, Menlo, monospace; white-space: pre-wrap; color: #cfcfcf; }
.devices-preview { width: 100%; max-width: 420px; border-radius: 12px; background: #000; }
.toolbar { max-width: 1100px; margin: 0 auto 18px; display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.toolbar select { padding: 10px 12px; border-radius: 10px; background: #1c1c1c; color: var(--ink); border: 1px solid #333; font-size: 16px; }
.toolbar .muted { margin-left: auto; }
.muted { color: var(--muted); font-size: 14px; }
.gallery { max-width: 1100px; margin: 0 auto; display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 16px; }
.clip { background: #1a1a1a; border: 1px solid #262626; border-radius: 14px; overflow: hidden; display: flex; flex-direction: column; }
.clip .thumb { aspect-ratio: 16/9; background: #000 center / cover no-repeat; position: relative; display: grid; place-items: center; color: var(--accent); }
.clip .thumb svg { width: 44px; height: 44px; stroke: var(--accent); }
.clip .badge { position: absolute; top: 8px; left: 8px; background: rgba(0,0,0,.7); padding: 4px 10px; border-radius: 999px; font-size: 12px; color: #fff; text-transform: uppercase; letter-spacing: .08em; }
.clip .meta { padding: 10px 12px; font-size: 14px; display: flex; flex-direction: column; gap: 3px; }
.clip .meta b { font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.clip .acts { display: grid; grid-template-columns: repeat(4, 1fr); border-top: 1px solid #262626; }
.clip .acts button { background: none; border: 0; padding: 12px 4px; font-size: 13px; color: var(--ink); }
.clip .acts button + button { border-left: 1px solid #262626; }
.clip .acts .del { color: #ff8a8a; }
.empty { text-align: center; color: var(--muted); padding: 60px 0; }
.help-text { max-width: 860px; margin: 0 auto; color: #d6d6d6; line-height: 1.6; font-size: 15px; }
.help-text code { background: #222; padding: 2px 6px; border-radius: 6px; }

@media (max-width: 760px) {
  .field { grid-template-columns: 1fr; gap: 8px; }
  .mode-btn { width: 140px; height: 140px; font-size: 16px; }
  .shutter { width: 96px; height: 96px; }
  .shutter span { width: 70px; height: 70px; }
}

/* bilingual (English + Hindi) labels stack on two lines */
[data-t] small, .live-hint small, .sub small, .autosave small { display: block; font-size: .85em; opacity: .85; margin-top: 2px; }

/* iPad landscape: camera-app layout — shutter on the right, filters on the left,
   so the burned-in names at the bottom of the frame stay visible */
@media (orientation: landscape) and (min-width: 900px) {
  .live-bottom { position: absolute; top: 0; bottom: 0; right: 0; width: 220px; padding: 24px 24px calc(24px + var(--safe-b));
    background: linear-gradient(to left, rgba(0,0,0,.6), transparent); justify-content: center; }
  .shutter-row { grid-template-columns: 1fr; justify-items: center; gap: 18px; }
  .meter { justify-self: center; order: -1; height: 70px; }
  .live-hint { justify-self: center; text-align: center; font-size: 16px; max-width: 190px; }
  .filters { position: fixed; left: 20px; top: 50%; transform: translateY(-50%); flex-direction: column; align-items: stretch; z-index: 3; }
  .live-top { padding-right: 24px; }
}

/* Tamil/Hindi lines must not inherit wide letter-spacing or uppercase (breaks the script) */
.eyebrow small, [data-t] small { letter-spacing: normal; text-transform: none; }
