/* ================================================
   SportHub — Game Page Styles (3D 蓄力射門)
   全部 selector 以 #page-game 為前綴，防止與主站衝突
   ================================================ */

/* ─── Login Required Card ─── */
#page-game .sg-login-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 40px 24px;
  text-align: center;
  min-height: 240px;
}
#page-game .sg-login-card .sg-login-icon {
  font-size: 40px;
  line-height: 1;
}
#page-game .sg-login-card h3 {
  margin: 0 0 6px;
  font-size: 18px;
  font-weight: 800;
}
#page-game .sg-login-card p {
  margin: 0;
  font-size: 14px;
  color: var(--text-muted);
  line-height: 1.6;
}

/* ─── Loading State ─── */
#page-game .sg-loading-state {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 48px 24px;
  font-size: 14px;
  color: var(--text-muted);
  min-height: 200px;
}

/* ─── Page Title Row ─── */
#page-game .sg-page-title-row {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 8px 6px 6px;
  font-size: 15px;
  font-weight: 800;
  letter-spacing: 0.4px;
}

/* ─── Game Container ─── */
#page-game #shot-game-container {
  position: relative;
  --sg-hud-left: 8px;
  --sg-guide-right: 8px;
  --sg-guide-width: 168px;
  --sg-hud-gap: 10px;
  height: calc(100vh - var(--topbar-h) - var(--bottombar-h) - 52px);
  height: calc(100dvh - var(--topbar-h) - var(--bottombar-h) - 52px);
  min-height: 380px;
  background: #8bc5e0;
  touch-action: none;
  filter: brightness(1);
  transition: filter 180ms ease-out;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
  border-radius: 12px;
  overflow: hidden;
}
#page-game #shot-game-container.flash-hit { filter: brightness(2); }
#page-game #shot-game-container canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
}

/* ─── HUD ─── */
#page-game .sg-hud {
  position: absolute;
  left: 50%;
  top: 14px;
  transform: translateX(-50%);
  z-index: 5;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0;
  font-weight: 700;
}
#page-game .sg-hud-chip {
  display: inline-flex;
  align-items: center;
  height: 34px;
  padding: 0 14px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.62);
  background: linear-gradient(160deg, rgba(255, 255, 255, 0.56), rgba(255, 255, 255, 0.26));
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  box-shadow: 0 5px 12px rgba(18, 39, 58, 0.16);
  color: #0d1e2b;
  font-size: 14px;
  font-weight: 800;
  line-height: 1;
}
#page-game .sg-streak-chip {
  margin-top: 0;
  color: #8a5200;
}

/* ─── Goal Guide ─── */
#page-game .sg-goal-guide {
  position: absolute;
  right: var(--sg-guide-right);
  top: 12px;
  margin: 0;
  z-index: 4;
  color: var(--text-primary, #0d1e2b);
  font-size: 12px;
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid rgba(0, 0, 0, 0.15);
  border-radius: 10px;
  padding: 10px 11px;
  width: var(--sg-guide-width);
  box-sizing: border-box;
  text-align: center;
  line-height: 1.4;
  -webkit-backdrop-filter: blur(7px);
  backdrop-filter: blur(7px);
  box-shadow: 0 5px 12px rgba(14, 38, 56, 0.16);
}
#page-game .sg-goal-guide-title {
  font-size: 12px;
  margin-bottom: 7px;
  opacity: 0.9;
  letter-spacing: 0.4px;
}
#page-game .sg-goal-guide-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 5px;
}
#page-game .sg-gg-cell {
  text-align: center;
  border-radius: 6px;
  border: 1px solid rgba(0, 0, 0, 0.18);
  padding: 4px 0;
  font-size: 12px;
  font-weight: 800;
  background: linear-gradient(160deg, rgba(255, 255, 255, 0.54), rgba(255, 255, 255, 0.22));
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  color: #0d1e2b;
}
#page-game .sg-gg-high { background: rgba(255, 91, 91, 0.23); }
#page-game .sg-gg-mid  { background: rgba(255, 183, 77, 0.23); }
#page-game .sg-gg-low  { background: rgba(255, 238, 88, 0.23); }

/* ─── Score Message ─── */
#page-game #sg-message {
  position: absolute;
  left: 50%;
  top: 36%;
  transform: translateX(-50%);
  z-index: 5;
  font-size: clamp(20px, 5vw, 34px);
  font-weight: 800;
  opacity: 0;
  transition: opacity 0.2s ease;
  white-space: nowrap;
  color: #0d1e2b;
}

/* ─── Crosshair ─── */
#page-game #sg-crosshair {
  position: absolute;
  width: 38px;
  height: 38px;
  border: 3px solid rgba(255, 67, 67, 0.9);
  border-radius: 50%;
  z-index: 5;
  pointer-events: none;
  display: none;
  transform: translate(-50%, -50%);
  box-shadow: 0 0 8px rgba(255, 255, 255, 0.35);
}

