/* 游戏代充首页 — 竞品式清爽白底 + 荧光绿主色；间距 8 基准 */
:root {
  color-scheme: light;
  --space-1: 8px;
  --space-2: 16px;
  --space-3: 24px;
  --page: #f0f2f5;
  --surface: #ffffff;
  --ink: #0f1114;
  --muted: #5c6370;
  --line: rgba(15, 17, 20, 0.08);
  --lime: #76d72f;
  --lime-dark: #5fb51f;
  --lime-soft: rgba(118, 215, 47, 0.18);
  --accent-red: #c41e3a;
  --accent-red-soft: rgba(196, 30, 58, 0.12);
  --star: #ffb800;
  --badge: #ff7a2e;
  --radius-sm: 10px;
  --radius-md: 16px;
  --radius-lg: 20px;
  --nav-h: 56px;
  --header-h: 52px;
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --font: "DM Sans", "Noto Sans SC", ui-sans-serif, sans-serif;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-tap-highlight-color: transparent;
}

body {
  margin: 0;
  min-height: 100%;
  font-family: var(--font);
  background: var(--page);
  color: var(--ink);
  font-size: 15px;
  line-height: 1.5;
}

:focus-visible {
  outline: 2px solid #2e86de;
  outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
  }
}

.app {
  min-height: 100dvh;
  padding-bottom: calc(var(--nav-h) + env(safe-area-inset-bottom, 0px));
}

.header {
  position: sticky;
  top: 0;
  z-index: 50;
  height: var(--header-h);
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.8);
}

.logo {
  display: flex;
  align-items: center;
  gap: var(--space-1);
  font-weight: 800;
  font-size: 1.125rem;
  letter-spacing: -0.02em;
  color: var(--ink);
}

.logo-mark {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  background: var(--ink);
  display: grid;
  place-items: center;
  position: relative;
}

.logo-mark::after {
  content: "";
  width: 14px;
  height: 14px;
  background: var(--lime);
  border-radius: 2px;
  position: absolute;
  right: 5px;
  bottom: 5px;
  clip-path: polygon(0 0, 100% 0, 100% 100%, 0 100%);
  transform: rotate(45deg);
}

.logo-mark span {
  color: #fff;
  font-size: 1.1rem;
  font-weight: 800;
  margin-left: -2px;
}

.wrap {
  padding: var(--space-2) var(--space-2) 0;
  max-width: 480px;
  margin: 0 auto;
}

/* —— 游戏宣传主视觉（支持 URL / 本地上传由 JS 写入）—— */
.promo-block {
  margin-bottom: var(--space-2);
}

.promo-hero {
  position: relative;
  border-radius: var(--radius-md);
  overflow: hidden;
  aspect-ratio: 16 / 9;
  background: linear-gradient(145deg, #1a1d22 0%, #2a3038 100%);
  border: 1px solid var(--line);
  box-shadow: 0 var(--space-2) var(--space-3) rgba(15, 17, 20, 0.08);
  cursor: pointer;
  transition: transform 160ms var(--ease-out), box-shadow 200ms var(--ease-out);
}

.promo-hero:hover {
  box-shadow: 0 var(--space-3) 40px rgba(15, 17, 20, 0.12);
}

.promo-hero:active {
  transform: scale(0.99);
}

.promo-hero__img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.promo-hero__scrim {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(
    180deg,
    transparent 40%,
    rgba(15, 17, 20, 0.55) 100%
  );
}

.promo-hero__foot {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  padding: var(--space-2) var(--space-2) 14px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  pointer-events: none;
}

.promo-hero__tag {
  font-size: 11px;
  font-weight: 700;
  color: var(--ink);
  background: var(--lime);
  padding: 4px 10px;
  border-radius: 999px;
  letter-spacing: 0.02em;
}

.promo-hero__cta {
  margin: 0;
  font-size: 13px;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.95);
  text-shadow: 0 1px 8px rgba(0, 0, 0, 0.45);
  max-width: 90%;
}

