/* knockknock — modern CSS: nesting, oklch, light-dark(), container queries, :has(),
   @starting-style, view transitions, scroll-driven animations. No build step. */
@layer reset, tokens, base, components, screens, motion;

@layer reset {
  *, *::before, *::after { box-sizing: border-box; }
  body, h1, h2, h3, p, ol, ul { margin: 0; }
  ul, ol { padding: 0; list-style: none; }
  button, input { font: inherit; color: inherit; }
  img, video { display: block; max-width: 100%; }
}

@layer tokens {
  :root {
    color-scheme: light dark;
    --cream: light-dark(oklch(97.5% 0.025 85), oklch(20% 0.02 280));
    --paper: light-dark(oklch(99.5% 0.01 85), oklch(26% 0.025 280));
    --ink: light-dark(oklch(20% 0.02 280), oklch(96% 0.02 85));
    --ink-soft: light-dark(oklch(45% 0.02 280), oklch(75% 0.02 85));
    --line: light-dark(oklch(20% 0.02 280), oklch(10% 0.02 280));
    --door: oklch(66% 0.2 28);        /* coral red: the door */
    --door-ink: oklch(99% 0 0);
    --sun: oklch(85% 0.16 85);         /* mustard */
    --mint: oklch(74% 0.12 185);       /* teal */
    --pink: oklch(80% 0.11 5);
    --radius: 20px;
    --bw: 2.5px;
    --shadow: 4px 4px 0 var(--line);
    --shadow-sm: 2px 2px 0 var(--line);
    --font-display: "Bricolage Grotesque", ui-rounded, system-ui, sans-serif;
    --font-body: "DM Sans", system-ui, sans-serif;
    --safe-b: env(safe-area-inset-bottom, 0px);
    --safe-t: env(safe-area-inset-top, 0px);
  }
}

@layer base {
  html { background: var(--cream); color: var(--ink); -webkit-tap-highlight-color: transparent; }
  body {
    font-family: var(--font-body); font-size: 16px; line-height: 1.45;
    min-height: 100dvh; overscroll-behavior-y: none;
    background:
      radial-gradient(circle at 1px 1px, color-mix(in oklch, var(--ink) 9%, transparent) 1px, transparent 0) 0 0 / 22px 22px,
      var(--cream);
  }
  body.sheet-open { overflow: hidden; }
  #app { max-width: 520px; margin-inline: auto; min-height: 100dvh; position: relative; }
  h1, h2, h3 { font-family: var(--font-display); letter-spacing: -0.02em; text-wrap: balance; }
  h3 { font-size: 1rem; margin: 22px 0 10px; small { font-weight: 400; color: var(--ink-soft); font-family: var(--font-body); } }
  p { text-wrap: pretty; }
  a { color: inherit; }
  :focus-visible { outline: 3px solid var(--mint); outline-offset: 2px; }
}