/* ─── Power Bar ─── */
#page-game #sg-power {
  position: absolute;
  left: 50%;
  bottom: 74px;
  transform: translateX(-50%);
  width: min(78%, 520px);
  height: 20px;
  border-radius: 999px;
  border: 2px solid rgba(0, 0, 0, 0.45);
  background: rgba(0, 0, 0, 0.4);
  overflow: hidden;
  z-index: 5;
  display: none;
}
#page-game #sg-power-fill {
  width: 0%;
  height: 100%;
  background: linear-gradient(90deg, #22c55e, #facc15);
}

/* ─── Restart Button ─── */
#page-game #sg-restart {
  position: absolute;
  left: 50%;
  bottom: 64px;
  transform: translateX(-50%);
  z-index: 6;
  display: none;
  border: 0;
  border-radius: 10px;
  padding: 11px 24px;
  background: linear-gradient(90deg, #ffb26f, #ff7f90);
  color: #1a1216;
  font-weight: 800;
  cursor: pointer;
  font-size: 14px;
}

/* ─── Bottom HUD Row ─── */
#page-game .sg-bottom-row {
  position: absolute;
  right: 10px;
  bottom: 8px;
  z-index: 7;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}
#page-game #session-badge {
  display: grid;
  grid-template-rows: auto auto auto auto;
  align-content: start;
  gap: 4px;
  width: min(76vw, 270px);
  min-height: 102px;
  padding: 8px 10px;
  border-radius: 12px;
  border: 1px solid rgba(0, 0, 0, 0.22);
  background: linear-gradient(165deg, rgba(255, 255, 255, 0.86), rgba(233, 247, 255, 0.72));
  box-shadow: 0 6px 14px rgba(15, 34, 52, 0.16);
  color: #15384c;
  box-sizing: border-box;
}
#page-game #session-badge .sg-session-top-title {
  display: flex;
  justify-content: center;
  align-items: center;
  width: 100%;
  text-align: center;
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.55px;
  line-height: 1.1;
}
#page-game #session-badge .sg-session-title {
  text-align: center;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.35px;
  line-height: 1.1;
}
#page-game #session-badge .sg-session-focus-row {
  display: flex;
  align-items: stretch;
  justify-content: center;
  gap: 8px;
}
#page-game #session-badge .sg-session-focus-box {
  width: 37.5%;
  min-width: 82px;
  max-width: 102px;
  border: 1px solid rgba(40, 89, 125, 0.55);
  border-radius: 8px;
  background: linear-gradient(180deg, #153753, #102b42);
  padding: 4px 6px 5px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.12), 0 3px 9px rgba(10, 23, 35, 0.3);
}
#page-game #session-badge .sg-session-focus-label {
  color: #bddfff;
  font-size: 11px;
  line-height: 1;
  font-weight: 800;
  letter-spacing: 0.6px;
  text-align: center;
}
#page-game #session-badge .sg-session-focus-value {
  margin-top: 3px;
  text-align: center;
  font-family: "Outfit", "Noto Sans TC", sans-serif;
  font-size: 22px;
  line-height: 1;
  font-weight: 900;
  letter-spacing: 0.8px;
  text-shadow: 0 1px 0 rgba(0, 0, 0, 0.32);
}
#page-game #session-badge .sg-session-focus-box-score .sg-session-focus-value { color: #ffe16b; }
#page-game #session-badge .sg-session-focus-box-streak .sg-session-focus-value { color: #84ecff; }
#page-game #session-badge .sg-session-best,
#page-game #session-badge .sg-session-title {
  text-align: center;
  white-space: nowrap;
}
#page-game #session-badge .sg-session-best {
  font-size: 13px;
  font-weight: 800;
  line-height: 1.2;
  font-family: "Outfit", "Noto Sans TC", sans-serif;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.12px;
  overflow: hidden;
  text-overflow: ellipsis;
}
#page-game #session-badge .sg-session-sep {
  margin: 0 4px;
  opacity: 0.72;
}
#page-game #sg-score.sg-hud-chip,
#page-game #sg-streak.sg-hud-chip {
  display: none;
}
#page-game .sg-lb-btn {
  height: 34px;
  min-width: 86px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.62);
  background: linear-gradient(160deg, rgba(255, 255, 255, 0.42), rgba(255, 255, 255, 0.2));
  box-shadow: 0 6px 18px rgba(20, 40, 58, 0.18);
  -webkit-backdrop-filter: blur(7px);
  backdrop-filter: blur(7px);
  color: #0d1e2b;
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.6px;
  cursor: pointer;
  padding: 0 14px;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  white-space: nowrap;
  flex-shrink: 0;
}
#page-game .sg-lb-btn:hover { transform: translateY(-1px); }
#page-game .sg-lb-btn:active { transform: translateY(0); }

