/* ============ 坦克大战 - 复古游戏机风格 (2560x2000 超清大屏版) ============ */
* { margin: 0; padding: 0; box-sizing: border-box; }

:root {
  --bg: #000;
  --bezel: #161616;
  --bezel-edge: #3a3a3a;
  --accent: #ffd700;      /* 金色标题 */
  --accent2: #ff5722;     /* 橙红 */
  --cursor: #ff3b30;      /* 经典红色光标 */
  --text: #f0f0f0;
  --dim: #8a8a8a;
  --panel: #101010;
}

html, body {
  height: 100%;
  background: #050505;
  font-family: "Courier New", "Consolas", monospace;
  color: var(--text);
  overflow: hidden;
}

body {
  display: flex;
  align-items: center;
  justify-content: center;
  background:
    radial-gradient(ellipse at 50% 40%, #1a1a1a 0%, #050505 75%);
}

/* 游戏机外壳 (由 JS 按窗口大小整体缩放, 保持 1920x1080 设计稿) */
#wrap {
  display: flex;
  flex-direction: column;
  gap: 0;
  background: var(--bezel);
  border: 4px solid var(--bezel-edge);
  box-shadow:
    0 0 0 4px #000,
    0 24px 80px rgba(0, 0, 0, 0.85),
    inset 0 0 0 2px #000;
  padding: 14px;
  transform-origin: center center;
  flex: none;
}

/* 顶栏 */
#topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 28px;
  margin-bottom: 14px;
  background: var(--panel);
  border: 3px solid #2c2c2c;
  font-size: 34px;
}
#topbar .logo {
  color: var(--accent);
  font-weight: bold;
  letter-spacing: 8px;
  text-shadow: 3px 3px 0 #7a5c00;
}
#topbar .logo i {
  color: var(--dim);
  font-style: normal;
  font-size: 24px;
  margin-left: 14px;
  letter-spacing: 3px;
}

.mini-btn {
  background: #1c1c1c;
  color: var(--text);
  border: 3px solid #4a4a4a;
  padding: 10px 28px;
  font-family: inherit;
  font-size: 26px;
  cursor: pointer;
  margin-left: 14px;
  letter-spacing: 2px;
  transition: none;
}
.mini-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: #241f00;
}
.mini-btn:active { transform: translateY(2px); }

/* 游戏区域 (屏幕) 2560x2000 */
#game-area {
  position: relative;
  width: 2560px;
  height: 2000px;
  border: 4px solid #000;
  box-shadow: inset 0 0 40px rgba(0, 0, 0, 0.9);
  background: #000;
  overflow: hidden;
}

#game {
  display: block;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
}

/* CRT 扫描线效果 */
#game-area::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: repeating-linear-gradient(
    to bottom,
    rgba(0, 0, 0, 0) 0px,
    rgba(0, 0, 0, 0) 3px,
    rgba(0, 0, 0, 0.16) 4px,
    rgba(0, 0, 0, 0) 6px
  );
  z-index: 5;
}

/* 覆盖层 */
#overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.88);
  z-index: 10;
}
#overlay.hidden { display: none; }

/* 演示模式 (attract mode): 菜单降透明, 透出背后 AI 实战画面 */
body.demo-on #overlay { background: rgba(0, 0, 0, 0.55); }
.demo-hint {
  margin-top: 26px;
  color: var(--accent);
  font-size: 30px;
  letter-spacing: 6px;
  animation: demoBlink 1.2s infinite;
  text-shadow: 2px 2px 0 rgba(0, 0, 0, 0.8);
}
@keyframes demoBlink { 50% { opacity: 0.35; } }

/* ============================================================
 * DEMO 模式顶栏: 演示中隐藏全部菜单覆盖层, 仅保留顶部信息栏
 * "DEMO 模式 · 第 N 关 · 按回车开始游戏" (body.state-demo 由 JS 切换)
 * ============================================================ */
body.state-demo #overlay { display: none !important; }

/* DEMO 信息栏: 作为 #topbar 的中部 flex 子元素 (space-between 自动居中),
   置于"坦克大战"标题行的中间空白处, 不再覆盖游戏画布 */
