:root {
  --bg: #0b1220;
  --panel: #111a2c;
  --panel2: #16213a;
  --text: #e2e8f0;
  --muted: #94a3b8;
  --accent: #22c55e;
  --accent2: #38bdf8;
  --danger: #ef4444;
  --border: #1e293b;
  /* 底部广告条高度：原来自撑 40px → 加高一倍 80px → 再压 8px = 72px。
     游戏可在自己的 manifest.json 里写 "adBarHeight": 44 来单独指定（平台会覆盖这个变量）。 */
  --ad-bar-h: 72px;
  /* 给游戏舞台预留的高度 = 广告条高度 − 22px 覆盖量（**固定公式**，不按游戏自报留白动态调整）。
     为什么不自适应：一旦按"游戏自己的底部留白"动态调整，
     预留变 → iframe 尺寸变 → 游戏按 vh 重排 → 又测出新的留白 → 再调 …，
     形成反馈循环、画面持续抖动（英语填词卡实测抖动过）。
     平台规则：竖屏时广告条会压住游戏最下 22px；游戏请把重要内容放在离底边 ≥24px 处，
     并尽量别在底部留多余空白（那会露出游戏自己的底色 = 一条"蓝条"）。
     横屏游戏不适用这条：横屏舞台会整条让出 --ad-bar-h（见下方 landscape-full 规则）。 */
  --ad-reserve-h: calc(var(--ad-bar-h) - 22px);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
}

[v-cloak] { display: none !important; }

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

.container { max-width: 1080px; margin: 0 auto; padding: 0 20px; }

.topbar { background: var(--panel); border-bottom: 1px solid var(--border); padding: 18px 0; }
.topbar-inner { display: flex; align-items: baseline; gap: 14px; }
.logo { margin: 0; font-size: 22px; }
.subtitle { color: var(--muted); font-size: 13px; }

main.container { padding-top: 24px; padding-bottom: 60px; }

