/* ANARCHISM.AFRICA — afrofuturist mobile-first system
   Themes (dark/light/system) + animation library, all driven by CSS variables
   so the backend CMS can override at runtime. */

:root {
  /* DARK theme — pure white on pure black, gold the only accent */
  --bg:        #000000;
  --bg-2:      #0c0c0c;
  --fg:        #ffffff;
  --fg-dim:    #cfcfcf;
  --muted:     #888888;
  --line:      rgba(255, 255, 255, 0.14);
  --accent:    #FFD700;
  --red:       #C8102E;
  --green:     #007749;
  --violet:    #8B00FF;
  --teal:      #00FFE0;
  --radius:    14px;
  --radius-lg: 22px;
  --max:       100vw;          /* full viewport width on every screen format */
  --content-pad-x: clamp(12px, 1.6vw, 24px);  /* small breathing room only — content spans edge to edge */
  --shadow:    0 20px 60px rgba(0,0,0,.5);
  --grain-opacity: .35;
  --enter-anim: aa-fade-up;          /* default content-load animation */
  --enter-dur:  .55s;
  --grain:     url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='160' height='160'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' seed='3'/><feColorMatrix values='0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 .06 0'/></filter><rect width='100%25' height='100%25' filter='url(%23n)'/></svg>");
}

/* LIGHT theme — pure black on pure white, accent stays gold */
[data-theme="light"] {
  --bg:        #ffffff;
  --bg-2:      #f5f5f5;
  --fg:        #000000;
  --fg-dim:    #2a2a2a;
  --muted:     #777777;
  --line:      rgba(0, 0, 0, 0.14);
  --accent:    #FFD700;
  --shadow:    0 20px 60px rgba(0,0,0,.1);
  --grain-opacity: .08;
}

/* SYSTEM mode — follow OS preference */
@media (prefers-color-scheme: light) {
  [data-theme="system"] {
    --bg:        #ffffff;
    --bg-2:      #f5f5f5;
    --fg:        #000000;
    --fg-dim:    #2a2a2a;
    --muted:     #777777;
    --line:      rgba(0, 0, 0, 0.14);
    --accent:    #FFD700;
    --shadow:    0 20px 60px rgba(0,0,0,.1);
    --grain-opacity: .08;
  }
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; }
html { background: var(--bg); }
body {
  font-family: 'Space Grotesk', 'Inter', system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  background: var(--bg);
  color: var(--fg);
  font-size: 16px;
  line-height: 1.5;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}
body::before {
  content: ''; position: fixed; inset: 0; pointer-events: none;
  background-image: var(--grain); opacity: var(--grain-opacity); z-index: 999; mix-blend-mode: overlay;
}

/* ============================================================
   RESPONSIVE BREAKPOINTS — mobile-first, flex everywhere
   sm ≥ 600px (large phone / small tablet)
   md ≥ 768px (tablet)
   lg ≥ 1024px (desktop)
   xl ≥ 1280px (wide)
   ============================================================ */

a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }

h1, h2, h3 { font-family: 'Bebas Neue', 'Anton', 'Space Grotesk', system-ui; letter-spacing: .02em; line-height: 1.05; margin: 0 0 .4em; }
h1 { font-size: clamp(2rem, 7vw, 4rem); }
h2 { font-size: clamp(1.4rem, 4vw, 2rem); }
h3 { font-size: 1.05rem; letter-spacing: .08em; text-transform: uppercase; }
.mono { font-family: 'JetBrains Mono', ui-monospace, monospace; }

/* TOP NAV ----------------------------------------------------------------- */
.topbar {
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; justify-content: space-between;
  flex-wrap: wrap; row-gap: 8px;
  padding: 10px var(--content-pad-x);
  background: color-mix(in srgb, var(--bg) 90%, transparent);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
  width: 100%; max-width: 100vw; overflow: hidden;
}
.brand { display: flex; align-items: center; gap: 12px; font-weight: 700; letter-spacing: .1em; font-size: 1rem; }
@media (min-width: 600px) { .brand { font-size: 1.1rem; gap: 14px; } }
@media (min-width: 1024px) { .brand { font-size: 1.2rem; } }

.brand .logo {
  width: 40px; height: 40px; border-radius: 50%;
  position: relative;
  flex: 0 0 auto;
  --custom-logo: none;
  overflow: hidden;
  isolation: isolate;
}
@media (min-width: 600px) { .brand .logo { width: 44px; height: 44px; } }
.brand .logo::before {
  /* outer ring — rotating pan-african conic, the "moving GIF" feel */
  content: ''; position: absolute; inset: 0; border-radius: 50%;
  background: conic-gradient(from 0deg, var(--red), var(--accent), var(--green), var(--violet), var(--teal), var(--red));
  animation: aa-logo-spin 9s linear infinite;
  z-index: 1;
}
.brand .logo::after {
  /* inner core — sits still, holds the glyph */
  content: 'A'; position: absolute; inset: 4px; border-radius: 50%;
  display: grid; place-items: center;
  font-family: 'Bebas Neue', sans-serif; color: var(--accent);
  font-size: 22px; line-height: 1;
  background: var(--bg);
  z-index: 2;
  text-shadow: 0 0 12px var(--accent);
  animation: aa-logo-pulse 2.4s ease-in-out infinite;
}
@media (min-width: 600px) { .brand .logo::after { font-size: 26px; inset: 5px; } }

/* Admin-uploaded image overrides the auto-generated face */
.brand .logo.custom::before { animation: aa-logo-spin 14s linear infinite; opacity: .6; }
.brand .logo.custom::after  {
  content: ''; background: var(--custom-logo) center/cover no-repeat, var(--bg);
  text-shadow: none;
}

@keyframes aa-logo-spin  { to { transform: rotate(360deg); } }
@keyframes aa-logo-pulse {
  0%, 100% { text-shadow: 0 0 6px var(--accent); transform: scale(1); }
  50%      { text-shadow: 0 0 18px var(--accent), 0 0 32px var(--violet); transform: scale(1.04); }
}
.topbar-actions { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; min-width: 0; }
@media (min-width: 600px) { .topbar-actions { gap: 10px; } }

