:root {
  --ink: #111827;
  --muted: #667085;
  --line: #e5e7eb;
  --paper: #ffffff;
  --soft: #f6f7fb;
  --brand: #8a145e;
  --brand-dark: #681047;
  --blue: #006bbb;
  --shadow: 0 18px 46px rgba(17, 24, 39, 0.12);
  --wall-columns: 12;
  --wall-rows: 9;
  --flag-w: 90px;
  --flag-h: 60px;
  --wall-gap-x: 29px;
  --wall-gap-y: 18px;
  --wall-scale: 1;
  --wall-natural-width: 1399px;
  --wall-natural-height: 684px;
  --wall-scaled-height: 684px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  color: var(--ink);
  background: var(--paper);
  font-family: "Microsoft YaHei", "PingFang SC", Arial, sans-serif;
}

[hidden] {
  display: none !important;
}

a {
  color: inherit;
  text-decoration: none;
}

.site-header {
  position: absolute;
  z-index: 20;
  top: 0;
  left: 0;
  width: 100%;
  height: 100px;
  min-height: 0;
  margin: 0;
  overflow: hidden;
  background: #fff;
  transition: height .5s ease;
}

.site-header:hover,
.site-header.open {
  height: 270px;
}

.language-switch {
  position: absolute;
  z-index: 24;
  top: 18px;
  right: 28px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 22px;
  color: #333;
  font-size: 12px;
  line-height: 1;
  white-space: nowrap;
}

.language-switch a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 22px;
  color: #333;
  text-align: center;
  transition: color .18s ease;
}

.language-switch a:hover,
.language-switch a.is-active {
  color: var(--brand);
}

.language-switch .lang-en {
  font-weight: 700;
  letter-spacing: .16em;
  text-indent: .16em;
}

.language-switch .lang-cn {
  font-weight: 600;
  letter-spacing: 0;
}

.language-switch span {
  color: #9b9b9b;
  font-size: 11px;
}

.flag-header-inner {
  position: relative;
  width: 1180px;
  height: 270px;
  margin: 0 auto;
}

.brand {
  position: absolute;
  top: 0;
  left: 20px;
  display: inline-flex;
  align-items: center;
  gap: 14px;
  width: 250px;
  height: 100px;
  min-width: 0;
  overflow: hidden;
}

.brand-logo {
  width: 262px;
  max-width: 100%;
  height: auto;
  display: block;
}

.brand-logo-front {
  width: 171px;
}

.brand-mark {
  width: 72px;
  height: 58px;
  display: grid;
  place-items: center;
  color: #fff;
  background: linear-gradient(135deg, var(--brand), #b22b7a);
  font-size: 25px;
  font-weight: 800;
  letter-spacing: 0;
}

.brand strong {
  display: block;
  font-size: 22px;
  line-height: 1.15;
}

.brand small {
  display: block;
  color: #333;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0;
  margin-top: 3px;
}

.main-nav {
  position: absolute;
  top: 64px;
  right: 60px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0;
  height: 24px;
  font-size: 14px;
}

.main-nav a {
  display: block;
  width: 103px;
  height: 22px;
  overflow: hidden;
  padding: 0;
  border-bottom: 0;
  color: #111;
  line-height: 20px;
  text-align: center;
  transition: color .18s ease, transform .18s ease;
}

.main-nav a:hover,
.main-nav a[aria-current="page"] {
  color: var(--brand);
  transform: translateY(-2px);
}

.dropdown-map {
  position: absolute;
  top: 100px;
  right: 60px;
  display: none;
  width: 721px;
  height: 175px;
  padding: 0;
  background: transparent;
  box-shadow: none;
}

.site-header:hover .dropdown-map,
.site-header.open .dropdown-map {
  display: block;
}

.dropdown-map ul {
  margin: 0;
  padding: 0;
  list-style: none;
  display: flex;
  height: 175px;
}

.dropdown-map li {
  width: 103px;
  min-height: 0;
  height: 175px;
  padding: 0;
  border: 0;
  background: #fff;
}

.dropdown-map a {
  display: block;
  width: 103px;
  height: 28px;
  color: #333;
  font-size: 12px;
  line-height: 28px;
  text-align: center;
}

.dropdown-map a:hover {
  color: var(--brand);
  text-decoration: underline;
}

.admin-link {
  color: var(--brand);
  font-size: 14px;
  border: 1px solid rgba(138, 20, 94, 0.25);
  padding: 8px 14px;
}

main {
  width: 100%;
  margin: 0 auto;
}

.flag-wall-page main {
  padding-top: 100px;
}

.intro {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 28px;
  padding: 2px 0 26px;
}

.intro-title p:last-child {
  max-width: 560px;
  margin: 10px 0 0;
  color: var(--muted);
  line-height: 1.7;
  font-size: 14px;
}

.eyebrow {
  margin: 0 0 7px;
  color: var(--brand);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0;
}

h1 {
  margin: 0;
  font-size: clamp(25px, 3vw, 38px);
  font-weight: 700;
}

.tools {
  display: flex;
  align-items: center;
  gap: 12px;
}

.search {
  display: flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--line);
  padding: 8px 10px;
  background: #fff;
}

.search span {
  color: var(--muted);
  font-size: 13px;
}

input,
select,
textarea,
button {
  font: inherit;
}