/* ─── Ad Slot ─── */
#page-game .sg-ad-slot {
  margin-top: 8px;
  border-radius: 12px;
  overflow: hidden;
  min-height: 80px;
  background: var(--bg-elevated, rgba(0,0,0,0.04));
  border: 1px dashed var(--border, rgba(0,0,0,0.12));
}
#page-game .sg-ad-slot img { width: 100%; display: block; border-radius: 12px; }
#page-game .sg-ad-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 16px;
  color: var(--text-muted);
  font-size: 13px;
  text-align: center;
  min-height: 80px;
}
#page-game .sg-ad-icon { font-size: 22px; }

/* ─── Intro Modal ─── */
#page-game .sg-intro-overlay {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: rgba(0, 0, 0, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}
#page-game .sg-intro-overlay[aria-hidden="true"] { display: none; }
#page-game .sg-intro-dialog {
  background: var(--bg-card, #fff);
  border: 1px solid var(--border, rgba(0,0,0,0.12));
  border-radius: 20px;
  padding: 24px 22px 20px;
  max-width: 400px;
  width: 100%;
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.28);
}
#page-game .sg-intro-dialog h3 {
  margin: 0 0 14px;
  font-size: 17px;
  font-weight: 700;
  text-align: center;
}
#page-game .sg-intro-steps {
  list-style: none;
  padding: 0;
  margin: 0 0 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
#page-game .sg-intro-step {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  font-size: 14px;
  line-height: 1.55;
}
#page-game .sg-step-num {
  min-width: 24px;
  height: 24px;
  border-radius: 50%;
  background: #1a7abf;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 700;
  margin-top: 1px;
  flex-shrink: 0;
}
#page-game .sg-intro-dismiss-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 14px;
  font-size: 13px;
  color: var(--text-muted);
  cursor: pointer;
}
#page-game .sg-intro-dismiss-row input { cursor: pointer; width: 15px; height: 15px; }
#page-game .sg-intro-start-btn {
  width: 100%;
  padding: 12px 0;
  border-radius: 12px;
  border: none;
  background: linear-gradient(135deg, #1a7abf, #0e5a8a);
  color: #fff;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  letter-spacing: 0.5px;
}
#page-game .sg-intro-start-btn:hover { opacity: 0.9; }

/* ─── Leaderboard Modal ─── */
#page-game .sg-lb-overlay {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 18px;
  background: rgba(0, 20, 36, 0.3);
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
}
#page-game .sg-lb-overlay.is-open { display: flex; }
#page-game .sg-lb-dialog {
  width: min(560px, 100%);
  max-height: min(88dvh, 780px);
  overflow: hidden;
  display: grid;
  grid-template-rows: auto auto 1fr;
  background: var(--bg-card, #fff);
  border-radius: 16px;
  border: 1px solid var(--border, rgba(0,0,0,0.12));
  box-shadow: 0 16px 48px rgba(0,0,0,0.22);
}
#page-game .sg-lb-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 14px 16px 10px;
  border-bottom: 1px solid var(--border, rgba(0,0,0,0.1));
}
#page-game .sg-lb-head h3 { margin: 0; font-size: 18px; font-weight: 800; }
#page-game .sg-lb-head p { margin: 4px 0 0; color: var(--text-muted); font-size: 13px; }
#page-game .sg-lb-close-btn {
  height: 34px;
  min-width: 72px;
  padding: 0 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: 1px solid var(--border, rgba(0,0,0,0.1));
  border-radius: 999px;
  background: var(--bg-elevated, rgba(0,0,0,0.04));
  color: var(--text-primary);
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
  flex-shrink: 0;
}
#page-game .sg-lb-tabs {
  display: flex;
  gap: 8px;
  padding: 10px 16px 12px;
  border-bottom: 1px solid var(--border, rgba(0,0,0,0.1));
}
#page-game .sg-lb-tab {
  border: 1px solid var(--border, rgba(0,0,0,0.1));
  border-radius: 999px;
  padding: 6px 14px;
  background: var(--bg-elevated, rgba(0,0,0,0.04));
  color: var(--text-primary);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}
