/* ============================================================================
 * ELBO CARD — application styles
 * Mobile-first, full-bleed. The wireframe drew the app inside a phone bezel;
 * installed, the app *is* the phone, so the bezel only appears on desktop
 * where a 340px column would otherwise look broken.
 * ========================================================================== */

*,
*::before,
*::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box
}

html,
body {
  height: 100%;
  overscroll-behavior-y: none
}

body {
  background: var(--sand);
  color: var(--ink);
  font-family: var(--font);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}

button {
  font: inherit;
  color: inherit;
  background: none;
  border: none;
  cursor: pointer;
  text-align: inherit
}

input,
select,
textarea {
  font: inherit;
  color: var(--ink)
}

:focus-visible {
  outline: 3px solid var(--flare);
  outline-offset: 2px;
  border-radius: 6px
}

@media (prefers-reduced-motion:reduce) {

  *,
  *::before,
  *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
    scroll-behavior: auto !important
  }
}

/* ---------- app frame -------------------------------------------------- */
#app {
  position: relative;
  display: flex;
  flex-direction: column;
  height: 100dvh;
  width: 100%;
  background: var(--paper);
  overflow: hidden;
}

@media (min-width:600px) {
  body {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px
  }

  #app {
    width: 390px;
    height: min(844px, calc(100dvh - 48px));
    border-radius: 38px;
    border: 1px solid var(--line);
    box-shadow: var(--shadow)
  }
}

/* ---------- screen ----------------------------------------------------- */
/*
 * #view-root sits between #app and .view. Without these it is a plain block,
 * so .view's `flex:1` has no flex parent to act on, the screen sizes to its
 * content, and long screens simply cannot scroll. The install banner and the
 * offline bar are siblings of it, which is why it must shrink around them.
 */
#view-root {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.view {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: calc(20px + var(--safe-t)) 22px calc(24px + var(--safe-b));
}

.view::-webkit-scrollbar {
  width: 0
}

.view--night {
  background: var(--night);
  color: #fff
}

.view--grad {
  background: linear-gradient(170deg, #FF8A5C, var(--flare) 50%, var(--punch));
  color: #fff
}

.view--center {
  text-align: center
}

.spacer {
  flex: 1
}

/* ---------- typography ------------------------------------------------- */
.h1 {
  font-size: clamp(23px, 6vw, 28px);
  font-weight: 800;
  line-height: 1.1
}

.h2 {
  font-size: 19px;
  font-weight: 800;
  line-height: 1.15
}

.h3 {
  font-size: 15px;
  font-weight: 800
}

.eyebrow {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1px;
  color: var(--muted)
}

.view--night .eyebrow,
.view--grad .eyebrow {
  color: var(--slate)
}

.view--grad .eyebrow {
  color: rgba(255, 255, 255, .8)
}

.note {
  font-size: 13px;
  font-weight: 600;
  color: var(--muted-2);
  line-height: 1.5
}

.view--night .note,
.view--grad .note {
  color: rgba(255, 255, 255, .82)
}

.tiny {
  font-size: 11.5px;
  font-weight: 600;
  color: var(--muted);
  line-height: 1.45
}

.wordmark {
  font-weight: 800;
  font-size: 15px;
  letter-spacing: .6px;
  color: var(--flare)
}

.view--night .wordmark,
.view--grad .wordmark {
  color: #fff
}

/* ---------- top bar ---------------------------------------------------- */
.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  /* The row is as tall as the wordmark, not as tall as the avatar. A flex row
     takes the height of its tallest child, so without this the 90px circle
     pushes the heading and everything under it down the screen. */
  min-height: 44px
}

.avatar {
  width: 90px;
  height: 90px;
  /* These four are what make it a circle rather than a photo sitting on top of
     the layout: rounded, clipped to that rounding, and a positioning context
     for the image inside. Drop any one and the picture escapes the button. */
  border-radius: 50%;
  overflow: hidden;
  position: relative;
  flex: none;

  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  font-weight: 700;
  color: #fff;
  cursor: pointer;

  /* The 46px of extra height (90 − 44) comes off the bottom only. Splitting it
     across both edges pulls the circle up into the install banner, where it
     gets clipped. */
  margin-block: 0 -46px;

  transition: transform .12s, box-shadow .12s
}