@layer components {
  .btn {
    display: inline-flex; align-items: center; justify-content: center; gap: .4em;
    width: 100%; padding: 13px 18px; margin-top: 10px;
    border: var(--bw) solid var(--line); border-radius: 999px;
    background: var(--paper); box-shadow: var(--shadow-sm);
    font-weight: 700; cursor: pointer; text-decoration: none;
    transition: transform .12s, box-shadow .12s, background .2s;
    &:active:not(:disabled) { transform: translate(2px, 2px); box-shadow: 0 0 0 var(--line); }
    &:disabled { opacity: .45; cursor: not-allowed; }
    &.primary { background: var(--door); color: var(--door-ink); }
    &.danger { background: var(--ink); color: var(--cream); }
    &.ghost { background: transparent; box-shadow: none; border-style: dashed; }
    &.big { font-size: 1.1rem; padding: 16px 20px; box-shadow: var(--shadow); }
    &.small { width: auto; padding: 8px 14px; font-size: .9rem; margin-top: 8px; }
  }
  .icon-btn {
    width: 40px; height: 40px; border-radius: 50%; border: var(--bw) solid var(--line);
    background: var(--paper); font-size: 1.1rem; font-weight: 700; cursor: pointer; flex: none;
  }
  .card {
    background: var(--paper); border: var(--bw) solid var(--line); border-radius: var(--radius);
    box-shadow: var(--shadow); padding: 16px; margin-top: 16px;
  }
  .chips { display: flex; flex-wrap: wrap; gap: 8px; &.col { flex-direction: column; align-items: flex-start; } }
  .chip {
    border: var(--bw) solid var(--line); border-radius: 999px; padding: 7px 13px;
    background: var(--paper); cursor: pointer; font-size: .92rem; font-weight: 600; text-align: left;
    transition: background .15s, transform .15s;
    &.on, &:has(input:checked) { background: var(--sun); color: oklch(20% 0.02 280); transform: rotate(-1.5deg); }
    &.emoji { font-size: 1.35rem; padding: 4px 9px; line-height: 1.3; }
    input { position: absolute; opacity: 0; pointer-events: none; }
  }
  .note { color: var(--ink-soft); font-size: .95rem; margin: 6px 0 14px; &.center { text-align: center; } &.small { font-size: .82rem; } }
  .fine { color: var(--ink-soft); font-size: .82rem; margin-top: 12px; &.center { text-align: center; } }
  .center { text-align: center; }
  .muted { color: var(--ink-soft); }

  /* the selfie "sticker card" */
  .selfie {
    position: relative; aspect-ratio: 4 / 5; border-radius: var(--radius); overflow: hidden;
    border: var(--bw) solid var(--line); background: var(--sun); box-shadow: var(--shadow-sm);
    img, video { width: 100%; height: 100%; object-fit: cover; }
    video { transform: scaleX(-1); }
    .stickers {
      position: absolute; inset: auto 8px 8px auto; display: flex; gap: 2px; font-size: 1.4rem;
      background: var(--paper); border: var(--bw) solid var(--line); border-radius: 999px; padding: 1px 8px;
      container-type: normal;
    }
  }

  .badge {
    position: absolute; top: 8px; left: 8px; z-index: 2;
    font-size: .72rem; font-weight: 800; padding: 3px 9px; border-radius: 999px;
    border: 2px solid var(--line); background: var(--paper); color: var(--ink);
    &.knock { background: var(--door); color: var(--door-ink); }
    &.in { background: var(--mint); color: oklch(20% 0.02 280); }
    &.out { background: var(--sun); color: oklch(20% 0.02 280); }
    &.me-badge { background: var(--ink); color: var(--cream); }
  }

  .topbar {
    position: sticky; top: 0; z-index: 5; display: grid; grid-template-columns: 40px 1fr 40px; align-items: center;
    gap: 8px; padding: calc(10px + var(--safe-t)) 0 10px; background: color-mix(in oklch, var(--cream) 88%, transparent);
    backdrop-filter: blur(10px);
    h2 { text-align: center; font-size: 1.25rem; }
  }

  .bottom-nav {
    position: fixed; inset: auto 0 0 0; z-index: 6; display: flex; justify-content: center; gap: 6px;
    padding: 8px 12px calc(8px + var(--safe-b));
    background: color-mix(in oklch, var(--paper) 92%, transparent); backdrop-filter: blur(12px);
    border-top: var(--bw) solid var(--line);
    view-transition-name: bottom-nav;
  }
  .nav-item {
    flex: 1; max-width: 140px; border: 0; background: none; cursor: pointer; padding: 6px 4px; border-radius: 14px;
    display: flex; flex-direction: column; align-items: center; font-size: .78rem; font-weight: 700;
    &.on { background: var(--sun); color: oklch(20% 0.02 280); }
    .nav-icon { font-size: 1.4rem; position: relative; }
    i {
      position: absolute; top: -4px; right: -12px; font-style: normal; font-size: .7rem; min-width: 18px; height: 18px;
      border-radius: 9px; background: var(--door); color: #fff; display: grid; place-items: center; border: 2px solid var(--line);
    }
  }

  /* bottom sheet (enters with @starting-style, no JS animation) */
  .scrim { position: fixed; inset: 0; z-index: 20; background: oklch(0% 0 0 / .35);
    transition: opacity .25s; @starting-style { opacity: 0; } }
  .sheet {
    position: fixed; z-index: 21; inset: auto 0 0 0; margin-inline: auto; max-width: 520px; max-height: 88dvh; overflow: auto;
    background: var(--paper); border: var(--bw) solid var(--line); border-bottom: 0; border-radius: 26px 26px 0 0;
    padding: 18px 18px calc(24px + var(--safe-b));
    transition: translate .32s cubic-bezier(.2, .9, .3, 1.2);
    @starting-style { translate: 0 100%; }
    &::before { content: ""; display: block; width: 44px; height: 5px; border-radius: 3px; background: var(--ink-soft); opacity: .4; margin: -6px auto 14px; }
    .menu-btn { position: absolute; top: 18px; right: 18px; }
  }
  .sheet-big-selfie { width: min(62%, 260px); margin: 0 auto 8px; rotate: -2deg; }

  #toasts {
    position: fixed; z-index: 40; inset: calc(12px + var(--safe-t)) 12px auto 12px; display: grid; gap: 8px; justify-items: center; pointer-events: none;
  }
  .toast {
    pointer-events: auto; cursor: pointer; max-width: 480px; padding: 11px 16px; border-radius: 16px; font-weight: 600;
    background: var(--ink); color: var(--cream); border: var(--bw) solid var(--line); box-shadow: var(--shadow-sm);
    transition: translate .3s cubic-bezier(.2, .9, .3, 1.3), opacity .3s;
    @starting-style { translate: 0 -30px; opacity: 0; }
  }
}

