:root {
  --bg: #0b1020;
  --panel: #121a33;
  --panel-soft: #182342;
  --text: #eef4ff;
  --muted: #9fb0d1;
  --brand: #ffcc33;
  --brand-2: #ff4d6d;
  --line: rgba(255, 255, 255, 0.1);
  --shadow: 0 24px 80px rgba(0, 0, 0, 0.35);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  background: #0f172a;
}

a { color: inherit; text-decoration: none; }
button, input, select { font: inherit; }

.hero { min-height: auto; padding: 22px clamp(18px, 4vw, 56px) 42px; background: #111827; border-bottom: 1px solid var(--line); }
.nav, .play-header, .simple-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-weight: 900;
  letter-spacing: 0.05em;
  font-size: 24px;
}
.brand span { color: var(--brand); }
.nav-links { display: flex; gap: 18px; color: var(--muted); }
.nav-links a:hover { color: var(--text); }
.hero-content { max-width: 820px; padding-top: 46px; }
.eyebrow { color: var(--brand); font-weight: 800; letter-spacing: 0.14em; text-transform: uppercase; }
h1 { margin: 0; font-size: clamp(32px, 5vw, 56px); line-height: 1.12; }
.subtitle { max-width: 680px; color: var(--muted); font-size: 20px; line-height: 1.75; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 14px; margin-top: 28px; }
.btn {
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--text);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 46px;
  padding: 0 20px;
  transition: transform 0.18s ease, border-color 0.18s ease, background 0.18s ease;
}
.btn:hover { transform: translateY(-2px); border-color: rgba(255, 255, 255, 0.28); }
.btn.primary { background: linear-gradient(135deg, var(--brand), #ff8f33); color: #1b1200; border: 0; font-weight: 800; }
.btn.ghost { background: rgba(255, 255, 255, 0.06); }
.btn.full { width: 100%; }
.upload-btn { position: relative; overflow: hidden; }

.container { width: min(1280px, calc(100% - 36px)); margin: 0 auto; padding-top: 34px; }
.toolbar {
  align-items: end;
  display: flex;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 24px;
}
.toolbar h2 { margin: 0 0 8px; font-size: 34px; }
.toolbar p { margin: 0; color: var(--muted); }
.filters { display: flex; gap: 12px; flex-wrap: wrap; }
.filters input, .filters select {
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid var(--line);
  border-radius: 14px;
  color: var(--text);
  min-height: 46px;
  outline: none;
  padding: 0 14px;
}
.filters select option { color: #111; }
.game-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 18px; }
.game-card {
  background: #111827;
  border: 1px solid var(--line);
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.22);
}
.cover {
  align-items: center;
  aspect-ratio: 4 / 3;
  background: var(--panel-soft);
  display: flex;
  justify-content: center;
  overflow: hidden;
}
.cover img { width: 100%; height: 100%; object-fit: cover; display: block; }

.screenshot-cover { position: relative; aspect-ratio: 16 / 9; }
.screenshot-cover::after {
  background: linear-gradient(180deg, transparent 35%, rgba(0, 0, 0, 0.62));
  content: "";
  inset: 0;
  position: absolute;
}
.title-row { align-items: center; display: flex; gap: 12px; margin-bottom: 8px; }
.title-row h3 { margin-bottom: 0; }
.mini-cover { display: none; }
.game-info { padding: 14px; }
.game-info h3 { margin: 0 0 6px; font-size: 19px; }
.game-info p { color: var(--muted); line-height: 1.5; min-height: 42px; margin: 0 0 12px; font-size: 14px; }
.badge { color: var(--brand); display: inline-block; font-size: 12px; font-weight: 800; margin-bottom: 5px; }
.empty { color: var(--muted); padding: 48px 0; text-align: center; }
.hidden { display: none; }
.footer { color: var(--muted); padding: 50px 18px; text-align: center; }

.play-body { padding-bottom: 120px; }
.play-header, .simple-header { padding: 22px clamp(18px, 4vw, 46px); border-bottom: 1px solid var(--line); }
.play-meta { flex: 1; }
.play-meta h1 { font-size: clamp(22px, 4vw, 36px); }
.play-meta p { color: var(--muted); margin: 6px 0 0; }
.play-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 22px;
  margin: 26px auto;
  width: min(1280px, calc(100% - 36px));
}
.screen-card, .panel-card {
  background: rgba(255, 255, 255, 0.055);
  border: 1px solid var(--line);
  border-radius: 24px;
  box-shadow: var(--shadow);
}
.screen-card { padding: 14px; }
.emulator-box {
  align-items: center;
  aspect-ratio: 4 / 3;
  background: #05070e;
  border-radius: 18px;
  display: flex;
  justify-content: center;
  overflow: hidden;
  position: relative;
}
.emulator-box > canvas, .emulator-box iframe { width: 100%; height: 100%; }
.emulator-fallback { color: var(--muted); max-width: 480px; padding: 24px; text-align: center; }
.side-panel { display: grid; gap: 16px; align-content: start; }
.panel-card { padding: 18px; }
.panel-card h2 { margin: 0 0 12px; }
.panel-card p { color: var(--muted); line-height: 1.65; }
.key-list { display: grid; gap: 10px; list-style: none; margin: 0; padding: 0; }
.key-list li { display: flex; justify-content: space-between; background: rgba(0, 0, 0, 0.18); border-radius: 12px; padding: 10px 12px; }
.key-list span { color: var(--muted); }
.warning { border-color: rgba(255, 204, 51, 0.35); }
.mobile-pad {
  bottom: 12px;
  display: none;
  gap: 18px;
  justify-content: space-between;
  left: 12px;
  pointer-events: none;
  position: fixed;
  right: 12px;
  z-index: 20;
}
.mobile-pad button {
  background: rgba(255, 255, 255, 0.16);
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 999px;
  color: var(--text);
  min-height: 54px;
  min-width: 54px;
  pointer-events: auto;
}
.dpad, .action-pad { display: grid; gap: 8px; }
.dpad { grid-template-columns: repeat(3, 54px); grid-template-rows: repeat(3, 54px); }
.dpad button:nth-child(1) { grid-column: 2; }
.dpad button:nth-child(2) { grid-column: 1; grid-row: 2; }
.dpad button:nth-child(3) { grid-column: 2; grid-row: 3; }
.dpad button:nth-child(4) { grid-column: 3; grid-row: 2; }
.action-pad { grid-template-columns: repeat(2, 70px); align-content: end; }
.doc { padding: 56px 0; line-height: 1.8; }
.doc h1 { font-size: 42px; }
.doc code, .doc pre { background: rgba(0, 0, 0, 0.24); border: 1px solid var(--line); border-radius: 12px; }
.doc code { padding: 2px 6px; }
.doc pre { overflow: auto; padding: 18px; }