/* Sits over the initials, so a photo that never loads leaves the fallback
   already in place instead of a hole. object-fit crops rather than squashing —
   a portrait and a landscape both fill the circle without distortion. */
.avatar img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
  display: block
}

button.avatar:hover {
  transform: scale(1.06);
  box-shadow: 0 0 0 3px rgba(14, 140, 127, .2)
}

button.avatar:active {
  transform: scale(.96)
}

/* ---------- busy indicator ---------------------------------------------- */
/* Inherits currentColor, so one rule works on the dark launch button, inside
   a white Invite chip, and next to muted body text without a variant each. */
.spinner {
  display: inline-block;
  width: 12px;
  height: 12px;
  vertical-align: -1px;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: elbo-spin .6s linear infinite
}

.spinner--lg {
  width: 16px;
  height: 16px;
  border-width: 2.5px;
  vertical-align: -3px
}

@keyframes elbo-spin {
  to {
    transform: rotate(360deg)
  }
}

/* Someone who has asked for less motion still needs to know something is
   happening — slowed right down rather than stopped. */
@media (prefers-reduced-motion: reduce) {
  .spinner {
    animation-duration: 1.8s
  }
}

/* ---------- form controls ---------------------------------------------- */
.field {
  width: 100%;
  border: 1.5px solid var(--ink);
  border-radius: var(--r-sm);
  padding: 13px 14px;
  font-size: 16px;
  font-weight: 600;
  background: #fff;
  outline: none
}

.field--soft {
  border-color: var(--line-2);
  font-weight: 500;
  font-size: 15px
}

.field::placeholder {
  color: #B7AA99;
  font-weight: 500
}

.btn {
  width: 100%;
  border-radius: var(--r-pill);
  padding: 14px;
  text-align: center;
  font-weight: 800;
  font-size: 15px;
  transition: background .15s, transform .08s, opacity .2s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px
}

.btn:active {
  transform: translateY(1px)
}

.btn[disabled] {
  opacity: .45;
  cursor: not-allowed;
  box-shadow: none
}

.btn--primary {
  background: var(--flare);
  color: #fff;
  box-shadow: var(--shadow-btn)
}

.btn--primary:hover {
  background: var(--flare-dk)
}

.btn--dark {
  background: var(--ink);
  color: #fff;
  font-size: 14px;
  padding: 13px
}

.btn--dark:hover {
  background: #0e141b
}

.btn--outline {
  border: 1.5px solid var(--line-2);
  background: #fff;
  /* Stated, not inherited. This button also appears on the capture stage,
     where the surrounding text is white — inheriting there put white on a
     white pill and the label vanished. */
  color: var(--ink);
  font-weight: 700;
  font-size: 14px;
  padding: 12px
}

.btn--outline:hover {
  background: #F7F2EA
}

.btn--light {
  background: #fff;
  color: var(--flare-dk)
}

.btn--light:hover {
  background: #FFE9E0
}

.btn--clear {
  border: 1.5px solid rgba(255, 255, 255, .55);
  color: #fff;
  font-weight: 600;
  font-size: 14px;
  padding: 12px
}

.btn--clear:hover {
  background: rgba(255, 255, 255, .12)
}

.btn-row {
  display: flex;
  gap: 8px
}

.link {
  width: 100%;
  text-align: center;
  font-size: 13px;
  font-weight: 700;
  color: var(--flare-dk);
  text-decoration: underline;
  padding: 6px
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px
}

.chip {
  border-radius: var(--r-pill);
  padding: 6px 13px;
  font-size: 12px;
  font-weight: 700;
  background: #fff;
  color: var(--muted-2);
  border: 1.5px solid var(--line-2);
  transition: all .15s
}

.chip[aria-pressed="true"] {
  background: var(--ink);
  color: #fff;
  border-color: var(--ink)
}

.seg {
  display: flex;
  background: var(--shell);
  border-radius: var(--r-pill);
  padding: 3px
}

.seg button {
  flex: 1;
  border-radius: var(--r-pill);
  padding: 10px 0;
  text-align: center;
  font-size: 12.5px;
  font-weight: 700;
  color: var(--muted-2);
  transition: all .18s
}

