:root {
  color-scheme: dark;
  --bg: #000000;
  --bg-elevated: #111111;
  --sidebar: #0a0a0a;
  --panel: #1f1f1f;
  --panel-hover: #2a2a2a;
  --text: #ffffff;
  --muted: #aaaaaa;
  --accent: #4f8cff;
  --accent-hover: #3d78ea;
  --border: rgba(255, 255, 255, 0.1);
  --border-subtle: rgba(255, 255, 255, 0.06);
  --code-bg: #111111;
  --user-row: #1a1a1a;
  --assistant-row: transparent;
  --sidebar-width: 260px;
  --sidebar-width-min: 3.25rem;
  --topbar-height: 3rem;
  --composer-max: 46rem;
  --thread-max: 46rem;
  --grid: 1rem;
  --radius-sm: 0.5rem;
  --radius-md: 0.75rem;
  --radius-lg: 1.25rem;
  --radius-pill: 1.75rem;
  --ease-out: cubic-bezier(0.32, 0.72, 0, 1);
  --font-sans: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", system-ui, sans-serif;
}

* { box-sizing: border-box; }

html, body {
  height: 100%;
}

body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: 1.125rem;
  line-height: 1.5;
  letter-spacing: -0.011em;
  background: var(--bg);
  color: var(--text);
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

button, textarea {
  font: inherit;
}

.layout {
  --sidebar-current-width: var(--sidebar-width);
  display: grid;
  grid-template-columns: var(--sidebar-current-width) minmax(0, 1fr);
  grid-template-rows: 1fr;
  height: 100dvh;
  width: 100%;
  transition: grid-template-columns 0.28s var(--ease-out);
}

.sidebar {
  grid-column: 1;
  grid-row: 1;
}

.main {
  grid-column: 2;
  grid-row: 1;
}

body.sidebar-collapsed {
  --sidebar-current-width: var(--sidebar-width-min);
}

/* ── Sidebar ── */

.sidebar {
  width: 100%;
  min-width: 0;
  display: flex;
  flex-direction: column;
  background: var(--sidebar);
  border-right: 1px solid var(--border);
  z-index: 30;
  overflow: hidden;
  position: relative;
}

.sidebar[hidden] {
  display: none !important;
}

.sidebar__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.35rem;
  padding: 0.75rem 0.75rem 0.45rem;
  min-height: 3rem;
  flex-shrink: 0;
}

body.sidebar-collapsed .sidebar__head {
  justify-content: center;
  padding: 0.55rem 0.3rem 0.35rem;
}

.sidebar__brand {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  color: var(--text);
  text-decoration: none;
  font-weight: 700;
  font-size: 1.05rem;
  min-width: 0;
  flex: 1;
}

body.sidebar-collapsed .sidebar__brand {
  display: none;
}

.sidebar__brand-text,
.sidebar__new-label,
.sidebar__meta {
  white-space: nowrap;
  transition: opacity 0.2s ease, transform 0.2s ease;
}

body.sidebar-collapsed .sidebar__brand-text,
body.sidebar-collapsed .sidebar__new-label {
  opacity: 0;
  width: 0;
  overflow: hidden;
  visibility: hidden;
  pointer-events: none;
}

body.sidebar-collapsed .sidebar__list,
body.sidebar-collapsed .sidebar__foot {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

body.sidebar-collapsed .sidebar__item-title {
  overflow: hidden;
  text-overflow: clip;
  max-width: 1.1rem;
  font-size: 0.72rem;
  letter-spacing: -0.04em;
}

body.sidebar-collapsed .sidebar__item-del {
  display: none;
}

body.sidebar-collapsed .sidebar__meta {
  font-size: 0.58rem;
  line-height: 1.25;
  white-space: normal;
  text-align: left;
  max-width: 4.5rem;
  opacity: 0.85;
}

body.sidebar-collapsed .sidebar__foot {
  flex-direction: column;
  align-items: center;
  gap: 0.35rem;
  padding: 0.55rem 0.25rem;
}

.sidebar__logo {
  font-size: 1.2rem;
  flex-shrink: 0;
}

.sidebar__head-actions {
  display: inline-flex;
  align-items: center;
  gap: 0.15rem;
  flex-shrink: 0;
}

.sidebar__collapse,
.sidebar__minimize-foot {
  display: inline-flex;
  position: relative;
  z-index: 2;
  flex-shrink: 0;
}

.sidebar__icon-expand {
  display: none;
}

body.sidebar-collapsed .sidebar__icon-collapse {
  display: none;
}

body.sidebar-collapsed .sidebar__icon-expand {
  display: block;
}

.sidebar__close {
  display: none;
}

.sidebar__new {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  margin: 0 0.65rem 0.65rem;
  padding: 0.62rem 0.85rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: transparent;
  color: var(--text);
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s, padding 0.28s var(--ease-out), margin 0.28s var(--ease-out);
}

body.sidebar-collapsed .sidebar__new {
  margin: 0.15rem 0.4rem 0.5rem;
  padding: 0.62rem;
  width: calc(100% - 0.8rem);
  min-height: 2.35rem;
  border-radius: 0.65rem;
}

.sidebar__new:hover {
  background: var(--panel-hover);
}

.sidebar__list {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 0 0.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  transition: opacity 0.18s ease, visibility 0.18s ease;
}

.sidebar__empty {
  margin: 0.5rem 0.75rem;
  color: var(--muted);
  font-size: 0.88rem;
}

.sidebar__item {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  width: 100%;
  padding: 0.58rem 0.65rem;
  border: 0;
  border-radius: var(--radius-md);
  background: transparent;
  color: var(--text);
  text-align: left;
  cursor: pointer;
  transition: background 0.15s ease;
}

.sidebar__item:hover,
.sidebar__item.is-active {
  background: var(--panel-hover);
}

.sidebar__item-title {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.9rem;
}

.sidebar__item-badge {
  display: inline-block;
  margin-left: 0.35rem;
  font-size: 0.62rem;
  font-weight: 700;
  color: #9ec2ff;
  vertical-align: middle;
}

.sidebar__item-preview {
  display: block;
  font-size: 0.72rem;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  text-align: left;
  margin-top: 0.1rem;
}

.sidebar__item-del {
  display: inline-flex;
  opacity: 0;
  color: var(--muted);
  padding: 0.15rem;
  border-radius: 0.35rem;
  transition: opacity 0.15s, color 0.15s, background 0.15s;
}

.sidebar__item:hover .sidebar__item-del,
.sidebar__item.is-active .sidebar__item-del {
  opacity: 1;
}

.sidebar__item-del:hover {
  color: #ff9f9f;
  background: rgba(255, 100, 100, 0.08);
}

.sidebar__foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.75rem 0.85rem;
  border-top: 1px solid var(--border-subtle);
  transition: opacity 0.2s ease, visibility 0.2s ease;
  flex-shrink: 0;
}

.sidebar__minimize-foot {
  flex-shrink: 0;
  color: var(--muted);
}

.sidebar__minimize-foot:hover {
  color: var(--text);
}

.sidebar__meta {
  font-size: 0.78rem;
  color: var(--muted);
}

.sidebar-backdrop {
  display: none !important;
  pointer-events: none !important;
}

/* ── Main area ── */

.main {
  flex: 1;
  min-width: 0;
  display: grid;
  grid-template-rows: var(--topbar-height) 1fr auto;
  background: var(--bg);
}

.topbar {
  display: grid;
  grid-template-columns: 2.25rem 1fr auto;
  align-items: center;
  gap: 0.75rem;
  padding: 0 0.85rem;
  border-bottom: 1px solid transparent;
}

body.has-thread .topbar {
  border-bottom-color: var(--border-subtle);
  background: rgba(0, 0, 0, 0.82);
  backdrop-filter: blur(12px) saturate(140%);
  -webkit-backdrop-filter: blur(12px) saturate(140%);
}

/* Keep navigation panel always visible during active chats (desktop) */
@media (min-width: 861px) {
  body.has-thread {
    --sidebar-current-width: var(--sidebar-width) !important;
  }

  body.has-thread .sidebar {
    display: flex !important;
    visibility: visible !important;
    opacity: 1 !important;
    pointer-events: auto !important;
  }

  body.has-thread .sidebar__brand {
    display: inline-flex !important;
  }

  body.has-thread .sidebar__brand-text,
  body.has-thread .sidebar__new-label,
  body.has-thread .sidebar__list,
  body.has-thread .sidebar__foot,
  body.has-thread .sidebar__meta,
  body.has-thread .sidebar__minimize-foot {
    opacity: 1 !important;
    visibility: visible !important;
    pointer-events: auto !important;
    width: auto !important;
    overflow: visible !important;
  }

  body.has-thread .sidebar__item-title {
    max-width: none !important;
    font-size: 0.9rem !important;
    letter-spacing: normal !important;
  }

  body.has-thread .sidebar__item-del {
    display: inline-flex !important;
  }

  body.has-thread .sidebar__meta {
    font-size: 0.78rem !important;
    max-width: none !important;
    white-space: nowrap !important;
  }

  body.has-thread .sidebar__foot {
    flex-direction: row !important;
    align-items: center !important;
    padding: 0.75rem 0.85rem !important;
  }

  body.has-thread .sidebar__icon-collapse {
    display: block !important;
  }

  body.has-thread .sidebar__icon-expand {
    display: none !important;
  }
}

.topbar__pickers {
  display: inline-flex;
  align-items: center;
  gap: 0.15rem;
  max-width: 100%;
}

.topbar__share {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 500;
  padding: 0.35rem 0.55rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}

.topbar__share:hover {
  background: var(--panel-hover);
  color: var(--text);
}