@layer screens {
  .screen { padding: 0 18px calc(110px + var(--safe-b)); }

  .welcome {
    padding-top: calc(28px + var(--safe-t)); display: flex; flex-direction: column;
    .logo-row { display: flex; align-items: center; gap: 10px; }
    .logo { width: 44px; height: 44px; }
    .wordmark { font-family: var(--font-display); font-weight: 800; font-size: 1.35rem; letter-spacing: -0.03em; }
    .hero { font-size: clamp(2.8rem, 13vw, 4.2rem); line-height: .95; margin-top: 36px; font-weight: 800; }
    .hl { background: linear-gradient(transparent 58%, var(--sun) 58% 92%, transparent 92%); padding-inline: 4px; }
    .lede { margin-top: 16px; font-size: 1.08rem; color: var(--ink-soft); }
    .steps {
      margin-top: 24px; display: grid; grid-template-columns: 1fr 1fr; gap: 10px;
      li { background: var(--paper); border: var(--bw) solid var(--line); border-radius: 16px; padding: 12px; box-shadow: var(--shadow-sm);
        display: flex; flex-direction: column; gap: 4px; font-weight: 600; font-size: .92rem;
        b { font-size: 1.6rem; }
        &:nth-child(odd) { rotate: -1deg; } &:nth-child(even) { rotate: 1.2deg; } }
    }
    .check { display: flex; gap: 10px; align-items: center; margin-top: 26px; font-weight: 600; cursor: pointer;
      input { width: 22px; height: 22px; accent-color: var(--door); } }
    .demo-pill { align-self: center; border: 2px dashed var(--ink-soft); border-radius: 999px; padding: 4px 12px; }
  }

  .loading { text-align: center; padding: 40px 0; font-weight: 600; color: var(--ink-soft); }
  .knock-anim { display: inline-block; font-size: 2rem; animation: knock 1s infinite; }

  .spots { display: grid; gap: 10px; }
  .spot {
    width: 100%; display: grid; grid-template-columns: 44px 1fr auto; align-items: center; gap: 10px; text-align: left;
    padding: 12px 14px; border: var(--bw) solid var(--line); border-radius: 18px; background: var(--paper);
    box-shadow: var(--shadow-sm); cursor: pointer; font-weight: 700;
    &:active { translate: 2px 2px; box-shadow: none; }
    .spot-dist { color: var(--ink-soft); font-size: .82rem; font-weight: 600; }
  }
  .spots-sep { margin: 10px 0 -2px; font-size: .82rem; font-weight: 800; color: var(--ink-soft); letter-spacing: .02em; }
  .spot.myth { background: linear-gradient(135deg, oklch(0.97 0.04 300), oklch(0.96 0.05 200));
    .spot-dist { font-style: italic; max-width: 11ch; text-align: right; line-height: 1.15; }
    .spot-emoji { background: oklch(0.9 0.09 300); } }
  .spot-emoji { font-size: 1.6rem; width: 44px; height: 44px; display: grid; place-items: center; border-radius: 12px; background: var(--sun); border: 2px solid var(--line); }
  .custom-spot { display: grid; gap: 12px;
    label { display: grid; gap: 6px; font-weight: 700; }
    input[name=name] { padding: 12px 14px; border: var(--bw) solid var(--line); border-radius: 14px; background: var(--cream); } }

  .selfie-screen {
    > .selfie { width: min(80%, 340px); margin: 6px auto 0; rotate: -1.5deg; box-shadow: var(--shadow); }
    > .btn.small { display: flex; margin: 12px auto 0; }
    .cam-err { position: absolute; inset: 0; display: grid; place-content: center; gap: 6px; padding: 20px; text-align: center;
      background: var(--sun); color: oklch(20% 0.02 280); font-weight: 600; }
  }
  .shutter {
    display: block; margin: -34px auto 0; position: relative; z-index: 2;
    width: 72px; height: 72px; border-radius: 50%; border: 4px solid var(--line); cursor: pointer;
    background: radial-gradient(circle, var(--door) 0 58%, var(--paper) 60%); box-shadow: var(--shadow-sm);
    &:active { scale: .92; } &:disabled { opacity: .4; }
  }

  .room-head {
    position: sticky; top: 0; z-index: 5; display: flex; align-items: center; justify-content: space-between; gap: 10px;
    padding: calc(12px + var(--safe-t)) 0 12px; background: color-mix(in oklch, var(--cream) 88%, transparent); backdrop-filter: blur(10px);
    .here { display: flex; gap: 10px; align-items: center; min-width: 0;
      small { display: block; color: var(--ink-soft); font-size: .75rem; }
      b { font-family: var(--font-display); font-size: 1.15rem; display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; } }
    /* scroll-driven: header gains a rule once you scroll */
    animation: head-rule linear both; animation-timeline: scroll(); animation-range: 0 60px;
  }
  .timer-chip { flex: none; border: var(--bw) solid var(--line); background: var(--paper); border-radius: 999px; padding: 7px 12px; font-weight: 800; cursor: pointer; font-variant-numeric: tabular-nums; }
  .count-row { font-weight: 600; margin: 2px 0 12px; display: flex; align-items: center; gap: 6px; b { font-size: 1.3rem; font-family: var(--font-display); } }
  .dot-live { width: 10px; height: 10px; border-radius: 50%; background: var(--mint); border: 2px solid var(--line); animation: pulse 1.6s infinite; }
  .banner { display: flex; align-items: center; gap: 10px; padding: 10px 12px; margin: 0 0 14px; span { flex: 1; font-weight: 600; font-size: .9rem; } .btn { margin: 0; } .icon-btn { width: 32px; height: 32px; font-size: .8rem; } }

  /* container queries: the grid adapts to the column width, not the viewport */
  .grid { container-type: inline-size; display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px; }
  @container (min-width: 420px) { .grid { grid-template-columns: repeat(3, 1fr); } }
  .person {
    position: relative; padding: 0; border: 0; background: none; cursor: pointer; text-align: left;
    &:nth-child(3n+1) { rotate: -1.2deg; } &:nth-child(3n+2) { rotate: .8deg; } &:nth-child(3n) { rotate: -.4deg; }
    transition: rotate .2s, scale .2s;
    &:hover, &:focus-visible { rotate: 0deg; scale: 1.03; }
    &.pulse .selfie { animation: knock-card 1.2s infinite; border-color: var(--door); }
    &.me { cursor: default; opacity: .85; }
  }
  .invite { text-align: center; }

  .knock-card { background: var(--sun); color: oklch(20% 0.02 280); border: var(--bw) solid var(--line); border-radius: 18px; padding: 14px; margin: 10px 0; text-align: center; }
  .kline { font-weight: 700; &.big { font-size: 1.25rem; font-family: var(--font-display); } }
  .kmeta { font-size: .9rem; margin-top: 2px; }
  .kstatus { font-size: .82rem; color: var(--ink-soft); margin-top: 4px; font-variant-numeric: tabular-nums; .hot { color: var(--door); } }
  .knock-card .kstatus { color: inherit; opacity: .75; }
  .btn-row { display: flex; gap: 10px; }
  .big-msg { font-size: 1.3rem; font-weight: 700; font-family: var(--font-display); margin: 10px 0; }
  .compose .custom-line { width: 100%; margin-top: 10px; padding: 10px 14px; border: var(--bw) dashed var(--line); border-radius: 14px; background: var(--cream);
    &.on, &:focus { border-style: solid; background: var(--sun); color: oklch(20% 0.02 280); } }

  .filters { margin: 0 0 14px; overflow-x: auto; flex-wrap: nowrap; scrollbar-width: none; .chip { flex: none; } }
  .knock-list { display: grid; gap: 10px; }
  .knock-row {
    width: 100%; display: grid; grid-template-columns: 56px 1fr; gap: 12px; align-items: center; text-align: left; cursor: pointer;
    padding: 10px; border: var(--bw) solid var(--line); border-radius: 18px; background: var(--paper); box-shadow: var(--shadow-sm);
    img { width: 56px; height: 70px; object-fit: cover; border-radius: 12px; border: 2px solid var(--line); }
    &:has(.hot) { background: color-mix(in oklch, var(--door) 14%, var(--paper)); }
  }
  .empty { text-align: center; padding: 50px 10px; .big-emoji { font-size: 3rem; } .btn { width: auto; } }

  .chat { display: flex; flex-direction: column; height: 100dvh; padding-bottom: calc(12px + var(--safe-b));
    .chat-who { display: flex; align-items: center; justify-content: center; gap: 8px; border: 0; background: none; cursor: pointer;
      img { width: 40px; height: 40px; border-radius: 50%; object-fit: cover; border: 2px solid var(--line); view-transition-name: chat-face; } }
    .msgs { flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 8px; padding: 6px 2px; }
    .msg { max-width: 78%; padding: 9px 14px; border-radius: 18px 18px 18px 4px; border: 2px solid var(--line); background: var(--paper); align-self: flex-start;
      transition: scale .25s, opacity .25s; @starting-style { scale: .8; opacity: 0; }
      &.mine { align-self: flex-end; background: var(--door); color: var(--door-ink); border-radius: 18px 18px 4px 18px; } }
    .quick { flex-wrap: nowrap; overflow-x: auto; padding: 8px 0; scrollbar-width: none; .chip { flex: none; } }
    .composer { display: flex; gap: 8px;
      input { flex: 1; min-width: 0; padding: 12px 16px; border-radius: 999px; border: var(--bw) solid var(--line); background: var(--paper); }
      .btn { width: auto; margin: 0; } }
  }

  .me-screen {
    .me-card { width: min(60%, 240px); margin: 6px auto 0; text-align: center; .selfie { rotate: 2deg; box-shadow: var(--shadow); } }
    .row { display: flex; align-items: center; gap: 16px; justify-content: space-between;
      small { display: block; color: var(--ink-soft); font-size: .75rem; } b { font-variant-numeric: tabular-nums; } .btn { margin: 0; } }
    .links { display: grid; gap: 10px; a { font-weight: 700; text-decoration: none; } }
  }
  .tips { display: grid; gap: 10px; list-style: "→  "; padding-left: 1.4em; }
  .big-timer { font-family: var(--font-display); font-size: 3rem; font-weight: 800; text-align: center; font-variant-numeric: tabular-nums; }
}