.brand { min-width: 0; flex: 1 1 auto; }
.brand .logoword { min-width: 0; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.brand .logoword .word { overflow: hidden; text-overflow: ellipsis; }

/* Hide the role tag on phones — it's not actionable */
@media (max-width: 540px) {
  .topbar #role-tag { display: none; }
  /* Compress button text on phones */
  .topbar .btn { padding: 7px 11px; font-size: .72rem; }
  .topbar-actions { gap: 4px; }
}

/* Tiny phones — drop the wordmark, keep just the round logo */
@media (max-width: 380px) {
  .brand .logoword { display: none; }
  .logo-shuffle { display: none; }
}
.btn {
  border: 1px solid var(--line); background: transparent; color: var(--fg);
  padding: 8px 14px; border-radius: 999px; font: inherit; font-size: .8rem; letter-spacing: .08em;
  text-transform: uppercase; cursor: pointer; transition: all .2s;
}
.btn:hover { background: var(--fg); color: #000; border-color: var(--fg); }
.btn.primary { background: var(--accent); color: #000; border-color: var(--accent); font-weight: 600; }
.btn.primary:hover { background: var(--fg); }
.btn.ghost { border-color: var(--line); color: var(--fg-dim); }

/* TABS -------------------------------------------------------------------- */
/* Old horizontal pill row — kept for fallback / non-app pages but hidden when
   the new left rail is present (rail markup adds .has-rail to <body>). */
.tabs {
  display: flex; gap: 4px; overflow-x: auto; padding: 8px 12px 10px;
  background: var(--bg);
  border-bottom: 1px solid var(--line);
  position: sticky; top: 53px; z-index: 25;
  scrollbar-width: none;
}
.tabs::-webkit-scrollbar { display: none; }
.tab {
  flex: 0 0 auto; padding: 10px 16px; border-radius: 999px;
  font-size: .78rem; letter-spacing: .12em; text-transform: uppercase;
  color: var(--fg-dim); border: 1px solid transparent; cursor: pointer;
  white-space: nowrap; user-select: none;
  transition: all .2s;
}
.tab:hover { color: var(--fg); }
.tab.active { background: var(--fg); color: #000; border-color: var(--fg); font-weight: 600; }
body.has-rail .tabs { display: none; }

/* LEFT RAIL — collapsed = icons only, expanded = icon + label
   Mobile: overlay drawer · Desktop: pushes content */
.rail {
  position: fixed; left: 0; top: 56px; bottom: 60px; z-index: 28;
  width: 64px; padding: 8px 6px; gap: 2px;
  display: flex; flex-direction: column;
  background: color-mix(in srgb, var(--bg) 96%, transparent);
  border-right: 1px solid var(--line);
  overflow-y: auto; overflow-x: hidden;
  transition: width .26s ease, transform .26s ease;
  scrollbar-width: none;
}
.rail::-webkit-scrollbar { display: none; }
.rail.expanded { width: 220px; }

.rail .rail-item {
  display: flex; align-items: center; gap: 14px;
  padding: 10px 12px; border-radius: 10px;
  color: var(--fg-dim); cursor: pointer;
  border: 1px solid transparent; background: transparent;
  font: inherit; font-size: .82rem; letter-spacing: .05em;
  white-space: nowrap;
  transition: background .15s, color .15s, border-color .15s;
  width: 100%; text-align: left;
}
.rail .rail-item:hover { background: var(--bg-2); color: var(--fg); }
.rail .rail-item.active {
  background: var(--accent); color: var(--bg); font-weight: 600;
  border-color: var(--accent);
}
.rail .rail-item .glyph {
  flex: 0 0 auto; width: 24px; height: 24px;
  display: inline-flex; align-items: center; justify-content: center;
}
.rail .rail-item .glyph svg { width: 22px; height: 22px; }
.rail .rail-item .glyph svg * { fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.rail .rail-item .glyph svg .fill { fill: currentColor; stroke: none; }

/* Label hidden when collapsed */
.rail:not(.expanded) .rail-item { justify-content: center; padding: 12px 0; }
.rail:not(.expanded) .rail-item .label { display: none; }

/* Mobile drawer behaviour */
@media (max-width: 768px) {
  .rail { transform: translateX(-100%); width: 220px; box-shadow: var(--shadow); }
  .rail.expanded { transform: translateX(0); width: 220px; }
  .rail.expanded .rail-item { justify-content: flex-start; padding: 10px 12px; }
  .rail.expanded .rail-item .label { display: inline; }
  body.has-rail main, body.has-rail .footer, body.has-rail section.view { padding-left: var(--content-pad-x); }
}

/* Desktop push */
@media (min-width: 769px) {
  body.has-rail main, body.has-rail section.view { padding-left: calc(64px + var(--content-pad-x)); transition: padding-left .26s ease; }
  body.has-rail.rail-open main, body.has-rail.rail-open section.view { padding-left: calc(220px + var(--content-pad-x)); }
  body.has-rail .footer { padding-left: calc(64px + var(--content-pad-x)); }
  body.has-rail.rail-open .footer { padding-left: calc(220px + var(--content-pad-x)); }
}

/* Mobile backdrop when drawer open */
.rail-backdrop {
  position: fixed; inset: 56px 0 60px 0; background: rgba(0,0,0,.5);
  z-index: 27; opacity: 0; pointer-events: none;
  transition: opacity .25s;
}
body.rail-open .rail-backdrop { opacity: 1; pointer-events: auto; }
@media (min-width: 769px) { .rail-backdrop { display: none; } }

/* MENU TOGGLE BUTTON (top-left) ------------------------------------------ */
.menu-toggle {
  display: inline-flex; align-items: center; justify-content: center;
  width: 44px; height: 44px; border-radius: 50%;
  background: transparent; border: 0; cursor: pointer;
  padding: 0; margin: 0;
  position: relative;
}
.menu-toggle .logo { width: 40px; height: 40px; pointer-events: none; }

/* FIXED BOTTOM BAR -------------------------------------------------------- */
.bottombar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 35;
  display: flex; align-items: stretch;
  background: color-mix(in srgb, var(--bg) 96%, transparent);
  backdrop-filter: blur(14px);
  border-top: 1px solid var(--line);
  height: 60px;
  padding: 0 6px;
}
.bottombar button {
  flex: 1 1 0; min-width: 0;
  background: transparent; border: 0; color: var(--fg-dim);
  cursor: pointer; font: inherit;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 3px; padding: 6px 4px;
  font-size: .65rem; letter-spacing: .12em; text-transform: uppercase;
  transition: color .15s;
}
.bottombar button .glyph { width: 22px; height: 22px; display: inline-flex; }
.bottombar button .glyph svg { width: 22px; height: 22px; }
.bottombar button .glyph svg * { fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.bottombar button .glyph svg .fill { fill: currentColor; stroke: none; }
.bottombar button:hover, .bottombar button.active { color: var(--accent); }
.bottombar button.active .glyph svg .fill { fill: var(--accent); }

@media (min-width: 769px) { .bottombar { padding: 0 calc(64px + 12px) 0 calc(64px + 12px); } body.rail-open .bottombar { padding-left: calc(220px + 12px); padding-right: calc(220px + 12px); } }

/* Reserve space for the fixed bottom bar */
body.has-rail { padding-bottom: 60px; }
.chat-fab { bottom: 78px; }      /* lift above bottom bar */
.chat-panel { bottom: 78px; }
.role-strip { bottom: 60px; }

/* Afro-futurist tab icons — adinkra-inspired glyphs, theme-aware */
.tab .glyph {
  display: inline-flex; vertical-align: -3px; margin-right: 6px;
  width: 16px; height: 16px;
}
.tab .glyph svg { width: 100%; height: 100%; }
.tab .glyph svg * { fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.tab .glyph svg .fill { fill: currentColor; stroke: none; }
.tab.active .glyph { filter: drop-shadow(0 0 6px rgba(0,0,0,.2)); }
@media (min-width: 768px) { .tab .glyph { width: 18px; height: 18px; } }

/* SECTIONS ---------------------------------------------------------------- */
section.view {
  display: none;
  padding: 16px var(--content-pad-x);
  max-width: 100%;
  width: 100%;
  margin: 0 auto;
}
section.view.active { display: block; animation: fadeIn .35s ease; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

.section-head { display: flex; align-items: end; justify-content: space-between; margin: 8px 0 18px; }
.section-head h2 { margin: 0; }
.section-head .lead { color: var(--fg-dim); max-width: 60ch; font-size: .95rem; }

/* HERO SLIDESHOW ---------------------------------------------------------- */
.hero {
  position: relative; aspect-ratio: 9 / 16; max-height: 78vh; min-height: 420px;
  width: 100%; overflow: hidden; border-radius: 0; background: #000;
}
@media (min-width: 720px) { .hero { aspect-ratio: 16 / 9; max-height: 80vh; } }
.hero .slide {
  position: absolute; inset: 0; opacity: 0; transition: opacity .8s ease;
  pointer-events: none;
}
.hero .slide.active { opacity: 1; pointer-events: auto; }
.hero .slide img,
.hero .slide video {
  position: absolute; inset: 0; width: 100%; height: 100%;
  object-fit: cover; object-position: center;
}
.hero .slide::after {
  content: ''; position: absolute; inset: 0;
  background: linear-gradient(180deg, rgba(0,0,0,.15) 0%, rgba(0,0,0,.25) 40%, rgba(10,10,10,.95) 100%);
}
.hero-overlay {
  position: absolute; inset: auto 0 0 0; padding: 28px 20px 36px;
  display: flex; flex-direction: column; gap: 10px; z-index: 2;
}
.hero-kicker {
  display: inline-flex; align-items: center; gap: 8px;
  font-size: .72rem; letter-spacing: .25em; text-transform: uppercase;
  color: var(--accent); font-weight: 600;
}
.hero-kicker .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); animation: pulse 1.4s infinite; }
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: .3; } }
.hero h1 { color: var(--fg); text-shadow: 0 2px 30px rgba(0,0,0,.6); max-width: 22ch; }
.hero .hero-sub { color: var(--fg-dim); max-width: 50ch; font-size: 1rem; }
.hero-cta { margin-top: 10px; display: flex; gap: 10px; flex-wrap: wrap; }

.hero-progress {
  position: absolute; top: 14px; left: 16px; right: 16px;
  display: flex; gap: 6px; z-index: 3;
}
.hero-progress span {
  flex: 1; height: 3px; background: rgba(255,255,255,.15); border-radius: 2px; overflow: hidden;
}
.hero-progress span::after {
  content: ''; display: block; height: 100%; width: 0; background: var(--accent);
}
.hero-progress span.active::after { width: 100%; transition: width var(--interval, 7000ms) linear; }
.hero-progress span.done::after { width: 100%; }

.hero-controls {
  position: absolute; right: 14px; bottom: 14px; z-index: 3; display: flex; gap: 8px;
}
.hero-controls button {
  width: 38px; height: 38px; border-radius: 50%; border: 1px solid var(--line);
  background: rgba(0,0,0,.5); color: var(--fg); cursor: pointer; backdrop-filter: blur(6px);
  display: grid; place-items: center; font-size: 14px;
}

/* GRID CARDS -------------------------------------------------------------- */
.grid {
  display: grid; gap: 14px;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
}
.card {
  background: var(--bg-2); border: 1px solid var(--line); border-radius: var(--radius);
  overflow: hidden; cursor: pointer; transition: transform .2s, border-color .2s;
  display: flex; flex-direction: column;
}
.card:hover { transform: translateY(-3px); border-color: rgba(255,215,0,.4); }
.card .thumb {
  aspect-ratio: 4 / 3; background: #1b1815 center/cover no-repeat; position: relative;
}
.card .badge {
  position: absolute; top: 10px; left: 10px;
  background: rgba(0,0,0,.6); color: var(--accent); font-size: .65rem; font-weight: 700;
  letter-spacing: .15em; padding: 4px 8px; border-radius: 4px; text-transform: uppercase;
  backdrop-filter: blur(4px);
}
.card .body { padding: 14px; }
.card h3 { margin: 0 0 6px; font-family: 'Space Grotesk', sans-serif; font-size: 1rem; letter-spacing: 0; text-transform: none; }
.card .meta { color: var(--muted); font-size: .8rem; }
.card .summary { color: var(--fg-dim); font-size: .9rem; margin-top: 8px; }

/* MERCH-SPECIFIC ---------------------------------------------------------- */
.merch-card .price {
  display: flex; align-items: baseline; gap: 8px; margin-top: 8px;
}
.merch-card .price strong { color: var(--accent); font-size: 1.15rem; }
.eco-tags { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.eco-tag {
  font-size: .65rem; padding: 2px 7px; border-radius: 99px;
  background: rgba(0,119,73,.18); color: #6fffa0; border: 1px solid rgba(0,119,73,.4);
  letter-spacing: .08em; text-transform: uppercase; font-weight: 600;
}
.carbon-bar {
  margin-top: 6px; height: 4px; border-radius: 2px; background: rgba(255,255,255,.08); overflow: hidden;
}
.carbon-bar > i {
  display: block; height: 100%; background: linear-gradient(90deg, var(--green), var(--accent));
}

/* AMBASSADOR + COMMUNITY -------------------------------------------------- */
.amb-row, .post-row {
  display: flex; gap: 14px; padding: 14px; background: var(--bg-2);
  border: 1px solid var(--line); border-radius: var(--radius); margin-bottom: 10px;
}
.amb-row .avatar, .post-row .avatar {
  width: 44px; height: 44px; border-radius: 50%; flex: 0 0 auto;
  background: linear-gradient(135deg, var(--violet), var(--red));
  display: grid; place-items: center; font-weight: 700; color: #fff;
}
.amb-row .meta, .post-row .meta { color: var(--muted); font-size: .8rem; }
.status-pill { font-size: .65rem; padding: 3px 8px; border-radius: 99px; text-transform: uppercase; letter-spacing: .1em; }
.status-pill.active   { background: rgba(0,119,73,.2); color: #6fffa0; }
.status-pill.pending  { background: rgba(255,215,0,.15); color: var(--accent); }
.status-pill.hot      { background: rgba(200,16,46,.18); color: #ff7d8a; }

/* CROWDFUND --------------------------------------------------------------- */
.cf-card { display: flex; gap: 14px; padding: 14px; background: var(--bg-2); border: 1px solid var(--line); border-radius: var(--radius); margin-bottom: 12px; }
.cf-card .thumb { width: 96px; height: 96px; border-radius: 10px; background-size: cover; background-position: center; flex: 0 0 auto; }
.cf-card .progress { height: 6px; border-radius: 3px; background: rgba(255,255,255,.08); margin: 8px 0 6px; overflow: hidden; }
.cf-card .progress > i { display: block; height: 100%; background: linear-gradient(90deg, var(--accent), var(--red)); }

/* DETAIL MODAL ------------------------------------------------------------ */
.modal {
  position: fixed; inset: 0; background: rgba(0,0,0,.85); backdrop-filter: blur(8px);
  z-index: 60; display: none; align-items: flex-start; justify-content: center;
  padding: 20px; overflow-y: auto;
}
.modal.open { display: flex; animation: fadeIn .25s ease; }
.modal .panel {
  width: 100%; max-width: 760px; background: var(--bg-2); border: 1px solid var(--line);
  border-radius: var(--radius-lg); overflow: hidden; box-shadow: var(--shadow);
}
.modal .panel-head {
  position: relative; aspect-ratio: 16/9; background: #000 center/cover no-repeat;
}
.modal .panel-head .close {
  position: absolute; top: 12px; right: 12px; z-index: 2;
  width: 36px; height: 36px; border-radius: 50%; border: 1px solid var(--line);
  background: rgba(0,0,0,.6); color: #fff; cursor: pointer;
}
.modal .panel-body { padding: 22px; }
.modal h2 { margin-top: 0; }

/* CHAT WIDGET ------------------------------------------------------------- */
.chat-fab {
  position: fixed; bottom: 18px; right: 18px; z-index: 50;
  width: 58px; height: 58px; border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--red));
  color: #000; font-weight: 800; display: grid; place-items: center;
  cursor: pointer; box-shadow: 0 10px 30px rgba(0,0,0,.6);
  border: none; font-size: 12px; letter-spacing: .1em;
}
.chat-panel {
  position: fixed; bottom: 18px; right: 18px; width: min(380px, calc(100vw - 24px));
  height: min(560px, 78vh); z-index: 51; background: var(--bg-2);
  border: 1px solid var(--line); border-radius: var(--radius-lg);
  box-shadow: var(--shadow); display: none; flex-direction: column; overflow: hidden;
}
.chat-panel.open { display: flex; animation: fadeIn .25s ease; }
.chat-head { padding: 14px 16px; border-bottom: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; }
.chat-head .title { font-weight: 700; letter-spacing: .15em; font-size: .8rem; }
.chat-head .model-pick { font-size: .7rem; padding: 4px 8px; background: var(--bg); border: 1px solid var(--line); border-radius: 99px; color: var(--fg-dim); }
.chat-body { flex: 1; padding: 14px; overflow-y: auto; display: flex; flex-direction: column; gap: 10px; }
.chat-msg { padding: 10px 12px; border-radius: 12px; max-width: 88%; font-size: .9rem; line-height: 1.4; }
.chat-msg.user { background: var(--accent); color: #000; align-self: flex-end; border-bottom-right-radius: 4px; }
.chat-msg.bot  { background: #1f1c19; color: var(--fg); align-self: flex-start; border-bottom-left-radius: 4px; }
.chat-form { display: flex; gap: 8px; padding: 10px; border-top: 1px solid var(--line); }
.chat-form input { flex: 1; padding: 10px 12px; border: 1px solid var(--line); background: var(--bg); color: var(--fg); border-radius: 99px; font: inherit; }
.chat-form button { padding: 10px 14px; border-radius: 99px; border: 0; background: var(--accent); color: #000; font-weight: 700; cursor: pointer; }

/* MINI PLAYER (sticky, above bottombar) ---------------------------------- */
.mini-player {
  position: fixed; left: 0; right: 0; bottom: 60px; z-index: 36;
  display: none; align-items: center; gap: 10px;
  padding: 8px 12px;
  background: color-mix(in srgb, var(--bg) 95%, transparent);
  backdrop-filter: blur(14px);
  border-top: 1px solid var(--line);
  font-size: .85rem;
}
.mini-player.show { display: flex; animation: aa-fade-up .3s; }
.mini-player .play {
  width: 36px; height: 36px; border-radius: 50%; flex: 0 0 auto;
  border: 1px solid var(--accent); background: var(--accent); color: var(--bg);
  cursor: pointer; font-weight: 800;
}
.mini-player .play.playing { background: transparent; color: var(--accent); }
.mini-player .info { flex: 1; min-width: 0; }
.mini-player .info b { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: .9rem; }
.mini-player .info span { color: var(--muted); font-size: .75rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: block; }
.mini-player .progress { flex: 0 0 80px; height: 4px; background: rgba(255,255,255,.1); border-radius: 2px; overflow: hidden; }
.mini-player .progress > i { display: block; height: 100%; width: 0; background: var(--accent); transition: width .25s linear; }
.mini-player .close {
  width: 28px; height: 28px; border-radius: 50%; flex: 0 0 auto;
  background: transparent; border: 1px solid var(--line); color: var(--fg-dim); cursor: pointer; font-size: 14px;
}
@media (min-width: 769px) {
  body.has-rail .mini-player { left: 64px; padding-right: 24px; }
  body.has-rail.rail-open .mini-player { left: 220px; }
}

/* PIN GATE OVERLAY ------------------------------------------------------- */
.pin-gate {
  position: fixed; inset: 0; z-index: 100;
  background: var(--bg); display: flex; align-items: center; justify-content: center;
  padding: 24px;
}
.pin-gate .panel { max-width: 360px; width: 100%; background: var(--bg-2); border: 1px solid var(--accent); border-radius: var(--radius-lg); padding: 28px; text-align: center; }
.pin-gate h2 { margin: 0 0 8px; }
.pin-gate p  { color: var(--fg-dim); margin: 0 0 20px; }
.pin-gate input {
  width: 100%; box-sizing: border-box; padding: 14px; border: 1px solid var(--line); background: var(--bg); color: var(--fg);
  border-radius: 10px; font: inherit; font-size: 1.4rem; letter-spacing: .6em; text-align: center;
}
.pin-gate.bad input { border-color: var(--red); animation: aa-undermode-jitter .2s 3; }

/* CUSTOMIZE SHEET --------------------------------------------------------- */
.customize-sheet {
  position: fixed; right: -460px; top: 0; bottom: 0; width: min(440px, 100vw);
  z-index: 60; background: var(--bg-2); border-left: 1px solid var(--line);
  display: flex; flex-direction: column; transition: right .35s ease;
  box-shadow: var(--shadow);
}
.customize-sheet.open { right: 0; }
.customize-head { display: flex; align-items: center; justify-content: space-between; padding: 16px 18px; border-bottom: 1px solid var(--line); }
.customize-head h3 { margin: 0; }
.customize-body { flex: 1; overflow-y: auto; padding: 16px 18px; display: flex; flex-direction: column; gap: 18px; }
.preset-list { display: flex; flex-direction: column; gap: 8px; }
.preset-card {
  display: flex; align-items: center; gap: 10px; padding: 10px 12px;
  border: 1px solid var(--line); border-radius: 10px; cursor: pointer; background: var(--bg);
}
.preset-card:hover { border-color: var(--accent); }
.preset-card .swatches { display: flex; gap: 4px; flex: 0 0 auto; }
.preset-card .swatches i { width: 14px; height: 14px; border-radius: 50%; display: block; border: 1px solid rgba(255,255,255,.2); }
.preset-card b { display: block; font-size: .9rem; }
.preset-card span { color: var(--muted); font-size: .7rem; text-transform: uppercase; letter-spacing: .12em; }
.preset-card .meta { flex: 1; min-width: 0; }
.preset-card .delete { padding: 4px 8px; border: 1px solid var(--line); background: transparent; color: var(--muted); border-radius: 6px; font-size: .7rem; cursor: pointer; }
.token-row {
  display: grid; grid-template-columns: 110px 1fr 80px; align-items: center; gap: 10px;
  margin-bottom: 8px;
}
.token-row label { font-size: .8rem; color: var(--fg-dim); }
.token-row input[type=color] { width: 100%; height: 36px; padding: 0; border: 1px solid var(--line); background: var(--bg); border-radius: 6px; cursor: pointer; }
.token-row input[type=text] { padding: 8px 10px; border: 1px solid var(--line); background: var(--bg); color: var(--fg); border-radius: 6px; font: inherit; font-size: .75rem; font-family: 'JetBrains Mono', monospace; }

/* MARKETPLACE SUBTABS ----------------------------------------------------- */
.subtabs { display: flex; gap: 6px; overflow-x: auto; margin: 0 0 16px; padding-bottom: 4px; scrollbar-width: none; }
.subtabs::-webkit-scrollbar { display: none; }
.subtab {
  flex: 0 0 auto; padding: 8px 14px; border-radius: 8px;
  border: 1px solid var(--line); background: var(--bg-2); color: var(--fg-dim);
  font: inherit; font-size: .78rem; letter-spacing: .1em; text-transform: uppercase; cursor: pointer;
  white-space: nowrap;
}
.subtab.active { background: var(--accent); color: var(--bg); border-color: var(--accent); font-weight: 700; }
.subtab:hover { color: var(--fg); }

/* External shop card / service card / seminar card / job card  */
.shop-card .thumb { aspect-ratio: 16/10; }
.shop-card .summary { color: var(--fg-dim); }
.shop-card .city {
  display: inline-block; font-size: .65rem; padding: 2px 8px; border-radius: 99px;
  background: rgba(255,215,0,.12); color: var(--accent);
  letter-spacing: .12em; text-transform: uppercase; font-weight: 700; margin-bottom: 6px;
}
.service-card .rate, .seminar-card .fee, .job-card .comp {
  display: inline-block; font-size: .75rem; padding: 3px 8px; border-radius: 99px;
  background: rgba(0,119,73,.18); color: #6fffa0; border: 1px solid rgba(0,119,73,.4);
  font-weight: 600; margin-top: 6px;
}
.seminar-card .when {
  font-size: .75rem; color: var(--accent); font-weight: 600; letter-spacing: .04em;
}

/* UNDERGROUND MODE — Konami code overlay -------------------------------- */
body.underground {
  filter: contrast(1.05) hue-rotate(-8deg);
}
body.underground::after {
  content: ''; position: fixed; inset: 0; z-index: 1000; pointer-events: none;
  background: repeating-linear-gradient(0deg, rgba(255,0,68,.04) 0 1px, transparent 1px 3px);
  mix-blend-mode: screen;
  animation: aa-undermode-flicker 4s steps(60) infinite;
}
body.underground .topbar, body.underground .tabs { background: rgba(0,0,0,.95); }
body.underground h1, body.underground h2 { animation: aa-undermode-jitter .4s steps(2) infinite; }
@keyframes aa-undermode-flicker { 50% { opacity: .7; } 51% { opacity: .35; } }
@keyframes aa-undermode-jitter  { 0%,100% { transform: translate(0); } 50% { transform: translate(1px, -1px); } }
.underground-toast {
  position: fixed; bottom: 90px; right: 18px; z-index: 1001;
  padding: 12px 18px; background: #000; color: var(--accent); border: 1px solid var(--accent);
  font-family: 'JetBrains Mono', monospace; font-size: .85rem; letter-spacing: .12em;
  text-transform: uppercase; box-shadow: 0 0 30px rgba(255,215,0,.4);
}

/* CLI INSTALL CARD --------------------------------------------------------
   Punk, underground, full-bleed terminal aesthetic for the install widget */
.cli-card {
  background: var(--bg-2); border: 1px solid var(--accent); border-radius: var(--radius);
  padding: 18px; margin: 14px 0;
  position: relative; overflow: hidden;
}
.cli-card::before {
  content: ''; position: absolute; inset: 0;
  background:
    repeating-linear-gradient(0deg, transparent, transparent 3px, rgba(255,255,255,.02) 3px, rgba(255,255,255,.02) 4px);
  pointer-events: none;
}
.cli-card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 8px; }
.cli-screen {
  background: #000; color: #5dff8a;
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: .82rem; line-height: 1.5;
  padding: 14px 16px; border-radius: 8px; border: 1px solid #1a3a1a;
  overflow-x: auto; white-space: nowrap;
  box-shadow: 0 0 0 1px rgba(255,215,0,.1) inset;
  margin: 0;
}
.cli-screen .cli-prompt { color: #FFD700; font-weight: 700; }
.cli-screen .cli-cmd { color: #6fffa0; }
.cli-screen .cli-comment { color: #6b6359; }
@media (min-width: 600px) { .cli-screen { font-size: .9rem; padding: 16px 20px; white-space: pre-wrap; word-break: break-all; } }

.cli-card.copied .btn.primary { background: var(--green); color: #fff; border-color: var(--green); }

/* FOOTER ------------------------------------------------------------------ */
.footer { padding: 50px var(--content-pad-x) 80px; width: 100%; margin: 30px auto 0; border-top: 1px solid var(--line); color: var(--muted); font-size: .85rem; display: grid; gap: 10px; }
.footer .row { display: flex; flex-wrap: wrap; gap: 16px; justify-content: space-between; }
.footer .signup { display: flex; gap: 8px; max-width: 420px; }
.footer .signup input { flex: 1; padding: 10px 14px; border: 1px solid var(--line); background: var(--bg-2); color: var(--fg); border-radius: 99px; font: inherit; }
.footer .signup button { padding: 10px 16px; border-radius: 99px; border: 0; background: var(--accent); color: #000; font-weight: 700; cursor: pointer; }

/* ROLE LOGIN STRIP -------------------------------------------------------- */
.role-strip {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 40;
  background: var(--bg-2); border-top: 1px solid var(--line);
  display: flex; gap: 6px; padding: 8px; overflow-x: auto;
  transform: translateY(120%); transition: transform .3s;
}
.role-strip.open { transform: translateY(0); }
.role-strip button {
  flex: 0 0 auto; padding: 8px 12px; border-radius: 99px; border: 1px solid var(--line);
  background: var(--bg); color: var(--fg-dim); font-size: .75rem; cursor: pointer;
  text-transform: uppercase; letter-spacing: .1em;
}
.role-strip button.active { background: var(--accent); color: #000; border-color: var(--accent); font-weight: 700; }

/* AUDIO ROW (music tab) --------------------------------------------------- */
.audio-row { display: flex; align-items: center; gap: 12px; padding: 12px; background: var(--bg-2); border: 1px solid var(--line); border-radius: var(--radius); margin-bottom: 8px; }
.audio-row .play { width: 44px; height: 44px; border-radius: 50%; border: 1px solid var(--accent); background: var(--accent); color: #000; cursor: pointer; font-weight: 800; flex: 0 0 auto; }
.audio-row .play.playing { background: var(--bg-2); color: var(--accent); }
.audio-row .info { flex: 1; min-width: 0; }
.audio-row .info h3 { margin: 0; font-family: 'Space Grotesk', sans-serif; text-transform: none; letter-spacing: 0; font-size: 1rem; }
.audio-row .info .meta { color: var(--muted); font-size: .8rem; }

/* UTILITIES --------------------------------------------------------------- */
.row-flex { display: flex; gap: 10px; flex-wrap: wrap; }
.tag { font-size: .7rem; padding: 4px 8px; border-radius: 99px; background: rgba(255,255,255,.05); border: 1px solid var(--line); color: var(--fg-dim); }
.divider { height: 1px; background: var(--line); margin: 24px 0; }

/* ADMIN OVERRIDES (loaded only on admin.html) ----------------------------- */
body.admin .admin-grid { display: grid; grid-template-columns: 1fr; gap: 16px; }
@media (min-width: 900px) { body.admin .admin-grid { grid-template-columns: 240px 1fr; } }
body.admin .sidenav { background: var(--bg-2); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px; height: fit-content; position: sticky; top: 70px; }
body.admin .sidenav button { width: 100%; text-align: left; padding: 10px 12px; border-radius: 8px; border: 0; background: transparent; color: var(--fg-dim); cursor: pointer; font: inherit; font-size: .9rem; }
body.admin .sidenav button.active { background: var(--accent); color: #000; font-weight: 600; }
body.admin .panel { background: var(--bg-2); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; }
body.admin .panel { overflow-x: auto; -webkit-overflow-scrolling: touch; }
body.admin .panel > table { min-width: 540px; }
body.admin table { width: 100%; border-collapse: collapse; font-size: .85rem; }
body.admin th, body.admin td { text-align: left; padding: 10px 8px; border-bottom: 1px solid var(--line); white-space: nowrap; }
@media (max-width: 600px) {
  body.admin th, body.admin td { padding: 8px 6px; font-size: .8rem; }
  body.admin .form-row input, body.admin .form-row textarea, body.admin .form-row select { width: 100%; max-width: 100%; box-sizing: border-box; }
  body.admin .panel form { max-width: 100%; }
  body.admin .panel form input, body.admin .panel form textarea, body.admin .panel form select { width: 100%; box-sizing: border-box; }
  body.admin .kpi { grid-template-columns: repeat(2, 1fr); gap: 8px; }
}
body.admin th { color: var(--muted); font-weight: 600; font-size: .75rem; letter-spacing: .12em; text-transform: uppercase; }
body.admin .form-row { display: grid; gap: 6px; margin-bottom: 12px; }
body.admin .form-row label { font-size: .75rem; color: var(--muted); letter-spacing: .1em; text-transform: uppercase; }
body.admin .form-row input, body.admin .form-row textarea, body.admin .form-row select {
  padding: 10px; border: 1px solid var(--line); background: var(--bg); color: var(--fg); border-radius: 8px; font: inherit;
}
body.admin textarea { min-height: 100px; }
body.admin .kpi { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px; margin-bottom: 18px; }
body.admin .kpi .stat { background: var(--bg); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; }
body.admin .kpi .stat b { font-size: 1.6rem; display: block; color: var(--accent); }
body.admin .kpi .stat span { font-size: .75rem; color: var(--muted); letter-spacing: .12em; text-transform: uppercase; }

/* ============================================================
   THEME TOGGLE (3-way segment in header)
   ============================================================ */
.theme-toggle {
  display: inline-flex; gap: 2px; padding: 3px;
  background: var(--bg-2); border: 1px solid var(--line); border-radius: 999px;
}
.theme-toggle button {
  width: 30px; height: 30px; border-radius: 999px; border: 0; background: transparent;
  color: var(--fg-dim); cursor: pointer; display: grid; place-items: center; font-size: 14px;
  transition: background .2s, color .2s;
}
.theme-toggle button.active { background: var(--accent); color: var(--bg); }
.theme-toggle button:hover { color: var(--fg); }

/* ============================================================
   HEADER LOGO — animated, font-rotating
   ============================================================ */
.brand .logoword {
  display: inline-flex; align-items: baseline; gap: 0;
  position: relative; min-width: 12ch;
  font-family: 'Bebas Neue', system-ui;
  letter-spacing: .03em; font-size: 1.05rem; line-height: 1;
}
@media (min-width: 600px) { .brand .logoword { font-size: 1.25rem; } }
@media (min-width: 1024px) { .brand .logoword { font-size: 1.4rem; } }
.brand .logoword .word {
  display: inline-block; will-change: transform, opacity, filter;
  white-space: nowrap;
}
.brand .logoword .dot { color: var(--accent); margin: 0 1px; }

.logo-shuffle {
  width: 22px; height: 22px; border-radius: 999px; border: 1px solid var(--line);
  background: transparent; color: var(--fg-dim); cursor: pointer;
  display: grid; place-items: center; font-size: 11px; transition: transform .25s, color .2s, background .2s;
  margin-left: 2px; padding: 0; line-height: 1;
}
@media (min-width: 600px) { .logo-shuffle { width: 24px; height: 24px; font-size: 12px; } }
.logo-shuffle:hover { color: var(--accent); border-color: var(--accent); }
.logo-shuffle:active { transform: rotate(360deg) scale(.9); }

/* ============================================================
   ENTRY ANIMATIONS — pickable from Studio. Default = aa-fade-up.
   Apply via: element { animation: var(--enter-anim) var(--enter-dur) both; }
   ============================================================ */
@keyframes aa-fade-up        { from { opacity:0; transform: translateY(14px); } to { opacity:1; transform:none; } }
@keyframes aa-slide-left     { from { opacity:0; transform: translateX(-30px); } to { opacity:1; transform:none; } }
@keyframes aa-slide-right    { from { opacity:0; transform: translateX( 30px); } to { opacity:1; transform:none; } }
@keyframes aa-scale-pop      { 0% { opacity:0; transform: scale(.92); } 60% { opacity:1; transform: scale(1.02); } 100% { transform: scale(1); } }
@keyframes aa-mask-reveal    { 0% { clip-path: inset(0 100% 0 0); opacity:0; } 100% { clip-path: inset(0 0 0 0); opacity:1; } }
@keyframes aa-blur-clear     { from { opacity:0; filter: blur(14px); transform: scale(.98); } to { opacity:1; filter: none; transform: none; } }
@keyframes aa-glitch-in      {
  0%   { opacity:0; transform: translate(0); filter: hue-rotate(0deg); }
  20%  { opacity:.4; transform: translate(-3px, 1px); filter: hue-rotate(80deg) contrast(1.4); }
  40%  { opacity:.6; transform: translate(2px,-2px); filter: hue-rotate(-40deg); }
  60%  { opacity:.85; transform: translate(-1px,1px); }
  100% { opacity:1; transform: none; filter: none; }
}
@keyframes aa-rise-rotate    { from { opacity:0; transform: translateY(20px) rotate(-2deg); } to { opacity:1; transform: none; } }
@keyframes aa-flip-y         { from { opacity:0; transform: perspective(900px) rotateY(-30deg); } to { opacity:1; transform: none; } }
@keyframes aa-iris-in        { 0% { clip-path: circle(0% at 50% 60%); opacity:0; } 100% { clip-path: circle(140% at 50% 60%); opacity:1; } }
@keyframes aa-marquee-in     { from { opacity:0; transform: translateX(-100%); } to { opacity:1; transform:none; } }

/* Entry classes — added by JS via the .anim-enter helper */
.anim-enter { animation: var(--enter-anim) var(--enter-dur) both; }
.anim-stagger > * { animation: var(--enter-anim) var(--enter-dur) both; }
.anim-stagger > *:nth-child(2) { animation-delay: .06s; }
.anim-stagger > *:nth-child(3) { animation-delay: .12s; }
.anim-stagger > *:nth-child(4) { animation-delay: .18s; }
.anim-stagger > *:nth-child(5) { animation-delay: .24s; }
.anim-stagger > *:nth-child(6) { animation-delay: .30s; }
.anim-stagger > *:nth-child(7) { animation-delay: .36s; }
.anim-stagger > *:nth-child(8) { animation-delay: .42s; }
.anim-stagger > *:nth-child(n+9) { animation-delay: .48s; }

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  .anim-enter, .anim-stagger > * { animation: none !important; }
  .brand .logoword .word { animation: none !important; }
}

/* ============================================================
   LOGO ENTRY ANIMATIONS — applied per random pick
   ============================================================ */
@keyframes logo-glitch {
  0%   { transform: translate(0); filter: none; opacity: 0; }
  10%  { transform: translate(-3px, 0); filter: hue-rotate(60deg) contrast(1.5); opacity: .7; }
  20%  { transform: translate(3px, -1px); filter: hue-rotate(-60deg); }
  30%  { transform: translate(-2px, 2px); filter: invert(.2); }
  40%  { transform: translate(0); filter: none; opacity: 1; }
  100% { transform: translate(0); filter: none; opacity: 1; }
}
@keyframes logo-slice    { 0% { clip-path: inset(0 0 100% 0); opacity:0; } 100% { clip-path: inset(0); opacity:1; } }
@keyframes logo-scramble { 0% { letter-spacing: 1em; opacity: 0; filter: blur(8px); } 100% { letter-spacing: .04em; opacity: 1; filter: none; } }
@keyframes logo-bounce   { 0% { transform: translateY(-30px); opacity: 0; } 60% { transform: translateY(4px); opacity: 1; } 100% { transform: translateY(0); } }
@keyframes logo-flip     { 0% { transform: perspective(800px) rotateX(-90deg); opacity: 0; } 100% { transform: none; opacity: 1; } }
@keyframes logo-zoom     { 0% { transform: scale(0.2); opacity: 0; filter: blur(20px); } 100% { transform: scale(1); opacity: 1; filter: none; } }
@keyframes logo-typeon   { from { clip-path: inset(0 100% 0 0); } to { clip-path: inset(0 0 0 0); } }
@keyframes logo-neon     {
  0% { opacity: 0; text-shadow: none; }
  20% { opacity: .4; text-shadow: 0 0 14px var(--accent); }
  40% { opacity: .8; text-shadow: 0 0 20px var(--accent), 0 0 40px var(--violet); }
  60% { opacity: .6; text-shadow: 0 0 4px var(--accent); }
  100% { opacity: 1; text-shadow: 0 0 12px var(--accent); }
}
@keyframes logo-rotate3d { 0% { transform: rotateY(180deg); opacity: 0; } 100% { transform: none; opacity: 1; } }
@keyframes logo-marquee  { 0% { transform: translateX(120%); opacity: 0; } 100% { transform: translateX(0); opacity: 1; } }
@keyframes logo-shake    { 0% { transform: translateX(0); opacity:0; } 20% { transform: translateX(-8px); opacity:1; } 40% { transform: translateX(8px); } 60% { transform: translateX(-4px); } 80% { transform: translateX(4px); } 100% { transform: none; } }
@keyframes logo-fall     { 0% { transform: translateY(-100px) rotate(-15deg); opacity:0; } 70% { transform: translateY(8px) rotate(2deg); opacity:1; } 100% { transform: none; } }
@keyframes logo-warp     { 0% { transform: skewX(40deg) scaleX(.4); opacity:0; filter:blur(6px); } 100% { transform:none; opacity:1; filter:none; } }

.brand .logoword .word.is-anim { display: inline-block; }
.brand .logoword .word.anim-glitch    { animation: logo-glitch    .9s both; }
.brand .logoword .word.anim-slice     { animation: logo-slice     .55s ease-out both; }
.brand .logoword .word.anim-scramble  { animation: logo-scramble  .8s ease-out both; }
.brand .logoword .word.anim-bounce    { animation: logo-bounce    .8s cubic-bezier(.7,1.6,.3,.9) both; }
.brand .logoword .word.anim-flip      { animation: logo-flip      .7s both; }
.brand .logoword .word.anim-zoom      { animation: logo-zoom      .7s both; }
.brand .logoword .word.anim-typeon    { animation: logo-typeon    .9s steps(28, end) both; }
.brand .logoword .word.anim-neon      { animation: logo-neon      1s both; }
.brand .logoword .word.anim-rotate3d  { animation: logo-rotate3d  .8s both; }
.brand .logoword .word.anim-marquee   { animation: logo-marquee   .8s ease-out both; }
.brand .logoword .word.anim-shake     { animation: logo-shake     .9s both; }
.brand .logoword .word.anim-fall      { animation: logo-fall      .9s cubic-bezier(.5,1.4,.4,1) both; }
.brand .logoword .word.anim-warp      { animation: logo-warp      .7s ease-out both; }

/* ============================================================
   SKELETON LOADERS
   ============================================================ */
.skeleton {
  position: relative; overflow: hidden;
  background: var(--bg-2);
  border: 1px solid var(--line); border-radius: var(--radius);
  min-height: 280px;
}
.skeleton::after {
  content: ''; position: absolute; inset: 0;
  background: linear-gradient(110deg, transparent 30%, rgba(255,255,255,.07) 45%, transparent 60%);
  background-size: 200% 100%;
  animation: aa-shimmer 1.4s infinite;
}
@keyframes aa-shimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }
.skeleton-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px,1fr)); gap: 14px; }

/* ============================================================
   CHAT — multi-tab, embeds, calls
   ============================================================ */
.chat-panel {
  width: min(420px, calc(100vw - 24px));
  height: min(640px, 82vh);
}
.chat-tabs { display: flex; gap: 2px; padding: 0 10px 8px; border-bottom: 1px solid var(--line); }
.chat-tabs button {
  flex: 1; padding: 8px 10px; background: transparent; border: 0; border-radius: 8px 8px 0 0;
  color: var(--fg-dim); cursor: pointer; font: inherit; font-size: .75rem;
  letter-spacing: .12em; text-transform: uppercase;
}
.chat-tabs button.active { background: var(--bg); color: var(--accent); border-bottom: 2px solid var(--accent); }

.chat-screen { display: none; flex: 1; flex-direction: column; min-height: 0; }
.chat-screen.active { display: flex; }

.thread-list { flex: 1; overflow-y: auto; padding: 8px; }
.thread {
  display: flex; gap: 10px; padding: 8px 10px; border-radius: 10px; cursor: pointer;
  align-items: center;
}
.thread:hover { background: var(--bg); }
.thread.active { background: var(--bg); }
.thread .avatar {
  width: 36px; height: 36px; border-radius: 50%; flex: 0 0 auto;
  background: linear-gradient(135deg, var(--violet), var(--red));
  display: grid; place-items: center; font-weight: 700; color: #fff; font-size: .8rem;
}
.thread .meta { flex: 1; min-width: 0; }
.thread .meta b { display: block; font-size: .85rem; font-weight: 600; }
.thread .meta span { color: var(--muted); font-size: .75rem; display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.thread .badge { background: var(--accent); color: var(--bg); font-size: .65rem; padding: 2px 6px; border-radius: 99px; font-weight: 700; }
.thread .live-dot { width: 8px; height: 8px; border-radius: 50%; background: #6fffa0; box-shadow: 0 0 0 4px rgba(111,255,160,.18); animation: pulse 1.4s infinite; }

.dm-head {
  display: flex; align-items: center; gap: 10px; padding: 10px;
  border-bottom: 1px solid var(--line); background: var(--bg);
}
.dm-head .avatar { width: 32px; height: 32px; border-radius: 50%; background: linear-gradient(135deg, var(--teal), var(--violet)); display: grid; place-items: center; color: #fff; font-weight: 700; font-size: .75rem; }
.dm-head .who { flex: 1; min-width: 0; }
.dm-head .who b { display: block; font-size: .85rem; }
.dm-head .who span { color: var(--muted); font-size: .7rem; }
.dm-head button.icon-btn {
  width: 32px; height: 32px; border-radius: 8px; border: 1px solid var(--line); background: transparent;
  color: var(--fg-dim); cursor: pointer; font-size: 14px;
}
.dm-head button.icon-btn:hover { color: var(--accent); border-color: var(--accent); }

.embed { margin-top: 6px; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; background: var(--bg); }
.embed iframe, .embed video, .embed audio { width: 100%; display: block; border: 0; }
.embed audio { padding: 8px; }
.embed.pdf { aspect-ratio: 4/5; }
.embed.pdf iframe { height: 100%; }
.embed-link {
  display: flex; gap: 10px; align-items: center; padding: 8px;
  border: 1px solid var(--line); border-radius: 10px; margin-top: 6px; background: var(--bg);
  text-decoration: none; color: var(--fg);
}
.embed-link .ico { width: 36px; height: 36px; border-radius: 8px; background: var(--accent); color: var(--bg); display: grid; place-items: center; font-weight: 700; flex: 0 0 auto; }
.embed-link b { display: block; font-size: .85rem; }
.embed-link span { color: var(--muted); font-size: .7rem; word-break: break-all; }

.embed-share-card {
  display: flex; gap: 10px; align-items: center; padding: 8px;
  border: 1px solid var(--accent); border-radius: 10px; margin-top: 6px; background: rgba(255,215,0,.06);
}
.embed-share-card img { width: 48px; height: 48px; object-fit: cover; border-radius: 8px; flex: 0 0 auto; }
.embed-share-card b { display: block; font-size: .85rem; }
.embed-share-card span { color: var(--muted); font-size: .7rem; text-transform: uppercase; letter-spacing: .12em; }

.chat-form { gap: 4px; flex-wrap: wrap; }
.chat-form .tools { display: flex; gap: 4px; }
.chat-form .tools button {
  width: 36px; height: 36px; border-radius: 50%; border: 1px solid var(--line); background: transparent;
  color: var(--fg-dim); cursor: pointer; flex: 0 0 auto;
}
.chat-form .tools button:hover { color: var(--accent); border-color: var(--accent); }

/* Share content sheet */
.share-sheet {
  position: absolute; inset: auto 0 0 0; height: 70%;
  background: var(--bg-2); border-top: 1px solid var(--line);
  border-radius: 16px 16px 0 0; padding: 14px;
  display: none; flex-direction: column; gap: 10px;
  z-index: 5;
}
.share-sheet.open { display: flex; animation: aa-fade-up .25s; }
.share-sheet h4 { margin: 0 0 6px; font-family: 'Space Grotesk', sans-serif; font-size: .9rem; }
.share-sheet input { padding: 8px 12px; border: 1px solid var(--line); background: var(--bg); color: var(--fg); border-radius: 99px; font: inherit; }
.share-results { flex: 1; overflow-y: auto; display: grid; grid-template-columns: repeat(2, 1fr); gap: 6px; }
.share-results .pick {
  display: flex; gap: 8px; align-items: center; padding: 6px; border: 1px solid var(--line); border-radius: 8px; cursor: pointer; background: var(--bg);
}
.share-results .pick:hover { border-color: var(--accent); }
.share-results .pick img { width: 36px; height: 36px; object-fit: cover; border-radius: 6px; flex: 0 0 auto; }
.share-results .pick b { display: block; font-size: .75rem; line-height: 1.2; }
.share-results .pick span { display: block; font-size: .65rem; color: var(--muted); text-transform: uppercase; letter-spacing: .1em; }

/* Live call modal (in-chat) */
.call-stage {
  position: absolute; inset: 0; background: #000; z-index: 10;
  display: none; flex-direction: column;
}
.call-stage.open { display: flex; animation: aa-fade-up .3s; }
.call-stage .grid {
  flex: 1; display: grid; grid-template-columns: 1fr; gap: 4px; padding: 4px;
  background: #000; min-height: 0;
}
.call-stage .tile {
  background: linear-gradient(135deg, var(--violet), var(--red));
  border-radius: 8px; display: grid; place-items: center;
  color: #fff; font-weight: 700; font-size: 2rem; aspect-ratio: 16/9; position: relative;
}
.call-stage .tile.self { background: linear-gradient(135deg, var(--teal), var(--green)); }
.call-stage .tile small { position: absolute; bottom: 6px; left: 8px; font-size: .7rem; font-weight: 500; opacity: .9; }
.call-controls { display: flex; gap: 8px; padding: 12px; justify-content: center; background: #0a0a0a; border-top: 1px solid var(--line); }
.call-controls button {
  width: 44px; height: 44px; border-radius: 50%; border: 1px solid var(--line);
  background: var(--bg-2); color: var(--fg); cursor: pointer; font-size: 18px;
}
.call-controls button.danger { background: var(--red); color: #fff; border-color: var(--red); }
.call-controls button.toggled-off { background: rgba(255,255,255,.06); color: var(--muted); }

/* ============================================================
   RESPONSIVE — mobile-first → tablet → desktop
   ============================================================ */
.tabs { gap: 4px; padding: 8px 12px 10px; }
section.view { padding: 16px; }

@media (min-width: 600px) {
  body { font-size: 16.5px; }
  .grid { grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; }
  .topbar { padding: 14px var(--content-pad-x); }
  .hero { aspect-ratio: 16 / 9; max-height: 70vh; min-height: 480px; }
  .hero-overlay { padding: 36px; gap: 12px; }
}

@media (min-width: 900px) {
  body { font-size: 17px; }
  .grid { grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 20px; }
  .tabs { padding: 10px var(--content-pad-x); }
  .hero { min-height: 540px; max-height: 80vh; }
  .hero-overlay { padding: 48px; max-width: 720px; }
  .topbar-actions { gap: 14px; }
  .chat-panel { width: 440px; height: 660px; }
  .share-results { grid-template-columns: repeat(3, 1fr); }
}

@media (min-width: 1280px) {
  .hero-overlay { padding: 56px 64px; max-width: 820px; }
  .grid { grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 22px; }
}

/* On very wide screens (4K, ultra-wide) — keep cards filling the width but cap density so they don't get tiny */
@media (min-width: 1800px) {
  .grid { grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 26px; }
}
@media (min-width: 2400px) {
  .grid { grid-template-columns: repeat(auto-fill, minmax(380px, 1fr)); gap: 28px; }
}

/* iPad landscape and larger — show sidenav + content side by side in admin */
@media (min-width: 1024px) {
  body.admin .admin-grid { grid-template-columns: 260px 1fr; }
}

/* Hide some tabs on small phones to keep the row compact */
@media (max-width: 360px) {
  .tab { padding: 8px 12px; font-size: .72rem; }
  .topbar .brand span:not(.logo) { font-size: .75rem; }
}

/* ===== Fluid card body padding so on tablet/desktop cards breathe ===== */
@media (min-width: 768px) { .card .body { padding: 18px; } .card h3 { font-size: 1.1rem; } }
