:root {
  color-scheme: dark;
  --bg: #0b1020;
  --surface: #121a2e;
  --surface-2: #18223b;
  --line: #27334f;
  --text: #f3ead9;
  --muted: #aaa392;
  --accent: #e8a95b;
  --accent-strong: #f2bd76;
  --accent-ink: #1d1407;
  --danger: #ec8a78;
  --ok: #9cc9a4;
  --serif: Georgia, 'Iowan Old Style', 'Palatino Linotype', 'Times New Roman', serif;
  --sans: system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  --radius: 14px;
  --gutter: 16px;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: radial-gradient(1200px 600px at 80% -10%, #1b2440 0%, transparent 60%), var(--bg);
  color: var(--text);
  font: 16px/1.6 var(--sans);
  overflow-wrap: anywhere;
}
img { max-width: 100%; height: auto; }
a { color: var(--accent); text-underline-offset: 3px; }
a:hover { color: var(--accent-strong); }
h1, h2, h3 { font-family: var(--serif); font-style: italic; font-weight: 400; line-height: 1.2; margin: 0 0 .5em; }
h1 { font-size: clamp(1.8rem, 5vw, 2.6rem); }
h2 { font-size: clamp(1.35rem, 3.6vw, 1.7rem); }
h3 { font-size: 1.2rem; }
p { margin: 0 0 1em; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
[hidden] { display: none !important; }

.wrap { width: 100%; max-width: 960px; margin: 0 auto; padding: 0 var(--gutter); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: -999px; top: 8px; background: var(--accent); color: var(--accent-ink); padding: 8px 12px; border-radius: 8px; z-index: 10; }
.skip:focus { left: 8px; }
.small { font-size: .875rem; color: var(--muted); }
.muted { color: var(--muted); }
.error { color: var(--danger); font-size: .925rem; }
.notice { padding: 14px 16px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }

/* Header and footer */
.top { position: sticky; top: 0; z-index: 5; background: rgba(11, 16, 32, .88); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); }
.top-row { display: flex; align-items: center; gap: 12px; min-height: 60px; }
.brand { display: flex; align-items: center; gap: 10px; color: var(--text); text-decoration: none; font-family: var(--serif); font-style: italic; font-size: 1.15rem; white-space: nowrap; }
.brand img { border-radius: 50%; border: 1px solid var(--line); }
.nav { display: flex; gap: 4px; margin-left: auto; }
.nav a { color: var(--muted); text-decoration: none; padding: 8px 10px; border-radius: 10px; font-size: .95rem; white-space: nowrap; }
.nav a:hover, .nav a[aria-current="page"] { color: var(--text); background: var(--surface-2); }
.me { display: flex; align-items: center; }
.me-name { font-size: .85rem; color: var(--muted); white-space: nowrap; }
.me-name strong { color: var(--accent); font-weight: 600; }
.me { gap: 4px; }
.me-link { position: relative; display: inline-flex; align-items: center; gap: 8px; min-height: 40px; padding: 0 8px; border-radius: 999px; color: var(--muted); text-decoration: none; font-size: .9rem; }
.me-link:hover { color: var(--text); background: var(--surface-2); }
.me-link svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linejoin: round; }
.me-handle { max-width: 140px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.count-dot { display: inline-flex; align-items: center; justify-content: center; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 999px; background: var(--accent); color: var(--accent-ink); font: 700 .7rem/1 var(--sans); }
.me-link .count-dot { position: absolute; top: 2px; right: 0; }
.avatar { display: inline-flex; align-items: center; justify-content: center; flex: none; width: 30px; height: 30px; border-radius: 50%; background: linear-gradient(140deg, #2b3a63, #4a3a2a); border: 1px solid var(--line); color: var(--accent-strong); font: 600 .9rem/1 var(--serif); }
.avatar.big { width: 84px; height: 84px; font-size: 2.2rem; }

.foot { margin-top: auto; border-top: 1px solid var(--line); padding: 22px 0 88px; }
.foot-row { display: flex; flex-wrap: wrap; gap: 10px 24px; align-items: center; justify-content: space-between; }
.foot-row p { margin: 0; }
.foot nav { display: flex; gap: 16px; flex-wrap: wrap; }
.foot nav a { color: var(--muted); font-size: .9rem; }

/* Buttons and fields */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 0 18px; border: 0; border-radius: 999px;
  background: var(--accent); color: var(--accent-ink); font: 600 .95rem/1 var(--sans);
  cursor: pointer; text-decoration: none; white-space: nowrap;
}
.btn:hover { background: var(--accent-strong); color: var(--accent-ink); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-small { min-height: 36px; padding: 0 14px; font-size: .85rem; }
.btn-ghost { background: transparent; color: var(--text); border: 1px solid var(--line); }
.btn-ghost:hover { background: var(--surface-2); color: var(--text); }
.link { background: none; border: 0; padding: 0; color: var(--accent); font: inherit; text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }
.icon-btn { background: none; border: 0; color: var(--muted); font: .8rem var(--sans); cursor: pointer; padding: 6px 8px; border-radius: 8px; min-height: 32px; }
.icon-btn:hover { color: var(--text); background: var(--surface-2); }

label.field { display: block; margin-bottom: 14px; }
label.field > span { display: block; font-size: .9rem; color: var(--muted); margin-bottom: 6px; }
input[type="text"], input[type="email"], input[type="password"], textarea, select {
  width: 100%; background: var(--surface); color: var(--text); border: 1px solid var(--line);
  border-radius: 12px; padding: 12px 14px; font: 1rem/1.5 var(--sans);
}
textarea { resize: vertical; min-height: 120px; }
input:focus, textarea:focus, select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(232, 169, 91, .2); }
.form-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.count { font-size: .8rem; color: var(--muted); }
.count.over { color: var(--danger); }

/* Home */
/* Featured film: the newest video, centred, with soft rain behind it */
.feature {
  position: relative; isolation: isolate; display: grid; grid-template-columns: minmax(0, 340px) minmax(0, 1fr);
  gap: 36px; align-items: center; margin: 22px 0 10px; padding: 28px; border-radius: 24px; overflow: hidden;
  border: 1px solid var(--line);
  background: radial-gradient(520px 380px at 22% 40%, rgba(232, 169, 91, .16), transparent 70%),
    radial-gradient(600px 420px at 100% 0%, rgba(98, 126, 196, .22), transparent 70%),
    linear-gradient(160deg, #141d36, #0d1326 70%);
}
.feature::before {
  content: ''; position: absolute; inset: -40% 0 0; z-index: -1; opacity: .16; pointer-events: none;
  background: repeating-linear-gradient(104deg, transparent 0 14px, rgba(220, 230, 255, .55) 14px 15px, transparent 15px 31px);
  mask-image: linear-gradient(180deg, transparent, #000 30%, #000 70%, transparent);
  animation: rain 1.6s linear infinite;
}
@keyframes rain { from { transform: translate3d(0, -60px, 0); } to { transform: translate3d(-14px, 0, 0); } }
.film {
  position: relative; justify-self: center; width: 100%; max-width: 340px; border-radius: 20px; overflow: hidden;
  border: 1px solid rgba(242, 189, 118, .35); background: #05080f;
  box-shadow: 0 0 0 6px rgba(232, 169, 91, .06), 0 24px 70px rgba(0, 0, 0, .55), 0 0 90px rgba(232, 169, 91, .18);
}
.film-video { display: block; width: 100%; height: auto; aspect-ratio: 9 / 16; max-height: 72vh; object-fit: cover; cursor: pointer; }
.film-sound {
  position: absolute; left: 12px; bottom: 12px; display: inline-flex; align-items: center; gap: 8px;
  min-height: 38px; padding: 0 14px 0 10px; border: 1px solid rgba(255, 255, 255, .25); border-radius: 999px;
  background: rgba(8, 12, 24, .62); backdrop-filter: blur(8px); color: var(--text); font: 600 .85rem/1 var(--sans); cursor: pointer;
  animation: nudge 2.4s ease-in-out 1.2s 3;
}
.film-sound:hover { background: rgba(8, 12, 24, .82); }
.film-icon { width: 18px; height: 18px; background: currentColor; mask: no-repeat center / contain url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M4 9h4l5-4v14l-5-4H4z'/%3E%3Cpath d='M16 9l5 6M21 9l-5 6' stroke='%23000' stroke-width='2' fill='none' stroke-linecap='round'/%3E%3C/svg%3E"); }
.film-sound[aria-pressed="true"] { animation: none; }
.film-sound[aria-pressed="true"] .film-icon { mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M4 9h4l5-4v14l-5-4H4z'/%3E%3Cpath d='M16.5 8.5a5 5 0 0 1 0 7M19 6a8.5 8.5 0 0 1 0 12' stroke='%23000' stroke-width='2' fill='none' stroke-linecap='round'/%3E%3C/svg%3E"); }
@keyframes nudge { 0%, 100% { transform: none; } 50% { transform: scale(1.06); } }
.feature-text { max-width: 480px; }
.eyebrow { display: inline-flex; align-items: center; gap: 8px; margin-bottom: 12px; font-size: .78rem; letter-spacing: .14em; text-transform: uppercase; color: var(--accent); }
.eyebrow::before { content: ''; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 4px rgba(232, 169, 91, .2); animation: pulse 2s ease-in-out infinite; }
@keyframes pulse { 50% { box-shadow: 0 0 0 8px rgba(232, 169, 91, 0); } }
.feature h1 { font-size: clamp(1.9rem, 4.4vw, 2.8rem); margin-bottom: .4em; }
.lead { color: var(--muted); font-size: 1.08rem; }
.cta { display: flex; flex-wrap: wrap; gap: 10px; margin: 20px 0 16px; }
.watch { font-size: .9rem; color: var(--muted); margin: 0; }

.intro { margin: 34px 0 24px; max-width: 680px; }
.intro h2 { margin-bottom: .35em; }
.intro p { color: var(--muted); font-size: 1.05rem; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin: 30px 0 12px; flex-wrap: wrap; }
.section-head h2 { margin: 0; }

.boards { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }
.board-card {
  display: block; padding: 18px 18px 16px; border-radius: var(--radius); background: var(--surface);
  border: 1px solid var(--line); color: var(--text); text-decoration: none; transition: border-color .2s, transform .2s, box-shadow .2s;
}
.board-card { position: relative; overflow: hidden; background: linear-gradient(180deg, var(--surface-2), var(--surface)); }
.board-card::before { content: ''; position: absolute; inset: 0 0 auto; height: 2px; background: linear-gradient(90deg, var(--accent), transparent); opacity: 0; transition: opacity .2s; }
.board-card:hover { border-color: rgba(232, 169, 91, .6); color: var(--text); transform: translateY(-3px); box-shadow: 0 14px 34px rgba(0, 0, 0, .35); }
.board-card:hover::before { opacity: 1; }
.board-card h3 { margin-bottom: .3em; color: var(--accent); }
.board-card p { margin: 0 0 .6em; color: var(--muted); font-size: .95rem; }
.board-card .meta { font-size: .8rem; color: var(--muted); }

/* Thread lists */
.threads { list-style: none; margin: 0; padding: 0; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; background: var(--surface); }
.threads li + li { border-top: 1px solid var(--line); }
.threads a { display: block; padding: 14px 16px; color: var(--text); text-decoration: none; }
.threads a:hover { background: var(--surface-2); }
.threads .t-title { display: block; font-size: 1.02rem; margin-bottom: 2px; }
.threads .meta { font-size: .8rem; color: var(--muted); }
.empty { padding: 26px 16px; text-align: center; color: var(--muted); border: 1px dashed var(--line); border-radius: var(--radius); }
.more { display: flex; justify-content: center; margin: 16px 0; }

/* Thread page */
.crumbs { margin: 22px 0 10px; font-size: .9rem; color: var(--muted); }
.crumbs a { color: var(--muted); }
.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.page-head p { color: var(--muted); margin: 0; }
#view > .page-head:first-child, .settings > .page-head:first-child { margin-top: 26px; }
.post { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 16px 10px; margin-bottom: 12px; }
.post.op { border-color: #3a4566; background: linear-gradient(180deg, var(--surface-2), var(--surface)); }
.post.mine { border-left: 3px solid var(--accent); }
.post-head { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; margin-bottom: 8px; font-size: .85rem; color: var(--muted); }
.post-head .name { color: var(--accent); font-weight: 600; }
.post-body { white-space: pre-wrap; margin-bottom: 8px; }
.post-foot { display: flex; justify-content: flex-end; gap: 4px; }
.badge { display: inline-block; font-size: .72rem; padding: 2px 8px; border-radius: 999px; border: 1px solid var(--line); color: var(--muted); }
.badge.pending { border-color: #6b5a33; color: var(--accent); }
.reply { margin: 22px 0 10px; }
.composer { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; }
.composer textarea { margin-bottom: 10px; }
.join { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.join p { margin: 0; color: var(--muted); }
.join-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.notice.join { margin: 10px 0; }
a.name { text-decoration: none; }
a.name:hover { text-decoration: underline; }
.post-head a.name { color: var(--accent); font-weight: 600; }

/* Accounts */
.auth { max-width: 440px; margin: 28px auto 10px; }
.auth h1 { font-size: 1.8rem; }
.auth-form { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; margin-top: 14px; }
.auth-form .form-row { justify-content: flex-end; }
.auth-foot { margin-top: 14px; color: var(--muted); }
.hint { display: block; margin-top: 6px; font-size: .8rem; color: var(--muted); }
label.check { display: flex; align-items: center; gap: 10px; margin: 4px 0 14px; cursor: pointer; }
label.check input { width: 18px; height: 18px; accent-color: var(--accent); }
.settings { max-width: 640px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; margin: 14px 0; }
.card h2 { font-size: 1.15rem; margin-top: 0; }
.card .auth-form { background: none; border: 0; padding: 0; margin: 0; }
.private { color: var(--text); word-break: break-all; }
details.danger summary { cursor: pointer; color: var(--danger); font-weight: 600; }
details.danger[open] summary { margin-bottom: 12px; }
.danger-form .btn { background: var(--danger); }
.profile { display: flex; gap: 20px; align-items: flex-start; margin: 24px 0 18px; }
.profile h1 { margin: 0 0 4px; }
.profile-main { min-width: 0; flex: 1; }
.bio { white-space: pre-wrap; margin: 10px 0; }
.profile-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 12px; }

/* Private messages */
.inbox a { display: flex; align-items: center; gap: 12px; }
.inbox-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.inbox-main .meta { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.inbox .t-title { display: flex; align-items: center; gap: 8px; }
.inbox time { font-size: .8rem; color: var(--muted); white-space: nowrap; }
.inbox li.unread .t-title { color: var(--accent-strong); }
.dm-title { display: flex; align-items: center; gap: 10px; font-size: 1.4rem; margin: 0; }
.dm-title a { color: var(--text); text-decoration: none; }
.dm-title .back { font-size: 1.8rem; line-height: 1; padding: 0 6px; color: var(--muted); }
.conversation { display: flex; flex-direction: column; height: calc(100vh - 230px); min-height: 380px; margin: 14px 0 8px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.dm-list { flex: 1; overflow-y: auto; list-style: none; margin: 0; padding: 14px; display: flex; flex-direction: column; gap: 10px; }
.dm { max-width: min(78%, 520px); align-self: flex-start; }
.dm.mine { align-self: flex-end; }
.dm-body { padding: 10px 14px; border-radius: 16px 16px 16px 4px; background: var(--surface-2); border: 1px solid var(--line); white-space: pre-wrap; overflow-wrap: anywhere; }
.dm.mine .dm-body { border-radius: 16px 16px 4px 16px; background: rgba(232, 169, 91, .16); border-color: rgba(232, 169, 91, .35); }
.dm-meta { display: flex; align-items: center; gap: 4px; font-size: .75rem; color: var(--muted); margin-top: 3px; }
.dm.mine .dm-meta { justify-content: flex-end; }
.dm-meta .icon-btn { font-size: .75rem; min-height: 26px; padding: 2px 6px; }
.conversation .composer { border: 0; border-top: 1px solid var(--line); border-radius: 0; background: var(--surface-2); padding: 12px; }
.conversation .composer textarea { min-height: 60px; }
.conversation > .notice { margin: 0; border: 0; border-top: 1px solid var(--line); border-radius: 0; }

/* Chat */
.chat { display: flex; flex-direction: column; height: calc(100vh - 220px); min-height: 380px; margin: 18px 0 8px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.chat-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.chat-head h1 { font-size: 1.4rem; margin: 0; }
.online { font-size: .85rem; color: var(--muted); display: flex; align-items: center; gap: 6px; }
.online::before { content: ''; width: 8px; height: 8px; border-radius: 50%; background: var(--ok); }
.online.off::before { background: var(--danger); }
.messages { flex: 1; overflow-y: auto; padding: 12px 16px; list-style: none; margin: 0; }
.msg { padding: 6px 0; display: grid; grid-template-columns: 1fr auto; gap: 0 6px; align-items: start; }
.msg .who { font-size: .8rem; color: var(--muted); }
.msg .who .name { color: var(--accent); font-weight: 600; margin-right: 6px; }
.msg.mine .who .name { color: var(--accent-strong); }
.msg .text { grid-column: 1; white-space: pre-wrap; }
.msg .icon-btn { grid-row: 1 / span 2; grid-column: 2; opacity: .55; }
.msg:hover .icon-btn, .msg .icon-btn:focus-visible { opacity: 1; }
.system { text-align: center; font-size: .82rem; color: var(--muted); padding: 8px 0; }
.chat-form { display: flex; gap: 8px; padding: 12px; border-top: 1px solid var(--line); background: var(--surface-2); }
.chat-form input { flex: 1; min-width: 0; }
.chat-form .join { flex: 1; }

/* Dialogs */
.dialog { width: min(520px, calc(100vw - 2 * var(--gutter))); max-height: calc(100vh - 32px); padding: 0; border: 1px solid var(--line); border-radius: 18px; background: var(--surface); color: var(--text); }
.dialog::backdrop { background: rgba(4, 7, 15, .72); }
.dialog-body { padding: 22px 20px 18px; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 10px; flex-wrap: wrap; margin-top: 12px; }
.turnstile { min-height: 65px; margin: 10px 0; }
.choices { border: 0; padding: 0; margin: 0 0 8px; display: grid; gap: 6px; }
.choices label { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; cursor: pointer; }
.choices label:has(input:checked) { border-color: var(--accent); }
.choices input { accent-color: var(--accent); }
.lines { padding-left: 18px; }
.lines li { margin-bottom: 6px; }

/* Plain pages (rules, privacy, terms, help, admin) */
.doc { max-width: 720px; padding-top: 28px; padding-bottom: 28px; }
.doc h2 { margin-top: 1.4em; }
.doc li { margin-bottom: 6px; }

/* Talk with Alfred: floating button and the AI drawer */
.ai-fab {
  position: fixed; right: 16px; bottom: 16px; z-index: 8; display: inline-flex; align-items: center; gap: 10px;
  min-height: 52px; padding: 6px 18px 6px 6px; border: 1px solid rgba(242, 189, 118, .45); border-radius: 999px;
  background: linear-gradient(180deg, #1f2a48, #151d34); color: var(--text); font: 600 .95rem/1 var(--sans); cursor: pointer;
  box-shadow: 0 12px 30px rgba(0, 0, 0, .45), 0 0 0 0 rgba(232, 169, 91, .4); animation: fab-glow 3s ease-in-out infinite;
}
.ai-fab img { border-radius: 50%; width: 40px; height: 40px; }
.ai-fab:hover { border-color: var(--accent); }
@keyframes fab-glow { 50% { box-shadow: 0 12px 30px rgba(0, 0, 0, .45), 0 0 0 8px rgba(232, 169, 91, 0); } }

.ai {
  position: fixed; inset: 0 0 0 auto; width: min(440px, 100vw); max-width: 100vw; height: 100dvh; max-height: 100dvh;
  margin: 0 0 0 auto; padding: 12px; border: 0; background: transparent; color: var(--text);
}
.ai::backdrop { background: rgba(4, 7, 15, .6); backdrop-filter: blur(2px); }
.ai[open] .ai-panel { animation: drawer-in .28s cubic-bezier(.2, .8, .2, 1); }
@keyframes drawer-in { from { transform: translateX(24px); opacity: 0; } }
.ai-panel {
  display: grid; grid-template-rows: auto 1fr auto auto auto; height: 100%; overflow: hidden;
  border: 1px solid var(--line); border-radius: 20px; background: linear-gradient(180deg, #151e37, var(--surface));
  box-shadow: 0 30px 80px rgba(0, 0, 0, .55);
}
.ai-head { display: flex; align-items: center; gap: 12px; padding: 14px 12px 12px 16px; border-bottom: 1px solid var(--line); }
.ai-head img { border-radius: 50%; border: 1px solid rgba(242, 189, 118, .5); }
.ai-head div { flex: 1; min-width: 0; }
.ai-head h2 { font-size: 1.3rem; margin: 0; }
.ai-head p { margin: 0; }
.ai-x { font-size: 1.4rem; line-height: 1; padding: 4px 10px; }
.ai-log { overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 10px; overscroll-behavior: contain; }
.ai-msg { max-width: 86%; padding: 10px 14px; border-radius: 16px; line-height: 1.55; }
.ai-msg p, .ai-msg ul, .ai-msg ol { margin: 0 0 .6em; }
.ai-msg > :last-child { margin-bottom: 0; }
.ai-msg ul, .ai-msg ol { padding-left: 1.2em; }
.ai-msg code { font-size: .9em; background: rgba(255, 255, 255, .08); padding: 1px 5px; border-radius: 5px; }
.ai-bear { align-self: flex-start; background: var(--surface-2); border: 1px solid var(--line); border-bottom-left-radius: 6px; }
.ai-user { align-self: flex-end; background: var(--accent); color: var(--accent-ink); border-bottom-right-radius: 6px; white-space: pre-wrap; }
.ai-error { border-color: rgba(236, 138, 120, .5); color: var(--danger); }
.ai-streaming > :last-child::after { content: '▍'; margin-left: 2px; color: var(--accent); animation: blink 1s steps(2) infinite; }
@keyframes blink { 50% { opacity: 0; } }
.ai-typing { display: inline-flex; gap: 4px; padding: 4px 0; }
.ai-typing i { width: 7px; height: 7px; border-radius: 50%; background: var(--muted); animation: bounce 1.2s ease-in-out infinite; }
.ai-typing i:nth-child(2) { animation-delay: .15s; }
.ai-typing i:nth-child(3) { animation-delay: .3s; }
@keyframes bounce { 0%, 80%, 100% { transform: none; opacity: .5; } 40% { transform: translateY(-5px); opacity: 1; } }
.ai-chips { display: flex; flex-wrap: wrap; gap: 8px; padding: 0 16px 12px; }
.ai-chips button { border: 1px solid var(--line); background: transparent; color: var(--text); border-radius: 999px; padding: 8px 12px; font: .85rem var(--sans); cursor: pointer; }
.ai-chips button:hover { border-color: var(--accent); color: var(--accent-strong); }
.ai-form { display: flex; align-items: flex-end; gap: 8px; padding: 12px; border-top: 1px solid var(--line); background: var(--surface-2); }
.ai-form textarea { flex: 1; min-height: 46px; max-height: 140px; resize: none; padding: 11px 14px; border-radius: 14px; }
.ai-send { flex: none; width: 46px; height: 46px; border: 0; border-radius: 50%; background: var(--accent); color: var(--accent-ink); font: 700 1.2rem/1 var(--sans); cursor: pointer; }
.ai-send:hover { background: var(--accent-strong); }
.ai-stop { background: var(--surface); color: var(--text); border: 1px solid var(--line); font-size: .9rem; }
.ai-note { margin: 0; padding: 0 14px 12px; background: var(--surface-2); font-size: .75rem; color: var(--muted); text-align: center; }

.toast { position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%); background: var(--surface-2); border: 1px solid var(--line); color: var(--text); padding: 10px 16px; border-radius: 999px; font-size: .9rem; z-index: 20; max-width: calc(100vw - 32px); }

@media (max-width: 760px) {
  .feature { grid-template-columns: 1fr; }
  .feature-text { text-align: center; margin: 0 auto; }
  .cta { justify-content: center; }
}

@media (max-width: 560px) {
  .brand span { display: none; }
  .nav a { padding: 8px 8px; }
  .top-row { gap: 6px; }
  .me-name { max-width: 34vw; overflow: hidden; text-overflow: ellipsis; }
  .me-label { display: none; }
  .me-handle { display: none; }
  .profile { gap: 14px; }
  .avatar.big { width: 64px; height: 64px; font-size: 1.7rem; }
  .conversation { height: calc(100vh - 200px); }
  .dm { max-width: 88%; }
  .chat { height: calc(100vh - 190px); }
  .feature { grid-template-columns: 1fr; gap: 20px; margin-top: 12px; padding: 14px 14px 20px; border-radius: 18px; }
  .film { max-width: 300px; }
  .film-video { max-height: 64vh; }
  .feature-text { text-align: center; margin: 0 auto; }
  .cta { justify-content: center; }
  .ai-fab { right: 12px; bottom: 12px; padding-right: 14px; font-size: .88rem; }
  .ai { padding: 0; }
  .ai-panel { border-radius: 0; border: 0; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
  .feature::before { display: none; }
}