#page-game .sg-lb-tab.is-active {
  background: linear-gradient(90deg, #8de4ff 0%, #7af0a8 100%);
  color: #062037;
  border-color: rgba(11, 75, 111, 0.2);
}
#page-game .sg-lb-prev-month-row {
  padding: 0 16px 4px;
  text-align: right;
}
#page-game .sg-lb-prev-month-btn {
  background: none;
  border: none;
  color: var(--text-link, #2d8fc7);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 6px;
}
#page-game .sg-lb-prev-month-btn:active {
  background: rgba(0,0,0,0.06);
}
#page-game .sg-lb-table-wrap {
  overflow: auto;
  padding: 0 16px 14px;
}
#page-game .sg-lb-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
}
#page-game .sg-lb-table thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  text-align: center;
  font-size: 12px;
  letter-spacing: 0.35px;
  color: var(--text-muted);
  background: var(--bg-card, #fff);
  border-bottom: 1px solid var(--border, rgba(0,0,0,0.1));
  padding: 8px 4px;
}
#page-game .sg-lb-table tbody td {
  border-bottom: 1px solid var(--border, rgba(0,0,0,0.07));
  padding: 8px 4px;
  font-size: 12px;
  white-space: nowrap;
  text-align: center;
}
#page-game .sg-lb-col-rank  { width: 15%; }
#page-game .sg-lb-col-nick  { width: 36%; }
#page-game .sg-lb-col-score { width: 16%; }
#page-game .sg-lb-col-streak { width: 16%; }
#page-game .sg-lb-col-time  { width: 17%; }
#page-game .sg-lb-rank { font-weight: 900; }
#page-game .sg-lb-rank-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 3px;
  min-width: 40px;
  font-weight: 900;
}
#page-game .sg-lb-rank-icon { width: 13px; height: 13px; vertical-align: middle; }
#page-game .sg-lb-row-top1 td { background: rgba(255, 215, 0, 0.18); }
#page-game .sg-lb-row-top2 td { background: rgba(192, 192, 192, 0.18); }
#page-game .sg-lb-row-top3 td { background: rgba(205, 127, 50, 0.15); }
#page-game .sg-lb-score { font-weight: 800; color: var(--accent, #0e6b35); }
#page-game .sg-lb-nick { text-align: left; padding-left: 6px; overflow: hidden; }
#page-game .sg-lb-name-pill {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  border: 1px solid var(--border, rgba(0,0,0,0.1));
  background: var(--bg-elevated, rgba(0,0,0,0.04));
  font-weight: 700;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  vertical-align: middle;
  font-size: 11px;
}
#page-game .sg-lb-player-row {
  margin-top: 10px;
  border: 1px dashed var(--border, rgba(0,0,0,0.1));
  border-radius: 10px;
  background: var(--bg-elevated, rgba(0,0,0,0.02));
  padding: 8px;
}
#page-game .sg-lb-player-row h4 {
  margin: 0 0 6px;
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 700;
}
#page-game .sg-lb-player-row table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
}
#page-game .sg-lb-player-row td { font-size: 12px; padding: 4px 3px; text-align: center; }
#page-game .sg-lb-player-row.is-hidden { display: none; }

/* ─── Dark Mode ─── */
[data-theme="dark"] #page-game #shot-game-container { background: #0b2137; }
[data-theme="dark"] #page-game .sg-hud-chip {
  border-color: rgba(255, 255, 255, 0.28);
  background: linear-gradient(160deg, rgba(255, 255, 255, 0.12), rgba(10, 31, 49, 0.38));
  color: #ecf8ff;
}
[data-theme="dark"] #page-game .sg-streak-chip { color: #ffe082; }
[data-theme="dark"] #page-game #sg-message { color: #f0f8ff; }
[data-theme="dark"] #page-game .sg-goal-guide {
  background: rgba(7, 20, 33, 0.55);
  color: #e3f3ff;
  border-color: rgba(255, 255, 255, 0.2);
}
[data-theme="dark"] #page-game .sg-gg-cell {
  border-color: rgba(255, 255, 255, 0.22);
  background: linear-gradient(165deg, rgba(255,255,255,0.12), rgba(0,0,0,0.32));
  color: #e3f3ff;
}
[data-theme="dark"] #page-game .sg-gg-high { background: rgba(255, 91, 91, 0.28); }
[data-theme="dark"] #page-game .sg-gg-mid  { background: rgba(255, 183, 77, 0.24); }
[data-theme="dark"] #page-game .sg-gg-low  { background: rgba(255, 238, 88, 0.2); }
[data-theme="dark"] #page-game #session-badge {
  background: rgba(0, 0, 0, 0.42);
  border-color: rgba(255, 255, 255, 0.28);
  color: #d8f6ff;
}
[data-theme="dark"] #page-game #session-badge .sg-session-focus-box {
  border-color: rgba(144, 201, 241, 0.48);
  background: linear-gradient(180deg, rgba(10, 33, 52, 0.95), rgba(7, 24, 38, 0.98));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06), 0 4px 11px rgba(0, 0, 0, 0.38);
}
[data-theme="dark"] #page-game #session-badge .sg-session-focus-label { color: #bbdefb; }
[data-theme="dark"] #page-game #session-badge .sg-session-focus-box-score .sg-session-focus-value { color: #ffd166; }
[data-theme="dark"] #page-game #session-badge .sg-session-focus-box-streak .sg-session-focus-value { color: #89f1ff; }
[data-theme="dark"] #page-game .sg-lb-btn {
  border-color: rgba(255, 255, 255, 0.25);
  background: linear-gradient(160deg, rgba(255,255,255,0.17), rgba(6,24,41,0.38));
  color: #e9f7ff;
}
[data-theme="dark"] #page-game #sg-power { border-color: rgba(255, 255, 255, 0.7); }
[data-theme="dark"] #page-game .sg-step-num { background: #2a9dd8; }
[data-theme="dark"] #page-game .sg-lb-table thead th { background: var(--bg-card); }
[data-theme="dark"] #page-game .sg-lb-name-pill { background: rgba(0,0,0,0.3); }
[data-theme="dark"] #page-game .sg-lb-player-row { background: rgba(0,0,0,0.2); }
[data-theme="dark"] #page-game .sg-lb-row-top1 td { background: rgba(255,215,0,0.14); }
[data-theme="dark"] #page-game .sg-lb-row-top2 td { background: rgba(192,192,192,0.12); }
[data-theme="dark"] #page-game .sg-lb-row-top3 td { background: rgba(205,127,50,0.12); }

