:root {
  --bg: #141414;
  --bg-2: #1b1b1b;
  --card: #202020;
  --card-2: #272727;
  --line: #2f2f2f;
  --text: #f6f3ef;
  --muted: #b3aca5;
  --primary: #ff6b2c;
  --primary-ink: #1a0d06;
  --accent: #ffc93c;
  --radius: 18px;
  --radius-sm: 12px;
  --shadow: 0 10px 30px rgba(0, 0, 0, .35);
  --font: 'Manrope', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --display: 'Bricolage Grotesque', 'Manrope', system-ui, sans-serif;
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.55;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}
img { display: block; max-width: 100%; }
a { color: var(--accent); text-underline-offset: 3px; }
a:hover { color: #ffd76b; }
h1, h2, h3 { margin: 0; line-height: 1.15; }
ul { margin: 0; padding: 0; list-style: none; }
button { font: inherit; color: inherit; }
[hidden] { display: none !important; }

:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; border-radius: 6px; }
main:focus, [tabindex="-1"]:focus { outline: none; }

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.skip {
  position: absolute; left: 16px; top: -60px; z-index: 100;
  background: var(--accent); color: #141414; padding: 10px 14px; border-radius: 10px;
  font-weight: 700; text-decoration: none; transition: top .2s;
}
.skip:focus { top: 12px; }

.wrap { width: 100%; max-width: 1120px; margin: 0 auto; padding: 0 16px; }
.wrap.narrow { max-width: 760px; }
@media (min-width: 720px) { .wrap { padding: 0 28px; } }

/* ---------- Barra superiore ---------- */
.topbar {
  position: sticky; top: 0; z-index: 50;
  background: rgba(20, 20, 20, .82);
  backdrop-filter: saturate(1.4) blur(12px);
  -webkit-backdrop-filter: saturate(1.4) blur(12px);
  border-bottom: 1px solid rgba(255, 255, 255, .06);
}
.topbar-in { display: flex; align-items: center; justify-content: space-between; height: 60px; gap: 12px; }
.brand {
  display: inline-flex; align-items: center; gap: 10px; text-decoration: none; color: var(--text);
  font-family: var(--display); font-weight: 800; font-size: 1.3rem; letter-spacing: -.01em;
}
.brand:hover { color: var(--text); }
.brand img { border-radius: 10px; }
.nav { display: flex; gap: 4px; }
.nav a {
  color: var(--muted); text-decoration: none; font-weight: 600; font-size: .92rem;
  padding: 8px 10px; border-radius: 10px; transition: color .2s, background .2s;
}
.nav a:hover { color: var(--text); background: rgba(255, 255, 255, .06); }
@media (max-width: 560px) {
  .nav a:not([href="#cerca"]) { display: none; }
  .nav a[href="#cerca"] { background: var(--primary); color: var(--primary-ink); }
}