.topbar__share-label {
  display: none;
}

@media (min-width: 700px) {
  .topbar__share-label {
    display: inline;
  }
}

.topbar__menu {
  display: none;
}

.topbar__menu-icon-desktop {
  display: none;
}

@media (min-width: 861px) {
  .topbar__menu {
    display: inline-flex;
  }

  .topbar__menu-icon-mobile {
    display: none;
  }

  .topbar__menu-icon-desktop {
    display: block;
  }
}

.topbar__center {
  display: flex;
  justify-content: center;
  min-width: 0;
}

.topbar__actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.55rem;
  min-width: 0;
}

/* ── Mode picker (ChatGPT-style) ── */

.mode-picker {
  position: relative;
}

.mode-picker__btn {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  border: 0;
  background: transparent;
  color: var(--text);
  font-size: 0.95rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  padding: 0.4rem 0.55rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background 0.15s ease;
}

.mode-picker__btn:hover,
.mode-picker.is-open .mode-picker__btn {
  background: var(--panel-hover);
}

.mode-picker__chevron {
  opacity: 0.7;
  transition: transform 0.2s;
}

.mode-picker.is-open .mode-picker__chevron {
  transform: rotate(180deg);
}

.mode-picker__menu {
  position: absolute;
  top: calc(100% + 0.35rem);
  left: 50%;
  transform: translateX(-50%);
  width: min(18rem, calc(100vw - 2rem));
  padding: 0.35rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--bg-elevated);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
  z-index: 40;
}

.mode-picker__menu[hidden] {
  display: none;
}

.mode-picker__option {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.2rem;
  width: 100%;
  padding: 0.7rem 0.75rem;
  border: 0;
  border-radius: 0.6rem;
  background: transparent;
  color: var(--text);
  text-align: left;
  cursor: pointer;
  transition: background 0.15s;
}

.mode-picker__option:hover,
.mode-picker__option.is-active {
  background: var(--panel-hover);
}

.mode-picker__option-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  gap: 0.5rem;
}

.mode-picker__option-name {
  font-size: 0.92rem;
  font-weight: 600;
}

.mode-picker__option-badge {
  font-size: 0.72rem;
  color: var(--muted);
  padding: 0.12rem 0.45rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  white-space: nowrap;
}

.mode-picker__option-badge--pro {
  color: #9ec2ff;
  border-color: #35507a;
  background: rgba(79, 140, 255, 0.1);
}

.mode-picker__option-desc {
  font-size: 0.78rem;
  line-height: 1.45;
  color: var(--muted);
}

/* ── Reasoning picker (iGPT-style) ── */

.reasoning-picker {
  position: relative;
}

.reasoning-picker__btn {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 500;
  padding: 0.4rem 0.5rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}

.reasoning-picker__btn:hover,
.reasoning-picker.is-open .reasoning-picker__btn {
  background: var(--panel-hover);
  color: var(--text);
}

.reasoning-picker__chevron {
  opacity: 0.65;
}

.reasoning-picker__menu {
  position: absolute;
  top: calc(100% + 0.35rem);
  left: 50%;
  transform: translateX(-50%);
  width: min(14rem, calc(100vw - 2rem));
  padding: 0.35rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--bg-elevated);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.45);
  z-index: 40;
}

.reasoning-picker__menu[hidden] {
  display: none;
}

.reasoning-picker__option {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.15rem;
  width: 100%;
  padding: 0.6rem 0.7rem;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text);
  text-align: left;
  cursor: pointer;
  transition: background 0.15s ease;
}

.reasoning-picker__option:hover,
.reasoning-picker__option.is-active {
  background: var(--panel-hover);
}

.reasoning-picker__option-name {
  font-size: 0.88rem;
  font-weight: 600;
}

.reasoning-picker__option-desc {
  font-size: 0.75rem;
  color: var(--muted);
}

.auth-guest {
  display: flex;
  align-items: center;
}

