/* AI8899 小游戏通用外壳样式 — 所有生成游戏共用
 * 约定类名：.top 顶栏 / .wrap 主体 / .panel 卡片 / .hud 数值条 / .stage 画布容器 / .overlay 遮罩
 * 画布比例由页面内联 --ar 变量控制
 */
:root {
  --primary: #FF4400;
  --primary-soft: #FF6A1A;
  --ink: #1f1f1f;
  --muted: #8a8a8a;
  --bg: #f7f5f2;
  --card: #ffffff;
  --border: #ece7e0;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
a { color: inherit; text-decoration: none; }
button { font-family: inherit; }
.top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 20px;
  background: #fff;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 10;
}
.back {
  font-size: 13px;
  color: var(--muted);
  padding: 8px 12px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: #fff;
}
.back:hover { color: var(--primary); border-color: var(--primary); }
.brand { font-size: 12px; color: var(--muted); letter-spacing: 1px; }
.wrap { width: 100%; max-width: 680px; margin: 0 auto; padding: 16px 16px 32px; }
.h1 { font-size: 22px; font-weight: 800; margin: 2px 0 6px; letter-spacing: .5px; }
.sub { font-size: 13px; color: var(--muted); line-height: 1.7; margin: 0 0 14px; }
.panel {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 14px;
  box-shadow: 0 6px 20px rgba(31, 25, 20, .05);
}
.hud { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.stat { flex: 1 1 84px; background: #faf8f5; border: 1px solid var(--border); border-radius: 12px; padding: 8px 10px; }
.stat b { display: block; font-size: 18px; font-weight: 800; line-height: 1.3; }
.stat span { font-size: 11px; color: var(--muted); }
.stage {
  position: relative;
  width: 100%;
  aspect-ratio: var(--ar, 1 / 1);
  background: #fffdfa;
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
}
canvas { display: block; width: 100%; height: 100%; touch-action: none; }
.overlay {
  position: absolute;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(24, 18, 14, .55);
  text-align: center;
  padding: 20px;
}
.overlay.on { display: flex; }
.overlay .box { background: #fff; border-radius: 16px; padding: 20px 24px; max-width: 320px; }
.overlay h3 { margin: 0 0 8px; font-size: 20px; }
.overlay p { margin: 0 0 14px; font-size: 14px; color: var(--muted); line-height: 1.7; }
.btn {
  appearance: none;
  border: 1px solid var(--primary);
  background: var(--primary);
  color: #fff;
  font: 600 15px/1 inherit;
  padding: 12px 20px;
  border-radius: 999px;
  cursor: pointer;
  touch-action: manipulation;
}
.btn.ghost { background: #fff; color: var(--primary); }
.btn:active { transform: translateY(1px); }
.bar { display: flex; gap: 10px; margin-top: 12px; flex-wrap: wrap; }
.tips { margin: 12px 0 0; font-size: 12px; color: var(--muted); line-height: 1.9; }
.foot { margin: 18px 0 0; font-size: 12px; color: var(--muted); text-align: center; line-height: 1.8; }
@media (max-width: 420px) {
  .wrap { padding: 12px 12px 26px; }
  .h1 { font-size: 20px; }
  .stat b { font-size: 16px; }
  .btn { flex: 1 1 auto; }
}