.seg button[aria-pressed="true"] {
  background: #fff;
  color: var(--ink);
  box-shadow: 0 1px 3px rgba(0, 0, 0, .08)
}

.stepper {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border: 1.5px solid var(--line-2);
  border-radius: var(--r-sm);
  padding: 11px 14px;
  background: #fff
}

.stepper .val {
  display: flex;
  gap: 18px;
  align-items: center;
  font-weight: 800;
  font-size: 17px
}

.stepper button {
  font-weight: 800;
  font-size: 22px;
  line-height: 1;
  padding: 0 6px;
  color: var(--muted)
}

.stepper button:last-child {
  color: var(--flare)
}

.pay-grid {
  display: flex;
  gap: 8px
}

.pay {
  flex: 1;
  border-radius: var(--r-md);
  padding: 11px;
  background: #fff;
  border: 2px solid var(--line-2);
  transition: all .18s
}

.pay .lbl {
  font-size: 12px;
  font-weight: 700;
  color: var(--muted-2)
}

.pay .amt {
  font-size: 17px;
  font-weight: 800;
  color: var(--ink)
}

.pay[aria-pressed="true"] {
  background: #FFF0EA;
  border-color: var(--flare)
}

.pay[aria-pressed="true"] .lbl,
.pay[aria-pressed="true"] .amt {
  color: var(--flare-dk)
}

.consent {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  background: #F7F2EA;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  padding: 12px
}

.consent input {
  width: 19px;
  height: 19px;
  flex: none;
  margin-top: 1px;
  accent-color: var(--flare)
}

.consent label {
  font-size: 11.5px;
  font-weight: 600;
  color: var(--muted-2);
  line-height: 1.5
}

/* ---------- lists ------------------------------------------------------ */
.list {
  display: flex;
  flex-direction: column;
  gap: 7px
}

.row {
  display: flex;
  align-items: center;
  gap: 10px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  padding: 9px 12px;
  width: 100%;
  transition: all .3s
}

.row .name {
  flex: 1;
  font-size: 13.5px;
  font-weight: 600;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis
}

.row .tag {
  background: var(--shell);
  border-radius: var(--r-pill);
  padding: 3px 10px;
  font-size: 10.5px;
  font-weight: 700;
  color: var(--muted-2);
  flex: none
}

.row--out {
  opacity: .5
}

.row--out .name {
  text-decoration: line-through
}

.av {
  width: 27px;
  height: 27px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
  color: #fff;
  flex: none
}

/* Avatar photos from the account directory. Without object-fit a non-square
   upload stretches into an oval inside the circular frame. */
img.av {
  object-fit: cover;
  background: var(--line-2);
}

/* ---------- callouts --------------------------------------------------- */
.callout {
  background: #F7F2EA;
  border-radius: var(--r-sm);
  padding: 11px 13px;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--muted);
  line-height: 1.5
}

.callout--ok {
  background: var(--ok-bg);
  border: 1px solid #BFE3D2;
  color: #146C43
}

.callout--hot {
  background: var(--flare);
  color: #fff;
  font-weight: 800;
  text-align: center;
  font-size: 13px;
  animation: pulse 1.2s infinite
}

.callout--glass {
  background: rgba(255, 255, 255, .16);
  color: #fff
}

.callout code {
  font-family: var(--mono);
  font-size: 10.5px;
  background: var(--shell);
  padding: 1px 5px;
  border-radius: 4px;
  color: var(--ink);
  word-break: break-all
}

