/* MS Flix — base visual compartilhada
   Conceito: sala de cinema à noite — tinta azul-escura, vidro fosco, luz âmbar de letreiro.
   Tema escuro único, escolhido de propósito. */
:root {
  --ink: #07080d;
  --panel: #0f121b;
  --raise: #161a26;
  --raise-2: #1d2231;
  --line: rgba(196, 206, 255, 0.09);
  --line-2: rgba(196, 206, 255, 0.16);
  --text: #eef0f7;
  --muted: #8d93a8;
  --faint: #5c6276;
  --amber: #f7b545;
  --coral: #ff6b4f;
  --brand: linear-gradient(120deg, #ffcf6a 0%, #f7b545 35%, #ff6b4f 100%);
  --ok: #3ddc97;
  --warn: #f7b545;
  --bad: #ff5d6c;
  --info: #7aa7ff;
  --on-brand: #1a0e05;
  --bubble-me: #2a2113;
  --bubble-them: #1a1f2d;
  --display: "Bricolage Grotesque", "Avenir Next", "Segoe UI", system-ui, sans-serif;
  --body: "Figtree", "Segoe UI", system-ui, -apple-system, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --r-sm: 10px; --r: 14px; --r-lg: 22px;
  --shadow: 0 24px 60px -20px rgba(0, 0, 0, 0.7);
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body { margin: 0; background: var(--ink); color: var(--text); font: 15px/1.5 var(--body); -webkit-font-smoothing: antialiased; }
h1, h2, h3, h4 { font-family: var(--display); margin: 0; letter-spacing: -0.02em; text-wrap: balance; }
p { margin: 0; }
a { color: var(--amber); }
button, input, select, textarea { font: inherit; color: inherit; }
img { max-width: 100%; }
[hidden] { display: none !important; }
::selection { background: rgba(247, 181, 69, 0.35); }
:focus-visible { outline: 2px solid var(--amber); outline-offset: 2px; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--raise-2); border-radius: 10px; border: 2px solid var(--ink); }
::-webkit-scrollbar-track { background: transparent; }

/* Fundo ambiente */
.ambient { position: fixed; inset: 0; pointer-events: none; z-index: 0; overflow: hidden; }
.ambient::before, .ambient::after { content: ""; position: absolute; border-radius: 50%; filter: blur(90px); opacity: .35; }
.ambient::before { width: 46vw; height: 46vw; left: -12vw; top: -18vw; background: radial-gradient(circle, rgba(247,181,69,.55), transparent 65%); animation: drift 26s ease-in-out infinite alternate; }
.ambient::after { width: 40vw; height: 40vw; right: -14vw; bottom: -16vw; background: radial-gradient(circle, rgba(255,107,79,.4), transparent 65%); animation: drift 32s ease-in-out infinite alternate-reverse; }
@keyframes drift { to { transform: translate(6vw, 4vw) scale(1.1); } }

/* Logo */
.logo { display: inline-flex; align-items: baseline; gap: 2px; font-family: var(--display); font-weight: 800; font-size: 24px; letter-spacing: -0.04em; line-height: 1; }
.logo b { background: var(--brand); -webkit-background-clip: text; background-clip: text; color: transparent; }
.logo span { color: var(--text); }
.logo small { font-family: var(--body); font-size: 10px; font-weight: 700; letter-spacing: .16em; text-transform: uppercase; color: var(--muted); margin-left: 8px; align-self: center; }

/* Botões */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 42px; padding: 0 18px; border-radius: 999px; border: 1px solid var(--line-2); background: var(--raise); color: var(--text); font-weight: 600; font-size: 14px; cursor: pointer; transition: transform .15s, background .2s, border-color .2s, box-shadow .2s; white-space: nowrap; text-decoration: none; }
.btn:hover { background: var(--raise-2); border-color: rgba(247,181,69,.35); }
.btn:active { transform: scale(.97); }
.btn svg { width: 18px; height: 18px; flex: none; }
.btn.primary { background: var(--brand); color: var(--on-brand); border-color: transparent; box-shadow: 0 10px 30px -10px rgba(255,140,60,.6); }
.btn.primary:hover { filter: brightness(1.06); box-shadow: 0 14px 34px -10px rgba(255,140,60,.75); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn.ghost:hover { color: var(--text); background: var(--raise); }
.btn.danger { color: var(--bad); }
.btn.danger:hover { background: rgba(255,93,108,.12); border-color: rgba(255,93,108,.4); }
.btn.sm { height: 34px; padding: 0 12px; font-size: 13px; }
.btn.icon { width: 42px; padding: 0; }
.btn.sm.icon { width: 34px; }
.btn[disabled] { opacity: .5; pointer-events: none; }

/* Formulários */
.field { display: grid; gap: 6px; min-width: 0; }
.field > label, .label { font-size: 11.5px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.input, .select, .textarea { width: 100%; height: 44px; padding: 0 14px; background: rgba(255,255,255,.035); border: 1px solid var(--line-2); border-radius: var(--r-sm); color: var(--text); transition: border-color .2s, background .2s, box-shadow .2s; }
.textarea { height: auto; min-height: 110px; padding: 12px 14px; resize: vertical; line-height: 1.5; }
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--amber); background: rgba(247,181,69,.05); box-shadow: 0 0 0 4px rgba(247,181,69,.12); }
.input::placeholder, .textarea::placeholder { color: var(--faint); }
.select { appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%); background-position: calc(100% - 18px) 19px, calc(100% - 13px) 19px; background-size: 5px 5px; background-repeat: no-repeat; padding-right: 34px; }
.select option { background: var(--panel); }
.mono { font-family: var(--mono); font-size: 13px; }
.seg { display: inline-flex; padding: 4px; background: rgba(255,255,255,.04); border: 1px solid var(--line); border-radius: 999px; gap: 2px; }
.seg button { border: 0; background: transparent; color: var(--muted); height: 34px; padding: 0 16px; border-radius: 999px; font-weight: 600; font-size: 13px; cursor: pointer; transition: .2s; }
.seg button.on { background: var(--raise-2); color: var(--text); box-shadow: inset 0 0 0 1px var(--line-2); }