@media (max-width: 860px) {
  .toolbar, .play-header { align-items: stretch; flex-direction: column; }
  .play-layout { grid-template-columns: 1fr; }
  .side-panel { order: 2; }
  .mobile-pad { display: flex; }
  .nav-links { display: none; }
}

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

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

@media (max-width: 480px) {
  .game-grid { grid-template-columns: 1fr; }
}

.start-btn { width: 100%; min-height: 42px; }

.btn, .mobile-pad button { -webkit-tap-highlight-color: transparent; touch-action: manipulation; user-select: none; }
.start-btn { width: 100%; min-height: 44px; position: relative; z-index: 3; }
.mobile-pad button.is-pressed { background: rgba(255, 204, 51, 0.72); color: #1b1200; transform: scale(0.96); }
.pagination {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
  padding: 30px 0 10px;
}
.page-btn {
  background: #111827;
  border: 1px solid var(--line);
  border-radius: 12px;
  color: var(--text);
  cursor: pointer;
  min-height: 40px;
  min-width: 42px;
  padding: 0 13px;
}
.page-btn.active {
  background: var(--brand);
  border-color: var(--brand);
  color: #1b1200;
  font-weight: 900;
}
.page-btn:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}
.page-ellipsis, .page-total {
  color: var(--muted);
}
.page-total {
  flex-basis: 100%;
  font-size: 14px;
  text-align: center;
}
@media (max-width: 760px) {
  .pagination { gap: 8px; }
  .page-btn { min-width: 38px; padding: 0 10px; }
}
