/* Shared layout fixes. Visual system lives in each page, matching the design boards. */
html { scroll-behavior: smooth; }
body { margin: 0; }
img { max-width: 100%; }
.nav-toggle {
  display: none;
  align-items: center;
  min-height: 44px;
  padding: 0 14px;
  background: transparent;
  color: #E2C68B;
  border: 1px solid rgba(226,198,139,0.55);
  border-radius: 2px;
  font-family: inherit;
  font-size: 15px;
  cursor: pointer;
}
.brand-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 28px;
  background: #14100E;
  color: #E2C68B;
}
.brand-bar a { color: #E2C68B; text-decoration: none; font-size: 15px; }
.brand-bar img { display: block; width: auto; }
.brand-root { margin: 0 auto; }
[hidden] { display: none !important; }
@media (max-width: 860px) {
  .nav-toggle { display: inline-flex; }
  #primary-nav { display: none !important; width: 100%; flex-direction: column; align-items: flex-start; gap: 12px; }
  #primary-nav.is-open { display: flex !important; }
}
@media (max-width: 720px) {
  .brand-root {
    width: auto !important;
    height: auto !important;
    padding: 28px 16px !important;
  }
  .brand-root [style*="repeat(2"],
  .brand-root [style*="repeat(3"],
  .brand-root [style*="repeat(4"],
  .brand-root [style*="repeat(6"] {
    grid-template-columns: 1fr !important;
  }
  .brand-root [style*="grid-column: span 2"] { grid-column: auto !important; }
  #story ol li { grid-template-columns: 1fr !important; gap: 6px !important; }
  aside[aria-label="Maolu"] > div { padding: 28px 20px !important; }
}
@media (max-width: 420px) {
  header > div { padding-left: 16px !important; padding-right: 16px !important; }
}

/* Auth header chip */
#auth-slot {
  display: flex;
  align-items: center;
  gap: 18px;
}
.auth-user-chip {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: #E2C68B !important;
  text-decoration: none;
  max-width: 220px;
}
.auth-user-chip:hover { color: #F3EADB !important; }
.auth-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  overflow: hidden;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #B3282D;
  border: 1px solid rgba(226, 198, 139, 0.45);
}
.auth-avatar-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.auth-avatar-fallback {
  font-family: 'Noto Serif SC', 'Noto Serif CJK SC', serif;
  font-size: 15px;
  font-weight: 700;
  color: #FBF6EC;
  line-height: 1;
}
.auth-user-name {
  font-size: 15px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
@media (max-width: 720px) {
  .auth-user-name { display: none; }
  #auth-slot .btn-red { display: none !important; }
}


/* Language switcher */
#lang-slot { display: flex; align-items: center; }
.lang-switch {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: #E2C68B;
  font-size: 13px;
}
.lang-switch-label {
  font-family: 'IBM Plex Mono', Menlo, monospace;
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #A89B86;
  white-space: nowrap;
}
.lang-switch select {
  appearance: none;
  -webkit-appearance: none;
  min-height: 36px;
  padding: 0 28px 0 10px;
  background: #1C1512 url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath fill='%23E2C68B' d='M0 0l5 6 5-6z'/%3E%3C/svg%3E") no-repeat right 10px center;
  color: #E2C68B;
  border: 1px solid rgba(226,198,139,0.45);
  border-radius: 2px;
  font-family: inherit;
  font-size: 13px;
  cursor: pointer;
}
.lang-switch select:focus-visible {
  outline: 2px solid #C9A465;
  outline-offset: 2px;
}
html.is-rtl .lang-switch { flex-direction: row-reverse; }
@media (max-width: 720px) {
  .lang-switch-label { display: none; }
}