/* Pílulas de status */
.pill { display: inline-flex; align-items: center; gap: 6px; height: 24px; padding: 0 10px; border-radius: 999px; font-size: 12px; font-weight: 700; background: rgba(255,255,255,.06); color: var(--muted); white-space: nowrap; }
.pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.pill.ok { color: var(--ok); background: rgba(61,220,151,.1); }
.pill.warn { color: var(--warn); background: rgba(247,181,69,.12); }
.pill.bad { color: var(--bad); background: rgba(255,93,108,.12); }
.pill.plain::before { display: none; }

.badge { min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px; background: var(--coral); color: #fff; font-size: 11px; font-weight: 800; display: inline-grid; place-items: center; }

/* Modal */
.modal-wrap { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; padding: max(16px, env(safe-area-inset-top, 0px)) max(16px, env(safe-area-inset-right, 0px)) max(16px, env(safe-area-inset-bottom, 0px)) max(16px, env(safe-area-inset-left, 0px)); background: rgba(3,4,8,.72); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); animation: fade .2s ease; }
.modal { position: relative; width: min(640px, 100%); max-height: 100%; overflow: auto; background: var(--panel); border: 1px solid var(--line-2); border-radius: var(--r-lg); box-shadow: var(--shadow); animation: rise .28s cubic-bezier(.2,.9,.3,1.2); }
.modal.wide { width: min(980px, 100%); }
.modal.media { width: min(1100px, 100%); background: #000; }
.modal-head { position: sticky; top: 0; z-index: 2; display: flex; align-items: center; gap: 12px; padding: 18px 20px; background: rgba(15,18,27,.92); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); }
.modal-head h3 { font-size: 19px; flex: 1; min-width: 0; }
.modal-body { padding: 20px; display: grid; gap: 18px; }
.modal-foot { position: sticky; bottom: 0; display: flex; justify-content: flex-end; gap: 10px; flex-wrap: wrap; padding: 14px 20px; background: rgba(15,18,27,.95); border-top: 1px solid var(--line); }
.x-btn { position: absolute; top: 12px; right: 12px; z-index: 5; width: 38px; height: 38px; border-radius: 50%; border: 0; background: rgba(0,0,0,.55); color: #fff; cursor: pointer; display: grid; place-items: center; backdrop-filter: blur(6px); }
.x-btn:hover { background: rgba(0,0,0,.8); }
.x-btn svg { width: 18px; height: 18px; }
@keyframes fade { from { opacity: 0; } }
@keyframes rise { from { opacity: 0; transform: translateY(18px) scale(.98); } }

/* Toast */
.toasts { position: fixed; z-index: 200; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%); display: grid; gap: 8px; width: min(420px, calc(100% - 32px)); pointer-events: none; }
.toast { padding: 12px 16px; border-radius: var(--r); background: var(--raise-2); border: 1px solid var(--line-2); box-shadow: var(--shadow); font-weight: 500; animation: rise .25s ease; display: flex; gap: 10px; align-items: center; }
.toast.bad { border-color: rgba(255,93,108,.5); }
.toast.ok { border-color: rgba(61,220,151,.45); }
.toast svg { width: 18px; height: 18px; flex: none; }