@layer motion {
  @keyframes knock { 0%, 60%, 100% { rotate: 0deg; } 10%, 30% { rotate: -14deg; } 20%, 40% { rotate: 10deg; } }
  @keyframes knock-card { 0%, 70%, 100% { translate: 0; } 10%, 30% { translate: -3px 0; } 20%, 40% { translate: 3px 0; } }
  @keyframes pulse { 50% { box-shadow: 0 0 0 6px color-mix(in oklch, var(--mint) 35%, transparent); } }
  @keyframes head-rule { to { box-shadow: 0 2px 0 var(--line); } }

  /* View Transitions between screens */
  ::view-transition-old(root) { animation: .18s ease-in both vt-out; }
  ::view-transition-new(root) { animation: .28s cubic-bezier(.2, .9, .3, 1.1) both vt-in; }
  @keyframes vt-out { to { opacity: 0; translate: -18px 0; } }
  @keyframes vt-in { from { opacity: 0; translate: 22px 0; } }
  html.vt-back::view-transition-old(root) { animation-name: vt-out-back; }
  html.vt-back::view-transition-new(root) { animation-name: vt-in-back; }
  @keyframes vt-out-back { to { opacity: 0; translate: 18px 0; } }
  @keyframes vt-in-back { from { opacity: 0; translate: -22px 0; } }

  @media (prefers-reduced-motion: reduce) {
    *, ::view-transition-group(*), ::view-transition-old(*), ::view-transition-new(*) { animation: none !important; transition: none !important; }
  }
}
.qr-note { margin: 18px 0 0; padding: 10px 14px; font-weight: 600; background: var(--sun); color: oklch(20% 0.02 280); }
.first { text-align: center; background: var(--sun); color: oklch(20% 0.02 280); .big-emoji { font-size: 2.4rem; } }
.demo-link { align-self: center; text-decoration: underline; text-underline-offset: 3px; }
.demo-pill a { color: inherit; }
.legal-links { text-align: center; a { font-weight: 700; } }
.check a { text-decoration: underline; text-underline-offset: 2px; }
/* build label + update pill */
.build { display: block; margin: 14px auto 0; border: 0; background: none; cursor: pointer;
  font: 700 .7rem/1 ui-monospace, "SF Mono", Menlo, monospace; letter-spacing: .06em; color: var(--ink-soft); opacity: .7;
  &:hover { opacity: 1; } }
