html, body { margin: 0; background: black; color: white; font: 18px system-ui; height: 100%; }
#slide { width: 100%; height: 100%; object-fit: contain; }
#controls { position: fixed; inset: auto 0 0; padding: 20px; background: #000b; text-align: center; }
button { font: inherit; margin: 4px; padding: 8px 16px; }

body:has(#pair-form:not([hidden])) {
  background: radial-gradient(ellipse at top, #233452, #101521 65%);
}
body:has(#pair-form:not([hidden])) #slide,
body:has(#pair-form:not([hidden])) #controls > button {
  display: none;
}
body:has(#pair-form:not([hidden])) #controls {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: center;
  box-sizing: border-box;
  min-height: 100dvh;
  padding: 24px;
  background: none;
}
body:has(#pair-form:not([hidden])) #status {
  order: 1;
  color: #c4cfdf;
}
#pair-form {
  box-sizing: border-box;
  width: min(100%, 520px);
  margin: 0 auto;
  padding: clamp(20px, 5vw, 40px);
  border: 1px solid #35435b;
  border-radius: 24px;
  background: #182235;
  text-align: left;
}
#pair-form h1 {
  margin: 12px 0 28px;
  font-size: clamp(25px, 5vw, 34px);
  line-height: 1.15;
}
#pair-form label {
  display: block;
  margin-bottom: 8px;
  font-size: 16px;
  font-weight: 600;
}
#pair-link, #pair-form button {
  box-sizing: border-box;
  width: 100%;
  min-height: 52px;
  border-radius: 12px;
  font: inherit;
}
#pair-link {
  padding: 12px;
  border: 1px solid #637493;
  background: #101521;
  color: white;
}
#pair-link::placeholder { color: #aab8ce; }
#pair-form button {
  margin: 16px 0 0;
  border: 0;
  background: #b6d1ff;
  color: #101521;
  font-weight: 650;
}
#pair-form :focus-visible { outline: 3px solid #f4d49a; outline-offset: 3px; }
body:has(#pair-form:not([hidden])) #interval-control { display: none; }
#interval-control { display: inline-flex; align-items: center; gap: 8px; margin: 4px; }
#interval { font: inherit; padding: 8px; }

#pair-form a { display: inline-block; margin-top: 18px; color: #b6d1ff; }
#tv-setup:not([hidden]), .approval-page {
  display: grid;
  place-items: center;
  box-sizing: border-box;
  padding: 20px;
  background: #101521;
}
#tv-setup { position: fixed; inset: 0; overflow: auto; text-align: center; }
.setup-card { box-sizing: border-box; width: min(100%, 540px); padding: 24px; border-radius: 24px; background: #182235; }
.setup-card h1 { margin: 12px 0; font-size: 32px; }
.setup-card p { color: #d3deed; }
.setup-card button, .setup-card select, .setup-card input { font: inherit; min-height: 48px; padding: 8px 14px; border-radius: 8px; }
.setup-card button { color: #101521; background: #b6d1ff; border: 0; }
.setup-card button:focus { outline: 3px solid #f4d49a; outline-offset: 3px; }
.setup-card select { width: 100%; margin: 8px 0 16px; }
.setup-card label { display: block; margin: 12px 0; }
.setup-card input { box-sizing: border-box; display: block; width: 100%; margin-top: 8px; border: 1px solid #637493; border-radius: 8px; background: #101521; color: white; text-align: center; letter-spacing: 0.1em; }
#tv-qr { max-height: 42vh; max-width: 100%; object-fit: contain; }

#held-greeting-loop, #opening-video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; }
#held-greeting-loop[hidden], #opening-video[hidden], #slide[hidden], #video-sound[hidden] { display: none; }

#caption {
  position: fixed;
  left: max(24px, env(safe-area-inset-left));
  bottom: max(88px, calc(env(safe-area-inset-bottom) + 88px));
  z-index: 6;
  max-width: min(70vw, 720px);
  margin: 0;
  padding: 7px 13px;
  border-radius: 9px;
  background: rgb(0 0 0 / 48%);
  color: #fff;
  font-size: 15px;
  line-height: 1.35;
  text-shadow: 0 1px 2px rgb(0 0 0 / 50%);
  pointer-events: none;
}
#caption[hidden] { display: none; }
body[data-fit="cover"] #slide { object-fit: cover; }
body.night-dim #slide,
body.night-dim #opening-video,
body.night-dim #held-greeting-loop { filter: brightness(var(--night-brightness, 0.3)); }
body.night-black #slide,
body.night-black #opening-video,
body.night-black #held-greeting-loop { filter: brightness(0); }

/* The setup surface stays separate from the quiet, full-screen player. */
[hidden] { display: none !important; }
button, input, select { font-family: inherit; }
button { cursor: pointer; border: 1px solid #ffffff26; border-radius: 12px; background: #263346; color: #f6f7fb; min-height: 48px; }
button:hover { background: #35445a; }
button:disabled { opacity: .45; cursor: default; }
button:focus-visible, a:focus-visible, select:focus-visible, input:focus-visible { outline: 3px solid #e7bb78; outline-offset: 5px; }
body:has(#pair-form:not([hidden])), .approval-page, #tv-setup:not([hidden]) {
  background: radial-gradient(ellipse at 15% 10%, #30433e 0, transparent 55%), radial-gradient(ellipse at 95% 90%, #30334a 0, transparent 55%), #111b22;
}
body:has(#pair-form:not([hidden])) #controls { padding: 48px 24px; min-height: 100vh; min-height: 100dvh; }
#pair-form { width: min(100%, 640px); padding: clamp(28px, 5vw, 52px); background: #17242c; border: 1px solid #ffffff1f; border-radius: 28px; box-shadow: 0 24px 90px #0005; }
.brand-icon, .setup-card > img:first-child { border-radius: 18px; width: 56px; height: 56px; }
.eyebrow { color: #b7cbbf; font-size: 12px; font-weight: 700; letter-spacing: .17em; margin: 24px 0 16px; }
#pair-form h1 { font-size: clamp(34px, 5vw, 48px); font-weight: 600; letter-spacing: -.04em; line-height: 1.08; margin: 0 0 18px; }
.setup-intro { color: #b8c4ce; font-size: 18px; line-height: 1.6; margin: 0 0 28px; }
.setup-steps { list-style: none; padding: 0; margin: 28px 0 32px; color: #d9e2e7; font-size: 15px; line-height: 1.6; }
.setup-steps li { display: block; margin: 12px 0; }
.setup-steps li span { display: inline-block; width: 24px; margin-right: 8px; text-align: center; background: #ffffff12; border-radius: 50%; color: #b7cbbf; }
.setup-steps strong { font-weight: 600; }
#pair-form label { color: #e5ecf1; font-size: 14px; }
#pair-link { min-height: 58px; background: #101c24; border: 1px solid #687c89; font-size: 16px; padding: 16px; }
#pair-form button, .setup-card button { background: #d9eadc; color: #14271d; min-height: 54px; font-weight: 650; }
#pair-form button:hover, .setup-card button:hover { background: #edf7ee; }
#pair-form button span { float: right; }
.setup-alternative { margin: 24px 0 0; color: #b8c4ce; font-size: 15px; }
#pair-form a { color: #deeddf; margin: 0; text-underline-offset: 4px; }
.setup-note { margin: 28px 0 0; padding-top: 22px; border-top: 1px solid #ffffff16; color: #9fb1bd; font-size: 13px; line-height: 1.6; }
body:has(#pair-form:not([hidden])) #status { font-size: 14px; max-width: 580px; margin: 20px auto 0; line-height: 1.6; }
.setup-card { width: min(100%, 680px); padding: clamp(28px, 5vw, 52px); border: 1px solid #ffffff1f; background: #17242c; box-shadow: 0 24px 90px #0005; }
.setup-card h1 { font-size: clamp(30px, 4vw, 44px); font-weight: 600; letter-spacing: -.035em; }
.setup-card p { line-height: 1.6; }
.setup-card input { min-height: 62px; font-size: 26px; }
#tv-qr { background: white; padding: 16px; border-radius: 16px; box-sizing: border-box; margin-top: 20px; }
#controls { padding: 20px max(20px, env(safe-area-inset-right)) max(20px, env(safe-area-inset-bottom)); background: linear-gradient(transparent, #071019ee); }
#interval { border: 1px solid #ffffff36; border-radius: 10px; color: white; background: #263346; min-height: 48px; }
@media (min-width: 1100px) { #tv-setup .setup-card { width: 780px; padding: 48px 64px; } }
@media (max-width: 480px) { body:has(#pair-form:not([hidden])) #controls { padding: 20px 16px; } #pair-form { border-radius: 20px; padding: 28px 24px; } .setup-steps li { display: block; } .setup-steps li span { display: inline-block; width: 24px; margin-right: 8px; } }

.display-code { font-size: 30px; font-weight: 600; letter-spacing: .16em; margin: 18px 0; }
.primary-link { display: block; padding: 16px 20px; border-radius: 12px; color: #14271d; background: #d9eadc; text-decoration: none; font-weight: 650; margin: 20px 0; }
#tv-code { background: transparent; color: #d9eadc; border: 1px solid #687c89; }
#tv-setup .setup-intro + .setup-intro { display: none; }

#tv-setup .setup-card { width: min(100%, 1000px); padding: 36px; }
#tv-setup .eyebrow { margin: 12px 0; }
#tv-setup h1 { margin: 12px 0; }
.pairing-layout { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 36px; align-items: center; margin-top: 28px; }
.qr-panel { text-align: center; }
#tv-qr { width: 270px; height: 270px; margin: 0; }
#tv-message { font-size: 14px; color: #b8c4ce; max-width: 320px; margin: 16px auto 0; }
.pairing-options { text-align: left; padding-left: 32px; border-left: 1px solid #ffffff20; }
.option-label { font-weight: 600; margin: 0; }
.pairing-options .setup-note { border: 0; padding: 0; margin: 12px 0; overflow-wrap: anywhere; }
.pairing-options #tv-code { font-size: 14px; min-height: 44px; margin: 8px 0 0; }
@media (max-width: 680px) { .pairing-layout { grid-template-columns: 1fr; gap: 24px; } .pairing-options { border-left: 0; border-top: 1px solid #ffffff20; padding: 24px 0 0; text-align: center; } #tv-setup .setup-card { padding: 28px 24px; } }
body:has(#tv-setup:not([hidden])) #controls,
body:has(#tv-setup:not([hidden])) #slide { display: none; }

.pairing-options .setup-steps { margin: 16px 0; font-size: 15px; }
.pairing-alternatives { margin: 22px 0 12px; padding-top: 18px; border-top: 1px solid #ffffff20; }
.pairing-alternatives summary { color: #d9eadc; cursor: pointer; padding: 10px 0; font-size: 15px; }
.pairing-alternatives summary:focus-visible { outline: 3px solid #e7bb78; outline-offset: 4px; }
.pairing-alternatives .option-label { margin-top: 18px; font-size: 14px; }
.secondary-link { display: inline-block; color: #d9eadc; margin: 12px 0 0; padding: 10px 0; text-underline-offset: 4px; font-size: 15px; }

#occasion-card { position: fixed; right: max(24px, env(safe-area-inset-right)); bottom: max(100px, env(safe-area-inset-bottom)); z-index: 5; box-sizing: border-box; width: min(360px, 38vw); padding: 24px; border-radius: 18px; background: #101b26eb; color: #fff; border: 1px solid #ffffff35; box-shadow: 0 8px 32px #0004; overflow-wrap: anywhere; pointer-events: none; }
#occasion-card h2 { font-size: clamp(20px, 2.6vw, 32px); margin: 6px 0 12px; line-height: 1.15; }
#occasion-card p { font-size: clamp(14px, 1.5vw, 20px); line-height: 1.4; margin: 0; }
#occasion-countdown:not(:empty) { color: #f6d390; font-size: clamp(24px, 3.5vw, 44px); font-weight: 650; margin-bottom: 12px; }
#occasion-card[data-style="warm"] { background: #302126eb; }
#occasion-card[data-style="warm"]::before { content: '♥'; color: #f4a5bb; font-size: 25px; }
#occasion-card[data-style="celebration"] { background: #1d2944ed; border-color: #e8c475; }
#occasion-card[data-style="celebration"]::before { content: '✦'; color: #e8c475; font-size: 25px; }
body.night-dim #occasion-card { filter: brightness(var(--night-brightness, .3)); }
body.night-black #occasion-card { visibility: hidden; }
@media (max-width: 680px) { #occasion-card { width: min(300px, 76vw); right: 16px; bottom: 100px; padding: 18px; } }
.frame-auth-options { display: grid; gap: 10px; margin: 18px 0; }
.frame-auth-options button { width: 100%; min-height: 48px; }
.frame-email-sign-in { display: grid; gap: 10px; }
.frame-email-sign-in label { display: grid; gap: 6px; text-align: left; }
.frame-email-sign-in input { box-sizing: border-box; width: 100%; min-height: 48px; padding: 10px 12px; border: 1px solid #718094; border-radius: 10px; background: #17212e; color: #fff; font: inherit; }