/* Pôsteres */
.poster { position: relative; aspect-ratio: 2/3; max-width: 100%; border-radius: var(--r); overflow: hidden; background: var(--raise); cursor: pointer; isolation: isolate; transition: transform .35s cubic-bezier(.2,.8,.2,1), box-shadow .35s; border: 0; padding: 0; text-align: left; color: var(--text); display: block; width: 100%; }
.poster img { position: absolute; inset: 0; z-index: 1; width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .6s cubic-bezier(.2,.8,.2,1); }
.poster::after { content: ""; position: absolute; inset: 0; z-index: 1; background: linear-gradient(to top, rgba(0,0,0,.85) 0%, rgba(0,0,0,0) 45%); opacity: .9; transition: opacity .3s; }
.poster .p-title { position: absolute; z-index: 3 !important; left: 10px; right: 10px; bottom: 10px; z-index: 2; font-weight: 700; font-size: 13.5px; line-height: 1.25; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; text-shadow: 0 1px 6px rgba(0,0,0,.6); }
.poster .p-tag { position: absolute; top: 8px; left: 8px; z-index: 3; font-size: 10.5px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; padding: 3px 8px; border-radius: 6px; background: rgba(0,0,0,.6); backdrop-filter: blur(4px); color: var(--amber); }
.poster:hover { transform: translateY(-6px) scale(1.03); box-shadow: 0 22px 40px -16px rgba(0,0,0,.9), 0 0 0 1px rgba(247,181,69,.4); }
.poster:hover img { transform: scale(1.06); }
.poster .ph { position: absolute; inset: 0; display: grid; place-items: center; font-family: var(--display); font-size: 38px; font-weight: 800; letter-spacing: -0.04em; color: rgba(255,255,255,.85); }

/* Utilidades */
.muted { color: var(--muted); }
.row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.grow { flex: 1; min-width: 0; }
.empty { display: grid; justify-items: center; text-align: center; gap: 10px; padding: 56px 20px; color: var(--muted); border: 1px dashed var(--line-2); border-radius: var(--r-lg); }
.empty svg { width: 40px; height: 40px; color: var(--faint); }
.empty h4 { color: var(--text); font-size: 18px; }
.spinner { width: 28px; height: 28px; border-radius: 50%; border: 3px solid var(--line-2); border-top-color: var(--amber); animation: spin .8s linear infinite; }
.loading { display: grid; place-items: center; padding: 60px; }
@keyframes spin { to { transform: rotate(360deg); } }
.skeleton { background: linear-gradient(90deg, var(--raise) 0%, var(--raise-2) 50%, var(--raise) 100%); background-size: 200% 100%; animation: shimmer 1.4s infinite; }
@keyframes shimmer { to { background-position: -200% 0; } }

/* Login */
.auth { position: relative; z-index: 1; min-height: 100%; display: grid; place-items: center; padding-block: 32px; padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); }
.auth-card { width: min(420px, 100%); padding: 34px 30px; border-radius: 28px; background: rgba(15,18,27,.72); border: 1px solid var(--line-2); backdrop-filter: blur(22px); -webkit-backdrop-filter: blur(22px); box-shadow: var(--shadow); display: grid; gap: 20px; animation: rise .5s cubic-bezier(.2,.9,.3,1.1); }
.auth-card h1 { font-size: 30px; line-height: 1.1; }
.auth-err { color: var(--bad); font-size: 13.5px; min-height: 1em; }