/* ─── Mobile Adjustments ─── */
@media (max-width: 480px) {
  #page-game #shot-game-container {
    --sg-hud-left: 6px;
    --sg-guide-right: 6px;
    --sg-guide-width: 144px;
    --sg-hud-gap: 8px;
  }
  #page-game .sg-goal-guide {
    padding: 8px 8px;
  }
  #page-game .sg-goal-guide-title { font-size: 11px; margin-bottom: 5px; }
  #page-game .sg-goal-guide-grid { gap: 4px; }
  #page-game .sg-gg-cell { font-size: 11px; padding: 3px 0; }
  #page-game #sg-power { bottom: 82px; }
  #page-game .sg-lb-btn { min-width: 76px; font-size: 11px; }
  #page-game #session-badge {
    width: min(80vw, 252px);
    padding: 7px 8px;
    gap: 4px;
  }
  #page-game #session-badge .sg-session-top-title { font-size: 11px; }
  #page-game #session-badge .sg-session-title { font-size: 11px; }
  #page-game #session-badge .sg-session-focus-row { gap: 6px; }
  #page-game #session-badge .sg-session-focus-box {
    width: 38%;
    min-width: 78px;
    max-width: 96px;
  }
  #page-game #session-badge .sg-session-focus-label { font-size: 10px; }
  #page-game #session-badge .sg-session-focus-value { font-size: clamp(16px, 5.2vw, 20px); }
  #page-game #session-badge .sg-session-best {
    font-size: clamp(11px, 3.1vw, 13px);
    letter-spacing: 0;
  }
  #page-game #session-badge .sg-session-sep { margin: 0 2px; }
}
@media (max-width: 560px) {
  #page-game .sg-goal-guide { top: 122px; }
}
@media (max-width: 390px) {
  #page-game #shot-game-container {
    --sg-guide-width: 136px;
  }
}

/* ================================================
   Kick Game Page Styles (誰才是開球王)
   全部 selector 以 #page-kick-game 為前綴
   ================================================ */

/* ─── Login Required Card ─── */
#page-kick-game .kg-login-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 40px 24px;
  text-align: center;
  min-height: 240px;
}
#page-kick-game .kg-login-card .kg-login-icon {
  font-size: 40px;
  line-height: 1;
}
#page-kick-game .kg-login-card h3 {
  margin: 0 0 6px;
  font-size: 18px;
  font-weight: 800;
}
#page-kick-game .kg-login-card p {
  margin: 0;
  font-size: 14px;
  color: var(--text-muted);
  line-height: 1.6;
}

/* ─── Loading State ─── */
#page-kick-game .kg-loading-state {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 48px 24px;
  font-size: 14px;
  color: var(--text-muted);
  min-height: 200px;
}

/* ─── Page Title Row ─── */
#page-kick-game .kg-page-title-row {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 8px 6px 6px;
  font-size: 15px;
  font-weight: 800;
  letter-spacing: 0.4px;
}

/* ─── Game Container ─── */
#page-kick-game #kick-game-container {
  position: relative;
  height: calc(100vh - var(--topbar-h) - var(--bottombar-h) - 52px - env(safe-area-inset-bottom, 0));
  height: calc(100dvh - var(--topbar-h) - var(--bottombar-h) - 52px - env(safe-area-inset-bottom, 0));
  min-height: 380px;
  background: #8bc5e0;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent;
  border-radius: 12px;
  overflow: hidden;
}
#page-kick-game #kick-game-container * {
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  user-select: none;
}
#page-kick-game #kick-game-container canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
}

