/* 百家樂板路單 — 樣式 (1920×1080 固定全螢幕) */

/* ===== 老闆鍵:模仿 Windows 桌面 ===== */
.boss-screen {
  position: fixed;
  inset: 0;
  display: none;
  z-index: 99999;
  background:
    radial-gradient(ellipse at 30% 35%, rgba(120, 200, 255, 0.18) 0%, transparent 55%),
    radial-gradient(ellipse at 70% 70%, rgba(140, 100, 255, 0.15) 0%, transparent 60%),
    linear-gradient(135deg, #0a3a7a 0%, #062758 50%, #08306b 100%);
}

.boss-screen.active {
  display: block;
}

.boss-screen .boss-taskbar {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 48px;
  background: rgba(20, 24, 32, 0.78);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
}

.boss-screen .boss-start {
  display: flex;
  align-items: center;
  padding: 6px 10px;
  border-radius: 4px;
}

.boss-screen .boss-tray {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 1px;
  font-family: "Segoe UI", "Microsoft JhengHei", system-ui, sans-serif;
  font-size: 12px;
  color: #fff;
  line-height: 1.2;
}



/* ===== Design Tokens =====
   目標解析度:固定 1920×1080 全螢幕。所有尺寸為這個解析度設計。 */
:root {
  /* 8px spatial grid */
  --sp-1: 4px;
  --sp-2: 8px;
  --sp-3: 12px;
  --sp-4: 16px;
  --sp-5: 24px;

  /* Type scale 1.25 (modular) */
  --t-xs: 10px;
  --t-sm: 12px;
  --t-base: 14px;
  --t-md: 18px;
  --t-lg: 22px;
  --t-xl: 28px;
  --t-2xl: 36px;

  /* 方格尺寸 (所有格子保證正方形,下三路 = 大路 × 2/3) */
  --cell-big: 48px;
  --cell-derived: 32px;    /* 48 × 2/3 */
  --cell-bead: 40px;

  /* 欄數 */
  --cols-big: 39;          /* 39 × 48 = 1872 */
  --cols-derived: 29;      /* 29 × 32 = 928 */
  --cols-bead: 24;         /* 24 × 40 = 960 */

  /* Layout rows */
  --row-title: 56px;       /* 縮小讓出空間給下三路 */
  --row-big: 294px;        /* road 288 + 6 (上下各 1px 留白) */
  --row-mid-panel: 210px;  /* derived road 192 + 18 (上下各 7px 留白,跟左右 9px 一致) */
  --row-mid: 428px;        /* 210 × 2 + 8 gap */
  --row-bottom: 258px;     /* bead road 240 + 18 (上下各 7px 留白,跟左右 9px 一致) */
  /* 56+294+428+258 + 3×8 gap + 2×10 padding = 1080 ✓ */
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  /* Art Deco 奢華賭場:中文用 Noto Serif TC 展示襯線,英文/輔助用 Cormorant Garamond */
  font-family: "Noto Serif TC", "Cormorant Garamond", "Microsoft JhengHei", "PingFang TC", serif;
  font-weight: 500;
  background: #7a0b0b;
  color: #f5f5f5;
  height: 100vh;
  overflow: hidden;
  font-feature-settings: "palt" 1;
}

/* 讓固定 1920×1080 畫布在任何視口尺寸下等比縮放居中,避免截斷
   注意:不用 grid place-items: center,因為當 .app 比 viewport 大時,grid auto 軌道會放大成 .app 的尺寸,反而把 .app 黏在 (0,0) 沒置中。改用 absolute + translate(-50%) 才會真的置中。 */
body {
  position: relative;
}

/* 數字統一用 Cinzel(羅馬碑刻感,搭配 tabular-nums 對齊) */
.title-bar .stats-inline b,
.stats-panel .stats-list li b,
.limit-input,
#totalCount {
  font-family: "Abril Fatface", "Cinzel", "Cormorant Garamond", "Georgia", serif;
  font-weight: 400;
  letter-spacing: 1.5px;
  font-feature-settings: "tnum" 1, "lnum" 1;
  font-variant-numeric: tabular-nums lining-nums;
}

.app {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 1920px;
  height: 1080px;
  flex-shrink: 0;
  padding: 10px;
  display: grid;
  grid-template-columns: 1fr;
  /* 大路 288 / 中段 392 / 底部 276,下三路格 = 大路格 × 2/3 */
  grid-template-rows: var(--row-title) var(--row-big) var(--row-mid) var(--row-bottom);
  gap: var(--sp-2);
  transform-origin: center center;
  /* --app-scale 由 JS 依視口比例動態設定;translate 先把元素中心移到 viewport 中心 */
  transform: translate(-50%, -50%) scale(var(--app-scale, 1));
}