.auth-guest__btn {
  border: 1px solid var(--border);
  background: var(--panel);
  color: var(--text);
  font-size: 0.82rem;
  font-weight: 600;
  padding: 0.4rem 0.75rem;
  border-radius: var(--radius-pill);
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.auth-guest__btn:hover {
  background: var(--panel-hover);
  border-color: rgba(255, 255, 255, 0.14);
}

.auth-user {
  display: flex;
  align-items: center;
  max-width: 16rem;
}

.auth-user__chip {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  border: 1px solid var(--border);
  background: var(--panel);
  color: var(--text);
  padding: 0.3rem 0.55rem 0.3rem 0.35rem;
  border-radius: var(--radius-pill);
  cursor: pointer;
  max-width: 100%;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.auth-user__chip:hover {
  background: var(--panel-hover);
  border-color: rgba(255, 255, 255, 0.14);
}

.auth-user__avatar {
  width: 1.75rem;
  height: 1.75rem;
  border-radius: 50%;
  background: linear-gradient(135deg, #5436da, #4f8cff);
  color: #fff;
  font-size: 0.62rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  letter-spacing: -0.02em;
}

.auth-user__info {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  min-width: 0;
  line-height: 1.2;
}

.auth-user__name {
  font-size: 0.78rem;
  font-weight: 600;
  max-width: 7.5rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.auth-user__email {
  font-size: 0.68rem;
  color: var(--muted);
  max-width: 7.5rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.auth-user__plan {
  font-size: 0.65rem;
  font-weight: 600;
  color: #9ec2ff;
  padding: 0.15rem 0.45rem;
  border-radius: 999px;
  border: 1px solid rgba(79, 140, 255, 0.25);
  background: rgba(79, 140, 255, 0.08);
  flex-shrink: 0;
  margin-left: 0.15rem;
}

.auth-modal__sub {
  margin: -0.35rem 0 1rem;
  font-size: 0.84rem;
  color: var(--muted);
}

.chat-view {
  overflow: hidden;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

/* ── Welcome ── */

.welcome {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 2.5rem 1.5rem;
  text-align: center;
}

.welcome__logo {
  font-size: 2.5rem;
  margin-bottom: 1rem;
  filter: drop-shadow(0 0 24px rgba(79, 140, 255, 0.25));
}

.welcome__heading {
  margin: 0;
  font-size: clamp(1.5rem, 4vw, 2rem);
  font-weight: 600;
  letter-spacing: -0.035em;
}

.welcome__sub {
  margin: 0.5rem 0 0;
  color: var(--muted);
  font-size: 0.95rem;
  max-width: 26rem;
}

.welcome__hint {
  margin: 0.85rem 0 0;
  font-size: 0.88rem;
  color: var(--muted);
  max-width: 28rem;
}

.welcome__hint code {
  font-size: 0.82rem;
  padding: 0.1rem 0.35rem;
  border-radius: 0.3rem;
  background: var(--panel);
  border: 1px solid var(--border);
  color: var(--text);
}

.welcome__prompts {
  width: 100%;
  max-width: 42rem;
  margin-top: 1.75rem;
  max-height: min(42vh, 22rem);
  overflow-y: auto;
  padding: 0 0.25rem;
  text-align: left;
}

.welcome__category {
  margin-bottom: 1.1rem;
}

.welcome__category-label {
  margin: 0 0 0.5rem;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}

.welcome__chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.chip {
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--text);
  padding: 0.5rem 0.85rem;
  border-radius: 999px;
  font-size: 0.85rem;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.chip:hover {
  background: var(--panel-hover);
  border-color: rgba(255, 255, 255, 0.14);
}

/* ── Room header (Team / WhatsApp) ── */

.room-header {
  flex-shrink: 0;
  padding: 0.65rem 1rem;
  border-bottom: 1px solid var(--border);
  background: var(--bg-elevated);
}

.room-header__title {
  margin: 0;
  font-size: 1rem;
  font-weight: 600;
}

.room-header__members {
  margin: 0.15rem 0 0;
  font-size: 0.78rem;
  color: var(--muted);
}

.welcome__hint--register {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
}

.welcome__register-btn {
  border: 1px solid rgba(79, 140, 255, 0.35);
  background: rgba(79, 140, 255, 0.12);
  color: #9ec2ff;
  font-size: 0.82rem;
  font-weight: 600;
  padding: 0.35rem 0.75rem;
  border-radius: var(--radius-pill);
  cursor: pointer;
}

.welcome__register-btn:hover {
  background: rgba(79, 140, 255, 0.2);
}

/* ── Agent harness steps ── */

.agent-steps {
  flex-shrink: 0;
  max-height: 7rem;
  overflow-y: auto;
  margin: 0 1rem;
  padding: 0.45rem 0.65rem;
  border: 1px solid rgba(79, 140, 255, 0.2);
  border-radius: var(--radius-md);
  background: rgba(79, 140, 255, 0.06);
  font-size: 0.78rem;
}

.agent-step {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  padding: 0.2rem 0;
  border-bottom: 1px solid var(--border-subtle);
}

.agent-step:last-child {
  border-bottom: 0;
}

.agent-step__label {
  font-weight: 600;
  color: #9ec2ff;
}

.agent-step__thought {
  color: var(--muted);
}

.agent-step--tool .agent-step__label {
  color: var(--muted);
}

/* ── Thread ── */

.thread {
  flex: 1;
  overflow-y: auto;
  overscroll-behavior: contain;
  scroll-behavior: smooth;
}

.thread--wa {
  padding: 0.75rem 0.65rem 1rem;
  background:
    radial-gradient(circle at 20% 20%, rgba(84, 54, 218, 0.04), transparent 40%),
    radial-gradient(circle at 80% 80%, rgba(79, 140, 255, 0.04), transparent 35%),
    var(--bg);
}

.msg {
  animation: msg-in 0.28s var(--ease-out) both;
  width: 100%;
  padding: 0.2rem 0;
  background: transparent;
}

.msg--user {
  background: transparent;
}

.msg--assistant {
  background: transparent;
}

@keyframes msg-in {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

.msg__inner {
  max-width: var(--thread-max);
  margin: 0 auto;
  padding: 0.35rem 0.5rem;
  display: grid;
  grid-template-columns: 1.75rem minmax(0, 1fr);
  gap: 0.55rem;
  align-items: end;
}

.thread--wa .msg__inner {
  max-width: 42rem;
}

.thread--wa .msg--mine .msg__inner {
  grid-template-columns: minmax(0, 1fr) 1.75rem;
  justify-items: end;
}

.thread--wa .msg--mine .msg__avatar {
  order: 2;
}

.thread--wa .msg--mine .msg__content {
  align-items: flex-end;
}

.thread--wa .msg--theirs .msg__inner,
.thread--wa .msg--spike .msg__inner {
  justify-items: start;
}

.msg__avatar {
  width: 1.75rem;
  height: 1.75rem;
  border-radius: 0.2rem;
  background: var(--panel);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 0.95rem;
  line-height: 1;
}

.msg__avatar--user {
  background: #5436da;
  color: #fff;
  font-size: 0.58rem;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.msg__content {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.msg__bubble {
  flex: 1;
  min-width: 0;
  line-height: 1.7;
  font-size: 1rem;
}

.msg__citations {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem;
}

.msg__citations-label {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--muted);
  margin-right: 0.15rem;
}

.citation {
  display: inline-flex;
  align-items: center;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--muted);
  font-size: 0.72rem;
  text-decoration: none;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.citation:hover {
  background: var(--panel-hover);
  color: var(--text);
  border-color: rgba(255, 255, 255, 0.14);
}

.citation--model {
  color: #9ec2ff;
  border-color: rgba(79, 140, 255, 0.25);
}

.citation--source {
  color: var(--text);
}

.llm-message.markdown a.citation {
  font-weight: 500;
}

.msg--mine .msg__bubble {
  background: #005c4b;
  color: #e9edef;
  border-radius: 1rem 1rem 0.2rem 1rem;
  padding: 0.45rem 0.65rem 0.35rem;
  box-shadow: 0 1px 0.5px rgba(0, 0, 0, 0.2);
}

.msg--theirs .msg__bubble,
.msg--spike .msg__bubble {
  background: #1f2c34;
  color: #e9edef;
  border-radius: 1rem 1rem 1rem 0.2rem;
  padding: 0.45rem 0.65rem 0.35rem;
  box-shadow: 0 1px 0.5px rgba(0, 0, 0, 0.25);
}

.msg--spike .msg__bubble {
  border: 1px solid rgba(79, 140, 255, 0.2);
}

.msg--spike-cmd .msg__bubble {
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  font-size: 0.88rem;
  color: #c8d8ff;
  background: #1a2332;
}

.msg__author {
  font-size: 0.72rem;
  font-weight: 600;
  color: #53bdeb;
  margin-bottom: 0.15rem;
  padding-left: 0.15rem;
}

.msg__time {
  font-size: 0.62rem;
  color: rgba(255, 255, 255, 0.45);
  margin-top: 0.2rem;
  text-align: right;
}

.msg--theirs .msg__time,
.msg--spike .msg__time {
  text-align: left;
}

.msg--user .msg__content {
  min-width: 0;
  max-width: min(78%, 28rem);
}

.msg--assistant .msg__content {
  max-width: min(85%, 32rem);
}

.msg--user .msg__bubble {
  white-space: pre-wrap;
}

.msg:not(.msg--mine):not(.msg--theirs):not(.msg--spike) .msg__inner {
  padding: 1rem;
}

.msg:not(.msg--mine):not(.msg--theirs):not(.msg--spike).msg--user {
  background: var(--user-row);
}

.msg:not(.msg--mine):not(.msg--theirs):not(.msg--spike).msg--assistant {
  background: var(--assistant-row);
}

.msg--error .msg__bubble {
  color: #ffb4b4;
}

.msg__typing-wrap {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  min-height: 1.5rem;
}

.msg__typing {
  display: inline-flex;
  gap: 0.3rem;
  align-items: center;
}

.msg__typing span {
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 50%;
  background: var(--accent);
  animation: typing 1.2s infinite ease-in-out;
}

.msg__typing-label {
  font-size: 0.9rem;
  color: var(--muted);
}

.msg__typing span:nth-child(2) { animation-delay: 0.15s; }
.msg__typing span:nth-child(3) { animation-delay: 0.3s; }

@keyframes typing {
  0%, 80%, 100% { opacity: 0.35; transform: translateY(0); }
  40% { opacity: 1; transform: translateY(-3px); }
}

/* ── Composer ── */

.composer {
  padding: 0.75rem 1rem calc(0.85rem + env(safe-area-inset-bottom, 0));
  background: linear-gradient(to top, var(--bg) 70%, transparent);
}

.composer__form {
  max-width: var(--composer-max);
  margin: 0 auto;
}

.composer__shell {
  border: 1px solid var(--border);
  border-radius: 1.35rem;
  background: var(--panel);
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.2), 0 4px 24px rgba(0, 0, 0, 0.22);
  overflow: hidden;
  transition: border-color 0.25s ease, box-shadow 0.25s ease;
}

.composer__shell:focus-within {
  border-color: rgba(255, 255, 255, 0.14);
}

.composer__shell:has(.composer__box.is-waiting) {
  border-color: rgba(79, 140, 255, 0.3);
}

.composer__toolbar {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.45rem 0.65rem 0;
  flex-wrap: wrap;
}

.chat-mode {
  display: inline-flex;
  align-items: center;
  gap: 0.15rem;
  padding: 0.15rem;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border);
  background: var(--bg-elevated);
}

.chat-mode__btn {
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 600;
  padding: 0.28rem 0.55rem;
  border-radius: var(--radius-pill);
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}

.chat-mode__btn:hover {
  color: var(--text);
}

.chat-mode__btn.is-active {
  background: var(--panel-hover);
  color: var(--text);
}

.chat-mode__btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.topbar__invite {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 500;
  padding: 0.35rem 0.55rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
}

.topbar__invite:hover {
  background: var(--panel-hover);
  color: var(--text);
}

.invite-modal__backdrop,
.invite-modal__dialog {
  /* reuse share-modal pattern */
}

.invite-modal {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.invite-modal[hidden] {
  display: none !important;
}

.invite-modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
}

.invite-modal__dialog {
  position: relative;
  width: min(100%, 28rem);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.45);
}

.invite-modal__title {
  margin: 0 0 0.35rem;
  font-size: 1.15rem;
}

.invite-modal__sub {
  margin: 0 0 1rem;
  font-size: 0.84rem;
  color: var(--muted);
}

.invite-modal__field {
  display: flex;
  gap: 0.5rem;
}

.invite-modal__field input {
  flex: 1;
  border: 1px solid var(--border);
  background: var(--panel);
  color: var(--text);
  border-radius: var(--radius-sm);
  padding: 0.55rem 0.65rem;
  font-size: 0.82rem;
}

.invite-modal__copy {
  border: 0;
  background: var(--accent);
  color: #fff;
  font-weight: 600;
  font-size: 0.82rem;
  padding: 0.55rem 0.85rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
}

.invite-modal__close {
  position: absolute;
  top: 0.65rem;
  right: 0.65rem;
}

.image-upload-btn {
  flex-shrink: 0;
  border: 0;
  background: transparent;
  color: var(--muted);
  width: 2.25rem;
  height: 2.25rem;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}

.image-upload-btn:hover:not(:disabled) {
  background: var(--panel-hover);
  color: var(--text);
}

.image-upload-btn:disabled {
  opacity: 0.45;
  cursor: wait;
}

.msg__bubble--image {
  padding: 0.25rem !important;
  background: transparent !important;
  box-shadow: none !important;
}

.msg__image {
  display: block;
  max-width: min(100%, 18rem);
  max-height: 16rem;
  border-radius: 0.65rem;
  object-fit: cover;
}

.msg__caption {
  margin: 0.35rem 0.15rem 0;
  font-size: 0.88rem;
  line-height: 1.4;
}

.msg--image.msg--mine .msg__bubble--image {
  background: #005c4b !important;
  padding: 0.35rem !important;
  border-radius: 1rem 1rem 0.2rem 1rem;
}

.msg--image.msg--theirs .msg__bubble--image {
  background: #1f2c34 !important;
  padding: 0.35rem !important;
  border-radius: 1rem 1rem 1rem 0.2rem;
}

.hub-check {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.9rem;
}

.hub-settings select {
  width: 100%;
  margin-top: 0.35rem;
  border: 1px solid var(--border);
  background: var(--panel);
  color: var(--text);
  border-radius: var(--radius-sm);
  padding: 0.55rem 0.65rem;
}

.hub-vault__lead {
  margin: 0 0 1rem;
  font-size: 0.92rem;
  color: #9ec2ff;
}

.composer__box {
  display: flex;
  align-items: flex-end;
  gap: 0.4rem;
  padding: 0.35rem 0.45rem 0.45rem 0.85rem;
  background: transparent;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  transition: none;
}

/* ── Sources picker ── */

.sources-picker {
  position: relative;
}

.sources-picker__btn {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--text);
  font-size: 0.82rem;
  font-weight: 500;
  padding: 0.35rem 0.6rem;
  border-radius: 999px;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.sources-picker__btn:hover,
.sources-picker.is-open .sources-picker__btn {
  background: var(--panel-hover);
  border-color: rgba(255, 255, 255, 0.14);
}

.sources-picker__chevron {
  opacity: 0.6;
}

.sources-picker__menu {
  position: absolute;
  bottom: calc(100% + 0.45rem);
  left: 0;
  width: min(16rem, calc(100vw - 2rem));
  padding: 0.35rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--bg-elevated);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.45);
  z-index: 40;
}

.sources-picker__menu[hidden] {
  display: none;
}

.sources-picker__option {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  width: 100%;
  padding: 0.55rem 0.6rem;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text);
  text-align: left;
  cursor: pointer;
  transition: background 0.15s ease;
}

.sources-picker__option:hover:not(.is-disabled),
.sources-picker__option.is-active {
  background: var(--panel-hover);
}

.sources-picker__option.is-disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.sources-picker__option-check {
  width: 1rem;
  flex-shrink: 0;
  font-size: 0.75rem;
  color: var(--accent);
  padding-top: 0.15rem;
}

.sources-picker__option-icon {
  flex-shrink: 0;
  font-size: 1rem;
  line-height: 1;
  padding-top: 0.1rem;
}

.sources-picker__option-body {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  min-width: 0;
}

.sources-picker__option-name {
  font-size: 0.86rem;
  font-weight: 600;
}

.sources-picker__option-desc {
  font-size: 0.74rem;
  color: var(--muted);
}

.sources-picker__pro {
  font-size: 0.65rem;
  font-weight: 600;
  color: #9ec2ff;
  border: 1px solid rgba(79, 140, 255, 0.3);
  border-radius: 999px;
  padding: 0.05rem 0.35rem;
  margin-left: 0.25rem;
  vertical-align: middle;
}

textarea {
  flex: 1;
  border: 0;
  background: transparent;
  color: var(--text);
  font-size: 1rem;
  line-height: 1.5;
  padding: 0.55rem 0;
  resize: none;
  outline: none;
  max-height: 160px;
}

.icon-btn,
.send-btn {
  border: 0;
  border-radius: 999px;
  cursor: pointer;
  transition: background 0.15s, opacity 0.15s, box-shadow 0.2s, transform 0.2s;
}

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.25rem;
  height: 2.25rem;
  background: transparent;
  color: var(--muted);
}

.icon-btn:hover {
  background: var(--panel-hover);
  color: var(--text);
}

.send-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.25rem;
  height: 2.25rem;
  background: #ececec;
  color: #212121;
  flex-shrink: 0;
  position: relative;
  overflow: hidden;
}

