/* ==================== TOPBAR ==================== */
.topbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 50;
  height: var(--topbar-h);
  background: rgba(5, 5, 7, 0.88);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border);
  transition: top 0.2s ease;
}

body.has-sandbox .topbar {
  top: 37px;
}

body.has-sandbox .app-main {
  padding-top: calc(var(--topbar-h) + 37px);
}

.topbar-inner {
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

/* Brand */
.topbar-brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
  cursor: pointer;
  background: none;
  border: none;
  color: #fff;
  text-align: left;
}

.topbar-brand-logo {
  width: 42px;
  height: 42px;
  object-fit: contain;
  filter: drop-shadow(0 0 14px rgba(230, 0, 18, 0.45));
}

.topbar-brand-text {
  display: flex;
  flex-direction: column;
  line-height: 1;
}

.topbar-brand-title {
  display: flex;
  align-items: baseline;
  gap: 4px;
}

.topbar-brand-main {
  font-family: 'Anton', sans-serif;
  font-size: 1.55rem;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  text-shadow: 0 3px 0 #000, 0 0 16px rgba(230, 0, 18, 0.35);
}

.topbar-brand-sub {
  font-family: 'Permanent Marker', cursive;
  font-size: 1.15rem;
  color: var(--primary);
  transform: rotate(-5deg);
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.95), 0 0 14px rgba(230, 0, 18, 0.65);
}

.topbar-brand-tag {
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
  margin-top: 2px;
}

/* Center Category Navigation */
.topbar-nav {
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border);
  padding: 5px;
  border-radius: 14px;
}

.topbar-tab {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 9px 15px;
  border-radius: 10px;
  background: transparent;
  border: none;
  color: var(--text-soft);
  font-size: 0.76rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  cursor: pointer;
  transition: all 0.2s ease;
}

.topbar-tab:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.06);
}

.topbar-tab.is-active {
  background: var(--primary);
  color: #fff;
  box-shadow: 0 0 20px rgba(230, 0, 18, 0.42);
}

.topbar-tab-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--primary);
}

.topbar-tab.is-active .topbar-tab-dot {
  background: #fff;
}

/* Right Auth / Character Chip */
.topbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.char-nav-chip {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 5px 12px 5px 6px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-strong);
  color: #fff;
  cursor: pointer;
  transition: all 0.2s ease;
}

.char-nav-chip:hover {
  border-color: var(--primary);
  background: rgba(230, 0, 18, 0.12);
}

.char-nav-avatar {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: linear-gradient(135deg, #e60012, #6b0009);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 900;
  font-size: 0.78rem;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.char-nav-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.char-nav-meta {
  display: flex;
  flex-direction: column;
  text-align: left;
  line-height: 1.15;
}

.char-nav-name {
  font-size: 0.78rem;
  font-weight: 800;
  max-width: 130px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.char-nav-sub {
  font-size: 0.66rem;
  color: var(--muted);
  font-weight: 600;
}

.topbar-mobile-btn {
  display: none;
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid var(--border-strong);
  color: #fff;
  font-size: 1.15rem;
  cursor: pointer;
  align-items: center;
  justify-content: center;
}

/* Mobile Drawer */
.mobile-nav-drawer {
  display: none;
  position: fixed;
  top: var(--topbar-h);
  left: 0;
  right: 0;
  z-index: 49;
  background: rgba(8, 8, 11, 0.98);
  border-bottom: 1px solid var(--border-strong);
  padding: 14px 20px 20px;
  flex-direction: column;
  gap: 8px;
  backdrop-filter: blur(16px);
}

body.has-sandbox .mobile-nav-drawer {
  top: calc(var(--topbar-h) + 37px);
}

.mobile-nav-drawer.is-open {
  display: flex;
}

.mobile-nav-drawer .topbar-tab {
  width: 100%;
  justify-content: flex-start;
  padding: 12px 16px;
}

@media (max-width: 980px) {
  .topbar-nav {
    display: none;
  }
  .topbar-mobile-btn {
    display: inline-flex;
  }
  .topbar-brand-tag {
    display: none;
  }
}

@media (max-width: 540px) {
  .char-nav-meta {
    display: none;
  }
  .char-nav-chip {
    padding: 4px;
  }
}