/* ---------- Bottoni ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 48px; padding: 0 22px; border-radius: 999px; border: 0; cursor: pointer;
  font-weight: 700; font-size: 1rem; text-decoration: none;
  transition: transform .15s ease, box-shadow .2s ease, background .2s;
}
.btn:active { transform: scale(.97); }
.btn-primary { background: var(--primary); color: var(--primary-ink); box-shadow: 0 8px 24px rgba(255, 107, 44, .35); }
.btn-primary:hover { color: var(--primary-ink); background: #ff7c43; box-shadow: 0 10px 30px rgba(255, 107, 44, .45); }
.btn-ghost { background: rgba(255, 255, 255, .07); color: var(--text); border: 1px solid rgba(255, 255, 255, .12); }
.btn-ghost:hover { color: var(--text); background: rgba(255, 255, 255, .12); }
.btn-small { min-height: 40px; padding: 0 16px; font-size: .92rem; }

/* ---------- Hero ---------- */
.hero { position: relative; overflow: hidden; padding: 64px 0 72px; text-align: center; }
.hero-glow {
  position: absolute; inset: -30% -20% auto; height: 120%;
  background:
    radial-gradient(40% 45% at 30% 30%, rgba(255, 107, 44, .35), transparent 70%),
    radial-gradient(35% 40% at 72% 35%, rgba(255, 201, 60, .22), transparent 70%);
  filter: blur(20px);
  animation: glow 12s ease-in-out infinite alternate;
  pointer-events: none;
}
@keyframes glow { to { transform: translate3d(0, 4%, 0) scale(1.08); } }
.hero-in { position: relative; display: flex; flex-direction: column; align-items: center; }
.hero-logo {
  width: 112px; height: 112px; border-radius: 28px; box-shadow: 0 18px 50px rgba(255, 107, 44, .35);
  animation: pop .7s cubic-bezier(.2, .9, .3, 1.3) both;
}
@keyframes pop { from { opacity: 0; transform: scale(.7) rotate(-6deg); } }
.eyebrow {
  margin: 26px 0 8px; color: var(--accent); font-weight: 700; font-size: .8rem;
  letter-spacing: .14em; text-transform: uppercase;
}
.hero-title {
  font-family: var(--display); font-weight: 800; letter-spacing: -.03em;
  font-size: clamp(3rem, 14vw, 6.5rem); line-height: 1;
  background: linear-gradient(100deg, #fff 10%, var(--accent) 55%, var(--primary) 95%);
  -webkit-background-clip: text; background-clip: text; color: transparent;
  min-height: 1em;
}
.hero-tag { margin: 16px auto 0; max-width: 34ch; color: #ddd6cf; font-size: clamp(1.05rem, 3.6vw, 1.3rem); }
.hero-cta { display: flex; flex-wrap: wrap; justify-content: center; gap: 12px; margin-top: 30px; }
.live-pill {
  display: inline-flex; align-items: center; gap: 8px; margin: 26px 0 0;
  padding: 7px 14px; border-radius: 999px; font-size: .88rem; font-weight: 600;
  background: rgba(255, 107, 44, .12); border: 1px solid rgba(255, 107, 44, .35); color: #ffd2bd;
}
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--primary); box-shadow: 0 0 0 0 rgba(255, 107, 44, .7); animation: pulse 1.8s infinite; }
@keyframes pulse { 70% { box-shadow: 0 0 0 9px rgba(255, 107, 44, 0); } 100% { box-shadow: 0 0 0 0 rgba(255, 107, 44, 0); } }

/* ---------- Sezioni ---------- */
.section { padding: 64px 0; }
.section-alt { background: var(--bg-2); border-block: 1px solid rgba(255, 255, 255, .04); }
.h2 { font-family: var(--display); font-weight: 800; font-size: clamp(1.8rem, 6vw, 2.6rem); letter-spacing: -.02em; }
.h3 { font-family: var(--display); font-weight: 600; font-size: 1.2rem; margin: 30px 0 14px; }
.lead { color: var(--muted); font-size: 1.08rem; max-width: 62ch; margin: 12px 0 28px; }
.lead.small { font-size: 1rem; margin-bottom: 22px; }

.js .reveal { opacity: 0; transform: translateY(18px); transition: opacity .6s ease, transform .6s ease; }
.js .reveal.in { opacity: 1; transform: none; }