/* 標題列 */
.title-bar {
  background: linear-gradient(90deg, #8b0000, #b22222);
  border: 2px solid #ffd700;
  border-radius: 8px;
  padding: 0 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.title-bar .brand {
  font-family: "Noto Serif TC", "Cinzel", serif;
  font-size: 36px;
  font-weight: 900;
  color: #ffd700;
  letter-spacing: 10px;
  padding-left: 6px;
  text-shadow:
    0 1px 0 rgba(255, 236, 140, 0.6),
    0 2px 4px rgba(0, 0, 0, 0.55);
}

.title-bar .stats-inline {
  color: #fff;
  font-size: 24px;
  display: flex;
  gap: 18px;
}

.title-bar .stats-inline b {
  color: #ffd700;
}

/* 標題列內嵌的操作控制 */
.title-controls {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  flex-wrap: wrap;
}

.title-controls .action-buttons,
.title-controls .util-buttons {
  display: flex;
  gap: 6px;
}

.title-controls .btn {
  font-size: 14px;
  font-weight: 600;
  border: none;
  border-radius: 5px;
  cursor: pointer;
  color: #fff;
  padding: 6px 14px;
}

/* 前六顆動作按鈕大小一致 */
.title-controls .action-btn {
  width: 78px;
  height: 48px;
  padding: 0;
  font-family: "Noto Serif TC", "Cinzel", serif;
  font-size: 30px;
  font-weight: 900;
  letter-spacing: 1px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  white-space: nowrap;
  box-shadow:
    inset 0 2px 3px rgba(255, 255, 255, 0.35),
    inset 0 -2px 3px rgba(0, 0, 0, 0.2),
    0 2px 3px rgba(0, 0, 0, 0.3);
}

/* 莊對/閒對 顏色與「莊」「閒」區別:桃紫 / 靛紫 */
.title-controls .btn-banker-pair {
  background: #a4307a;
}

.title-controls .btn-player-pair {
  background: #5747b8;
}

.title-controls .btn-lucky6 {
  background: #e0a800;
}

.title-controls .btn-confirm {
  background: linear-gradient(180deg, #0f9a9a, #076868);
  font-size: 24px;
  letter-spacing: 2px;
}

/* 退/清 改圓形,並與前六顆保持水平距離 */
.title-controls .util-buttons {
  margin-left: 24px;
  gap: 10px;
}

.title-controls .btn-undo,
.title-controls .btn-clear {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  padding: 0;
  font-size: 20px;
}

.title-controls .btn:hover {
  filter: brightness(1.1);
}

/* 面板通用 */
.panel {
  background: rgba(255, 255, 255, 0.96);
  color: #222;
  border: 2px solid #ffd700;
  border-radius: 8px;
  padding: 0px;
  position: relative;
}


/* 網格底板通用 */
.grid-board {
  display: grid;
  background: #fff;
  border: 1px solid #ccc;
  border-radius: 4px;
  overflow: hidden;
  width: 100%;
  position: relative;
  container-type: size;
}

/* 浮水印式標題:放在格子右下角,灰字浮雕感;
   ::before 在 tree order 為第一個定位後代,繪製在 cell(marks)之前,
   因此符號會自動覆蓋在標籤之上 */
.grid-board::before {
  content: attr(data-label);
  position: absolute;
  right: clamp(6px, 1.6cqi, 18px);
  bottom: clamp(6px, 3cqh, 20px);
  font-family: "Noto Serif TC", serif;
  font-weight: 900;
  color: rgba(120, 120, 120, 0.45);
  letter-spacing: clamp(2px, 1cqi, 10px);
  line-height: 1;
  pointer-events: none;
  white-space: nowrap;
  text-shadow:
    0 -1px 0 rgba(255, 255, 255, 0.85),
    0 1px 0 rgba(0, 0, 0, 0.18);
}

.big-road::before {
  font-size: 40cqh;
}

.derived-road::before {
  font-size: 42cqh;
}

.bead-board::before {
  font-size: 22cqh;
  letter-spacing: clamp(2px, 0.8cqi, 6px);
}

/* 大路:39 欄 x 6 列,每格 48×48px */
.big-panel {
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.big-road {
  grid-template-columns: repeat(var(--cols-big), var(--cell-big));
  grid-template-rows: repeat(6, var(--cell-big));
  width: calc(var(--cols-big) * var(--cell-big));   /* 1872px */
  height: calc(6 * var(--cell-big));                 /* 288px */
  container-type: size;
  background:
    linear-gradient(#d8d8d8 1px, transparent 1px) 0 0 / 100% var(--cell-big),
    linear-gradient(90deg, #d8d8d8 1px, transparent 1px) 0 0 / var(--cell-big) 100%,
    #fff;
}

/* 中間兩欄:左(大眼仔+小路) / 右(甲由路+公告欄) */
.mid-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--sp-2);
  min-height: 0;
}

.mid-col {
  display: grid;
  /* minmax(0, 1fr) 才會強制兩個 track 等高;單純 1fr 1fr 會被子元素的 min-content 拉歪 */
  grid-template-rows: minmax(0, 1fr) minmax(0, 1fr);
  gap: var(--sp-2);
  min-height: 0;
}

.derived-road {
  grid-template-columns: repeat(var(--cols-derived), var(--cell-derived));
  grid-template-rows: repeat(6, var(--cell-derived));
  width: calc(var(--cols-derived) * var(--cell-derived));  /* 928px */
  height: calc(6 * var(--cell-derived));                    /* 192px */
  margin: 0 auto;
  container-type: size;
  background:
    linear-gradient(#d8d8d8 1px, transparent 1px) 0 0 / 100% var(--cell-derived),
    linear-gradient(90deg, #d8d8d8 1px, transparent 1px) 0 0 / var(--cell-derived) 100%,
    #fff;
}

.derived-panel {
  display: flex;
  align-items: center;
  justify-content: center;
}

/* 公告欄 */
.notice-panel {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  justify-content: flex-start;
  container-type: size;
  overflow: hidden;
  padding: 6px 0 4px;
  gap: 4px;
}

/* 鍵盤對照表(輔助提示,字級小、低對比) */
.key-legend {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 0 10px;
  color: rgba(80, 80, 80, 0.55);
  font-family: "Noto Serif TC", serif;
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.5px;
  user-select: none;
}

.key-legend .key-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 4px 14px;
}

.key-legend .key-row span {
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.key-legend b {
  font-family: "Abril Fatface", "Cinzel", "Cormorant Garamond", serif;
  font-weight: 400;
  color: rgba(120, 60, 60, 0.7);
  background: rgba(255, 215, 0, 0.18);
  border: 1px solid rgba(120, 60, 60, 0.25);
  border-radius: 3px;
  padding: 0 4px;
  min-width: 14px;
  text-align: center;
  line-height: 1.4;
  font-size: 12px;
}

.notice-win {
  font-family: "Cinzel", "Cormorant Garamond", serif;
  font-size: 42px;
  font-weight: 900;
  color: #333;
  letter-spacing: 6px;
  text-transform: uppercase;
  text-shadow:
    0 -1px 0 rgba(255, 255, 255, 0.9),
    0 1px 0 rgba(0, 0, 0, 0.25),
    0 2px 4px rgba(0, 0, 0, 0.15);
}

/* 公告欄 — Art Deco 手繪圖示 */
.notice-icons {
  display: flex;
  gap: clamp(8px, 3cqh, 24px);
  align-items: center;
  justify-content: center;
  flex-wrap: nowrap;
  padding: 2px 8px;
  width: 100%;
  height: 100%;
}

.deco-icon-btn {
  background: transparent;
  border: none;
  padding: 0;
  cursor: pointer;
  color: #6b0f0f;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: color 0.2s ease, transform 0.2s ease, filter 0.2s ease;
  filter: drop-shadow(0 1px 1px rgba(0, 0, 0, 0.15));
}

.deco-icon-btn svg {
  width: 90px;
  height: 90px;
  display: block;
}

.deco-icon-btn:hover {
  color: #c8941f;
  transform: translateY(-2px);
  filter: drop-shadow(0 2px 3px rgba(200, 148, 31, 0.45));
}

.deco-icon-btn:active {
  transform: translateY(0);
}

/* 靜音斜線:預設隱藏 */
.deco-icon-btn .mute-slash {
  opacity: 0;
  transition: opacity 0.2s ease;
}

/* 音效關閉狀態:icon 變灰 + 顯示斜線 */
.deco-icon-btn.muted {
  color: #8a8a8a;
  filter: drop-shadow(0 1px 1px rgba(0, 0, 0, 0.15));
}

.deco-icon-btn.muted:hover {
  color: #666;
  transform: translateY(-2px);
  filter: drop-shadow(0 2px 3px rgba(120, 120, 120, 0.45));
}

.deco-icon-btn.muted .mute-slash {
  opacity: 1;
}

/* 單格:由 grid 自動配置,寬高填滿 */
.cell {
  position: relative;
  width: 100%;
  height: 100%;
  min-width: 0;
  min-height: 0;
}

/* 珠盤路圓點 */
.bead {
  width: 92%;
  height: 92%;
  margin: 4%;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-family: "Noto Serif TC", serif;
  font-weight: 900;
  /* 字型隨 .bead-board 寬度等比縮放 */
  font-size: 2.8cqi;
  line-height: 1;
  position: relative;
  /* 立體感:內部頂部亮光 + 外部底部投影 */
  box-shadow:
    inset 0 0.8cqi 1.2cqi rgba(255, 255, 255, 0.45),
    inset 0 -0.6cqi 1cqi rgba(0, 0, 0, 0.25),
    0 0.4cqi 0.8cqi rgba(0, 0, 0, 0.35);
  text-shadow: 0 1px 1px rgba(0, 0, 0, 0.4);
}

.bead.B {
  background: #d62121;
}

.bead.P {
  background: #1e5ec9;
}

.bead.T {
  background: #2ea94a;
}

/* 幸運 6:紅寶石質感 + 香檳金「6」+ 金環六芒緩轉 + 慢呼吸光暈
   分層:
     background(寶石本體:多層 radial-gradient,左上高光、右下熱焰、中央深紅過渡)
     ::before(寶石頂部珍珠高光,位於底色與文字之間)
     「6」文字(香檳金 + 浮雕陰影)
     box-shadow(金邊 + 暖色脈動外暈)
     ::after(六芒緩慢旋轉的金色光環,位於珠子外圈) */
.bead.l6 {
  background:
    radial-gradient(ellipse 38% 28% at 30% 22%, rgba(255, 255, 255, 0.75) 0%, rgba(255, 235, 210, 0.2) 45%, transparent 75%),
    radial-gradient(circle at 72% 80%, rgba(255, 130, 80, 0.45) 0%, transparent 55%),
    radial-gradient(circle at 50% 50%, #ff3434 0%, #c41414 45%, #4a0000 100%);
  color: #fff4c2;
  font-family: "Abril Fatface", "Cinzel", "Cormorant Garamond", "Georgia", serif;
  font-weight: 400;
  font-size: 3.6cqi;
  font-feature-settings: "lnum" 1;
  letter-spacing: -0.1cqi;
  text-shadow:
    /* 浮雕:上亮下暗 */
    0 -0.08cqi 0 rgba(255, 240, 180, 0.9),
    0 0.1cqi 0 rgba(90, 30, 0, 0.55),
    /* 金色光暈 */
    0 0 0.35cqi rgba(255, 240, 180, 0.95),
    0 0 0.9cqi rgba(255, 190, 80, 0.75),
    0 0 1.8cqi rgba(255, 130, 50, 0.35);
  animation: l6-breathe 2.6s ease-in-out infinite;
  z-index: 1;
  will-change: box-shadow;
}

/* 寶石頂部高光:柔暈橢圓,位於底色之上、文字之下(z-index: -1 在 .bead.l6 的堆疊脈絡內) */
.bead.l6::before {
  content: "";
  position: absolute;
  top: 6%;
  left: 16%;
  width: 42%;
  height: 26%;
  border-radius: 50%;
  background: radial-gradient(ellipse at center,
      rgba(255, 255, 255, 0.9) 0%,
      rgba(255, 245, 220, 0.35) 45%,
      transparent 85%);
  transform: rotate(-18deg);
  filter: blur(0.25cqi);
  pointer-events: none;
  z-index: -1;
}

/* 八顆寶石圓點:均分 45 度排列,以 8 層 radial-gradient 繪出獨立小圓,
   位於 bead 內部環繞「6」字,整體低透明以柔化存在感;::after 旋轉 → 圓點繞「6」公轉 */
.bead.l6::after {
  content: "";
  position: absolute;
  inset: -6%;
  border-radius: 50%;
  /* 圓點中心分布於半徑 35%(以 bead 中心為圓心)的圓周上,每 45 度一顆;
     每顆以 core 4% + halo 淡出至 11% 呈現柔邊小圓 */
  background:
    radial-gradient(circle at 50% 15%, rgba(255, 235, 120, 0.95) 0%, rgba(255, 235, 120, 0.5) 5%, transparent 14%),
    /* 0° 香檳金 */
    radial-gradient(circle at 74.7% 25.3%, rgba(255, 140, 175, 0.95) 0%, rgba(255, 140, 175, 0.5) 5%, transparent 14%),
    /* 45° 玫瑰 */
    radial-gradient(circle at 85% 50%, rgba(255, 160, 120, 0.95) 0%, rgba(255, 160, 120, 0.5) 5%, transparent 14%),
    /* 90° 珊瑚 */
    radial-gradient(circle at 74.7% 74.7%, rgba(130, 235, 180, 0.95) 0%, rgba(130, 235, 180, 0.5) 5%, transparent 14%),
    /* 135° 祖母綠 */
    radial-gradient(circle at 50% 85%, rgba(120, 230, 230, 0.95) 0%, rgba(120, 230, 230, 0.5) 5%, transparent 14%),
    /* 180° 翠湖藍 */
    radial-gradient(circle at 25.3% 74.7%, rgba(140, 180, 255, 0.95) 0%, rgba(140, 180, 255, 0.5) 5%, transparent 14%),
    /* 225° 藍寶石 */
    radial-gradient(circle at 15% 50%, rgba(210, 150, 255, 0.95) 0%, rgba(210, 150, 255, 0.5) 5%, transparent 14%),
    /* 270° 紫水晶 */
    radial-gradient(circle at 25.3% 25.3%, rgba(255, 200, 120, 0.95) 0%, rgba(255, 200, 120, 0.5) 5%, transparent 14%);
  /* 315° 琥珀金 */
  animation: l6-spin 8s linear infinite;
  filter: blur(0.04cqi);
  mix-blend-mode: screen;
  pointer-events: none;
  z-index: 0;
  opacity: 1;
}

@keyframes l6-breathe {

  0%,
  100% {
    box-shadow:
      /* 內層:寶石面的高光與底暗 */
      inset 0 0.3cqi 0.6cqi rgba(255, 235, 195, 0.3),
      inset 0 -0.4cqi 0.8cqi rgba(40, 0, 0, 0.5),
      /* 細金邊 */
      0 0 0 0.14cqi rgba(255, 220, 120, 0.9),
      /* 小範圍暖金暈 */
      0 0 0.7cqi rgba(255, 190, 80, 0.65),
      /* 底部投影 */
      0 0.3cqi 0.6cqi rgba(0, 0, 0, 0.4);
  }

  50% {
    box-shadow:
      inset 0 0.3cqi 0.6cqi rgba(255, 240, 210, 0.4),
      inset 0 -0.4cqi 0.8cqi rgba(40, 0, 0, 0.5),
      0 0 0 0.22cqi rgba(255, 235, 150, 0.95),
      0 0 1.15cqi rgba(255, 210, 95, 0.85),
      0 0.3cqi 0.6cqi rgba(0, 0, 0, 0.4);
  }
}

@keyframes l6-spin {
  from {
    transform: rotate(0deg) scale(0.98);
  }

  to {
    transform: rotate(360deg) scale(1.08);
  }
}

/* 珠盤路角標:加大 + 白框 + 陰影,更醒目 */
.pair-bp::before,
.pair-pp::after {
  content: "";
  position: absolute;
  width: 38%;
  height: 38%;
  border-radius: 50%;
  border: 2px solid #fff;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
  box-sizing: border-box;
}

.pair-bp::before {
  top: -4%;
  left: -4%;
  background: #d62121;
}

.pair-pp::after {
  bottom: -4%;
  right: -4%;
  background: #1e5ec9;
}

/* 大路圓圈 — 漸層淡出效果 (原蟑螂路效果移植):對角兩端淡,中間實,帶陰影 */
.big-circle {
  width: 92%;
  height: 92%;
  margin: 4%;
  border-radius: 50%;
  border: 4px solid #d62121;
  background: linear-gradient(-45deg, transparent 0%, rgba(214, 33, 33, 0.08) 25%, rgba(214, 33, 33, 0.18) 50%, rgba(214, 33, 33, 0.08) 75%, transparent 100%);
  position: relative;
  box-sizing: border-box;
  filter: drop-shadow(0 1px 1.5px rgba(0, 0, 0, 0.45));
}

.big-circle.B {
  border-color: #d62121;
  background: linear-gradient(-45deg, transparent 0%, rgba(214, 33, 33, 0.08) 25%, rgba(214, 33, 33, 0.18) 50%, rgba(214, 33, 33, 0.08) 75%, transparent 100%);
}

.big-circle.P {
  border-color: #1e5ec9;
  background: linear-gradient(-45deg, transparent 0%, rgba(30, 94, 201, 0.08) 25%, rgba(30, 94, 201, 0.18) 50%, rgba(30, 94, 201, 0.08) 75%, transparent 100%);
}

.big-circle.tie-mark::before {
  content: "";
  position: absolute;
  top: 50%;
  left: -10%;
  width: 120%;
  height: 2.5px;
  background: #2ea94a;
  transform: rotate(-45deg);
  transform-origin: center;
}

/* 大路裡的莊對/閒對小實心圓:加大 + 白框 + 陰影,更醒目 */
.big-circle .mark-bp,
.big-circle .mark-pp {
  position: absolute;
  border-radius: 50%;
  box-sizing: border-box;
  border: 2px solid #fff;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
}

.big-circle .mark-bp {
  top: -10%;
  left: -10%;
  width: 58%;
  height: 58%;
  background: #d62121;
}

.big-circle .mark-pp {
  bottom: -10%;
  right: -10%;
  width: 58%;
  height: 58%;
  background: #1e5ec9;
}

/* 長龍(連續同色 >= 6)動畫:脈動光暈 + 金色外環呼吸 + 微縮放,
   --dragon-delay 由 JS 依序設定,形成由頭到尾的波浪漣漪 */
.big-circle.dragon {
  animation-duration: 1.6s;
  animation-iteration-count: infinite;
  animation-timing-function: ease-in-out;
  animation-delay: var(--dragon-delay, 0s);
  will-change: transform, box-shadow, border-color;
}

.big-circle.dragon.B {
  animation-name: dragon-breath-b;
}

.big-circle.dragon.P {
  animation-name: dragon-breath-p;
}

@keyframes dragon-breath-b {

  0%,
  100% {
    box-shadow:
      0 0 0 0 rgba(255, 215, 0, 0),
      0 0 4px rgba(214, 33, 33, 0.35);
    border-color: #d62121;
    transform: scale(1);
  }

  50% {
    box-shadow:
      0 0 0 2px rgba(255, 215, 0, 0.6),
      0 0 14px rgba(255, 90, 90, 0.95),
      0 0 22px rgba(255, 60, 60, 0.55);
    border-color: #ff5252;
    transform: scale(1.06);
  }
}

@keyframes dragon-breath-p {

  0%,
  100% {
    box-shadow:
      0 0 0 0 rgba(255, 215, 0, 0),
      0 0 4px rgba(30, 94, 201, 0.35);
    border-color: #1e5ec9;
    transform: scale(1);
  }

  50% {
    box-shadow:
      0 0 0 2px rgba(255, 215, 0, 0.6),
      0 0 14px rgba(80, 160, 255, 0.95),
      0 0 22px rgba(40, 120, 255, 0.55);
    border-color: #4a8cff;
    transform: scale(1.06);
  }
}

/* 衍生路記號:大眼仔=空心圓、小路=實心圓、甲由路=斜線 */
.derived-dot {
  width: 92%;
  height: 92%;
  margin: 4%;
  box-sizing: border-box;
  position: relative;
}

/* 大眼仔:空心圓 — 雙層邊框,內淺外深,凹陷感 */
.derived-dot.shape-hollow {
  border-radius: 50%;
  border: 2px solid #d62121;
  background: transparent;
  box-shadow:
    inset 0 0 0 1.5px rgba(255, 255, 255, 0.9),
    0 1px 2px rgba(0, 0, 0, 0.25);
}

.derived-dot.shape-hollow.blue {
  border-color: #1e5ec9;
}

/* 小路:實心圓 — 漸層球體,亮點偏右上,質感與珠子路不同 */
.derived-dot.shape-solid {
  width: 78%;
  height: 78%;
  margin: 0;
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  background: radial-gradient(circle at 70% 28%, #ff8a8a 0%, #e23a3a 35%, #9a0d0d 100%);
  box-shadow:
    0 1px 2px rgba(0, 0, 0, 0.4),
    inset 0 -1px 2px rgba(0, 0, 0, 0.25);
}

.derived-dot.shape-solid.blue {
  background: radial-gradient(circle at 70% 28%, #8ab6ff 0%, #3070d6 35%, #0d3a8a 100%);
}

/* 蟑螂路:斜線 — 沿用小路漸層球效果,改成條狀 */
.derived-dot.shape-slash::before {
  content: "";
  position: absolute;
  top: 50%;
  left: -8%;
  width: 116%;
  height: 3px;
  border-radius: 2px;
  background: radial-gradient(circle at 70% 28%, #ff8a8a 0%, #e23a3a 35%, #9a0d0d 100%);
  transform: translateY(-50%) rotate(-45deg);
  transform-origin: center;
  box-shadow:
    0 1px 2px rgba(0, 0, 0, 0.4),
    inset 0 -1px 2px rgba(0, 0, 0, 0.25);
}

.derived-dot.shape-slash.blue::before {
  background: radial-gradient(circle at 70% 28%, #8ab6ff 0%, #3070d6 35%, #0d3a8a 100%);
}

/* 底部四欄:統計 | 珠盤路 | 下局指示 | 限額 */
.bottom-row {
  display: grid;
  grid-template-columns: 300px 978px 162px 436px;
  gap: var(--sp-2);
  /* 高度由 .app grid-template-rows 決定 */
  min-height: 0;
}

/* 統計 — 六格等分佔滿卡片高度,字級隨卡片高度縮放 */
.stats-panel {
  display: flex;
  flex-direction: column;
}

.stats-panel .stats-list {
  list-style: none;
  padding: 2px;
  margin: 0;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  grid-template-rows: repeat(3, 1fr);
  grid-auto-flow: column;
  gap: 2px;
  flex: 1;
  min-height: 0;
  /* 設為 size container,讓 cqh 以自身高度為基準 */
  container-type: size;
}

.stats-panel .stats-list li {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 4px 0 12px;
  border-radius: 4px;
  font-weight: 900;
  border: 1px solid rgba(0, 0, 0, 0.15);
  color: #fff;
  min-height: 0;
  box-shadow:
    inset 0 2px 3px rgba(255, 255, 255, 0.35),
    inset 0 -2px 3px rgba(0, 0, 0, 0.2),
    0 2px 3px rgba(0, 0, 0, 0.3);
}

.stats-panel .stats-list li b {
  color: #fff;
  font-size: clamp(16px, 11cqh, 38px);
  text-shadow: 0 1px 1px rgba(0, 0, 0, 0.4);
}

.stats-panel .k {
  font-family: "Noto Serif TC", serif;
  font-weight: 900;
  font-size: clamp(18px, 13cqh, 42px);
  letter-spacing: 1px;
  color: #fff;
  text-shadow: 0 1px 1px rgba(0, 0, 0, 0.4);
}

.stats-panel .stat-banker-pair .k,
.stats-panel .stat-player-pair .k,
.stats-panel .stat-lucky6 .k {
  font-size: clamp(16px, 11cqh, 34px);
}

/* 六格底色對應六顆按鈕 */
.stats-panel .stat-banker {
  background: #d62121;
}

.stats-panel .stat-player {
  background: #1e5ec9;
}

.stats-panel .stat-tie {
  background: #2ea94a;
}

.stats-panel .stat-banker-pair {
  background: #a4307a;
}

.stats-panel .stat-player-pair {
  background: #5747b8;
}

.stats-panel .stat-lucky6 {
  background: #e0a800;
}

/* 其他地方仍沿用的色彩類別 */
.banker {
  color: #ff4444;
}

.player {
  color: #4da3ff;
}

.tie {
  color: #44cc66;
}

.banker-pair {
  color: #ff4444;
}

.player-pair {
  color: #4da3ff;
}

.lucky6 {
  color: #e8a800;
}

/* 珠盤路:20 欄 x 6 列,每格 46×46px */
.bead-panel {
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.bead-board {
  grid-template-columns: repeat(var(--cols-bead), var(--cell-bead));
  grid-template-rows: repeat(6, var(--cell-bead));
  width: calc(var(--cols-bead) * var(--cell-bead));   /* 800px */
  height: calc(6 * var(--cell-bead));                  /* 240px */
  container-type: size;
  background:
    linear-gradient(#d8d8d8 1px, transparent 1px) 0 0 / 100% var(--cell-bead),
    linear-gradient(90deg, #d8d8d8 1px, transparent 1px) 0 0 / var(--cell-bead) 100%,
    #fff;
}

/* 下局指示 */
.predict-panel {
  padding: 6px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.predict-title {
  text-align: center;
  font-family: "Noto Serif TC", serif;
  font-weight: 900;
  color: #555;
  font-size: 20px;
  letter-spacing: 4px;
  padding: 2px 0;
  border-bottom: 1px solid #ccc;
}

.predict-legend {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-template-rows: repeat(4, 1fr);
  gap: 2px 8px;
  justify-items: center;
  align-items: center;
  padding: 2px;
  /* 設為 size container,讓內部圖示用 cqh 隨卡片高度縮放 */
  container-type: size;
}

.leg-row {
  display: contents;
}

.leg-tag {
  display: inline-flex;
  width: clamp(26px, 28cqh, 46px);
  height: clamp(26px, 28cqh, 46px);
  border-radius: 50%;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-family: "Noto Serif TC", serif;
  font-weight: 900;
  font-size: clamp(15px, 14cqh, 24px);
  /* 立體陰影 */
  box-shadow:
    inset 0 3px 4px rgba(255, 255, 255, 0.45),
    inset 0 -2px 3px rgba(0, 0, 0, 0.25),
    0 2px 3px rgba(0, 0, 0, 0.35);
  text-shadow: 0 1px 1px rgba(0, 0, 0, 0.4);
}

.leg-tag.banker {
  background: #d62121;
}

.leg-tag.player {
  background: #1e5ec9;
}

.leg-mark {
  display: inline-block;
  width: clamp(26px, 28cqh, 46px);
  height: clamp(26px, 28cqh, 46px);
  position: relative;
}

.leg-mark.circle {
  border-radius: 50%;
  border: 2.5px solid #d62121;
  box-shadow: 0 2px 3px rgba(0, 0, 0, 0.3);
}

.leg-mark.circle.blue {
  border-color: #1e5ec9;
}

.leg-mark.solid {
  border-radius: 50%;
  background: #d62121;
  box-shadow:
    inset 0 2px 3px rgba(255, 255, 255, 0.45),
    inset 0 -2px 3px rgba(0, 0, 0, 0.25),
    0 2px 3px rgba(0, 0, 0, 0.35);
}

.leg-mark.solid.blue {
  background: #1e5ec9;
}

.leg-mark.slash::before {
  content: "";
  position: absolute;
  top: 50%;
  left: -4px;
  width: 130%;
  height: 2.5px;
  background: #d62121;
  transform: rotate(-45deg);
  transform-origin: center;
}

.leg-mark.slash.blue::before {
  background: #1e5ec9;
}

.predict-dots {
  margin-top: auto;
}

.predict-panel .predict-grid {
  display: grid;
  grid-template-columns: 30px 1fr 1fr 1fr;
  gap: 3px;
  padding: 3px;
}

.predict-head {
  text-align: center;
  font-weight: 700;
  font-size: 12px;
  color: #555;
  padding: 2px 0;
}

.predict-row-head {
  font-weight: 900;
  text-align: center;
  padding: 6px 0;
  font-size: 14px;
}

.dot-cell {
  display: flex;
  align-items: center;
  justify-content: center;
  background: #fafafa;
  border: 1px solid #eee;
  border-radius: 4px;
  min-height: 28px;
}

.predict-panel .dot {
  display: inline-block;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 2.5px solid #ccc;
  box-sizing: border-box;
}

.predict-panel .dot.red {
  border-color: #d62121;
}

.predict-panel .dot.blue {
  border-color: #1e5ec9;
}

/* 限額面板:保留原顏色,改成橫向「標籤 | 最高/最低」排列 */
.limit-panel {
  padding: 4px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.limit-row-item {
  display: grid;
  grid-template-columns: 116px 1fr;
  align-items: stretch;
  border-radius: 4px;
  overflow: hidden;
  color: #fff;
  flex: 1;            /* 4 列均分限額面板 192px 高 */
  min-height: 0;
}

.limit-row-item.banker-box {
  background: #c41e1e;
}

.limit-row-item.tie-box {
  background: #2a8f3a;
}

.limit-row-item.pair-box {
  background: #1e5ec9;
}

.limit-row-item.lucky-box {
  background: #d99a00;
}

.limit-label {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 4px 8px;
  font-family: "Noto Serif TC", serif;
  font-size: 24px;
  font-weight: 900;
  letter-spacing: 3px;
  white-space: nowrap;
  border-right: 1px solid rgba(255, 255, 255, 0.3);
  text-shadow: 0 1px 1px rgba(0, 0, 0, 0.35);
}

.limit-values {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 10px;
  padding: 0 8px;
  min-width: 0;
}

.limit-row {
  flex: 1;
  min-width: 0;
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 4px;
  color: #fff;
  font-family: "Noto Serif TC", serif;
  font-size: 18px;
  font-weight: 700;
  letter-spacing: 1px;
  white-space: nowrap;
}

.limit-key {
  display: inline-block;
}

.limit-input {
  min-width: 0;
  width: 100%;
  padding: 2px 4px;
  border: 1px solid rgba(255, 255, 255, 0.5);
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.15);
  color: #fff;
  font-weight: 800;
  font-size: 18px;
}

.limit-input:focus {
  outline: none;
  background: #fff;
  color: #222;
  border-color: #ffd700;
}

.limit-input::-webkit-outer-spin-button,
.limit-input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.limit-input[type=number] {
  -moz-appearance: textfield;
}

/* 操作列 */
.control-panel {
  display: grid;
  grid-template-columns: 2fr 3fr 2fr;
  gap: 8px;
  align-items: center;
}

.control-panel .main-buttons {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 6px;
}

.btn {
  padding: 10px 8px;
  font-size: 16px;
  font-weight: 900;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  color: #fff;
  transition: transform 0.05s, filter 0.1s;
}

.btn:hover {
  filter: brightness(1.08);
}

.btn:active {
  transform: translateY(1px);
}

.btn-banker {
  background: #d62121;
}

.btn-player {
  background: #1e5ec9;
}

.btn-tie {
  background: #2ea94a;
}

.btn-undo {
  background: #555;
}

.btn-clear {
  background: #222;
}

.pair-toggles {
  padding: 4px 6px;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  font-size: 14px;
  color: #222;
}

.toggle {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-weight: 700;
  cursor: pointer;
}

.pair-toggles .hint {
  flex-basis: 100%;
  font-size: 11px;
  color: #777;
  font-weight: 400;
}

.util-buttons {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}

/* 固定 1920×1080 畫布由 fitApp() 整體等比縮放。
   窄視口仍維持原本欄列，避免單欄重排超出固定列高、裁掉工具區。 */

/* ================== 特效：長龍金龍與霓虹外框 ================== */

/* 1. 霓虹外框 (附加在大路的 .cell 內部) */
.dragon-neon {
  position: absolute;
  inset: 0;
  /* 剛好覆蓋整個 cell，因為大路沒有 gap，邊界會完美重合 */
  box-sizing: border-box;
  border: 0 solid #d82bd8;
  /* 霓虹紫色 */
  /* 發光效果：外陰影 + 內陰影 */
  box-shadow: 0 0 10px #d82bd8, inset 0 0 8px #d82bd8;
  z-index: 10;
  pointer-events: none;
  border-radius: 4px;
  /* 微小的圓角讓折角更好看 */
  opacity: 0;
  animation: neon-flash 0.5s forwards ease-in-out;
}

/* 只保留需要的邊，連接相鄰的 cell 形成一條完整的龍形 */
.dragon-neon.t {
  border-top-width: 3px;
  border-top-left-radius: 6px;
  border-top-right-radius: 6px;
}

.dragon-neon.b {
  border-bottom-width: 3px;
  border-bottom-left-radius: 6px;
  border-bottom-right-radius: 6px;
}

.dragon-neon.l {
  border-left-width: 3px;
  border-top-left-radius: 6px;
  border-bottom-left-radius: 6px;
}

.dragon-neon.r {
  border-right-width: 3px;
  border-top-right-radius: 6px;
  border-bottom-right-radius: 6px;
}

/* 若是閒龍，切換成霓虹藍色 */
.dragon-neon.player-dragon {
  border-color: #3b82f6;
  box-shadow: 0 0 10px #3b82f6, inset 0 0 8px #3b82f6;
}

@keyframes neon-flash {
  0% {
    opacity: 0;
    transform: scale(1.05);
  }

  50% {
    opacity: 1;
    transform: scale(1);
    filter: brightness(1.5);
  }

  100% {
    opacity: 1;
    transform: scale(1);
    filter: brightness(1);
  }
}

/* 2. 滿版金龍飛出特效 */
.dragon-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  pointer-events: none;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  /* 讓龍在畫面正中央 */
  overflow: hidden;
  opacity: 0;
  transition: opacity 0.5s;
}

.dragon-overlay.active {
  opacity: 1;
}

.golden-dragon-img {
  height: 90vh;
  /* 佔滿畫面高度的 90% */
  object-fit: contain;
  /* 加上真實的去背圖光暈 */
  filter: drop-shadow(0 0 25px rgba(255, 200, 50, 0.85)) drop-shadow(0 0 50px rgba(255, 100, 0, 0.6)) brightness(1.2);
  /* 初始狀態:縮成極小、淡到看不見、定位在畫面正中 */
  transform: scale(0.05);
  opacity: 0;
  transition: opacity 0.3s;
}

/* 兩張色龍 APNG 預先放在 DOM,預設都隱藏,避免 flex 並排佔位;靠 overlay class 切換顯示哪一張 */
.dragon-banker-img,
.dragon-player-img {
  display: none;
}

.dragon-overlay.banker-dragon-overlay .dragon-banker-img,
.dragon-overlay.player-dragon-overlay .dragon-player-img {
  display: block;
}

.dragon-overlay.player-dragon-overlay .dragon-player-img {
  filter: drop-shadow(0 0 25px rgba(70, 170, 255, 0.9)) drop-shadow(0 0 55px rgba(0, 80, 255, 0.7)) brightness(1.18);
}

.dragon-overlay.banker-dragon-overlay .dragon-banker-img {
  filter: drop-shadow(0 0 25px rgba(255, 200, 50, 0.85)) drop-shadow(0 0 50px rgba(255, 100, 0, 0.6)) brightness(1.2);
}

/* 觸發長龍時的螺旋升空與浮動動畫 (只跑當前對應色那張,另一張被 display:none 不會佔位也不顯) */
.dragon-overlay.active.banker-dragon-overlay .dragon-banker-img,
.dragon-overlay.active.player-dragon-overlay .dragon-player-img {
  /* 飛出動畫：2.5秒完成螺旋上升，之後無限循環浮動動畫 */
  animation:
    dragon-spiral-entrance 2.5s cubic-bezier(0.2, 0.8, 0.3, 1) forwards,
    dragon-float 4s infinite ease-in-out 2.5s;
}

/* 中心點縮放浮現:從極小淡入,放到 1.0 同時淡到全顯 */
@keyframes dragon-spiral-entrance {
  0% {
    transform: scale(0.05);
    opacity: 0;
  }

  60% {
    transform: scale(0.7);
    opacity: 0.7;
  }

  100% {
    transform: scale(1);
    opacity: 1;
  }
}

/* 定位後的緩慢呼吸 */
@keyframes dragon-float {

  0%,
  100% {
    transform: scale(1);
  }

  50% {
    transform: scale(1.02);
  }
}

/* 每次連擊增加時，讓整條龍也跟著震動放大的打擊感特效 */
.dragon-overlay.hit {
  animation: dragon-hit-pulse 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes dragon-hit-pulse {
  0% {
    transform: scale(1);
    filter: brightness(1);
  }

  30% {
    transform: scale(1.15);
    filter: brightness(1.6) drop-shadow(0 0 30px rgba(255, 255, 0, 0.8));
  }

  100% {
    transform: scale(1);
    filter: brightness(1);
  }
}

/* 3. 連勝數字特效 */
.dragon-combo {
  position: absolute;
  /* 隨螢幕縮放的超大字體 */
  font-size: 35vh;
  font-family: "Abril Fatface", "Cinzel", "Cormorant Garamond", serif;
  font-weight: 400;
  color: #fff;
  /* 華麗的金色火焰多層陰影 */
  text-shadow:
    0 0 10px rgba(255, 255, 255, 0.9),
    0 0 30px #ffd700,
    0 0 60px #ff8c00,
    0 0 100px #ff0000;
  z-index: 10000;
  pointer-events: none;
  opacity: 0;
}

/* 每次數字更新時觸發強烈的 Pop 彈出特效 */
.dragon-combo.pop {
  animation: combo-pop 1.5s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}

@keyframes combo-pop {
  0% {
    transform: scale(0.1);
    opacity: 0;
    filter: brightness(2);
  }

  30% {
    transform: scale(1.3);
    opacity: 1;
    filter: brightness(1.5);
  }

  50% {
    transform: scale(1);
    opacity: 1;
    filter: brightness(1);
  }

  100% {
    transform: scale(1);
    opacity: 0.9;
    filter: brightness(1);
  }
}
.backup-notice{position:fixed;bottom:12px;left:50%;transform:translateX(-50%);max-width:min(900px,94vw);z-index:10000;display:flex;align-items:center;gap:10px;flex-wrap:wrap;padding:10px 14px;background:#fffaf5;border:1px solid #b48635;border-radius:6px;color:#621010;font:13px/1.5 "Microsoft JhengHei",sans-serif;box-shadow:0 2px 10px #0003}
.backup-notice[hidden],.backup-notice [hidden]{display:none}
.backup-notice button,.backup-notice a{font:inherit;color:#751313;background:#fff;border:1px solid #b48635;border-radius:4px;padding:3px 8px;text-decoration:none;cursor:pointer}
.backup-notice button:disabled{cursor:wait;opacity:.6}
/* PNG uses the complete desktop layout, independently of the display zoom. */
.road-export-frame{background:#7a0b0b}
.road-export-frame *{animation:none!important;transition:none!important}
.road-export-frame .bead,.road-export-frame .big-circle,.road-export-frame .derived-mark{opacity:1!important}
.road-export-frame .dragon-neon,
.road-export-frame .dragon-spine-svg,
.road-export-frame .dragon-corner-badge { display: none !important; }

/* ================== 2026 次世代莊／閒長龍特效升級 ================== */

.big-panel {
  position: relative;
}

#bigRoad {
  position: relative;
}

/* 1. 大路棋盤：連 6+ 龍珠波浪呼吸與龍尾聚能環 */
.big-circle.dragon {
  animation-duration: 1.5s;
  animation-iteration-count: infinite;
  animation-timing-function: ease-in-out;
  animation-delay: var(--dragon-delay, 0s);
  will-change: transform, box-shadow;
  z-index: 4;
}

.big-circle.dragon.B {
  animation-name: dragon-breath-b-v2;
}

.big-circle.dragon.P {
  animation-name: dragon-breath-p-v2;
}

@keyframes dragon-breath-b-v2 {
  0%, 100% {
    box-shadow:
      0 0 0 0 rgba(255, 210, 60, 0),
      0 0 6px rgba(220, 38, 38, 0.45);
    border-color: #dc2626;
    transform: scale(1);
  }
  50% {
    box-shadow:
      0 0 0 2.5px rgba(255, 215, 70, 0.85),
      0 0 14px rgba(255, 110, 40, 0.95),
      0 0 24px rgba(255, 45, 20, 0.65);
    border-color: #ff7a45;
    transform: scale(1.08);
  }
}

@keyframes dragon-breath-p-v2 {
  0%, 100% {
    box-shadow:
      0 0 0 0 rgba(80, 230, 255, 0),
      0 0 6px rgba(37, 99, 235, 0.45);
    border-color: #1e5ec9;
    transform: scale(1);
  }
  50% {
    box-shadow:
      0 0 0 2.5px rgba(110, 240, 255, 0.9),
      0 0 14px rgba(56, 189, 248, 0.95),
      0 0 24px rgba(37, 99, 235, 0.7);
    border-color: #67e8f9;
    transform: scale(1.08);
  }
}

/* 龍尾（最新一顆連勝球）聚能脈衝特效 */
.big-circle.dragon.dragon-tail {
  z-index: 6;
}

.big-circle.dragon.dragon-tail::after {
  content: "";
  position: absolute;
  inset: -5px;
  border-radius: 50%;
  pointer-events: none;
  border: 2px solid rgba(255, 220, 90, 0.95);
  box-shadow: 0 0 12px rgba(255, 180, 30, 0.95), inset 0 0 8px rgba(255, 220, 90, 0.75);
  animation: dragon-tail-beacon 1.1s ease-out infinite;
}

.big-circle.dragon.P.dragon-tail::after {
  border-color: rgba(103, 232, 249, 0.95);
  box-shadow: 0 0 12px rgba(56, 189, 248, 0.95), inset 0 0 8px rgba(165, 243, 252, 0.8);
}

@keyframes dragon-tail-beacon {
  0% {
    transform: scale(0.88);
    opacity: 1;
  }
  100% {
    transform: scale(1.38);
    opacity: 0;
  }
}

/* 2. 大路連 6+ 連續流光外框 (.dragon-neon) —— 修正轉角並改為莊赤金／閒冰雷 */
.dragon-neon {
  position: absolute;
  inset: 0;
  box-sizing: border-box;
  border: 0 solid #ffbe3b;
  border-radius: 0;
  box-shadow:
    0 0 10px rgba(255, 165, 30, 0.82),
    inset 0 0 8px rgba(255, 95, 20, 0.65);
  background: radial-gradient(circle, rgba(255, 160, 30, 0.12) 0%, transparent 75%);
  z-index: 8;
  pointer-events: none;
  opacity: 1;
  animation: neon-flow-b 1.8s ease-in-out infinite;
  animation-delay: var(--dragon-delay, 0s);
}

.dragon-neon.t { border-top-width: 3px; border-radius: 0; }
.dragon-neon.b { border-bottom-width: 3px; border-radius: 0; }
.dragon-neon.l { border-left-width: 3px; border-radius: 0; }
.dragon-neon.r { border-right-width: 3px; border-radius: 0; }

/* 只在真正的外轉角設定圓角，讓直線與 L 型轉彎完全無縫接合 */
.dragon-neon.t.l { border-top-left-radius: 7px; }
.dragon-neon.t.r { border-top-right-radius: 7px; }
.dragon-neon.b.l { border-bottom-left-radius: 7px; }
.dragon-neon.b.r { border-bottom-right-radius: 7px; }

.dragon-neon.player-dragon {
  border-color: #4be1ff;
  box-shadow:
    0 0 10px rgba(56, 189, 248, 0.88),
    inset 0 0 8px rgba(37, 99, 235, 0.68);
  background: radial-gradient(circle, rgba(56, 189, 248, 0.14) 0%, transparent 75%);
  animation-name: neon-flow-p;
}

@keyframes neon-flow-b {
  0%, 100% {
    border-color: #ffae2b;
    box-shadow: 0 0 8px rgba(255, 140, 20, 0.7), inset 0 0 6px rgba(255, 80, 10, 0.5);
    filter: brightness(1);
  }
  50% {
    border-color: #fff099;
    box-shadow: 0 0 16px rgba(255, 200, 50, 0.98), 0 0 26px rgba(255, 60, 0, 0.7), inset 0 0 11px rgba(255, 210, 80, 0.85);
    filter: brightness(1.22);
  }
}

@keyframes neon-flow-p {
  0%, 100% {
    border-color: #38bdf8;
    box-shadow: 0 0 8px rgba(56, 189, 248, 0.7), inset 0 0 6px rgba(29, 78, 216, 0.5);
    filter: brightness(1);
  }
  50% {
    border-color: #cffafe;
    box-shadow: 0 0 16px rgba(103, 232, 249, 0.98), 0 0 26px rgba(37, 99, 235, 0.75), inset 0 0 11px rgba(165, 243, 252, 0.85);
    filter: brightness(1.22);
  }
}

/* 3. 大路 SVG 動態流光龍脊 (.dragon-spine-svg) */
.dragon-spine-svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 5;
  overflow: visible;
}

.dragon-spine-svg .spine-base {
  fill: none;
  stroke-width: 0.16;
  stroke-linecap: round;
  stroke-linejoin: round;
  opacity: 0.42;
}

.dragon-spine-svg .spine-stream {
  fill: none;
  stroke-width: 0.11;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-dasharray: 1.4 2.2;
  animation: dragon-spine-dash 1.25s linear infinite;
}

.dragon-spine-svg.banker .spine-base {
  stroke: #ff6b1a;
  filter: drop-shadow(0 0 4px rgba(255, 140, 0, 0.85));
}

.dragon-spine-svg.banker .spine-stream {
  stroke: #fff3a1;
  filter: drop-shadow(0 0 6px rgba(255, 215, 0, 0.95));
}

.dragon-spine-svg.player .spine-base {
  stroke: #0284c7;
  filter: drop-shadow(0 0 4px rgba(56, 189, 248, 0.85));
}

.dragon-spine-svg.player .spine-stream {
  stroke: #e0f2fe;
  filter: drop-shadow(0 0 6px rgba(103, 232, 249, 0.95));
}

@keyframes dragon-spine-dash {
  from { stroke-dashoffset: 3.6; }
  to { stroke-dashoffset: 0; }
}

/* 4. 大路右上角常駐長龍徽章 (#dragonCornerBadge) —— 不擋看路、點擊可重播大龍 */
.dragon-corner-badge {
  position: absolute;
  top: 6px;
  right: 10px;
  z-index: 25;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 14px 4px 10px;
  border-radius: 999px;
  font-family: "Noto Serif TC", "Cinzel", serif;
  font-size: 16px;
  font-weight: 900;
  letter-spacing: 1px;
  color: #fff9e6;
  cursor: pointer;
  user-select: none;
  border: 1.5px solid #ffd56b;
  background: linear-gradient(135deg, rgba(130, 18, 10, 0.92), rgba(65, 6, 4, 0.94));
  box-shadow:
    0 4px 14px rgba(0, 0, 0, 0.55),
    0 0 14px rgba(255, 175, 40, 0.65),
    inset 0 1px 0 rgba(255, 255, 255, 0.35);
  transition: transform 0.18s ease, box-shadow 0.18s ease, opacity 0.25s ease;
  animation: corner-badge-pulse-b 2.2s ease-in-out infinite;
}

.dragon-corner-badge[hidden] {
  display: none !important;
}

.dragon-corner-badge:hover {
  transform: translateY(-1px) scale(1.04);
}

.dragon-corner-badge:active {
  transform: scale(0.97);
}

.dragon-corner-badge.player-badge {
  border-color: #67e8f9;
  background: linear-gradient(135deg, rgba(10, 52, 130, 0.92), rgba(6, 22, 68, 0.94));
  box-shadow:
    0 4px 14px rgba(0, 0, 0, 0.55),
    0 0 14px rgba(56, 189, 248, 0.7),
    inset 0 1px 0 rgba(255, 255, 255, 0.35);
  animation-name: corner-badge-pulse-p;
}

.dragon-badge-icon {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  display: inline-block;
  background: radial-gradient(circle at 35% 35%, #fff7b2 0%, #ffb700 45%, #e62e00 100%);
  box-shadow: 0 0 8px #ffb700;
}

.dragon-corner-badge.player-badge .dragon-badge-icon {
  background: radial-gradient(circle at 35% 35%, #e0f9ff 0%, #38bdf8 45%, #1d4ed8 100%);
  box-shadow: 0 0 8px #38bdf8;
}

.dragon-badge-count {
  font-family: "Cinzel", "Abril Fatface", serif;
  font-size: 22px;
  line-height: 1;
  color: #ffe57f;
  text-shadow: 0 0 8px rgba(255, 190, 0, 0.9);
}

.dragon-corner-badge.player-badge .dragon-badge-count {
  color: #a5f3fc;
  text-shadow: 0 0 8px rgba(56, 189, 248, 0.9);
}

@keyframes corner-badge-pulse-b {
  0%, 100% { box-shadow: 0 4px 12px rgba(0,0,0,0.5), 0 0 10px rgba(255, 165, 20, 0.55); }
  50% { box-shadow: 0 4px 16px rgba(0,0,0,0.6), 0 0 20px rgba(255, 200, 50, 0.95), 0 0 30px rgba(255, 70, 10, 0.55); }
}

@keyframes corner-badge-pulse-p {
  0%, 100% { box-shadow: 0 4px 12px rgba(0,0,0,0.5), 0 0 10px rgba(56, 189, 248, 0.55); }
  50% { box-shadow: 0 4px 16px rgba(0,0,0,0.6), 0 0 20px rgba(103, 232, 249, 0.95), 0 0 30px rgba(37, 99, 235, 0.6); }
}

/* 5. 全螢幕巨龍特效層 (#dragonOverlay) —— 2.8秒展演後自動淡出，不擋看路 */
.dragon-overlay {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  pointer-events: none;
  z-index: 9500;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.45s cubic-bezier(0.22, 1, 0.36, 1), visibility 0.45s;
}

.dragon-overlay.banker-dragon-overlay {
  background: radial-gradient(circle at 50% 46%, rgba(120, 28, 0, 0.52) 0%, rgba(45, 6, 0, 0.68) 46%, rgba(8, 2, 0, 0.45) 100%);
}

.dragon-overlay.player-dragon-overlay {
  background: radial-gradient(circle at 50% 46%, rgba(0, 58, 135, 0.52) 0%, rgba(4, 16, 54, 0.68) 46%, rgba(0, 4, 14, 0.45) 100%);
}

.dragon-overlay.active {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  cursor: pointer;
}

.dragon-overlay.fading-out {
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.55s ease-in, visibility 0.55s;
}

.dragon-fx-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 1;
}

.dragon-stage {
  position: relative;
  z-index: 2;
  width: 100vw;
  height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  padding-top: 2.5vh;
  gap: 1.5vh;
  box-sizing: border-box;
  pointer-events: none;
}

/* 背光能量光環（純ハードウェア加速 transform/opacity，不每幀重算高斯模糊） */
.dragon-aura-ring {
  position: absolute;
  top: 1.5vh;
  left: 50%;
  width: 73vh;
  height: 73vh;
  margin-left: -36.5vh;
  border-radius: 50%;
  pointer-events: none;
  opacity: 0.9;
  background: radial-gradient(circle, rgba(255, 195, 45, 0.52) 0%, rgba(255, 80, 10, 0.28) 42%, transparent 72%);
  animation: aura-breathe 2.2s ease-in-out infinite;
}

.dragon-overlay.player-dragon-overlay .dragon-aura-ring {
  background: radial-gradient(circle, rgba(80, 225, 255, 0.52) 0%, rgba(25, 105, 255, 0.28) 42%, transparent 72%);
}

/* 旋轉陣法光輪 */
.dragon-magic-circle {
  position: absolute;
  top: 5.5vh;
  left: 50%;
  width: 65vh;
  height: 65vh;
  margin-left: -32.5vh;
  border-radius: 50%;
  pointer-events: none;
  border: 2px dashed rgba(255, 210, 90, 0.42);
  box-shadow:
    0 0 35px rgba(255, 150, 20, 0.35),
    inset 0 0 35px rgba(255, 150, 20, 0.25);
  animation: magic-spin 16s linear infinite;
}

.dragon-magic-circle::before {
  content: "";
  position: absolute;
  inset: 8%;
  border-radius: 50%;
  border: 1.5px solid rgba(255, 230, 140, 0.28);
}

.dragon-overlay.player-dragon-overlay .dragon-magic-circle {
  border-color: rgba(103, 232, 249, 0.45);
  box-shadow:
    0 0 35px rgba(56, 189, 248, 0.38),
    inset 0 0 35px rgba(56, 189, 248, 0.25);
}

.dragon-overlay.player-dragon-overlay .dragon-magic-circle::before {
  border-color: rgba(165, 243, 252, 0.3);
}

@keyframes aura-breathe {
  0%, 100% { transform: scale(0.94); opacity: 0.78; }
  50% { transform: scale(1.06); opacity: 1; }
}

@keyframes magic-spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

/* 巨龍主圖本體（位於上方 2.5vh ~ 73.5vh，下方留給文字，完全不重疊） */
.golden-dragon-img {
  position: relative;
  z-index: 3;
  width: 71vh;
  height: 71vh;
  max-width: 82vw;
  flex-shrink: 0;
  object-fit: contain;
  transform: scale(0.2);
  opacity: 0;
  filter: none;
  will-change: transform, opacity;
}

.dragon-overlay.banker-dragon-overlay .dragon-banker-img,
.dragon-overlay.player-dragon-overlay .dragon-player-img {
  display: block;
}

/* 初登場（連7）破空衝出 + 游動呼吸 */
.dragon-overlay.active.banker-dragon-overlay .dragon-banker-img,
.dragon-overlay.active.player-dragon-overlay .dragon-player-img {
  animation:
    dragon-hero-entrance 0.78s cubic-bezier(0.16, 1, 0.3, 1) forwards,
    dragon-living-float 3.2s ease-in-out infinite 0.78s;
}

/* 連勝追加（連8、連9...）龍身暴衝震擊 */
.dragon-overlay.active.hit.banker-dragon-overlay .dragon-banker-img,
.dragon-overlay.active.hit.player-dragon-overlay .dragon-player-img {
  animation:
    dragon-strike-pulse 0.62s cubic-bezier(0.22, 1, 0.36, 1) forwards,
    dragon-living-float 3.2s ease-in-out infinite 0.62s;
}

/* 退場化光消散 */
.dragon-overlay.fading-out .dragon-banker-img,
.dragon-overlay.fading-out .dragon-player-img {
  animation: dragon-dissolve-out 0.55s ease-in forwards !important;
}

@keyframes dragon-hero-entrance {
  0% {
    transform: translateY(4%) scale(0.18) rotate(-7deg);
    opacity: 0;
    filter: brightness(2.2);
  }
  62% {
    transform: translateY(-1%) scale(1.03) rotate(1.2deg);
    opacity: 1;
    filter: brightness(1.3);
  }
  100% {
    transform: translateY(0) scale(1) rotate(0deg);
    opacity: 1;
    filter: brightness(1.08);
  }
}

@keyframes dragon-strike-pulse {
  0% {
    transform: translateY(0) scale(0.86);
    opacity: 1;
    filter: brightness(1.9);
  }
  42% {
    transform: translateY(-1.5%) scale(1.06) rotate(1deg);
    opacity: 1;
    filter: brightness(1.35);
  }
  100% {
    transform: translateY(0) scale(1) rotate(0deg);
    opacity: 1;
    filter: brightness(1.08);
  }
}

@keyframes dragon-living-float {
  0%, 100% {
    transform: translateY(0) scale(1) rotate(0deg);
  }
  50% {
    transform: translateY(-1.8%) scale(1.02) rotate(0.8deg);
  }
}

@keyframes dragon-dissolve-out {
  0% {
    transform: translateY(0) scale(1);
    opacity: 1;
    filter: brightness(1.1);
  }
  100% {
    transform: translateY(-5%) scale(1.12);
    opacity: 0;
    filter: brightness(1.8);
  }
}

/* 6. 莊／閒專屬立體金屬連勝字（排在巨龍正下方、無深色底框、0px 重疊） */
.dragon-banner {
  position: relative;
  bottom: auto;
  left: auto;
  transform: none;
  z-index: 6;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-width: 0;
  padding: 0;
  border-radius: 0;
  background: transparent !important;
  border: 0 !important;
  box-shadow: none !important;
  overflow: visible;
}

.dragon-banner::after {
  display: none !important;
}

.dragon-overlay.player-dragon-overlay .dragon-banner {
  background: transparent !important;
  border: 0 !important;
  box-shadow: none !important;
}

.dragon-title {
  font-family: "Noto Serif TC", "Cinzel", serif;
  font-size: 3.2vh;
  line-height: 1.15;
  font-weight: 900;
  letter-spacing: 5px;
  color: #ffe8a3;
  text-shadow:
    0 2px 8px rgba(0, 0, 0, 0.95),
    0 0 18px rgba(255, 165, 0, 0.92),
    0 0 32px rgba(220, 38, 38, 0.75);
  margin-bottom: 0.2vh;
  white-space: nowrap;
}

.dragon-overlay.player-dragon-overlay .dragon-title {
  color: #cffafe;
  text-shadow:
    0 2px 8px rgba(0, 0, 0, 0.95),
    0 0 18px rgba(56, 189, 248, 0.95),
    0 0 32px rgba(37, 99, 235, 0.8);
}

.dragon-combo-wrap {
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 12px;
}

/* 覆寫原本固定金紅的 .dragon-combo，改為莊金火／閒冰雷雙主題立體字 */
.dragon-combo {
  position: relative;
  font-size: 13.5vh;
  line-height: 0.95;
  font-family: "Cinzel", "Abril Fatface", serif;
  font-weight: 900;
  color: #fffdf2;
  text-shadow:
    0 3px 0 #b45309,
    0 6px 0 #78350f,
    0 8px 18px rgba(0, 0, 0, 0.85),
    0 0 18px rgba(255, 230, 110, 0.95),
    0 0 42px rgba(255, 120, 0, 0.9),
    0 0 75px rgba(239, 68, 68, 0.85);
  z-index: 10;
  opacity: 1;
}

.dragon-overlay.player-dragon-overlay .dragon-combo {
  color: #f0fdff;
  text-shadow:
    0 3px 0 #0369a1,
    0 6px 0 #1e3a8a,
    0 8px 18px rgba(0, 0, 0, 0.85),
    0 0 18px rgba(165, 243, 252, 0.98),
    0 0 42px rgba(56, 189, 248, 0.92),
    0 0 75px rgba(37, 99, 235, 0.9);
}

.dragon-combo-unit {
  font-family: "Noto Serif TC", serif;
  font-size: 4.5vh;
  font-weight: 900;
  letter-spacing: 3px;
  color: #ffd56b;
  text-shadow:
    0 2px 8px rgba(0, 0, 0, 0.95),
    0 0 16px rgba(255, 165, 0, 0.9);
}

.dragon-overlay.player-dragon-overlay .dragon-combo-unit {
  color: #7dd3fc;
  text-shadow:
    0 2px 8px rgba(0, 0, 0, 0.95),
    0 0 16px rgba(56, 189, 248, 0.92);
}

.dragon-subtitle {
  display: none;
}

.dragon-combo.pop {
  animation: combo-pop-v2 0.75s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}

@keyframes combo-pop-v2 {
  0% {
    transform: scale(0.25);
    opacity: 0;
    filter: brightness(2.2);
  }
  45% {
    transform: scale(1.24);
    opacity: 1;
    filter: brightness(1.45);
  }
  100% {
    transform: scale(1);
    opacity: 1;
    filter: brightness(1);
  }
}