.update-pill {
  position: fixed; z-index: 45; left: 50%; top: calc(12px + var(--safe-t)); translate: -50% 0;
  display: flex; align-items: center; gap: 10px; width: max-content; max-width: calc(100% - 24px);
  padding: 7px 7px 7px 14px; border-radius: 999px; font-weight: 700; font-size: .9rem;
  background: var(--sun); color: oklch(20% 0.02 280); border: var(--bw) solid var(--line); box-shadow: var(--shadow);
  transition: translate .35s cubic-bezier(.2, .9, .3, 1.3), opacity .3s;
  @starting-style { translate: -50% -140%; opacity: 0; }
  .update-emoji { display: inline-block; animation: knock 1.4s infinite; }
  button { border: var(--bw) solid var(--line); background: var(--door); color: var(--door-ink); font-weight: 800;
    padding: 7px 14px; border-radius: 999px; cursor: pointer; white-space: nowrap; }
  button:disabled { opacity: .7; }
}
body.has-update #toasts { top: calc(70px + var(--safe-t)); }

/* ---------- v2: tags, poll, met, night, rescue, blink ---------- */
.selfie {
  .group-tag, .live-tag { position: absolute; z-index: 1; font-size: .72rem; font-weight: 800; padding: 2px 8px; border-radius: 999px;
    border: 2px solid var(--line); background: var(--paper); color: var(--ink); }
  .group-tag { top: 8px; right: 8px; }
  .live-tag { bottom: 8px; left: 8px; background: var(--mint); color: oklch(20% 0.02 280); }
  .intent-tags { position: absolute; top: 8px; right: 8px; display: flex; gap: 1px; font-size: 1.05rem; background: var(--paper);
    border: 2px solid var(--line); border-radius: 999px; padding: 0 6px; }
  &:has(.group-tag) .intent-tags { top: 36px; }
}
.blink-hint { text-align: center; font-weight: 700; margin-top: 10px; color: var(--ink-soft); min-height: 1.4em;
  &.face { color: var(--door); animation: pulse-text 1s infinite; } &.closed { color: var(--mint); } }
