.topbar, .footer-links {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}
.topbar { position: relative; z-index: 2; width: 100%; padding: 0; }
.nav-links, .footer-links nav {
  display: flex;
  gap: .75rem;
  flex-wrap: wrap;
  align-items: center;
}
.nav-chip, .footer-links a, .back-link {
  color: var(--text-soft);
  text-decoration: none;
  transition: .2s ease;
}
.nav-chip, .footer-links a {
  padding: .55rem .85rem;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,.06);
  background: rgba(255,255,255,.02);
  font-size: .82rem;
}
.nav-chip:hover, .footer-links a:hover, .back-link:hover { color: var(--p-color); }
.nav-chip.active {
  color: #fff;
  background: linear-gradient(90deg, rgba(99,102,241,.18), rgba(236,72,153,.16));
  border-color: rgba(255,255,255,.08);
  box-shadow: none;
}
.brand-wrap {
  display:flex;
  align-items:center;
  gap:.9rem;
  text-decoration:none;
  min-width:0;
}
.brand-badge {
  width: 2.7rem;
  height: 2.7rem;
  border-radius: 1rem;
  display:flex;
  align-items:center;
  justify-content:center;
  background: linear-gradient(135deg, rgba(99,102,241,.22), rgba(236,72,153,.18));
  border: 1px solid rgba(255,255,255,.08);
  box-shadow: 0 12px 30px rgba(99,102,241,.10);
  font-size: 1.2rem;
  color: var(--text-main);
}
.brand-copy { display:flex; flex-direction:column; line-height:1; }
.brand-title { font-size: 1rem; letter-spacing: 3px; font-weight: 800; }
.brand-sub { font-size: .65rem; letter-spacing: 1.4px; color: var(--text-soft); margin-top: .2rem; text-transform: uppercase; }
.lang-wrap{display:flex;gap:.75rem;align-items:center;justify-content:flex-end;min-height:44px;}
.flag-btn { cursor: pointer; font-size: .82rem; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; line-height: 1; transition: .22s ease; opacity: .68; user-select: none; padding: .15rem 0; color: var(--text-soft); }
.flag-btn.active { opacity: 1; transform: none; color: var(--text-main); }
.flag-btn:hover { opacity: 1; color: var(--text-main); transform: none; }
.theme-toggle { width: 2.55rem; height: 2.55rem; border-radius: 999px; display:flex; align-items:center; justify-content:center; cursor:pointer; border:1px solid rgba(255,255,255,.08); background: rgba(255,255,255,.03); transition:.22s ease; font-size: 1rem; line-height:1; user-select:none; box-shadow: 0 10px 24px rgba(0,0,0,.12); color: var(--text-main); }
.theme-toggle:hover { transform: translateY(-1px); border-color: rgba(99,102,241,.26); color: var(--p-color); }
[data-theme="light"] .theme-toggle { border-color: rgba(15,23,42,.12); background: rgba(15,23,42,.04); color: rgba(15,23,42,.72); }
.footer {
  padding: 1.8rem 0 2rem;
  border-top: 1px solid rgba(255,255,255,0.05);
  text-align: center;
}
.copyright { color: var(--text-soft); font-size: .82rem; margin: 0; }
.footer-meta { display:flex; flex-direction:column; align-items:flex-start; gap:.55rem; min-width: 17rem; text-align:left; }
.footer-note { color: var(--text-soft); font-size: .78rem; line-height: 1.7; margin: 0; max-width: 38rem; text-align:left; }
@media (max-width: 768px) {
  .topbar, .footer-links { align-items: flex-start; }
  .topbar > div:first-child, .nav-links, .lang-wrap, .footer-links nav { width: 100%; }
  .lang-wrap { justify-content: flex-start; }
  .footer-meta { min-width: 0; width: 100%; }
  .footer-links nav { justify-content: flex-start; }
}
.topbar, .topbar *, .footer-links, .footer-links * { min-width: 0; }
.brand-copy, .nav-links, .lang-wrap { min-width: 0; }
.nav-chip, .footer-links a, .brand-sub, .brand-title, .footer-note { overflow-wrap:anywhere; word-break:break-word; }
@media (max-width: 575px) {
  .brand-title { letter-spacing: 2px; }
  .nav-links { gap: .5rem; }
  .nav-chip, .footer-links a { padding: .52rem .72rem; font-size: .78rem; }
  .theme-toggle { width: 2.4rem; height: 2.4rem; }
}
