:root {
      --poke-blue: #2563EB;
      --poke-dark-blue: #1E3A8A;
      --poke-yellow: #FACC15;
      --poke-red: #EF4444;
      --poke-dark-red: #DC2626;
      --poke-bg: #F8FAFC;
      --card-bg: #FFFFFF;
      --text-main: #0F172A;
      --text-muted: #64748B;
      --gold: #F59E0B;
      --silver: #94A3B8;
      --bronze: #D97706;
    }

    * {
      box-sizing: border-box;
      margin: 0;
      padding: 0;
      font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "PingFang TC", "Microsoft JhengHei", "微軟正黑體", "Segoe UI Emoji", "Segoe UI Symbol", "Apple Color Emoji", "Noto Color Emoji", sans-serif;
    }

    body {
      background: var(--poke-bg);
      background-image: 
        radial-gradient(circle at 10% 15%, rgba(239, 68, 68, 0.12) 0%, transparent 25%),
        radial-gradient(circle at 90% 85%, rgba(37, 99, 235, 0.12) 0%, transparent 30%),
        radial-gradient(circle at 50% 40%, rgba(250, 204, 21, 0.15) 0%, transparent 35%);
      color: var(--text-main);
      min-height: 100vh;
      overflow-x: hidden;
      padding-bottom: 60px;
    }

    
    /* Mode Switcher Tabs */
    .mode-tab-bar {
      display: flex;
      justify-content: center;
      gap: 10px;
      margin: 14px auto 16px;
      flex-wrap: wrap;
      max-width: 900px;
    }
    .mode-tab-btn {
      background: white;
      border: 2px solid #CBD5E1;
      padding: 9px 18px;
      border-radius: 25px;
      font-size: 13.5px;
      font-weight: 800;
      color: #475569;
      cursor: pointer;
      display: flex;
      align-items: center;
      gap: 7px;
      transition: all 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
      box-shadow: 0 2px 6px rgba(0,0,0,0.04);
    }
    .mode-tab-btn:hover {
      border-color: #3B82F6;
      color: #1D4ED8;
      transform: translateY(-2px);
      box-shadow: 0 4px 12px rgba(37,99,235,0.15);
    }
    .mode-tab-btn.active {
      background: linear-gradient(135deg, #2563EB 0%, #1D4ED8 100%);
      color: white;
      border-color: #1E40AF;
      box-shadow: 0 4px 12px rgba(37,99,235,0.3);
      transform: scale(1.03);
    }
    .mode-badge-pill {
      font-size: 11px;
      padding: 2px 7px;
      border-radius: 10px;
      background: rgba(255,255,255,0.25);
      color: white;
      font-weight: 900;
    }
    .mode-tab-btn:not(.active) .mode-badge-pill {
      background: #E2E8F0;
      color: #64748B;
    }

    /* Confetti Canvas */
    #confetti-canvas {
      position: fixed;
      top: 0;
      left: 0;
      width: 100%;
      height: 100%;
      pointer-events: none;
      z-index: 99999;
    }

    
