/* =========================================================================
 * 水果忍者 · 切水果 —— 全屏游戏页样式（自包含，不动站点全局 CSS）
 * 视觉方向：参考原版水果忍者 —— 浅色木质小清新背景、奶油色浮层卡片、
 * 绿色侧栏 HUD、大字分数。背景板由 canvas 绘制（见 game.js 的 drawBg），
 * 这里负责 DOM 层（顶栏 / 生命条 / 遮罩 / 按钮）。
 * ========================================================================= */
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body {
    margin: 0; padding: 0; height: 100%;
    overflow: hidden;
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, "PingFang SC", "Microsoft YaHei", sans-serif;
    /* 兜底背景：canvas 覆盖后基本看不见，但蒙层借光 */
    background: #f4ecd9;
    color: #4a3f2f;
    user-select: none; -webkit-user-select: none;
    touch-action: none;
}

/* 顶部栏：半透明白色木板条 */
.game-topbar {
    position: fixed; top: 0; left: 0; right: 0;
    z-index: 50;
    display: flex; align-items: center; justify-content: space-between;
    gap: 8px;
    padding: max(10px, env(safe-area-inset-top)) 12px 8px;
    background: linear-gradient(rgba(255, 244, 217, .86), rgba(255, 244, 217, .4) 85%, transparent);
    font-size: .84rem;
}
.back-home {
    color: #7a5a2a; text-decoration: none; font-weight: 700;
    background: #fff4d9; padding: 7px 14px; border-radius: 999px;
    border: 1.5px solid #d8bc82; box-shadow: 0 2px 6px #b08a3e33; white-space: nowrap;
}
.game-topbar-center { flex: 1; text-align: center; min-width: 0; }
.game-score {
    display: inline-block; font-weight: 800; font-size: 1.2rem; letter-spacing: 1px;
    color: #fff; padding: 4px 16px; border-radius: 999px;
    background: linear-gradient(#4f8f2f, #3c7a22); box-shadow: 0 4px 12px #3c7a2244;
    font-variant-numeric: tabular-nums;
}
.game-score b { color: #fff; }
.game-combo {
    margin-left: 10px; color: #c15b1e; font-size: .95rem; font-weight: 800;
    text-shadow: 0 1px 0 #fff6;
}
.game-topbar-actions { display: flex; gap: 6px; }
.game-icon-btn {
    width: 36px; height: 36px; border-radius: 50%;
    border: 1.5px solid #d8bc82; background: #fff4d9; color: #7a5a2a;
    font-size: 15px; cursor: pointer; line-height: 1; box-shadow: 0 2px 5px #b08a3e33;
}
.game-icon-btn:hover { background: #fff; }

/* 生命条：三把"刀"（❤改用小刀更贴原版，保留爱心做通用） */
.game-lives {
    position: fixed; top: max(50px, env(safe-area-inset-top)); left: 0; right: 0;
    z-index: 40; display: flex; justify-content: center; gap: 12px;
}
.life { width: 30px; height: 30px; font-size: 0; transition: all .3s; filter: drop-shadow(0 2px 3px #0003); }
.life::after { content: '🍉'; font-size: 24px; }
.life.lost { filter: grayscale(1) brightness(.5) opacity(.4); transform: scale(.75) rotate(-12deg); }

/* 画布 */
#game { position: fixed; inset: 0; width: 100%; height: 100%; display: block; z-index: 5; }

/* 连击大横幅：连击≥3 时居中弹跳 */
.combo-banner {
    position: fixed; top: 24%; left: 0; right: 0; z-index: 45;
    text-align: center; pointer-events: none; opacity: 0;
    transform: scale(.6);
    font-size: 2rem; font-weight: 900; letter-spacing: 2px; color: #fff;
    text-shadow: 0 3px 0 #c15b1e, 0 0 22px #ffd23f99;
    font-style: italic;
}
.combo-banner.show { animation: comboPop .5s cubic-bezier(.2, 1.4, .4, 1); opacity: 1; }
.combo-banner b { color: #ffd23f; font-size: 2.3rem; }
@keyframes comboPop {
    0% { opacity: 0; transform: scale(.6) translateY(12px); }
    60% { opacity: 1; transform: scale(1.1) translateY(-4px); }
    100% { opacity: 1; transform: scale(1) translateY(0); }
}

/* 遮罩层：奶油色木纹卡片 */
.game-overlay {
    position: fixed; inset: 0; z-index: 60;
    display: flex; align-items: center; justify-content: center;
    background: rgba(80, 60, 30, .42); backdrop-filter: blur(2px);
    padding: 20px;
}
.game-overlay.hidden { display: none; }
.overlay-card {
    text-align: center; max-width: 340px; width: 100%;
    background: linear-gradient(180deg, #fff7e3, #f6e9c8);
    border: 2px solid #e3c891;
    border-radius: 20px; padding: 30px 24px;
    box-shadow: 0 18px 50px #3a2c14a6, inset 0 1px 0 #fff8;
    color: #4a3f2f;
}
.overlay-title {
    font-size: 1.9rem; font-weight: 900; letter-spacing: 1px;
    color: #3c7a22; text-shadow: 0 2px 0 #fff;
}
.overlay-sub { margin-top: 10px; font-size: .88rem; color: #8a7753; line-height: 1.7; }
.overlay-best { margin-top: 14px; color: #a2641a; font-size: .95rem; font-weight: 700; }
.overlay-best b { font-size: 1.2rem; color: #c15b1e; }
.game-btn {
    margin-top: 22px; padding: 13px 38px; border: 0; border-radius: 999px;
    background: linear-gradient(#63a038, #45811f); color: #fff; font-weight: 800;
    font-size: 1.1rem; letter-spacing: 1px; cursor: pointer;
    box-shadow: 0 8px 18px #45811f55, inset 0 1px 0 #9ecc6d;
}
.game-btn:hover { filter: brightness(1.08); transform: translateY(-1px); }
.overlay-orient-hint { margin-top: 16px; font-size: .78rem; color: #9c8b66; line-height: 1.5; }

/* 横屏后的状态提示（自由选择横/竖屏游玩） */
#rotator.on::after {
    content: '🔁 已切换横屏 · 可再点 🔄 切回竖屏';
    position: fixed; bottom: max(14px, env(safe-area-inset-bottom)); left: 0; right: 0;
    text-align: center; font-size: .78rem; color: #5a4c34; z-index: 90; pointer-events: none;
    background: rgba(255, 244, 217, .8); padding: 6px 0;
}

/* 手机窄屏微调 */
@media (max-width: 480px) {
    .game-topbar { font-size: .78rem; }
    .game-icon-btn { width: 33px; height: 33px; }
    .game-score { font-size: 1.05rem; }
}