/* =========================================================
   FilmiChat - main stylesheet
   Themes: [data-theme="dark"] (default) and [data-theme="light"]
   Accent colour comes from admin settings as --accent.
   ========================================================= */

:root {
  --accent: #F5B83D;
  --accent-ink: #0D1015;
  --radius: 14px;
  --radius-lg: 20px;
  --font: 'Plus Jakarta Sans', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --header-h: 64px;
}

[data-theme="dark"] {
  --bg: #0D1015;
  --bg-2: #11151C;
  --surface: #141820;
  --surface-2: #1A1F28;
  --surface-3: #1F2530;
  --line: #222833;
  --line-2: #2A313D;
  --text: #E8EAF0;
  --text-2: #C9CED8;
  --muted: #9AA3B2;
  --user-bubble: #2B3445;
  --user-bubble-text: #E8EAF0;
  --bot-bubble: #171C25;
  --link: var(--accent);
  --danger: #FF8A8E;
  --success-bg: #12291E;
  --success-text: #7FDCA4;
  --error-bg: #2C1517;
  --error-text: #FFA3A6;
  --info-bg: #182233;
  --info-text: #9CC1FF;
  --online: #6FD39B;
  color-scheme: dark;
}

[data-theme="light"] {
  --bg: #F4F2EE;
  --bg-2: #ECE9E3;
  --surface: #FFFFFF;
  --surface-2: #F7F5F1;
  --surface-3: #EFECE6;
  --line: #E4E1DA;
  --line-2: #D8D4CB;
  --text: #1A1D23;
  --text-2: #3C424D;
  --muted: #5E6470;
  --user-bubble: #1A1D23;
  --user-bubble-text: #FFFFFF;
  --bot-bubble: #FFFFFF;
  --link: #8A5300;
  --danger: #B42318;
  --success-bg: #E9F6EE;
  --success-text: #165C38;
  --error-bg: #FDECEC;
  --error-text: #9B1C1C;
  --info-bg: #EAF1FC;
  --info-text: #1D4E9E;
  --online: #1E7A4A;
  color-scheme: light;
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; overflow-x: hidden; }
button, a, input, select, textarea, label { touch-action: manipulation; -webkit-tap-highlight-color: transparent; }

