:root {
  --blue-950: #052c72;
  --blue-900: #073f98;
  --blue-600: #0879e8;
  --ink: #172135;
  --muted: #68758a;
  --line: #e1e7f0;
  font-family: "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  color: var(--ink);
  background: #eef2f8;
}
* { box-sizing: border-box; }
body { margin: 0; min-width: 320px; background: radial-gradient(circle at 50% -160px, #7aa7e4, transparent 480px), #eef2f8; }
button, input, select { font: inherit; }
button { cursor: pointer; }
.gallery-header { color: white; background: linear-gradient(120deg, #0a63ca, var(--blue-900) 46%, var(--blue-950)); box-shadow: 0 8px 30px rgba(8, 48, 113, .16); }
.gallery-header-inner { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 24px; width: min(100% - 32px, 1080px); min-height: 96px; margin: 0 auto; }
.gallery-brand { display: flex; align-items: center; gap: 12px; color: white; text-decoration: none; }
.gallery-brand img { display: block; flex: 0 0 60px; width: 60px; height: auto; object-fit: contain; }
.gallery-brand strong { font-size: 24px; }
.gallery-title { text-align: center; }
.gallery-title small { color: #b9d8ff; font-weight: 800; }
.gallery-title h1 { margin: 3px 0 0; font-size: 28px; }
.home-link { justify-self: end; padding: 10px 17px; border: 1px solid rgba(255,255,255,.35); border-radius: 999px; color: white; text-decoration: none; font-weight: 800; }
.gallery-main { width: min(100% - 28px, 1080px); margin: 22px auto 48px; }
.game-tabs { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-bottom: 13px; padding: 8px; border-radius: 13px; background: var(--blue-900); }
.game-tabs a { padding: 11px 8px; border-radius: 9px; color: #dceaff; text-align: center; text-decoration: none; font-weight: 800; }
.game-tabs a.active { color: var(--blue-900); background: white; }
.gallery-panel { padding: 20px; border: 1px solid var(--line); border-radius: 16px; background: white; box-shadow: 0 18px 50px rgba(12, 46, 95, .08); }
.gallery-filters { display: grid; grid-template-columns: 1.2fr 1fr 1fr auto; gap: 12px; align-items: end; }
.gallery-filters label, .gallery-toolbar label { display: grid; gap: 6px; color: #4d5a70; font-size: 13px; font-weight: 700; }
.gallery-filters input, .gallery-filters select, .gallery-toolbar input { width: 100%; height: 42px; padding: 0 11px; border: 1px solid #d5dce7; border-radius: 8px; outline: 0; color: var(--ink); background: white; }
.gallery-filters input:focus, .gallery-filters select:focus, .gallery-toolbar input:focus { border-color: #72adf0; box-shadow: 0 0 0 3px rgba(75, 150, 235, .13); }
.gallery-filters button { height: 42px; padding: 0 22px; border: 0; border-radius: 9px; color: white; background: linear-gradient(180deg, #1385ee, #0871d7); font-weight: 800; }
.gallery-toolbar { display: flex; align-items: end; justify-content: space-between; gap: 24px; margin: 22px 0 14px; padding-top: 18px; border-top: 1px solid var(--line); }
.gallery-toolbar strong, .gallery-toolbar span { display: block; }
.gallery-toolbar strong { font-size: 19px; }
.gallery-toolbar span { margin-top: 4px; color: var(--muted); font-size: 13px; }
.gallery-toolbar label { width: min(100%, 260px); }
.gallery-state { display: flex; align-items: center; justify-content: center; gap: 7px; min-height: 250px; color: var(--muted); }
.gallery-state[hidden] { display: none; }
.gallery-state i { width: 8px; height: 8px; border-radius: 50%; background: var(--blue-600); animation: pulse .8s ease-in-out infinite alternate; }
.gallery-state i:nth-child(2) { animation-delay: .12s; }
.gallery-state i:nth-child(3) { animation-delay: .24s; }
.gallery-state span { margin-left: 6px; }
@keyframes pulse { to { opacity: .28; transform: translateY(-3px); } }
.gallery-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }
.image-card { min-width: 0; padding: 0; overflow: hidden; border: 1px solid var(--line); border-radius: 10px; color: var(--ink); background: white; text-align: left; transition: transform .16s ease, box-shadow .16s ease; }
.image-card:hover { transform: translateY(-3px); box-shadow: 0 12px 28px rgba(8, 52, 115, .14); }
.image-card .thumb { display: grid; place-items: center; width: 100%; aspect-ratio: 4 / 3; overflow: hidden; background: #f2f5f9; }
.image-card img { display: block; width: 100%; height: 100%; object-fit: contain; }
.image-card b { display: block; overflow: hidden; padding: 10px 11px; white-space: nowrap; text-overflow: ellipsis; }
.image-card[hidden] { display: none; }
.pagination { display: flex; align-items: center; justify-content: center; gap: 18px; margin-top: 24px; }
.pagination button { min-height: 38px; padding: 0 16px; border: 1px solid #c9d7e8; border-radius: 8px; color: var(--blue-900); background: white; font-weight: 800; }
.pagination button:disabled { cursor: default; opacity: .42; }
.pagination span { color: var(--muted); font-size: 13px; }
.image-dialog { width: min(calc(100% - 24px), 820px); max-height: calc(100vh - 28px); padding: 0; border: 0; border-radius: 17px; box-shadow: 0 30px 100px rgba(2, 21, 55, .35); }
.image-dialog::backdrop { background: rgba(1, 17, 43, .72); backdrop-filter: blur(3px); }
.image-dialog-panel { padding: 18px; }
.image-dialog-head { display: flex; align-items: start; justify-content: space-between; gap: 18px; margin-bottom: 13px; }
.image-dialog-head small { color: var(--blue-600); font-weight: 800; }
.image-dialog-head h2 { margin: 3px 0 0; font-size: 22px; }
.image-dialog-head button { width: 36px; height: 36px; border: 0; border-radius: 50%; color: var(--muted); background: #edf1f6; font-size: 24px; }
.preview-wrap { display: grid; place-items: center; min-height: 280px; max-height: calc(100vh - 190px); overflow: auto; border-radius: 10px; background: #eef2f6; }
.preview-wrap img { display: block; max-width: 100%; height: auto; }
#previewOriginal { display: block; margin-top: 13px; color: var(--blue-600); text-align: center; text-decoration: none; font-weight: 800; }
@media (max-width: 800px) {
  .gallery-header-inner { grid-template-columns: auto 1fr auto; min-height: 72px; gap: 10px; }
  .gallery-brand img { flex-basis: 32px; width: 32px; }
  .gallery-brand strong { display: none; }
  .gallery-title { text-align: left; }
  .gallery-title small { display: none; }
  .gallery-title h1 { margin: 0; font-size: 20px; }
  .home-link { padding: 8px 12px; font-size: 13px; }
  .gallery-main { width: min(100% - 16px, 1080px); margin-top: 10px; }
  .game-tabs { gap: 5px; margin-bottom: 8px; padding: 5px; }
  .game-tabs a { padding: 9px 3px; font-size: 13px; }
  .gallery-panel { padding: 13px; }
  .gallery-filters { grid-template-columns: 1fr 1fr; }
  .gallery-filters button { grid-column: 1 / -1; }
  .gallery-toolbar { align-items: stretch; flex-direction: column; gap: 12px; }
  .gallery-toolbar label { width: 100%; }
  .gallery-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .image-card b { font-size: 14px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