.promo-hero__hint {
  position: absolute;
  top: var(--space-1);
  right: var(--space-1);
  font-size: 11px;
  font-weight: 600;
  color: #fff;
  background: rgba(0, 0, 0, 0.5);
  padding: 6px 10px;
  border-radius: 999px;
  pointer-events: none;
}

.promo-hero__dots {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 10px;
  display: flex;
  justify-content: center;
  gap: 6px;
  pointer-events: none;
}

.promo-hero__dots span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.35);
}

.promo-hero__dots span.on {
  background: var(--lime);
  width: 16px;
  border-radius: 3px;
}

.promo-tools {
  margin-top: var(--space-1);
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background: var(--surface);
  overflow: hidden;
}

.promo-tools summary {
  list-style: none;
  cursor: pointer;
  padding: 10px var(--space-2);
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-1);
}

.promo-tools summary::-webkit-details-marker {
  display: none;
}

.promo-tools summary::after {
  content: "▾";
  font-size: 10px;
  opacity: 0.6;
}

.promo-tools[open] summary::after {
  transform: rotate(180deg);
}

.promo-tools__body {
  padding: 0 var(--space-2) var(--space-2);
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
}

.promo-tools__row {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-1);
  align-items: center;
}

.promo-tools label {
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  min-width: 72px;
}

.promo-tools input[type="url"],
.promo-tools input[type="file"] {
  font: inherit;
  font-size: 13px;
}

.promo-tools input[type="url"] {
  flex: 1;
  min-width: 0;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background: #fafbfc;
  color: var(--ink);
}

.promo-tools input[type="url"]:focus {
  outline: none;
  border-color: rgba(46, 134, 222, 0.45);
  box-shadow: 0 0 0 3px rgba(46, 134, 222, 0.15);
}

.promo-tools .btn-row {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-1);
  margin-top: 4px;
}

.promo-tools button {
  font: inherit;
  font-size: 13px;
  font-weight: 700;
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background: #f3f4f6;
  color: var(--ink);
  cursor: pointer;
  transition: background 160ms var(--ease-out), border-color 160ms var(--ease-out);
}

.promo-tools button:hover {
  background: #e8eaef;
}

.promo-tools button.primary {
  background: var(--lime-soft);
  border-color: rgba(118, 215, 47, 0.45);
  color: var(--lime-dark);
}

.promo-tools .hint {
  margin: 0;
  font-size: 11px;
  color: var(--muted);
  line-height: 1.45;
}

/* 竞品式分区条（白底上的战术红点缀） */
.section-ribbon {
  display: flex;
  align-items: stretch;
  gap: 0;
  margin: var(--space-3) 0 var(--space-2);
  border-radius: var(--radius-sm);
  overflow: hidden;
  border: 1px solid var(--line);
  background: var(--surface);
  box-shadow: 0 2px 12px rgba(15, 17, 20, 0.04);
}

.section-ribbon__accent {
  width: 6px;
  flex-shrink: 0;
  background: linear-gradient(180deg, #e85d6f 0%, var(--accent-red) 50%, #8b1538 100%);
}

.section-ribbon__text {
  flex: 1;
  padding: 10px var(--space-2);
  font-size: 14px;
  font-weight: 800;
  letter-spacing: 0.02em;
  color: var(--ink);
}

.section-title {
  margin: 0 0 var(--space-2);
  font-size: 1.0625rem;
  font-weight: 800;
  color: var(--ink);
}

.game-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-2);
  padding-bottom: var(--space-2);
}

.game-card {
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: 0 4px 14px rgba(15, 17, 20, 0.05);
  transition: transform 160ms var(--ease-out), box-shadow 200ms var(--ease-out);
}

.game-card:hover {
  box-shadow: 0 8px 22px rgba(15, 17, 20, 0.08);
}