.send-btn::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: linear-gradient(135deg, #4f8cff, #7c5cff, #4fd1ff, #4f8cff);
  background-size: 300% 300%;
  opacity: 0;
  transition: opacity 0.25s ease;
}

.send-btn svg {
  position: relative;
  z-index: 1;
}

.send-btn:hover:not(:disabled) {
  background: #fff;
}

.send-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.send-btn.is-sent::before {
  opacity: 1;
  animation: send-flash 0.7s cubic-bezier(0.34, 1.2, 0.64, 1);
}

.send-btn.is-sending {
  background: transparent;
  color: #fff;
  opacity: 1;
  cursor: default;
  animation: send-glow 1.6s ease-in-out infinite;
}

.send-btn.is-sending::before {
  opacity: 1;
  animation: send-gradient 1.8s ease infinite;
}

.send-btn.is-sending svg {
  animation: send-arrow 1.2s ease-in-out infinite;
}

@keyframes send-flash {
  0% { opacity: 0; transform: scale(0.85); }
  35% { opacity: 1; transform: scale(1.08); }
  100% { opacity: 0; transform: scale(1); }
}

@keyframes send-gradient {
  0%, 100% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
}

@keyframes send-glow {
  0%, 100% { box-shadow: 0 0 0 0 rgba(79, 140, 255, 0.45); }
  50% { box-shadow: 0 0 18px 4px rgba(124, 92, 255, 0.55); }
}

@keyframes send-arrow {
  0%, 100% { transform: translateX(0); }
  50% { transform: translateX(2px); }
}

.composer__hint {
  margin: 0.5rem auto 0;
  max-width: var(--composer-max);
  color: var(--muted);
  text-align: center;
  font-size: 0.82rem;
  transition: color 0.2s ease;
}

.composer__hint.is-active {
  color: #9ec2ff;
}

/* ── Markdown ── */

.msg__bubble p {
  margin: 0 0 0.9rem;
}

.msg__bubble p:last-child { margin-bottom: 0; }

.msg__bubble ul {
  margin: 0 0 0.9rem 1.1rem;
  padding: 0;
}

.msg__bubble code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.92em;
  background: var(--code-bg);
  border: 1px solid var(--border);
  border-radius: 0.35rem;
  padding: 0.1rem 0.35rem;
}

.code-block {
  margin: 0.9rem 0;
  border: 1px solid var(--border);
  border-radius: 0.75rem;
  overflow: hidden;
  background: var(--code-bg);
}

.code-block__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.45rem 0.7rem;
  border-bottom: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.02);
}

.code-block__lang {
  font-size: 0.78rem;
  color: var(--muted);
  text-transform: lowercase;
}

.code-copy {
  border: 0;
  border-radius: 0.45rem;
  padding: 0.3rem 0.65rem;
  font-size: 0.78rem;
  background: #1b2636;
  color: var(--text);
  cursor: pointer;
}

.code-copy:hover { background: #243247; }

.code-block pre {
  margin: 0;
  padding: 0.9rem 1rem;
  overflow-x: auto;
}

.code-block pre code {
  display: block;
  border: 0;
  padding: 0;
  background: transparent;
  font-size: 0.88rem;
  line-height: 1.5;
  white-space: pre;
}

/* ── Mobile ── */

/* ── Auth modal ── */

.auth-modal[hidden],
.hub-modal[hidden],
.share-modal[hidden] {
  display: none !important;
  pointer-events: none !important;
  visibility: hidden !important;
}

.auth-modal:not(.is-open):not(.is-opening):not(.is-closing),
.hub-modal:not(.is-open):not(.is-opening):not(.is-closing),
.share-modal:not(.is-open) {
  display: none !important;
  pointer-events: none !important;
  visibility: hidden !important;
}

.auth-modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  pointer-events: auto;
}

.auth-modal.is-closing {
  pointer-events: none;
}

.auth-modal__backdrop,
.hub-modal__backdrop {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse at 50% 0%, rgba(255, 255, 255, 0.09), transparent 55%),
    rgba(8, 12, 20, 0.42);
  opacity: 0;
  backdrop-filter: blur(0) saturate(100%);
  -webkit-backdrop-filter: blur(0) saturate(100%);
  transition:
    opacity 0.42s cubic-bezier(0.32, 0.72, 0, 1),
    backdrop-filter 0.48s cubic-bezier(0.32, 0.72, 0, 1),
    -webkit-backdrop-filter 0.48s cubic-bezier(0.32, 0.72, 0, 1);
}

.auth-modal.is-open .auth-modal__backdrop,
.hub-modal.is-open .hub-modal__backdrop {
  opacity: 1;
  backdrop-filter: blur(32px) saturate(160%);
  -webkit-backdrop-filter: blur(32px) saturate(160%);
}

.auth-modal__dialog,
.hub-modal__dialog {
  position: relative;
  width: min(100%, 24rem);
  padding: 1.35rem 1.35rem 1.5rem;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 1.35rem;
  background: rgba(255, 255, 255, 0.07);
  backdrop-filter: blur(48px) saturate(180%);
  -webkit-backdrop-filter: blur(48px) saturate(180%);
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.06) inset,
    0 1px 0 rgba(255, 255, 255, 0.08) inset,
    0 28px 80px rgba(0, 0, 0, 0.48),
    0 8px 24px rgba(0, 0, 0, 0.28);
  opacity: 0;
  transform: scale(0.94) translateY(14px);
  transition:
    opacity 0.36s cubic-bezier(0.32, 0.72, 0, 1),
    transform 0.44s cubic-bezier(0.32, 0.72, 0, 1);
}

.hub-modal__dialog {
  width: min(100%, 42rem);
  max-height: min(88vh, 52rem);
  overflow: auto;
}

.auth-modal.is-open .auth-modal__dialog,
.hub-modal.is-open .hub-modal__dialog {
  opacity: 1;
  transform: scale(1) translateY(0);
}

@media (prefers-reduced-motion: reduce) {
  .auth-modal__backdrop,
  .auth-modal__dialog,
  .hub-modal__backdrop,
  .hub-modal__dialog,
  .auth-panel {
    transition: none !important;
  }
}

.auth-modal__close {
  position: absolute;
  top: 0.65rem;
  right: 0.65rem;
}

.auth-modal__title {
  margin: 0 0 1rem;
  font-size: 1.15rem;
}

.auth-tabs,
.hub-tabs {
  display: flex;
  gap: 0.35rem;
  margin-bottom: 1rem;
  padding: 0.25rem;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 0.85rem;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.hub-tabs {
  position: sticky;
  top: 0;
  z-index: 1;
}

.auth-tabs__btn,
.hub-tabs__btn {
  flex: 1;
  border: 0;
  background: transparent;
  color: var(--muted);
  padding: 0.52rem;
  border-radius: 0.62rem;
  cursor: pointer;
  font-size: 0.88rem;
  transition: background 0.2s ease, color 0.2s ease, box-shadow 0.2s ease;
}

.auth-tabs__btn.is-active,
.hub-tabs__btn.is-active {
  background: rgba(255, 255, 255, 0.12);
  color: var(--text);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.1) inset;
}

.auth-panels {
  position: relative;
  min-height: 17.5rem;
}