body {
  margin: 0; max-width: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.55;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

a { color: var(--link); }
a:hover { opacity: .88; }
img { max-width: 100%; height: auto; }
h1, h2, h3 { line-height: 1.2; margin: 0 0 .5em; }
p { margin: 0 0 1em; }

.main { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.container { width: 100%; max-width: 1200px; margin: 0 auto; padding: 0 20px; }
.container.narrow, .narrow { max-width: 860px; }
.muted { color: var(--muted); }
.tiny { font-size: 13px; }
.center { text-align: center; }
.accent-text { color: var(--accent); }
[data-theme="light"] .accent-text { color: #8A5300; }
.sr-only, .hp {
  position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.skip-link { position: absolute; left: -9999px; top: 8px; z-index: 100; background: var(--accent); color: var(--accent-ink); padding: 8px 14px; border-radius: 8px; }
.skip-link:focus { left: 8px; }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 0 18px; border-radius: 12px; border: 1px solid transparent;
  font: inherit; font-size: 15px; font-weight: 700; text-decoration: none; cursor: pointer;
  transition: transform .08s ease, opacity .15s ease, background .15s ease;
  white-space: nowrap;
}
.btn:active { transform: translateY(1px); }
.btn:hover { opacity: 1; }
.btn-primary { background: var(--accent); color: var(--accent-ink); }
.btn-primary:hover { filter: brightness(1.06); }
.btn-ghost { background: transparent; color: var(--text); border-color: var(--line-2); }
.btn-ghost:hover { background: var(--surface-2); }
.btn-dark { background: #0D1015; color: #FFFFFF; }
.btn-danger-ghost { background: transparent; color: var(--danger); border-color: var(--line-2); }
.btn-sm { min-height: 40px; padding: 0 14px; font-size: 14px; }
.btn-lg { min-height: 54px; padding: 0 26px; font-size: 16px; border-radius: 14px; }
.btn-block { width: 100%; }

.icon-btn {
  width: 44px; height: 44px; flex: none; display: inline-flex; align-items: center; justify-content: center;
  border-radius: 12px; border: 1px solid var(--line-2); background: transparent; color: var(--text-2); cursor: pointer;
}
.icon-btn:hover { background: var(--surface-2); }
[data-theme="dark"] .ico-sun, [data-theme="light"] .ico-moon { display: none; }

/* ---------- Header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 30;
  background: var(--surface-2);
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.header-inner {
  max-width: 1200px; margin: 0 auto; padding: 10px 16px; min-height: var(--header-h);
  display: flex; align-items: center; gap: 12px;
}
.brand { display: flex; align-items: center; gap: 10px; color: var(--text); text-decoration: none; font-weight: 800; font-size: 18px; }
.brand img { border-radius: 8px; }
.brand-mark {
  width: 36px; height: 36px; flex: none; border-radius: 10px; background: var(--accent); color: var(--accent-ink);
  display: inline-flex; align-items: center; justify-content: center; font-weight: 800; font-size: 14px;
}
.brand-mark.sm { width: 32px; height: 32px; border-radius: 50%; font-size: 12px; }
.header-nav { display: none; gap: 4px; margin-left: 12px; flex: 1; }
.header-nav a { padding: 9px 14px; border-radius: 10px; color: var(--text-2); text-decoration: none; font-size: 14px; font-weight: 600; }
.header-nav a:hover { background: var(--surface-2); color: var(--text); }
.header-nav a.is-active { background: var(--surface-3); color: var(--accent); }
.header-actions { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.avatar {
  width: 40px; height: 40px; border-radius: 50%; background: var(--surface-3); color: var(--accent);
  display: inline-flex; align-items: center; justify-content: center; font-weight: 800;
}
.avatar-lg { width: 48px; height: 48px; font-size: 18px; flex: none; }
.avatar-xl { width: 72px; height: 72px; font-size: 28px; flex: none; }
.avatar-link { text-decoration: none; }

@media (min-width: 900px) {
  .header-nav { display: flex; }
}
@media (max-width: 420px) {
  .hide-xs { display: none; }
  .brand-name { font-size: 16px; }
}

/* ---------- Drawer ---------- */
.drawer-backdrop { position: fixed; inset: 0; background: rgba(0,0,0,.55); z-index: 40; }
.drawer {
  position: fixed; top: 0; left: 0; bottom: 0; z-index: 50; width: min(320px, 86vw);
  background: var(--surface); border-right: 1px solid var(--line-2);
  display: flex; flex-direction: column; overflow-y: auto;
  transform: translateX(-105%); transition: transform .22s ease; visibility: hidden;
}
.drawer.is-open { transform: none; visibility: visible; }
.drawer-head { display: flex; align-items: center; gap: 12px; padding: 18px 16px; border-bottom: 1px solid var(--line); }
.drawer-who { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.drawer-who strong { font-size: 15px; }
.drawer-who span { font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.drawer-auth { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; padding: 14px 16px 4px; }
.drawer-group { display: flex; flex-direction: column; padding: 8px; }
.drawer-link {
  display: flex; align-items: center; gap: 14px; min-height: 46px; padding: 0 12px; border-radius: 10px;
  color: var(--text); text-decoration: none; font-size: 14px; font-weight: 600;
}
.drawer-link:hover { background: var(--surface-2); }
.drawer-link.is-active { background: var(--surface-3); color: var(--accent); }
.drawer-pages {
  display: grid; grid-template-columns: 1fr 1fr; gap: 2px; padding: 8px; margin: 4px 16px 0;
  border-top: 1px solid var(--line);
}
.drawer-pages a { min-height: 40px; display: flex; align-items: center; padding: 0 4px; font-size: 13px; color: var(--text-2); text-decoration: none; }
.drawer-foot { margin-top: auto; padding: 14px 16px 22px; border-top: 1px solid var(--line); display: flex; align-items: center; gap: 10px; }
.segmented { flex: 1; display: flex; padding: 3px; border-radius: 12px; border: 1px solid var(--line-2); background: var(--bg); }
.segmented button {
  flex: 1; min-height: 38px; border: 0; border-radius: 9px; background: transparent; color: var(--muted);
  font: inherit; font-size: 12px; font-weight: 700; cursor: pointer;
}
.segmented button[aria-pressed="true"] { background: var(--surface-3); color: var(--text); }
body.drawer-lock { overflow: hidden; }

/* ---------- Footer ---------- */
.site-footer { border-top: 1px solid var(--line); margin-top: 40px; }
.footer-inner { display: flex; flex-wrap: wrap; align-items: center; gap: 14px 20px; padding-top: 26px; padding-bottom: 30px; }
.footer-copy { flex: 1 1 200px; font-size: 13px; color: var(--muted); }
.footer-links { display: flex; flex-wrap: wrap; gap: 6px 18px; }
.footer-links a { font-size: 13px; color: var(--text-2); text-decoration: none; }
.footer-links a:hover { color: var(--text); }

/* ---------- Homepage ---------- */
.hero { padding: 64px 0 48px; }
.hero-inner { display: flex; flex-wrap: wrap; align-items: center; gap: 48px; }
.hero-copy { flex: 1 1 440px; display: flex; flex-direction: column; gap: 20px; }
.hero-preview-left .hero-copy { order: 2; }
.hero-center .hero-inner { flex-direction: column; text-align: center; }
.hero-center .hero-copy { align-items: center; flex-basis: auto; max-width: 760px; }
.hero-center .hero-actions, .hero-center .hero-points { justify-content: center; }
.eyebrow {
  align-self: flex-start; font-size: 12px; font-weight: 800; letter-spacing: .1em; text-transform: uppercase;
  color: var(--accent); background: color-mix(in srgb, var(--accent) 10%, transparent);
  border: 1px solid color-mix(in srgb, var(--accent) 28%, transparent); padding: 6px 12px; border-radius: 20px;
}
[data-theme="light"] .eyebrow { color: #8A5300; }
.hero-center .eyebrow { align-self: center; }
.hero-title { font-size: clamp(36px, 6vw, 58px); font-weight: 800; letter-spacing: -.02em; line-height: 1.06; margin: 0; }
.hero-sub { font-size: 18px; color: var(--text-2); max-width: 540px; margin: 0; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 12px; }
.hero-points { list-style: none; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 8px 20px; font-size: 13px; color: var(--muted); }
.hero-points li::before { content: ""; display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: var(--accent); margin-right: 8px; vertical-align: middle; }

.hero-preview {
  flex: 1 1 340px; max-width: 440px; background: var(--surface); border: 1px solid var(--line-2);
  border-radius: 24px; overflow: hidden; box-shadow: 0 24px 60px rgba(0,0,0,.25);
}
.preview-head { display: flex; align-items: center; gap: 10px; padding: 14px 16px; border-bottom: 1px solid var(--line); }
.preview-who { display: flex; flex-direction: column; }
.preview-who strong { font-size: 14px; }
.preview-who small { font-size: 11px; color: var(--online); }
.preview-body { padding: 16px; display: flex; flex-direction: column; gap: 10px; }

.bubble { max-width: 85%; padding: 9px 13px; font-size: 14px; line-height: 1.45; border-radius: 16px; }
.bubble-user { align-self: flex-end; background: var(--user-bubble); color: var(--user-bubble-text); border-bottom-right-radius: 4px; }
.bubble-bot { align-self: flex-start; background: var(--bot-bubble); border: 1px solid var(--line-2); border-bottom-left-radius: 4px; }

.asks { background: var(--bg-2); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.asks-inner { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; padding-top: 20px; padding-bottom: 20px; }
.asks-label { font-size: 13px; font-weight: 700; color: var(--muted); margin-right: 4px; }
.chip {
  font-size: 14px; padding: 8px 14px; border-radius: 18px; background: var(--surface-2);
  border: 1px solid var(--line-2); color: var(--text); text-decoration: none;
}
.chip:hover { border-color: var(--accent); }

.section { padding: 56px 0 20px; }
.section-title { font-size: clamp(26px, 4vw, 36px); font-weight: 800; letter-spacing: -.01em; margin-bottom: 28px; }
.lead { font-size: 16px; color: var(--text-2); }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: 18px; padding: 22px; }
.grid-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 18px; }
.step { display: flex; flex-direction: column; gap: 10px; }
.step h3 { font-size: 19px; margin: 0; }
.step p { margin: 0; color: var(--text-2); }
.step-num {
  width: 40px; height: 40px; border-radius: 12px; background: var(--surface-3); color: var(--accent);
  display: inline-flex; align-items: center; justify-content: center; font-weight: 800; font-size: 17px;
}
.feature-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 1px;
  background: var(--line); border: 1px solid var(--line); border-radius: 18px; overflow: hidden;
}
.feature { background: var(--bg-2); padding: 24px; }
.feature h3 { font-size: 17px; color: var(--accent); margin-bottom: 6px; }
[data-theme="light"] .feature h3 { color: #8A5300; }
.feature p { margin: 0; color: var(--text-2); }

.split { display: flex; flex-wrap: wrap; gap: 36px; align-items: center; }
.split-copy { flex: 1 1 340px; }
.cmd-grid { flex: 1 1 440px; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.cmd { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; display: flex; flex-direction: column; gap: 2px; }
.cmd strong { color: var(--accent); font-size: 14px; }
[data-theme="light"] .cmd strong { color: #8A5300; }
.cmd span { font-size: 13px; color: var(--muted); }

.faq-list { display: flex; flex-direction: column; gap: 12px; }
.faq { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 16px 20px; }
.faq summary { font-weight: 700; cursor: pointer; list-style-position: outside; }
.faq p { margin: 12px 0 0; color: var(--text-2); }

.cta-band {
  background: var(--accent); color: var(--accent-ink); border-radius: 24px; padding: 40px;
  display: flex; flex-wrap: wrap; align-items: center; gap: 22px; margin-bottom: 30px;
}
.cta-copy { flex: 1 1 360px; }
.cta-copy h2 { font-size: clamp(24px, 3.4vw, 34px); font-weight: 800; margin: 0 0 6px; }
.cta-copy p { margin: 0; font-weight: 500; }

@media (max-width: 600px) {
  .hero { padding: 36px 0 28px; }
  .hero-actions .btn { width: 100%; }
  .hero-preview { max-width: none; }
  .cmd-grid { grid-template-columns: 1fr; }
  .cta-band { padding: 26px 22px; }
  .cta-band .btn { width: 100%; }
}

/* ---------- Forms & auth ---------- */
.auth-wrap { flex: 1; display: flex; align-items: flex-start; justify-content: center; padding: 48px 16px; }
.auth-card {
  width: 100%; max-width: 440px; background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius-lg); padding: 30px 26px;
}
.auth-card h1 { font-size: 26px; margin-bottom: 6px; }
.auth-switch { text-align: center; margin: 20px 0 0; font-size: 14px; color: var(--muted); }

.form { display: flex; flex-direction: column; gap: 16px; }
.form h2 { font-size: 18px; margin: 0; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field-row { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; }
.field label { font-size: 14px; font-weight: 600; }
.small-link { font-size: 13px; }
.hint { font-size: 12px; color: var(--muted); }
input[type="text"], input[type="email"], input[type="password"], select, textarea {
  width: 100%; min-height: 46px; padding: 10px 14px; border-radius: 12px;
  border: 1px solid var(--line-2); background: var(--bg); color: var(--text); font: inherit; font-size: 16px;
}
textarea { resize: vertical; min-height: 120px; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 22%, transparent); }
.check { display: flex; align-items: flex-start; gap: 10px; font-size: 14px; cursor: pointer; }
.check input { width: 18px; height: 18px; margin-top: 2px; accent-color: var(--accent); flex: none; }
.form-2col { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; }

.alert { padding: 12px 14px; border-radius: 12px; font-size: 14px; margin-bottom: 16px; }
.alert-error { background: var(--error-bg); color: var(--error-text); }
.alert-success { background: var(--success-bg); color: var(--success-text); }
.alert-info { background: var(--info-bg); color: var(--info-text); }

/* ---------- Account ---------- */
.account { padding-top: 32px; padding-bottom: 20px; display: flex; flex-direction: column; gap: 18px; }
.account h1 { font-size: 28px; margin: 0; }
.profile-head { display: flex; flex-wrap: wrap; align-items: center; gap: 18px; }
.profile-who { flex: 1 1 200px; }
.profile-who h1 { margin-bottom: 2px; }
.profile-who p { margin: 0; }
.stat-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; }
.stat { display: flex; flex-direction: column; gap: 2px; text-decoration: none; color: var(--text); }
.stat strong { font-size: 26px; }
.stat span { font-size: 13px; color: var(--muted); }
.empty { text-align: center; padding: 40px 22px; }
.account .btn { align-self: flex-start; }

/* ---------- Content pages ---------- */
.page { padding-top: 40px; padding-bottom: 20px; }
.page h1 { font-size: clamp(28px, 4vw, 40px); font-weight: 800; }
.prose { color: var(--text-2); font-size: 16px; }
.prose h2 { color: var(--text); font-size: 22px; margin-top: 1.6em; }
.prose h3 { color: var(--text); font-size: 18px; margin-top: 1.4em; }
.prose ul, .prose ol { padding-left: 1.3em; }
.prose li { margin-bottom: .4em; }
.contact-form { margin-top: 28px; }

.error-page { padding-top: 70px; padding-bottom: 40px; text-align: center; }
.error-code { display: block; font-size: 64px; font-weight: 800; color: var(--accent); line-height: 1; margin-bottom: 10px; }
.error-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; margin-top: 20px; }

/* ---------- Chat ---------- */
body.page-chat { overflow: hidden; }
.page-chat .main { min-height: 0; }
.chat-shell {
  flex: 1; min-height: 0; width: 100%; max-width: 900px; margin: 0 auto; position: relative;
  display: flex; flex-direction: column; background: var(--bg);
}
@media (min-width: 900px) {
  .chat-shell { margin: 16px auto; border: 1px solid var(--line); border-radius: 18px; overflow: hidden; background: var(--bg-2); }
}
.chat-head { display: flex; align-items: center; gap: 12px; padding: 12px 16px; background: var(--surface); border-bottom: 1px solid var(--line); }
.chat-avatar { border-radius: 50%; width: 40px; height: 40px; }
.chat-who { display: flex; flex-direction: column; }
.chat-who strong { font-size: 15px; }
.online { color: var(--online); font-size: 12px; }
.guest-bar {
  display: flex; align-items: center; gap: 10px; padding: 9px 16px; font-size: 12px;
  background: var(--surface-2);
  background: color-mix(in srgb, var(--accent) 12%, var(--surface)); border-bottom: 1px solid var(--line);
}
.guest-bar span { flex: 1; }
.guest-bar a { font-weight: 700; }

.chat-body { flex: 1; min-height: 0; overflow-y: auto; padding: 14px 14px 10px; display: flex; flex-direction: column; gap: 10px; overscroll-behavior: contain; }
.chat-list { display: flex; flex-direction: column; gap: 8px; }
.load-more { display: flex; justify-content: center; }
.load-more .chip { cursor: pointer; font: inherit; font-size: 13px; }
.day-sep { align-self: center; margin: 6px 0; }
.day-sep span { font-size: 11px; font-weight: 600; color: var(--muted); background: var(--surface-2); padding: 4px 10px; border-radius: 10px; }

.msg { display: flex; flex-direction: column; gap: 6px; max-width: 86%; }
.msg-user { align-self: flex-end; align-items: flex-end; }
.msg-bot { align-self: flex-start; align-items: flex-start; }
.msg .bubble { max-width: 100%; display: flex; flex-direction: column; gap: 3px; word-wrap: break-word; overflow-wrap: anywhere; }
.msg-text { white-space: normal; }
.msg-meta { align-self: flex-end; font-size: 10px; color: var(--muted); line-height: 1; margin-top: 2px; }
.bubble-user .msg-meta { color: color-mix(in srgb, var(--user-bubble-text) 65%, transparent); }
.tick-done { color: var(--online); letter-spacing: -2px; }
.bubble-error { opacity: .75; border: 1px dashed var(--danger); }
.msg-admin .bubble { border-color: color-mix(in srgb, var(--accent) 45%, var(--line-2)); }
.msg-label { font-size: 10px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: var(--accent); }
[data-theme="light"] .msg-label { color: #8A5300; }

.qr { display: flex; flex-wrap: wrap; gap: 6px; }
.qr[hidden] { display: none; }
.qr-btn { cursor: pointer; font: inherit; font-size: 13px; font-weight: 600; padding: 8px 12px; min-height: 36px; }
.qr-btn:hover { border-color: var(--accent); }

.chat-note { align-self: center; text-align: center; font-size: 12px; color: var(--muted); background: var(--surface-2); padding: 6px 12px; border-radius: 10px; max-width: 90%; }
.chat-note-error { color: var(--error-text); background: var(--error-bg); }

.typing { display: inline-flex; gap: 4px; align-items: center; padding: 12px 14px; align-self: flex-start; }
.typing[hidden] { display: none; }
.typing span { width: 7px; height: 7px; border-radius: 50%; background: var(--muted); animation: blink 1.2s infinite ease-in-out; }
.typing span:nth-child(2) { animation-delay: .15s; }
.typing span:nth-child(3) { animation-delay: .3s; }
@keyframes blink { 0%, 80%, 100% { opacity: .25; transform: translateY(0); } 40% { opacity: 1; transform: translateY(-3px); } }

.cmd-sheet {
  position: absolute; left: 0; right: 0; bottom: 68px; z-index: 5; max-height: min(60%, 460px);
  display: flex; flex-direction: column; background: var(--surface); border-top: 1px solid var(--line-2);
  border-radius: 18px 18px 0 0; box-shadow: 0 -12px 30px rgba(0,0,0,.25);
}
.cmd-sheet[hidden] { display: none; }
.cmd-sheet-head { display: flex; align-items: center; justify-content: space-between; padding: 10px 12px 6px 16px; font-size: 11px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.cmd-sheet-list { overflow-y: auto; padding: 0 6px 8px; }
.cmd-item {
  display: flex; align-items: center; gap: 12px; width: 100%; min-height: 46px; padding: 6px 10px;
  border: 0; border-radius: 10px; background: transparent; color: var(--text); font: inherit; text-align: left; cursor: pointer;
}
.cmd-item:hover, .cmd-item.is-active { background: var(--surface-2); }
.cmd-item strong { width: 116px; flex: none; color: var(--accent); font-size: 14px; }
[data-theme="light"] .cmd-item strong { color: #8A5300; }
.cmd-item span { flex: 1; font-size: 13px; color: var(--text-2); }
.cmd-tag { font-style: normal; font-size: 10px; font-weight: 700; color: var(--muted); border: 1px solid var(--line-2); border-radius: 6px; padding: 1px 6px; }
.icon-btn.sm { width: 34px; height: 34px; border-radius: 9px; font-size: 18px; }

.chat-compose {
  display: flex; align-items: center; gap: 8px; padding: 10px 12px calc(12px + env(safe-area-inset-bottom));
  background: var(--surface); border-top: 1px solid var(--line); position: relative; z-index: 6;
}
.chat-compose input { flex: 1; min-width: 0; border-radius: 22px; }
.compose-cmd, .compose-send {
  width: 44px; height: 44px; flex: none; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center;
  font: inherit; font-size: 20px; font-weight: 800; cursor: pointer;
}
.compose-cmd { border: 1px solid var(--line-2); background: var(--surface-2); color: var(--accent); }
.compose-cmd[aria-expanded="true"] { border-color: var(--accent); }
.compose-send { border: 0; background: var(--accent); color: var(--accent-ink); }

.chat-toast {
  position: absolute; left: 50%; top: 72px; transform: translateX(-50%); z-index: 7;
  background: var(--success-bg); color: var(--success-text); padding: 8px 14px; border-radius: 10px; font-size: 13px; font-weight: 600;
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}

/* ---------- Movie cards & lists in chat ---------- */
.msg-wide { width: 100%; }
.msg-card { max-width: 440px; }
.msg-list { max-width: 100%; }
@media (min-width: 900px) {
  .chat-shell { max-width: 1040px; }
  .msg { max-width: 72%; }
  .msg-card { max-width: 820px; }
  .msg-list { max-width: 100%; }
}
.msg-wide > .mcard, .msg-wide > .mlist { align-self: stretch; width: 100%; }
.mcard, .mlist {
  background: var(--bot-bubble); border: 1px solid var(--line-2); border-radius: 16px 16px 16px 4px; overflow: hidden;
}

/* --- single movie card --- */
.mcard-body { display: flex; flex-wrap: wrap; gap: 12px; padding: 12px; }
.mcard-poster { width: 88px; height: 132px; flex: none; border-radius: 10px; object-fit: cover; background: var(--surface-3); }
.mcard-noposter { display: flex; align-items: center; justify-content: center; font-size: 26px; font-weight: 800; color: var(--muted); }
.mcard-info { flex: 1 1 180px; min-width: 0; display: flex; flex-direction: column; gap: 7px; }
.mcard-kicker { font-size: 11px; font-weight: 800; letter-spacing: .08em; color: var(--accent); }
[data-theme="light"] .mcard-kicker { color: #8A5300; }
.mcard-title { font-weight: 800; font-size: 16px; line-height: 1.25; overflow-wrap: anywhere; }
.mcard-year { color: var(--muted); font-weight: 500; }
.mcard-badges { display: flex; flex-wrap: wrap; gap: 4px; }
.badge { font-size: 10.5px; font-weight: 700; padding: 2px 7px; border-radius: 5px; background: var(--surface-3); color: var(--text-2); white-space: nowrap; }
.badge-kind { background: color-mix(in srgb, var(--accent) 22%, var(--surface-3)); color: var(--text); letter-spacing: .04em; }
.badge-muted { color: var(--muted); }
.mcard-grid { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 4px 12px; margin: 2px 0 0; font-size: 12.5px; }
.mcard-grid dt { color: var(--muted); }
.mcard-grid dd { margin: 0; color: var(--text-2); overflow-wrap: anywhere; }
.mcard-plot {
  margin: 0; font-size: 13px; color: var(--text-2); line-height: 1.5;
  display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden;
}
.mcard-line { font-size: 12px; color: var(--text-2); }
.mcard-line.muted { color: var(--muted); }
.mcard-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 4px; }
.mcard-btn {
  flex: 1 1 100%; display: flex; align-items: center; justify-content: center; gap: 6px; text-align: center;
  min-height: 42px; padding: 8px 14px; border-radius: 10px; border: 1px solid var(--line-2);
  background: var(--surface-2); color: var(--text); font: inherit; font-size: 13.5px; font-weight: 700;
  text-decoration: none; line-height: 1.25; cursor: pointer;
}
.mcard-btn:hover { border-color: var(--accent); opacity: 1; }
.mcard-btn-main { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.mcard-btn-ghost { background: transparent; }
.mcard-btn-toggle { background: transparent; flex: 1 1 calc(50% - 4px); }
.mcard-btn-toggle.is-on { border-color: var(--success-text); color: var(--success-text); background: var(--success-bg); }
.mcard-btn:disabled { opacity: .6; cursor: wait; }
.chat-toast-live {
  position: fixed; left: 50%; bottom: 96px; z-index: 60; max-width: calc(100% - 32px);
  transform: translate(-50%, 12px); opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s;
  background: var(--surface-3); color: var(--text); border: 1px solid var(--line-2);
  padding: 10px 16px; border-radius: 12px; font-size: 13.5px; font-weight: 600; box-shadow: 0 8px 24px rgba(0,0,0,.25);
}
.chat-toast-live.is-show { opacity: 1; transform: translate(-50%, 0); }
.mcard-note { font-size: 12.5px; color: var(--muted); }
.mcard-full { flex: 1 1 100%; }
.mcard-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 0 12px 8px; }
.mcard-fb { display: flex; gap: 4px; }
.fb-btn { width: 34px; height: 30px; border-radius: 8px; border: 1px solid var(--line-2); background: transparent; cursor: pointer; font-size: 13px; opacity: .55; }
.fb-btn.is-on { opacity: 1; border-color: var(--accent); background: var(--surface-3); }

/* release date block: a strip on phones, a tall block on desktop */
.mcard-date {
  flex: 1 1 100%; display: flex; align-items: baseline; justify-content: center; gap: 8px;
  padding: 8px 12px; border-radius: 10px; background: var(--accent); color: var(--accent-ink);
}
.mcard-date-m { font-size: 13px; font-weight: 800; letter-spacing: .08em; }
.mcard-date-d { font-size: 26px; font-weight: 800; line-height: 1; }
.mcard-date-y { font-size: 13px; font-weight: 700; }

@media (min-width: 900px) {
  .mcard-body { flex-wrap: nowrap; gap: 18px; padding: 16px; }
  .mcard-poster { width: 150px; height: 225px; border-radius: 12px; }
  .mcard-title { font-size: 20px; }
  .mcard-grid { grid-template-columns: auto minmax(0, 1fr) auto minmax(0, 1fr); gap: 6px 14px; font-size: 13px; }
  .mcard-plot { font-size: 13.5px; -webkit-line-clamp: 3; }
  .mcard-btn { flex: 0 1 auto; }
  .mcard-date {
    flex: 0 0 112px; flex-direction: column; align-items: center; justify-content: center; gap: 2px; padding: 12px 8px;
  }
  .mcard-date-d { font-size: 44px; }
  .mcard-release .mcard-poster { width: 104px; height: 156px; }
  .mcard-foot { padding: 0 16px 10px; }
}
@media (max-width: 360px) {
  .mcard-poster { width: 72px; height: 108px; }
}

/* --- lists (Option B: wide rows, 2 columns on desktop) --- */
.mlist-head { padding: 12px 14px 10px; font-size: 14.5px; font-weight: 700; border-bottom: 1px solid var(--line); }
.mlist-grid { display: grid; grid-template-columns: minmax(0, 1fr); }
.mlist-item {
  display: flex; align-items: center; gap: 12px; width: 100%; min-height: 76px; padding: 9px 14px;
  border: 0; border-bottom: 1px solid var(--line); background: transparent; color: var(--text);
  font: inherit; text-align: left; cursor: pointer;
}
.mlist-item:hover { background: var(--surface-2); }
.mlist-rank { width: 24px; flex: none; text-align: center; font-size: 20px; font-weight: 800; color: var(--muted); }
.mlist-rank.is-top { color: var(--accent); }
[data-theme="light"] .mlist-rank.is-top { color: #8A5300; }
.mlist-thumb { width: 40px; height: 60px; flex: none; border-radius: 6px; object-fit: cover; background: var(--surface-3); font-size: 15px; }
.mlist-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.mlist-text strong { font-size: 14px; line-height: 1.3; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mlist-sub { font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mlist-chips { display: flex; flex-wrap: wrap; gap: 4px; max-height: 22px; overflow: hidden; }
.chip-date { font-size: 10.5px; font-weight: 800; padding: 2px 7px; border-radius: 5px; background: color-mix(in srgb, var(--accent) 22%, var(--surface-3)); color: var(--text); white-space: nowrap; }
.mlist-open { display: none; }
.mlist-go { font-size: 22px; line-height: 1; color: var(--accent); flex: none; }
.mlist-more {
  display: block; width: 100%; min-height: 44px; border: 0; background: transparent;
  color: var(--accent); font: inherit; font-size: 14px; font-weight: 700; cursor: pointer;
}
[data-theme="light"] .mlist-go, [data-theme="light"] .mlist-more, [data-theme="light"] .mlist-open { color: #8A5300; }
.mlist-time { display: block; text-align: right; padding: 4px 12px 8px; }

@media (min-width: 900px) {
  .mlist-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .mlist-grid .mlist-item:nth-child(odd) { border-right: 1px solid var(--line); }
  .mlist-item { min-height: 92px; padding: 10px 16px; }
  .mlist-thumb { width: 48px; height: 72px; }
  .mlist-rank { width: 28px; font-size: 22px; }
  .mlist-text strong { font-size: 14.5px; }
  .mlist-open {
    display: flex; align-items: center; flex: none; min-height: 34px; padding: 0 14px; border-radius: 9px;
    background: var(--surface-3); color: var(--accent); font-size: 12.5px; font-weight: 700;
  }
  .mlist-go { display: none; }
}

/* ---------- Trailer popup ---------- */
.tmodal {
  position: fixed; inset: 0; z-index: 100; display: flex; align-items: center; justify-content: center;
  padding: 12px; background: rgba(0, 0, 0, .85);
}
.tmodal[hidden] { display: none; }
.tmodal-box {
  position: relative; width: min(960px, calc(100vw - 24px), calc((100dvh - 120px) * 16 / 9));
  display: flex; flex-direction: column; gap: 10px;
}
.tmodal-bar { display: flex; align-items: center; gap: 10px; color: #fff; }
.tmodal-title { flex: 1; min-width: 0; font-weight: 700; font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tmodal-close {
  width: 44px; height: 44px; flex: none; border-radius: 50%; border: 1px solid rgba(255,255,255,.3);
  background: rgba(255,255,255,.12); color: #fff; font-size: 24px; line-height: 1; cursor: pointer;
}
.tmodal-close:hover { background: rgba(255,255,255,.22); }
.tmodal-frame { position: relative; width: 100%; aspect-ratio: 16 / 9; background: #000; border-radius: 12px; overflow: hidden; }
.tmodal-frame iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
body.modal-lock { overflow: hidden; }

/* ---------- Notifications / requests / watchlist pages ---------- */
.notif-btn { position: relative; }
.notif-dot {
  position: absolute; top: 2px; right: 0; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px;
  background: var(--danger); color: #fff; font-size: 10.5px; font-weight: 800; line-height: 18px; text-align: center;
}
.drawer-count {
  margin-left: auto; min-width: 22px; padding: 1px 7px; border-radius: 11px; text-align: center;
  background: var(--danger); color: #fff; font-style: normal; font-size: 11.5px; font-weight: 800;
}
.account-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.account .account-head .btn { align-self: center; }
.account-sub { font-size: 15px; margin: 6px 0 -6px; color: var(--text-2); text-transform: uppercase; letter-spacing: .06em; }
.ulist { list-style: none; margin: 0; padding: 6px; }
.uitem { display: flex; align-items: center; gap: 10px; padding: 4px 6px 4px 0; border-radius: 12px; }
.uitem + .uitem { border-top: 1px solid var(--line); }
.uitem.is-new { background: color-mix(in srgb, var(--accent) 10%, transparent); }
.uitem form { flex: 0 0 auto; }
.account .uitem .btn { align-self: center; }
.uitem-link { flex: 1 1 auto; min-width: 0; display: flex; align-items: center; gap: 12px; padding: 8px; color: var(--text); text-decoration: none; }
.uitem-thumb { flex: 0 0 44px; width: 44px; height: 66px; border-radius: 8px; object-fit: cover; background: var(--surface-3); }
.uitem-icon { display: flex; align-items: center; justify-content: center; font-size: 20px; font-weight: 800; color: var(--muted); }
.uitem-text { min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.uitem-text strong { font-size: 14.5px; line-height: 1.35; overflow-wrap: anywhere; }
.uitem-go { margin-left: auto; font-size: 22px; color: var(--muted); }

.wgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 14px; }
.wcard { display: flex; flex-direction: column; gap: 6px; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 8px; }
.wcard-link { display: flex; flex-direction: column; gap: 5px; color: var(--text); text-decoration: none; }
.wcard-poster { width: 100%; aspect-ratio: 2 / 3; height: auto; border-radius: 10px; object-fit: cover; background: var(--surface-3); }
.wcard-noposter { display: flex; align-items: center; justify-content: center; font-size: 34px; font-weight: 800; color: var(--muted); }
.wcard-name { font-size: 14px; line-height: 1.3; }
.wcard .chip-date, .wcard .badge { align-self: flex-start; }
.wcard-remove {
  width: 100%; min-height: 34px; border-radius: 8px; border: 1px solid var(--line-2); background: transparent;
  color: var(--muted); font: inherit; font-size: 12.5px; font-weight: 700; cursor: pointer;
}
.wcard-remove:hover { color: var(--danger); border-color: var(--danger); }
@media (min-width: 900px) { .wgrid { grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); } }

/* ---------- Announcements (admin messages) ---------- */
.cmsg {
  display: flex; flex-direction: column; gap: 10px; padding: 12px; border-radius: 16px; max-width: 760px;
  background: var(--bot-bubble); border: 1px solid color-mix(in srgb, var(--accent) 45%, var(--line-2));
}
.cmsg-text { font-size: 14.5px; line-height: 1.55; overflow-wrap: anywhere; }
.cmsg-img { width: 100%; max-height: 420px; object-fit: cover; border-radius: 12px; display: block; background: var(--surface-3); }
.cmsg .mcard, .cmsg .mlist { margin: 0; }
.cmsg-btns, .pin-btns { display: flex; flex-wrap: wrap; gap: 6px; }
.cmsg-btn { cursor: pointer; font: inherit; font-size: 13px; font-weight: 700; padding: 8px 14px; min-height: 36px; text-decoration: none; color: var(--text); display: inline-flex; align-items: center; }
.cmsg-btn:hover { border-color: var(--accent); opacity: 1; }
.cmsg-time { align-self: flex-end; }

/* pinned bar under the chat header */
.chat-pin {
  display: flex; align-items: flex-start; gap: 10px; padding: 10px 10px 10px 14px;
  background: var(--surface-2);
  background: color-mix(in srgb, var(--accent) 12%, var(--surface)); border-bottom: 1px solid var(--line);
}
.chat-pin[hidden] { display: none; }
.pin-icon { font-size: 16px; line-height: 22px; }
.pin-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 8px; }
.pin-text {
  border: 0; background: transparent; color: var(--text); font: inherit; font-size: 13.5px; line-height: 1.45; text-align: left; padding: 1px 0; cursor: pointer;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.chat-pin.is-open .pin-text { -webkit-line-clamp: unset; display: block; }
.pin-btns .cmsg-btn { padding: 6px 12px; min-height: 32px; font-size: 12.5px; }
.pin-close { flex: none; width: 32px; height: 32px; }
.captcha { margin: 2px 0; min-height: 65px; }

/* "Not what you wanted?" link under results */
.alt-link {
  display: block; margin: 0 12px 4px; padding: 6px 2px; border: 0; background: transparent; cursor: pointer;
  color: var(--muted); font: inherit; font-size: 12.5px; text-decoration: underline; text-underline-offset: 3px; text-align: left;
}
.alt-link:hover { color: var(--accent); }
.alt-link:disabled { opacity: .5; cursor: default; }
@media (min-width: 900px) { .alt-link { margin: 0 16px 4px; } }


/* ---------- iPhone / small screens ---------- */
/* Header never wider than the screen: the name shrinks, the buttons stay */
.header-inner { padding-left: max(12px, env(safe-area-inset-left)); padding-right: max(12px, env(safe-area-inset-right)); }
.site-header { padding-top: env(safe-area-inset-top); }
.header-inner > * { min-width: 0; }
.header-inner .icon-btn, .header-actions { flex: none; }
.brand { min-width: 0; flex: 0 1 auto; }
.brand-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (max-width: 420px) {
  .header-inner { gap: 8px; }
  .header-actions { gap: 6px; }
  .header-actions .btn-sm { padding: 0 12px; }
}

/* Chat fills exactly the visible screen (keyboard included, see chat.js) and never scrolls sideways */
/* top+bottom (not a height) pins the chat to the part of the screen that is really visible, above Safari/Chrome's bottom bar */
body.page-chat {
  position: fixed; top: 0; right: 0; bottom: 0; left: 0; width: 100%; max-width: 100%; height: auto; min-height: 0;
}
body.page-chat.kb-open { bottom: auto; height: var(--app-h, 100%); }
.page-chat .main, .chat-shell, .chat-body, .chat-list, .msg { min-width: 0; max-width: 100%; }
.chat-body { overflow-x: hidden; -webkit-overflow-scrolling: touch; }
.msg-wide, .msg-card, .msg-list { min-width: 0; }
.mcard, .mlist, .cmsg { max-width: 100%; min-width: 0; }
.chat-compose {
  padding-left: max(12px, env(safe-area-inset-left)); padding-right: max(12px, env(safe-area-inset-right));
}
/* 16px stops iOS zooming into the page when the box is tapped; appearance none removes iOS's inner shadow */
.chat-compose input {
  font-size: 16px; -webkit-appearance: none; appearance: none; -webkit-user-select: text; user-select: text;
  -webkit-text-fill-color: var(--text); opacity: 1;
}
.chat-compose input::placeholder { color: var(--muted); -webkit-text-fill-color: var(--muted); opacity: 1; }
.chat-compose input:focus { box-shadow: none; }

/* keyboard open: give the messages the room */
body.kb-open .guest-bar, body.kb-open .chat-head, body.kb-open .chat-pin { display: none; }