/* ---------- Funzionalità ---------- */
.features { display: grid; gap: 14px; grid-template-columns: 1fr; }
@media (min-width: 620px) { .features { grid-template-columns: 1fr 1fr; } }
@media (min-width: 960px) { .features { grid-template-columns: repeat(3, 1fr); } }
.feature {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 22px; transition: transform .25s ease, border-color .25s ease;
}
.feature:hover { transform: translateY(-3px); border-color: rgba(255, 107, 44, .45); }
.feature h3 { font-size: 1.12rem; margin: 14px 0 6px; font-family: var(--display); font-weight: 600; }
.feature p { margin: 0; color: var(--muted); font-size: .97rem; }
.f-ico {
  display: inline-grid; place-items: center; width: 46px; height: 46px; border-radius: 14px;
  background: linear-gradient(135deg, rgba(255, 107, 44, .22), rgba(255, 201, 60, .14));
}
.f-ico svg { width: 26px; height: 26px; fill: none; stroke: var(--accent); stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.f-ico svg .fill { fill: var(--primary); stroke: var(--primary); }

/* ---------- Statistiche ---------- */
.stats { display: grid; gap: 12px; grid-template-columns: 1fr 1fr; }
@media (min-width: 760px) { .stats { grid-template-columns: repeat(3, 1fr); } }
.stat {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 18px 16px; min-height: 104px;
}
.stat-value {
  display: block; font-family: var(--display); font-weight: 800; letter-spacing: -.02em;
  font-size: clamp(1.6rem, 7vw, 2.4rem); color: var(--text); font-variant-numeric: tabular-nums;
}
.stat-label { display: block; color: var(--muted); font-size: .92rem; margin-top: 4px; }
.stat.live .stat-value { color: var(--primary); }

/* ---------- Ricerca ---------- */
.search { position: relative; max-width: 620px; }
.search input {
  width: 100%; height: 56px; padding: 0 52px 0 50px; border-radius: 999px;
  background: var(--card); border: 1.5px solid var(--line); color: var(--text);
  font: inherit; font-size: 1.05rem; transition: border-color .2s, box-shadow .2s;
  -webkit-appearance: none; appearance: none;
}
.search input::placeholder { color: #8d8680; }
.search input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 4px rgba(255, 107, 44, .22); }
.search input::-webkit-search-cancel-button { display: none; }
.search-ico { position: absolute; left: 18px; top: 50%; width: 22px; height: 22px; transform: translateY(-50%); fill: none; stroke: var(--muted); stroke-width: 2; stroke-linecap: round; pointer-events: none; }
.search-clear {
  position: absolute; right: 8px; top: 50%; transform: translateY(-50%);
  width: 40px; height: 40px; border-radius: 50%; border: 0; background: transparent; cursor: pointer;
  display: grid; place-items: center;
}
.search-clear:hover { background: rgba(255, 255, 255, .08); }
.search-clear svg { width: 18px; height: 18px; stroke: var(--muted); stroke-width: 2.2; stroke-linecap: round; }
.search-status { color: var(--muted); min-height: 1.5em; margin: 14px 0 8px; font-size: .95rem; }

.people { display: grid; gap: 10px; grid-template-columns: 1fr; }
@media (min-width: 680px) { .people { grid-template-columns: 1fr 1fr; } }
.person {
  display: flex; align-items: center; gap: 14px; padding: 12px 14px; text-decoration: none; color: var(--text);
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius-sm);
  transition: border-color .2s, background .2s, transform .2s; animation: fadeUp .35s ease both;
}
.person:hover { color: var(--text); border-color: rgba(255, 107, 44, .5); background: var(--card-2); transform: translateY(-1px); }
.person-main { min-width: 0; flex: 1; }
.person-name { display: flex; align-items: center; gap: 5px; font-weight: 700; }
.person-name .txt, .person-user { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.person-user { display: block; color: var(--muted); font-size: .9rem; }
.person-meta { display: block; color: #d7d0c9; font-size: .85rem; margin-top: 2px; }
.chev { width: 18px; height: 18px; flex: none; fill: none; stroke: #6f6a65; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

@keyframes fadeUp { from { opacity: 0; transform: translateY(8px); } }

/* ---------- Avatar ---------- */
.avatar {
  position: relative; flex: none; width: 52px; height: 52px; border-radius: 50%; overflow: hidden;
  display: grid; place-items: center; background: var(--card-2);
  font-family: var(--display); font-weight: 800; color: #fff; font-size: 1.1rem; text-transform: uppercase;
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar.lg { width: 104px; height: 104px; font-size: 2.2rem; box-shadow: 0 0 0 4px var(--bg), 0 0 0 6px var(--primary); }
.avatar.md { width: 72px; height: 72px; font-size: 1.5rem; }

.verified { width: 17px; height: 17px; flex: none; }
.verified.lg { width: 24px; height: 24px; }

/* ---------- Tendenze ---------- */
.creators-row {
  display: grid; grid-auto-flow: column; grid-auto-columns: 148px; gap: 12px;
  overflow-x: auto; padding: 4px 2px 14px; scroll-snap-type: x mandatory; overscroll-behavior-x: contain;
  scrollbar-width: thin; scrollbar-color: #444 transparent;
}
.creator {
  scroll-snap-align: start; display: flex; flex-direction: column; align-items: center; text-align: center; gap: 4px;
  padding: 18px 10px 14px; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  text-decoration: none; color: var(--text); height: 100%; transition: border-color .2s, transform .2s;
}
.creator:hover { color: var(--text); border-color: rgba(255, 107, 44, .5); transform: translateY(-2px); }
.creator .rank { align-self: flex-start; margin: -8px 0 -6px -2px; color: var(--accent); font-weight: 800; font-size: .8rem; }
.creator .person-name { justify-content: center; max-width: 100%; margin-top: 8px; font-size: .95rem; }
.creator .person-user { max-width: 100%; font-size: .82rem; }
.creator .person-meta { font-size: .8rem; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  display: inline-flex; align-items: baseline; gap: 6px; padding: 8px 14px; border-radius: 999px;
  background: var(--card); border: 1px solid var(--line); font-weight: 700; font-size: .95rem;
}
.chip .hash { color: var(--primary); }
.chip small { color: var(--muted); font-weight: 500; font-size: .8rem; }

.grid { display: grid; gap: 6px; grid-template-columns: repeat(3, 1fr); }
@media (min-width: 760px) { .grid { grid-template-columns: repeat(4, 1fr); gap: 10px; } }
.tile {
  position: relative; aspect-ratio: 9 / 16; border-radius: 12px; overflow: hidden;
  background: linear-gradient(160deg, #2a2a2a, #1d1d1d); animation: fadeUp .4s ease both;
}
.tile img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.tile .ph {
  position: absolute; inset: 0; display: grid; place-items: center;
  background: radial-gradient(circle at 30% 20%, rgba(255, 107, 44, .25), transparent 60%), linear-gradient(160deg, #2b2b2b, #1c1c1c);
}
.tile .ph svg { width: 34px; height: 34px; fill: none; stroke: rgba(255, 255, 255, .35); stroke-width: 1.6; stroke-linejoin: round; }
.tile::after {
  content: ''; position: absolute; inset: auto 0 0; height: 55%;
  background: linear-gradient(transparent, rgba(0, 0, 0, .78)); pointer-events: none;
}
.tile-meta {
  position: absolute; z-index: 1; left: 8px; right: 8px; bottom: 7px;
  display: flex; flex-wrap: wrap; gap: 2px 10px; font-size: .78rem; font-weight: 700; color: #fff;
  text-shadow: 0 1px 3px rgba(0, 0, 0, .6);
}
.tile-meta span { display: inline-flex; align-items: center; gap: 3px; }
.tile-meta svg { width: 13px; height: 13px; fill: currentColor; }
.tile-user {
  position: absolute; z-index: 1; top: 7px; left: 7px; right: 7px; max-width: calc(100% - 14px);
  font-size: .76rem; font-weight: 700; color: #fff; text-decoration: none;
  background: rgba(0, 0, 0, .5); padding: 3px 8px; border-radius: 999px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; width: max-content;
}
.tile-user:hover { color: var(--accent); }
.tile-type {
  position: absolute; z-index: 1; top: 7px; right: 7px; width: 22px; height: 22px; border-radius: 50%;
  display: grid; place-items: center; background: rgba(0, 0, 0, .5);
}
.tile-type svg { width: 12px; height: 12px; fill: #fff; }

/* ---------- Skeleton / stati ---------- */
.sk {
  background: linear-gradient(90deg, #232323 0%, #2e2e2e 40%, #232323 80%);
  background-size: 300% 100%; animation: shimmer 1.4s linear infinite; border-radius: 10px;
}
@keyframes shimmer { from { background-position: 100% 0; } to { background-position: -50% 0; } }
.sk-line { height: 12px; margin: 6px 0; }
.sk-circle { border-radius: 50%; }
.stat .sk-line.big { height: 30px; width: 60%; margin-bottom: 12px; }
.sk-chip { display: inline-block; width: 96px; height: 38px; border-radius: 999px; }

.state {
  display: flex; flex-direction: column; align-items: center; text-align: center; gap: 10px;
  padding: 28px 16px; border: 1px dashed #3a3a3a; border-radius: var(--radius); color: var(--muted);
}
.state strong { color: var(--text); font-size: 1.05rem; }
.state svg { width: 36px; height: 36px; fill: none; stroke: var(--primary); stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.state.inline { grid-column: 1 / -1; }

/* ---------- FAQ ---------- */
.faq { display: grid; gap: 10px; }
.faq details { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius-sm); overflow: hidden; }
.faq details[open] { border-color: rgba(255, 107, 44, .4); }
.faq summary {
  cursor: pointer; list-style: none; padding: 18px 52px 18px 18px; font-weight: 700; position: relative;
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after {
  content: ''; position: absolute; right: 20px; top: 50%; width: 10px; height: 10px; margin-top: -7px;
  border-right: 2.5px solid var(--accent); border-bottom: 2.5px solid var(--accent);
  transform: rotate(45deg); transition: transform .25s ease;
}
.faq details[open] summary::after { transform: rotate(225deg); margin-top: -2px; }
.faq summary:focus-visible { outline-offset: -3px; border-radius: var(--radius-sm); }
.faq details p { margin: 0; padding: 0 18px 18px; color: var(--muted); }

/* ---------- Profilo ---------- */
.profile-wrap { padding-top: 22px; padding-bottom: 64px; min-height: 70vh; }
.back {
  display: inline-flex; align-items: center; gap: 6px; color: var(--muted); text-decoration: none;
  font-weight: 600; padding: 8px 12px 8px 6px; border-radius: 10px; margin-left: -6px;
}
.back:hover { color: var(--text); background: rgba(255, 255, 255, .06); }
.back svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.p-head { display: flex; flex-direction: column; align-items: center; text-align: center; padding: 22px 0 8px; animation: fadeUp .4s ease both; }
.p-name { display: flex; align-items: center; justify-content: center; gap: 8px; margin-top: 16px; font-family: var(--display); font-weight: 800; font-size: clamp(1.6rem, 6vw, 2.2rem); letter-spacing: -.02em; overflow-wrap: anywhere; }
.p-user { color: var(--muted); font-weight: 600; margin-top: 4px; overflow-wrap: anywhere; }
.p-bio { white-space: pre-line; max-width: 52ch; margin: 14px auto 0; color: #e2dbd4; overflow-wrap: anywhere; }
.p-joined { color: var(--muted); font-size: .9rem; margin-top: 10px; display: inline-flex; align-items: center; gap: 6px; }
.p-joined svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
.p-stats {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 24px auto 0; max-width: 560px;
}
@media (min-width: 560px) { .p-stats { grid-template-columns: repeat(5, 1fr); } }
.p-stat { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 12px 6px; text-align: center; }
.p-stat b { display: block; font-family: var(--display); font-size: 1.25rem; font-variant-numeric: tabular-nums; }
.p-stat span { color: var(--muted); font-size: .8rem; }
.p-section-t { font-family: var(--display); font-weight: 600; font-size: 1.15rem; margin: 30px 0 12px; }
.p-hashtags { justify-content: center; }

/* ---------- 404 ---------- */
.empty-page { min-height: 70vh; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding-top: 40px; padding-bottom: 60px; }
.big-code {
  margin: 0; font-family: var(--display); font-weight: 800; font-size: clamp(5rem, 28vw, 9rem); line-height: 1;
  background: linear-gradient(100deg, var(--accent), var(--primary)); -webkit-background-clip: text; background-clip: text; color: transparent;
}
.empty-page .h2:focus { outline: none; }

/* ---------- Footer ---------- */
.footer { border-top: 1px solid rgba(255, 255, 255, .06); padding: 32px 0 calc(32px + env(safe-area-inset-bottom)); background: #101010; }
.footer-in { display: grid; gap: 16px; }
@media (min-width: 760px) { .footer-in { grid-template-columns: auto 1fr; align-items: center; } .footer-note { grid-column: 1 / -1; } }
.footer-brand { display: inline-flex; align-items: center; gap: 10px; font-weight: 700; }
.footer-brand img { border-radius: 8px; }
.footer-links { display: flex; flex-wrap: wrap; gap: 6px 18px; }
@media (min-width: 760px) { .footer-links { justify-content: flex-end; } }
.footer-links a { color: var(--muted); text-decoration: none; font-weight: 600; padding: 6px 0; }
.footer-links a:hover { color: var(--text); text-decoration: underline; }
.footer-note { margin: 0; color: #8f8983; font-size: .85rem; }
.noscript { text-align: center; padding: 16px; background: #2a1a12; color: #ffd2bd; margin: 0; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; scroll-behavior: auto !important; }
  .js .reveal { opacity: 1; transform: none; }
}

/* ---------- Assistente in chat ---------- */
.chat-fab {
  position: fixed; right: 16px; bottom: 16px; z-index: 60;
  bottom: max(16px, env(safe-area-inset-bottom));
  width: 58px; height: 58px; border-radius: 50%; border: 0; cursor: pointer;
  display: grid; place-items: center; color: var(--primary-ink);
  background: linear-gradient(135deg, var(--accent), var(--primary));
  box-shadow: 0 10px 28px rgba(255, 107, 44, .45);
  transition: transform .2s, box-shadow .2s;
}
.chat-fab:hover { transform: translateY(-2px); box-shadow: 0 14px 34px rgba(255, 107, 44, .55); }
.chat-fab:active { transform: scale(.95); }
.chat-fab svg, .chat-panel svg { width: 26px; height: 26px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.chat-open .chat-fab { transform: scale(.9); }

.chat-panel {
  position: fixed; right: 16px; bottom: 88px; z-index: 61;
  width: 380px; max-width: calc(100vw - 32px);
  height: 560px; max-height: calc(100vh - 110px); max-height: calc(100dvh - 110px);
  display: flex; flex-direction: column; overflow: hidden;
  background: var(--bg-2); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: 0 20px 50px rgba(0, 0, 0, .55);
  animation: chatIn .22s ease both;
}
@keyframes chatIn { from { opacity: 0; transform: translateY(12px) scale(.98); } to { opacity: 1; transform: none; } }
.chat-head {
  display: flex; align-items: center; gap: 10px; padding: 12px 12px 12px 14px;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(135deg, rgba(255, 107, 44, .18), rgba(255, 201, 60, .08));
}
.chat-avatar {
  width: 36px; height: 36px; border-radius: 50%; flex: none; display: grid; place-items: center;
  color: var(--primary-ink); background: linear-gradient(135deg, var(--accent), var(--primary));
}
.chat-avatar svg { width: 20px; height: 20px; }
.chat-head-text { flex: 1; min-width: 0; }
.chat-title { font-family: var(--display); font-size: 1.08rem; font-weight: 800; overflow-wrap: anywhere; }
.chat-sub { color: var(--muted); font-family: var(--font); font-weight: 600; font-size: .9rem; }
.chat-close {
  width: 40px; height: 40px; flex: none; border: 0; border-radius: 50%; cursor: pointer;
  background: rgba(255, 255, 255, .07); display: grid; place-items: center;
}
.chat-close:hover { background: rgba(255, 255, 255, .14); }
.chat-close svg { width: 20px; height: 20px; }

.chat-list { flex: 1; overflow-y: auto; overscroll-behavior: contain; padding: 14px; display: flex; flex-direction: column; gap: 8px; }
.chat-msg {
  max-width: 85%; padding: 9px 13px; border-radius: 16px; font-size: .95rem; line-height: 1.45;
  overflow-wrap: anywhere; white-space: normal;
}
.chat-msg.bot { align-self: flex-start; background: var(--card-2); border-bottom-left-radius: 6px; }
.chat-msg.me { align-self: flex-end; background: var(--primary); color: var(--primary-ink); font-weight: 600; border-bottom-right-radius: 6px; }
.chat-msg.err { background: #2a1a12; color: #ffd2bd; border: 1px solid #4a2a1a; }
.chat-typing { display: flex; gap: 5px; padding: 13px 15px; }
.chat-typing[hidden] { display: none !important; }
.chat-typing span { width: 7px; height: 7px; border-radius: 50%; background: var(--muted); animation: chatDot 1.1s infinite ease-in-out; }
.chat-typing span:nth-child(2) { animation-delay: .15s; }
.chat-typing span:nth-child(3) { animation-delay: .3s; }
@keyframes chatDot { 0%, 80%, 100% { opacity: .3; transform: translateY(0); } 40% { opacity: 1; transform: translateY(-3px); } }

.chat-foot { border-top: 1px solid var(--line); padding: 10px 12px 8px; }
.chat-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.chat-chip {
  border: 1px solid rgba(255, 201, 60, .35); background: rgba(255, 201, 60, .08); color: var(--text);
  border-radius: 999px; padding: 6px 12px; font-size: .85rem; font-weight: 600; cursor: pointer;
}
.chat-chip:hover { background: rgba(255, 201, 60, .16); }
.chat-form { display: flex; align-items: flex-end; gap: 8px; }
.chat-input {
  flex: 1; min-width: 0; resize: none; min-height: 44px; max-height: 120px; overflow-y: hidden;
  padding: 11px 14px; border-radius: 14px; border: 1px solid var(--line);
  background: var(--card); color: var(--text); font: inherit; font-size: 16px; line-height: 1.35;
}
.chat-input:focus { outline: none; border-color: var(--accent); }
.chat-send {
  width: 44px; height: 44px; flex: none; border: 0; border-radius: 50%; cursor: pointer;
  display: grid; place-items: center; color: var(--primary-ink); background: var(--primary);
}
.chat-send:disabled { opacity: .5; cursor: default; }
.chat-send svg { width: 20px; height: 20px; }
.chat-disclaimer { margin: 8px 2px 0; color: #8f8983; font-size: .75rem; text-align: center; }

@media (max-width: 480px) {
  .chat-panel {
    inset: 0; width: 100%; max-width: none; height: 100%; max-height: none;
    border-radius: 0; border: 0;
    padding-bottom: env(safe-area-inset-bottom);
  }
  .chat-open .chat-fab { display: none; }
  .chat-open, .chat-open body { overflow: hidden; }
}