.toolbar { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 12px; margin-bottom: 20px; }
.filters { display: flex; gap: 8px; flex-wrap: wrap; }
.chip {
  background: var(--panel); color: var(--muted); border: 1px solid var(--border);
  padding: 6px 14px; border-radius: 999px; font-size: 13px; cursor: pointer;
  transition: all .15s;
}
.chip:hover { color: var(--text); }
.chip.active { background: var(--accent); color: #052e16; border-color: var(--accent); font-weight: 600; }
.count { color: var(--muted); font-size: 13px; }

.state { padding: 60px 0; text-align: center; color: var(--muted); font-size: 15px; }
.state.error { color: var(--danger); }

.game-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 18px; }
.game-card {
  background: var(--panel); border: 1px solid var(--border); border-radius: 14px;
  overflow: hidden; transition: transform .15s, border-color .15s; display: block;
}
.game-card:hover { transform: translateY(-3px); border-color: var(--accent2); }
.thumb { position: relative; aspect-ratio: 16 / 9; background: var(--panel2); overflow: hidden; }
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.thumb-fallback {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  font-size: 40px; font-weight: 800; color: #334155;
  background: linear-gradient(135deg, #16213a, #0f172a);
}
.meta { padding: 12px 14px 14px; }
.name { margin: 0 0 8px; font-size: 16px; }
.tags { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 8px; }
.tag { background: #1e3a5f; color: #7dd3fc; font-size: 11px; padding: 2px 8px; border-radius: 6px; }
.tag-dim { background: #26324a; color: var(--muted); }
.author { color: var(--muted); font-size: 12px; }

/* ---- 播放页 ---- */
.player-body { height: 100vh; height: 100dvh; overflow: hidden; box-sizing: border-box;
  padding-bottom: env(safe-area-inset-bottom, 0px); }
/* 词力学院自身已处理底部安全区，平台不再预留，避免渐变底被黑条截断 */
.player-body.internal-safe { padding-bottom: 0; }
/* 播放页：Vue 挂载点 #app 才是真正的 flex 纵向容器（body 下面还有 #app 这层） */
.player-body #app { height: 100%; display: flex; flex-direction: column; }
/* 底部广告条出现时，给舞台让出高度，避免广告盖住游戏底部按钮/状态行。
   两种标记都认：body.has-ad（player.js 里打的，实际生效的就是它）
   和 #app.has-ad（模板上的 :class，保留兼容）。 */
.player-body.has-ad .player-stage,
.player-body #app.has-ad .player-stage { padding-bottom: var(--ad-reserve-h); box-sizing: border-box; }
.player-bar {
  display: flex; align-items: center; gap: 14px; background: var(--panel);
  border-bottom: 1px solid var(--border); padding: 12px 20px;
}
.back { color: var(--accent2); font-size: 14px; }
.back:hover { text-decoration: underline; }
.player-title { font-weight: 700; font-size: 16px; }
.player-spacer { flex: 1; }
.player-user {
  color: var(--text); font-size: 13px; font-weight: 600; cursor: pointer;
  padding: 4px 10px; border-radius: 999px; background: var(--panel2);
  white-space: nowrap; transition: all .15s;
}
.player-user:hover { background: var(--accent2); color: #082f49; }
.player-user-editor { display: flex; align-items: center; gap: 6px; }
.player-user-editor input {
  width: 110px; padding: 4px 8px; border-radius: 6px; border: 1px solid var(--border);
  background: var(--panel2); color: var(--text); font-size: 13px; outline: none;
}
.player-user-editor button {
  border: 0; border-radius: 6px; padding: 4px 8px; font-size: 12px; cursor: pointer;
  background: var(--accent2); color: #082f49; font-weight: 600;
}
.player-user-editor button:last-child { background: var(--panel2); color: var(--muted); }

.player-stage { flex: 1; min-height: 0; display: flex; align-items: center; justify-content: center; padding: 0; }
.game-frame { border: 0; background: #000; border-radius: 0; box-shadow: none; }

/* 容器方向与尺寸：iframe 按方向锁定比例并撑满可用空间，游戏内部自适应缩放 */
.player-stage.portrait .game-frame { width: 100%; height: 100%; max-width: none; max-height: none; aspect-ratio: auto; }
.player-stage.landscape .game-frame { width: 100%; height: 100%; max-width: none; max-height: none; }

/* ========== 横屏全屏模式：上下 UI 悬浮不占位，游戏区铺满屏幕 ========== */
.player-body.landscape-full {
  position: fixed; inset: 0; z-index: 1000; background: #000;
}
/* 横屏全屏按钮（固定视口右下角，手机横屏也能看到，点击请求浏览器全屏） */
.fs-btn {
  position: fixed; right: 14px; bottom: 14px; z-index: 9999;
  background: rgba(0,0,0,.65); color: #fff; border: 2px solid rgba(255,255,255,.5);
  border-radius: 999px; padding: 10px 18px; font-size: 14px; font-weight: 800;
  cursor: pointer; backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px);
  box-shadow: 0 2px 12px rgba(0,0,0,.5);
}
.fs-btn:active { background: rgba(56,189,248,.5); transform: scale(.94); }
/* iOS 无法进全屏时的引导提示 */
.fs-hint {
  position: fixed; top: 80px; left: 50%; transform: translateX(-50%); z-index: 10000;
  background: rgba(0,0,0,.85); color: #fff; border: 1px solid rgba(255,255,255,.3);
  border-radius: 12px; padding: 14px 20px; font-size: 13px; line-height: 1.6;
  text-align: center; max-width: 80%; box-shadow: 0 6px 24px rgba(0,0,0,.5);
  pointer-events: none;
}
.fs-hint b { color: #4fc3f7; }
/* 横屏时顶栏悬浮在顶部（半透明不占位，游戏内容避开它） */
.player-body.landscape-full #app { flex-direction: column; }
.player-body.landscape-full header.player-bar {
  position: absolute; top: 0; left: 0; right: 0; z-index: 60;
  background: linear-gradient(rgba(0,0,0,.6), rgba(0,0,0,.2));
  border-bottom: none; padding: 5px 14px;
  color: #fff; pointer-events: none;
}
.player-body.landscape-full header.player-bar > * { pointer-events: auto; }
.player-body.landscape-full header.player-bar .player-title,
.player-body.landscape-full header.player-bar .player-user {
  font-size: 12px; color: #fff;
}
.player-body.landscape-full header.player-bar .player-actions button {
  background: rgba(255,255,255,.2); color: #fff; padding: 4px 10px; font-size: 12px;
}
/* 横屏时底部游戏信息隐藏（游戏内自带 HUD） */
.player-body.landscape-full aside.game-info { display: none; }
/* 横屏时游戏舞台铺满整个屏幕 */
.player-body.landscape-full .player-stage {
  position: absolute; inset: 0; z-index: 10;
  display: flex; align-items: center; justify-content: center;
}
.player-body.landscape-full .game-frame { width: 100%; height: 100%; border: 0; }

/* 横屏全屏：让出手机左右安全区（刘海/圆角），避免游戏按钮与广告被屏幕边缘切掉 */
.player-body.landscape-full header.player-bar {
  padding-left: calc(14px + env(safe-area-inset-left, 0px));
  padding-right: calc(14px + env(safe-area-inset-right, 0px));
}
.player-body.landscape-full .player-stage {
  left: env(safe-area-inset-left, 0px);
  right: env(safe-area-inset-right, 0px);
}
/* 横屏全屏：底部广告条必须完整露出 —— 舞台让出整条广告高度，广告压在游戏之上。
   （原先广告 z-index 低于舞台 z-index:10，会被游戏底部的深色/蓝条盖住顶部 22px）
   注意：这里要同时清掉竖屏那套 padding-bottom 预留，否则舞台底边与广告之间会多出一条空带 */
.player-body.landscape-full.has-ad .player-stage { bottom: var(--ad-bar-h); padding-bottom: 0; }
.player-body.landscape-full .ad-banner {
  z-index: 1200;
  padding-left: calc(10px + env(safe-area-inset-left, 0px));
  padding-right: calc(10px + env(safe-area-inset-right, 0px));
}
/* 横屏游戏在竖屏时：平台层兜底提示（游戏内自带拦截层，这里保证连广告条区域也盖住） */
.rotate-overlay {
  position: fixed; inset: 0; z-index: 2000;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px;
  background: rgba(4,10,20,.94); color: #fff; text-align: center; padding: 24px;
}
.rotate-overlay .ro-icon { font-size: 44px; animation: roSpin 1.8s ease-in-out infinite; }
.rotate-overlay .ro-title { font-size: 20px; font-weight: 900; color: #ffd54f; letter-spacing: 2px; }
.rotate-overlay .ro-sub { font-size: 13px; color: #b8c7d9; line-height: 1.7; }
@keyframes roSpin { 0%,100% { transform: rotate(0); } 50% { transform: rotate(-90deg); } }

.game-info { padding: 8px 20px 12px; color: var(--muted); font-size: 12px; border-top: 1px solid var(--border); }
.game-info .desc { color: var(--text); margin-bottom: 8px; }
.game-info .meta-line { margin: 2px 0; }
.game-info .tags { margin-top: 8px; }

.ad-banner {
  position: fixed; bottom: 0; left: 0; right: 0; background: #1e293b;
  display: flex; align-items: flex-start; justify-content: center; gap: 16px;
  min-height: var(--ad-bar-h);   /* 加高一倍：原来靠内容撑到 40px，现在固定 72px */
  /* 内容靠上（而不是垂直居中）：这样广告内容紧贴游戏底边，
     不会在"游戏底部 ↔ 广告内容"之间空出一条深色带（槽位高度照旧保留给正式广告素材） */
  padding: 8px 10px; font-size: 13px; color: var(--muted); border-top: 1px solid var(--border);
}
/* 平台动态滚动条 */
.news-banner { padding: 8px 10px; }
.news-ticker { flex: 1; overflow: hidden; white-space: nowrap; }
.news-track { display: flex; width: max-content; animation: newsTicker 22s linear infinite; }
.news-run { display: flex; align-items: center; }
.news-item { color: #e2e8f0; text-decoration: none; margin-right: 56px; font-size: 13px; white-space: nowrap; }
.news-item b { color: #fbbf24; font-weight: 800; }
@keyframes newsTicker {
  0% { transform: translateX(0); }
  100% { transform: translateX(-50%); }
}
.ad-close { background: transparent; border: 1px solid var(--border); color: var(--text); border-radius: 6px; cursor: pointer; padding: 2px 8px; flex: none; }