/* Chat (estilo WhatsApp) */
.chat { display: grid; grid-template-rows: auto 1fr auto; height: 100%; min-height: 0; background: var(--panel); border: 1px solid var(--line); border-radius: var(--r-lg); overflow: hidden; }
.chat-head { display: flex; align-items: center; gap: 12px; padding: 12px 16px; background: var(--raise); border-bottom: 1px solid var(--line); }
.avatar { width: 42px; height: 42px; border-radius: 50%; display: grid; place-items: center; font-weight: 800; font-family: var(--display); background: var(--brand); color: var(--on-brand); flex: none; font-size: 15px; }
.avatar.alt { background: linear-gradient(135deg, #3a4260, #252a3d); color: var(--text); }
.chat-head .who { min-width: 0; flex: 1; }
.chat-head .who b { display: block; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-head .who small { color: var(--ok); font-size: 12px; }
.chat-scroll { overflow-y: auto; padding: 18px clamp(10px, 3vw, 28px); display: flex; flex-direction: column; gap: 4px; min-height: 0;
  background-color: #0b0e15;
  background-image: radial-gradient(rgba(247,181,69,.05) 1px, transparent 1.4px), radial-gradient(rgba(122,167,255,.04) 1px, transparent 1.4px);
  background-size: 22px 22px, 34px 34px; background-position: 0 0, 11px 17px; }
.day-sep { align-self: center; margin: 12px 0 6px; padding: 4px 12px; border-radius: 8px; background: rgba(255,255,255,.06); color: var(--muted); font-size: 11.5px; font-weight: 700; letter-spacing: .04em; }
.bubble { position: relative; max-width: min(78%, 520px); padding: 7px 10px 6px; border-radius: 12px; background: var(--bubble-them); align-self: flex-start; box-shadow: 0 1px 1px rgba(0,0,0,.3); animation: pop .22s ease; word-wrap: break-word; overflow-wrap: anywhere; }
.bubble.me { align-self: flex-end; background: var(--bubble-me); border: 1px solid rgba(247,181,69,.14); }
.bubble.first.me { border-top-right-radius: 4px; }
.bubble.first:not(.me) { border-top-left-radius: 4px; }
.bubble.first { margin-top: 8px; }
.bubble .t { white-space: pre-wrap; font-size: 14.5px; }
.bubble .meta { float: right; margin: 6px 0 -2px 10px; font-size: 10.5px; color: var(--muted); display: inline-flex; align-items: center; gap: 3px; }
.bubble .meta svg { width: 15px; height: 15px; color: var(--info); }
.bubble img, .bubble video { display: block; max-width: 100%; max-height: 320px; border-radius: 8px; margin-bottom: 4px; cursor: zoom-in; background: #000; }
.bubble video { cursor: auto; }
.bubble .emoji-only { font-size: 38px; line-height: 1.15; }
@keyframes pop { from { opacity: 0; transform: translateY(6px) scale(.98); } }
.chat-input { display: flex; align-items: flex-end; gap: 8px; padding: 10px 12px; background: var(--raise); border-top: 1px solid var(--line); position: relative; }
.chat-input .box { flex: 1; min-width: 0; display: flex; align-items: flex-end; gap: 4px; background: rgba(255,255,255,.05); border: 1px solid var(--line); border-radius: 22px; padding: 4px 6px; }
.chat-input textarea { flex: 1; min-width: 0; border: 0; background: transparent; resize: none; max-height: 120px; height: 36px; padding: 8px 6px; line-height: 1.35; outline: none; }
.chat-input .ib { width: 36px; height: 36px; border-radius: 50%; border: 0; background: transparent; color: var(--muted); cursor: pointer; display: grid; place-items: center; flex: none; }
.chat-input .ib:hover { color: var(--amber); background: rgba(255,255,255,.05); }
.chat-input .ib svg { width: 22px; height: 22px; }
.chat-input .send { width: 46px; height: 46px; border-radius: 50%; border: 0; background: var(--brand); color: var(--on-brand); display: grid; place-items: center; cursor: pointer; flex: none; transition: transform .15s; }
.chat-input .send:active { transform: scale(.92); }
.chat-input .send svg { width: 20px; height: 20px; }
.emoji-pop { position: absolute; left: 10px; bottom: calc(100% + 8px); width: min(360px, calc(100% - 20px)); background: var(--raise-2); border: 1px solid var(--line-2); border-radius: var(--r); box-shadow: var(--shadow); z-index: 10; animation: rise .2s ease; overflow: hidden; }
.emoji-tabs { display: flex; gap: 2px; padding: 6px; border-bottom: 1px solid var(--line); overflow-x: auto; }
.emoji-tabs button { border: 0; background: transparent; font-size: 18px; padding: 4px 8px; border-radius: 8px; cursor: pointer; opacity: .6; }
.emoji-tabs button.on { background: rgba(255,255,255,.08); opacity: 1; }
.emoji-grid { display: grid; grid-template-columns: repeat(8, 1fr); padding: 8px; max-height: 220px; overflow-y: auto; }
.emoji-grid button { border: 0; background: transparent; font-size: 23px; padding: 4px 0; border-radius: 8px; cursor: pointer; transition: transform .1s; }
.emoji-grid button:hover { background: rgba(255,255,255,.08); transform: scale(1.15); }
.upl-bar { position: absolute; left: 0; right: 0; top: -3px; height: 3px; background: var(--brand); transform-origin: left; transition: transform .2s; }
.lightbox { position: fixed; inset: 0; z-index: 150; background: rgba(0,0,0,.92); display: grid; place-items: center; padding: 24px; animation: fade .2s; cursor: zoom-out; }
.lightbox img { max-height: 90vh; border-radius: 10px; box-shadow: var(--shadow); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; }
}