@keyframes pulse-text { 50% { opacity: .55; } }
.blink-ok { text-align: center; font-weight: 700; font-size: .9rem; margin-top: 10px; color: var(--ink-soft); }
.vibe-line { text-align: center; font-weight: 700; font-size: .92rem; margin: 6px 0 4px; }

.poll { margin: 0 0 16px;
  .poll-q { font-weight: 800; font-family: var(--font-display); font-size: 1.1rem; span { display: block; font-family: var(--font-body); font-size: .78rem; color: var(--ink-soft); font-weight: 700; } }
  .poll-opts { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 10px; }
  .poll-opt { position: relative; overflow: hidden; display: flex; justify-content: space-between; align-items: center; gap: 6px;
    padding: 12px; border: var(--bw) solid var(--line); border-radius: 16px; background: var(--paper); font-weight: 800; cursor: pointer; text-align: left;
    &::before { content: ""; position: absolute; inset: 0 auto 0 0; width: var(--pct); background: color-mix(in oklch, var(--sun) 70%, transparent); transition: width .6s cubic-bezier(.2,.9,.3,1); z-index: 0; }
    span, b { position: relative; z-index: 1; }
    &.on { box-shadow: var(--shadow-sm); border-color: var(--door); } }
}
.met-bar { display: block; width: 100%; margin: 4px 0 6px; padding: 10px 14px; border-radius: 16px; text-align: center; font-weight: 800;
  border: var(--bw) dashed var(--line); background: var(--paper);
  &.btn { border-style: solid; background: var(--mint); color: oklch(20% 0.02 280); small { display: block; font-weight: 600; opacity: .75; } }
  &.done { background: var(--sun); color: oklch(20% 0.02 280); border-style: solid; } }