/* ---------- hero card -------------------------------------------------- */
.hero {
  background: linear-gradient(160deg, #FF8A5C, var(--flare) 55%, var(--punch));
  border-radius: var(--r-lg);
  padding: 18px 16px;
  color: #fff
}

.hero .kicker {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1.5px;
  opacity: .85
}

.hero .name {
  font-weight: 800;
  font-size: 26px;
  line-height: 1.05;
  margin-top: 4px;
  word-break: break-word
}

.pill-glass {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(255, 255, 255, .2);
  border-radius: var(--r-pill);
  padding: 5px 13px;
  font-size: 12px;
  font-weight: 700
}

/* ---------- capture ---------------------------------------------------- */
.stage {
  position: relative;
  flex: 1;
  min-height: 280px;
  border-radius: var(--r-lg);
  overflow: hidden;
  background: linear-gradient(200deg, #3A4656, #232B36 60%, #161C24);
  display: flex;
  align-items: center;
  justify-content: center
}

.stage video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  background: #000
}

.stage video.mirror {
  transform: scaleX(-1)
}

.badge {
  position: absolute;
  background: rgba(0, 0, 0, .55);
  border-radius: var(--r-pill);
  padding: 4px 11px;
  font-size: 11px;
  font-weight: 800
}

.badge--tr {
  top: 12px;
  right: 12px;
  color: var(--sun)
}

.badge--tl {
  top: 12px;
  left: 12px;
  color: var(--danger);
  display: flex;
  align-items: center;
  gap: 6px
}

.badge--rec {
  animation: pulse 1s infinite
}

.countdown {
  position: absolute;
  bottom: 16px;
  left: 0;
  right: 0;
  text-align: center;
  font-weight: 800;
  font-size: 34px;
  color: #fff;
  text-shadow: 0 2px 8px rgba(0, 0, 0, .5);
  font-variant-numeric: tabular-nums
}

.shout-pill {
  align-self: center;
  background: var(--flare);
  color: #fff;
  border-radius: var(--r-pill);
  padding: 6px 15px;
  font-size: 12px;
  font-weight: 800;
  text-align: center;
  max-width: 100%
}

.rec-bar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 26px
}

.rec-bar .side {
  font-size: 12.5px;
  font-weight: 700;
  color: var(--slate);
  padding: 8px
}

.rec-btn {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  border: 3.5px solid #fff;
  flex: none;
  display: flex;
  align-items: center;
  justify-content: center
}

.rec-btn i {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--flare);
  transition: border-radius .2s, width .2s, height .2s
}

.rec-btn.is-on i {
  border-radius: 8px;
  width: 26px;
  height: 26px
}

.cam-fallback {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  text-align: center;
  padding: 24px;
  background: rgba(20, 24, 29, .86)
}

/* ---------- progress / pipeline ---------------------------------------- */
.track {
  height: 10px;
  background: var(--shell);
  border-radius: var(--r-pill);
  overflow: hidden
}

.track i {
  display: block;
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, #FF8A5C, var(--flare));
  transition: width .5s
}

.view--night .track {
  background: #232B36;
  height: 8px
}

.clock {
  font-weight: 800;
  font-size: 42px;
  letter-spacing: 1px;
  font-variant-numeric: tabular-nums
}

.pipe {
  display: flex;
  align-items: center;
  gap: 11px;
  background: var(--night-2);
  border-radius: var(--r-sm);
  padding: 12px 13px;
  opacity: .35;
  transition: opacity .4s
}

.pipe.is-on {
  opacity: 1
}

.pipe .dot {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #2E3947;
  color: var(--slate);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 800;
  flex: none
}

.pipe.is-on .dot {
  background: var(--flare);
  color: #fff
}

.pipe.is-done .dot {
  background: var(--ok);
  color: #fff
}

.pipe .lbl {
  flex: 1;
  font-size: 13px;
  font-weight: 600
}

/* ---------- player ----------------------------------------------------- */
.player {
  position: relative;
  flex: 1;
  min-height: 280px;
  width: 100%;
  border-radius: var(--r-lg);
  overflow: hidden;
  background: linear-gradient(160deg, #FF8A5C, var(--flare) 45%, var(--punch));
  display: flex;
  align-items: center;
  justify-content: center
}

.player video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  background: #000
}

.play-fab {
  position: relative;
  z-index: 2;
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: rgba(255, 255, 255, .94);
  color: var(--flare-dk);
  font-size: 22px;
  display: flex;
  align-items: center;
  justify-content: center
}

.scrub {
  position: absolute;
  bottom: 12px;
  left: 14px;
  right: 14px;
  height: 4px;
  z-index: 3;
  background: rgba(255, 255, 255, .35);
  border-radius: var(--r-pill)
}

