:root {
  --bg: #0e0d0c; --surface: #1a1917; --surface-2: #24221f; --ink: #f4f1ec; --muted: #9c968e; --line: #2e2c29;
  --accent: #ff5a3c; --accent-ink: #fff; --like: #ff3b5c; --radius: 18px; --top: 60px;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--ink); font: 15px/1.5 Inter, system-ui, -apple-system, sans-serif; }
.hidden { display: none !important; }
button { font: inherit; cursor: pointer; color: inherit; }
input, textarea { font: inherit; color: inherit; }
a { color: inherit; text-decoration: none; }

.logo { font-family: Fraunces, Georgia, serif; font-weight: 600; font-size: 26px; letter-spacing: -.5px; color: var(--accent); }
.logo.big { font-size: 52px; margin: 0; line-height: 1.1; }

.btn { border: 0; border-radius: 999px; padding: 9px 18px; font-weight: 600; display: inline-flex; align-items: center; justify-content: center; gap: 6px; }
.btn.primary { background: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { filter: brightness(1.08); }
.btn.primary:disabled { opacity: .45; cursor: default; filter: none; }
.btn.wide { width: 100%; padding: 12px; }
.icon-btn { border: 0; background: var(--surface-2); width: 34px; height: 34px; border-radius: 50%; font-size: 22px; line-height: 1; display: grid; place-items: center; }
.error { color: #ff7a63; min-height: 1.4em; margin: 12px 0 0; font-size: 14px; }

/* avatars */
.avatar { width: 44px; height: 44px; border-radius: 50%; display: inline-grid; place-items: center; color: #fff; font-weight: 700; flex-shrink: 0; border: 0; padding: 0; font-size: 15px; }
.avatar.sm { width: 34px; height: 34px; font-size: 13px; }
.avatar.xs { width: 28px; height: 28px; font-size: 11px; }

/* ---------- auth ---------- */
.auth { min-height: 100vh; display: grid; place-items: center; padding: 16px;
  background: radial-gradient(1200px 600px at 20% -10%, #3a1d14 0%, transparent 60%), radial-gradient(900px 500px at 110% 110%, #2a1530 0%, transparent 60%); }
.auth-card { width: 100%; max-width: 390px; background: var(--surface); border: 1px solid var(--line); padding: 40px 30px; border-radius: 26px; text-align: center; box-shadow: 0 30px 80px rgba(0,0,0,.45); }
.tagline { color: var(--muted); margin: 6px 0 26px; }
.tabs { display: flex; background: var(--bg); border-radius: 999px; padding: 4px; margin-bottom: 18px; }
.tab { flex: 1; padding: 8px; border-radius: 999px; font-weight: 600; color: var(--muted); }
.tab.active { background: var(--surface-2); color: var(--ink); }
.form { display: flex; flex-direction: column; gap: 10px; }
.form input { padding: 12px 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--bg); outline: none; }
.form input:focus { border-color: var(--accent); }
.form .btn { padding: 12px; margin-top: 6px; }

/* ---------- top bar ---------- */
.topbar { position: fixed; inset: 0 0 auto 0; height: var(--top); z-index: 20; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 0 16px;
  background: linear-gradient(to bottom, rgba(14,13,12,.95), rgba(14,13,12,.75)); backdrop-filter: blur(12px); border-bottom: 1px solid rgba(255,255,255,.05); }
.sort-tabs { display: flex; gap: 4px; background: var(--surface); padding: 4px; border-radius: 999px; }
.sort-tab { border: 0; background: transparent; padding: 6px 14px; border-radius: 999px; font-weight: 600; color: var(--muted); white-space: nowrap; }
.sort-tab.active { background: var(--ink); color: var(--bg); }
.top-actions { display: flex; align-items: center; gap: 10px; }
.menu { position: relative; }
.menu-pop { position: absolute; right: 0; top: 44px; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 6px; min-width: 190px; display: none; box-shadow: 0 20px 50px rgba(0,0,0,.5); }
.menu.open .menu-pop { display: block; }
.menu-who { padding: 8px 10px; display: flex; flex-direction: column; border-bottom: 1px solid var(--line); margin-bottom: 4px; }
.menu-who span { color: var(--muted); font-size: 13px; }
.menu-item { width: 100%; text-align: left; border: 0; background: none; padding: 9px 10px; border-radius: 9px; }
.menu-item:hover { background: var(--surface-2); }

/* ---------- feed ---------- */
.feed { height: 100vh; height: 100dvh; overflow-y: auto; scroll-snap-type: y mandatory; padding-top: var(--top); scroll-padding-top: var(--top); scrollbar-width: none; }
.feed::-webkit-scrollbar { display: none; }
.slide { height: calc(100dvh - var(--top)); scroll-snap-align: start; scroll-snap-stop: always; display: flex; justify-content: center; align-items: center; gap: 16px; padding: 14px 16px; }
.player { position: relative; height: 100%; aspect-ratio: 9 / 16; max-width: 100%; background: #000; border-radius: var(--radius); overflow: hidden; }
.player video { width: 100%; height: 100%; object-fit: cover; display: block; background: #000; }
.player.landscape video { object-fit: contain; }
.overlay { position: absolute; inset: auto 0 0 0; padding: 60px 16px 16px; background: linear-gradient(to top, rgba(0,0,0,.75), transparent); pointer-events: none; }
.overlay .who { display: flex; align-items: center; gap: 8px; font-weight: 600; }
.overlay .who small { color: rgba(255,255,255,.7); font-weight: 400; }
.overlay a { pointer-events: auto; }
.overlay a:hover { text-decoration: underline; }
.overlay .src { color: #fff; font-weight: 600; }
.menu-credit { padding: 8px 10px 4px; font-size: 12px; color: var(--muted); border-top: 1px solid var(--line); margin-top: 4px; }
.menu-credit a { color: var(--ink); text-decoration: underline; }
.overlay .cap { margin: 6px 0 0; white-space: pre-wrap; word-wrap: break-word; max-height: 5.4em; overflow: hidden; text-shadow: 0 1px 2px rgba(0,0,0,.5); }
.overlay .cap .tag { color: #ffd2c8; font-weight: 600; }
.rank { position: absolute; top: 12px; left: 12px; background: rgba(0,0,0,.55); backdrop-filter: blur(6px); padding: 4px 10px; border-radius: 999px; font-size: 13px; font-weight: 600; }
.sound { position: absolute; top: 12px; right: 12px; width: 36px; height: 36px; border-radius: 50%; border: 0; background: rgba(0,0,0,.55); backdrop-filter: blur(6px); display: grid; place-items: center; }
.paused-icon { position: absolute; inset: 0; display: grid; place-items: center; pointer-events: none; opacity: 0; transition: opacity .15s; }
.player.paused .paused-icon { opacity: 1; }
.burst { position: absolute; inset: 0; display: grid; place-items: center; pointer-events: none; opacity: 0; }
.burst.show { animation: burst .8s ease; }
@keyframes burst { 0%{opacity:0;transform:scale(.4)} 20%{opacity:1;transform:scale(1.15)} 60%{opacity:1;transform:scale(1)} 100%{opacity:0} }

.actions { display: flex; flex-direction: column; align-items: center; gap: 14px; align-self: flex-end; padding-bottom: 8px; }
.act { border: 0; background: none; display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: 13px; font-weight: 600; padding: 0; }
.act .ic { width: 48px; height: 48px; border-radius: 50%; background: var(--surface-2); display: grid; place-items: center; transition: transform .15s; }
.act:hover .ic { transform: scale(1.06); }
.act.liked .ic { color: var(--like); }
.act.liked svg { fill: var(--like); }
.act.liked svg.pop { animation: pop .3s ease; }
@keyframes pop { 50% { transform: scale(1.35); } }
.act.static { cursor: default; }
.act.static:hover .ic { transform: none; }

.feed-status { position: fixed; left: 50%; top: 50%; transform: translate(-50%, -50%); text-align: center; color: var(--muted); pointer-events: none; }
.feed-status.empty { pointer-events: auto; }
.feed-status b { display: block; color: var(--ink); font-size: 20px; margin-bottom: 6px; }
.feed-status .btn { margin-top: 16px; }
.spinner { width: 34px; height: 34px; border: 3px solid var(--surface-2); border-top-color: var(--accent); border-radius: 50%; animation: spin .8s linear infinite; margin: 0 auto; }
.end { height: 120px; display: grid; place-items: center; color: var(--muted); scroll-snap-align: end; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- upload modal ---------- */
.modal { position: fixed; inset: 0; z-index: 50; background: rgba(0,0,0,.7); display: grid; place-items: center; padding: 16px; backdrop-filter: blur(4px); }
.modal-card { width: 100%; max-width: 440px; background: var(--surface); border: 1px solid var(--line); border-radius: 22px; padding: 20px; max-height: 100%; overflow: auto; }
.modal-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; }
.modal-head h2 { margin: 0; font-size: 18px; }
.drop { display: grid; place-items: center; height: 300px; border: 2px dashed var(--line); border-radius: 16px; cursor: pointer; overflow: hidden; background: var(--bg); transition: border-color .15s; }
.drop:hover, .drop.drag { border-color: var(--accent); }
.drop-empty { display: flex; flex-direction: column; align-items: center; gap: 4px; color: var(--muted); text-align: center; padding: 16px; }
.drop-empty b { color: var(--ink); margin-top: 6px; }
.drop-empty span { font-size: 13px; }
.drop-preview { width: 100%; height: 100%; object-fit: contain; background: #000; }
#upload-form textarea { width: 100%; margin-top: 12px; border: 1px solid var(--line); background: var(--bg); border-radius: 12px; padding: 12px; resize: vertical; outline: none; }
#upload-form textarea:focus { border-color: var(--accent); }
.progress { position: relative; height: 26px; background: var(--bg); border-radius: 999px; overflow: hidden; margin-top: 12px; }
.progress .bar { position: absolute; inset: 0 auto 0 0; width: 0; background: var(--accent); transition: width .2s; }
.progress .pct { position: relative; display: block; text-align: center; font-size: 13px; font-weight: 600; line-height: 26px; }
#upload-form .btn { margin-top: 8px; }

/* ---------- comments drawer ---------- */
.scrim { position: fixed; inset: 0; z-index: 39; background: rgba(0,0,0,.45); }
.drawer { position: fixed; z-index: 40; right: 0; top: 0; bottom: 0; width: 380px; max-width: 100%; background: var(--surface); border-left: 1px solid var(--line); display: flex; flex-direction: column; animation: slideIn .2s ease; }
@keyframes slideIn { from { transform: translateX(30px); opacity: 0; } }
.drawer-head { display: flex; justify-content: space-between; align-items: center; padding: 16px; border-bottom: 1px solid var(--line); }
.drawer-head h2 { margin: 0; font-size: 17px; }
.c-count { color: var(--muted); font-weight: 500; }
.c-list { flex: 1; overflow-y: auto; padding: 14px 16px; }
.c-item { display: flex; gap: 10px; margin-bottom: 14px; font-size: 14px; }
.c-item .meta { color: var(--muted); font-size: 12px; }
.c-item p { margin: 2px 0 0; white-space: pre-wrap; word-wrap: break-word; }
.c-empty { color: var(--muted); text-align: center; margin-top: 40px; }
.c-form { display: flex; gap: 8px; align-items: center; padding: 12px 16px calc(12px + env(safe-area-inset-bottom)); border-top: 1px solid var(--line); }
.c-form input { flex: 1; min-width: 0; border: 1px solid var(--line); background: var(--bg); border-radius: 999px; padding: 9px 14px; outline: none; }
.c-form input:focus { border-color: var(--accent); }
.c-form button { border: 0; background: none; color: var(--accent); font-weight: 700; }

.toast { position: fixed; left: 50%; bottom: 28px; z-index: 60; transform: translate(-50%, 20px); background: var(--ink); color: var(--bg); padding: 10px 18px; border-radius: 999px; font-weight: 600;
  opacity: 0; visibility: hidden; transition: all .25s; max-width: calc(100% - 32px); text-align: center; }
.toast.show { opacity: 1; visibility: visible; transform: translate(-50%, 0); }

/* ---------- phones: full-screen videos with overlaid actions ---------- */
@media (max-width: 640px) {
  :root { --top: 54px; }
  .topbar { padding: 0 10px; }
  .logo { font-size: 22px; }
  .sort-tab { padding: 5px 10px; font-size: 14px; }
  .upload-open span { display: none; }
  .upload-open { padding: 9px; }
  .slide { padding: 0; }
  .player { aspect-ratio: auto; width: 100%; border-radius: 0; }
  .actions { position: absolute; right: 8px; bottom: 90px; z-index: 2; }
  .slide { position: relative; }
  .act .ic { background: rgba(0,0,0,.4); backdrop-filter: blur(6px); }
  .act { text-shadow: 0 1px 2px rgba(0,0,0,.6); }
  .overlay { padding-right: 76px; }
  .drawer { top: auto; height: 72dvh; width: 100%; border-left: 0; border-top: 1px solid var(--line); border-radius: 20px 20px 0 0; animation: slideUp .22s ease; }
  @keyframes slideUp { from { transform: translateY(40px); opacity: 0; } }
}
@media (max-width: 380px) { .logo { display: none; } }

/* password show/hide */
.pw-field { position: relative; display: flex; }
.pw-field input { flex: 1; padding-right: 46px !important; }
.pw-toggle { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); width: 36px; height: 36px; border: 0; border-radius: 10px;
  background: transparent; color: var(--muted); display: grid; place-items: center; }
.pw-toggle:hover, .pw-toggle[aria-pressed="true"] { color: var(--ink); background: var(--surface-2); }
.pw-toggle:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }

/* ---------- content pages (connections, privacy) ---------- */
.page-body { overflow-y: auto; }
.page { max-width: 760px; margin: 0 auto; padding: calc(var(--top) + 28px) 16px 60px; }
.page h1 { font-size: 30px; margin: 0 0 8px; letter-spacing: -.3px; }
.page h2 { font-size: 18px; margin: 28px 0 8px; }
.page .lead { color: var(--muted); margin: 0 0 22px; font-size: 16px; }
.page a:not(.btn) { color: #ffb4a3; text-decoration: underline; }
.page ul, .page ol { padding-left: 20px; color: #d9d4cd; } .page li { margin: 6px 0; }
.page code, .page pre { background: var(--surface-2); border-radius: 6px; font-size: 13px; }
.page code { padding: 1px 5px; }
.page pre { padding: 12px; overflow-x: auto; white-space: pre; border: 1px solid var(--line); }
.btn.ghost-dark { background: var(--surface); color: var(--ink); border: 1px solid var(--line); }
.btn.small { padding: 7px 14px; font-size: 14px; background: var(--surface-2); color: var(--ink); }
.btn.small:hover { background: var(--line); }
.btn.danger { color: #ff8f7a; }
.flash { padding: 12px 14px; border-radius: 12px; margin: 0 0 18px; border: 1px solid; }
.flash.ok { background: #13291b; border-color: #23533a; color: #a6e9c0; }
.flash.err { background: #2e1512; border-color: #5f2a22; color: #ffb4a3; }
.conn-list { display: flex; flex-direction: column; gap: 10px; margin-bottom: 26px; }
.conn { display: flex; align-items: center; gap: 14px; background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 14px; flex-wrap: wrap; }
.conn-avatar { width: 48px; height: 48px; border-radius: 50%; object-fit: cover; flex-shrink: 0; background: var(--surface-2); }
.conn-avatar.ph.instagram { background: linear-gradient(45deg, #f9ce34, #ee2a7b, #6228d7); }
.conn-avatar.ph.facebook { background: #1877f2; }
.conn-info { flex: 1; min-width: 180px; }
.conn-meta { color: var(--muted); font-size: 13px; margin-top: 2px; }
.conn-err { color: #ffb4a3; font-size: 13px; margin-top: 4px; }
.conn-actions { display: flex; gap: 8px; }
.chip { display: inline-block; font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 999px; margin-left: 6px; vertical-align: 2px; }
.chip.instagram { background: #3b1830; color: #ff9bd0; } .chip.facebook { background: #13284a; color: #8fb8ff; }
.providers { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 14px; }
.provider { background: var(--surface); border: 1px solid var(--line); border-radius: 18px; padding: 18px; display: flex; flex-direction: column; gap: 12px; }
.provider-head { display: flex; gap: 12px; align-items: center; }
.provider-head h2 { margin: 0; font-size: 17px; } .provider-head p { margin: 0; color: var(--muted); font-size: 14px; }
.pico { width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; flex-shrink: 0; }
.pico.instagram { background: linear-gradient(45deg, #f9ce34, #ee2a7b, #6228d7); } .pico.facebook { background: #1877f2; }
.req { margin: 0; font-size: 14px; color: #d9d4cd; }
.provider details summary, .owner-setup summary { cursor: pointer; color: var(--muted); font-size: 14px; font-weight: 600; }
.token-form { display: flex; gap: 8px; margin-top: 10px; }
.token-form input { flex: 1; min-width: 0; border: 1px solid var(--line); background: var(--bg); border-radius: 10px; padding: 9px 12px; outline: none; font-size: 14px; }
.token-form input:focus { border-color: var(--accent); }
.hint { font-size: 12.5px; color: var(--muted); margin: 8px 0 0; }
.owner-setup { margin-top: 22px; background: var(--surface); border: 1px dashed var(--line); border-radius: 14px; padding: 14px; }
.owner-setup p { font-size: 14px; color: #d9d4cd; }
.fine { color: var(--muted); font-size: 13px; margin-top: 26px; }
.menu-item.link { display: block; }

/* ---------- upload modal tabs + paste-a-link ---------- */
.up-tabs { display: flex; background: var(--bg); border-radius: 999px; padding: 4px; margin-bottom: 14px; }
.up-tab { flex: 1; border: 0; background: transparent; padding: 8px; border-radius: 999px; font-weight: 600; color: var(--muted); font-size: 14px; }
.up-tab.active { background: var(--surface-2); color: var(--ink); }
.link-intro { display: flex; gap: 6px; align-items: flex-start; background: var(--bg); border: 1px solid var(--line); border-radius: 14px; padding: 12px; }
.link-intro p { margin: 0 0 0 4px; font-size: 13.5px; color: #d9d4cd; }
.pico.sm { width: 28px; height: 28px; border-radius: 8px; }
#link-form input[name=link] { width: 100%; margin-top: 12px; border: 1px solid var(--line); background: var(--bg); border-radius: 12px; padding: 12px; outline: none; }
#link-form input[name=link]:focus { border-color: var(--accent); }
#link-form textarea { width: 100%; margin-top: 10px; border: 1px solid var(--line); background: var(--bg); border-radius: 12px; padding: 12px; resize: vertical; outline: none; }
#link-form .btn { margin-top: 8px; }

/* ---------- embedded Instagram / Facebook player ---------- */
.player.embed { display: flex; flex-direction: column; background: var(--surface); }
.player.embed .frame-wrap { flex: 1; min-height: 0; background: var(--bg); position: relative; }
.player.embed iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.overlay.static { position: static; background: var(--surface); padding: 10px 14px 12px; pointer-events: auto; }
.overlay.static .cap { max-height: 3.1em; text-shadow: none; }
@media (max-width: 640px) { .overlay.static { padding-right: 76px; } }

.personal-tip { background: linear-gradient(135deg, #2a1712, #1f1526); border: 1px solid #4a2a22; border-radius: 16px; padding: 16px; margin: 0 0 26px; font-size: 15px; line-height: 1.55; }
.personal-tip .small-cta { display: inline-flex; margin-top: 12px; }
.page h2.sub { font-size: 18px; margin: 0 0 4px; }
.page .muted { color: var(--muted); font-weight: 500; font-size: 14px; }
.page .lead.small { font-size: 14px; margin-bottom: 14px; }

/* ---------- Facebook tab (official Page widget) ---------- */
.sort-tab.fb-tab { display: inline-flex; align-items: center; gap: 5px; }
.sort-tab.fb-tab.active { background: #1877f2; color: #fff; }
.feed.fb-mode { scroll-snap-type: none; }
.fb-wrap { width: 100%; max-width: 500px; margin: 0 auto; padding: 16px 16px 24px; display: flex; flex-direction: column; align-items: center; }
.fb-page { border: 0; border-radius: 14px; background: #fff; max-width: 100%; overflow: hidden; }
.fb-note { color: var(--muted); font-size: 13px; margin: 10px 0 0; text-align: center; }
.fb-note a { color: var(--ink); text-decoration: underline; }
@media (max-width: 640px) {
  .sort-tab.fb-tab span { display: none; }
  .fb-wrap { padding: 10px 8px 16px; }
}

/* YouTube embeds: show the thumbnail while the player loads */
.player.embed .frame-wrap { background-size: cover; background-position: center; }
.player.embed.yt .frame-wrap { background-color: #000; }

/* "Tap for sound" pill */
.sound-hint { position: fixed; left: 50%; bottom: 22px; transform: translateX(-50%); z-index: 30; border: 0; border-radius: 999px;
  padding: 10px 18px; font-weight: 700; background: rgba(255,255,255,.92); color: #111; box-shadow: 0 8px 24px rgba(0,0,0,.4);
  animation: hintIn .3s ease; }
.sound-hint:hover { background: #fff; }
@keyframes hintIn { from { opacity: 0; transform: translate(-50%, 10px); } }
@media (max-width: 640px) { .sound-hint { bottom: calc(18px + env(safe-area-inset-bottom)); } }
