:root {
  color-scheme: dark;
  --page: #050812;
  --nav: rgba(10, 14, 39, .95);
  --card: #1a1a2e;
  --card-name: rgba(10, 14, 39, .95);
  --text: #fff;
  --muted: #b4b4c8;
  --cyan: #00d4ff;
  --purple: #a855f7;
  --pink: #f05aa6;
  --danger: #dc4446;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { min-width: 320px; scroll-behavior: smooth; }

body {
  margin: 0;
  min-height: 100vh;
  overflow-x: hidden;
  background: linear-gradient(#050812, #0b1120, #060912);
  color: var(--text);
  font-family: "Microsoft YaHei UI", "Microsoft YaHei", "PingFang SC", sans-serif;
  font-size: 16px;
  letter-spacing: 0;
}
body.game-open { overflow: hidden; }
button, input { font: inherit; letter-spacing: 0; }
button, a { -webkit-tap-highlight-color: transparent; }

.particle-field {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  opacity: .52;
  background-image:
    radial-gradient(circle, rgba(0, 212, 255, .72) 0 1px, transparent 1.5px),
    radial-gradient(circle, rgba(168, 85, 247, .65) 0 1px, transparent 1.5px),
    radial-gradient(circle, rgba(255, 255, 255, .42) 0 1px, transparent 1.5px);
  background-size: 97px 97px, 151px 151px, 211px 211px;
  background-position: 13px 19px, 59px 73px, 103px 31px;
  animation: particle-drift 24s linear infinite;
}
.particle-field::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(rgba(5, 8, 18, .2), rgba(5, 8, 18, .84));
}
@keyframes particle-drift { to { transform: translateY(-97px); } }

.navbar {
  min-height: 63px;
  background: var(--nav);
  box-shadow: 0 4px 30px rgba(0, 0, 0, .3);
  border-bottom: 1px solid rgba(255, 255, 255, .04);
}
.navbar-inner {
  width: 100%;
  max-width: 1400px;
  min-height: 62px;
  margin: 0 auto;
  padding: 14px 24px;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 16px;
}
.simulator-logo {
  color: transparent;
  background: linear-gradient(100deg, var(--cyan), #fff 48%, var(--pink));
  background-clip: text;
  -webkit-background-clip: text;
  font-size: 21px;
  font-weight: 800;
  text-shadow: 0 0 18px rgba(0, 212, 255, .35);
}

.simulator-container { width: 100%; max-width: 1400px; margin: 0 auto; padding: 0 24px 80px; }
.ad-band:empty { display: none; }
.ad-band { padding-top: 16px; }
.ad-band-footer { padding-top: 34px; }
.ad-list {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}
.ad-card {
  min-width: 0;
  min-height: 94px;
  padding: 10px;
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, .1);
  border-top: 2px solid rgba(246, 199, 67, .82);
  border-radius: 10px;
  background: rgba(18, 25, 43, .96);
  box-shadow: 0 8px 22px rgba(0, 0, 0, .22);
}
.ad-card-media {
  width: 70px;
  height: 70px;
  flex: 0 0 70px;
  overflow: hidden;
  display: grid;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, .09);
  border-radius: 8px;
  background: #0d1424;
}
.ad-card-media img { width: 100%; height: 100%; display: block; object-fit: cover; }
.ad-card-media.fallback { color: #788198; font: 800 13px/1 Consolas, monospace; }
.ad-card-media.fallback img { display: none; }
.ad-card-copy { min-width: 0; flex: 1 1 auto; }
.ad-card-copy strong {
  display: block;
  overflow: hidden;
  color: #f6ca4d;
  font-size: 15px;
  font-weight: 800;
  line-height: 1.35;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.ad-card-copy span {
  margin-top: 6px;
  display: -webkit-box;
  overflow: hidden;
  color: #aeb6c9;
  font-size: 12px;
  line-height: 1.45;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}
.sim-game-search { width: 100%; padding: 12px 0 4px; display: flex; gap: 10px; }
.sim-game-search-box {
  width: 100%;
  height: 45px;
  padding: 0 14px;
  display: flex;
  align-items: center;
  gap: 12px;
  border: 1px solid rgba(255, 255, 255, .1);
  border-radius: 10px;
  background: rgba(15, 23, 45, .84);
  box-shadow: inset 0 0 18px rgba(0, 0, 0, .16);
  transition: border-color .2s ease, box-shadow .2s ease;
}
.sim-game-search-box:focus-within { border-color: rgba(0, 212, 255, .68); box-shadow: 0 0 0 3px rgba(0, 212, 255, .08); }
.sim-game-search-icon { width: 20px; flex: 0 0 20px; font-size: 14px; text-align: center; }
.sim-game-search-input {
  min-width: 0;
  width: 100%;
  height: 43px;
  padding: 12px 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: #fff;
  font-size: 14px;
}
.sim-game-search-input::-webkit-search-cancel-button { display: none; }
.sim-game-search-input::placeholder { color: #7f869e; }
.sim-game-search-clear {
  width: 28px;
  height: 28px;
  padding: 0;
  display: none;
  border: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, .08);
  color: var(--muted);
  font-size: 21px;
  line-height: 26px;
  cursor: pointer;
}
.sim-game-search-clear.show { display: block; }
.sim-game-search-clear:hover { background: rgba(255, 255, 255, .15); color: #fff; }
.sim-search-hint { display: none; padding: 4px 2px 0; color: var(--muted); font-size: 12px; }
.sim-search-hint.show { display: block; }

.sim-tabs { padding: 13px 0 30px; display: flex; flex-wrap: wrap; gap: 10px; }
.sim-tab {
  min-height: 42px;
  padding: 10px 22px;
  border: 1px solid rgba(255, 255, 255, .1);
  border-radius: 21px;
  background: rgba(20, 25, 52, .9);
  color: #c7c9db;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: transform .2s ease, border-color .2s ease, box-shadow .2s ease;
}
.sim-tab:hover { transform: translateY(-2px); border-color: rgba(0, 212, 255, .55); }
.sim-tab.active {
  border-color: transparent;
  background: linear-gradient(135deg, var(--cyan), #6967ee 52%, var(--purple));
  box-shadow: 0 4px 18px rgba(80, 128, 255, .38), inset 0 1px rgba(255, 255, 255, .28);
  color: #fff;
}

.category-section { width: 100%; }
.category-header { min-height: 32px; margin-bottom: 35px; display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.category-header h1 { margin: 0; color: #fff; font-size: 24px; font-weight: 700; line-height: 32px; }
.category-badge {
  padding: 5px 11px;
  border: 1px solid rgba(168, 85, 247, .45);
  border-radius: 15px;
  background: rgba(168, 85, 247, .15);
  color: #dcc2ff;
  font-size: 12px;
  line-height: 1;
  white-space: nowrap;
}
.catalog-state { min-height: 240px; display: grid; place-items: center; color: var(--muted); font-size: 14px; }
.catalog-state.empty { border: 1px dashed rgba(255, 255, 255, .1); border-radius: 12px; }
.catalog-state.error, .game-iframe-loading.error { color: var(--danger); }
.loading-dots { margin-left: 6px; display: inline-flex; align-items: center; gap: 4px; }
.loading-dots span { width: 4px; height: 4px; border-radius: 50%; background: currentColor; animation: dot-pulse 1.1s ease-in-out infinite; }
.loading-dots span:nth-child(2) { animation-delay: .16s; }
.loading-dots span:nth-child(3) { animation-delay: .32s; }
@keyframes dot-pulse { 0%, 60%, 100% { opacity: .25; transform: translateY(0); } 30% { opacity: 1; transform: translateY(-3px); } }

.pg-game-grid { display: grid; grid-template-columns: repeat(8, minmax(0, 1fr)); gap: 16px; }
.pg-game-item {
  min-width: 0;
  overflow: hidden;
  position: relative;
  border: 1px solid rgba(255, 255, 255, .08);
  border-radius: 14px;
  background: var(--card);
  color: #fff;
  cursor: pointer;
  transition: transform .2s ease, border-color .2s ease, box-shadow .2s ease;
}
.pg-game-item:hover { transform: translateY(-5px); border-color: rgba(0, 212, 255, .62); box-shadow: 0 10px 26px rgba(0, 0, 0, .42), 0 0 18px rgba(0, 212, 255, .14); }
.pg-game-item:focus-visible { outline: 2px solid var(--cyan); outline-offset: 3px; }
.pg-game-image { width: 100%; aspect-ratio: 1 / 1; display: block; object-fit: cover; background: #16213e; }
.cover-placeholder { place-items: center; color: #757c95; font-size: 12px; }
.pg-game-image.cover-placeholder { display: grid; }
.pg-game-name {
  height: 37px;
  padding: 10px 8px;
  overflow: hidden;
  background: var(--card-name);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  line-height: 17px;
  text-align: center;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.site-footer { padding: 18px 24px 28px; color: #71778e; font-size: 12px; text-align: center; }
.back-to-top {
  width: 44px;
  height: 44px;
  padding: 0;
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 20;
  border: 1px solid rgba(255, 255, 255, .16);
  border-radius: 50%;
  background: linear-gradient(135deg, #5965ef, var(--purple));
  box-shadow: 0 6px 20px rgba(89, 101, 239, .38);
  color: #fff;
  font-size: 21px;
  cursor: pointer;
  opacity: 0;
  pointer-events: none;
  transform: translateY(12px);
  transition: opacity .2s ease, transform .2s ease;
}
.back-to-top.show { opacity: 1; pointer-events: auto; transform: translateY(0); }

.game-iframe-container {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: none;
  background: rgba(5, 8, 18, .98);
}
.game-iframe-container.active { display: block; }
.game-iframe-panel { width: 100%; height: 100%; display: grid; grid-template-rows: 58px minmax(0, 1fr); }
.game-iframe-header {
  padding: 0 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  border-bottom: 1px solid rgba(255, 255, 255, .1);
  background: rgba(10, 14, 39, .98);
  box-shadow: 0 4px 20px rgba(0, 0, 0, .28);
}
.game-iframe-header strong { min-width: 0; overflow: hidden; font-size: 15px; text-overflow: ellipsis; white-space: nowrap; }
.game-iframe-close {
  min-width: 92px;
  padding: 8px 16px;
  border: 1px solid rgba(220, 68, 70, .62);
  border-radius: 18px;
  background: rgba(220, 68, 70, .14);
  color: #ff9fa0;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: background .2s ease, color .2s ease;
}
.game-iframe-close:hover { background: var(--danger); color: #fff; }
.game-iframe-wrapper { min-height: 0; position: relative; }
.game-iframe-loading { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; color: var(--muted); font-size: 14px; }
.game-iframe { width: 100%; height: 100%; display: none; border: 0; background: #050812; }

@media (max-width: 1100px) { .pg-game-grid { grid-template-columns: repeat(6, minmax(0, 1fr)); } }
@media (max-width: 900px) { .ad-list { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 820px) { .pg-game-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
@media (max-width: 600px) {
  .navbar-inner { padding-left: 16px; padding-right: 16px; }
  .simulator-container { padding-left: 16px; padding-right: 16px; padding-bottom: 58px; }
  .simulator-logo { font-size: 19px; }
  .ad-list { grid-template-columns: 1fr; }
  .sim-tabs { padding-bottom: 24px; }
  .sim-tab { width: 100%; }
  .category-header { margin-bottom: 22px; }
  .category-header h1 { font-size: 19px; line-height: 27px; }
  .pg-game-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 11px; }
  .pg-game-name { height: 34px; padding: 8px 5px; font-size: 11px; }
  .back-to-top { right: 16px; bottom: 16px; }
  .game-iframe-panel { grid-template-rows: 54px minmax(0, 1fr); }
  .game-iframe-header { padding: 0 12px; }
  .game-iframe-close { min-width: 82px; padding: 7px 12px; }
}

@media (max-width: 380px) {
  .ad-card { min-height: 82px; padding: 8px; gap: 9px; }
  .ad-card-media { width: 58px; height: 58px; flex-basis: 58px; }
  .ad-card-copy strong { font-size: 14px; }
  .ad-card-copy span { margin-top: 4px; font-size: 11px; }
}

@media (max-width: 360px) {
  .pg-game-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