.scrub i {
  display: block;
  height: 100%;
  width: 0;
  background: #fff;
  border-radius: var(--r-pill)
}

/* ---------- end-card / vault ------------------------------------------- */
.endcard {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 10px
}

.endcard .mark {
  font-weight: 800;
  font-size: 30px;
  letter-spacing: .5px;
  color: var(--flare)
}

.endcard .tagline {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 2.5px;
  color: var(--sun)
}

.avgrid {
  display: flex;
  gap: 7px;
  flex-wrap: wrap;
  justify-content: center
}

.avgrid .av {
  width: 36px;
  height: 36px;
  font-size: 12px
}

.qr {
  width: 110px;
  height: 110px;
  background: #fff;
  border-radius: var(--r-sm);
  padding: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  align-self: center;
  transition: transform .15s
}

button.qr {
  cursor: pointer
}

button.qr:hover {
  transform: scale(1.05)
}

button.qr:active {
  transform: scale(.97)
}

.qr img,
.qr svg {
  width: 100%;
  height: 100%;
  image-rendering: pixelated
}

/* ---------- toast / install prompt ------------------------------------- */
.toast {
  position: fixed;
  left: 50%;
  bottom: calc(26px + var(--safe-b));
  transform: translateX(-50%);
  background: var(--ink);
  color: #fff;
  border-radius: var(--r-pill);
  padding: 10px 18px;
  font-size: 12.5px;
  font-weight: 700;
  white-space: nowrap;
  z-index: 60;
  max-width: 90vw;
  overflow: hidden;
  text-overflow: ellipsis;
  box-shadow: 0 8px 20px rgba(0, 0, 0, .3);
  animation: pop 2.4s forwards
}

@media (min-width:600px) {
  .toast {
    position: absolute
  }
}

.install {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--ink);
  color: #fff;
  border-radius: var(--r-sm);
  padding: 11px 13px;
  font-size: 12px;
  font-weight: 700
}

.install button {
  margin-left: auto;
  background: var(--flare);
  border-radius: var(--r-pill);
  padding: 7px 14px;
  font-size: 12px;
  font-weight: 800;
  flex: none
}

.install .x {
  background: none;
  padding: 6px;
  color: rgba(255, 255, 255, .6);
  font-size: 14px
}

/* ---------- offline banner --------------------------------------------- */
.offline-bar {
  background: var(--warn);
  color: #fff;
  font-size: 11.5px;
  font-weight: 700;
  text-align: center;
  padding: 6px 12px;
  flex: none
}

@keyframes pulse {

  0%,
  100% {
    opacity: 1
  }

  50% {
    opacity: .35
  }
}

/* Live indicator on the ElboTV button — the channel is always on, so the dot
   is decorative only and hidden from assistive tech. */
.live-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--danger);
  animation: pulse 1.4s infinite;
  flex: none
}

@media (prefers-reduced-motion:reduce) {
  .live-dot {
    animation: none
  }
}

@keyframes pop {
  0% {
    transform: translate(-50%, 10px);
    opacity: 0
  }

  9% {
    transform: translate(-50%, 0);
    opacity: 1
  }

  86% {
    transform: translate(-50%, 0);
    opacity: 1
  }

  100% {
    transform: translate(-50%, 6px);
    opacity: 0
  }
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0
}

/* Result sheet — used for delivery reports and anything else the reader must
   read before moving on. Sits above the phone frame, dismissed by tap or Esc. */
.sheet-wrap {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  background: rgba(30, 40, 51, .45);
  padding: 16px;
}

.sheet {
  width: 100%;
  max-width: 420px;
  max-height: 80vh;
  overflow-y: auto;
  background: var(--paper);
  border-radius: 20px;
  padding: 18px 16px 16px;
  box-shadow: 0 18px 50px rgba(30, 40, 51, .28);
  animation: sheet-in .18s ease-out;
}

@keyframes sheet-in {
  from {
    transform: translateY(14px);
    opacity: 0
  }

  to {
    transform: none;
    opacity: 1
  }
}

@media (prefers-reduced-motion: reduce) {
  .sheet {
    animation: none
  }
}

@media (min-width: 520px) {
  .sheet-wrap {
    align-items: center
  }
}