.game-thumb {
  position: relative;
  aspect-ratio: 10 / 11;
  background: linear-gradient(160deg, #eceef2 0%, #f7f8fa 100%);
}

.game-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.badge-off {
  position: absolute;
  top: 6px;
  right: 6px;
  background: var(--badge);
  color: #fff;
  font-size: 10px;
  font-weight: 800;
  padding: 2px 6px;
  border-radius: 999px;
  box-shadow: 0 2px 8px rgba(255, 122, 46, 0.35);
}

.game-meta {
  padding: 8px 8px 10px;
  font-size: 12px;
  line-height: 1.35;
}

.game-meta strong {
  display: block;
  margin-bottom: 2px;
  font-weight: 700;
  color: var(--ink);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.stars {
  color: var(--star);
  font-size: 11px;
  font-weight: 600;
}

.game-card.event-entry {
  cursor: pointer;
  border: 2px solid var(--lime);
  box-shadow: 0 4px 20px var(--lime-soft);
}

.game-card.event-entry:focus-visible {
  outline-offset: 4px;
}

.game-card.event-entry .game-thumb {
  background: linear-gradient(145deg, #1e2228 0%, #2d333d 100%);
  display: grid;
  place-items: center;
  color: var(--lime);
  font-weight: 800;
  font-size: 11px;
  text-align: center;
  padding: 8px;
  line-height: 1.35;
}

.tabbar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 60;
  height: calc(var(--nav-h) + env(safe-area-inset-bottom, 0px));
  padding-bottom: env(safe-area-inset-bottom, 0px);
  background: var(--surface);
  border-top: 1px solid var(--line);
  display: flex;
  justify-content: space-around;
  align-items: flex-start;
  padding-top: 6px;
  max-width: 480px;
  margin: 0 auto;
  box-shadow: 0 -4px 24px rgba(15, 17, 20, 0.06);
}

.tab {
  flex: 1;
  text-align: center;
  font-size: 10px;
  font-weight: 500;
  color: var(--muted);
}

.tab svg {
  display: block;
  margin: 0 auto 2px;
  width: 24px;
  height: 24px;
  opacity: 0.4;
}

.tab.on {
  color: var(--lime-dark);
  font-weight: 700;
}

.tab.on svg {
  opacity: 1;
  stroke: var(--lime-dark);
  fill: none;
}

.iframe-layer {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(15, 20, 30, 0.35);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: stretch;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom)
    env(safe-area-inset-left);
}

.iframe-layer.open {
  display: flex;
}

.iframe-panel {
  flex: 1;
  width: 100%;
  max-width: 480px;
  margin: 10px auto;
  margin-top: max(10px, env(safe-area-inset-top));
  margin-bottom: max(10px, env(safe-area-inset-bottom));
  background: var(--surface);
  border-radius: var(--radius-lg);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  min-height: 0;
  border: 1px solid rgba(46, 134, 222, 0.22);
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.85) inset, 0 16px 48px rgba(15, 17, 20, 0.12);
}

.iframe-toolbar {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
  padding: 12px var(--space-2);
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}

.iframe-toolbar span {
  font-size: 16px;
  font-weight: 800;
  color: var(--ink);
  letter-spacing: 0.03em;
}

.iframe-close {
  border: 1px solid var(--line);
  background: #f3f4f6;
  color: #555;
  width: 40px;
  height: 40px;
  border-radius: var(--radius-sm);
  font-size: 22px;
  line-height: 1;
  font-weight: 800;
  cursor: pointer;
  transition: transform 120ms var(--ease-out), border-color 160ms var(--ease-out);
}

.iframe-close:hover {
  border-color: rgba(46, 134, 222, 0.4);
}

.iframe-close:active {
  transform: scale(0.96);
}

.iframe-panel iframe {
  flex: 1;
  width: 100%;
  border: 0;
  min-height: 0;
  display: block;
  background: var(--page);
}

.banner-fallback::before {
  content: "上传或填写图片链接展示游戏宣传";
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  text-align: center;
  padding: var(--space-2);
  color: rgba(255, 255, 255, 0.75);
  font-size: 13px;
  font-weight: 600;
  z-index: 1;
}