/* ─── Session Badge Card (inside game container, top-center) ─── */
#page-kick-game #kg-session-badge {
  position: absolute;
  left: 50%;
  top: 8px;
  transform: translateX(-50%);
  z-index: 15;
  display: grid;
  grid-template-rows: auto auto auto auto auto;
  align-content: start;
  gap: 4px;
  width: min(92vw, 400px);
  min-height: 102px;
  padding: 8px 10px;
  border-radius: 12px;
  border: 1px solid rgba(0,0,0,0.22);
  background: linear-gradient(165deg, rgba(255,255,255,0.86), rgba(233,247,255,0.72));
  box-shadow: 0 6px 14px rgba(15,34,52,0.16);
  color: #15384c;
  box-sizing: border-box;
  pointer-events: auto;
}
#page-kick-game .kg-session-top-title {
  display: flex;
  justify-content: center;
  align-items: center;
  width: 100%;
  text-align: center;
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.55px;
  line-height: 1.1;
}
#page-kick-game .kg-session-focus-row {
  display: flex;
  align-items: stretch;
  justify-content: center;
  gap: 8px;
}
#page-kick-game .kg-session-focus-box {
  width: 31%;
  min-width: 88px;
  max-width: 120px;
  border: 1px solid rgba(40,89,125,0.55);
  border-radius: 8px;
  background: linear-gradient(180deg, #153753, #102b42);
  padding: 4px 6px 5px;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.12), 0 3px 9px rgba(10,23,35,0.3);
  text-align: center;
}
#page-kick-game .kg-session-focus-label {
  color: #bddfff;
  font-size: 11px;
  line-height: 1;
  font-weight: 800;
  letter-spacing: 0.6px;
}
#page-kick-game .kg-session-focus-value {
  margin-top: 3px;
  font-family: "Outfit", "Noto Sans TC", sans-serif;
  font-size: 22px;
  line-height: 1;
  font-weight: 900;
  letter-spacing: 0.8px;
  text-shadow: 0 1px 0 rgba(0,0,0,0.32);
}
#page-kick-game .kg-session-focus-unit {
  font-size: 10px;
  color: #8ec6f0;
  font-weight: 700;
  line-height: 1;
  margin-top: 2px;
}
#page-kick-game .kg-session-focus-box-dist .kg-session-focus-value { color: #7af0a8; }
#page-kick-game .kg-session-focus-box-height .kg-session-focus-value { color: #f0d87a; }
#page-kick-game .kg-session-focus-box-speed .kg-session-focus-value { color: #84ecff; }
#page-kick-game .kg-session-info {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
}
#page-kick-game .kg-session-sep {
  margin: 0 2px;
  opacity: 0.72;
}
#page-kick-game .kg-session-title {
  text-align: center;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.35px;
  line-height: 1.1;
}
#page-kick-game .kg-session-best {
  text-align: center;
  white-space: nowrap;
  font-size: 13px;
  font-weight: 800;
  line-height: 1.2;
  font-family: "Outfit", "Noto Sans TC", sans-serif;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.12px;
  overflow: hidden;
  text-overflow: ellipsis;
}
#page-kick-game .kg-lb-btn {
  height: 34px;
  min-width: 86px;
  border-radius: 999px;
  border: 1px solid var(--border, rgba(0,0,0,0.12));
  background: linear-gradient(160deg, rgba(255,255,255,0.42), rgba(255,255,255,0.2));
  box-shadow: 0 6px 18px rgba(20,40,58,0.18);
  color: var(--text-primary, #0d1e2b);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.6px;
  cursor: pointer;
  padding: 0 14px;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  white-space: nowrap;
  flex-shrink: 0;
}
#page-kick-game .kg-lb-btn:hover { transform: translateY(-1px); }
#page-kick-game .kg-lb-btn:active { transform: translateY(0); }

/* ─── Intro Modal ─── */
#page-kick-game .kg-intro-overlay {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: rgba(0,0,0,0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}
#page-kick-game .kg-intro-overlay[aria-hidden="true"] { display: none; }
#page-kick-game .kg-intro-dialog {
  background: var(--bg-card, #fff);
  border: 1px solid var(--border, rgba(0,0,0,0.12));
  border-radius: 20px;
  padding: 24px 22px 20px;
  max-width: 400px;
  width: 100%;
  box-shadow: 0 16px 48px rgba(0,0,0,0.28);
}
#page-kick-game .kg-intro-dialog h3 {
  margin: 0 0 14px;
  font-size: 17px;
  font-weight: 700;
  text-align: center;
}
#page-kick-game .kg-intro-steps {
  list-style: none;
  padding: 0;
  margin: 0 0 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