#demo-bar {
  display: none;
  align-items: center;
  gap: 26px;
  pointer-events: none;
  user-select: none;
  white-space: nowrap;
}
body.state-demo #demo-bar { display: flex; }

/* 顶栏按钮隐藏: 不占空间、不可见, 保留 DOM (便于一行恢复) */
.mini-btn.hidden { display: none; }

#demo-bar .db-demo {
  color: var(--accent);
  font-size: 30px;
  font-weight: bold;
  letter-spacing: 6px;
  text-shadow: 2px 2px 0 #7a5c00;
}
#demo-bar .db-sep {
  color: #4a4a4a;
  font-size: 26px;
}
#demo-bar .db-stage {
  color: #fff;
  font-size: 28px;
  letter-spacing: 5px;
  text-shadow: 2px 2px 0 rgba(0, 0, 0, 0.8);
}
#demo-bar .db-hint {
  color: var(--accent);
  font-size: 26px;
  letter-spacing: 5px;
  animation: demoBlink 1.2s infinite;
  text-shadow: 2px 2px 0 rgba(0, 0, 0, 0.8);
}

.screen {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  padding: 24px;
  text-align: center;
}
.screen.hidden { display: none; }

/* 标题 */
.title-logo { text-align: center; }
.logo-tank { display: flex; justify-content: center; margin-bottom: 10px; }
.logo-tank canvas {
  image-rendering: pixelated;
  width: 200px;
  height: 200px;
  filter: drop-shadow(0 0 14px rgba(255, 215, 0, 0.4));
}
.title-logo h1 {
  font-size: 130px;
  color: var(--accent);
  letter-spacing: 34px;
  text-shadow: 6px 6px 0 #b8860b, 10px 10px 0 rgba(0, 0, 0, 0.7);
  margin-left: 34px; /* 补偿 letter-spacing */
  font-weight: bold;
}
.title-logo h2 {
  font-size: 40px;
  color: var(--accent2);
  letter-spacing: 24px;
  margin: 12px 0 4px 24px;
  text-shadow: 3px 3px 0 #5c1a00;
}
.subtitle { color: var(--dim); font-size: 30px; margin-top: 12px; letter-spacing: 4px; }

/* 菜单 (经典红色光标) */
.menu {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 26px;
  min-width: 900px;
}
.menu-item {
  padding: 16px 44px;
  font-size: 40px;
  cursor: pointer;
  color: var(--text);
  letter-spacing: 4px;
  user-select: none;
  text-align: left;
  position: relative;
  transition: none;
}
.menu-item::before {
  content: "▶";
  position: absolute;
  left: 4px;
  color: var(--cursor);
  opacity: 0;
}
.menu-item small { color: var(--dim); font-size: 26px; margin-left: 18px; letter-spacing: 1px; }
.menu-item:hover, .menu-item.active {
  color: var(--accent);
  transform: translateX(18px);
}
.menu-item:hover::before, .menu-item.active::before { opacity: 1; }
.menu-item.selected {
  color: var(--accent);
}
.menu-item.selected::before { opacity: 1; }

.title-footer {
  display: flex;
  gap: 72px;
  margin-top: 32px;
  color: var(--dim);
  font-size: 28px;
  letter-spacing: 3px;
}
.copyright {
  margin-top: 18px;
  color: #555;
  font-size: 22px;
  letter-spacing: 3px;
}