.auth-panel {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  opacity: 0;
  filter: blur(10px);
  transform: translateY(8px) scale(0.98);
  pointer-events: none;
  transition:
    opacity 0.2s cubic-bezier(0.32, 0.72, 0, 1),
    filter 0.2s cubic-bezier(0.32, 0.72, 0, 1),
    transform 0.2s cubic-bezier(0.32, 0.72, 0, 1);
}

.auth-panel.is-active {
  opacity: 1;
  filter: blur(0);
  transform: translateY(0) scale(1);
  pointer-events: auto;
}

.auth-panel.is-leaving {
  opacity: 0;
  filter: blur(10px);
  transform: translateY(-6px) scale(0.98);
  pointer-events: none;
}

.auth-panel.is-entering {
  opacity: 0;
  filter: blur(10px);
  transform: translateY(8px) scale(0.98);
  pointer-events: none;
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.auth-form label {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  font-size: 0.82rem;
  color: var(--muted);
}

.auth-form input {
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(0, 0, 0, 0.22);
  color: var(--text);
  border-radius: 0.65rem;
  padding: 0.6rem 0.75rem;
  font-size: 0.95rem;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  transition: border-color 0.2s ease, background 0.2s ease;
}

.auth-form input:focus {
  outline: none;
  border-color: rgba(79, 140, 255, 0.55);
  background: rgba(0, 0, 0, 0.28);
}

.auth-error {
  margin: 0;
  font-size: 0.82rem;
  color: #ff9f9f;
}

.auth-submit {
  margin-top: 0.25rem;
  border: 0;
  border-radius: 0.75rem;
  background: linear-gradient(180deg, rgba(79, 140, 255, 0.95), rgba(61, 120, 234, 0.95));
  color: white;
  padding: 0.7rem 1rem;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 4px 16px rgba(79, 140, 255, 0.28);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.auth-submit:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(79, 140, 255, 0.38);
}

body.modal-open {
  overflow: hidden;
}

/* ── Account / Evolution hub modal ── */

.hub-modal {
  position: fixed;
  inset: 0;
  z-index: 110;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  pointer-events: auto;
}

.hub-modal.is-closing {
  pointer-events: none;
}

.hub-modal__close {
  position: absolute;
  top: 0.65rem;
  right: 0.65rem;
}

.hub-modal__title {
  margin: 0 0 0.25rem;
  font-size: 1.15rem;
}

.hub-modal__sub {
  margin: 0 0 1rem;
  font-size: 0.84rem;
  color: var(--muted);
}

.hub-panel {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.hub-meta {
  display: grid;
  gap: 0.65rem;
  margin: 0;
}

.hub-meta > div {
  display: grid;
  grid-template-columns: 8.5rem 1fr;
  gap: 0.5rem;
  align-items: baseline;
}

.hub-meta dt {
  margin: 0;
  font-size: 0.78rem;
  color: var(--muted);
}

.hub-meta dd {
  margin: 0;
  font-size: 0.88rem;
  word-break: break-word;
}

.hub-meta--model > div {
  grid-template-columns: 7rem 1fr;
}

.hub-muted {
  margin: 0;
  font-size: 0.84rem;
  color: var(--muted);
}

.hub-loading,
.hub-error {
  margin: 0;
  font-size: 0.88rem;
  color: var(--muted);
}

.hub-error {
  color: #ff8f8f;
}

.hub-screenshot {
  margin: 0;
  border: 1px solid var(--border);
  border-radius: 0.75rem;
  overflow: hidden;
  background: var(--bg-elevated);
}

.hub-screenshot img {
  display: block;
  width: 100%;
  height: auto;
}

.hub-screenshot figcaption {
  padding: 0.55rem 0.75rem;
  font-size: 0.78rem;
  color: var(--muted);
  border-top: 1px solid var(--border);
}

.evolution-timeline {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.evolution-card {
  border: 1px solid var(--border);
  border-radius: 0.85rem;
  padding: 0.9rem 1rem 1rem;
  background: var(--bg-elevated);
}

.evolution-card.is-current {
  border-color: #35507a;
  box-shadow: 0 0 0 1px rgba(79, 140, 255, 0.15);
}

.evolution-card__head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.45rem 0.65rem;
  margin-bottom: 0.35rem;
}

.evolution-card__version {
  font-weight: 700;
  font-size: 0.95rem;
}

.evolution-card__badge {
  font-size: 0.68rem;
  padding: 0.1rem 0.45rem;
  border-radius: 999px;
  color: #9ec2ff;
  border: 1px solid #35507a;
  background: rgba(79, 140, 255, 0.1);
}

.evolution-card__date {
  margin-left: auto;
  font-size: 0.76rem;
  color: var(--muted);
}

.evolution-card__title {
  margin: 0 0 0.35rem;
  font-size: 1rem;
}

.evolution-card__model {
  font-size: 0.78rem;
  color: var(--muted);
  margin-bottom: 0.65rem;
}

.evolution-card__shot {
  display: block;
  width: 100%;
  border-radius: 0.55rem;
  margin-bottom: 0.75rem;
  border: 1px solid var(--border);
}

.evolution-card__changelog {
  font-size: 0.88rem;
}

.evolution-card__changelog ul {
  margin: 0.35rem 0 0;
  padding-left: 1.1rem;
}

.hub-model-details {
  font-size: 0.9rem;
}

.hub-logout {
  align-self: flex-start;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 0.84rem;
  cursor: pointer;
  padding: 0.35rem 0;
}

.hub-logout:hover {
  color: var(--text);
  text-decoration: underline;
}

/* ── Share modal ── */

.share-modal {
  position: fixed;
  inset: 0;
  z-index: 105;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  pointer-events: auto;
}

.share-modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.share-modal__dialog {
  position: relative;
  width: min(100%, 26rem);
  padding: 1.25rem;
  border: 1px solid var(--border);
  border-radius: 1.1rem;
  background: var(--panel);
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.5);
}

.share-modal__close {
  position: absolute;
  top: 0.55rem;
  right: 0.55rem;
}

.share-modal__title {
  margin: 0 0 0.35rem;
  font-size: 1.05rem;
}

.share-modal__sub {
  margin: 0 0 1rem;
  font-size: 0.82rem;
  color: var(--muted);
  line-height: 1.45;
}

.share-modal__field {
  display: flex;
  gap: 0.5rem;
}

.share-modal__field input {
  flex: 1;
  min-width: 0;
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--text);
  border-radius: var(--radius-sm);
  padding: 0.55rem 0.65rem;
  font-size: 0.82rem;
}

.share-modal__copy {
  border: 0;
  border-radius: var(--radius-sm);
  background: var(--accent);
  color: #fff;
  font-weight: 600;
  font-size: 0.82rem;
  padding: 0.55rem 0.85rem;
  cursor: pointer;
  white-space: nowrap;
}

.share-modal__revoke {
  margin-top: 0.85rem;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 0.82rem;
  cursor: pointer;
  padding: 0.25rem 0;
}

.share-modal__revoke:hover {
  color: var(--text);
  text-decoration: underline;
}

.share-error {
  max-width: var(--thread-max);
  margin: 2rem auto;
  padding: 0 1rem;
  color: #ffb4b4;
  text-align: center;
}

body.is-share-view .sidebar {
  display: none !important;
}

body.is-share-view .composer {
  display: none !important;
}

body.is-share-view .mobile-nav {
  display: none !important;
}

.mobile-nav {
  display: none;
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 30;
  padding: 0.35rem 0.5rem calc(0.35rem + env(safe-area-inset-bottom, 0));
  background: rgba(10, 10, 10, 0.92);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-top: 1px solid var(--border);
  justify-content: space-around;
  align-items: stretch;
  gap: 0.25rem;
}

.mobile-nav__btn {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.15rem;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 600;
  padding: 0.35rem 0.25rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  min-height: 3rem;
  transition: background 0.15s ease, color 0.15s ease;
}

.mobile-nav__btn:hover,
.mobile-nav__btn:focus-visible {
  background: var(--panel-hover);
  color: var(--text);
}

.mobile-nav__avatar {
  width: 1.35rem;
  height: 1.35rem;
  border-radius: 50%;
  background: linear-gradient(135deg, #5436da, #4f8cff);
  color: #fff;
  font-size: 0.55rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
}

body:not(.is-share-view) .sidebar {
  display: flex !important;
}

@media (prefers-reduced-motion: reduce) {
  .send-btn.is-sent::before,
  .send-btn.is-sending::before,
  .send-btn.is-sending svg,
  .send-btn.is-sending {
    animation: none !important;
  }
}

@media (max-width: 860px) {
  .layout {
    grid-template-columns: minmax(0, 1fr);
    transition: none;
  }

  body.sidebar-collapsed {
    --sidebar-current-width: var(--sidebar-width);
  }

  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: var(--sidebar-width) !important;
    transform: translateX(-100%);
    transition: transform 0.25s ease;
    box-shadow: 8px 0 32px rgba(0, 0, 0, 0.35);
  }

  body.sidebar-collapsed .sidebar__brand,
  body.sidebar-collapsed .sidebar__brand-text,
  body.sidebar-collapsed .sidebar__new-label,
  body.sidebar-collapsed .sidebar__meta,
  body.sidebar-collapsed .sidebar__minimize-foot,
  body.sidebar-collapsed .sidebar__list,
  body.sidebar-collapsed .sidebar__foot {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
  }

  body.sidebar-collapsed .sidebar__brand {
    display: inline-flex;
  }

  body.sidebar-collapsed .sidebar__icon-collapse {
    display: block;
  }

  body.sidebar-collapsed .sidebar__icon-expand {
    display: none;
  }

  body.sidebar-collapsed .sidebar__head {
    justify-content: space-between;
    padding: 0.75rem 0.75rem 0.45rem;
  }

  body.sidebar-collapsed .sidebar__new {
    margin: 0 0.75rem 0.75rem;
    padding: 0.7rem 0.9rem;
    width: auto;
  }

  .sidebar.is-open {
    transform: translateX(0);
  }

  .sidebar__collapse {
    display: none;
  }

  .sidebar__close {
    display: inline-flex;
  }

  .topbar__menu {
    display: inline-flex;
  }

  .sidebar-backdrop:not([hidden]) {
    display: block !important;
    pointer-events: auto !important;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
    z-index: 20;
  }

  .sidebar-backdrop[hidden] {
    display: none !important;
    pointer-events: none !important;
  }

  .main {
    grid-column: 1;
  }

  .mobile-nav {
    display: flex;
  }

  .auth-user,
  .auth-guest {
    display: none;
  }

  .composer {
    padding-bottom: calc(4.5rem + env(safe-area-inset-bottom, 0));
  }

  .reasoning-picker__btn span#reasoning-picker-label {
    display: none;
  }
}

