:root {
  --bg: #0A0A0F;
  --panel: #15151C;
  --panel-2: #1B1B23;
  --line: #2A2A35;
  --text: #F4F4F6;
  --muted: #A1A1AD;
  --faint: #8E8E9B;
  --pink: #FF4F7B;
  --pink-soft: rgba(255, 79, 123, 0.18);
  --lime: #C6F432;
  --ig-red: #FF3040;
  --glass: rgba(10, 10, 15, 0.55);
  --sans: 'DM Sans', system-ui, sans-serif;
  --display: 'Bricolage Grotesque', var(--sans);
  --system: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text); font-family: var(--sans); overflow: hidden; }
body { position: fixed; inset: 0; overscroll-behavior: none; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
input { font: inherit; }
svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.hidden { display: none !important; }

.screen { position: absolute; inset: 0; }
.label { display: block; font-size: 12px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }
.fine { margin: 0; text-align: center; font-size: 13px; color: var(--faint); }
.fine.left { text-align: left; }
.fine a { color: var(--muted); font-weight: 700; text-decoration: underline; text-underline-offset: 2px; }
.muted { color: var(--muted); font-weight: 500; }
.pill { display: inline-flex; align-items: center; gap: 7px; padding: 8px 12px; border-radius: 999px; background: var(--glass); border: 1px solid rgba(255,255,255,0.14); font-size: 12px; font-weight: 700; letter-spacing: 0.06em; color: var(--lime); backdrop-filter: blur(10px); }
.pill.live i { width: 7px; height: 7px; border-radius: 50%; background: var(--lime); animation: pulse 1.6s infinite; }
@keyframes pulse { 50% { opacity: 0.35; } }

.primary { display: flex; align-items: center; justify-content: center; gap: 10px; width: 100%; height: 56px; border-radius: 16px; background: var(--pink); color: var(--bg); font-weight: 700; font-size: 17px; }
.primary:disabled { background: #22222C; color: var(--faint); }
.ghost { height: 52px; padding: 0 16px; border-radius: 14px; border: 1px solid var(--line); background: #22222C; font-weight: 700; font-size: 15px; }
.ghost.wide { width: 100%; }
.ghost.small { height: 40px; padding: 0 14px; border-radius: 10px; border: 0; background: var(--line); font-size: 14px; }
.link { color: #FF7A9A; font-weight: 700; font-size: 15px; padding: 8px 2px; flex-shrink: 0; }

/* avatars */
.av { display: inline-flex; align-items: center; justify-content: center; width: 32px; height: 32px; border-radius: 50%; color: var(--bg); font-weight: 700; font-size: 13px; border: 2px solid var(--bg); flex-shrink: 0; }
.avatars { display: flex; }
.avatars .av { width: 24px; height: 24px; font-size: 10px; border-color: #111; }
.avatars .av + .av { margin-left: -8px; }

/* ---------- join ---------- */
.join { display: flex; flex-direction: column; gap: 24px; padding: max(56px, env(safe-area-inset-top) + 28px) 24px max(32px, env(safe-area-inset-bottom) + 16px); overflow-y: auto; }
.join-top { display: flex; align-items: center; justify-content: space-between; }
.brand { font-family: var(--display); font-weight: 800; font-size: 22px; letter-spacing: -0.02em; }
.brand span { color: var(--pink); }
.join-hero { display: flex; flex-direction: column; gap: 14px; }
.join-hero h1 { margin: 0; font-family: var(--display); font-weight: 800; font-size: 44px; line-height: 0.98; letter-spacing: -0.035em; }
.join-hero p { margin: 0; font-size: 16px; line-height: 1.45; color: var(--muted); }
.who { display: flex; align-items: center; gap: 12px; font-size: 14px; color: var(--muted); min-height: 32px; }
.who .avatars .av { width: 32px; height: 32px; font-size: 13px; border-color: var(--bg); }
.who .avatars .av + .av { margin-left: -10px; }
.join-form { display: flex; flex-direction: column; gap: 22px; flex: 1; }
.field { display: flex; flex-direction: column; gap: 8px; }
.field input:not([type]) { height: 52px; padding: 0 16px; border-radius: 14px; border: 1px solid var(--line); background: var(--panel); color: var(--text); font-weight: 500; font-size: 16px; outline: none; width: 100%; }
.field input:focus { border-color: var(--pink); }
.field input::placeholder { color: #7E7E8C; }
.choice { display: flex; align-items: center; gap: 14px; padding: 14px; border-radius: 16px; border: 2px solid var(--line); background: var(--panel); cursor: pointer; }
.choice input { position: absolute; opacity: 0; pointer-events: none; }
.choice-icon { width: 44px; height: 44px; flex-shrink: 0; border-radius: 12px; background: #22222C; display: flex; align-items: center; justify-content: center; }
.choice-text { display: flex; flex-direction: column; gap: 3px; flex: 1; }
.choice-text b { font-size: 16px; }
.choice-text small { font-size: 13px; line-height: 1.35; color: var(--muted); }
.radio { width: 22px; height: 22px; flex-shrink: 0; border-radius: 50%; border: 2px solid #4A4A57; display: flex; align-items: center; justify-content: center; }
.choice:has(input:checked) { border-color: var(--pink); background: rgba(255, 79, 123, 0.10); }
.choice:has(input:checked) .radio { border-color: var(--pink); }
.choice:has(input:checked) .radio::after { content: ''; width: 10px; height: 10px; border-radius: 50%; background: var(--pink); }
.join-bottom { margin-top: auto; display: flex; flex-direction: column; gap: 14px; }

/* ---------- feed (Instagram's layout, system font) ---------- */
.feed { background: #000; overflow: hidden; touch-action: none; font-family: var(--system); }
.stage { position: absolute; inset: 0; background: #111; transition: transform 0.22s ease, opacity 0.22s ease; }
.stage.out-up { transform: translateY(-12%); opacity: 0; }
.stage.out-down { transform: translateY(12%); opacity: 0; }
.stage.in-up { transform: translateY(12%); opacity: 0; transition: none; }
.stage.in-down { transform: translateY(-12%); opacity: 0; transition: none; }
.stage video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; background: #000; }
.stage video.standby { opacity: 0; pointer-events: none; }
.shade { position: absolute; left: 0; right: 0; pointer-events: none; }
.shade.top { top: 0; height: 160px; background: linear-gradient(rgba(0,0,0,0.55), rgba(0,0,0,0)); }
.shade.bottom { bottom: 0; height: 300px; background: linear-gradient(rgba(0,0,0,0), rgba(0,0,0,0.7)); }
.waiting { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; text-align: center; padding: 40px; }
.waiting h2 { margin: 0; font-family: var(--display); font-weight: 800; font-size: 26px; letter-spacing: -0.02em; }
.waiting p { margin: 0; color: var(--muted); font-size: 15px; }
.spinner { width: 36px; height: 36px; border-radius: 50%; border: 3px solid var(--line); border-top-color: var(--pink); animation: spin 0.9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.topbar { position: absolute; top: max(50px, env(safe-area-inset-top) + 10px); left: 12px; right: 12px; display: flex; flex-direction: column; gap: 10px; }
.topbar-controls { justify-content: space-between; }
.host-banner { flex-direction: column; align-items: flex-start; gap: 3px; border-radius: 12px; color: var(--text); letter-spacing: normal; line-height: 1.4; }
.host-banner .muted { font-size: 11px; }
.room { display: inline-flex; align-items: center; gap: 8px; height: 36px; padding: 0 12px 0 5px; border-radius: 999px; background: var(--glass); color: #fff; font-size: 14px; font-weight: 600; backdrop-filter: blur(10px); }
.dot { width: 7px; height: 7px; border-radius: 50%; background: var(--lime); }
.dot.off { background: var(--muted); }
.round { width: 36px; height: 36px; border-radius: 50%; background: var(--glass); color: #fff; display: flex; align-items: center; justify-content: center; backdrop-filter: blur(10px); }
.round svg { width: 20px; height: 20px; }

.toast { position: absolute; top: calc(100% + 14px); left: 50%; transform: translateX(-50%); display: flex; align-items: center; gap: 8px; padding: 6px 12px 6px 6px; border-radius: 999px; background: rgba(255,255,255,0.95); color: #000; font-size: 13px; white-space: nowrap; animation: toast-in 0.2s ease; z-index: 5; font-family: var(--system); }
.toast.error { background: #FFB547; }
.toast.info { background: rgba(0,0,0,0.75); color: #fff; padding: 8px 14px; }
.toast .av { width: 22px; height: 22px; font-size: 10px; border: 0; }
.toast.pill-reconnecting { background: var(--glass); color: #fff; padding: 8px 14px; border: 1px solid rgba(255,255,255,0.14); backdrop-filter: blur(10px); font-weight: 600; white-space: normal; width: max-content; max-width: 100%; line-height: 1.4; }
.toast.pill-reconnecting i { width: 7px; height: 7px; flex-shrink: 0; border-radius: 50%; background: #FFB547; animation: pulse 1.2s infinite; }
@keyframes toast-in { from { opacity: 0; transform: translate(-50%, -8px); } }

.paused { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; pointer-events: none; }
.paused svg { width: 96px; height: 96px; color: rgba(255,255,255,0.85); filter: drop-shadow(0 4px 24px rgba(0,0,0,0.5)); }

.media-fail { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); max-width: calc(100% - 48px); padding: 10px 16px; border-radius: 999px; background: rgba(0,0,0,0.75); color: #fff; font-size: 14px; font-weight: 600; text-align: center; pointer-events: none; }
.tap-play { position: absolute; inset: 0; z-index: 4; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; background: rgba(0,0,0,0.45); color: #fff; font-size: 16px; font-weight: 700; }
.tap-play span { width: 84px; height: 84px; border-radius: 50%; display: flex; align-items: center; justify-content: center; background: rgba(255,255,255,0.18); backdrop-filter: blur(10px); }
.tap-play svg { width: 40px; height: 40px; margin-left: 4px; }

.big-heart { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; pointer-events: none; opacity: 0; }
.big-heart svg { width: 120px; height: 120px; fill: #fff; stroke: none; filter: drop-shadow(0 6px 24px rgba(0,0,0,0.4)); }
.big-heart.go { animation: bigheart 0.9s ease-out forwards; }
@keyframes bigheart { 0% { opacity: 0; transform: scale(0.5); } 20% { opacity: 1; transform: scale(1.15); } 40% { transform: scale(1); } 80% { opacity: 1; } 100% { opacity: 0; transform: scale(1.1) translateY(-20px); } }

.bursts { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.burst { position: absolute; display: flex; flex-direction: column; align-items: center; gap: 4px; animation: burst 1.6s ease-out forwards; }
.burst svg { width: 64px; height: 64px; fill: var(--ig-red); stroke: none; filter: drop-shadow(0 6px 18px rgba(0,0,0,0.4)); }
.burst span { padding: 3px 9px; border-radius: 999px; color: #000; font-size: 12px; font-weight: 700; }
@keyframes burst { 0% { transform: scale(0.4) rotate(var(--rot)); opacity: 0; } 15% { transform: scale(1.1) rotate(var(--rot)); opacity: 1; } 70% { opacity: 1; } 100% { transform: translateY(-120px) scale(0.9) rotate(var(--rot)); opacity: 0; } }

.rail { position: absolute; right: 10px; bottom: max(96px, env(safe-area-inset-bottom) + 76px); display: flex; flex-direction: column; align-items: center; gap: 22px; }
.rail button { display: flex; flex-direction: column; align-items: center; gap: 5px; color: #fff; font-weight: 600; font-size: 12px; min-width: 44px; filter: drop-shadow(0 2px 6px rgba(0,0,0,0.5)); }
.rail svg { width: 28px; height: 28px; stroke-width: 1.9; }
#heartIcon.on { fill: var(--ig-red); stroke: var(--ig-red); }
#likeBtn.pop svg { animation: pop 0.3s ease; }
@keyframes pop { 50% { transform: scale(1.3); } }
.disc { width: 30px; height: 30px; border-radius: 50%; border: 4px solid #333; background: #111 center / cover no-repeat; animation: spin 4s linear infinite; }

.meta { position: absolute; left: 14px; right: 72px; bottom: max(28px, env(safe-area-inset-bottom) + 12px); display: flex; flex-direction: column; gap: 8px; color: #fff; text-shadow: 0 1px 4px rgba(0,0,0,0.5); }
.chip { align-self: flex-start; display: inline-flex; align-items: center; gap: 6px; padding: 4px 9px; border-radius: 6px; background: rgba(255,255,255,0.16); backdrop-filter: blur(8px); font-size: 12px; font-weight: 600; text-shadow: none; }
.creator { display: flex; align-items: center; gap: 10px; font-size: 14px; }
.avatar-img { width: 32px; height: 32px; flex-shrink: 0; border-radius: 50%; background: #333 center / cover no-repeat; border: 1.5px solid rgba(255,255,255,0.9); }
.verified { width: 16px; height: 16px; margin-left: -4px; }
.ad { font-size: 12px; color: rgba(255,255,255,0.75); }
.caption { margin: 0; font-size: 14px; line-height: 1.35; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; cursor: pointer; }
.caption.open { -webkit-line-clamp: unset; max-height: 40vh; overflow-y: auto; }
.music { display: flex; align-items: center; gap: 8px; font-size: 13px; overflow: hidden; }
.music svg { width: 14px; height: 14px; flex-shrink: 0; }
.music span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.liked-by { display: flex; align-items: center; gap: 8px; font-size: 13px; }
.liked-by .avatars .av { border-color: #000; }

.progress { position: absolute; left: 0; right: 0; bottom: max(0px, env(safe-area-inset-bottom) - 14px); height: 2px; background: rgba(255,255,255,0.2); }
#progressBar { width: 0; height: 100%; background: #fff; }

/* ---------- sheets ---------- */
.sheet { position: absolute; inset: 0; z-index: 10; font-family: var(--system); }
.scrim { position: absolute; inset: 0; background: rgba(0,0,0,0.5); width: 100%; }
.card { position: absolute; left: 0; right: 0; bottom: 0; padding: 10px 16px max(28px, env(safe-area-inset-bottom) + 12px); border-radius: 20px 20px 0 0; background: #1c1c1e; display: flex; flex-direction: column; gap: 16px; animation: up 0.25s ease; max-height: 88%; overflow-y: auto; }
.card.tall { height: 72%; padding-bottom: 0; overflow: hidden; }
@keyframes up { from { transform: translateY(40px); opacity: 0; } }
.grab { align-self: center; width: 36px; height: 4px; border-radius: 2px; background: #555; flex-shrink: 0; }
.card h2 { margin: 0 0 6px; font-family: var(--display); font-weight: 800; font-size: 26px; letter-spacing: -0.02em; }
.sheet-title { margin: 0; text-align: center; font-size: 16px; font-weight: 700; padding-bottom: 12px; border-bottom: 1px solid #2c2c2e; }
.sub { margin: 0; font-size: 15px; line-height: 1.45; color: var(--muted); }
.row { display: flex; gap: 8px; align-items: center; }
.row.between { justify-content: space-between; align-items: flex-start; gap: 12px; }
.row input { flex: 1; min-width: 0; }
.card .field input { background: #2c2c2e; border-color: #3a3a3c; }
.error { padding: 10px 14px; border-radius: 12px; background: rgba(255,181,71,0.15); color: #FFD08A; font-size: 14px; }
.linkbox { display: flex; align-items: center; gap: 10px; height: 56px; padding: 0 8px 0 16px; border-radius: 16px; background: #2c2c2e; }
.linkbox svg { width: 18px; height: 18px; color: var(--muted); flex-shrink: 0; }
.linkbox span { flex: 1; min-width: 0; font-weight: 600; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.qrbox { display: flex; align-items: center; gap: 16px; padding: 14px; border-radius: 18px; background: #2c2c2e; }
.qrbox img { width: 112px; height: 112px; padding: 6px; border-radius: 12px; background: #fff; flex-shrink: 0; }
.qrbox div { display: flex; flex-direction: column; gap: 6px; font-size: 15px; line-height: 1.4; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip-btn { display: inline-flex; align-items: center; gap: 6px; height: 40px; padding: 0 14px; border-radius: 999px; border: 1px solid #3a3a3c; background: #2c2c2e; font-weight: 600; font-size: 14px; }
.chip-btn.on { border-color: var(--pink); background: var(--pink-soft); color: #FFC2D1; }
.chip-btn.busy { opacity: 0.6; }
.chip-btn:disabled { cursor: default; }
.members { display: flex; flex-direction: column; }
.member { display: flex; align-items: center; gap: 12px; padding: 8px 0; font-size: 15px; }
.member b { flex: 1; }
.member b small { font-weight: 500; color: var(--muted); }
.member span { font-size: 13px; color: var(--muted); }

/* comments */
.comment-list { flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 18px; padding: 4px 0 12px; -webkit-overflow-scrolling: touch; }
.comment { display: flex; gap: 12px; align-items: flex-start; }
.comment .avatar-img { width: 32px; height: 32px; border: 0; }
.comment .body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.comment .head { display: flex; align-items: center; gap: 6px; font-size: 13px; }
.comment .head b { font-weight: 600; }
.comment .head .verified { width: 12px; height: 12px; margin: 0; }
.comment .head time { color: var(--muted); font-size: 12px; }
.comment .text { font-size: 14px; line-height: 1.35; word-break: break-word; }
.comment .sub2 { font-size: 12px; color: var(--muted); }
.comment .likes { display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: 11px; color: var(--muted); padding-top: 4px; }
.comment .likes svg { width: 14px; height: 14px; stroke-width: 1.8; }
.comment.jam .tag { padding: 1px 6px; border-radius: 4px; background: var(--pink-soft); color: #FFC2D1; font-size: 10px; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; }
.comment-empty { color: var(--muted); font-size: 14px; text-align: center; padding: 24px 0; }
.comment-bar { display: flex; align-items: center; gap: 10px; padding: 10px 0 max(14px, env(safe-area-inset-bottom) + 4px); border-top: 1px solid #2c2c2e; }
.comment-bar input { flex: 1; min-width: 0; height: 40px; padding: 0 14px; border-radius: 20px; border: 1px solid #3a3a3c; background: #2c2c2e; color: #fff; font-size: 14px; outline: none; }
.comment-bar input::placeholder { color: #8e8e93; }

/* more menu */
.menu { display: flex; flex-direction: column; }
.menu-row { display: flex; align-items: center; gap: 14px; width: 100%; height: 52px; font-size: 15px; font-weight: 500; color: #fff; text-decoration: none; text-align: left; }
.menu-row svg { width: 22px; height: 22px; color: #fff; }
.menu-row + .menu-row { border-top: 1px solid #2c2c2e; }

/* ---------- privacy page (static, no app) ---------- */
/* A plain scrolling document, not the app's fixed full-screen shell. */
html.doc, html.doc body { height: auto; min-height: 100%; overflow: visible; }
html.doc body { position: static; overscroll-behavior: auto; }
.doc-page { max-width: 560px; margin: 0 auto; padding: max(56px, env(safe-area-inset-top) + 28px) 24px max(40px, env(safe-area-inset-bottom) + 24px); display: flex; flex-direction: column; gap: 24px; }
.doc-page h1 { margin: 0; font-family: var(--display); font-weight: 800; font-size: 40px; line-height: 1; letter-spacing: -0.035em; }
.doc-page .lede { margin: 0; font-size: 16px; line-height: 1.5; color: var(--muted); }
.doc-page section { display: flex; flex-direction: column; gap: 6px; padding: 16px 18px; border-radius: 16px; border: 1px solid var(--line); background: var(--panel); }
.doc-page h2 { margin: 0; font-size: 16px; font-weight: 700; }
.doc-page p { margin: 0; font-size: 15px; line-height: 1.5; color: var(--muted); }
.doc-page .back { align-self: flex-start; color: #FF7A9A; font-weight: 700; font-size: 15px; text-decoration: none; }

/* Keep portrait video and its controls together on a laptop. */
@media (min-width: 700px) {
  html:not(.doc) body { max-width: 480px; margin-inline: auto; border-inline: 1px solid var(--line); }
  .stage video { object-fit: contain; }
}
#endJam { align-self: flex-end; min-height: 32px; }