.search input,
.tools select {
  min-height: 34px;
  border: 0;
  outline: 0;
  background: transparent;
}

.tools select {
  border: 1px solid var(--line);
  padding: 8px 10px;
  background: #fff;
}

.flag-stage {
  width: 100%;
  height: var(--wall-scaled-height);
  display: flex;
  justify-content: center;
  align-items: flex-start;
  margin: 48px auto 28px;
  overflow: visible;
}

.flag-wall {
  display: grid;
  width: var(--wall-natural-width);
  grid-template-columns: repeat(var(--wall-columns), var(--flag-w));
  justify-content: center;
  gap: var(--wall-gap-y) var(--wall-gap-x);
  align-items: start;
  padding: 0;
  transform: scale(var(--wall-scale));
  transform-origin: top center;
  will-change: transform;
}

.loading,
.empty {
  grid-column: 1 / -1;
  color: var(--muted);
  text-align: center;
  padding: 80px 0;
}

.flag-card {
  position: relative;
  width: var(--flag-w);
  height: var(--flag-h);
  border: 0;
  padding: 0;
  background: #fff;
  cursor: pointer;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.08);
  overflow: hidden;
}

.flag-card img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}

.flag-overlay {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 8px;
  color: #fff;
  text-align: center;
  background: rgba(0, 0, 0, 0.58);
  transform: translateY(100%);
  transition: transform 0.22s ease;
}

.flag-card:hover .flag-overlay,
.flag-card:focus-visible .flag-overlay {
  transform: translateY(0);
}

.flag-overlay strong {
  display: block;
  font-size: clamp(11px, 0.9vw, 13px);
  line-height: 1.25;
}

.flag-overlay span {
  display: block;
  margin-top: 4px;
  font-size: 10px;
  line-height: 1.2;
  opacity: 0.88;
}

.site-footer {
  width: min(1255px, calc(100% - 48px));
  margin: 0 auto 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  gap: 28px;
  color: #111;
  font-size: 13px;
  line-height: 1.4;
  text-align: center;
}

.site-footer a {
  color: #0158c8;
  text-decoration: underline;
}

.site-footer span {
  display: block;
}

.modal[hidden] {
  display: none;
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 28px;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(17, 24, 39, 0.42);
}

.modal-panel {
  position: relative;
  width: min(760px, 100%);
  max-height: min(82vh, 780px);
  overflow: auto;
  background: #fff;
  box-shadow: var(--shadow);
}

.modal-close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 34px;
  height: 34px;
  border: 0;
  color: #fff;
  background: var(--brand);
  font-size: 25px;
  line-height: 1;
  cursor: pointer;
}

.modal-head {
  display: grid;
  grid-template-columns: 128px 1fr;
  gap: 22px;
  align-items: center;
  padding: 34px 34px 22px;
  border-bottom: 1px solid var(--line);
}

.modal-head img {
  width: 128px;
  aspect-ratio: 3 / 2;
  object-fit: cover;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.12);
}

.modal-head h2 {
  margin: 0;
  font-size: 28px;
}

.modal-head p:last-child {
  margin: 6px 0 0;
  color: var(--muted);
}

.modal-content {
  padding: 24px 34px 34px;
  line-height: 1.8;
  font-size: 15px;
}

.modal-content section + section {
  margin-top: 18px;
}

.modal-content h3 {
  margin: 0 0 7px;
  color: var(--brand-dark);
  font-size: 16px;
}

.modal-content p {
  margin: 0;
  white-space: normal;
}

.modal-content .legacy-html {
  line-height: 1.8;
}

@media (max-width: 1050px) {
  .site-header {
    width: min(100% - 28px, 680px);
    height: auto;
    min-height: 82px;
    overflow: visible;
    flex-wrap: wrap;
    gap: 14px;
    padding: 12px 0;
  }

  .site-header:hover,
  .site-header.open {
    height: auto;
  }

  .flag-header-inner {
    width: 100%;
    height: auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 14px;
  }

  .brand,
  .main-nav {
    position: static;
  }

  .brand {
    min-width: auto;
  }

  .brand-logo {
    width: 190px;
  }

  .brand-logo-front {
    width: 150px;
  }

  .brand-mark {
    width: 58px;
    height: 48px;
    font-size: 21px;
  }

  .brand strong {
    font-size: 18px;
  }

  .main-nav {
    order: 3;
    width: 100%;
    justify-content: flex-start;
    gap: 18px;
    overflow-x: auto;
    padding-bottom: 4px;
  }

  .dropdown-map {
    display: none !important;
  }

  main {
    width: min(100% - 28px, 680px);
  }

  .intro {
    display: block;
  }

  .tools {
    margin-top: 18px;
    align-items: stretch;
    flex-direction: column;
  }

  .modal {
    padding: 12px;
  }

  .modal-head {
    grid-template-columns: 1fr;
    padding: 28px 22px 18px;
  }

  .modal-content {
    padding: 20px 22px 28px;
  }
}

@media (max-width: 820px) {
  .flag-stage {
    height: auto;
    width: min(100% - 28px, 680px);
  }

  .flag-wall {
    width: 100%;
    grid-template-columns: repeat(auto-fill, minmax(112px, 1fr));
    gap: 14px;
    transform: none;
  }

  .flag-card {
    width: 100%;
    height: auto;
    aspect-ratio: 3 / 2;
  }
}