.poke-img-avatar {
  width: 52px;
  height: 52px;
  object-fit: contain;
  filter: drop-shadow(0 4px 6px rgba(0,0,0,0.25));
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.poke-avatar-badge:hover .poke-img-avatar {
  transform: scale(1.25) rotate(8deg);
}
.card-poke-thumb {
  width: 38px;
  height: 38px;
  object-fit: contain;
  margin-right: 6px;
  filter: drop-shadow(0 2px 4px rgba(0,0,0,0.15));
}

/* Hero Banner Header */
    .hero-banner {
      background: linear-gradient(135deg, #1E3A8A 0%, #2563EB 50%, #3B82F6 100%);
      color: white;
      padding: 26px 20px 22px;
      text-align: center;
      position: relative;
      box-shadow: 0 6px 20px rgba(30, 58, 138, 0.25);
      border-bottom: 5px solid var(--poke-yellow);
    }

    .pokemon-trio {
      display: flex;
      justify-content: center;
      align-items: center;
      gap: 20px;
      margin-bottom: 10px;
    }

    .poke-avatar-badge {
      width: 64px;
      height: 64px;
      border-radius: 50%;
      display: flex;
      align-items: center;
      justify-content: center;
      background: white;
      box-shadow: 0 4px 12px rgba(0,0,0,0.2);
      border: 3px solid var(--poke-yellow);
      animation: floatPokemon 2.8s ease-in-out infinite;
      cursor: pointer;
      transition: transform 0.2s;
    }
    .poke-avatar-badge:hover { transform: scale(1.15) rotate(6deg); }

    .badge-pikachu { animation-delay: 0s; }
    .badge-charmander { animation-delay: 0.4s; }
    .badge-bulbasaur { animation-delay: 0.8s; }

    @keyframes floatPokemon {
      0%, 100% { transform: translateY(0px); }
      50% { transform: translateY(-7px); }
    }

    h1.title {
      font-size: 28px;
      font-weight: 900;
      letter-spacing: 1.5px;
      margin-bottom: 6px;
      text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
      color: #FFFFFF;
    }
    h1.title span {
      color: var(--poke-yellow);
    }

    p.subtitle {
      font-size: 14px;
      color: #BFDBFE;
      font-weight: 600;
      letter-spacing: 0.5px;
    }

    .stats-bar {
      display: flex;
      justify-content: center;
      flex-wrap: wrap;
      gap: 12px;
      margin-top: 16px;
    }

    .stat-pill {
      background: rgba(255, 255, 255, 0.15);
      backdrop-filter: blur(8px);
      border: 1.5px solid rgba(255, 255, 255, 0.4);
      border-radius: 20px;
      padding: 6px 14px;
      font-size: 13px;
      font-weight: 700;
      color: white;
      display: flex;
      align-items: center;
      gap: 6px;
    }
    .stat-pill strong { color: var(--poke-yellow); }

    /* Nav Tabs & Tool Bar */
    .nav-container {
      max-width: 1120px;
      margin: 18px auto;
      padding: 0 15px;
      display: flex;
      justify-content: space-between;
      align-items: center;
      flex-wrap: wrap;
      gap: 12px;
    }

    .tab-bar {
      display: flex;
      gap: 8px;
      background: white;
      padding: 6px;
      border-radius: 30px;
      border: 2px solid #E2E8F0;
      box-shadow: 0 2px 10px rgba(0,0,0,0.04);
      flex-wrap: wrap;
    }

    .tab-btn {
      background: transparent;
      border: none;
      padding: 8px 16px;
      border-radius: 20px;
      font-size: 13px;
      font-weight: 800;
      color: var(--text-muted);
      cursor: pointer;
      transition: all 0.25s;
    }

    .tab-btn.active {
      background: var(--poke-blue);
      color: white;
      box-shadow: 0 4px 10px rgba(37, 99, 235, 0.35);
    }

    .action-tools {
      display: flex;
      gap: 10px;
      align-items: center;
    }

    .btn-action {
      background: white;
      border: 2px solid var(--poke-blue);
      color: var(--poke-blue);
      border-radius: 20px;
      padding: 7px 14px;
      font-size: 13px;
      font-weight: 700;
      cursor: pointer;
      display: flex;
      align-items: center;
      gap: 5px;
      transition: all 0.2s;
    }
    .btn-action:hover {
      background: var(--poke-blue);
      color: white;
      transform: translateY(-2px);
    }

    .search-box {
      position: relative;
    }
    .search-input {
      border: 2px solid #CBD5E1;
      border-radius: 20px;
      padding: 7px 14px 7px 32px;
      font-size: 13px;
      outline: none;
      width: 170px;
      transition: all 0.3s;
    }
    .search-input:focus {
      width: 220px;
      border-color: var(--poke-blue);
      box-shadow: 0 0 8px rgba(37, 99, 235, 0.3);
    }
    .search-icon {
      position: absolute;
      left: 10px;
      top: 50%;
      transform: translateY(-50%);
      font-size: 12px;
      color: #94A3B8;
    }

    /* Content Area */
    .content-container {
      max-width: 1120px;
      margin: 0 auto;
      padding: 0 15px;
    }

    .tab-panel {
      display: none;
      animation: fadeIn 0.3s ease-in;
    }
    .tab-panel.active {
      display: block;
    }
    @keyframes fadeIn {
      from { opacity: 0; transform: translateY(6px); }
      to { opacity: 1; transform: translateY(0); }
    }

    /* Top 3 Podium */
    .podium-container {
      display: flex;
      justify-content: center;
      align-items: flex-end;
      gap: 16px;
      margin: 28px auto 32px;
      max-width: 720px;
      padding: 0 10px;
    }

    .podium-step {
      flex: 1;
      text-align: center;
      position: relative;
      border-radius: 20px 20px 10px 10px;
      padding: 18px 10px 22px;
      box-shadow: 0 8px 24px rgba(0,0,0,0.08);
      transition: transform 0.3s;
      border: 3px solid white;
    }
    .podium-step:hover { transform: translateY(-6px); }

    .podium-1 {
      height: 260px;
      background: linear-gradient(180deg, #FEF08A 0%, #FACC15 60%, #EAB308 100%);
      order: 2;
    }
    .podium-2 {
      height: 225px;
      background: linear-gradient(180deg, #FFEDD5 0%, #FED7AA 60%, #FB923C 100%);
      order: 1;
    }
    .podium-3 {
      height: 200px;
      background: linear-gradient(180deg, #DCFCE7 0%, #BBF7D0 60%, #4ADE80 100%);
      order: 3;
    }

    .crown-banner {
      font-size: 28px;
      margin-bottom: 2px;
      display: inline-block;
      animation: bounceCrown 2s infinite ease-in-out;
    }
    @keyframes bounceCrown {
      0%, 100% { transform: translateY(0); }
      50% { transform: translateY(-5px); }
    }

    
    .podium-pokemon-img {
      width: 76px;
      height: 76px;
      object-fit: contain;
      filter: drop-shadow(0 6px 10px rgba(0,0,0,0.3));
      margin-bottom: 6px;
      transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    }
    .podium-step:hover .podium-pokemon-img {
      transform: scale(1.18) rotate(5deg);
    }
    .rank-poke-img {
      width: 44px;
      height: 44px;
      object-fit: contain;
      filter: drop-shadow(0 2px 4px rgba(0,0,0,0.2));
    }
    .star-poke-img {
      width: 34px;
      height: 34px;
      object-fit: contain;
      filter: drop-shadow(0 2px 4px rgba(0,0,0,0.15));
      margin-right: 6px;
    }
    .game-poke-badge-img {
      width: 24px;
      height: 24px;
      object-fit: contain;
      vertical-align: middle;
      margin-right: 4px;
    }

    .podium-pokemon-icon {
      width: 68px;
      height: 68px;
      background: white;
      border-radius: 50%;
      margin: 4px auto 8px;
      display: flex;
      align-items: center;
      justify-content: center;
      font-size: 32px;
      box-shadow: 0 4px 12px rgba(0,0,0,0.15);
      border: 3px solid white;
    }

    .podium-name {
      font-size: 18px;
      font-weight: 900;
      color: #0F172A;
    }
    .podium-class {
      font-size: 13px;
      color: #334155;
      font-weight: 700;
      margin: 2px 0 6px;
    }
    .podium-badge-score {
      display: inline-block;
      background: white;
      border-radius: 12px;
      padding: 3px 10px;
      font-size: 13px;
      font-weight: 800;
      color: var(--poke-dark-blue);
      box-shadow: 0 2px 5px rgba(0,0,0,0.06);
    }
    .podium-time {
      font-size: 11px;
      color: #475569;
      margin-top: 4px;
      font-weight: 600;
    }

    /* Cards Grid */
    .card-list {
      display: grid;
      grid-template-columns: repeat(auto-fill, minmax(min(320px, 100%), 1fr));
      gap: 12px;
    }

    .rank-card {
      background: white;
      border-radius: 16px;
      padding: 12px 16px;
      display: flex;
      align-items: center;
      justify-content: space-between;
      border: 2px solid #F1F5F9;
      box-shadow: 0 3px 10px rgba(0,0,0,0.03);
      transition: all 0.2s;
    }
    .rank-card:hover {
      transform: translateY(-2px);
      box-shadow: 0 6px 15px rgba(37, 99, 235, 0.12);
      border-color: #BFDBFE;
    }
    .rank-card.highlight {
      border: 3px solid #EF4444;
      background: #FEF2F2;
      transform: scale(1.02);
    }

    .rank-left {
      display: flex;
      align-items: center;
      gap: 12px;
    }

    .rank-poke-avatar {
      width: 40px;
      height: 40px;
      border-radius: 50%;
      background: #F1F5F9;
      display: flex;
      align-items: center;
      justify-content: center;
      font-size: 20px;
      border: 2px solid #E2E8F0;
      flex-shrink: 0;
    }

    .st-name {
      font-size: 16px;
      font-weight: 800;
      color: #1E293B;
    }
    .st-class {
      font-size: 12px;
      color: #64748B;
      font-weight: 600;
    }
    .st-poke-tag {
      font-size: 10px;
      background: #F1F5F9;
      color: #475569;
      padding: 1px 6px;
      border-radius: 8px;
      display: inline-block;
      margin-left: 4px;
    }

    .rank-right {
      text-align: right;
    }
    .st-score {
      font-size: 17px;
      font-weight: 900;
      color: #2563EB;
    }
    .st-date {
      font-size: 11px;
      color: #94A3B8;
    }

    /* Class Chips Selector */
    .class-selector {
      display: flex;
      justify-content: center;
      gap: 10px;
      margin: 15px 0 25px;
      flex-wrap: wrap;
    }
    .cls-chip {
      background: white;
      border: 2px solid #CBD5E1;
      color: #334155;
      padding: 8px 18px;
      border-radius: 20px;
      font-size: 14px;
      font-weight: 800;
      cursor: pointer;
      transition: all 0.2s;
    }
    .cls-chip.active {
      background: var(--poke-blue);
      color: white;
      border-color: var(--poke-blue);
      box-shadow: 0 4px 10px rgba(37, 99, 235, 0.3);
    }

    /* 400 Pts Star Grid */
    .perfect-grid {
      display: grid;
      grid-template-columns: repeat(auto-fill, minmax(min(135px, 100%), 1fr));
      gap: 12px;
      margin-top: 15px;
    }
    .star-card {
      background: white;
      border: 2px solid #FDE047;
      border-radius: 14px;
      padding: 12px 8px;
      text-align: center;
      box-shadow: 0 3px 8px rgba(0,0,0,0.04);
      transition: transform 0.2s;
    }
    .star-card:hover {
      transform: scale(1.06);
      border-color: #EAB308;
      box-shadow: 0 6px 15px rgba(234, 179, 8, 0.25);
    }
    .star-avatar { font-size: 26px; margin-bottom: 4px; }
    .star-name { font-size: 14px; font-weight: 800; color: #1E293B; }
    .star-cls { font-size: 11px; color: #64748B; }

    /* Minigame Section (Tab 4) */
    .game-box {
      background: white;
      border-radius: 24px;
      padding: 30px 20px;
      max-width: 650px;
      margin: 20px auto;
      text-align: center;
      border: 4px solid var(--poke-blue);
      box-shadow: 0 12px 32px rgba(37, 99, 235, 0.15);
      position: relative;
    }

    .game-header {
      display: flex;
      justify-content: space-between;
      align-items: center;
      margin-bottom: 20px;
      padding-bottom: 12px;
      border-bottom: 2px dashed #E2E8F0;
    }
    .round-tag {
      background: #EFF6FF;
      color: #1D4ED8;
      font-size: 13px;
      font-weight: 800;
      padding: 4px 12px;
      border-radius: 15px;
    }
    .game-score-tag {
      background: #FEF3C7;
      color: #B45309;
      font-size: 13px;
      font-weight: 800;
      padding: 4px 12px;
      border-radius: 15px;
    }

    .target-monster-badge {
      font-size: 52px;
      margin-bottom: 6px;
      animation: bounceMonster 1.8s infinite ease-in-out;
    }
    @keyframes bounceMonster {
      0%, 100% { transform: scale(1); }
      50% { transform: scale(1.08) rotate(4deg); }
    }

    .target-word {
      font-size: 66px;
      font-weight: 900;
      color: var(--poke-dark-blue);
      letter-spacing: 4px;
      margin-bottom: 4px;
      text-shadow: 2px 2px 0px #DBEAFE;
    }

    .game-prompt {
      font-size: 15px;
      color: var(--text-muted);
      font-weight: 700;
      margin-bottom: 22px;
    }

    .input-slots-row {
      display: flex;
      justify-content: center;
      gap: 20px;
      margin-bottom: 26px;
    }

    .code-slot {
      background: #F8FAFC;
      border: 2px dashed #CBD5E1;
      border-radius: 14px;
      padding: 10px 20px;
      min-width: 140px;
      text-align: center;
    }
    .code-slot.filled {
      border: 2px solid var(--poke-blue);
      background: #EFF6FF;
    }
    .code-slot-label {
      font-size: 11px;
      color: #64748B;
      font-weight: 700;
      margin-bottom: 4px;
    }
    .code-slot-val {
      font-size: 22px;
      font-weight: 900;
      color: #0F172A;
    }

    /* Clean 6 Buttons (NO AUXILIARY TEXT!) */
    .options-grid {
      display: grid;
      grid-template-columns: repeat(3, 1fr);
      gap: 14px;
      margin-bottom: 25px;
    }

    .cj-btn {
      background: white;
      border: 2px solid #CBD5E1;
      border-radius: 18px;
      padding: 14px 10px;
      cursor: pointer;
      transition: all 0.2s;
      box-shadow: 0 4px 8px rgba(0,0,0,0.04);
      display: flex;
      flex-direction: column;
      align-items: center;
      justify-content: center;
      gap: 4px;
    }
    .cj-btn:hover {
      border-color: var(--poke-blue);
      background: #EFF6FF;
      transform: translateY(-3px);
      box-shadow: 0 6px 14px rgba(37, 99, 235, 0.2);
    }
    .cj-btn:disabled {
      opacity: 0.55;
      cursor: not-allowed;
      transform: none;
    }

    .cj-btn-char {
      font-size: 26px;
      font-weight: 900;
      color: #1E293B;
    }
    
    .cj-btn-aux {
      font-size: 11px;
      color: #64748B;
      font-weight: 700;
      margin-top: 2px;
      letter-spacing: 0.5px;
      white-space: normal; line-height: 1.3; max-width: 140px; text-align: center;
    }

    .cj-btn-key {
      font-size: 13px;
      color: var(--poke-blue);
      font-weight: 800;
      background: #DBEAFE;
      padding: 2px 8px;
      border-radius: 8px;
    }

    /* Decomposition Secret Box */
    .secret-box {
      background: #F0FDF4;
      border: 2px solid #86EFAC;
      border-radius: 16px;
      padding: 16px;
      margin-top: 15px;
      text-align: left;
      display: none;
      animation: fadeIn 0.3s;
    }
    .secret-title {
      font-size: 14px;
      font-weight: 800;
      color: #166534;
      margin-bottom: 8px;
      display: flex;
      align-items: center;
      gap: 6px;
    }
    .secret-desc {
      font-size: 13px;
      color: #15803D;
      line-height: 1.6;
    }

    .btn-next-round {
      background: linear-gradient(135deg, #2563EB 0%, #1D4ED8 100%);
      color: white;
      border: none;
      padding: 10px 30px;
      border-radius: 20px;
      font-size: 15px;
      font-weight: 800;
      cursor: pointer;
      margin-top: 16px;
      box-shadow: 0 4px 12px rgba(37, 99, 235, 0.35);
      display: none;
    }
    .btn-next-round:hover {
      background: #1E40AF;
      transform: translateY(-2px);
    }

    /* 表格的橫向捲動容器。
       窄螢幕上表格的最小內容寬度會超過容器，沒有這層就只能被裁掉。
       -webkit-overflow-scrolling 讓 iOS 的捲動有慣性，手感才正常。 */
    .table-scroll {
      width: 100%;
      overflow-x: auto;
      -webkit-overflow-scrolling: touch;
      border-radius: 16px;
    }

    /* Vocab Table */
    .ref-table {
      width: 100%;
      border-collapse: collapse;
      background: white;
      border-radius: 16px;
      overflow: hidden;
      box-shadow: 0 4px 12px rgba(0,0,0,0.04);
    }
    .ref-table th {
      background: #1E3A8A;
      color: white;
      padding: 12px 10px;
      font-size: 13px;
      font-weight: 800;
    }
    .ref-table td {
      padding: 10px;
      font-size: 13px;
      border-bottom: 1px solid #EDF2F7;
      text-align: center;
    }
    .ref-table tr:hover td {
      background: #EFF6FF;
    }

    @media (max-width: 768px) {
      .podium-container { flex-direction: column; align-items: stretch; }
      .podium-step { height: auto !important; margin-bottom: 10px; order: initial !important; }
      .nav-container { flex-direction: column; align-items: stretch; }
      .options-grid { grid-template-columns: repeat(2, 1fr); }
    }
  
    /* =========================================================================
       🎮 寶可夢隨機遊行抓寶與擴充功能專屬樣式
       ========================================================================= */
    .form-select {
      border: 2px solid #CBD5E1;
      border-radius: 12px;
      padding: 8px 14px;
      font-size: 14px;
      font-weight: 700;
      color: #1E293B;
      background: white;
      outline: none;
      min-width: 140px;
      cursor: pointer;
      transition: all 0.2s;
    }
    .form-select:focus {
      border-color: var(--poke-blue);
      box-shadow: 0 0 8px rgba(37, 99, 235, 0.25);
    }
    .identity-preview-box {
      background: #EFF6FF;
      border: 2px dashed #93C5FD;
      border-radius: 16px;
      padding: 10px 18px;
      display: inline-flex;
      align-items: center;
      gap: 8px;
      font-size: 14px;
      font-weight: 800;
      color: #1E3A8A;
      margin-bottom: 20px;
    }
    .btn-primary-action {
      background: linear-gradient(135deg, #2563EB 0%, #1D4ED8 100%);
      color: white;
      border: none;
      padding: 11px 26px;
      border-radius: 20px;
      font-size: 15px;
      font-weight: 800;
      cursor: pointer;
      box-shadow: 0 4px 12px rgba(37, 99, 235, 0.35);
      transition: all 0.2s;
    }
    .btn-primary-action:hover {
      background: #1E40AF;
      transform: translateY(-2px);
    }
    .trainer-header-bar {
      background: #F8FAFC;
      border: 2px solid #E2E8F0;
      border-radius: 18px;
      padding: 12px 18px;
      display: flex;
      justify-content: space-between;
      align-items: center;
      flex-wrap: wrap;
      gap: 12px;
      text-align: left;
    }
    .trainer-meta {
      display: flex;
      align-items: center;
      gap: 12px;
    }
    .trainer-badge-icon {
      width: 46px;
      height: 46px;
      background: white;
      border-radius: 50%;
      display: flex;
      align-items: center;
      justify-content: center;
      font-size: 26px;
      border: 2px solid #FACC15;
      box-shadow: 0 2px 6px rgba(0,0,0,0.1);
    }
    .trainer-name-text {
      font-size: 16px;
      font-weight: 900;
      color: #0F172A;
    }
    .trainer-title-pill {
      font-size: 11px;
      font-weight: 800;
      background: #FEF3C7;
      color: #B45309;
      padding: 2px 8px;
      border-radius: 10px;
      border: 1px solid #FDE68A;
    }
    .trainer-actions {
      display: flex;
      gap: 8px;
      flex-wrap: wrap;
    }
    .btn-hub {
      border: none;
      border-radius: 16px;
      padding: 6px 12px;
      font-size: 12px;
      font-weight: 800;
      cursor: pointer;
      transition: all 0.2s;
    }
    .btn-hub-gold {
      background: #FEF3C7;
      color: #B45309;
      border: 1.5px solid #FACC15;
    }
    .btn-hub-gold:hover { background: #FDE68A; transform: translateY(-1px); }
    .btn-hub-purple {
      background: #F3E8FF;
      color: #7E22CE;
      border: 1.5px solid #D8B4FE;
    }
    .btn-hub-purple:hover { background: #E9D5FF; transform: translateY(-1px); }
    .btn-hub-gray {
      background: #F1F5F9;
      color: #475569;
      border: 1.5px solid #CBD5E1;
    }
    .btn-hub-gray:hover { background: #E2E8F0; }

    /* 🎮 隨機遊行抓寶區 (Pokémon Wandering Capture Arena) */
    .capture-arena-container {
      position: relative;
      width: 100%;
      height: 280px;
      background: radial-gradient(circle at center, #EFF6FF 0%, #DBEAFE 60%, #BFDBFE 100%);
      border: 2.5px solid #3B82F6;
      border-radius: 20px;
      overflow: hidden;
      margin: 16px 0;
      box-shadow: inset 0 4px 16px rgba(37, 99, 235, 0.15), 0 8px 20px rgba(0,0,0,0.06);
      user-select: none;
    }
    .arena-background-grid {
      position: absolute;
      top: 0; left: 0; width: 100%; height: 100%;
      background-image: radial-gradient(rgba(37, 99, 235, 0.1) 1.5px, transparent 1.5px);
      background-size: 24px 24px;
      pointer-events: none;
    }
    .arena-watermark {
      position: absolute;
      top: 50%; left: 50%;
      transform: translate(-50%, -50%);
      font-size: 140px;
      opacity: 0.08;
      pointer-events: none;
    }
    .arena-controls-bar {
      position: absolute;
      top: 8px; right: 12px;
      display: flex;
      align-items: center;
      gap: 6px;
      z-index: 20;
    }
    .arena-speed-btn {
      background: rgba(255, 255, 255, 0.85);
      border: 1px solid #CBD5E1;
      border-radius: 12px;
      padding: 3px 8px;
      font-size: 11px;
      font-weight: 800;
      color: #334155;
      cursor: pointer;
      backdrop-filter: blur(4px);
      transition: all 0.15s;
    }
    .arena-speed-btn.active {
      background: var(--poke-blue);
      color: white;
      border-color: var(--poke-blue);
    }

    /* 隨機遊行精靈球 (Wandering Poké-Orb) */
    .poke-orb {
      position: absolute;
      width: 82px;
      height: 82px;
      border-radius: 50%;
      background: white;
      box-shadow: 0 6px 16px rgba(0, 0, 0, 0.2), inset 0 -3px 6px rgba(0,0,0,0.1);
      border: 3px solid #1E293B;
      cursor: pointer;
      display: flex;
      flex-direction: column;
      align-items: center;
      justify-content: center;
      transition: transform 0.15s ease-out, box-shadow 0.15s ease-out;
      z-index: 10;
      overflow: hidden;
    }
    .poke-orb::before {
      content: '';
      position: absolute;
      top: 0; left: 0; width: 100%; height: 48%;
      background: linear-gradient(180deg, #EF4444 0%, #DC2626 100%);
      z-index: 1;
    }
    .poke-orb::after {
      content: '';
      position: absolute;
      top: 48%; left: 0; width: 100%; height: 4px;
      background: #1E293B;
      z-index: 2;
    }
    .poke-orb-center-ring {
      position: absolute;
      top: 50%; left: 50%;
      transform: translate(-50%, -50%);
      width: 22px;
      height: 22px;
      border-radius: 50%;
      background: white;
      border: 3px solid #1E293B;
      z-index: 3;
      box-shadow: 0 2px 4px rgba(0,0,0,0.2);
    }
    .poke-orb-content {
      position: relative;
      z-index: 4;
      display: flex;
      flex-direction: column;
      align-items: center;
      justify-content: center;
      width: 100%;
      height: 100%;
      pointer-events: none;
    }
    .poke-orb-char {
      font-size: 28px;
      font-weight: 900;
      color: white;
      text-shadow: 0 2px 5px rgba(0,0,0,0.65);
      line-height: 1;
      margin-top: -18px; /* 純粹居中於上半部紅色半圓，球內絕無任何答案提示 */
    }
    .poke-orb-key-pill {
      font-size: 11px;
      font-weight: 900;
      color: #1E293B;
      background: rgba(255, 255, 255, 0.95);
      border-radius: 8px;
      padding: 0 5px;
      margin-top: 10px;
      border: 1px solid #CBD5E1;
      box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    }
    .poke-orb-aux {
      font-size: 9px;
      font-weight: 800;
      color: #475569;
      line-height: 1;
      margin-top: 1px;
      max-width: 72px;
      overflow: hidden;
      text-overflow: ellipsis;
      white-space: nowrap;
    }
    .poke-orb:hover {
      transform: scale(1.18);
      box-shadow: 0 10px 24px rgba(239, 68, 68, 0.45);
      border-color: #FACC15;
      z-index: 15;
    }
    .poke-orb.highlight-focus {
      box-shadow: 0 0 20px #3B82F6, 0 0 40px #60A5FA !important;
      border-color: #3B82F6 !important;
    }
    .poke-orb.eliminated {
      animation: eliminatePoof 0.3s ease-out forwards;
      pointer-events: none !important;
    }
    @keyframes eliminatePoof {
      0% { transform: scale(1); opacity: 1; }
      50% { transform: scale(1.15); filter: brightness(1.4); }
      100% { transform: scale(0); opacity: 0; display: none; }
    }
    .poke-orb.caught {
      animation: catchBurst 0.35s ease-out forwards;
    }
    @keyframes catchBurst {
      0% { transform: scale(1); opacity: 1; }
      50% { transform: scale(1.3) rotate(20deg); filter: brightness(2); }
      100% { transform: scale(0) rotate(-45deg); opacity: 0; }
    }

    /* 5 關結算卡片樣式 */
    .session-summary-box {
      background: white;
      border: 3px solid #2563EB;
      border-radius: 24px;
      padding: 26px 20px;
      margin: 16px 0;
      box-shadow: 0 12px 28px rgba(37, 99, 235, 0.18);
      text-align: center;
      animation: modalSlideIn 0.3s ease-out;
    }
    .summary-stats-grid {
      display: grid;
      grid-template-columns: repeat(auto-fit, minmax(min(130px, 100%), 1fr));
      gap: 12px;
      margin: 18px 0;
    }
    .summary-stat-card {
      background: #F8FAFC;
      border: 1.5px solid #E2E8F0;
      border-radius: 14px;
      padding: 10px;
    }
    .stat-label { font-size: 11px; font-weight: 700; color: #64748B; margin-bottom: 2px; }
    .stat-val { font-size: 18px; font-weight: 900; }

    /* Modals Overlay */
    .custom-modal-overlay {
      position: fixed;
      top: 0; left: 0; width: 100%; height: 100%;
      background: rgba(15, 23, 42, 0.75);
      backdrop-filter: blur(6px);
      z-index: 100000;
      display: none;
      align-items: flex-start !important;
      justify-content: center;
      padding: 24px 15px;
      overflow-y: auto !important;
      box-sizing: border-box;
    }
    .custom-modal-dialog {
      background: white;
      border-radius: 24px;
      padding: 24px 22px;
      max-width: 480px;
      width: 100%;
      text-align: center;
      box-shadow: 0 20px 50px rgba(0,0,0,0.35);
      border: 3.5px solid var(--poke-blue);
      animation: modalSlideIn 0.25s ease-out;
      max-height: 90vh !important;
      overflow-y: auto !important;
      display: flex !important;
      flex-direction: column !important;
      position: relative;
      margin: 10px auto !important;
      box-sizing: border-box;
    }
    .custom-modal-lg { max-width: 820px; text-align: left; }
    @keyframes modalSlideIn {
      from { opacity: 0; transform: translateY(20px) scale(0.96); }
      to { opacity: 1; transform: translateY(0) scale(1); }
    }
    .modal-header-flex {
      display: flex;
      justify-content: space-between;
      align-items: center;
      margin-bottom: 16px;
      padding: 10px 0 12px;
      border-bottom: 2px dashed #E2E8F0;
      position: sticky !important;
      top: -24px !important;
      background: white !important;
      z-index: 100 !important;
      flex-shrink: 0;
    }
    .modal-close-btn {
      background: #FEE2E2 !important;
      border: 2px solid #F87171 !important;
      width: 36px !important;
      height: 36px !important;
      border-radius: 50% !important;
      font-size: 18px !important;
      font-weight: 900 !important;
      color: #DC2626 !important;
      cursor: pointer !important;
      display: flex !important;
      align-items: center !important;
      justify-content: center !important;
      transition: all 0.2s !important;
      box-shadow: 0 2px 8px rgba(220, 38, 38, 0.2) !important;
      flex-shrink: 0 !important;
    }
    .modal-close-btn:hover {
      background: #DC2626 !important;
      color: white !important;
      border-color: #B91C1C !important;
      transform: scale(1.1) !important;
    }
    
    .confirm-info-card {
      background: #F8FAFC;
      border: 2px solid #E2E8F0;
      border-radius: 16px;
      padding: 14px 18px;
      text-align: left;
      margin: 15px 0;
    }
    .confirm-info-row {
      display: flex;
      justify-content: space-between;
      padding: 6px 0;
      border-bottom: 1px solid #EDF2F7;
      font-size: 14px;
    }
    .confirm-info-row:last-child { border-bottom: none; }
    .confirm-label { color: #64748B; font-weight: 700; }
    .confirm-val { color: #0F172A; font-weight: 800; }

    .btn-modal-cancel {
      background: #F1F5F9;
      border: 2px solid #CBD5E1;
      color: #475569;
      padding: 9px 20px;
      border-radius: 20px;
      font-size: 14px;
      font-weight: 800;
      cursor: pointer;
    }
    .btn-modal-cancel:hover { background: #E2E8F0; }
    .btn-modal-confirm {
      background: linear-gradient(135deg, #2563EB 0%, #1D4ED8 100%);
      border: none;
      color: white;
      padding: 9px 24px;
      border-radius: 20px;
      font-size: 14px;
      font-weight: 800;
      cursor: pointer;
      box-shadow: 0 4px 10px rgba(37, 99, 235, 0.3);
    }
    .btn-modal-confirm:hover { background: #1E40AF; }

    /* Leaderboard Modal Styles */
    .my-status-banner {
      background: linear-gradient(135deg, #EFF6FF 0%, #DBEAFE 100%);
      border: 2px solid #BFDBFE;
      border-radius: 16px;
      padding: 12px 18px;
      display: flex;
      justify-content: space-between;
      align-items: center;
      margin-bottom: 15px;
    }
    .lb-filter-bar { display: flex; gap: 6px; margin-bottom: 12px; flex-wrap: wrap; }
    .lb-filter-btn {
      background: white;
      border: 1.5px solid #CBD5E1;
      border-radius: 16px;
      padding: 4px 12px;
      font-size: 12px;
      font-weight: 800;
      color: #475569;
      cursor: pointer;
    }
    .lb-filter-btn.active {
      background: var(--poke-blue);
      color: white;
      border-color: var(--poke-blue);
    }

    /* Skills Hall Styles */
    .skills-progress-card {
      background: #FFFBEB;
      border: 2px solid #FDE68A;
      border-radius: 16px;
      padding: 14px 18px;
      margin-bottom: 16px;
    }
    .progress-track {
      background: #E2E8F0;
      height: 12px;
      border-radius: 6px;
      overflow: hidden;
      margin-top: 6px;
    }
    .progress-bar {
      height: 100%;
      background: linear-gradient(90deg, #F59E0B 0%, #10B981 100%);
      transition: width 0.4s ease-out;
    }
    .tiers-grid {
      display: grid;
      grid-template-columns: repeat(auto-fill, minmax(min(160px, 100%), 1fr));
      gap: 10px;
    }
    .tier-card {
      background: white;
      border: 2px solid #E2E8F0;
      border-radius: 14px;
      padding: 10px;
      text-align: center;
      transition: all 0.2s;
    }
    .tier-card.unlocked {
      border-color: #FACC15;
      background: #FEFCE8;
      box-shadow: 0 4px 10px rgba(250, 204, 21, 0.2);
    }
    .tier-card.locked { opacity: 0.55; background: #F8FAFC; }
    .tier-card-badge { font-size: 28px; margin-bottom: 4px; }
    .tier-card-title { font-size: 12px; font-weight: 800; color: #1E293B; margin-bottom: 2px; }
    .tier-card-score { font-size: 11px; font-weight: 700; color: #B45309; }
    
    .skills-grid {
      display: grid;
      grid-template-columns: repeat(auto-fill, minmax(min(230px, 100%), 1fr));
      gap: 12px;
    }
    .skill-card {
      background: white;
      border: 2px solid #E2E8F0;
      border-radius: 16px;
      padding: 12px 14px;
      position: relative;
      transition: all 0.2s;
    }
    .skill-card.unlocked {
      border-color: #A855F7;
      background: #FAF5FF;
      box-shadow: 0 4px 12px rgba(168, 85, 247, 0.15);
    }
    .skill-card.locked { opacity: 0.6; background: #F8FAFC; }
    .skill-name-row { display: flex; justify-content: space-between; align-items: center; margin-bottom: 4px; }
    .skill-name { font-size: 14px; font-weight: 900; color: #7E22CE; }
    .skill-rate { font-size: 11px; font-weight: 800; background: #E9D5FF; color: #6B21A8; padding: 1px 6px; border-radius: 6px; }
    .skill-desc { font-size: 12px; color: #475569; line-height: 1.4; margin-top: 4px; }

    /* Floating Skill Toast */
    .skill-toast {
      position: fixed;
      top: -70px;
      left: 50%;
      transform: translateX(-50%);
      background: linear-gradient(135deg, #7E22CE 0%, #9333EA 100%);
      color: white;
      padding: 10px 24px;
      border-radius: 30px;
      font-size: 15px;
      font-weight: 900;
      box-shadow: 0 8px 24px rgba(147, 51, 234, 0.45);
      border: 2px solid #FACC15;
      z-index: 100002;
      display: flex;
      align-items: center;
      gap: 8px;
      transition: all 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
      pointer-events: none;
    }
    .skill-toast.show { top: 25px; }

    /* Floating Stage Pass Toast */
    .stage-pass-toast {
      position: fixed;
      top: -85px;
      left: 50%;
      transform: translateX(-50%);
      background: linear-gradient(135deg, #15803D 0%, #16A34A 50%, #22C55E 100%);
      color: white;
      padding: 12px 32px;
      border-radius: 40px;
      box-shadow: 0 12px 28px rgba(22, 163, 74, 0.45);
      display: flex;
      align-items: center;
      gap: 12px;
      font-weight: 900;
      font-size: 16px;
      z-index: 100000;
      transition: all 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
      border: 2.5px solid #BBF7D0;
      pointer-events: none;
      /* 修復 47：這個橫幅原本放在 #panel-game（display:none）裡，靠「父層不顯示」
         才會消失；移到 <body> 之後它永遠有佈局，而 top:-85px 只推得動 91px 高的自己
         到 -85px，底邊仍停在 +6px —— 畫面最上緣會露出一條 6px 綠色橫條，
         而且在所有非遊戲頁籤都出現（首頁／班級／滿分榜／詞彙）。
         用 visibility 而不是改 top 或 opacity：visibility 在 transition 下是離散插值，
         只要有一端是 visible，整個轉場期間都維持可見，所以滑入／滑出動畫與官方逐格相同，
         只是靜止時真正不再被繪製。實測靜止頂端 12px 帶綠像素：官方 0、修復前 985、修復後 0；
         叫出提示時 15480 → 15483（正常）。 */
      visibility: hidden;
    }
    .stage-pass-toast.show {
      top: 28px;
      visibility: visible;
    }

    /* ======================================================== */
    /* 🎮 1080*720 緊湊排版優化：無須滾動完整顯示精靈球移動原野 */
    /* ======================================================== */
    .game-box {
      background: white;
      border-radius: 18px;
      padding: 10px 16px;
      box-shadow: 0 4px 18px rgba(0,0,0,0.06);
      border: 2px solid #E2E8F0;
      max-width: 980px;
      margin: 0 auto;
    }
    .trainer-header-bar {
      display: flex;
      justify-content: space-between;
      align-items: center;
      padding: 6px 12px;
      background: #F8FAFC;
      border-radius: 12px;
      border: 1.5px solid #E2E8F0;
      margin-bottom: 8px;
    }
    .trainer-meta {
      display: flex;
      align-items: center;
      gap: 10px;
    }
    .trainer-badge-icon {
      font-size: 26px;
    }
    .trainer-name-text {
      font-size: 15px;
      font-weight: 900;
      color: #1E3A8A;
    }
    .trainer-title-pill {
      font-size: 11px;
      font-weight: 800;
      color: #D97706;
      background: #FEF3C7;
      padding: 1px 8px;
      border-radius: 10px;
    }
    .trainer-actions {
      display: flex;
      gap: 6px;
    }
    .btn-hub {
      padding: 5px 12px;
      font-size: 12px;
      font-weight: 800;
      border-radius: 16px;
    }

    /* 模式 1-3 按鈕橫向排列。
       原文寫死 flex-wrap: nowrap !important —— 夠寬時確實是單行，
       但三個按鈕的內容（含徽章）最少需要 924px，在 769–1023px 的
       平板直向塞不進 834px 的容器，整頁就水平溢出 48px。
       改成 wrap：夠寬時外觀完全不變（放得下就不會折行），
       不夠寬時自動折行，而不是把整個版面撐爆。 */
    .mode-tab-bar {
      display: flex !important;
      flex-direction: row !important;
      flex-wrap: wrap !important;
      justify-content: center !important;
      align-items: center !important;
      gap: 8px !important;
      margin-bottom: 8px !important;
      width: 100% !important;
    }
    .mode-tab-btn {
      flex: 1 1 0 !important;
      padding: 6px 10px !important;
      font-size: 13px !important;
      font-weight: 800 !important;
      border-radius: 20px !important;
      white-space: nowrap !important;
      display: flex !important;
      align-items: center !important;
      justify-content: center !important;
      gap: 4px !important;
    }
    .mode-badge-pill {
      font-size: 10.5px;
      padding: 1px 6px;
      border-radius: 8px;
    }

    /* 關卡狀態與進度橫條 */
    .stage-status-bar {
      display: flex;
      justify-content: center;
      align-items: center;
      gap: 10px;
      margin-bottom: 6px;
    }
    .stage-tag {
      font-size: 12px;
      font-weight: 800;
      padding: 2px 10px;
      border-radius: 10px;
    }

    /* 目標怪物與巨大文字字卡 (居中且比例優化) */
    .target-monster-badge {
      font-size: 38px !important;
      margin-bottom: 2px !important;
      animation: bounceMonster 1.8s infinite ease-in-out !important;
      text-align: center !important;
      line-height: 1 !important;
    }
    .target-word {
      font-size: 56px !important;
      font-weight: 900 !important;
      color: #1E3A8A !important;
      letter-spacing: 3px !important;
      margin-bottom: 2px !important;
      text-shadow: 2px 2px 0px #DBEAFE !important;
      text-align: center !important;
      line-height: 1 !important;
    }
    #target-sub-hint {
      font-size: 12.5px !important;
      font-weight: 800 !important;
      color: #475569 !important;
      margin: 0 0 4px !important;
      text-align: center !important;
    }
    .game-prompt {
      text-align: center !important;
      font-size: 13px !important;
      font-weight: 800 !important;
      color: #1E3A8A !important;
      margin-bottom: 8px !important;
      min-height: 20px;
    }

    /* 槽位高度緊湊化 */
    .input-slots-row {
      display: flex;
      justify-content: center;
      align-items: center;
      gap: 10px;
      margin-bottom: 8px;
    }
    .code-slot {
      width: 60px;
      height: 54px;
      padding: 3px 6px;
      border-radius: 12px;
    }
    .code-slot-label {
      font-size: 10px;
      margin-bottom: 2px;
    }
    .code-slot-val {
      font-size: 22px;
      font-weight: 900;
    }

    /* Mode 2: 字首與字身雙區塊槽位樣式 */
    .split-slots-container {
      display: flex;
      justify-content: center;
      align-items: center;
      gap: 12px;
      margin-bottom: 8px;
      flex-wrap: nowrap;
    }
    .split-slot-group {
      background: #F8FAFC;
      border: 1.5px solid #E2E8F0;
      border-radius: 14px;
      padding: 6px 12px;
      display: flex;
      flex-direction: column;
      align-items: center;
      gap: 4px;
    }
    .split-slot-group.prefix-group {
      border-color: #93C5FD;
      background: #EFF6FF;
    }
    .split-slot-group.body-group {
      border-color: #DDD6FE;
      background: #F5F3FF;
    }
    .split-group-header {
      font-size: 11px;
      font-weight: 900;
      display: flex;
      align-items: center;
      gap: 4px;
    }
    .prefix-group .split-group-header { color: #1D4ED8; }
    .body-group .split-group-header { color: #6D28D9; }
    .split-group-slots {
      display: flex;
      gap: 8px;
    }

    /* 緊湊精靈遊行原野 */
    .capture-arena-container {
      height: 250px !important;
      border-radius: 16px;
      position: relative;
      overflow: hidden;
      margin-bottom: 6px;
    }
    .poke-orb {
      width: 72px !important;
      height: 72px !important;
    }
    .poke-orb-center-ring {
      width: 22px !important;
      height: 22px !important;
    }
    .poke-orb-char {
      font-size: 26px !important;
    }

    /* 錯誤搖晃與閃爍紅光動畫 (球體不消失、不陷入死循環) */
    @keyframes shakeMistake {
      0%, 100% { transform: scale(1) rotate(0deg); }
      20%, 60% { transform: scale(0.95) translateX(-8px) rotate(-8deg); }
      40%, 80% { transform: scale(0.95) translateX(8px) rotate(8deg); }
    }
    .poke-orb.mistake-shake {
      animation: shakeMistake 0.45s ease-in-out !important;
      border-color: #EF4444 !important;
      box-shadow: 0 0 20px rgba(239, 68, 68, 0.9) !important;
    }

    /* 錯誤達5次以上之提示金光 Halo 動畫 */
    @keyframes pulseHintGold {
      0% { box-shadow: 0 0 0 0 rgba(234, 179, 8, 0.8), 0 0 16px rgba(234, 179, 8, 0.6); }
      70% { box-shadow: 0 0 0 14px rgba(234, 179, 8, 0), 0 0 28px rgba(234, 179, 8, 0.9); }
      100% { box-shadow: 0 0 0 0 rgba(234, 179, 8, 0), 0 0 16px rgba(234, 179, 8, 0.6); }
    }
    .poke-orb.highlight-hint {
      border: 3.5px solid #FACC15 !important;
      animation: pulseHintGold 1.1s infinite ease-in-out !important;
      z-index: 50 !important;
    }

    /* ======================================================== */
    /* 📊 統計棒形圖 (Bar Chart) 專屬樣式 */
    /* ======================================================== */
    .chart-container-card {
      background: white;
      border-radius: 18px;
      padding: 16px 20px;
      margin: 18px auto 22px;
      border: 2px solid #E2E8F0;
      box-shadow: 0 4px 14px rgba(0,0,0,0.04);
      max-width: 960px;
    }
    .chart-header {
      display: flex;
      justify-content: space-between;
      align-items: center;
      margin-bottom: 14px;
      flex-wrap: wrap;
      gap: 8px;
    }
    .chart-title {
      font-size: 15px;
      font-weight: 900;
      color: #1E3A8A;
      display: flex;
      align-items: center;
      gap: 6px;
    }
    .chart-bars-wrap {
      display: flex;
      justify-content: space-around;
      align-items: flex-end;
      height: 145px;
      padding: 10px 14px 0;
      border-bottom: 2.5px solid #CBD5E1;
      gap: 16px;
    }
    .chart-bar-col {
      flex: 1;
      display: flex;
      flex-direction: column;
      align-items: center;
      height: 100%;
      justify-content: flex-end;
    }
    .chart-bar-val {
      font-size: 13px;
      font-weight: 900;
      color: #1E3A8A;
      margin-bottom: 4px;
    }
    .chart-bar-pillar {
      width: 100%;
      max-width: 46px;
      border-radius: 8px 8px 0 0;
      transition: height 0.8s cubic-bezier(0.34, 1.56, 0.64, 1);
      box-shadow: 0 2px 6px rgba(0,0,0,0.08);
      min-height: 12px;
    }
    .chart-bar-label {
      margin-top: 8px;
      font-size: 13px;
      font-weight: 900;
      color: #334155;
    }


    /* ======================================================== */
    /* 📱 手機端自動適配 (P6 Mobile Responsive Layout) */
    /* ======================================================== */
    @media (max-width: 768px) {
      .nav-container {
        flex-direction: column !important;
        align-items: stretch !important;
        gap: 6px !important;
      }
      .tab-bar {
        justify-content: center !important;
        flex-wrap: wrap !important;
      }
      .action-tools {
        width: 100% !important;
        justify-content: center !important;
      }
      .search-box, .search-input {
        width: 100% !important;
        max-width: 100% !important;
      }
      .game-box {
        width: 96% !important;
        max-width: 96% !important;
        padding: 8px 10px !important;
        margin: 6px auto !important;
      }
      .trainer-header-bar {
        flex-direction: column !important;
        align-items: stretch !important;
        gap: 6px !important;
        padding: 6px 8px !important;
      }
      .trainer-actions {
        display: flex !important;
        justify-content: space-between !important;
        width: 100% !important;
        gap: 4px !important;
      }
      .trainer-actions .btn-hub {
        flex: 1 !important;
        text-align: center !important;
        justify-content: center !important;
        padding: 4px 6px !important;
        font-size: 11px !important;
      }
      .mode-tab-bar {
        gap: 4px !important;
        margin: 4px auto 6px !important;
      }
      .mode-tab-btn {
        flex-direction: column !important;
        padding: 5px 2px !important;
        font-size: 11px !important;
        gap: 2px !important;
        white-space: normal !important;
        text-align: center !important;
      }
      .mode-badge-pill {
        font-size: 9px !important;
        padding: 1px 4px !important;
      }
      .target-monster-badge {
        font-size: 28px !important;
      }
      .target-word {
        font-size: 40px !important;
      }
      .input-slots-row {
        gap: 6px !important;
        /* 讓 4 格平均分配容器寬度，而不是各自撐到 min-width */
        flex-wrap: nowrap !important;
        padding: 0 4px;
      }
      .code-slot {
        /* min-width 必須一起歸零：原規則寫死 140px，只覆寫 width 沒用，
           min-width 會勝出，4 格就把 320px 螢幕撐爆。 */
        min-width: 0 !important;
        flex: 1 1 0 !important;
        max-width: 72px;
        height: 44px !important;
        padding: 2px 3px !important;
        border-radius: 8px !important;
      }
      .code-slot-label {
        font-size: 8.5px !important;
        /* 標籤在窄格裡可能比格子還寬，讓它自己縮而不是撐開格子 */
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
      }
      .code-slot-val {
        font-size: 16px !important;
      }
      .split-slots-container {
        gap: 6px !important;
        flex-wrap: wrap !important;
        justify-content: center !important;
      }
      .split-slot-group {
        padding: 4px 6px !important;
        border-radius: 10px !important;
      }
      .split-group-slots {
        gap: 4px !important;
      }
      .split-group-header {
        font-size: 10px !important;
      }
      .capture-arena-container {
        height: 220px !important;
        touch-action: manipulation !important;
      }
      .poke-orb {
        width: 58px !important;
        height: 58px !important;
        touch-action: manipulation !important;
        -webkit-tap-highlight-color: transparent !important;
      }
      .poke-orb-center-ring {
        width: 18px !important;
        height: 18px !important;
      }
      .poke-orb-char {
        font-size: 20px !important;
      }
      .podium-container {
        flex-direction: column !important;
        align-items: stretch !important;
      }
      .podium-step {
        height: auto !important;
        margin-bottom: 8px !important;
        order: initial !important;
      }
      .rank-card {
        padding: 8px 10px !important;
        gap: 6px !important;
      }
      .modal-content {
        width: 95% !important;
        max-width: 95% !important;
        padding: 12px 10px !important;
        border-radius: 16px !important;
      }
    }

    @media (max-width: 480px) {
      .hero-banner {
        padding: 8px 10px !important;
      }
      h1.title {
        font-size: 17px !important;
      }
      p.subtitle {
        font-size: 10.5px !important;
      }
      .stats-bar {
        display: none !important;
      }
      .tab-btn {
        padding: 4px 8px !important;
        font-size: 11px !important;
      }
      .mode-tab-btn {
        font-size: 10px !important;
        padding: 4px 1px !important;
      }
      .capture-arena-container {
        height: 200px !important;
      }
      .poke-orb {
        width: 52px !important;
        height: 52px !important;
      }
      .poke-orb-char {
        font-size: 18px !important;
      }
      /* 320–480px：4 格字碼最容易溢出。格子再縮一階、間距收緊，
         確保 320px 上 4 格加間距仍放得下（4×64 + 3×6 = 274 < 320-32 padding）。 */
      .input-slots-row {
        gap: 4px !important;
      }
      .code-slot {
        max-width: 64px;
        height: 40px !important;
        padding: 1px 2px !important;
      }
      .code-slot-label {
        font-size: 7.5px !important;
        letter-spacing: -.02em;
      }
      .code-slot-val {
        font-size: 14px !important;
      }
      /* 手速賽的計時/進度長條在這尺寸也會擠壓 */
      #speed-arena-section {
        overflow: visible !important;
      }
      /* 各班平均分的柱狀圖：6 欄 × (34px + 16px gap) = 284px，
         但 320px 螢幕扣掉卡片內距只剩 246px，標籤會超出 13px。
         間距不能壓縮（flex gap 是固定值），所以在窄螢幕改小。 */
      .chart-container-card {
        padding: 12px 8px;
      }
      .chart-bars-wrap {
        gap: 4px;
        padding: 8px 2px 0;
      }
      .chart-bar-label {
        font-size: 11px;
      }
    }

    /* ======================================================== */
    /* 🌟 六年級榜單：第4-10名 & 各班前3名 炫彩流光閃爍特效 */
    /* ======================================================== */
    @keyframes elitePulseGlow {
      0% {
        box-shadow: 0 0 8px rgba(245, 158, 11, 0.45), 0 0 0 2px #F59E0B;
        border-color: #F59E0B;
      }
      50% {
        box-shadow: 0 0 22px rgba(239, 68, 68, 0.75), 0 0 0 3.5px #EF4444;
        border-color: #EF4444;
      }
      100% {
        box-shadow: 0 0 8px rgba(245, 158, 11, 0.45), 0 0 0 2px #F59E0B;
        border-color: #F59E0B;
      }
    }
    @keyframes eliteBgShimmer {
      0% { background: linear-gradient(135deg, #FFFDF5 0%, #FEF3C7 100%); }
      50% { background: linear-gradient(135deg, #FFF1F2 0%, #FED7AA 100%); }
      100% { background: linear-gradient(135deg, #FFFDF5 0%, #FEF3C7 100%); }
    }
    .rank-card-elite-flash {
      position: relative !important;
      animation: elitePulseGlow 2.2s infinite ease-in-out, eliteBgShimmer 4s infinite ease-in-out !important;
      border: 2px solid #F59E0B !important;
      overflow: visible !important;
    }
    .badge-elite-top10 {
      background: linear-gradient(90deg, #F59E0B 0%, #EF4444 100%);
      color: white;
      font-size: 10px;
      font-weight: 900;
      padding: 2px 7px;
      border-radius: 10px;
      box-shadow: 0 2px 5px rgba(239, 68, 68, 0.35);
      display: inline-flex;
      align-items: center;
      gap: 3px;
      margin-left: 6px;
      animation: badgePulseAnim 1.8s infinite ease-in-out;
    }

    /* 各班前 10 名之第 1 名（冠軍）：黃金熾熱光環閃爍 */
    @keyframes classTop1Pulse {
      0% {
        box-shadow: 0 0 8px rgba(245, 158, 11, 0.5), 0 0 0 2.5px #F59E0B;
        border-color: #F59E0B;
      }
      50% {
        box-shadow: 0 0 24px rgba(234, 179, 8, 0.9), 0 0 0 4px #EAB308;
        border-color: #EAB308;
      }
      100% {
        box-shadow: 0 0 8px rgba(245, 158, 11, 0.5), 0 0 0 2.5px #F59E0B;
        border-color: #F59E0B;
      }
    }
    .rank-card-class-champion {
      position: relative !important;
      background: linear-gradient(135deg, #FFFDF5 0%, #FEF3C7 100%) !important;
      animation: classTop1Pulse 2s infinite ease-in-out !important;
      border: 2.5px solid #F59E0B !important;
      overflow: visible !important;
    }

    /* 各班前 10 名之第 2 名（亞軍）：蔚藍銀光呼吸閃爍 */
    @keyframes classTop2Pulse {
      0% {
        box-shadow: 0 0 8px rgba(59, 130, 246, 0.45), 0 0 0 2px #3B82F6;
        border-color: #3B82F6;
      }
      50% {
        box-shadow: 0 0 20px rgba(96, 165, 250, 0.85), 0 0 0 3.5px #60A5FA;
        border-color: #60A5FA;
      }
      100% {
        box-shadow: 0 0 8px rgba(59, 130, 246, 0.45), 0 0 0 2px #3B82F6;
        border-color: #3B82F6;
      }
    }
    .rank-card-class-runnerup {
      position: relative !important;
      background: linear-gradient(135deg, #F0F9FF 0%, #E0F2FE 100%) !important;
      animation: classTop2Pulse 2.3s infinite ease-in-out !important;
      border: 2px solid #3B82F6 !important;
      overflow: visible !important;
    }

    /* 各班前 10 名之第 3 名（季軍）：曜石古銅光彩閃爍 */
    @keyframes classTop3Pulse {
      0% {
        box-shadow: 0 0 8px rgba(217, 119, 6, 0.45), 0 0 0 2px #D97706;
        border-color: #D97706;
      }
      50% {
        box-shadow: 0 0 20px rgba(249, 115, 22, 0.8), 0 0 0 3.5px #F97316;
        border-color: #F97316;
      }
      100% {
        box-shadow: 0 0 8px rgba(217, 119, 6, 0.45), 0 0 0 2px #D97706;
        border-color: #D97706;
      }
    }
    .rank-card-class-third {
      position: relative !important;
      background: linear-gradient(135deg, #FFFBEB 0%, #FFEDD5 100%) !important;
      animation: classTop3Pulse 2.6s infinite ease-in-out !important;
      border: 2px solid #D97706 !important;
      overflow: visible !important;
    }

    .badge-class-honor {
      color: white;
      font-size: 10px;
      font-weight: 900;
      padding: 2px 7px;
      border-radius: 10px;
      display: inline-flex;
      align-items: center;
      gap: 3px;
      margin-left: 6px;
      box-shadow: 0 2px 5px rgba(0,0,0,0.15);
      animation: badgePulseAnim 2s infinite ease-in-out;
    }
    .badge-class-honor.gold {
      background: linear-gradient(90deg, #F59E0B 0%, #EAB308 100%);
    }
    .badge-class-honor.silver {
      background: linear-gradient(90deg, #3B82F6 0%, #60A5FA 100%);
    }
    .badge-class-honor.bronze {
      background: linear-gradient(90deg, #D97706 0%, #F97316 100%);
    }
    @keyframes badgePulseAnim {
      0%, 100% { transform: scale(1); opacity: 1; }
      50% { transform: scale(1.06); opacity: 0.9; }
    }

  
    /* ========================================== */
    /* ⚡ 模式 2：倉頡 10 字極速鍵盤手速賽專用樣式 */
    /* ========================================== */
    .speed-arena-container {
      background: linear-gradient(135deg, #0F172A 0%, #1E293B 100%);
      border: 3px solid #3B82F6;
      border-radius: 20px;
      padding: 22px 18px;
      margin: 14px 0;
      color: white;
      text-align: center;
      position: relative;
      overflow: hidden;
      box-shadow: 0 10px 30px rgba(15, 23, 42, 0.4);
    }
    .speed-header-bar {
      display: flex;
      justify-content: space-between;
      align-items: center;
      flex-wrap: wrap;
      gap: 10px;
      margin-bottom: 16px;
      padding-bottom: 12px;
      border-bottom: 1px solid rgba(255, 255, 255, 0.15);
    }
    .speed-progress-dots {
      display: flex;
      gap: 6px;
      align-items: center;
    }
    .speed-dot {
      width: 14px;
      height: 14px;
      border-radius: 50%;
      background: #334155;
      border: 1.5px solid #64748B;
      transition: all 0.3s;
    }
    .speed-dot.active {
      background: #FACC15;
      border-color: #FEF08A;
      box-shadow: 0 0 10px #FACC15;
      transform: scale(1.25);
    }
    .speed-dot.done {
      background: #10B981;
      border-color: #34D399;
    }
    .speed-clock-box {
      font-family: 'Calibri', monospace;
      font-size: 28px;
      font-weight: 900;
      color: #38BDF8;
      text-shadow: 0 0 12px rgba(56, 189, 248, 0.6);
      background: rgba(0, 0, 0, 0.4);
      padding: 4px 16px;
      border-radius: 12px;
      border: 1.5px solid #0284C7;
      display: inline-flex;
      align-items: center;
      gap: 8px;
    }
    .speed-clock-penalty {
      font-size: 13px;
      color: #F87171;
      font-weight: 800;
      margin-left: 6px;
    }
    .speed-target-char-box {
      font-size: 76px;
      font-weight: 900;
      color: #F8FAFC;
      letter-spacing: 2px;
      margin: 10px 0;
      text-shadow: 0 4px 20px rgba(255, 255, 255, 0.3);
      animation: pulseChar 1.8s ease-in-out infinite;
    }
    @keyframes pulseChar {
      0%, 100% { transform: scale(1); }
      50% { transform: scale(1.04); }
    }
    .speed-slots-row {
      display: flex;
      justify-content: center;
      gap: 12px;
      margin: 18px 0;
      flex-wrap: wrap;
    }
    .speed-key-slot {
      width: 72px;
      height: 72px;
      border-radius: 14px;
      background: rgba(255, 255, 255, 0.08);
      border: 2.5px dashed #64748B;
      display: flex;
      flex-direction: column;
      align-items: center;
      justify-content: center;
      transition: all 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
      position: relative;
    }
    .speed-key-slot.current {
      border: 2.5px solid #38BDF8;
      background: rgba(56, 189, 248, 0.15);
      box-shadow: 0 0 15px rgba(56, 189, 248, 0.5);
      transform: scale(1.08);
    }
    .speed-key-slot.filled {
      border: 2.5px solid #10B981;
      background: rgba(16, 185, 129, 0.2);
      box-shadow: 0 0 12px rgba(16, 185, 129, 0.4);
      transform: scale(1.02);
    }
    .speed-key-slot.hint-glow {
      border: 2.5px solid #F59E0B !important;
      background: rgba(245, 158, 11, 0.25) !important;
      box-shadow: 0 0 18px #F59E0B !important;
      animation: breatheGlow 1.2s ease-in-out infinite;
    }
    @keyframes breatheGlow {
      0%, 100% { transform: scale(1.08); box-shadow: 0 0 12px #F59E0B; }
      50% { transform: scale(1.14); box-shadow: 0 0 22px #FBBF24; }
    }
    .speed-slot-code {
      font-size: 24px;
      font-weight: 900;
      color: #F8FAFC;
    }
    .speed-slot-sub {
      font-size: 11px;
      font-weight: 700;
      color: #94A3B8;
      margin-top: 2px;
    }
    .speed-slot-hint-text {
      font-size: 12px;
      font-weight: 800;
      color: #FBBF24;
    }
    .speed-notice-text {
      font-size: 13.5px;
      color: #94A3B8;
      margin-top: 10px;
    }
    .speed-notice-text strong {
      color: #FACC15;
    }
    .shake-error {
      animation: shakeAnim 0.4s cubic-bezier(0.36, 0.07, 0.19, 0.97) both !important;
      border-color: #EF4444 !important;
    }
    @keyframes shakeAnim {
      10%, 90% { transform: translate3d(-2px, 0, 0); }
      20%, 80% { transform: translate3d(4px, 0, 0); }
      30%, 50%, 70% { transform: translate3d(-6px, 0, 0); }
      40%, 60% { transform: translate3d(6px, 0, 0); }
    }
    .floating-penalty-tag {
      position: absolute;
      top: 35%;
      left: 50%;
      transform: translate(-50%, -50%);
      font-size: 26px;
      font-weight: 900;
      color: #EF4444;
      text-shadow: 0 2px 8px rgba(0,0,0,0.8), 0 0 12px #DC2626;
      pointer-events: none;
      z-index: 999;
      animation: floatUpFade 0.8s ease-out forwards;
    }
    @keyframes floatUpFade {
      0% { opacity: 0; transform: translate(-50%, 0) scale(0.7); }
      30% { opacity: 1; transform: translate(-50%, -20px) scale(1.15); }
      100% { opacity: 0; transform: translate(-50%, -50px) scale(1); }
    }
    .floating-deduct-tag {
      position: absolute;
      font-size: 20px;
      font-weight: 900;
      color: #EF4444;
      text-shadow: 0 2px 6px rgba(0,0,0,0.6);
      pointer-events: none;
      z-index: 999;
      animation: floatUpFadeDeduct 0.9s ease-out forwards;
    }
    @keyframes floatUpFadeDeduct {
      0% { opacity: 0; transform: translateY(0) scale(0.8); }
      25% { opacity: 1; transform: translateY(-15px) scale(1.2); }
      100% { opacity: 0; transform: translateY(-40px) scale(1); }
    }
    .lb-sub-nav-bar {
      display: flex;
      justify-content: center;
      gap: 10px;
      margin: 10px auto 14px;
    }
    .lb-sub-nav-btn {
      background: #F1F5F9;
      border: 1.5px solid #CBD5E1;
      padding: 6px 14px;
      border-radius: 20px;
      font-size: 13px;
      font-weight: 800;
      color: #475569;
      cursor: pointer;
      transition: all 0.2s;
    }
    .lb-sub-nav-btn.active {
      background: #2563EB;
      color: white;
      border-color: #1D4ED8;
      box-shadow: 0 2px 8px rgba(37, 99, 235, 0.3);
    }

  
    /* 🎨 修復按鈕與卡片對比度，徹底避免文字底色相近 */
    .btn-action-speed-restart {
      background: linear-gradient(135deg, #2563EB 0%, #1D4ED8 100%) !important;
      color: #FFFFFF !important;
      border: 1.5px solid #60A5FA !important;
      text-shadow: 0 1px 2px rgba(0,0,0,0.6) !important;
      box-shadow: 0 4px 12px rgba(37,99,235,0.4) !important;
      padding: 10px 22px !important;
      font-size: 14px !important;
      font-weight: 800 !important;
      border-radius: 25px !important;
      cursor: pointer !important;
      display: inline-flex !important;
      align-items: center !important;
      gap: 7px !important;
      transition: all 0.2s !important;
    }
    .btn-action-speed-restart:hover {
      background: linear-gradient(135deg, #1D4ED8 0%, #1E40AF 100%) !important;
      transform: translateY(-2px) !important;
      box-shadow: 0 6px 16px rgba(37,99,235,0.6) !important;
    }
    .btn-action-speed-lb {
      background: linear-gradient(135deg, #D97706 0%, #B45309 100%) !important;
      color: #FFFFFF !important;
      border: 1.5px solid #FCD34D !important;
      text-shadow: 0 1px 2px rgba(0,0,0,0.6) !important;
      box-shadow: 0 4px 12px rgba(217,119,6,0.4) !important;
      padding: 10px 22px !important;
      font-size: 14px !important;
      font-weight: 800 !important;
      border-radius: 25px !important;
      cursor: pointer !important;
      display: inline-flex !important;
      align-items: center !important;
      gap: 7px !important;
      transition: all 0.2s !important;
    }
    .btn-action-speed-lb:hover {
      background: linear-gradient(135deg, #B45309 0%, #92400E 100%) !important;
      transform: translateY(-2px) !important;
      box-shadow: 0 6px 16px rgba(217,119,6,0.6) !important;
    }

    /* 空白鍵確認提示列 */
    .speed-space-prompt {
      margin: 12px auto 4px auto;
      max-width: 540px;
      background: linear-gradient(135deg, rgba(16, 185, 129, 0.22), rgba(5, 150, 105, 0.38));
      border: 2px solid #34D399;
      border-radius: 30px;
      padding: 9px 18px;
      display: flex;
      align-items: center;
      justify-content: center;
      gap: 10px;
      cursor: pointer;
      box-shadow: 0 0 18px rgba(52, 211, 153, 0.35);
      animation: pulseSpaceGlow 1.2s infinite alternate ease-in-out;
      transition: all 0.2s;
    }
    .speed-space-prompt:hover {
      transform: scale(1.02);
      border-color: #6EE7B7;
      box-shadow: 0 0 25px rgba(52, 211, 153, 0.6);
    }
    @keyframes pulseSpaceGlow {
      0% { transform: scale(0.985); box-shadow: 0 0 10px rgba(52, 211, 153, 0.25); border-color: #34D399; }
      100% { transform: scale(1.015); box-shadow: 0 0 22px rgba(52, 211, 153, 0.6); border-color: #A7F3D0; }
    }
    .space-key-pill {
      background: #10B981;
      color: #FFFFFF !important;
      font-weight: 900;
      font-size: 13px;
      padding: 4px 13px;
      border-radius: 14px;
      box-shadow: 0 2px 6px rgba(0,0,0,0.3);
      letter-spacing: 0.5px;
      white-space: nowrap;
    }
    .space-prompt-text {
      color: #ECFDF5;
      font-size: 13px;
      font-weight: 800;
      text-shadow: 0 1px 3px rgba(0,0,0,0.8);
    }

  
    /* 🚀 模式 2 備戰大廳與按鈕樣式 */
    .btn-action-speed-launch {
      background: linear-gradient(135deg, #10B981 0%, #059669 100%) !important;
      color: #FFFFFF !important;
      border: 1.5px solid #6EE7B7 !important;
      text-shadow: 0 1px 2px rgba(0,0,0,0.6) !important;
      box-shadow: 0 4px 14px rgba(16, 185, 129, 0.4) !important;
      padding: 12px 28px !important;
      font-size: 16px !important;
      font-weight: 900 !important;
      border-radius: 30px !important;
      cursor: pointer !important;
      display: inline-flex !important;
      align-items: center !important;
      gap: 8px !important;
      transition: all 0.2s !important;
      letter-spacing: 0.5px;
      animation: pulseLaunchGlow 1.8s infinite alternate ease-in-out;
    }
    .btn-action-speed-launch:hover {
      background: linear-gradient(135deg, #059669 0%, #047857 100%) !important;
      transform: translateY(-2px) scale(1.03) !important;
      box-shadow: 0 6px 20px rgba(16, 185, 129, 0.6) !important;
    }
    @keyframes pulseLaunchGlow {
      0% { box-shadow: 0 4px 14px rgba(16, 185, 129, 0.4); }
      100% { box-shadow: 0 6px 24px rgba(52, 211, 153, 0.7); }
    }

    /* 手速榜專用雙重篩選列 */
    .speed-lb-filter-row {
      display: flex;
      align-items: center;
      gap: 8px;
      flex-wrap: wrap;
      margin-bottom: 8px;
      padding: 6px 12px;
      background: #F8FAFC;
      border-radius: 12px;
      border: 1px solid #E2E8F0;
    }
    .lb-sub-pill {
      background: white;
      border: 1.5px solid #CBD5E1;
      padding: 4px 12px;
      border-radius: 16px;
      font-size: 12px;
      font-weight: 800;
      color: #475569;
      cursor: pointer;
      transition: all 0.2s;
    }
    .lb-sub-pill:hover {
      border-color: #38BDF8;
      color: #0284C7;
    }
    .lb-sub-pill.active {
      background: #0284C7;
      color: white !important;
      border-color: #0369A1;
      box-shadow: 0 2px 6px rgba(2, 132, 199, 0.35);
    }

/* 🛡️ 徹底防禦符號豆腐塊（正方形）：強制 Emoji 獨立使用彩色表情符號字型並解除粗體攔截 */
.emoji-icon, .crown-banner, .crown-banner span, .trainer-badge-icon, #lb-my-badge {
  font-family: "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji", "Segoe UI Symbol", sans-serif !important;
  font-weight: normal !important;
  font-style: normal !important;
  display: inline-block;
  vertical-align: middle;
  line-height: 1;
}

.st-name .emoji-icon {
  font-size: 16px;
  vertical-align: -2px;
  margin-right: 3px;
}

.badge-class-honor .emoji-icon {
  font-size: 12px;
  vertical-align: -1px;
  margin-right: 2px;
}


/* ==========================================================================
   ♿ / 📐 P6 打字遊戲：樣式與標記修復（可及性 + 排版）
   以下規則一律置於檔案最後，並使用 !important —— 本檔前面已有大量
   !important 規則，唯有「同重要度、後出現者勝」才能穩定覆蓋。
   ========================================================================== */

/* ==========================================================================
   1. touch-target-small：**已知、經使用者決定不修（保留在報告中）**
   --------------------------------------------------------------------------
   原本這裡有一組 `min-height: 44px !important`，用來把窄螢幕上偏矮的可點
   元素（最矮 23px）撐到 WCAG 2.5.8 / Apple HIG 建議的 44×44。

   但使用者明確要求「所有功能、所有按鍵狀態切換、主題樣式都要和官方一樣，
   僅僅是修 bug」，且「手機電腦都別變大」。`min-height` 會讓頁籤列在 390px
   從 101px 變成 164px、桌機從 50px 變成 60px，屬於改變官方外觀的產品決策
   而非 bug 修復；也試過用 `::after` 覆蓋式熱區，但 `.lb-filter-btn`（官方
   僅 27px 高且緊鄰排列）往外擴會上下各溢出約 8.5px，蓋到隔壁列的可點元素
   造成點擊被搶 —— 那是比尺寸更嚴重的功能回歸，因此放棄。

   結論：幾何完全還原成官方，本條不再提供任何樣式。
   ========================================================================== */

/* 表格橫向捲動容器要用鍵盤操作，44px 指「可聚焦」不需高度，
   但 focus ring 要看得見（見下方第 3 節）。 */

/* ==========================================================================
   2. fold-line：壓縮上方留白，讓 #capture-arena 盡量落進首屏
   --------------------------------------------------------------------------
   教室投影機是 1440×768，原本 #capture-arena 的 top = 785 > 768，
   完全看不到抓寶區（要往下捲）。
   這裡只收「區塊之間的留白」與裝飾性留白，不動字級、配色、卡片結構，
   所以不影響可讀性。桌面與手機分開調，因為兩邊的留白來源不同。
   ========================================================================== */
@media (min-width: 769px) {
  /* 頂部裝飾橫幅：237px 全是留白堆出來的 */
  .hero-banner { padding: 12px 20px 12px !important; }
  .pokemon-trio { margin-bottom: 2px !important; }
  h1.title { margin-bottom: 2px !important; }
  .stats-bar { margin-top: 8px !important; }

  /* 導覽列上下各 18px 的 margin 純屬多餘 */
  .nav-container { margin: 8px auto !important; }

  /* 三個模式按鈕：官方是 flex-wrap: nowrap + max-width: 900px，三顆按鈕的
     min-content 總寬 923px（實測 296/338/289）+ gap 20px = 943px，本來就超出
     900px 的 bar；而 bar 沒有背景、又居中對齊，所以在**夠寬的螢幕上**
     （需 ≥989px）視覺上完全看不出來，官方就是這個樣子。

     ⚠️ 這段註解原本寫「本版較新的修訂把它改成 flex-wrap: wrap……副作用是
     第三顆被擠到第二行、bar 從 34px 變成 76px」，並指向一個
     `@media (min-width: 930px)` —— **那個寫法與那個 media 都已經不存在**。
     現行做法在檔尾：`@media (min-width: 769px) and (max-width: 988px)`
     （隱藏次要徽章 + 線性縮放，維持單列、列高不變），以及
     `@media (min-width: 989px)` 完整還原官方幾何。

     **保留這段修訂記錄是因為它本身就是一個實例：註解比程式碼更早過時，
     而過時的註解會讓人照著不存在的規則去理解版面。** 這裡只調整 margin
     （屬 fold-line 修復），不影響按鈕尺寸。 */
  .mode-tab-bar {
    margin: 6px auto 6px !important;
  }

  /* 訓練家資訊列：徽章字級是列高的來源 */
  .trainer-badge-icon { font-size: 22px !important; }
  .trainer-header-bar { padding: 5px 12px !important; margin-bottom: 6px !important; }

  /* 目標字卡與槽位：只收 margin，字級不動（學生要看得清楚） */
  .stage-status-bar { margin-bottom: 4px !important; }
  #target-sub-hint { margin-bottom: 2px !important; }
  .game-prompt { margin-bottom: 6px !important; }
  .input-slots-row { margin-bottom: 6px !important; }
  .capture-arena-container { margin-top: 6px !important; margin-bottom: 6px !important; }
}

@media (max-width: 768px) {
  /* 手機／小平板：只壓縮「垂直」留白。水平 padding 一律維持官方值，
     因此 .hero-banner 不在這裡處理，改用下方兩個與官方斷點對齊的區塊。 */
  .pokemon-trio { margin-bottom: 2px !important; }
  h1.title { margin-bottom: 2px !important; }
  .nav-container { margin: 6px auto !important; }
  .stage-status-bar { margin-bottom: 4px !important; }
  #target-sub-hint { margin-bottom: 2px !important; }
  .game-prompt { margin-bottom: 4px !important; }
  .input-slots-row { margin-bottom: 4px !important; }
  .capture-arena-container { margin-top: 4px !important; margin-bottom: 4px !important; }
}

/* hero 的水平 padding 依官方斷點分段還原（官方 css/style.css:1822 的
   @media (max-width: 480px) 才是手機版 padding: 8px 10px !important；
   481–768px 仍沿用桌面的 26px 20px 22px 20px）。這裡只把「上下」收掉，
   左右完全照官方 —— 否則 .pokemon-trio / h1.title 會被左右各擠窄 10px
   （實測 600px：官方 560px，誤用 10px 會變成 580px）。 */
@media (max-width: 480px) {
  .hero-banner { padding: 4px 10px 4px !important; }   /* 官方：8px 10px */
}
@media (min-width: 481px) and (max-width: 768px) {
  .hero-banner { padding: 12px 20px 12px !important; } /* 官方：26px 20px 22px 20px */
}

/* 769–988px：官方在這個區間把「模式 1／2／3」三顆按鈕裁掉。
   實測（本次探針，已通過正向對照）：
     視窗   769   800   820   850   900   929   930   940
     官方溢出 81px 65px 55px 40px 15px  1px  0*    2px      （* 被 body overflow-x:hidden 裁掉）
   量到最左按鈕 `left = -4px`（930px）代表**左邊被切掉、且因為 body 是
   `overflow-x: hidden`，連橫向捲動都救不回來** —— 學生看不到「模式 1」的開頭。

   成因（實測 computed 值，不是推導）：
     .mode-tab-btn 在 >768px 的生效值是 padding: 6px 10px、font-size: 13px、
     white-space: nowrap，且**基礎規則就有 `flex: 1 1 0 !important`**。
     `flex-shrink` 無法把元素縮到 `min-width: auto`（＝內容最小寬）以下，
     而 nowrap 讓最小寬＝整段文字寬，所以三顆按鈕**固定佔 927px**，
     即使容器只有 864px（930px 視窗）也不會縮，只是被裁掉。

   為什麼不是「把字縮小就好」：單列要塞進 769px 的容器（703px），
   三顆按鈕的**文字**必須縮到約 8.3px —— 學生讀不清，違背修 bug 的本意。

   使用者裁定「根據屏幕的大小動態調整」。這裡的做法是**先移除次要資訊、
   再線性縮放**，並**完全不改變垂直內距（固定 6px＝官方值）**，所以列高不變：
     ① 769–988px 隱藏 `.mode-badge-pill`（「1~4碼連擊／10字 極速秒數天梯／
        X難字/複合」三個徽章，合計 279px）。它們是次要提示，模式名稱才是主體。
     ② 字級沿 769→900px 由 11.8px 線性回到官方 13px，橫向內距 8→10px。
   驗算（實測反推）：769px 容器 703px，需 766px → 縮字後 ≈ 674×(11.8/13)+88 = 700px ✓
                     900px 容器 834px，官方原尺寸 766px ✓
   所以 769px 起全程無裁切、無折行、**列高與官方同為 34–35px**。

   ⚠️ 這是「與官方不同」的一項（官方在該區間顯示徽章但按鈕被裁）。
      判斷依據同修復 47：官方這裡是缺陷，修掉它優先於逐像素相同。
      若使用者要求徽章一律可見，替代方案是讓列折成兩行（+42px 高）——
      已量測，兩者不可兼得，取捨記錄於 FIXES.md。 */
@media (min-width: 769px) and (max-width: 988px) {
  .mode-tab-bar {
    flex-wrap: nowrap !important;
    max-width: 100% !important;
    gap: clamp(8px, calc(8px + (100vw - 769px) * 0.01527), 10px) !important;
  }
  .mode-tab-btn {
    /* 垂直內距維持官方的 6px —— 這是「列高不變」的關鍵 */
    padding: 6px clamp(8px, calc(8px + (100vw - 769px) * 0.01527), 10px) !important;
    /* 11.8px（769px）→ 13px（900px，官方值）；900px 以上維持 13px */
    font-size: clamp(11.8px, calc(11.8px + (100vw - 769px) * 0.00916), 13px) !important;
    /* 官方本來就是 nowrap；保留它，避免文字在鈕內折行導致鈕高增加 */
    white-space: nowrap !important;
  }
  /* 次要徽章在放不下的區間隱藏，讓模式名稱保持可讀字級 */
  .mode-badge-pill {
    display: none !important;
  }
}

/* ≥989px：官方從 989px 起三顆按鈕（含徽章）才真正完整放得下
   （容器需 923px + 內距；實測 1024px 溢出 0、940px 仍溢 2px），
   所以 989px 以上完整還原官方幾何 —— nowrap + max-width: 900px，
   三顆按鈕寬度、徽章與列高都與官方一模一樣（296/338/289、列高 34–35px）。 */
@media (min-width: 989px) {
  .mode-tab-bar {
    flex-wrap: nowrap !important;
    max-width: 900px !important;
  }
}

/* ==========================================================================
   3. modal-table-scroll：排行榜表格的「可橫向捲動」提示
   --------------------------------------------------------------------------
   原本那個容器只有 inline 的 max-height + overflow-y，375px 手機上
   表格寬 353px、容器只有 295px，右邊兩欄（討伐總分／擊倒魔王）被截掉
   卻毫無提示。這裡用純 CSS 的 scroll-shadow 漸層做視覺暗示
   （文字提示寫在 index.html，不依賴顏色）。
   ========================================================================== */
.lb-scroll-hint {
  font-size: 12px;
  font-weight: 800;
  color: #1D4ED8;
  background: #EFF6FF;
  border: 1.5px solid #BFDBFE;
  border-radius: 10px;
  padding: 6px 12px;
  margin: 0 0 8px;
  text-align: center;
}
.lb-table-scroll {
  max-height: 400px;
  overflow: auto;
  -webkit-overflow-scrolling: touch;
  border-radius: 10px;
  scrollbar-width: thin;
  /* 捲動陰影：左右兩側的深色漸層只在「還有內容可捲」時蓋在文字上，
     中間的白色漸層（local）負責在捲到底時把陰影遮掉 —— 這是純 CSS
     讓提示自動消失的標準做法。 */
  background:
    linear-gradient(to right, #FFFFFF 30%, rgba(255,255,255,0)) left center / 40px 100% no-repeat local,
    linear-gradient(to left, #FFFFFF 30%, rgba(255,255,255,0)) right center / 40px 100% no-repeat local,
    radial-gradient(farthest-side at 0% 50%, rgba(15, 23, 42, 0.18), rgba(15, 23, 42, 0)) left center / 14px 100% no-repeat scroll,
    radial-gradient(farthest-side at 100% 50%, rgba(15, 23, 42, 0.18), rgba(15, 23, 42, 0)) right center / 14px 100% no-repeat scroll;
}
/* 讓捲動區用鍵盤 Tab 進來時有明顯焦點框 */
.lb-table-scroll:focus-visible {
  outline: 3px solid #2563EB;
  outline-offset: 2px;
}

/* ==========================================================================
   4. chart-min-height：0 人班級不該畫出 12% 高的柱子
   --------------------------------------------------------------------------
   根因：app.js buildBarChartHtml() 用 Math.max(12, …) 當下限，
   再以 inline style 寫 height: 12%（js/app.js:471、475）。
   為了不動 Lead 的獨佔檔 js/app.js，這裡用「title 屬性結尾」精準選到
   0 人的柱子：title 格式固定是 `${cls}：${val} 人`。
   作者樣式表裡的 !important 可以覆蓋 inline style（cascade 順序：
   author !important > inline normal），所以不需要改 JS。
   柱高歸零後，班級名稱仍由下方 .chart-bar-label 顯示，資訊不流失。
   ========================================================================== */
.chart-bar-pillar[title$="：0 人"] {
  height: 0 !important;
  min-height: 0 !important;
  box-shadow: none !important;
}