/* ── Forum ── */

.sidebar__forum {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  margin: 0 0.75rem 0.75rem;
  padding: 0.65rem 0.9rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: rgba(79, 140, 255, 0.08);
  color: #9ec2ff;
  text-decoration: none;
  font-size: 0.88rem;
  font-weight: 600;
  transition: background 0.15s ease;
}

.sidebar__forum:hover {
  background: rgba(79, 140, 255, 0.15);
  color: var(--text);
}

.topbar__forum {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 500;
  padding: 0.35rem 0.55rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
}

.topbar__forum:hover {
  background: var(--panel-hover);
  color: var(--text);
}

.auth-user__rank {
  font-size: 0.62rem;
  margin-left: 0.15rem;
}

body.is-forum-view .composer {
  display: none !important;
}

.forum-view {
  flex: 1;
  overflow-y: auto;
  min-height: 0;
}

.forum-view__inner {
  max-width: 52rem;
  margin: 0 auto;
  padding: 1.25rem 1rem 2rem;
}

.forum-page__head {
  margin-bottom: 1.5rem;
}

.forum-page__title {
  margin: 0;
  font-size: 1.5rem;
}

.forum-page__sub {
  margin: 0.35rem 0 0.75rem;
  color: var(--muted);
  font-size: 0.92rem;
}

.forum-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 14rem;
  gap: 1.25rem;
}

.forum-cat {
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 1rem;
  margin-bottom: 1rem;
  background: var(--bg-elevated);
}

.forum-cat__head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 0.5rem;
}

.forum-cat__head h3 {
  margin: 0;
  font-size: 1.05rem;
}

.forum-cat__head a {
  color: var(--text);
  text-decoration: none;
}

.forum-cat__head a:hover {
  color: #9ec2ff;
}

.forum-cat__count,
.forum-cat__desc {
  font-size: 0.82rem;
  color: var(--muted);
}

.forum-subcats {
  display: grid;
  gap: 0.45rem;
  margin-top: 0.75rem;
}

.forum-subcat {
  display: flex;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.55rem 0.65rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-subtle);
  text-decoration: none;
  color: var(--text);
  transition: background 0.15s ease;
}

.forum-subcat:hover {
  background: var(--panel-hover);
}

.forum-subcat__meta {
  font-size: 0.72rem;
  color: var(--muted);
}

.forum-aside {
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 0.85rem;
  background: var(--bg-elevated);
  height: fit-content;
}

.forum-aside h4 {
  margin: 0 0 0.65rem;
  font-size: 0.88rem;
}

.forum-leaders {
  list-style: none;
  margin: 0;
  padding: 0;
}

.forum-leader {
  display: grid;
  grid-template-columns: 1.25rem 1fr auto;
  gap: 0.25rem 0.35rem;
  align-items: center;
  padding: 0.35rem 0;
  font-size: 0.78rem;
  border-bottom: 1px solid var(--border-subtle);
}

.forum-leader__pos {
  color: var(--muted);
  font-weight: 700;
}

.forum-leader__pts {
  grid-column: 3;
  color: var(--muted);
  font-size: 0.68rem;
}

.forum-btn {
  border: 0;
  background: var(--accent);
  color: #fff;
  font-weight: 600;
  font-size: 0.85rem;
  padding: 0.5rem 0.9rem;
  border-radius: var(--radius-pill);
  cursor: pointer;
}

.forum-btn--ghost {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text);
}

.forum-breadcrumb {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  font-size: 0.8rem;
  color: var(--muted);
  margin-bottom: 1rem;
}

.forum-breadcrumb a {
  color: #9ec2ff;
  text-decoration: none;
}

.forum-topic-list {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.forum-topic-row {
  display: grid;
  grid-template-columns: 1.5rem minmax(0, 1fr) auto;
  gap: 0.65rem;
  align-items: center;
  padding: 0.75rem 0.85rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  text-decoration: none;
  color: inherit;
  background: var(--bg-elevated);
  transition: border-color 0.15s ease;
}

.forum-topic-row:hover {
  border-color: rgba(79, 140, 255, 0.35);
}

.forum-topic-row__title {
  display: block;
  font-weight: 600;
  font-size: 0.95rem;
}

.forum-topic-row__meta {
  display: block;
  font-size: 0.75rem;
  color: var(--muted);
  margin-top: 0.15rem;
}

.forum-topic-row__stats {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  font-size: 0.72rem;
  color: var(--muted);
  text-align: right;
}

.forum-post {
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 1rem;
  margin-bottom: 0.65rem;
  background: var(--bg-elevated);
}

.forum-post__head {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.35rem;
  margin-bottom: 0.65rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--border-subtle);
}

.forum-post__time {
  font-size: 0.72rem;
  color: var(--muted);
}

.forum-author {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem;
}

.forum-author__name {
  font-weight: 600;
  font-size: 0.88rem;
}

.forum-rank {
  display: inline-block;
  font-size: 0.68rem;
  font-weight: 700;
  padding: 0.12rem 0.45rem;
  border-radius: 999px;
  border: 1px solid var(--rank-color, #9ec2ff);
  color: var(--rank-color, #9ec2ff);
  background: color-mix(in srgb, var(--rank-color, #9ec2ff) 12%, transparent);
}

.forum-rank--compact {
  font-size: 0.6rem;
  padding: 0.08rem 0.35rem;
}

.forum-badges {
  display: inline-flex;
  gap: 0.2rem;
}

.forum-badge {
  font-size: 0.85rem;
  line-height: 1;
  filter: drop-shadow(0 0 4px color-mix(in srgb, var(--badge-color) 40%, transparent));
}

.forum-badges--compact .forum-badge {
  font-size: 0.75rem;
}

.forum-reply,
.forum-new-topic {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  margin-top: 1rem;
}

.forum-reply textarea,
.forum-new-topic textarea,
.forum-new-topic input {
  border: 1px solid var(--border);
  background: var(--panel);
  color: var(--text);
  border-radius: var(--radius-sm);
  padding: 0.65rem 0.75rem;
  font: inherit;
}

.hub-profile-head {
  margin-bottom: 1rem;
}

.hub-profile-head h3 {
  margin: 0 0 0.35rem;
}

.hub-profile-points {
  display: block;
  font-size: 0.85rem;
  color: var(--muted);
  margin-top: 0.35rem;
}

.hub-badges-grid {
  display: grid;
  gap: 0.55rem;
  margin-top: 0.65rem;
}

.hub-badge-card {
  display: flex;
  gap: 0.65rem;
  align-items: flex-start;
  padding: 0.65rem 0.75rem;
  border: 1px solid color-mix(in srgb, var(--badge-color) 35%, var(--border));
  border-radius: var(--radius-sm);
  background: color-mix(in srgb, var(--badge-color) 8%, var(--bg-elevated));
}

.hub-badge-card__icon {
  font-size: 1.35rem;
}

.hub-badge-card p {
  margin: 0.15rem 0 0;
  font-size: 0.8rem;
  color: var(--muted);
}

.hub-badge-card small {
  font-size: 0.7rem;
  color: var(--muted);
}

.forum-loading,
.forum-error,
.forum-empty,
.forum-hint {
  color: var(--muted);
  font-size: 0.9rem;
}

@media (max-width: 860px) {
  .forum-layout {
    grid-template-columns: 1fr;
  }

  .forum-aside {
    order: -1;
  }

  .topbar__forum-label {
    display: none;
  }

  .mobile-nav__btn {
    font-size: 0.6rem;
    min-height: 2.75rem;
  }
}

/* ── Chat-Links & URL-Shortener ── */

.msg__link {
  color: var(--accent, #4f8cff);
  text-decoration: underline;
  text-underline-offset: 2px;
  word-break: break-all;
}

.msg__link:hover {
  opacity: 0.85;
}

/* ── Dokumentation ── */

.docs-layout {
  display: grid;
  grid-template-columns: 180px 1fr;
  gap: 1rem;
  min-height: 280px;
}

.docs-nav__group h4 {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  margin: 0.75rem 0 0.35rem;
}

.docs-nav__btn {
  display: block;
  width: 100%;
  text-align: left;
  padding: 0.4rem 0.5rem;
  border: none;
  background: transparent;
  color: var(--text);
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.85rem;
}

.docs-nav__btn:hover,
.docs-nav__btn.is-active {
  background: rgba(79, 140, 255, 0.12);
  color: var(--accent, #4f8cff);
}

.docs-content {
  max-height: 420px;
  overflow-y: auto;
}

/* ── Admin-Panel ── */

.admin-sections {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-bottom: 1rem;
}

.admin-sections__btn {
  padding: 0.35rem 0.65rem;
  border: 1px solid var(--border, rgba(255,255,255,0.1));
  border-radius: 6px;
  background: transparent;
  color: var(--text);
  font-size: 0.78rem;
  cursor: pointer;
}

.admin-sections__btn.is-active {
  background: rgba(243, 104, 224, 0.15);
  border-color: rgba(243, 104, 224, 0.4);
  color: #f368e0;
}

.admin-stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
  gap: 0.65rem;
}

.admin-stat {
  padding: 0.75rem;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.04);
  text-align: center;
}

.admin-stat__val {
  display: block;
  font-size: 1.25rem;
  font-weight: 600;
}

.admin-stat__lbl {
  font-size: 0.72rem;
  color: var(--muted);
}

.admin-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8rem;
}

.admin-table th,
.admin-table td {
  padding: 0.45rem 0.5rem;
  border-bottom: 1px solid var(--border, rgba(255,255,255,0.08));
  text-align: left;
  vertical-align: top;
}

.admin-table--wide td.admin-truncate {
  max-width: 200px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.admin-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
}

.admin-btn {
  padding: 0.25rem 0.5rem;
  border: 1px solid var(--border, rgba(255,255,255,0.15));
  border-radius: 5px;
  background: rgba(79, 140, 255, 0.1);
  color: var(--text);
  font-size: 0.72rem;
  cursor: pointer;
}

.admin-btn:hover {
  background: rgba(79, 140, 255, 0.2);
}

.admin-btn--danger {
  background: rgba(255, 80, 80, 0.12);
  border-color: rgba(255, 80, 80, 0.3);
}

.admin-input,
.admin-textarea {
  width: 100%;
  margin: 0.35rem 0 0.75rem;
  padding: 0.5rem;
  border-radius: 6px;
  border: 1px solid var(--border, rgba(255,255,255,0.12));
  background: rgba(0, 0, 0, 0.2);
  color: var(--text);
  font: inherit;
}

.admin-release {
  margin-bottom: 1.25rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border, rgba(255,255,255,0.08));
}

.admin-release__head {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
  margin-bottom: 0.5rem;
}

.admin-docs-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-bottom: 1rem;
}

.admin-doc-btn {
  padding: 0.35rem 0.6rem;
  border-radius: 6px;
  border: 1px solid var(--border, rgba(255,255,255,0.12));
  background: transparent;
  color: var(--text);
  cursor: pointer;
  font-size: 0.8rem;
}

.admin-doc-editor {
  margin-top: 0.75rem;
}

.admin-doc-preview {
  margin-top: 0.75rem;
  max-height: 200px;
  overflow-y: auto;
}

.admin-views [data-admin-view] {
  max-height: 380px;
  overflow-y: auto;
}

.admin-access-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-top: 1rem;
}

