/* Kofe — the phone app's door (welcome, sign up, log in).
 * Only the app draws these screens (html[data-app]); the website never does. */

:root[data-app] body { background: var(--bg); }
:root[data-app] .ad { min-height: 100dvh; color: var(--ink); }

/* ---- welcome: rooms drifting by, then the ways in */
.ad-start { display: flex; flex-direction: column; overflow: hidden; height: 100dvh; }
.ad-reel {
  position: relative; flex: 1 1 auto; min-height: 260px;
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; padding: 0 10px;
  overflow: hidden;
  -webkit-mask-image: linear-gradient(to bottom, transparent 0, #000 calc(env(safe-area-inset-top, 0px) + 70px), #000 62%, transparent 100%);
          mask-image: linear-gradient(to bottom, transparent 0, #000 calc(env(safe-area-inset-top, 0px) + 70px), #000 62%, transparent 100%);
}
.ad-col { position: relative; overflow: hidden; }
.ad-col-in { display: grid; gap: 10px; animation: ad-drift 46s linear infinite; will-change: transform; }
.ad-col-1 .ad-col-in { animation-direction: reverse; animation-duration: 54s; margin-top: -90px; }
.ad-col-2 .ad-col-in { animation-duration: 50s; margin-top: -40px; }
@keyframes ad-drift { from { transform: translateY(0); } to { transform: translateY(calc(-50% - 5px)); } }
.ad-tile {
  position: relative; aspect-ratio: 3 / 4.2; overflow: hidden;
  border-radius: 999px 999px 18px 18px; background: #14110e;
  box-shadow: 0 10px 24px -14px rgba(20, 12, 4, 0.55);
}
.ad-tile img { width: 100%; height: 100%; object-fit: cover; display: block; }
.ad-tile span {
  position: absolute; left: 8px; right: 8px; bottom: 8px; padding: 5px 8px; border-radius: 999px;
  background: rgba(251, 246, 236, 0.9); color: #1f1912; font-size: 11.5px; font-weight: 650;
  text-align: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

.ad-sheet {
  position: relative; z-index: 2; flex: 0 0 auto;
  display: grid; justify-items: center; gap: 0; text-align: center;
  padding: 0 24px calc(18px + env(safe-area-inset-bottom, 0px));
  margin-top: -36px;
}
.ad-logo { display: inline-flex; align-items: center; gap: 10px; color: var(--ink); }
.ad-logo .logo-sym { height: 34px; width: auto; }
.ad-logo .logo-sym .logo-light { fill: var(--lamp); }
.ad-logo .logo-word { height: 34px; width: auto; fill: currentColor; stroke: currentColor; stroke-width: 6; stroke-linejoin: round; }
.ad-title { margin: 18px 0 0; font-family: var(--display); font-weight: 500; font-size: clamp(30px, 8.6vw, 38px); line-height: 1.08; letter-spacing: -0.01em; }
.ad-lead { margin: 10px 0 0; max-width: 30ch; color: var(--muted); font-size: 15.5px; line-height: 1.45; }
.ad-ways { width: min(400px, 100%); display: grid; gap: 10px; margin-top: 24px; }
.ad-start .au-err:empty { display: none; }
.ad-start .au-err { margin-top: 10px; }

/* ---- buttons */
.ad-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  width: 100%; min-height: 52px; padding: 0 20px; border-radius: 16px; border: 1px solid transparent;
  font: inherit; font-size: 16px; font-weight: 650; text-decoration: none; cursor: pointer;
  -webkit-tap-highlight-color: transparent; transition: transform 0.12s ease, opacity 0.15s ease, background-color 0.15s ease;
}
.ad-btn:active { transform: scale(0.98); }
.ad-btn:disabled { opacity: 0.5; }
.ad-btn svg { flex: 0 0 auto; }
.ad-apple { background: #000; color: #fff; }
:root[data-theme="dark"] .ad-apple { background: #fff; color: #000; }
.ad-google { background: #fff; color: #1f1f1f; border-color: rgba(31, 25, 18, 0.18); }
.ad-google svg { width: 18px; height: 18px; }
.ad-mail { background: transparent; color: var(--ink); border-color: var(--line-2); }
.ad-go { background: var(--btn); color: var(--btn-ink); margin-top: 6px; }

.ad-switch { margin: 18px 0 0; font-size: 14.5px; color: var(--muted); text-align: center; }
.ad-switch a { color: var(--ink); font-weight: 700; text-decoration: none; margin-left: 2px; }
.ad-legal { margin: 10px 0 0; font-size: 12.5px; color: var(--faint); }
.ad-legal a { color: inherit; text-decoration: none; }

/* ---- the form pages: back arrow, one question, big type */
.ad-top {
  position: sticky; top: 0; z-index: 5; display: flex; align-items: center; justify-content: space-between;
  padding: calc(6px + env(safe-area-inset-top, 0px)) 10px 6px; background: var(--bg);
}
.ad-back { display: inline-grid; place-items: center; width: 44px; height: 44px; border-radius: 50%; color: var(--ink); -webkit-tap-highlight-color: transparent; }
.ad-back:active { background: color-mix(in srgb, var(--ink) 8%, transparent); }
.ad-top-tools .lang-btn, .ad-top-tools .lang { height: 36px; min-height: 36px; }
.ad-form-page { min-height: calc(100dvh - 56px - env(safe-area-inset-top, 0px)); padding: 8px 24px calc(24px + env(safe-area-inset-bottom, 0px)); }
.ad-form { width: min(440px, 100%); margin: 0 auto; display: grid; gap: 0; }
.ad-progress { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin: 4px 0 26px; }
.ad-progress i { height: 4px; border-radius: 4px; background: var(--line-2); transition: background-color 0.35s var(--ease); }
.ad-progress i.is-on { background: var(--lamp); }
.ad-pane { animation: ad-in 0.38s var(--ease) both; }
@keyframes ad-in { from { opacity: 0; transform: translateX(18px); } to { opacity: 1; transform: none; } }
.ad-h { margin: 0; font-family: var(--display); font-weight: 500; font-size: clamp(28px, 7.8vw, 34px); line-height: 1.12; letter-spacing: -0.01em; }
.ad-center { text-align: center; margin-top: 18px; }
.ad-p { margin: 10px 0 0; color: var(--muted); font-size: 15.5px; line-height: 1.45; }
.ad-fields { display: grid; gap: 12px; margin-top: 24px; }

/* a field whose label sits inside it and moves up when you type, as in the phone's own apps */
.ad-field { position: relative; display: block; }
.ad-field input {
  width: 100%; height: 58px; padding: 22px 16px 6px; border-radius: 14px;
  border: 1px solid var(--line-2); background: var(--surface); color: var(--ink);
  font: inherit; font-size: 17px; outline: none; -webkit-appearance: none; appearance: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.ad-field input:focus { border-color: color-mix(in srgb, var(--ink) 55%, transparent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--lamp) 22%, transparent); }
.ad-field input[aria-invalid="true"] { border-color: var(--danger); }
.ad-field > span {
  position: absolute; left: 17px; top: 50%; transform: translateY(-50%); transform-origin: left center;
  color: var(--muted); font-size: 17px; pointer-events: none; transition: transform 0.18s var(--ease), top 0.18s var(--ease);
}
.ad-field input:focus + span, .ad-field input:not(:placeholder-shown) + span { top: 17px; transform: translateY(-50%) scale(0.76); }
.ad-passf input { padding-right: 54px; }
.ad-passf .au-eye { position: absolute; right: 6px; top: 50%; translate: 0 -50%; transform: none; width: 44px; height: 44px; display: grid; place-items: center; border: 0; background: none; color: var(--muted); cursor: pointer; }

.ad-tick { display: flex; align-items: flex-start; gap: 12px; margin-top: 18px; font-size: 14.5px; line-height: 1.4; color: var(--ink-2); cursor: pointer; }
.ad-tick input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.ad-tick i { flex: 0 0 auto; width: 24px; height: 24px; border-radius: 8px; border: 1.5px solid var(--line-2); background: var(--surface); display: grid; place-items: center; transition: background-color 0.15s, border-color 0.15s; }
.ad-tick input:checked + i { background: var(--lamp); border-color: var(--lamp); }
.ad-tick input:checked + i::after { content: ""; width: 6px; height: 11px; border: solid var(--lamp-ink); border-width: 0 2.2px 2.2px 0; transform: translateY(-1px) rotate(45deg); }
.ad-tick input:focus-visible + i { box-shadow: 0 0 0 3px color-mix(in srgb, var(--lamp) 30%, transparent); }

.ad-form .au-err { margin: 12px 0 0; min-height: 0; font-size: 14px; color: var(--danger); }
.ad-form .au-err:empty { margin: 0; }
.ad-form .ad-go { margin-top: 20px; }
.ad-forgot { justify-self: center; margin-top: 14px; padding: 8px; border: 0; background: none; color: var(--ink-2); font: inherit; font-size: 14.5px; font-weight: 600; cursor: pointer; }
.ad-or { display: flex; align-items: center; gap: 12px; margin: 14px 0 4px; color: var(--faint); font-size: 13px; }
.ad-or::before, .ad-or::after { content: ""; flex: 1; height: 1px; background: var(--line-2); }
.ad-login .ad-ways { margin-top: 10px; width: 100%; }
.ad-logo-sm { justify-self: center; margin-top: 10px; }
.ad-logo-sm .logo-sym, .ad-logo-sm .logo-word { height: 30px; }

/* after sign-up: "check your email" replaces the form */
.ad-form > h1 { margin: 24px 0 0; font-family: var(--display); font-weight: 500; font-size: 32px; }
.ad-form > .lead-sm, .ad-form > .small { margin: 12px 0 0; color: var(--ink-2); font-size: 16px; line-height: 1.5; }

@media (prefers-reduced-motion: reduce) {
  .ad-col-in, .ad-pane { animation: none; }
}

/* ================================================================
 * The whole app, not only its door: what makes it feel like an app.
 * html.is-app is set by native.js only inside the iPhone / Android app.
 * ================================================================ */
html.is-app { background: var(--bg); -webkit-text-size-adjust: 100%; }
html.is-app body { -webkit-tap-highlight-color: transparent; -webkit-touch-callout: none; overscroll-behavior-y: none; }

/* buttons, tabs and pictures are touched, not selected */
html.is-app :is(a, button, label, nav, header, .tabbar, .room-card, .topic-tile, .chip, img, svg) {
  -webkit-user-select: none; user-select: none; -webkit-touch-callout: none;
}
html.is-app img { -webkit-user-drag: none; }
/* what people write stays selectable and copyable */
html.is-app :is(input, textarea, [contenteditable="true"], .msg, .msg *, .bubble, .bubble *) { -webkit-user-select: text; user-select: text; -webkit-touch-callout: default; }

/* iPhone zooms into any field with text under 16px; keep them at 16 */
html.is-app :is(input:not([type="checkbox"]):not([type="radio"]):not([type="range"]), textarea, select) { font-size: max(16px, 1em); }

/* a press you can feel with the eye */
html.is-app :is(.btn, .ad-btn, .tabbar a, .look-btn, .chip, .room-card, .topic-tile) { transition: transform 0.12s ease, opacity 0.12s ease, background-color 0.15s ease; }
html.is-app :is(.btn, .ad-btn, .look-btn, .chip):active { transform: scale(0.97); }
html.is-app :is(.room-card, .topic-tile):active { transform: scale(0.985); }
html.is-app .tabbar a:active { opacity: 0.6; }

/* glass bars, the way iOS draws them */
html.is-app .top:not(.over) {
  background: color-mix(in srgb, var(--bg) 78%, transparent);
  -webkit-backdrop-filter: saturate(1.6) blur(18px); backdrop-filter: saturate(1.6) blur(18px);
}
html.is-app .tabbar {
  background: color-mix(in srgb, var(--bg) 80%, transparent);
  -webkit-backdrop-filter: saturate(1.6) blur(20px); backdrop-filter: saturate(1.6) blur(20px);
  transition: transform 0.25s var(--ease), opacity 0.2s ease;
}
/* while the keyboard is up, the tab bar steps aside so the field and keyboard have the room */
html.is-app.kb-open .tabbar { transform: translateY(110%); opacity: 0; pointer-events: none; }

/* website-only parts have no place in the app */
html.is-app :is(.site-foot, .skip, .top-open, #install-group) { display: none !important; }

/* ================================================================
 * A room's conversation in the app: clean like Messages.
 * No card around the talk, a small segmented switch, and the writing bar docked at the bottom.
 * ================================================================ */
@media (max-width: 600px) {
  html.is-app.room-app .scene[style*="--room-img"] .talk {
    background: transparent !important; box-shadow: none !important; -webkit-backdrop-filter: none !important; backdrop-filter: none !important;
    margin: 4px 0 0 !important; padding-top: 6px; border-radius: 0;
  }
  html.is-app.room-app .scene[style*="--room-img"] .talk-pane { padding-inline: 14px; }

  /* Conversation | Who's here, as an iPhone segmented switch */
  html.is-app .scene[style*="--room-img"] .talk-tabs {
    display: grid; grid-template-columns: 1fr 1fr; gap: 2px; width: min(300px, calc(100% - 28px)); margin: 0 auto 4px; padding: 3px;
    border-radius: 12px; background: rgba(120, 100, 80, 0.12);
  }
  :root:not([data-theme="light"]) html.is-app .scene[style*="--room-img"] .talk-tabs { background: rgba(255, 255, 255, 0.08); }
  html.is-app .scene[style*="--room-img"] .talk-tabs button { min-height: 32px; border-radius: 9px; justify-content: center; font-size: 13.5px; padding: 0 10px; }
  html.is-app .scene[style*="--room-img"] .talk-tabs button[aria-selected="true"] { background: rgba(255, 255, 255, 0.92); box-shadow: 0 1px 3px rgba(30, 20, 8, 0.14); color: #1f1912; }
  :root:not([data-theme="light"]) html.is-app .scene[style*="--room-img"] .talk-tabs button[aria-selected="true"] { background: rgba(255, 255, 255, 0.16); color: var(--w-ink); }

  /* the writing bar: docked, full width, glass, the field a rounded pill inside it */
  html.is-app.room-app .scene[style*="--room-img"] .talk .composer {
    margin: 0 -14px !important; padding: 8px 10px calc(8px + env(safe-area-inset-bottom, 0px)) !important; gap: 4px; align-items: flex-end;
    border-radius: 0 !important; background: rgba(250, 245, 236, 0.82) !important;
    -webkit-backdrop-filter: saturate(1.6) blur(20px); backdrop-filter: saturate(1.6) blur(20px);
    box-shadow: 0 -0.5px 0 rgba(60, 40, 20, 0.16) !important;
  }
  :root:not([data-theme="light"]) html.is-app.room-app .scene[style*="--room-img"] .talk .composer { background: rgba(28, 23, 18, 0.86) !important; box-shadow: 0 -0.5px 0 rgba(255, 255, 255, 0.1) !important; }
  html.is-app.room-app.kb-open .scene[style*="--room-img"] .talk .composer { padding-bottom: 8px !important; margin-bottom: 0 !important; }
  html.is-app.room-app .scene[style*="--room-img"] .talk .composer textarea {
    min-height: 38px; padding: 8px 14px; border-radius: 20px; line-height: 1.3;
    background: rgba(255, 255, 255, 0.92); box-shadow: inset 0 0 0 1px rgba(60, 40, 20, 0.14); color: #1f1912;
  }
  :root:not([data-theme="light"]) html.is-app.room-app .scene[style*="--room-img"] .talk .composer textarea { background: rgba(255, 255, 255, 0.08); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.12); color: var(--w-ink); }
  html.is-app.room-app .scene[style*="--room-img"] .talk .composer:focus-within { box-shadow: 0 -0.5px 0 rgba(60, 40, 20, 0.16) !important; }
  html.is-app.room-app .scene[style*="--room-img"] .talk .composer textarea:focus { box-shadow: inset 0 0 0 1.5px color-mix(in srgb, var(--w-lamp, #e0a23a) 70%, transparent); }
  html.is-app.room-app .scene[style*="--room-img"] .talk .composer .tool-btn { width: 36px; height: 38px; }
  html.is-app.room-app .scene[style*="--room-img"] .talk .send { width: 38px; height: 38px; }
  html.is-app.room-app .scene[style*="--room-img"] .talk .send svg { width: 17px; height: 17px; }

  /* names over messages: quieter */
  html.is-app .scene[style*="--room-img"] .talk .thread { padding-bottom: 12px; }
}

/* ================================================================
 * The tab bar, the way the newest iPhone draws it: a floating capsule of liquid glass,
 * the open tab sitting in a lens of lighter glass, and "Open your room" as its own
 * round glass button beside the bar.
 * ================================================================ */
@media (max-width: 760px) {
  html.is-app .tabbar {
    --gap: 12px; --btn: 60px; --h: 62px;
    left: 14px; right: calc(14px + var(--btn) + var(--gap)); bottom: max(10px, calc(env(safe-area-inset-bottom, 0px) - 6px));
    min-height: var(--h); height: var(--h); padding: 4px; border-radius: 999px;
    grid-auto-columns: minmax(0, 1fr); gap: 0;
    background: rgba(252, 248, 241, 0.42);
    -webkit-backdrop-filter: blur(22px) saturate(1.9) brightness(1.06); backdrop-filter: blur(22px) saturate(1.9) brightness(1.06);
    box-shadow:
      inset 0 1px 0.5px rgba(255, 255, 255, 0.95),
      inset 0 -1px 1px rgba(255, 255, 255, 0.35),
      inset 0 0 0 0.5px rgba(255, 255, 255, 0.6),
      0 0 0 0.5px rgba(40, 25, 8, 0.08),
      0 12px 32px -10px rgba(40, 25, 8, 0.32),
      0 2px 6px -2px rgba(40, 25, 8, 0.12);
    isolation: isolate;
  }
  /* a soft sheen across the glass, brighter at the top edge, like light on a curved surface */
  html.is-app .tabbar::before {
    content: ""; position: absolute; inset: 0; border-radius: inherit; pointer-events: none; z-index: -1;
    background:
      radial-gradient(120% 90% at 20% -20%, rgba(255, 255, 255, 0.55), transparent 55%),
      linear-gradient(180deg, rgba(255, 255, 255, 0.22), transparent 45%, rgba(255, 255, 255, 0.08));
  }
  :root:not([data-theme="light"]) html.is-app .tabbar,
  html.is-app:not([data-theme="light"]) .tabbar {
    background: rgba(40, 33, 26, 0.48);
    box-shadow:
      inset 0 1px 0.5px rgba(255, 255, 255, 0.22),
      inset 0 0 0 0.5px rgba(255, 255, 255, 0.14),
      0 12px 32px -10px rgba(0, 0, 0, 0.6);
  }
  html.is-app:not([data-theme="light"]) .tabbar::before { background: radial-gradient(120% 90% at 20% -20%, rgba(255, 255, 255, 0.14), transparent 55%); }

  html.is-app .tabbar a {
    min-height: 0; height: 100%; gap: 2px; padding: 0 2px; border-radius: 999px; font-size: 10.5px; font-weight: 650;
    color: rgba(31, 25, 18, 0.62); transition: background-color 0.25s var(--ease), transform 0.18s var(--ease), color 0.2s;
  }
  html.is-app:not([data-theme="light"]) .tabbar a { color: rgba(244, 238, 226, 0.62); }
  html.is-app .tabbar svg { width: 24px; height: 24px; }
  html.is-app .tabbar a:active { transform: scale(0.92); opacity: 1; }
  /* the open tab: a lens of lighter glass, the icon in Kofe's lamp gold */
  html.is-app .tabbar a[aria-current="page"] {
    color: #a86f12; background: rgba(255, 255, 255, 0.62);
    box-shadow: inset 0 1px 0.5px rgba(255, 255, 255, 1), inset 0 0 0 0.5px rgba(255, 255, 255, 0.8), 0 2px 8px -3px rgba(40, 25, 8, 0.22);
  }
  html.is-app:not([data-theme="light"]) .tabbar a[aria-current="page"] {
    color: #f0bc63; background: rgba(255, 255, 255, 0.13);
    box-shadow: inset 0 1px 0.5px rgba(255, 255, 255, 0.25), inset 0 0 0 0.5px rgba(255, 255, 255, 0.12);
  }
  html.is-app .tabbar a[aria-current="page"] .av { box-shadow: 0 0 0 2px currentColor; }
  html.is-app .tabbar .badge { top: 5px; left: calc(50% + 7px); }

  /* "Open your room": its own round glass button beside the bar */
  html.is-app .tabbar .tab-open {
    position: absolute; top: 50%; right: calc(-1 * (var(--btn) + var(--gap))); width: var(--btn); height: var(--btn); margin-top: calc(var(--btn) / -2);
    padding: 0; border-radius: 50%; display: grid; place-items: center; color: #3a2705;
    background: radial-gradient(120% 120% at 30% 15%, rgba(255, 236, 190, 0.95), rgba(232, 172, 72, 0.88) 55%, rgba(201, 138, 40, 0.9));
    -webkit-backdrop-filter: blur(22px) saturate(1.8); backdrop-filter: blur(22px) saturate(1.8);
    box-shadow:
      inset 0 1px 0.5px rgba(255, 255, 255, 0.9),
      inset 0 -2px 4px rgba(120, 70, 0, 0.25),
      0 0 0 0.5px rgba(120, 70, 0, 0.2),
      0 12px 28px -10px rgba(170, 110, 20, 0.55);
  }
  html.is-app .tabbar .tab-open > span { display: none; }
  html.is-app .tabbar .tab-open i { width: auto; height: auto; background: none; color: inherit; }
  html.is-app .tabbar .tab-open i svg { width: 26px; height: 26px; }
  html.is-app .tabbar .tab-open[aria-current="page"] { background: radial-gradient(120% 120% at 30% 15%, #ffefc9, #e6a63f 60%, #c1852a); }

  /* the bar floats: the page can scroll under it, and steps aside while you type */
  html.is-app .main { padding-bottom: calc(var(--tab-h) + 48px + env(safe-area-inset-bottom, 0px)); }
  html.is-app .toast { bottom: calc(var(--tab-h) + 26px + env(safe-area-inset-bottom, 0px)); }
  html.is-app.kb-open .tabbar { transform: translateY(calc(100% + 60px)); opacity: 0; }
}
@media (max-width: 760px) {
  html.is-app .tabbar { background: rgba(252, 248, 241, 0.5); -webkit-backdrop-filter: blur(28px) saturate(1.9) brightness(1.06); backdrop-filter: blur(28px) saturate(1.9) brightness(1.06); }
  html.is-app:not([data-theme="light"]) .tabbar { background: rgba(40, 33, 26, 0.55); }
  html.is-app .tabbar a.tab-open, html.is-app:not([data-theme="light"]) .tabbar a.tab-open { color: #3a2705; }
}
/* "+" back in the middle of the glass bar, as a round gold glass button inside it */
@media (max-width: 760px) {
  html.is-app .tabbar { right: 14px; }
  html.is-app .tabbar .tab-open {
    position: relative; top: auto; right: auto; margin: 0 auto; align-self: center; justify-self: center;
    width: 50px; height: 50px; min-height: 0;
  }
  html.is-app .tabbar .tab-open i svg { width: 24px; height: 24px; }
  html.is-app .tabbar .tab-open:active { transform: scale(0.9); }
}
/* quieter, more elegant: a slimmer bar, finer type, a small ink-and-brass "+" */
@media (max-width: 760px) {
  html.is-app .tabbar { --h: 58px; height: var(--h); min-height: var(--h); padding: 4px 5px; }
  html.is-app .tabbar a { font-size: 10px; font-weight: 600; letter-spacing: 0.01em; gap: 3px; }
  html.is-app .tabbar svg { width: 22px; height: 22px; stroke-width: 1.6; }
  html.is-app .tabbar a[aria-current="page"] { color: #8f6420; background: rgba(255, 255, 255, 0.55); }
  html.is-app:not([data-theme="light"]) .tabbar a[aria-current="page"] { color: #e8c58a; background: rgba(255, 255, 255, 0.1); }
  html.is-app .tabbar .badge {
    top: 6px; left: calc(50% + 5px); min-width: 16px; height: 16px; padding: 0 4px; border-radius: 999px;
    font-size: 9.5px; font-weight: 700; line-height: 16px; background: #c8913a; color: #fffaf0;
    box-shadow: 0 0 0 1.5px rgba(252, 248, 241, 0.9);
  }
  html.is-app:not([data-theme="light"]) .tabbar .badge { box-shadow: 0 0 0 1.5px rgba(40, 33, 26, 0.9); }
  html.is-app .tabbar .av { --size: 24px; width: 24px !important; height: 24px !important; font-size: 10px !important; }

  /* "+": a small ink circle with a brass cross, the way a fine pen cap catches light */
  html.is-app .tabbar a.tab-open, html.is-app:not([data-theme="light"]) .tabbar a.tab-open {
    width: 42px; height: 42px; color: #e6c27e;
    background: linear-gradient(180deg, #34291f 0%, #1c1611 100%);
    box-shadow: inset 0 1px 0 rgba(255, 240, 210, 0.22), inset 0 0 0 0.5px rgba(230, 194, 126, 0.35), 0 6px 14px -6px rgba(20, 12, 4, 0.55);
  }
  html.is-app:not([data-theme="light"]) .tabbar a.tab-open {
    color: #2a1f14; background: linear-gradient(180deg, #faf4e8 0%, #e9dfcd 100%);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.9), 0 6px 14px -6px rgba(0, 0, 0, 0.6);
  }
  html.is-app .tabbar .tab-open i svg { width: 19px; height: 19px; stroke-width: 1.8; }
  html.is-app .tabbar .tab-open[aria-current="page"] { background: linear-gradient(180deg, #3d3024, #211a14); }
}
/* "+": light and delicate — a little frosted-glass disc with a fine brass ring and a brass cross */
@media (max-width: 760px) {
  html.is-app .tabbar a.tab-open {
    width: 42px; height: 42px; color: #a8762a;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.95) 0%, rgba(250, 243, 230, 0.85) 100%);
    box-shadow: inset 0 1px 0 #fff, inset 0 0 0 1px rgba(200, 145, 58, 0.45), 0 4px 12px -5px rgba(150, 100, 30, 0.35);
  }
  html.is-app:not([data-theme="light"]) .tabbar a.tab-open {
    color: #e8c58a;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.2) 0%, rgba(255, 255, 255, 0.08) 100%);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.3), inset 0 0 0 1px rgba(232, 197, 138, 0.45), 0 4px 12px -5px rgba(0, 0, 0, 0.5);
  }
  html.is-app .tabbar .tab-open[aria-current="page"] { background: linear-gradient(180deg, #fffaf0, #f3e4c6); }
  html.is-app .tabbar .tab-open i svg { stroke-width: 1.6; }
}

/* ---- the liquid lens under the open tab (moved by native.js) */
@media (max-width: 760px) {
  html.is-app .tabbar { touch-action: none; }
  html.is-app .tabbar > a { position: relative; z-index: 1; }
  html.is-app .tabbar a[aria-current="page"]:not(.tab-open),
  html.is-app:not([data-theme="light"]) .tabbar a[aria-current="page"]:not(.tab-open) { background: transparent; box-shadow: none; }
  .tb-lens {
    position: absolute; left: 0; top: 4px; bottom: 4px; z-index: 0; border-radius: 999px; pointer-events: none;
    transform-origin: 50% 50%; will-change: transform;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.78), rgba(255, 255, 255, 0.5));
    box-shadow: inset 0 1px 0.5px #fff, inset 0 -1px 1px rgba(255, 255, 255, 0.5), inset 0 0 0 0.5px rgba(255, 255, 255, 0.9), 0 3px 10px -4px rgba(40, 25, 8, 0.25);
    transition: opacity 0.2s, background 0.25s, box-shadow 0.25s;
  }
  html.is-app:not([data-theme="light"]) .tb-lens {
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.18), rgba(255, 255, 255, 0.08));
    box-shadow: inset 0 1px 0.5px rgba(255, 255, 255, 0.3), inset 0 0 0 0.5px rgba(255, 255, 255, 0.16), 0 3px 10px -4px rgba(0, 0, 0, 0.4);
  }
  /* held: the drop swells and turns clear, like water lifting off the glass */
  .tb-lens.is-press {
    background: radial-gradient(120% 140% at 50% 0%, rgba(255, 255, 255, 0.55), rgba(255, 255, 255, 0.12) 70%);
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.95), inset 0 2px 2px rgba(255, 255, 255, 0.9), inset 0 -3px 6px rgba(255, 255, 255, 0.35), 0 10px 26px -8px rgba(40, 25, 8, 0.38);
    -webkit-backdrop-filter: saturate(1.8) brightness(1.08); backdrop-filter: saturate(1.8) brightness(1.08);
  }
  .tb-lens.is-off { opacity: 0; }
  html.is-app .tabbar.tb-dragging a[aria-current="page"]:not(.is-under) { color: rgba(31, 25, 18, 0.62); }
  html.is-app:not([data-theme="light"]) .tabbar.tb-dragging a[aria-current="page"]:not(.is-under) { color: rgba(244, 238, 226, 0.62); }
  html.is-app .tabbar a.is-under { color: #8f6420; }
  html.is-app:not([data-theme="light"]) .tabbar a.is-under { color: #e8c58a; }
}

/* ---- a room's writing bar, the same as in messages: the field in a glass pill, the microphone on the right
 * (hold it to talk, let go to send, slide left to throw it away), and send appears once you write */
@media (max-width: 600px) {
  html.is-app.room-app .scene[style*="--room-img"] .talk .composer.tg { gap: 6px; align-items: flex-end; padding: 8px 10px calc(8px + env(safe-area-inset-bottom, 0px)) !important; }
  html.is-app.room-app .scene[style*="--room-img"] .talk .composer.tg textarea,
  html.is-app.room-app .scene[style*="--room-img"] .talk .composer.tg textarea:focus {
    background: transparent; box-shadow: none; border-radius: 0; min-height: 44px; padding: 11px 4px; color: var(--w-ink);
  }
  html.is-app[data-theme="light"].room-app .scene[style*="--room-img"] .talk .composer.tg textarea { color: #1f1912; }
  html.is-app.room-app .scene[style*="--room-img"] .talk .composer.tg .cmp-pill { background: rgba(255, 255, 255, 0.9); box-shadow: inset 0 0 0 1px rgba(60, 40, 20, 0.12), 0 4px 14px -10px rgba(40, 25, 8, 0.35); }
  html.is-app:not([data-theme="light"]).room-app .scene[style*="--room-img"] .talk .composer.tg .cmp-pill { background: rgba(255, 255, 255, 0.08); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.12); }
  html.is-app.room-app .scene[style*="--room-img"] .talk .composer.tg .cmp-pill:focus-within { box-shadow: inset 0 0 0 1.5px color-mix(in srgb, var(--w-lamp, #e0a23a) 60%, transparent); }
  html.is-app.room-app .scene[style*="--room-img"] .talk .composer.tg .tool-btn { width: 40px; height: 44px; }
  html.is-app.room-app .scene[style*="--room-img"] .talk .composer.tg .cmp-round { width: 44px; height: 44px; }
  html.is-app.room-app .scene[style*="--room-img"] .talk .composer.tg .tool-voice { background: rgba(255, 255, 255, 0.9); color: #1f1912; box-shadow: inset 0 0 0 1px rgba(60, 40, 20, 0.12); }
  html.is-app:not([data-theme="light"]).room-app .scene[style*="--room-img"] .talk .composer.tg .tool-voice { background: rgba(255, 255, 255, 0.1); color: var(--w-ink); }
}
@media (max-width: 760px) { html.is-app .tabbar a { -webkit-user-drag: none; user-drag: none; } }

/* ================================================================
 * Rooms home on a phone: "Open now" is a row of story cards you swipe left and right
 * ================================================================ */
@media (max-width: 760px) {
  .tier-now .doors-story > * { flex: 0 0 46%; min-height: 0; aspect-ratio: 3 / 4.6; padding: 14px 12px 12px; scroll-snap-align: start; border-radius: 120px 120px 22px 22px; }
  .tier-now .doors-story > :only-child { flex-basis: 62%; }
  .tier-now .doors-story .rc-topic { font-size: 11.5px; letter-spacing: 0.02em; }
  .tier-now .doors-story .rc-q { font-size: 16.5px; line-height: 1.2; margin: 4px 0 8px; display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden; }
  .tier-now .doors-story .rc-foot { min-height: 0; flex-direction: column; align-items: flex-start; gap: 6px; }
  .tier-now .doors-story .rc-state { font-size: 12px; gap: 6px; }
  .tier-now .doors-story .rc-faces .av { width: 20px !important; height: 20px !important; }
  .tier-now .doors-story .rc-act { display: none; }
  .tier-now .doors-story .skel-card { flex: 0 0 46%; aspect-ratio: 3 / 4.6; border-radius: 120px 120px 22px 22px; }
  .tier-now { margin-bottom: 6px; }
}
.now-empty {
  display: flex; align-items: center; gap: 14px; padding: 16px 18px; border-radius: 22px; text-decoration: none; color: var(--ink);
  background: var(--glass-2, rgba(255, 255, 255, 0.55)); box-shadow: inset 0 1px 0 var(--glass-top, #fff), inset 0 0 0 1px var(--glass-edge, rgba(0, 0, 0, 0.06));
}
.now-empty b { display: block; font-size: 15.5px; }
.now-empty small { display: block; color: var(--muted); font-size: 13.5px; margin-top: 2px; }
.ne-ic { flex: none; width: 46px; height: 46px; border-radius: 50%; display: grid; place-items: center; color: #a8762a; background: linear-gradient(180deg, #fff, #f6ecda); box-shadow: inset 0 0 0 1px rgba(200, 145, 58, 0.4); }
.ne-ic svg { width: 20px; height: 20px; }

/* ================================================================
 * Opening a room on a phone: three calm steps, one screen each
 * ================================================================ */
.cw {
  position: fixed; inset: 0; z-index: 60; display: flex; flex-direction: column;
  padding-top: env(safe-area-inset-top, 0px); background: var(--bg); color: var(--ink);
}
.cw-top { flex: none; display: grid; grid-template-columns: 44px 1fr 44px; align-items: center; gap: 12px; padding: 6px 12px 4px; }
.cw-ic { width: 44px; height: 44px; display: grid; place-items: center; border: 0; border-radius: 50%; background: none; color: var(--ink); cursor: pointer; text-decoration: none; }
.cw-ic svg { width: 22px; height: 22px; }
.cw-ic:active { background: color-mix(in srgb, var(--ink) 8%, transparent); }
.cw-steps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.cw-steps i { height: 4px; border-radius: 4px; background: var(--line-2); transition: background-color 0.3s var(--ease); }
.cw-steps i.is-on { background: var(--lamp); }
.cw-form { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; }
.cw-body { flex: 1 1 auto; min-height: 0; overflow-y: auto; padding: 10px 20px 16px; -webkit-overflow-scrolling: touch; overscroll-behavior: contain; }
.cw-pane { display: grid; gap: 14px; align-content: start; animation: cw-in 0.35s var(--ease) both; }
@keyframes cw-in { from { opacity: 0; transform: translateX(16px); } }
.cw-pane h1 { margin: 0; font-family: var(--display); font-weight: 500; font-size: 28px; line-height: 1.1; letter-spacing: -0.01em; }
.cw-lead { margin: -6px 0 2px; color: var(--muted); font-size: 15px; line-height: 1.4; }
.cw-k { margin: 4px 0 -4px; color: var(--muted); font-size: 13px; font-weight: 650; }
.cw-topics { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.cw-topics .topic-tile { min-height: 0; aspect-ratio: 1 / 1.08; border-radius: 60px 60px 16px 16px; }
.cw-topics .topic-tile span { font-size: 12.5px; }
.cw-topics .topic-tile[aria-pressed="true"] { box-shadow: 0 0 0 2.5px var(--bg), 0 0 0 4.5px var(--lamp); }
.cw-chip { justify-self: start; display: inline-flex; align-items: center; gap: 8px; padding: 4px 12px 4px 4px; border-radius: 999px; background: var(--glass-2, rgba(255, 255, 255, 0.6)); box-shadow: inset 0 0 0 1px var(--glass-edge, rgba(0, 0, 0, 0.06)); font-size: 13.5px; font-weight: 650; }
.cw-chip img { width: 28px; height: 28px; border-radius: 50%; object-fit: cover; object-position: var(--x, 50%) 50%; }
.cw-q textarea { min-height: 112px; font-family: var(--display); font-size: 21px; line-height: 1.3; padding: 14px 16px; border-radius: 18px; }
.cw .ideas { display: grid; gap: 8px; }
.cw-preview { display: grid; justify-items: center; }
.cw-preview .room-card { width: min(62%, 240px); min-height: 0; aspect-ratio: 3 / 4.3; border-radius: 140px 140px 22px 22px; padding: 16px 14px 14px; }
.cw-preview .rc-q { font-size: 18px; }
.cw-hello textarea { min-height: 64px; border-radius: 16px; }
.cw-opts { display: grid; gap: 10px; }
.cw-opt { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 8px 8px 8px 16px; border-radius: 16px; background: var(--glass-2, rgba(255, 255, 255, 0.55)); box-shadow: inset 0 0 0 1px var(--glass-edge, rgba(0, 0, 0, 0.06)); }
.cw-opt > span, .cw-opt > label { font-weight: 650; font-size: 15px; }
.cw-opt input { min-height: 40px; border: 0; background: transparent; color: var(--ink); font: inherit; }
.cw-go { flex: none; padding: 8px 16px calc(10px + env(safe-area-inset-bottom, 0px)); }
.cw-go .err:empty { display: none; }
.cw-go .err { margin: 0 0 8px; text-align: center; }
.cw-next { width: 100%; min-height: 54px; border: 0; border-radius: 16px; background: var(--btn); color: var(--btn-ink); font: inherit; font-size: 17px; font-weight: 650; cursor: pointer; transition: transform 0.12s ease; }
.cw-next:active { transform: scale(0.98); }
.cw-next:disabled { opacity: 0.55; }
html.kb-open .cw-go { padding-bottom: 8px; }

/* ================================================================ Games */
.games { display: grid; gap: 16px; }
.game-card {
  position: relative; isolation: isolate; overflow: hidden; display: flex; flex-direction: column; justify-content: flex-end; gap: 6px;
  min-height: 300px; padding: 22px 20px; border-radius: 28px; color: #f4eee2; text-decoration: none;
  box-shadow: 0 24px 50px -26px rgba(30, 18, 6, 0.6), inset 0 0 0 1px rgba(255, 255, 255, 0.14);
}
.game-card::before { content: ""; position: absolute; inset: 0; z-index: -1; background: linear-gradient(180deg, rgba(12, 9, 7, 0.1), rgba(12, 9, 7, 0.35) 45%, rgba(12, 9, 7, 0.92)); }
.gc-bg { position: absolute; inset: 0; z-index: -2; width: 100%; height: 100%; object-fit: cover; }
.gc-cards { position: absolute; top: 22px; right: 18px; display: flex; }
.gc-cards img { width: 54px; height: auto; border-radius: 6px; box-shadow: 0 10px 20px -6px rgba(0, 0, 0, 0.6); }
.gc-cards img + img { margin-left: -26px; }
.gc-cards img:nth-child(1) { transform: rotate(-12deg) translateY(6px); }
.gc-cards img:nth-child(2) { transform: rotate(-4deg); }
.gc-cards img:nth-child(3) { transform: rotate(4deg); }
.gc-cards img:nth-child(4) { transform: rotate(12deg) translateY(6px); }
.gc-text { display: grid; gap: 4px; max-width: 32ch; }
.gc-text small { font-size: 12px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: #e2bd76; }
.gc-text b { font-family: var(--display); font-weight: 500; font-size: 34px; line-height: 1.05; }
.gc-text span { font-size: 14.5px; line-height: 1.4; color: rgba(244, 238, 226, 0.82); }
.gc-go { align-self: flex-start; margin-top: 10px; padding: 11px 26px; border-radius: 999px; background: #f4eee2; color: #1f1912; font-weight: 700; font-size: 15px; }
.game-card:active { transform: scale(0.985); transition: transform 0.12s ease; }
.game-card.is-soon { min-height: 220px; }
.game-card.is-soon .gc-bg { filter: saturate(0.7) brightness(0.85); }
.gc-soon {
  position: absolute; top: 18px; right: 18px; padding: 6px 12px; border-radius: 999px; font-size: 12px; font-weight: 700; letter-spacing: 0.04em;
  color: #fff; background: rgba(255, 255, 255, 0.18); -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.35);
}
.ph-tools { display: inline-flex; gap: 8px; align-items: center; }
.ph-friends { position: relative; }
.ph-friends .badge { position: absolute; top: -4px; right: -4px; }
