  /* ============================================================
     像素字体 QuanPixel 8px
     ------------------------------------------------------------
     项目自带的 quan.ttf，覆盖拉丁字母、数字与 11000+ 汉字，
     与游戏的像素风格一致。

     注意：该字体不含 emoji（👑 🛡️ 💥 …），因此 font-family 里必须
     保留 emoji 字体作为后备，否则界面上的图标会变成豆腐块或空白。
     Segoe UI Emoji / Segoe UI Symbol 用于 Windows，其后是各平台常见
     的 emoji 字体；最后再回落到系统无衬线字体兜底。
     ============================================================ */
  @font-face {
    font-family: 'QuanPixel';
    src: url('quan.ttf') format('truetype');
    font-weight: normal;
    font-style: normal;
    font-display: swap;
  }

  * { margin: 0; padding: 0; box-sizing: border-box; user-select: none; }
  body {
    background: #1a1a1f;
    font-family: 'QuanPixel', "Segoe UI", "PingFang SC", "Microsoft YaHei",
                 "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji",
                 "Apple Color Emoji", sans-serif;
    display: flex; justify-content: center; align-items: center;
    min-height: 100vh; overflow: hidden; color: #e8e0d5;
  }

  /* ============================================================
     通用全屏容器
     ============================================================ */
  .screen {
    width: 1100px; height: 720px;
    background: #22222a; border-radius: 12px;
    position: relative; overflow: hidden;
    box-shadow: 0 0 40px rgba(0,0,0,0.8), inset 0 0 60px rgba(0,0,0,0.3);
    display: flex; flex-direction: column;
  }
  .hidden { display: none !important; }

  /* ============================================================
     主菜单
     ============================================================ */
  #mainMenu {
    background:
      radial-gradient(ellipse at 50% 40%, #2a3040 0%, #1a1a1f 70%),
      #1a1a1f;
    justify-content: center; align-items: center;
  }
  #mainMenu::before {
    content: '';
    position: absolute; inset: 0;
    background: repeating-linear-gradient(
      45deg, transparent, transparent 40px,
      rgba(255,215,0,0.02) 40px, rgba(255,215,0,0.02) 42px
    );
    pointer-events: none;
  }
  .menu-content {
    position: relative; z-index: 2;
    display: flex; flex-direction: column;
    align-items: center; gap: 8px;
    text-align: center;
  }
  .game-title {
    font-size: 76px;
    font-weight: 900;
    letter-spacing: 12px;
    color: #e8c84a;
    text-shadow:
      0 0 20px rgba(255,215,0,0.5),
      0 0 40px rgba(255,215,0,0.3),
      4px 4px 0 #6b5a2e;
    margin-bottom: 4px;
  }
  .game-subtitle {
    font-size: 16px; color: #888;
    letter-spacing: 6px; text-transform: uppercase;
    margin-bottom: 4px;
  }
  .game-tagline {
    font-size: 14px; color: #c8a84a;
    font-style: italic; margin-bottom: 36px;
  }
  .menu-frog {
    width: 140px; height: 160px;
    position: relative;
    margin-bottom: 20px;
    animation: idleBob 2.4s ease-in-out infinite;
  }
  @keyframes idleBob {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-8px); }
  }
  .menu-frog .frog-body {
    position: absolute; bottom: 0; left: 50%; transform: translateX(-50%);
    width: 110px; height: 130px; background: #e8c84a;
    border-radius: 50% 50% 45% 45% / 55% 55% 45% 45%;
    border: 3px solid #b89520;
  }
  .menu-frog .frog-belly {
    position: absolute; bottom: 8px; left: 50%; transform: translateX(-50%);
    width: 72px; height: 80px; background: #f5edcf;
    border-radius: 50% 50% 45% 45% / 55% 55% 45% 45%;
  }
  .menu-frog .frog-eye {
    position: absolute; top: -18px; width: 42px; height: 42px;
    background: #fff; border-radius: 50%; border: 3px solid #b89520;
    display: flex; align-items: center; justify-content: center;
  }
  .menu-frog .frog-eye.left { left: 8px; }
  .menu-frog .frog-eye.right { right: 8px; }
  .menu-frog .frog-eye::after {
    content: ''; width: 10px; height: 10px;
    background: #111; border-radius: 50%;
  }
  .menu-frog .frog-eye::before {
    content: ''; position: absolute; inset: 6px; border-radius: 50%;
    background: radial-gradient(circle at 40% 40%, #c8e8c0, #88bb80); opacity: 0.6;
  }
  .menu-frog .frog-mouth {
    position: absolute; bottom: 35px; left: 50%; transform: translateX(-50%);
    width: 44px; height: 22px; border-bottom: 5px solid #6b5a2e;
    border-radius: 0 0 50% 50%;
  }
  .menu-frog .frog-arm {
    position: absolute; width: 18px; height: 55px;
    background: #6b5a2e; border-radius: 9px; top: 70px;
  }
  .menu-frog .frog-arm.left { left: 6px; transform: rotate(15deg); }
  .menu-frog .frog-arm.right { right: 6px; transform: rotate(-15deg); }

  .menu-buttons {
    display: flex; flex-direction: column; gap: 12px;
    margin-top: 8px;
  }
  .menu-btn {
    min-width: 260px;
    padding: 14px 40px;
    border-radius: 10px;
    border: 2px solid #444;
    background: #2a2a35;
    color: #ddd;
    font-size: 16px; font-weight: bold;
    letter-spacing: 4px;
    cursor: pointer;
    transition: all 0.15s;
    font-family: inherit;
  }
  .menu-btn:hover {
    background: #3a3a48;
    border-color: #ffd966;
    color: #ffd966;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(255,215,0,0.2);
  }
  .menu-btn.primary {
    background: #4a3a10;
    border-color: #ffd966;
    color: #ffd966;
    text-shadow: 0 0 10px rgba(255,215,0,0.5);
  }
  .menu-btn.primary:hover {
    background: #6b5220;
    box-shadow: 0 6px 24px rgba(255,215,0,0.4);
  }
  .version {
    margin-top: 30px;
    font-size: 11px; color: #555;
    letter-spacing: 2px;
  }

  /* 全屏按钮：比主按钮次一级，但仍明显可点 */
  .menu-btn.alt {
    min-width: 220px;
    padding: 11px 28px;
    font-size: 14px;
    letter-spacing: 3px;
    color: #b9c2cf;
    border-color: #3c4450;
    background: #252b34;
  }
  .menu-btn.alt:hover {
    color: #8fd0ff;
    border-color: #8fd0ff;
    background: #2b3644;
    box-shadow: 0 6px 20px rgba(120,190,255,0.18);
  }
  /* 已进入全屏时给按钮一点状态感 */
  #fullscreenBtn.is-on { color: #8fd0ff; border-color: #4a6b8a; }
  /* 属性选择器权重 (1 id + 1 属性) 高于上面的 .menu-btn.alt，可稳定隐藏。
     由 Fullscreen.js 在确认支持全屏后解除 hidden，避免 iOS 上出现死按钮,
     也避免脚本执行前的瞬间闪现。 */
  #fullscreenBtn[hidden] { display: none; }

  /* ============================================================
     移动端横屏提示覆盖层
     ------------------------------------------------------------
     只对「触屏设备 且 竖屏」生效，见下方 @media 查询。
     z-index 高于 #stage（画布）与 .modal（100），保证一定盖在最上层。
     ============================================================ */
  body.is-touch #landscapeHint[hidden]:not(.dismissed) { display: flex; }

  #landscapeHint {
    display: none;
    position: fixed; inset: 0;
    z-index: 9999;
    box-sizing: border-box;
    padding: 24px;
    background:
      radial-gradient(ellipse at 50% 40%, #2a3040 0%, #16161b 70%),
      #16161b;
    color: #e8e0d5;
    text-align: center;
    align-items: center;
    justify-content: center;
    /* 与 body 一致，确保覆盖层也用像素字体，且 emoji 有后备 */
    font-family: 'QuanPixel', "Segoe UI", "PingFang SC", "Microsoft YaHei",
                 "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji",
                 "Apple Color Emoji", sans-serif;
  }
  #landscapeHint .lh-inner {
    max-width: 340px;
    display: flex; flex-direction: column; align-items: center;
  }
  #landscapeHint .lh-icon {
    font-size: 46px; line-height: 1;
    display: inline-block;
    animation: lhTilt 2.4s ease-in-out infinite;
  }
  @keyframes lhTilt {
    0%, 45%   { transform: rotate(0deg); }
    55%, 100% { transform: rotate(-90deg); }
  }
  #landscapeHint h2 {
    margin: 0 0 10px;
    font-size: 20px; font-weight: bold;
    color: #ffd966;
    letter-spacing: 3px;
    text-shadow: 0 0 16px rgba(255,215,0,0.35);
  }
  #landscapeHint p {
    font-size: 13px; line-height: 1.8; color: #b9b2a6;
  }
  #landscapeHint .lh-tip {
    margin-top: 10px;
    font-size: 13px; color: #8fd0ff; letter-spacing: 2px;
  }
  #landscapeHint .menu-btn {
    margin-top: 22px;
    min-width: 180px;
    padding: 10px 24px;
    font-size: 13px;
    letter-spacing: 2px;
  }

  /* 横屏（或方形）时不提示；只有竖向视口才需要提醒旋转 */
  @media (orientation: landscape), (min-aspect-ratio: 1/1) {
    body.is-touch #landscapeHint[hidden]:not(.dismissed) { display: none; }
  }
  /* 视口已足够宽时（平板横屏、折叠屏展开）也无需提示 */
  @media (min-width: 900px) {
    body.is-touch #landscapeHint[hidden]:not(.dismissed) { display: none; }
  }

  /* 用户点了「仍要继续」：本次会话不再打扰。
     已并入上面的 :not(.dismissed) —— 无需依赖规则先后顺序 */

  /* ============================================================
     教学界面
     ============================================================ */
  #tutorial {
    background: #1e1e26;
  }
  .tutorial-content {
    flex: 1;
    padding: 26px 46px;
    overflow-y: auto;
    display: flex; flex-direction: column;
  }
  .tutorial-content h1 {
    font-size: 32px;
    color: #ffd966;
    text-align: center;
    margin-bottom: 4px;
    letter-spacing: 6px;
    text-shadow: 0 0 20px rgba(255,215,0,0.4);
  }
  .tutorial-content .tut-sub {
    text-align: center;
    font-size: 12px;
    color: #666;
    letter-spacing: 3px;
    margin-bottom: 22px;
  }
  .tutorial-sections {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
    flex: 1;
    overflow-y: auto;
    padding-right: 6px;
  }
  .tut-card {
    background: #26262f;
    border: 1px solid #383844;
    border-left: 3px solid #ffd966;
    border-radius: 8px;
    padding: 14px 16px;
  }
  .tut-card h2 {
    font-size: 15px;
    color: #ffd966;
    margin-bottom: 8px;
    letter-spacing: 2px;
  }
  .tut-card p, .tut-card li {
    font-size: 12.5px;
    color: #bbb;
    line-height: 1.65;
  }
  .tut-card ul { padding-left: 18px; margin-top: 4px; }
  .tut-card li { margin-bottom: 3px; }
  .tut-card b { color: #ffcc66; }
  .tut-card .hl { color: #88ccff; }
  .tut-card .dgr { color: #ff8888; }
  .tut-card.boss-card {
    grid-column: 1 / -1;
    border-left-color: #ff6644;
    background: #2a2028;
  }
  .tut-card.boss-card h2 { color: #ff8866; }
  .tut-footer {
    display: flex; justify-content: center;
    margin-top: 16px; padding-top: 14px;
    border-top: 1px solid #333;
  }

  /* ============================================================
     游戏界面
     ============================================================ */
  #game {
    display: flex; flex-direction: column;
  }

  /* ----- 顶部状态栏 ----- */
  #topBar {
    display: flex; justify-content: space-between; align-items: center;
    padding: 8px 16px; background: #16161c;
    border-bottom: 2px solid #333340; flex-shrink: 0; height: 52px;
  }
  #topBar .left, #topBar .right { display: flex; align-items: center; gap: 10px; font-size: 13px; }
  #topBar .label { color: #888; }
  #topBar .val { font-weight: bold; color: #ffd966; }
  .clickable { cursor: pointer; padding: 2px 6px; border-radius: 4px; transition: background 0.15s; }
  .clickable:hover { background: #333; color: #fff; }
  .divider { width: 1px; height: 20px; background: #333; margin: 0 4px; }

  .lp-orb {
    display: inline-flex; align-items: center; justify-content: center;
    width: 26px; height: 26px; border-radius: 50%;
    background: radial-gradient(circle at 35% 35%, #ffe066, #cc9900);
    color: #1a1a1f; font-weight: 900; font-size: 12px;
    box-shadow: 0 0 10px rgba(255, 215, 0, 0.4);
    transition: transform 0.2s;
  }
  .lp-orb.spent { background: radial-gradient(circle at 35% 35%, #444, #222); color: #666; box-shadow: none; }

  #laughMeterWrap { display: flex; align-items: center; gap: 8px; }
  #laughMeterBar {
    width: 160px; height: 14px; background: #111;
    border-radius: 7px; overflow: hidden; border: 1px solid #444;
  }
  #laughMeterFill {
    height: 100%; width: 0%;
    background: linear-gradient(90deg, #66cc66, #ffcc00);
    border-radius: 7px; transition: width 0.3s, background 0.3s;
  }
  #laughMeterText { font-size: 11px; color: #aaa; min-width: 50px; }

  /* ----- 战斗区 ----- */
  #battlefield {
    flex: 1; display: flex; position: relative;
    background: radial-gradient(ellipse at 50% 30%, #2a2a35, #1a1a1f);
    min-height: 0;
  }
  #battlefield.boss-bg {
    background: radial-gradient(ellipse at 50% 30%, #3a2030, #1a0f14);
  }
  #playerArea {
    width: 280px; display: flex; flex-direction: column;
    align-items: center; justify-content: center;
    padding: 10px; border-right: 1px solid #2a2a35; position: relative;
  }
  #playerSprite {
    width: 140px; height: 160px; position: relative;
    cursor: pointer; transition: transform 0.15s;
  }
  #playerSprite:hover { transform: scale(1.05); }
  #playerSprite.laughing { animation: laughShake 0.3s infinite; }
  @keyframes laughShake {
    0%,100% { transform: translateX(0) rotate(0deg); }
    25% { transform: translateX(-4px) rotate(-3deg); }
    75% { transform: translateX(4px) rotate(3deg); }
  }
  .frog-body {
    position: absolute; bottom: 0; left: 50%; transform: translateX(-50%);
    width: 110px; height: 130px; background: #e8c84a;
    border-radius: 50% 50% 45% 45% / 55% 55% 45% 45%;
    border: 3px solid #b89520;
  }
  .frog-belly {
    position: absolute; bottom: 8px; left: 50%; transform: translateX(-50%);
    width: 72px; height: 80px; background: #f5edcf;
    border-radius: 50% 50% 45% 45% / 55% 55% 45% 45%;
  }
  .frog-eye {
    position: absolute; top: -18px; width: 42px; height: 42px;
    background: #fff; border-radius: 50%; border: 3px solid #b89520;
    display: flex; align-items: center; justify-content: center;
  }
  .frog-eye.left { left: 8px; }
  .frog-eye.right { right: 8px; }
  .frog-eye::after {
    content: ''; width: 10px; height: 10px;
    background: #111; border-radius: 50%;
  }
  .frog-eye::before {
    content: ''; position: absolute; inset: 6px; border-radius: 50%;
    background: radial-gradient(circle at 40% 40%, #c8e8c0, #88bb80); opacity: 0.6;
  }
  .frog-arm {
    position: absolute; width: 18px; height: 55px;
    background: #6b5a2e; border-radius: 9px; top: 70px;
  }
  .frog-arm.left { left: 6px; transform: rotate(15deg); }
  .frog-arm.right { right: 6px; transform: rotate(-15deg); }
  .frog-mouth {
    position: absolute; bottom: 35px; left: 50%; transform: translateX(-50%);
    width: 40px; height: 18px; border-bottom: 4px solid #6b5a2e;
    border-radius: 0 0 50% 50%; transition: all 0.2s;
  }
  .frog-mouth.laughing {
    height: 28px; border-bottom-width: 6px;
    background: #cc6666; border-color: #8b3333;
  }
  #playerHpBar {
    width: 120px; height: 16px; background: #111;
    border-radius: 8px; margin-top: 8px; overflow: hidden; border: 1px solid #555;
  }
  #playerHpFill {
    height: 100%; width: 100%;
    background: linear-gradient(90deg, #cc3333, #ff6666); transition: width 0.3s;
  }
  #playerHpText { font-size: 13px; margin-top: 3px; color: #ff8888; font-weight: bold; }

  #enemyArea {
    flex: 1; display: flex; flex-direction: column;
    align-items: center; justify-content: center;
    position: relative; padding: 10px;
  }
  #enemySpriteWrap { display: flex; flex-direction: column; align-items: center; }
  #enemyIntent {
    display: flex; align-items: center; gap: 6px;
    padding: 6px 14px; background: #2a1a1a;
    border: 1px solid #662222; border-radius: 20px;
    margin-bottom: 12px; font-size: 14px; min-height: 36px;
    transition: all 0.3s;
  }
  #enemyIntent.blurred { filter: blur(3px); opacity: 0.7; }
  #enemyIntent.boss-intent { background: #2a1515; border-color: #aa4433; }
  #enemyIntent .intent-icon { font-size: 20px; }
  #enemyIntent .intent-desc { color: #ff9999; }

  #enemySprite { width: 120px; height: 140px; position: relative; transition: transform 0.15s; }
  #enemySprite.hit { animation: hitFlash 0.25s; }
  @keyframes hitFlash {
    0% { transform: translateX(0); filter: brightness(1); }
    30% { transform: translateX(-8px); filter: brightness(3); }
    100% { transform: translateX(0); filter: brightness(1); }
  }
  .enemy-body {
    position: absolute; bottom: 0; left: 50%; transform: translateX(-50%);
    width: 90px; height: 110px; background: #4a4a5a;
    border-radius: 40% 40% 30% 30%; border: 3px solid #2a2a3a;
  }
  .enemy-eye {
    position: absolute; top: 15px; width: 24px; height: 24px;
    background: #ff3333; border-radius: 50%; border: 2px solid #660000;
  }
  .enemy-eye.left { left: 18px; }
  .enemy-eye.right { right: 18px; }

  /* 盛碗奶蛙（BOSS）外观 */
  #enemySprite.boss { width: 160px; height: 180px; }
  #enemySprite.boss .enemy-body {
    width: 130px; height: 140px;
    background: #d8b84a;
    border-color: #8b6a20;
    border-radius: 50% 50% 45% 45% / 55% 55% 45% 45%;
  }
  #enemySprite.boss .enemy-belly {
    position: absolute; bottom: 8px; left: 50%; transform: translateX(-50%);
    width: 86px; height: 90px; background: #f5edcf;
    border-radius: 50% 50% 45% 45% / 55% 55% 45% 45%;
  }
  #enemySprite.boss .enemy-eye {
    top: -20px;
    width: 46px; height: 46px;
    background: #fff; border-color: #8b6a20;
    display: flex; align-items: center; justify-content: center;
  }
  #enemySprite.boss .enemy-eye.left { left: 6px; }
  #enemySprite.boss .enemy-eye.right { right: 6px; }
  #enemySprite.boss .enemy-eye::after {
    content: ''; width: 11px; height: 11px;
    background: #111; border-radius: 50%;
  }
  #enemySprite.boss .enemy-eye::before {
    content: ''; position: absolute; inset: 7px; border-radius: 50%;
    background: radial-gradient(circle at 40% 40%, #ffcccc, #cc6666); opacity: 0.7;
  }
  #enemySprite.boss .enemy-mouth {
    position: absolute; bottom: 32px; left: 50%; transform: translateX(-50%);
    width: 46px; height: 26px;
    border-bottom: 5px solid #6b4a1e;
    border-radius: 0 0 50% 50%;
    background: #b8333a;
    border-color: #6b1a20;
  }
  /* 碗头盔 */
  #enemySprite.boss .enemy-helmet {
    position: absolute; top: -46px; left: 50%; transform: translateX(-50%);
    width: 118px; height: 56px;
    background: radial-gradient(ellipse at 50% 100%, #f0f0f0, #909090);
    border-radius: 50% 50% 8% 8% / 100% 100% 8% 8%;
    border: 3px solid #555;
    box-shadow: inset 0 -6px 12px rgba(0,0,0,0.3);
  }
  #enemySprite.boss .enemy-helmet::after {
    content: '';
    position: absolute; bottom: -6px; left: -8px; right: -8px;
    height: 12px;
    background: #707070;
    border: 3px solid #555;
    border-top: none;
    border-radius: 0 0 50% 50% / 0 0 100% 100%;
  }
  /* BOSS 皇冠标志 */
  #enemySprite.boss .crown-mark {
    position: absolute;
    top: -68px; left: 50%;
    transform: translateX(-50%);
    font-size: 22px;
    filter: drop-shadow(0 0 6px #ffd966);
  }
  #enemySprite.boss.stunned { animation: stunSpin 1.5s linear infinite; }
  @keyframes stunSpin {
    0% { transform: rotate(-6deg); filter: brightness(1.2) hue-rotate(20deg); }
    50% { transform: rotate(6deg); filter: brightness(1.2) hue-rotate(20deg); }
    100% { transform: rotate(-6deg); filter: brightness(1.2) hue-rotate(20deg); }
  }
  .stun-icon {
    position: absolute;
    top: -70px; left: 50%; transform: translateX(-50%);
    font-size: 24px;
    animation: spin 1.2s linear infinite;
    filter: drop-shadow(0 0 6px #ffee88);
  }
  @keyframes spin { from { transform: translateX(-50%) rotate(0); } to { transform: translateX(-50%) rotate(360deg); } }

  #enemyHpBar {
    width: 110px; height: 16px; background: #111;
    border-radius: 8px; margin-top: 8px; overflow: hidden; border: 1px solid #555;
  }
  #enemyHpBar.boss { width: 160px; height: 20px; border-color: #aa7733; }
  #enemyHpFill {
    height: 100%; width: 100%;
    background: linear-gradient(90deg, #aa2222, #ee4444); transition: width 0.3s;
  }
  #enemyHpFill.boss { background: linear-gradient(90deg, #cc6622, #ffaa33); }
  #enemyHpText { font-size: 13px; margin-top: 3px; color: #ff8888; font-weight: bold; }
  #enemyStatus { margin-top: 6px; display: flex; gap: 8px; font-size: 11px; flex-wrap: wrap; justify-content: center; }
  /* 玩家状态栏：与敌人状态同款式，位于血条下方 */
  #playerStatus { margin-top: 6px; display: flex; gap: 8px; font-size: 11px; flex-wrap: wrap; justify-content: center; }
  .status-badge {
    padding: 2px 8px; border-radius: 10px;
    background: #333; border: 1px solid #555; color: #aaa;
    cursor: pointer; user-select: none;
    transition: filter 0.12s, transform 0.12s;
  }
  .status-badge:hover { filter: brightness(1.35); transform: translateY(-1px); }
  /* 正面效果 / 负面效果用颜色区分 */
  .status-badge.good { border-color: #3f8a6a; color: #7fe0a8; background: #1e2e26; }
  .status-badge.bad  { border-color: #8a3f3f; color: #ff9a8a; background: #2e1e1e; }
  .status-badge.stun { border-color: #ffee44; color: #ffee66; }

  /* ----- 状态悬浮说明 -----
     鼠标停留在状态徽章上时出现，移出即消失（逻辑见 makeStatusBadge）。
     位置由 JS 计算后写入 inline 的 left/top，这里只负责外观。 */
  #statusTip {
    display: none;
    position: fixed;
    z-index: 400;
    max-width: 260px;
    padding: 10px 12px;
    background: #1c1c24;
    border: 1px solid #5a5a6a;
    border-radius: 8px;
    box-shadow: 0 6px 22px rgba(0,0,0,0.75);
    font-size: 12px; line-height: 1.7; color: #cfc8bd;
    pointer-events: none;      /* 不挡鼠标，避免与 mouseleave 互相抖动 */
  }
  #statusTip.show { display: block; }
  #statusTip .st-head {
    font-size: 13px; font-weight: bold; color: #ffd966;
    margin-bottom: 6px; white-space: nowrap;
  }
  #statusTip .st-side { font-size: 10px; padding: 1px 6px; border-radius: 7px; margin-left: 6px; font-weight: normal; }
  #statusTip .st-side.good { color: #7fe0a8; border: 1px solid #3f8a6a; }
  #statusTip .st-side.bad  { color: #ff9a8a; border: 1px solid #8a3f3f; }
  #statusTip .st-value { margin-bottom: 4px; color: #e8e0d5; }
  #statusTip .st-value b { color: #ffd966; font-size: 14px; }
  #statusTip .st-text { color: #b0a99e; }

  #playerBlock {
    position: absolute; top: 10px; right: 10px;
    display: flex; align-items: center; gap: 4px;
    background: #1a2a3a; border: 1px solid #3366aa;
    border-radius: 16px; padding: 4px 10px; font-size: 13px;
    color: #88bbff; opacity: 0; transition: opacity 0.3s;
  }
  #playerBlock.active { opacity: 1; }

  /* ----- 手牌 ----- */
  #handArea {
    height: 210px; background: #1e1e26;
    border-top: 2px solid #333340;
    display: flex; align-items: flex-end; justify-content: center;
    gap: 8px; padding: 12px 20px 16px;
    flex-shrink: 0; overflow-x: auto; overflow-y: visible;
  }
  .card {
    width: 130px; height: 170px; border-radius: 10px;
    background: #2a2a35; border: 2px solid #555;
    display: flex; flex-direction: column; align-items: center;
    padding: 8px; cursor: pointer;
    transition: transform 0.15s, box-shadow 0.15s, border-color 0.15s;
    position: relative; flex-shrink: 0;
  }
  .card:hover { transform: translateY(-14px); box-shadow: 0 8px 20px rgba(0,0,0,0.6); }
  .card.unplayable { opacity: 0.45; cursor: not-allowed; filter: grayscale(0.6); }
  .card.unplayable:hover { transform: none; box-shadow: none; }
  .card-cost {
    position: absolute; top: -8px; left: -8px;
    width: 28px; height: 28px; border-radius: 50%;
    background: radial-gradient(circle at 35% 35%, #ffe066, #cc9900);
    color: #1a1a1f; font-weight: 900; font-size: 14px;
    display: flex; align-items: center; justify-content: center;
    border: 2px solid #ffd966; box-shadow: 0 0 8px rgba(255,215,0,0.4);
  }
  /* 卡名与类型：都以卡牌宽度为基准居中，类型固定在卡名正下方 */
  .card-name {
    font-size: 13px; font-weight: bold; margin-top: 10px;
    width: 100%; text-align: center; line-height: 1.2;
  }
  .card-type {
    width: 100%; text-align: center;
    font-size: 10px; color: #888; margin-top: 3px;
    letter-spacing: 1px;
  }
  .card-desc {
    font-size: 11px; color: #bbb; text-align: center;
    margin-top: 8px; line-height: 1.4; flex: 1;
    display: flex; align-items: center; justify-content: center;
  }
  .card-tag {
    position: absolute; bottom: 6px; font-size: 9px;
    padding: 1px 8px; border-radius: 8px;
    background: #553300; color: #ffcc66; border: 1px solid #886600;
  }
  /* 稀有度标识：贴在卡牌左下角，与上方「狂笑 / 消耗」标签同处底部，
     用不同颜色区分普通 / 罕见 / 稀有 */
  .card-rarity {
    position: absolute; bottom: 6px; left: 8px;
    font-size: 9px; line-height: 1;
    padding: 2px 6px; border-radius: 7px;
    letter-spacing: 1px;
    background: rgba(0,0,0,0.45);
    border: 1px solid #6a7480; color: #9aa4b0;
  }
  .card.rarity-uncommon .card-rarity { border-color: #3f8a82; color: #6fd3c7; }
  .card.rarity-rare .card-rarity {
    border-color: #b99a2e; color: #ffd966;
    background: rgba(90,70,0,0.5);
    box-shadow: 0 0 8px rgba(255,215,0,0.35);
  }
  /* ----- 卡牌配色以后由「稀有度」决定（见下方 .card.rarity-*） -----
     这里保留卡名基础色，具体颜色由稀有度规则覆盖。 */
  .card.laugh-card { border-color: #cc8844; }
  .card.laugh-card .card-name { color: #ffcc66; }
  .card.attack-card { border-color: #aa4444; }
  .card.attack-card .card-name { color: #ff8888; }
  .card.skill-card { border-color: #4488aa; }
  .card.skill-card .card-name { color: #88ccff; }
  .card.power-card { border-color: #aa88dd; }
  .card.power-card .card-name { color: #cc99ff; }

  /* ============================================================
     卡牌配色 = 稀有度
     ------------------------------------------------------------
     稀有度是卡牌最主要的视觉信息，因此边框、卡名与类型文字都由稀有度
     统一决定。这三条规则写在上面「按类型着色」之后，权重相同（0,2,0）
     故后者生效，从而覆盖掉按类型分配的颜色。

     卡牌底色刻意保持中性（沿用 .card 的 #2a2a35），只有稀有卡额外加一层
     内发光 —— 若给每个稀有度都换底色，描述文字的可读性会被拖低。

     若想改某个稀有度的观感，只需改这里的 border-color / card-name
     / card-type 三个值即可。
     ============================================================ */
  .card.rarity-common { border-color: #7d8794; }
  .card.rarity-common .card-name { color: #b8c2cf; }
  .card.rarity-common .card-type { color: #7d8794; }

  .card.rarity-uncommon { border-color: #3fa89a; }
  .card.rarity-uncommon .card-name { color: #6fd3c7; }
  .card.rarity-uncommon .card-type { color: #4f9d94; }

  .card.rarity-rare { border-color: #d4af37; }
  .card.rarity-rare .card-name { color: #ffd966; }
  .card.rarity-rare .card-type { color: #c9a63c; }
  .card.rarity-rare { box-shadow: inset 0 0 18px rgba(255,215,0,0.12); }

  .card.rarity-epic { border-color: #a259e6; }
  .card.rarity-epic .card-name { color: #c07bff; }
  .card.rarity-epic .card-type { color: #9a6ac4; }
  .card.rarity-epic { box-shadow: inset 0 0 20px rgba(170,90,240,0.16); }
  .card.rarity-epic .card-rarity {
    border-color: #7d3fb8; color: #c07bff;
    background: rgba(60,20,90,0.5);
    box-shadow: 0 0 8px rgba(170,90,240,0.35);
  }

  /* ----- 已升级的卡牌：卡名变绿，并在名字后带「 +」 -----
     名字里的加号由 JS 生成（CardDisplayName），这里只负责配色。
     说明：稀有度规则 .card.rarity-* .card-name 权重为 (0,3,0)，
     升级规则 .card.upgraded .card-name 同为 (0,3,0) 且写在后面 ——
     本可以用「后者生效」来覆盖，但为了让「升级必然变绿」这条视觉
     约定不被将来新增的稀有度规则破坏，这里显式使用 !important。 */
  .card.upgraded .card-name { color: #6ef07a !important; }
  .card.upgraded { border-color: #4fbf58 !important; }
  /* 不可打出的诅咒牌 */
  .card.unplayable-card { opacity: 0.75; filter: saturate(0.5); }
  .card.unplayable-card .card-name { color: #b06a6a !important; }

  /* ----- 底部栏 ----- */
  #bottomBar {
    height: 56px; background: #16161c;
    border-top: 1px solid #333;
    display: flex; align-items: center; justify-content: space-between;
    padding: 0 20px; flex-shrink: 0;
  }
  #bottomBar .info { font-size: 12px; color: #888; }
  #bottomBar .info b { color: #ffd966; }
  .btn {
    padding: 10px 28px; border-radius: 8px;
    border: 1px solid #555; background: #2a2a35;
    color: #ddd; font-size: 14px; font-weight: bold;
    cursor: pointer; transition: all 0.15s;
    font-family: inherit;
  }
  .btn:hover { background: #3a3a48; border-color: #888; }
  .btn:disabled { opacity: 0.4; cursor: not-allowed; }
  .btn.end-turn { background: #663333; border-color: #aa4444; color: #ffcccc; }
  .btn.end-turn:hover { background: #884444; }
  .btn.primary { background: #335533; border-color: #44aa44; color: #ccffcc; }
  .btn.primary:hover { background: #447744; }
  .btn.ghost { background: #222; border-color: #444; color: #aaa; }
  .btn.ghost:hover { background: #333; color: #ddd; }
  /* 升级入口按钮：绿色系，与「升级后卡名变绿」呼应 */
  .btn.upgrade { background: #1f3a24; border-color: #4fbf58; color: #9df0a4; }
  .btn.upgrade:hover { background: #2b5233; color: #c8ffcf; }
  .btn.small { padding: 7px 16px; font-size: 12px; }

  /* ----- 日志 ----- */
  #log {
    position: absolute; bottom: 10px; right: 10px;
    width: 220px; max-height: 160px; overflow-y: auto;
    font-size: 11px; color: #777; line-height: 1.6;
    pointer-events: none; text-align: right; opacity: 0.85;
  }
  #log div { margin-bottom: 2px; }
  #log .dmg { color: #ff6666; }
  #log .heal { color: #66ff88; }
  #log .laugh { color: #ffcc66; }
  #log .block { color: #88bbff; }
  #log .boss { color: #ff8866; font-weight: bold; }

  /* ----- 模态框 ----- */
  .modal {
    position: absolute; inset: 0;
    background: rgba(0,0,0,0.85);
    display: none; flex-direction: column;
    align-items: center; justify-content: center;
    z-index: 100;
  }
  .modal.show { display: flex; }
  .modal-content {
    background: #22222a;
    border: 2px solid #444; border-radius: 12px;
    padding: 22px 26px;
    max-width: 88%; max-height: 86%;
    display: flex; flex-direction: column;
    align-items: center; gap: 16px;
    box-shadow: 0 0 50px rgba(0,0,0,0.9);
  }
  .modal-title {
    font-size: 20px; color: #ffd966; font-weight: bold;
    text-shadow: 0 0 12px rgba(255,215,0,0.4);
  }
  .modal-sub { font-size: 12px; color: #888; }
  .modal-cards {
    display: flex; flex-wrap: wrap; gap: 10px;
    justify-content: center; overflow-y: auto;
    max-height: 460px; padding: 10px;
  }
  .modal-cards .card {
    cursor: pointer;
    width: 120px; height: 160px;
  }
  .modal-cards .card:hover { transform: translateY(-8px); }
  .modal-actions { display: flex; gap: 12px; flex-wrap: wrap; justify-content: center; }

  .reward-intro { font-size: 13px; color: #ccc; text-align: center; max-width: 520px; line-height: 1.6; }
  .reward-intro .hint { color: #ffd966; }
  .reward-intro .ghost-txt { color: #888; font-size: 11.5px; }
  .boss-reward-banner {
    background: linear-gradient(90deg, #552222, #883333, #552222);
    border: 1px solid #ff6644; border-radius: 20px;
    padding: 6px 22px; font-size: 13px; color: #ffbb99;
    letter-spacing: 3px;
    box-shadow: 0 0 20px rgba(255,100,60,0.4);
  }

  /* 结束覆盖层 */
  #overlay h1 { font-size: 48px; margin-bottom: 16px; letter-spacing: 6px; }
  #overlay h1.win { color: #66ff88; text-shadow: 0 0 30px rgba(100,255,100,0.5); }
  #overlay h1.lose { color: #ff4444; text-shadow: 0 0 30px rgba(255,0,0,0.5); }
  #overlay p { font-size: 15px; color: #aaa; margin-bottom: 26px; text-align: center; line-height: 1.7; }
  #overlay .btn { padding: 14px 40px; font-size: 16px; }

  /* 阈值特效 */
  #thresholdFx {
    position: absolute; top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    font-size: 40px; font-weight: 900;
    color: #ffcc00; text-shadow: 0 0 30px rgba(255,200,0,0.8);
    pointer-events: none; opacity: 0; z-index: 50;
  }
  #thresholdFx.show { animation: thresholdPop 1s ease-out forwards; }
  @keyframes thresholdPop {
    0% { opacity: 0; transform: translate(-50%,-50%) scale(0.5); }
    30% { opacity: 1; transform: translate(-50%,-50%) scale(1.2); }
    100% { opacity: 0; transform: translate(-50%,-50%) scale(1.5); }
  }

  #battleNum.flash { animation: battleFlash 0.8s; }
  @keyframes battleFlash {
    0% { color: #fff; text-shadow: 0 0 20px #ffd966; }
    100% { color: #ffd966; text-shadow: none; }
  }
  #battleNum.boss-num { color: #ff6644; text-shadow: 0 0 12px rgba(255,100,60,0.6); }

  /* ============================================================
     分辨率自适应 —— 整幅画布等比缩放并严格居中
     ------------------------------------------------------------
     设计尺寸固定为 1100 x 720。这里把整幅画面当作一张"画布"整体
     transform 缩放，因此前面 300 多处设计像素值全部保持原样不动，
     排版比例与手感与原版完全一致。

     留白：--game-margin 是画面四周与浏览器窗口之间的空隙，四边等值。
       这个值只需改这一处 —— Responsive.js 会在运行时读取它，从窗口
       尺寸里扣掉后再算缩放系数（读不到时用内置兜底值 32px）。
       这样不会出现 CSS 与 JS 各写一份常量、数值对不上的问题。

     缩放后的实际占用尺寸（由 Responsive.js 计算得出）：
       · 宽度 = 1100 * s
       · 高度 =  720 * s
       其中 s = min((窗口宽 - 2*边距) / 1100, (窗口高 - 2*边距) / 720, 1.75)。
       宽高比恒为 1100:720，画面不会被拉伸或裁切。

       上限 1.75：窗口够大就按 175% 显示（高分屏上画面明显更大），
       窗口装不下则取窗口允许的最大值 —— 因此画布始终完整可见，
       放大后也不会溢出被裁掉。

       窄窗口下宽度贴边、上下留白；宽窗口下高度贴边、左右留白。两种情况
       都在某个方向"尽可能贴近窗口"，同时始终保留 --game-margin 的空隙。
       固定宽高比的画面无法在宽、高两个方向同时贴边，这是几何限制。

     居中方式（重要）：
       #stage 保持设计尺寸 1100x720 不变，用
           left:50%; top:50%; transform: translate(-50%,-50%) scale(s)
       把它钉在视口正中心。

       为什么不靠 body 的 flex 居中：
       flex 居中的准确性取决于"元素的布局尺寸恰好等于它的视觉尺寸"。
       一旦两者不一致（例如舞台写成定值、或 body 带 padding），
       元素就会同时向左/向上溢出并被 overflow 裁掉，视觉中心随之偏移。
       这里改用 fixed 定位 + translate(-50%,-50%)：百分比位移按元素自身
       尺寸计算，与布局流程、父容器 padding、内容宽度全部无关，
       因此在任意分辨率下都严格居中。

       注意 transform 顺序必须是 translate 在前、scale 在后：
       这样先按"未缩放的 1100x720"位移到中心，再就地等比缩放，
       因为缩放原点默认是元素中心，中心点不会移动。

     说明：.screen 是画布的"设计基准"，宽高保持 1100x720 不动，真正的
     自适应由 #stage 的整体缩放完成 —— 这样 .screen 内部那 300 多处
     百分比（如 max-width:88%）才会继续以设计尺寸为基准，比例不走样。

     注意：这里刻意复用 .screen / #mainMenu / #tutorial / #game 这些
     原有选择器，不新增 #stage > * 之类更长权重，以免波及
     .hidden { display:none !important } 的隐藏逻辑。
     ============================================================ */
  :root {
    --game-scale: 1;      /* 缩放系数，由 Responsive.js 写入 */
    --game-margin: 16px;  /* 画面四周留白：改这一处即可 */
    --design-w: 1100px;   /* 设计基准宽，需与 .screen 一致 */
    --design-h: 720px;    /* 设计基准高，需与 .screen 一致 */
  }

  #stage {
    position: fixed;
    left: 50%;
    top: 50%;
    width:  var(--design-w);
    height: var(--design-h);
    transform: translate(-50%, -50%) scale(var(--game-scale, 1));
    transform-origin: center center;
  }

  /* 三个界面铺满舞台，各自保持原有层叠与绝对定位基准 */
  #mainMenu, #tutorial, #game { position: absolute; top: 0; left: 0; }

  /* 不再改动 body：原本的 flex 居中与无内边距状态保持原样，
     居中改由上面 #stage 的 fixed + translate 保证。 */
