body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

main {
  flex: 1 0 auto;
}

.topbar {
  padding: 18px 0;
}

.topbar .container {
  width: min(1080px, 92vw);
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  flex-wrap: nowrap;
  position: relative;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 1.06rem;
  letter-spacing: 0.01em;
  color: var(--cc-primary, #ed6e38);
  text-decoration: none;
  transition: transform 0.22s ease, opacity 0.22s ease;
}

.brand:hover {
  transform: translateY(-1px);
  opacity: 0.92;
}

.brand img {
  width: 44px;
  height: 44px;
  border-radius: 10px;
}

.topbar-actions,
.topbar-right {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
}

.menu-toggle {
  display: none;
  appearance: none;
  border: 1px solid var(--cc-stroke, rgba(0, 0, 0, 0.09));
  background: transparent;
  color: var(--cc-text, #1f1f1f);
  border-radius: 10px;
  padding: 8px 12px;
  font-weight: 700;
  font-size: 0.86rem;
  line-height: 1;
  transition: background-color 0.2s ease, border-color 0.2s ease;
}

.menu-toggle:hover {
  background: rgba(237, 110, 56, 0.08);
  border-color: rgba(237, 110, 56, 0.32);
}

.menu-icon {
  width: 18px;
  height: 14px;
  position: relative;
  display: inline-block;
}

.menu-icon span {
  position: absolute;
  left: 0;
  width: 100%;
  height: 2px;
  background: currentColor;
  border-radius: 99px;
  transition: transform 0.25s ease, opacity 0.2s ease, top 0.25s ease;
}

.menu-icon span:nth-child(1) { top: 0; }
.menu-icon span:nth-child(2) { top: 6px; }
.menu-icon span:nth-child(3) { top: 12px; }

.menu-toggle[aria-expanded="true"] .menu-icon span:nth-child(1) {
  top: 6px;
  transform: rotate(45deg);
}

.menu-toggle[aria-expanded="true"] .menu-icon span:nth-child(2) {
  opacity: 0;
}

.menu-toggle[aria-expanded="true"] .menu-icon span:nth-child(3) {
  top: 6px;
  transform: rotate(-45deg);
}

.mobile-menu {
  display: none;
}

.nav-links,
.top-links {
  display: flex;
  gap: 16px;
}

.nav-links a,
.top-links a {
  color: var(--cc-muted, #5f6670);
  text-decoration: none;
  font-weight: 600;
  font-size: 0.93rem;
  transition: color 0.2s ease, transform 0.2s ease;
}

.nav-links a:hover,
.top-links a:hover {
  color: var(--cc-primary, #ed6e38);
  transform: translateY(-1px);
}

.lang-links {
  color: var(--cc-muted, #5f6670);
  font-size: 0.83rem;
  font-weight: 700;
  letter-spacing: 0.04em;
}

.lang-links a {
  color: inherit;
  text-decoration: none;
  transition: color 0.2s ease, opacity 0.2s ease;
}

.lang-links a:hover {
  color: var(--cc-primary, #ed6e38);
  opacity: 0.92;
}

.topbar .nav-links a.active,
.topbar .top-links a.active,
.topbar .lang-links a.active {
  color: var(--cc-primary, #ed6e38);
}

.site-footer {
  margin-top: auto;
  border-top: 1px solid var(--cc-stroke, rgba(0, 0, 0, 0.09));
  padding: 18px 0 26px;
  color: var(--cc-muted, #5f6670);
  font-size: 0.86rem;
}

.site-footer .container {
  width: min(1080px, 92vw);
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  gap: 18px;
  flex-wrap: wrap;
}

.footer-grid {
  display: grid !important;
  grid-template-columns: 1.2fr 0.8fr 0.8fr;
  align-items: start;
  padding-bottom: 18px;
}

.footer-brand {
  display: grid;
  gap: 8px;
}

.footer-brand strong,
.footer-title {
  color: var(--cc-text, #1f1f1f);
}

.footer-brand p {
  margin: 0;
  line-height: 1.6;
}

.footer-links {
  display: grid;
  gap: 8px;
}

.footer-title {
  font-weight: 700;
  font-size: 0.95rem;
}

.footer-links a {
  color: var(--cc-muted, #5f6670);
  text-decoration: none;
  transition: color 0.2s ease, transform 0.2s ease;
}

.footer-links a:hover {
  color: var(--cc-primary, #ed6e38);
  transform: translateY(-1px);
}

.footer-bottom {
  border-top: 1px solid var(--cc-stroke, rgba(0, 0, 0, 0.09));
  padding-top: 14px;
  font-size: 0.84rem;
}

@media (max-width: 700px) {
  .topbar {
    padding: 12px 0;
  }

  .topbar .container {
    gap: 10px;
    flex-wrap: wrap;
  }

  .brand {
    font-size: 0.98rem;
  }

  .brand img {
    width: 36px;
    height: 36px;
  }

  .topbar-actions,
  .topbar-right {
    width: auto;
    margin-left: auto;
    justify-content: flex-end;
    gap: 10px;
  }

  .nav-links,
  .top-links {
    display: none;
  }

  .menu-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }

  .lang-links {
    flex: 0 0 auto;
    font-size: 0.78rem;
  }

  .footer-grid {
    grid-template-columns: 1fr;
  }

  .session-actions {
    display: none !important;
  }

  .mobile-menu {
    flex: 0 0 100%;
    align-self: stretch;
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-top: 8px;
    padding: 10px;
    box-sizing: border-box;
    border: 1px solid var(--cc-stroke, rgba(0, 0, 0, 0.09));
    border-radius: 12px;
    background: var(--cc-card, #fff);
    box-shadow: 0 10px 24px rgba(17, 24, 39, 0.1);
    max-height: 0;
    opacity: 0;
    overflow: hidden;
    transform: translateY(-6px);
    pointer-events: none;
    transition: max-height 0.28s ease, opacity 0.2s ease, transform 0.22s ease;
  }

  .mobile-menu.is-open {
    max-height: 260px;
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
  }

  .mobile-menu a {
    color: var(--cc-muted, #5f6670);
    text-decoration: none;
    font-weight: 600;
    font-size: 0.9rem;
    padding: 8px 10px;
    border-radius: 8px;
    transition: background-color 0.2s ease, color 0.2s ease, transform 0.2s ease;
  }

  .mobile-menu a:hover {
    transform: translateX(2px);
    color: var(--cc-primary, #ed6e38);
  }

  .mobile-menu a.active {
    background: rgba(237, 110, 56, 0.12);
    color: var(--cc-primary, #ed6e38);
  }

  .session-actions-mobile {
    display: flex;
    flex-direction: column;
    gap: 6px;
  }

  .mobile-menu .header-session-button {
    width: 100%;
    display: block;
    text-align: left;
    color: var(--cc-muted, #5f6670);
    text-decoration: none;
    font-weight: 600;
    font-size: 0.9rem;
    padding: 8px 10px;
    border-radius: 8px;
    line-height: inherit;
  }

  .mobile-menu .header-session-button.danger {
    color: #d85b57;
  }

  .mobile-menu .header-session-button:hover {
    background: rgba(237, 110, 56, 0.12);
    color: var(--cc-primary, #ed6e38);
  }
}

@media (prefers-color-scheme: dark) and (max-width: 700px) {
  .menu-toggle {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.12);
    color: rgba(255, 255, 255, 0.92);
    box-shadow: 0 10px 24px rgba(6, 10, 18, 0.22);
  }

  .menu-toggle:hover {
    background: rgba(255, 255, 255, 0.12);
    border-color: rgba(249, 115, 22, 0.28);
  }

  .mobile-menu {
    background: rgba(23, 24, 29, 0.96);
    border-color: rgba(255, 255, 255, 0.08);
    box-shadow: 0 18px 36px rgba(4, 8, 14, 0.4);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
  }

  .mobile-menu a,
  .mobile-menu .header-session-button {
    color: rgba(243, 244, 246, 0.9);
  }

  .mobile-menu a.active {
    background: rgba(249, 115, 22, 0.16);
    color: #f97316;
  }

  .mobile-menu .header-session-button:hover,
  .mobile-menu a:hover {
    background: rgba(255, 255, 255, 0.08);
  }
}