.chat .met-bar.btn { margin-top: 4px; }
.vibe { display: flex; align-items: center; justify-content: space-between; gap: 12px; .btn { margin: 0; } }
.night, .rescue { h3 { margin-top: 0; } .chips { margin-top: 10px; } }
.night.on { background: color-mix(in oklch, var(--mint) 22%, var(--paper)); }

.confetti { position: fixed; inset: 0; pointer-events: none; z-index: 60; overflow: hidden;
  i { position: absolute; top: -40px; left: var(--x); font-style: normal; font-size: 1.6rem;
    animation: fall var(--d) var(--delay) cubic-bezier(.3,.6,.4,1) forwards; } }
@keyframes fall { to { translate: 0 110vh; rotate: var(--r); } }

.fake-call { position: fixed; inset: 0; z-index: 80; display: flex; flex-direction: column; align-items: center; justify-content: space-between;
  padding: calc(60px + var(--safe-t)) 24px calc(60px + var(--safe-b)); color: #fff; text-align: center;
  background: linear-gradient(180deg, #2b2f3a, #0e1015); font-family: -apple-system, system-ui, sans-serif;
  .fc-label { opacity: .7; font-size: 1rem; } h2 { font-family: inherit; font-weight: 400; font-size: 2.4rem; margin-top: 6px; letter-spacing: 0; }
  .fc-sub { opacity: .7; margin-top: 4px; font-variant-numeric: tabular-nums; }
  .fc-avatar { width: 120px; height: 120px; border-radius: 50%; display: grid; place-items: center; font-size: 3rem; background: #5b6170; }
  .fc-actions { display: flex; gap: 80px; }
  .fc-btn { width: 76px; height: 76px; border-radius: 50%; border: 0; font-size: 1.8rem; color: #fff; cursor: pointer; }
  .decline { background: #ff3b30; } .accept { background: #34c759; animation: pulse 1.2s infinite; } }

/* ---------- room: same order on phones, sidebar on desktop ---------- */
.room { display: flex; flex-direction: column; }
.room-main, .room-side { display: contents; }
.room > .room-head { order: 0; }
.room .count-row { order: 1; }
.room .banner { order: 2; }
.room .poll { order: 3; }
.room .grid { order: 4; }
.room .first { order: 5; }
.room .invite { order: 6; }
@media (min-width: 600px) { .grid { grid-template-columns: repeat(3, 1fr); } }

/* ---------- desktop (900px+) ---------- */
@media (min-width: 900px) {
  #app { max-width: 1180px; padding-inline: 32px; }
  .screen { padding-inline: 0; }

  /* welcome: headline + CTA left, the steps as big tilted cards right */
  .welcome {
    display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, .95fr); column-gap: 72px;
    align-content: center; min-height: 100dvh; padding-top: 48px; padding-bottom: 48px; box-sizing: border-box;
    > * { grid-column: 1; }
    .hero { font-size: clamp(3.4rem, 5vw, 4.8rem); margin-top: 28px; white-space: nowrap; }
    .lede { font-size: 1.2rem; max-width: 34em; }
    .btn.big { max-width: 420px; }
    .check { margin-top: 28px; }
    .demo-pill, .demo-link { align-self: start; justify-self: start; }
    .steps {
      grid-column: 2; grid-row: 1 / span 30; align-self: center; margin-top: 0; gap: 20px;
      li { padding: 24px; border-radius: 24px; box-shadow: var(--shadow); font-size: 1.3rem; min-height: 190px; justify-content: flex-end;
        b { font-size: 3rem; } }
      li:nth-child(1) { rotate: -3deg; } li:nth-child(2) { rotate: 2.5deg; translate: 0 24px; }
      li:nth-child(3) { rotate: 2deg; } li:nth-child(4) { rotate: -2.5deg; translate: 0 24px; }
    }
  }

  /* centered single-column screens */
  .screen:not(.room):not(.welcome):not(.chat) { max-width: 760px; margin-inline: auto; }
  .selfie-screen > .selfie { width: 320px; }

  /* room: selfie grid + sticky sidebar */
  .room { display: grid; grid-template-columns: minmax(0, 1fr) 340px; column-gap: 32px; align-items: start; }
  .room > .room-head { grid-column: 1 / -1; padding-top: 22px; .here b { font-size: 1.45rem; } }
  .room-main { display: block; grid-column: 1; }
  .room .grid { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 18px; }
  .room-side { display: flex; flex-direction: column; gap: 16px; grid-column: 2; position: sticky; top: 92px; }
  .room-side .card { margin: 0; }
  .room-side .banner { flex-wrap: wrap; }

  /* bottom tabs become a floating dock */
  .bottom-nav {
    inset: auto auto 20px 50%; translate: -50% 0; width: auto; gap: 4px; padding: 6px;
    border: var(--bw) solid var(--line); border-radius: 999px; box-shadow: var(--shadow);
  }
  .nav-item { flex: none; width: 110px; flex-direction: row; justify-content: center; gap: 8px; font-size: .9rem; padding: 10px 14px; border-radius: 999px;
    .nav-icon { font-size: 1.2rem; } }

  /* sheets open as centered dialogs */
  .sheet {
    inset: 50% auto auto 50%; translate: -50% -50%; width: min(480px, calc(100vw - 48px)); max-height: 86dvh;
    border-bottom: var(--bw) solid var(--line); border-radius: 26px; box-shadow: var(--shadow); padding: 24px;
    @starting-style { translate: -50% -42%; opacity: 0; }
    transition: translate .3s cubic-bezier(.2, .9, .3, 1.2), opacity .25s;
    &::before { display: none; }
  }

  /* chat: a comfortable centered panel */
  .chat {
    max-width: 760px; margin: 24px auto; height: calc(100dvh - 48px); box-sizing: border-box;
    background: var(--paper); border: var(--bw) solid var(--line); border-radius: 26px; box-shadow: var(--shadow); padding: 0 20px 16px;
    .topbar { background: var(--paper); border-radius: 26px 26px 0 0; }
  }

  #toasts { inset: 18px 24px auto auto; justify-items: end; }
}
@media (min-width: 1280px) { .room .grid { grid-template-columns: repeat(5, minmax(0, 1fr)); } }