#page-kick-game .kg-intro-step {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  font-size: 14px;
  line-height: 1.55;
}
#page-kick-game .kg-step-num {
  min-width: 24px;
  height: 24px;
  border-radius: 50%;
  background: #1a7abf;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 700;
  margin-top: 1px;
  flex-shrink: 0;
}
#page-kick-game .kg-intro-dismiss-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 14px;
  font-size: 13px;
  color: var(--text-muted);
  cursor: pointer;
}
#page-kick-game .kg-intro-dismiss-row input { cursor: pointer; width: 15px; height: 15px; }
#page-kick-game .kg-intro-start-btn {
  width: 100%;
  padding: 12px 0;
  border-radius: 12px;
  border: none;
  background: linear-gradient(135deg, #1a7abf, #0e5a8a);
  color: #fff;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  letter-spacing: 0.5px;
}
#page-kick-game .kg-intro-start-btn:hover { opacity: 0.9; }

/* ─── Leaderboard Modal ─── */
#page-kick-game .kg-lb-overlay {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 18px;
  background: rgba(0,20,36,0.3);
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
}
#page-kick-game .kg-lb-overlay.is-open { display: flex; }
#page-kick-game .kg-lb-dialog {
  width: min(560px, 100%);
  max-height: min(88dvh, 780px);
  overflow: hidden;
  display: grid;
  grid-template-rows: auto auto 1fr;
  background: var(--bg-card, #fff);
  border-radius: 16px;
  border: 1px solid var(--border, rgba(0,0,0,0.12));
  box-shadow: 0 16px 48px rgba(0,0,0,0.22);
}
#page-kick-game .kg-lb-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 14px 16px 10px;
  border-bottom: 1px solid var(--border, rgba(0,0,0,0.1));
}
#page-kick-game .kg-lb-head h3 { margin: 0; font-size: 18px; font-weight: 800; }
#page-kick-game .kg-lb-head p { margin: 4px 0 0; color: var(--text-muted); font-size: 13px; }
#page-kick-game .kg-lb-close-btn {
  height: 34px;
  min-width: 72px;
  padding: 0 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: 1px solid var(--border, rgba(0,0,0,0.1));
  border-radius: 999px;
  background: var(--bg-elevated, rgba(0,0,0,0.04));
  color: var(--text-primary);
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
  flex-shrink: 0;
}
#page-kick-game .kg-lb-tabs {
  display: flex;
  gap: 8px;
  padding: 10px 16px 12px;
  border-bottom: 1px solid var(--border, rgba(0,0,0,0.1));
}
#page-kick-game .kg-lb-tab {
  border: 1px solid var(--border, rgba(0,0,0,0.1));
  border-radius: 999px;
  padding: 6px 14px;
  background: var(--bg-elevated, rgba(0,0,0,0.04));
  color: var(--text-primary);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}
#page-kick-game .kg-lb-tab.is-active {
  background: linear-gradient(90deg, #8de4ff 0%, #7af0a8 100%);
  color: #062037;
  border-color: rgba(11,75,111,0.2);
}
#page-kick-game .kg-lb-prev-month-row {
  padding: 0 16px 4px;
  text-align: right;
}
#page-kick-game .kg-lb-prev-month-btn {
  background: none;
  border: none;
  color: var(--text-link, #2d8fc7);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 6px;
}
#page-kick-game .kg-lb-prev-month-btn:active {
  background: rgba(0,0,0,0.06);
}
#page-kick-game .kg-lb-table-wrap {
  overflow: auto;
  padding: 0 16px 14px;
}
#page-kick-game .kg-lb-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
}
#page-kick-game .kg-lb-table thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  text-align: center;
  font-size: 12px;
  letter-spacing: 0.35px;
  color: var(--text-muted);
  background: var(--bg-card, #fff);
  border-bottom: 1px solid var(--border, rgba(0,0,0,0.1));
  padding: 8px 4px;
}
#page-kick-game .kg-lb-table tbody td {
  border-bottom: 1px solid var(--border, rgba(0,0,0,0.07));
  padding: 8px 4px;
  font-size: 12px;
  white-space: nowrap;
  text-align: center;
}
#page-kick-game .kg-lb-col-rank  { width: 14%; }
#page-kick-game .kg-lb-col-nick  { width: 32%; }
#page-kick-game .kg-lb-col-dist  { width: 20%; }
#page-kick-game .kg-lb-col-speed { width: 17%; }
#page-kick-game .kg-lb-col-time  { width: 17%; }
#page-kick-game .kg-lb-rank { font-weight: 900; }
#page-kick-game .kg-lb-rank-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 3px;
  min-width: 40px;
  font-weight: 900;
}
#page-kick-game .kg-lb-rank-icon { width: 13px; height: 13px; vertical-align: middle; }
#page-kick-game .kg-lb-row-top1 td { background: rgba(255,215,0,0.18); }
#page-kick-game .kg-lb-row-top2 td { background: rgba(192,192,192,0.18); }
#page-kick-game .kg-lb-row-top3 td { background: rgba(205,127,50,0.15); }
#page-kick-game .kg-lb-dist { font-weight: 800; color: var(--accent, #0e6b35); }
#page-kick-game .kg-lb-nick { text-align: left; padding-left: 6px; overflow: hidden; }
#page-kick-game .kg-lb-name-pill {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  border: 1px solid var(--border, rgba(0,0,0,0.1));
  background: var(--bg-elevated, rgba(0,0,0,0.04));
  font-weight: 700;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  vertical-align: middle;
  font-size: 11px;
}
#page-kick-game .kg-lb-player-row {
  margin-top: 10px;
  border: 1px dashed var(--border, rgba(0,0,0,0.1));
  border-radius: 10px;
  background: var(--bg-elevated, rgba(0,0,0,0.02));
  padding: 8px;
}
#page-kick-game .kg-lb-player-row h4 {
  margin: 0 0 6px;
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 700;
}
#page-kick-game .kg-lb-player-row table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
}
#page-kick-game .kg-lb-player-row td { font-size: 12px; padding: 4px 3px; text-align: center; }
#page-kick-game .kg-lb-player-row.is-hidden { display: none; }