.admin-access-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  justify-content: space-between;
  padding: 0.75rem;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.admin-access-row__url {
  margin: 0.35rem 0;
  font-size: 0.75rem;
}

@media (max-width: 860px) {
  .docs-layout {
    grid-template-columns: 1fr;
  }
}

/* ── Launch Preview Gate ── */

html.spike-gate-boot .layout,
body.is-private-gated .layout {
  filter: blur(22px) saturate(0.45) brightness(0.45);
  pointer-events: none;
  user-select: none;
  transform: scale(1.01);
}

html.spike-gate-boot .mobile-nav,
body.is-private-gated .mobile-nav {
  display: none !important;
}

.private-gate {
  position: fixed;
  inset: 0;
  z-index: 12000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  overflow: hidden;
  pointer-events: auto;
  touch-action: manipulation;
}

.private-gate[hidden] {
  display: none !important;
}

html.spike-gate-boot #private-gate,
body.is-private-gated #private-gate {
  display: flex !important;
}

.private-gate__backdrop {
  position: absolute;
  inset: 0;
  z-index: 0;
  background: rgba(2, 4, 10, 0.92);
  backdrop-filter: blur(16px);
  pointer-events: none;
}

.private-gate__dialog {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  width: min(620px, 100%);
  max-height: calc(100vh - 2rem);
  overflow: hidden;
  pointer-events: auto;
  padding: 1.75rem 1.65rem 1.35rem;
  border-radius: 22px;
  border: 1px solid rgba(255, 255, 255, 0.09);
  background:
    linear-gradient(165deg, rgba(22, 26, 38, 0.98) 0%, rgba(10, 12, 18, 0.99) 100%);
  box-shadow:
    0 32px 100px rgba(0, 0, 0, 0.65),
    inset 0 1px 0 rgba(255, 255, 255, 0.06);
  text-align: left;
}

.private-gate__glow {
  position: absolute;
  top: -30%;
  right: -20%;
  width: 320px;
  height: 320px;
  background: radial-gradient(circle, rgba(79, 140, 255, 0.18), transparent 68%);
  pointer-events: none;
}

.private-gate__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 1.1rem;
}

.private-gate__brand {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
}

.private-gate__logo {
  font-size: 1.35rem;
}

.private-gate__brand-text {
  font-weight: 700;
  font-size: 1.05rem;
  letter-spacing: 0.03em;
}

.private-gate__badge {
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 0.3rem 0.55rem;
  border-radius: 999px;
  border: 1px solid rgba(79, 140, 255, 0.35);
  background: rgba(79, 140, 255, 0.1);
  color: #9ec2ff;
  white-space: nowrap;
}

.private-gate__title {
  margin: 0 0 0.55rem;
  font-size: clamp(1.35rem, 4vw, 1.75rem);
  font-weight: 700;
  line-height: 1.25;
  letter-spacing: -0.02em;
}

