/* 拼音塔防样式（由 index.html 拆出） */
    * {
      box-sizing: border-box;
      user-select: none;
    }
    html {
      height: 100%;
    }
    body {
      background: #1e2b1c;
      display: flex;
      min-height: 100vh;
      margin: 0;
      padding: 8px;
      padding-top: max(8px, env(safe-area-inset-top));
      padding-right: max(8px, env(safe-area-inset-right));
      padding-bottom: max(8px, env(safe-area-inset-bottom));
      padding-left: max(8px, env(safe-area-inset-left));
      overflow: auto;
      font-family: system-ui, 'Segoe UI', Roboto, 'Helvetica Neue', sans-serif;
    }
    .game-wrapper {
      /* 固定宽度 = 画布 900px + 左右内边距 40px，内容再长也不会撑开外框 */
      width: 940px;
      flex: none;
      margin: auto;
      background: #3a2e1e;
      padding: 20px 20px 20px;
      border-radius: 40px 40px 30px 30px;
      box-shadow: 0 20px 30px rgba(0, 0, 0, 0.6), inset 0 0 0 4px #6b5a3e;
      border-bottom: 8px solid #1f160c;
      display: flex;
      flex-direction: column;
      gap: 12px;
    }
    canvas {
      display: block;
      width: 900px;
      height: 500px;
      border-radius: 24px;
      box-shadow: inset 0 0 0 4px #5d4d32, 0 10px 15px rgba(0, 0, 0, 0.5);
      background: #8cb87a;
      cursor: default;
    }
    .canvas-wrap {
      position: relative;
      width: 900px;
      height: 500px;
      flex: none;
    }
    .account-chip {
      position: absolute;
      top: 10px;
      right: 10px;
      z-index: 60;
      max-width: 170px;
      overflow: hidden;
      text-overflow: ellipsis;
      white-space: nowrap;
      padding: 7px 13px;
      border-radius: 999px;
      border: 2px solid #fff3d1;
      background: rgba(31, 58, 75, 0.9);
      color: #fff;
      font-weight: bold;
      font-size: 13px;
      font-family: inherit;
      cursor: pointer;
      box-shadow: 0 4px 10px rgba(0, 0, 0, 0.25);
    }
    .account-chip:disabled {
      opacity: 0.6;
      cursor: not-allowed;
    }
    /* 开局前选择课本册别 */
    .grade-picker {
      position: absolute;
      inset: 0;
      z-index: 5;
      display: flex;
      flex-direction: column;
      align-items: center;
      justify-content: center;
      gap: 12px;
      padding: 20px;
      border-radius: 24px;
      background: rgba(18, 28, 12, 0.9);
      color: #f0e8d0;
      text-align: center;
    }
    .grade-picker[hidden] {
      display: none;
    }
    .grade-picker .gp-title {
      font-size: 36px;
      font-weight: 900;
      color: #f7e05e;
      letter-spacing: 3px;
      text-shadow: 3px 3px 0 #1f2a0e;
    }
    .grade-picker .gp-sub {
      font-size: 18px;
      color: #b4d68a;
    }
    .grade-picker .gp-difficulty {
      display: flex;
      flex-wrap: wrap;
      justify-content: center;
      gap: 10px;
      margin-top: -2px;
    }
    .grade-picker .gp-difficulty button {
      font-size: 16px;
      padding: 6px 16px;
      border-radius: 20px;
      opacity: 0.5;
      transition: opacity 0.15s, background 0.15s;
    }
    .grade-picker .gp-difficulty button.active {
      opacity: 1;
      background: #f7e05e;
      color: #3a2a0a;
    }
    .grade-picker .gp-grid {
      display: grid;
      grid-template-columns: repeat(2, 1fr);
      gap: 10px;
      margin-top: 4px;
      width: min(440px, 100%);
    }
    .grade-picker .gp-grid button {
      font-size: 19px;
      padding: 8px 16px;
      border-radius: 22px;
    }
    .grade-picker .gp-grid button.locked {
      opacity: 0.45;
      filter: grayscale(1);
      cursor: not-allowed;
    }
    .grade-picker .gp-grid button.shake {
      animation: gpShake 0.35s ease;
    }
    @keyframes gpShake {
      0%, 100% { transform: translateX(0); }
      25% { transform: translateX(-4px); }
      75% { transform: translateX(4px); }
    }
    .toast {
      position: fixed;
      top: 24px;
      left: 50%;
      transform: translateX(-50%) translateY(-20px);
      background: #1f3a4b;
      color: #fff;
      padding: 10px 24px;
      border-radius: 40px;
      font-weight: bold;
      font-size: 1.1rem;
      box-shadow: 0 10px 20px rgba(0, 0, 0, 0.35);
      opacity: 0;
      transition: opacity 0.25s, transform 0.25s;
      pointer-events: none;
      z-index: 9999;
      white-space: nowrap;
      max-width: 90vw;
    }
    .toast.show {
      opacity: 1;
      transform: translateX(-50%) translateY(0);
    }
    .grade-picker .gp-actions {
      display: flex;
      flex-wrap: wrap;
      justify-content: center;
      gap: 14px;
      margin-top: 8px;
    }
    .grade-picker .gp-actions button {
      font-size: 20px;
      padding: 10px 20px;
      border-radius: 24px;
    }
    .skill-picker .skill-grid {
      display: grid;
      grid-template-columns: repeat(2, minmax(0, 1fr));
      gap: 12px;
      width: min(560px, 100%);
    }
    .skill-picker .skill-grid button {
      font-size: 18px;
      padding: 9px 12px;
      border-radius: 22px;
    }
    .skill-picker .skill-grid button:disabled {
      opacity: 0.35;
    }
    .skill-picker .skill-close {
      font-size: 24px;
      padding: 14px 52px;
      border-radius: 30px;
      opacity: 0.95;
    }
    /* 帮助说明 */
    .help-picker {
      background: rgba(18, 28, 12, 0.95);
      gap: 8px;
    }
    .help-picker .gp-title {
      font-size: 26px;
    }
    .help-list {
      display: flex;
      flex-direction: column;
      gap: 6px;
      width: min(780px, 100%);
      min-height: 0;
      overflow-y: auto;
      text-align: left;
      font-size: 15px;
      line-height: 1.35;
      color: #e6ddc2;
    }
    .help-row {
      display: flex;
      align-items: flex-start;
      gap: 12px;
      padding: 6px 14px;
      border-radius: 14px;
      background: rgba(255, 255, 255, 0.06);
    }
    .help-row > b {
      flex: none;
      width: 68px;
      color: #f7e05e;
      font-size: 15px;
    }
    .help-row > span {
      flex: 1;
    }
    .help-row-skills {
      flex-direction: column;
      gap: 4px;
    }
    .help-row-skills > b {
      width: auto;
    }
    .help-skills {
      display: grid;
      grid-template-columns: repeat(2, minmax(0, 1fr));
      gap: 4px 18px;
      width: 100%;
    }
    .help-skills span:first-child {
      grid-column: 1 / -1;
      color: #b4d68a;
    }
    .help-btn {
      font-size: 18px;
      padding: 8px 12px;
      background: #9bb06e;
    }
    .stat-bump {
      animation: statBump 0.32s ease-out;
    }
    @keyframes statBump {
      0% { transform: scale(1); }
      40% { transform: scale(1.18); }
      100% { transform: scale(1); }
    }
    .reward-bullet {
      position: fixed;
      left: 0;
      top: 0;
      width: 7px;
      height: 16px;
      border-radius: 4px;
      background: linear-gradient(#fff2a8, #e0a52a);
      box-shadow: 0 0 10px rgba(255, 215, 80, 0.9);
      pointer-events: none;
      z-index: 9999;
    }
    .reward-skill {
      position: fixed;
      left: 0;
      top: 0;
      font-size: 32px;
      line-height: 1;
      pointer-events: none;
      z-index: 9999;
      filter: drop-shadow(0 0 10px rgba(255, 230, 120, 0.85));
    }
    .win-picker {
      background: rgba(30, 46, 16, 0.92);
    }
    .gameover-picker {
      background: rgba(44, 18, 16, 0.92);
    }
    .reset-picker {
      background: rgba(38, 32, 14, 0.92);
    }
    .info-panel {
      display: flex;
      align-items: center;
      padding: 0 8px;
      color: #f0e8d0;
      text-shadow: 2px 2px 0 #1f2a0e;
      font-weight: bold;
      font-size: 20px;
      gap: 10px;
      flex-wrap: wrap;
    }
    .stat-badge {
      background: #2f4b2c;
      padding: 8px 22px;
      border-radius: 40px;
      box-shadow: inset 0 -4px 0 #0f1a0c, 0 5px 0 #101b0a;
      display: flex;
      align-items: center;
      gap: 8px;
      white-space: nowrap;
    }
    .stat-badge span {
      font-size: 28px;
      color: #f7e05e;
      margin-left: 6px;
    }
    .status {
      background: #262b1c;
      padding: 6px 22px;
      border-radius: 30px;
      font-size: 20px;
      color: #ffd78c;
      box-shadow: inset 0 -3px 0 #0e1209;
      /* 宽度只由布局分配，文本再长也不参与撑宽 */
      flex: 1 1 0;
      width: 0;
      min-width: 0;
      text-align: center;
      white-space: nowrap;
      overflow: hidden;
      text-overflow: ellipsis;
    }
    button {
      background: #d9b382;
      border: none;
      font-weight: bold;
      font-size: 20px;
      padding: 8px 28px;
      border-radius: 40px;
      color: #2f1f0c;
      box-shadow: inset 0 -6px 0 #9b7b53, 0 6px 0 #3d2a13;
      cursor: pointer;
      transition: all 0.05s ease;
      font-family: inherit;
      letter-spacing: 1px;
      white-space: nowrap;
      touch-action: manipulation;
    }
    button:active {
      transform: translateY(4px);
      box-shadow: inset 0 -2px 0 #9b7b53, 0 2px 0 #3d2a13;
    }
    .pinyin-panel {
      background: #2e3b1e;
      border-radius: 28px;
      padding: 12px 20px;
      box-shadow: inset 0 0 0 3px #4d5f32, 0 8px 0 #1a1f11;
      /* 单行布局：题目在左，选项在右；选项数量已受控，不会挤爆这一行 */
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 20px;
      color: #f0e8d0;
    }
    .pinyin-quest {
      display: flex;
      align-items: center;
      gap: 16px;
      flex-wrap: wrap;
      flex: none;
    }
    .pinyin-word {
      font-size: 32px;
      font-weight: 900;
      color: #f7e05e;
      text-shadow: 3px 3px 0 #3a4b1e;
      letter-spacing: 4px;
      background: #1e2b0e;
      padding: 6px 18px;
      border-radius: 50px;
      box-shadow: inset 0 -4px 0 #0b1107;
    }
    .pinyin-hint {
      font-size: 26px;
      color: #b4d68a;
      font-weight: bold;
      text-shadow: 2px 2px 0 #1f2a0e;
    }
    /* 答对后可点击拼音再听一遍 */
    .pinyin-hint.replay {
      cursor: pointer;
      text-decoration: underline dotted;
    }
    .pinyin-hint.no-hint {
      font-size: 18px;
      color: #8fa86d;
      letter-spacing: 1px;
    }
    .pinyin-options {
      display: flex;
      align-items: center;
      justify-content: flex-end;
      gap: 10px;
      flex-wrap: wrap;
      min-width: 0;
    }
    .pinyin-btn {
      background: #d9b382;
      border: none;
      font-size: 26px;
      font-weight: 900;
      padding: 8px 20px;
      border-radius: 30px;
      color: #2f1f0c;
      box-shadow: inset 0 -5px 0 #9b7b53, 0 6px 0 #3d2a13;
      cursor: pointer;
      transition: all 0.05s ease;
      font-family: inherit;
      letter-spacing: 2px;
      min-width: 76px;
      text-align: center;
      flex: none;
      white-space: nowrap;
    }
    /* 单音节题最多 6 个选项，选项较多时整体缩小一档，保证与题目同行 */
    .pinyin-options.compact {
      gap: 8px;
    }
    .pinyin-options.compact .pinyin-btn {
      font-size: 22px;
      padding: 6px 14px;
      min-width: 56px;
      letter-spacing: 1px;
    }
    .pinyin-btn:active {
      transform: translateY(4px);
      box-shadow: inset 0 -2px 0 #9b7b53, 0 2px 0 #3d2a13;
    }
    .pinyin-btn.correct {
      background: #7fc46b;
      box-shadow: inset 0 -5px 0 #4a7a3a, 0 6px 0 #2d4a1f;
      transform: scale(0.98);
      color: #16200c;
    }
    .pinyin-btn.incorrect {
      background: #d45a5a;
      box-shadow: inset 0 -5px 0 #8a3535, 0 6px 0 #4a1e1e;
      transform: scale(0.98);
    }
    /* BOSS 战：原来的拼音选项变成点击补子弹的按钮 */
    .pinyin-btn.supply-btn {
      background: linear-gradient(180deg, #ffe08a 0%, #f5b942 100%);
      border: 2px solid #fff3c4;
      color: #5b3206;
      font-size: 22px;
      letter-spacing: 1px;
      padding: 8px 16px;
      min-width: 132px;
      box-shadow: inset 0 -5px 0 #b8741e, 0 6px 0 #5a3210;
      animation: supplyPulse 1.2s ease-in-out infinite;
    }
    .pinyin-btn.supply-btn.prop-supply {
      background: linear-gradient(180deg, #d9c2ff 0%, #9d75e8 100%);
      border-color: #efe4ff;
      color: #2f1659;
      box-shadow: inset 0 -5px 0 #6f43b8, 0 6px 0 #432477;
    }
    .pinyin-btn.supply-btn:disabled {
      background: linear-gradient(180deg, #ccd5d9 0%, #9aa8ad 100%);
      border-color: #e6ecee;
      color: #35454a;
      animation: none;
      box-shadow: inset 0 -4px 0 #6f7d82, 0 4px 0 #47545a;
    }
    .pinyin-btn.supply-btn:active {
      transform: translateY(4px);
      box-shadow: inset 0 -2px 0 #b8741e, 0 2px 0 #5a3210;
    }
    @keyframes supplyPulse {
      0%, 100% { filter: brightness(1); }
      50% { filter: brightness(1.12); }
    }
    .pinyin-btn:disabled {
      opacity: 0.7;
      transform: translateY(4px);
      box-shadow: inset 0 -2px 0 #9b7b53, 0 2px 0 #3d2a13;
      cursor: not-allowed;
    }
    .item-slot {
      background: #1e2b0e;
      border-radius: 40px;
      padding: 6px 22px;
      font-size: 22px;
      display: flex;
      align-items: center;
      gap: 12px;
      color: #f7e05e;
      box-shadow: inset 0 -3px 0 #0b1107;
      white-space: nowrap;
      cursor: pointer;
      transition: all 0.05s ease;
    }
    .item-slot:hover {
      background: #2a3a14;
    }
    .item-slot span {
      font-size: 32px;
    }
    .reset-btn {
      background: #b8885a;
    }
    .bullet-badge {
      background: #3a3a1e;
      padding: 8px 22px;
      border-radius: 40px;
      box-shadow: inset 0 -4px 0 #1a1a0a, 0 5px 0 #0f0f05;
      display: flex;
      align-items: center;
      gap: 8px;
      white-space: nowrap;
    }
    .bullet-badge span {
      font-size: 28px;
      color: #ffaa33;
      margin-left: 6px;
    }

    /* 胜利遮罩层（浮动在画布上，但实际用画布绘制） */
    /* 这里只做样式预留，不单独加DOM */

    /* 手机竖屏：自动切换成竖版战场（画布 500×900，世界坐标旋转 90°） */
    .game-wrapper.portrait {
      width: 540px;
    }
    .game-wrapper.portrait .canvas-wrap,
    .game-wrapper.portrait canvas {
      width: 500px;
      height: 900px;
    }
    .game-wrapper.portrait .pinyin-panel {
      flex-direction: column;
      align-items: stretch;
      gap: 10px;
    }
    .game-wrapper.portrait .pinyin-quest {
      justify-content: center;
    }
    .game-wrapper.portrait .pinyin-options {
      justify-content: center;
    }
  