/* 选关 / 难度 / 帮助 / 模式 标题 */
#screen-mode h3 {
  color: var(--accent);
  font-size: 60px;
  letter-spacing: 12px;
  margin-bottom: 16px;
  text-shadow: 3px 3px 0 #7a5c00;
}
#screen-stages h3, #screen-difficulty h3, #screen-help h3 {
  color: var(--accent);
  font-size: 52px;
  letter-spacing: 10px;
  margin-bottom: 16px;
  text-shadow: 3px 3px 0 #7a5c00;
}
.stage-grid {
  display: grid;
  grid-template-columns: repeat(7, 140px);
  gap: 14px;
  margin: 18px 0;
}
.stage-cell {
  width: 140px;
  height: 96px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #181818;
  border: 3px solid #3a3a3a;
  font-size: 40px;
  cursor: pointer;
  color: var(--text);
  transition: none;
}
.stage-cell:hover, .stage-cell.active { border-color: var(--accent); color: var(--accent); background: #241f00; }
.stage-cell.cleared { background: #10241a; border-color: #2e7d32; color: #66bb6a; }
.stage-cell.cleared.active { border-color: #66bb6a; color: #a5ffc0; background: #16301f; }
.stage-cell.locked { opacity: 0.35; cursor: not-allowed; }

/* 帮助 */
.help-box {
  background: rgba(255, 255, 255, 0.04);
  border: 3px solid #2c2c2c;
  padding: 28px 44px;
  font-size: 30px;
  line-height: 1.7;
  text-align: left;
  max-height: 920px;
  overflow-y: auto;
  width: 1500px;
}
.help-box b { color: var(--accent); }
.help-box p { margin: 3px 0; }

/* 状态文字 */
#screen-clear h3, #screen-gameover h3, #screen-victory h3 {
  font-size: 72px;
  letter-spacing: 12px;
  margin-bottom: 16px;
}
#screen-clear h3 { color: var(--accent); text-shadow: 3px 3px 0 #b8860b; }
.gameover-text { color: #e53935 !important; text-shadow: 3px 3px 0 #7f0000; animation: blink 1s infinite; }
.victory-text { color: #66bb6a !important; text-shadow: 3px 3px 0 #1b5e20; }
#screen-clear p, #screen-gameover p, #screen-victory p { color: var(--dim); font-size: 36px; }

@keyframes blink { 50% { opacity: 0.4; } }

/* 底栏 */
#bottombar {
  text-align: center;
  color: var(--dim);
  font-size: 28px;
  padding: 16px 8px 4px;
  letter-spacing: 3px;
}

/* 全站导航栏 (随 #wrap 整体缩放, 游戏机外壳风格) */
#site-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px 16px;
  background: var(--panel);
  border: 3px solid #2c2c2c;
  padding: 8px 24px;
  margin-bottom: 14px;
  font-size: 22px;
}
#site-nav .site-logo {
  color: var(--accent);
  text-decoration: none;
  letter-spacing: 1px;
}
#site-nav .site-logo i { font-style: normal; color: var(--dim); font-size: 16px; }
#site-nav .nav-links { display: flex; gap: 4px 2px; }
#site-nav .nav-links a {
  color: var(--dim);
  text-decoration: none;
  padding: 2px 12px;
  border: 2px solid transparent;
  border-radius: 6px;
  font-size: 20px;
}
#site-nav .nav-links a:hover { color: var(--text); border-color: #3a3a3a; }
#site-nav .nav-links a.active { color: var(--accent); border-color: var(--accent); }

/* 站点页脚 */
#site-footer {
  margin-top: 14px;
  text-align: center;
  background: var(--panel);
  border: 3px solid #2c2c2c;
  padding: 14px 20px 16px;
}
#site-footer .footer-links a {
  color: var(--dim);
  text-decoration: none;
  font-size: 20px;
  margin: 0 14px;
  border-bottom: 2px solid transparent;
}
#site-footer .footer-links a:hover { color: var(--accent); border-bottom-color: var(--accent); }
#site-footer .footer-copy {
  color: #666;
  font-size: 16px;
  margin-top: 8px;
  letter-spacing: 2px;
}

/* Google AdSense 广告位: 局间展示, 居中且不遮挡游戏 (默认隐藏, game.js 控制) */
#ad-slot {
  display: none;
  width: 100%;
  max-width: 970px;
  margin: 10px auto;
  min-height: 0;
  text-align: center;
  overflow: hidden;
}
#ad-slot .adsbygoogle {
  display: block;
  width: 100%;
  max-width: 970px;
  height: 90px;
}
#ad-slot.visible { display: block; }

/* 滚动条 */
::-webkit-scrollbar { width: 10px; }
::-webkit-scrollbar-track { background: #111; }
::-webkit-scrollbar-thumb { background: #444; }