.private-gate__sub {
  color: var(--muted, #9aa3b2);
  font-size: 0.9rem;
  line-height: 1.55;
  margin: 0 0 0.65rem;
}

.private-gate__teaser {
  margin: 0 0 1rem;
  font-size: 0.78rem;
  line-height: 1.45;
  text-align: center;
  color: rgba(200, 218, 255, 0.85);
}

.private-gate__teaser strong {
  color: #c8daff;
}

.private-gate__panel-title {
  margin: 0 0 0.35rem;
  font-size: 0.95rem;
  font-weight: 700;
  line-height: 1.3;
}

.private-gate__panel-lead {
  margin: 0 0 0.75rem;
  font-size: 0.78rem;
  line-height: 1.45;
  color: var(--muted, #9aa3b2);
}

.private-gate__access-list {
  margin: 0 0 0.85rem;
  padding: 0 0 0 1.1rem;
  font-size: 0.78rem;
  line-height: 1.5;
  color: var(--muted, #9aa3b2);
}

.private-gate__access-list li {
  margin-bottom: 0.35rem;
}

.private-gate__access-list li:last-child {
  margin-bottom: 0;
}

/* Early Access apply form */
.gate-apply-form-wrap {
  margin-bottom: 0.75rem;
}

.gate-apply-form {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}

.gate-apply-form__row {
  margin: 0;
}

.gate-apply-form__label {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  font-size: 0.72rem;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.82);
}

.gate-apply-form__label input,
.gate-apply-form__label textarea {
  width: 100%;
  padding: 0.5rem 0.6rem;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(0, 0, 0, 0.28);
  color: #eef2ff;
  font-size: 0.82rem;
  font-weight: 400;
  font-family: inherit;
  resize: vertical;
}

.gate-apply-form__label input:focus,
.gate-apply-form__label textarea:focus {
  outline: none;
  border-color: rgba(79, 140, 255, 0.55);
  box-shadow: 0 0 0 2px rgba(79, 140, 255, 0.15);
}

.gate-apply-form__consent {
  display: flex;
  align-items: flex-start;
  gap: 0.45rem;
  font-size: 0.68rem;
  line-height: 1.4;
  color: var(--muted, #9aa3b2);
}

.gate-apply-form__consent input {
  margin-top: 0.15rem;
  flex-shrink: 0;
}

.gate-apply-form__submit {
  width: 100%;
  margin-top: 0.15rem;
}

.gate-apply-form__error {
  margin: 0;
}

.heimdall-captcha {
  padding: 0.65rem 0.7rem;
  border-radius: 12px;
  border: 1px solid rgba(79, 140, 255, 0.28);
  background: linear-gradient(145deg, rgba(12, 18, 32, 0.95), rgba(8, 12, 22, 0.98));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

.heimdall-captcha__head {
  display: flex;
  align-items: flex-start;
  gap: 0.55rem;
  margin-bottom: 0.55rem;
}

.heimdall-captcha__shield {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  border-radius: 8px;
  background: rgba(79, 140, 255, 0.15);
  border: 1px solid rgba(79, 140, 255, 0.3);
  font-size: 1rem;
  flex-shrink: 0;
}

.heimdall-captcha__label {
  margin: 0;
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(158, 194, 255, 0.85);
}

.heimdall-captcha__question {
  margin: 0.1rem 0 0;
  font-size: 0.8rem;
  font-weight: 600;
  color: #e8efff;
}

.heimdall-captcha__refresh {
  margin-left: auto;
  width: 2rem;
  height: 2rem;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.04);
  color: #c8daff;
  cursor: pointer;
  font-size: 1rem;
  line-height: 1;
}

.heimdall-captcha__answer-label {
  margin-bottom: 0.45rem;
}

.heimdall-captcha__brand {
  margin: 0.35rem 0 0;
  text-align: center;
  width: 100%;
  font-size: 0.62rem;
  color: rgba(255, 255, 255, 0.42);
}

.heimdall-captcha__brand a {
  color: rgba(158, 194, 255, 0.95);
  text-decoration: none;
  font-weight: 600;
}

.heimdall-captcha__brand a:hover {
  text-decoration: underline;
}

.gate-apply-thanks {
  text-align: center;
  padding: 1.25rem 0.75rem;
  border-radius: 14px;
  border: 1px solid rgba(61, 214, 140, 0.28);
  background: rgba(61, 214, 140, 0.08);
}

.gate-apply-thanks[hidden] {
  display: none !important;
}

.gate-apply-thanks__icon {
  width: 2.5rem;
  height: 2.5rem;
  margin: 0 auto 0.55rem;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(61, 214, 140, 0.2);
  color: #3dd68c;
  font-size: 1.25rem;
  font-weight: 700;
}

.gate-apply-thanks__title {
  margin: 0 0 0.35rem;
  font-size: 0.95rem;
  font-weight: 700;
}

.gate-apply-thanks__text {
  margin: 0 0 0.35rem;
  font-size: 0.78rem;
  line-height: 1.5;
  color: rgba(232, 239, 255, 0.92);
}

.gate-apply-thanks__note {
  margin: 0;
  font-size: 0.72rem;
  color: var(--muted, #9aa3b2);
}

.gate-apply-invite {
  margin-top: 0.85rem;
  padding-top: 0.75rem;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.private-gate__features {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.55rem;
  margin-bottom: 1.15rem;
}

.private-gate__feature {
  display: flex;
  gap: 0.55rem;
  align-items: flex-start;
  padding: 0.65rem 0.7rem;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.private-gate__feature-icon {
  font-size: 1.1rem;
  line-height: 1.4;
  flex-shrink: 0;
}

.private-gate__feature strong {
  display: block;
  font-size: 0.78rem;
  font-weight: 600;
  margin-bottom: 0.15rem;
}

.private-gate__feature p {
  margin: 0;
  font-size: 0.72rem;
  line-height: 1.4;
  color: var(--muted, #9aa3b2);
}

.private-gate__feature code {
  font-size: 0.68rem;
  padding: 0.05rem 0.25rem;
  border-radius: 4px;
  background: rgba(79, 140, 255, 0.12);
}

.private-gate__countdown-block {
  position: relative;
  isolation: isolate;
  text-align: center;
  padding: 1rem 0.75rem 0.85rem;
  margin-bottom: 0.85rem;
  border-radius: 14px;
  background: rgba(0, 0, 0, 0.22);
  border: 1px solid rgba(255, 255, 255, 0.06);
  transition: border-color 0.35s ease, box-shadow 0.35s ease;
}

.private-gate__countdown-block::after {
  content: "";
  position: absolute;
  inset: -4px;
  border-radius: 17px;
  pointer-events: none;
  opacity: 0;
  z-index: -1;
}

.private-gate__countdown-block.is-burning {
  border-color: rgba(255, 145, 55, 0.42);
}

.private-gate__countdown-block.is-burning::after {
  animation: countdown-minute-burn 1.5s ease-out forwards;
}

@keyframes countdown-minute-burn {
  0% {
    opacity: 0;
    box-shadow:
      0 0 0 rgba(255, 120, 40, 0),
      0 0 0 rgba(255, 70, 20, 0);
  }
  18% {
    opacity: 1;
    box-shadow:
      0 0 6px rgba(255, 160, 60, 0.45),
      0 0 14px rgba(255, 110, 35, 0.38),
      0 0 28px rgba(255, 75, 20, 0.22),
      0 0 42px rgba(255, 50, 10, 0.1);
    outline: 1px solid rgba(255, 150, 50, 0.35);
    outline-offset: 1px;
  }
  100% {
    opacity: 0;
    box-shadow:
      0 0 0 rgba(255, 120, 40, 0),
      0 0 0 rgba(255, 70, 20, 0);
    outline: 1px solid transparent;
  }
}

.private-gate__countdown-label {
  margin: 0 0 0.2rem;
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.45);
}

.private-gate__launch-note {
  margin: 0 0 0.75rem;
  font-size: 0.82rem;
  color: var(--muted, #9aa3b2);
}

.private-countdown {
  margin: 0;
}

.private-countdown__grid {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.3rem;
}

.private-countdown__unit {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 4rem;
  padding: 0.55rem 0.4rem;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.07);
}

.private-countdown__num {
  font-size: 1.65rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  line-height: 1.1;
  background: linear-gradient(135deg, #c8daff, #4f8cff);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.private-countdown__lbl {
  font-size: 0.6rem;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: var(--muted, #9aa3b2);
  margin-top: 0.15rem;
}

.private-countdown__sep {
  font-size: 1.35rem;
  font-weight: 300;
  color: rgba(255, 255, 255, 0.2);
  padding-bottom: 0.85rem;
}

.private-gate__hint {
  text-align: center;
  color: var(--muted, #9aa3b2);
  font-size: 0.82rem;
  margin: 0;
}

.private-gate__login {
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.private-gate__login-head strong {
  display: block;
  font-size: 0.9rem;
  margin-bottom: 0.25rem;
}

.private-gate__login-lead {
  color: var(--muted, #9aa3b2);
  font-size: 0.82rem;
  line-height: 1.45;
  margin: 0 0 0.65rem;
}

.private-gate__form {
  margin-top: 0.5rem;
}

.private-gate__submit {
  width: 100%;
  margin-top: 0.25rem;
}

.private-gate__footer {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.35rem;
  margin: 1.1rem 0 0;
  text-align: center;
  font-size: 0.7rem;
  color: rgba(255, 255, 255, 0.32);
}

.private-gate__footer-brand {
  color: rgba(255, 255, 255, 0.45);
}

.private-gate__online {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  background: rgba(79, 140, 255, 0.1);
  border: 1px solid rgba(79, 140, 255, 0.22);
  color: rgba(200, 218, 255, 0.9);
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.private-gate__online[hidden] {
  display: none !important;
}

.private-gate__online-dot {
  width: 0.45rem;
  height: 0.45rem;
  border-radius: 50%;
  background: #3dd68c;
  box-shadow: 0 0 6px rgba(61, 214, 140, 0.65);
  animation: private-gate-pulse 2s ease-in-out infinite;
}

@keyframes private-gate-pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.65; transform: scale(0.92); }
}

/* Gate tabs */
.private-gate__tabs {
  display: flex;
  gap: 0.25rem;
  margin-bottom: 0.65rem;
  padding: 0.2rem;
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid rgba(255, 255, 255, 0.06);
  position: relative;
  z-index: 5;
  flex-shrink: 0;
}

.private-gate__tab {
  flex: 1;
  min-height: 2.5rem;
  padding: 0.55rem 0.35rem;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: var(--muted, #9aa3b2);
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  position: relative;
  z-index: 6;
  -webkit-user-select: none;
  user-select: none;
}

.private-gate__tab.is-active {
  background: rgba(79, 140, 255, 0.18);
  color: #c8daff;
}

.private-gate__panels {
  flex: 1;
  min-height: 0;
  overflow: hidden;
  position: relative;
}

.private-gate__panel {
  display: none;
  height: 100%;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.private-gate__panel.is-active {
  display: block;
}

.private-gate__panel[hidden] {
  display: none !important;
}

.private-countdown__grid--compact {
  gap: 0.35rem;
}

.private-countdown__grid--compact .private-countdown__unit {
  min-width: 3.1rem;
  padding: 0.4rem 0.25rem;
}

.private-countdown__grid--compact .private-countdown__num {
  font-size: 1.2rem;
}

.private-gate__form--compact label {
  margin-bottom: 0.45rem;
}

.private-gate__form--compact input {
  padding: 0.45rem 0.55rem;
}

@media (min-width: 861px) {
  .private-gate__dialog {
    max-height: calc(100vh - 2rem);
    overflow: hidden;
  }

  .private-gate__features--grid {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 860px) {
  .private-gate {
    padding: 0;
    align-items: stretch;
  }

  .private-gate__dialog {
    width: 100%;
    max-height: 100dvh;
    height: 100dvh;
    overflow: hidden;
    padding: 0.85rem 0.75rem 0.55rem;
    border-radius: 0;
  }

  .private-gate__tabs {
    display: flex;
    flex-shrink: 0;
  }

  .private-gate__header {
    margin-bottom: 0.45rem;
  }

  .private-gate__title {
    font-size: 1.05rem;
    margin-bottom: 0.45rem;
    text-align: center;
  }

  .private-gate__sub {
    font-size: 0.78rem;
    margin-bottom: 0.5rem;
    text-align: center;
  }

  .private-gate__panel-title {
    text-align: center;
  }

  .private-gate__panel-lead {
    text-align: center;
  }

  .private-gate__features--grid {
    grid-template-columns: 1fr;
    margin-bottom: 0;
  }

  .private-gate__feature {
    padding: 0.55rem 0.6rem;
  }

  .private-gate__teaser {
    font-size: 0.72rem;
  }

  .private-gate__countdown-block {
    padding: 0.65rem 0.5rem 0.55rem;
    margin-bottom: 0;
  }

  .private-gate__countdown-label {
    font-size: 0.62rem;
  }

  .private-gate__launch-note {
    font-size: 0.74rem;
    margin-bottom: 0.45rem;
  }

  .private-gate__footer {
    margin-top: 0.45rem;
    font-size: 0.62rem;
  }

  .private-gate__hint {
    font-size: 0.76rem;
    text-align: center;
  }

  .private-gate__login-lead {
    font-size: 0.76rem;
    text-align: center;
    margin-bottom: 0.5rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  .msg { animation: none; }
  .sidebar { transition: none; }
  .private-gate__countdown-block.is-burning::after { animation: none; opacity: 0; }
  .private-gate__online-dot { animation: none; }
}