/* ─── Kick Game Dark Mode ─── */
[data-theme="dark"] #page-kick-game #kick-game-container { background: #0b2137; }
[data-theme="dark"] #page-kick-game #kg-session-badge {
  background: rgba(0,0,0,0.42);
  border-color: rgba(255,255,255,0.28);
  color: #d8f6ff;
}
[data-theme="dark"] #page-kick-game .kg-session-focus-box {
  border-color: rgba(144,201,241,0.48);
  background: linear-gradient(180deg, rgba(10,33,52,0.95), rgba(7,24,38,0.98));
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.06), 0 4px 11px rgba(0,0,0,0.38);
}
[data-theme="dark"] #page-kick-game .kg-session-focus-label { color: #bbdefb; }
[data-theme="dark"] #page-kick-game .kg-session-focus-box-dist .kg-session-focus-value { color: #7af0a8; }
[data-theme="dark"] #page-kick-game .kg-session-focus-box-height .kg-session-focus-value { color: #f0d87a; }
[data-theme="dark"] #page-kick-game .kg-session-focus-box-speed .kg-session-focus-value { color: #89f1ff; }
[data-theme="dark"] #page-kick-game .kg-lb-btn {
  border-color: rgba(255,255,255,0.25);
  background: linear-gradient(160deg, rgba(255,255,255,0.17), rgba(6,24,41,0.38));
  color: #e9f7ff;
}
[data-theme="dark"] #page-kick-game .kg-step-num { background: #2a9dd8; }
[data-theme="dark"] #page-kick-game .kg-lb-table thead th { background: var(--bg-card); }
[data-theme="dark"] #page-kick-game .kg-lb-name-pill { background: rgba(0,0,0,0.3); }
[data-theme="dark"] #page-kick-game .kg-lb-player-row { background: rgba(0,0,0,0.2); }
[data-theme="dark"] #page-kick-game .kg-lb-row-top1 td { background: rgba(255,215,0,0.14); }
[data-theme="dark"] #page-kick-game .kg-lb-row-top2 td { background: rgba(192,192,192,0.12); }
[data-theme="dark"] #page-kick-game .kg-lb-row-top3 td { background: rgba(205,127,50,0.12); }
[data-theme="dark"] #page-kick-game .kg-lb-tab.is-active {
  background: linear-gradient(90deg, #8de4ff 0%, #7af0a8 100%);
  color: #062037;
}

/* ─── Kick Game Mobile ─── */
@media (max-width: 480px) {
  #page-kick-game .kg-lb-btn { min-width: 76px; font-size: 11px; }
  #page-kick-game #kg-session-badge {
    width: min(92vw, 370px);
    padding: 7px 8px;
    gap: 4px;
  }
  #page-kick-game .kg-session-top-title { font-size: 11px; }
  #page-kick-game .kg-session-focus-row { gap: 4px; }
  #page-kick-game .kg-session-focus-box {
    width: 31%;
    min-width: 78px;
    max-width: 110px;
  }
  #page-kick-game .kg-session-focus-label { font-size: 10px; }
  #page-kick-game .kg-session-focus-value { font-size: clamp(16px, 5.2vw, 20px); }
  #page-kick-game .kg-session-best {
    font-size: clamp(11px, 3.1vw, 13px);
    letter-spacing: 0;
  }
}
