/* ============================================================
   賽馬遊戲
   ============================================================ */

.hr-header-icon {
  font-size: 22px;
  line-height: 1;
}

.hr-section-title {
  font-size: 13.5px;
  font-weight: 700;
  letter-spacing: 1px;
  color: var(--gold-200, #e8c25a);
  margin: 0 0 12px;
}

/* ---------- 餘額 ---------- */

.hr-balance {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  margin-bottom: 14px;
  border-radius: 14px;
  background: linear-gradient(135deg, rgba(212, 175, 55, 0.14), rgba(184, 134, 11, 0.05));
  border: 1px solid rgba(212, 175, 55, 0.28);
}

.hr-balance-label {
  font-size: 12px;
  color: #a89860;
  letter-spacing: 0.5px;
}

.hr-balance-value {
  display: flex;
  align-items: baseline;
  gap: 4px;
  margin-left: auto;
  font-variant-numeric: tabular-nums;
}

#hr-balance {
  font-size: 22px;
  font-weight: 800;
  background: linear-gradient(135deg, #ffe79a, #e8c25a 55%, #b8860b);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.hr-balance-unit {
  font-size: 11px;
  color: #a89860;
  font-weight: 700;
}

.hr-reset-btn {
  flex-shrink: 0;
  padding: 6px 11px;
  border-radius: 8px;
  border: 1px solid rgba(212, 175, 55, 0.35);
  background: rgba(212, 175, 55, 0.1);
  color: #e8c25a;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
}

.hr-reset-btn:active {
  transform: scale(0.96);
}

/* ---------- 賽道 ---------- */

.hr-track-wrap {
  margin-bottom: 16px;
}


/* 終點線 */
.hr-lane::after {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  right: 0;
  width: 10px;
  background:
    repeating-linear-gradient(
      45deg,
      rgba(255, 255, 255, 0.5) 0 4px,
      rgba(0, 0, 0, 0.55) 4px 8px
    );
  opacity: 0.75;
}

.hr-lane-num {
  position: absolute;
  left: 5px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 9px;
  font-weight: 700;
  color: rgba(255, 255, 255, 0.3);
  z-index: 1;
  font-variant-numeric: tabular-nums;
}

/* 馬匹 */
.hr-horse {
  position: absolute;
  top: 50%;
  left: 14px;
  transform: translate(0, -50%);
  font-size: 19px;
  line-height: 1;
  transition: none;
  will-change: transform;
  z-index: 2;
  filter: drop-shadow(0 1px 3px rgba(0, 0, 0, 0.7));
}

/* 馬名標籤 */
.hr-lane-name {
  position: absolute;
  top: 50%;
  left: 34px;
  transform: translateY(-50%);
  font-size: 10px;
  font-weight: 700;
  color: rgba(255, 255, 255, 0.55);
  letter-spacing: 0.5px;
  z-index: 1;
  pointer-events: none;
  white-space: nowrap;
  max-width: 76px;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* 賽道上的名次標記 */
.hr-lane-rank {
  position: absolute;
  top: 50%;
  right: 16px;
  transform: translateY(-50%);
  font-size: 10px;
  font-weight: 800;
  color: #ffd75e;
  z-index: 3;
  opacity: 0;
  font-variant-numeric: tabular-nums;
}

.hr-lane.done .hr-lane-rank {
  opacity: 1;
}

.hr-lane.winner {
  background: rgba(232, 194, 90, 0.14);
}

.hr-lane.winner .hr-lane-name {
  color: #ffd75e;
}

/* ---------- 金色賽道（蘇巧慧） ---------- */

/* 平時就是淡金色底，跟其他跑道區隔 */
.hr-lane[data-horse="1"] {
  background:
    linear-gradient(90deg, rgba(212, 175, 55, 0.16), rgba(212, 175, 55, 0.05));
  border: 1px solid rgba(212, 175, 55, 0.28);
  box-shadow: inset 0 0 18px rgba(212, 175, 55, 0.12);
}

/* 技能觸發時的爆閃 */
@keyframes goldRush {
  0% {
    box-shadow:
      inset 0 0 18px rgba(255, 220, 120, 0.5),
      0 0 0 rgba(255, 215, 94, 0);
  }
  35% {
    box-shadow:
      inset 0 0 34px rgba(255, 226, 140, 0.95),
      0 0 26px rgba(255, 215, 94, 0.85);
  }
  100% {
    box-shadow:
      inset 0 0 18px rgba(255, 220, 120, 0.35),
      0 0 0 rgba(255, 215, 94, 0);
  }
}

.hr-lane.gold-rush {
  animation: goldRush 5s ease-out 2;
  border-color: rgba(255, 215, 94, 0.9);
}

/* ---------- 岩石賽道（李四川） ---------- */

/*
 * 平時就是岩石質感：
 *   用多層不規則漸層模擬碎石，
 *   加上土色調的邊框。
 */
.hr-lane[data-horse="2"] {
  background:
    radial-gradient(circle at 12% 30%, rgba(120, 100, 75, 0.35) 0 3px, transparent 3px),
    radial-gradient(circle at 38% 70%, rgba(100, 82, 60, 0.4) 0 4px, transparent 4px),
    radial-gradient(circle at 62% 25%, rgba(130, 108, 82, 0.3) 0 3px, transparent 3px),
    radial-gradient(circle at 84% 60%, rgba(110, 90, 66, 0.35) 0 4px, transparent 4px),
    linear-gradient(135deg, rgba(92, 78, 58, 0.42), rgba(58, 48, 36, 0.28));
  border: 1px solid rgba(139, 115, 85, 0.55);
  box-shadow: inset 0 0 14px rgba(0, 0, 0, 0.45);
}

/* 技能觸發：土石爆裂 */
@keyframes rockRush {
  0% {
    box-shadow: inset 0 0 14px rgba(0, 0, 0, 0.45);
    transform: translateX(0);
  }
  8% {
    transform: translateX(-2px);
  }
  16% {
    transform: translateX(2px);
  }
  24% {
    transform: translateX(-1.5px);
  }
  32% {
    transform: translateX(1px);
  }
  45% {
    box-shadow:
      inset 0 0 30px rgba(160, 130, 95, 0.9),
      inset 0 0 6px rgba(255, 220, 170, 0.5);
    transform: translateX(0);
  }
  100% {
    box-shadow: inset 0 0 14px rgba(0, 0, 0, 0.45);
    transform: translateX(0);
  }
}

.hr-lane.rock-rush {
  animation: rockRush 4s ease-out 2;
  border-color: rgba(180, 150, 110, 0.95);
}

/* ---------- 技能喊話 ---------- */

/* 縮放值乘上 --fx（由 JS 依第幾段設定），同一組 keyframes 表現 4 段遞減 */
@keyframes skillShout {
  0% {
    opacity: 0;
    transform: translate(-50%, -50%) scale(calc(0.5 * var(--fx, 1))) rotate(-8deg);
  }
  18% {
    transform: translate(-50%, -50%) scale(calc(1.14 * var(--fx, 1))) rotate(-2deg);
  }
  30% {
    transform: translate(-50%, -50%) scale(var(--fx, 1)) rotate(0deg);
  }
  80% {
    opacity: 1;
    transform: translate(-50%, -50%) scale(var(--fx, 1)) rotate(0deg);
  }
  100% {
    opacity: 0.9;
    transform: translate(-50%, -50%) scale(calc(1.04 * var(--fx, 1))) rotate(0deg);
  }
}

@keyframes skillOut {
  to {
    opacity: 0;
    transform: translate(-50%, -50%) scale(1.35);
  }
}

.hr-skill-shout {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 10;
  padding: 5px 14px;
  border-radius: 999px;
  white-space: nowrap;
  font-size: 12.5px;
  font-weight: 900;
  letter-spacing: 1.5px;
  pointer-events: none;

  /* 金色漸層字 + 深底，在跑道上非常顯眼 */
  background: linear-gradient(135deg, #3d2a00, #1a1200);
  border: 1.5px solid #ffd75e;

  background-clip: padding-box;
  color: #ffe79a;
  -webkit-text-fill-color: #ffe79a;

  text-shadow:
    0 0 8px rgba(255, 215, 94, 0.95),
    0 0 18px rgba(232, 194, 90, 0.7);

  box-shadow:
    0 0 18px rgba(255, 215, 94, 0.75),
    0 0 40px rgba(232, 194, 90, 0.4),
    inset 0 0 14px rgba(255, 215, 94, 0.2);
}

.hr-skill-shout.firing {
  animation: skillShout 1.6s cubic-bezier(0.18, 1.2, 0.36, 1) forwards;
}


.hr-skill-shout.fade-out {
  animation: skillOut 2s ease-out forwards;
}

/* 岩石系技能文字（李四川） */
.hr-skill-shout.rock {
  background:
    linear-gradient(135deg, #4a3f33, #2b241c);
  border: 1.5px solid #b49a6f;
  color: #f0e0c8;
  -webkit-text-fill-color: #f0e0c8;
  text-shadow:
    0 0 8px rgba(220, 190, 140, 0.9),
    0 2px 0 rgba(0, 0, 0, 0.7);
  box-shadow:
    0 0 18px rgba(180, 154, 111, 0.7),
    0 0 40px rgba(139, 115, 85, 0.45),
    inset 0 0 14px rgba(160, 130, 95, 0.25);
  /* 顆粒感邊緣 */
  letter-spacing: 2px;
}

/* 狀態文字 */
.hr-track-status {
  margin-top: 8px;
  text-align: center;
  font-size: 11.5px;
  color: #8b98ab;
  letter-spacing: 0.3px;
  line-height: 1.6;
  min-height: 18px;
}

.hr-track-status.live {
  color: #ffd75e;
  font-weight: 700;
}

/* ---------- 下注區 ---------- */

.hr-bet-panel {
  padding: 16px;
  border-radius: 16px;
  background: var(--navy-800, #121a26);
  border: 1px solid rgba(255, 255, 255, 0.07);
  margin-bottom: 16px;
}

/* 玩法切換 */
.hr-kind-tabs {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 7px;
  margin-bottom: 15px;
}

.hr-kind-tab {
  padding: 9px 4px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.03);
  color: #8b98ab;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.2s;
  display: flex;
  flex-direction: column;
  gap: 3px;
  align-items: center;
}

.hr-kind-tab.on {
  border-color: rgba(232, 194, 90, 0.6);
  background: rgba(232, 194, 90, 0.12);
}

.hr-kind-name {
  font-size: 13.5px;
  font-weight: 700;
  letter-spacing: 1px;
}

.hr-kind-tab.on .hr-kind-name {
  color: #ffe79a;
}

.hr-kind-desc {
  font-size: 10px;
  opacity: 0.75;
}

/* 選馬格 */
.hr-horse-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 7px;
  margin-bottom: 11px;
}

.hr-horse-cell {
  padding: 9px 3px 8px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.09);
  background: rgba(255, 255, 255, 0.025);
  cursor: pointer;
  font-family: inherit;
  transition: all 0.18s;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  position: relative;
  overflow: hidden;
}

.hr-horse-cell::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--hc, #666);
  opacity: 0.8;
}

.hr-horse-cell.on {
  border-color: rgba(232, 194, 90, 0.7);
  background: rgba(232, 194, 90, 0.13);
  box-shadow: 0 0 14px rgba(232, 194, 90, 0.22);
}

.hr-cell-icon {
  font-size: 16px;
  line-height: 1;
}

.hr-cell-name {
  font-size: 11px;
  font-weight: 700;
  color: #c9d4e0;
  letter-spacing: 0.3px;
  /* 人名可能三個字，縮小並保持單行 */
  white-space: nowrap;
  transform: scale(0.92);
  transform-origin: center;
}

.hr-horse-cell.on .hr-cell-name {
  color: #ffe79a;
}

.hr-cell-odds {
  font-size: 11px;
  font-weight: 800;
  color: #4ade80;
  font-variant-numeric: tabular-nums;
}

.hr-horse-cell.on .hr-cell-odds {
  color: #86efac;
}

/* 技能標記 */
.hr-cell-skill {
  margin-top: 1px;
  padding: 1px 6px;
  border-radius: 999px;
  font-size: 8.5px;
  font-weight: 900;
  letter-spacing: 0.3px;
  background: linear-gradient(135deg, #ffd75e, #b8860b);
  color: #1a1200;
  line-height: 1.5;
}

/* 有技能的格子外框帶金邊 */
.hr-horse-cell.has-skill {
  border-color: rgba(212, 175, 55, 0.45);
}

/* 金額 */
.hr-amount-row {
  margin-bottom: 10px;
}

.hr-amount-label {
  font-size: 11.5px;
  color: #8b98ab;
  margin-bottom: 6px;
  letter-spacing: 0.3px;
}

.hr-amount-input-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 3px 12px 3px 13px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.hr-amount-input {
  flex: 1;
  min-width: 0;
  padding: 9px 0;
  border: 0;
  outline: none;
  background: transparent;
  color: var(--text-primary, #e8eef6);
  font-size: 16px;
  font-weight: 700;
  font-family: inherit;
  font-variant-numeric: tabular-nums;
}

.hr-amount-unit {
  flex-shrink: 0;
  font-size: 11px;
  font-weight: 700;
  color: #a89860;
}

/* 快捷 */
.hr-quick {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 6px;
  margin-bottom: 13px;
}

.hr-chip {
  padding: 8px 0;
  border-radius: 9px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.04);
  color: #c9d4e0;
  font-size: 11.5px;
  font-weight: 700;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.15s;
  font-variant-numeric: tabular-nums;
}

.hr-chip.on {
  border-color: rgba(232, 194, 90, 0.6);
  background: rgba(232, 194, 90, 0.16);
  color: #ffe79a;
}

.hr-chip:active {
  transform: scale(0.96);
}

/* 潛在獎金 */
.hr-potential {
  padding: 11px 13px;
  margin-bottom: 13px;
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.24);
  border: 1px solid rgba(255, 255, 255, 0.06);
  font-size: 12.5px;
  color: #8b98ab;
  text-align: center;
  line-height: 1.6;
  font-variant-numeric: tabular-nums;
}

.hr-potential b {
  color: #ffd75e;
  font-size: 15px;
  font-weight: 800;
}

/* 開始按鈕 */
.hr-start-btn {
  width: 100%;
  padding: 14px;
  border: 0;
  border-radius: 30px;
  font-family: inherit;
  font-size: 15px;
  font-weight: 800;
  letter-spacing: 2px;
  cursor: pointer;
  background: linear-gradient(135deg, #f0d98a, #d4af37 55%, #b8942a);
  color: #1a1200;
  box-shadow: 0 6px 22px rgba(212, 175, 55, 0.3);
  transition: all 0.2s;
}

.hr-start-btn:disabled {
  background: #2a3548;
  color: #6b7a8d;
  cursor: not-allowed;
  box-shadow: none;
  letter-spacing: 1px;
}

.hr-start-btn:not(:disabled):active {
  transform: translateY(1px);
}

/* ---------- 賽果 ---------- */

.hr-result {
  padding: 16px;
  border-radius: 16px;
  background: var(--navy-800, #121a26);
  border: 1px solid rgba(232, 194, 90, 0.3);
  margin-bottom: 16px;
}

.hr-result.hidden {
  display: none;
}

.hr-result-list {
  display: flex;
  flex-direction: column;
  gap: 5px;
  margin-bottom: 12px;
}

.hr-result-row {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 7px 10px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.03);
  font-size: 12.5px;
}

.hr-result-row.top1 {
  background: rgba(232, 194, 90, 0.14);
  border: 1px solid rgba(232, 194, 90, 0.3);
}

.hr-result-rank {
  width: 20px;
  flex-shrink: 0;
  font-size: 11px;
  font-weight: 800;
  color: #8b98ab;
  font-variant-numeric: tabular-nums;
}

.hr-result-row.top1 .hr-result-rank {
  color: #ffd75e;
}

.hr-result-icon {
  font-size: 14px;
  line-height: 1;
}

.hr-result-name {
  flex: 1;
  font-weight: 700;
  color: #c9d4e0;
}

.hr-result-row.top1 .hr-result-name {
  color: #ffe79a;
}

.hr-result-time {
  font-size: 11px;
  color: #6b7a8d;
  font-variant-numeric: tabular-nums;
}

.hr-result-summary {
  padding: 13px;
  border-radius: 10px;
  text-align: center;
  font-size: 14px;
  font-weight: 700;
  line-height: 1.6;
  letter-spacing: 0.5px;
}

.hr-result-summary.win {
  background: rgba(74, 222, 128, 0.13);
  border: 1px solid rgba(74, 222, 128, 0.4);
  color: #4ade80;
}

.hr-result-summary.lose {
  background: rgba(248, 113, 113, 0.11);
  border: 1px solid rgba(248, 113, 113, 0.35);
  color: #f87171;
}

/* ---------- 歷史 ---------- */

.hr-history {
  margin-bottom: 16px;
}

.hr-history-list {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.hr-history-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 11px;
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.03);
  font-size: 12px;
}

.hr-hist-detail {
  flex: 1;
  color: #c9d4e0;
  line-height: 1.5;
}

.hr-hist-amount {
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

.hr-hist-amount.win {
  color: #4ade80;
}

.hr-hist-amount.lose {
  color: #f87171;
}

.hr-empty {
  padding: 20px 0;
  text-align: center;
  font-size: 12px;
  color: #6b7a8d;
}

/* ---------- 說明 ---------- */

.hr-rules {
  margin-bottom: 10px;
}

.hr-rules-list {
  margin: 0;
  padding-left: 18px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.hr-rules-list li {
  font-size: 12px;
  line-height: 1.7;
  color: #8b98ab;
}

.hr-rules-list b {
  color: #ffe79a;
}

/* ---------- RWD ---------- */

@media (max-width: 380px) {
  .hr-horse-grid {
    grid-template-columns: repeat(4, 1fr);
    gap: 5px;
  }

  .hr-cell-name {
    font-size: 10px;
  }

  .hr-quick {
    grid-template-columns: repeat(5, 1fr);
    gap: 4px;
  }

  .hr-chip {
    font-size: 10.5px;
    padding: 7px 0;
  }
}

/* ============================================================
   新北市標題
   ============================================================ */

.hr-city-banner {
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 10px;
  margin: 0 0 14px;
  padding: 12px 14px;
  border-radius: 14px;
  background:
    linear-gradient(135deg, rgba(212, 175, 55, 0.14), rgba(120, 70, 20, 0.06));
  border: 1px solid rgba(212, 175, 55, 0.32);
}

.hr-city-name {
  font-size: 22px;
  font-weight: 900;
  letter-spacing: 5px;
  background: linear-gradient(135deg, #fff3c4, #ffd75e 45%, #d4af37);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  text-shadow: 0 0 20px rgba(232, 194, 90, 0.35);
}

.hr-city-race {
  font-size: 12.5px;
  letter-spacing: 2px;
  color: rgba(200, 180, 140, 0.85);
}

/* 頁首副標 */
.hr-city {
  letter-spacing: 2px;
  font-weight: 600;
}

@media (max-width: 480px) {
  .hr-city-name {
    font-size: 19px;
    letter-spacing: 4px;
  }

  .hr-city-race {
    font-size: 11.5px;
  }
}

/* ============================================================
   新北市（與「賽馬」同一行）
   ============================================================ */

.hr-city-inline {
  display: inline-block;
  margin-left: 8px;
  padding: 1px 8px 2px;
  border-radius: 6px;

  /* 淺色底 + 黑字，在米色頁面上清楚可見 */
  background: #f5ecd4;
  border: 1px solid rgba(0, 0, 0, 0.35);

  font-size: 12px;
  font-weight: 800;
  letter-spacing: 1.5px;
  vertical-align: middle;

  /* 強制黑色，蓋掉父層 h1 的漸層文字效果 */
  background-clip: padding-box;
  color: #000 !important;
  -webkit-text-fill-color: #000 !important;
  text-shadow: none;
}

@media (max-width: 480px) {
  .hr-city-inline {
    font-size: 10.5px;
    letter-spacing: 1px;
    margin-left: 6px;
    padding: 1px 6px 2px;
  }
}

/* 開始按鈕放在「下注」標題上方時，與下方標題留白 */
.hr-start-btn.hr-start-top {
  margin-bottom: 16px;
}
/* ============================================================
   圓圈式跑道（同心橢圓）
   ============================================================ */

.hr-oval {
  position: relative;
  width: 100%;
  /* 寬高比 4:3，橢圓形比正圓更適合手機 */
  aspect-ratio: 4 / 3;
  max-height: 62vh;
  margin: 0 auto;
  border-radius: 18px;
  overflow: hidden;
  background:
    radial-gradient(ellipse at 50% 45%, #1c2c1f 0%, #0d1410 65%),
    #0a0e14;
  border: 1px solid rgba(255, 255, 255, 0.07);
}

/* 中央看板 */
.hr-oval-center {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  text-align: center;
  z-index: 1;
  pointer-events: none;
}

.hr-oval-title {
  font-size: 17px;
  font-weight: 900;
  letter-spacing: 4px;
  background: linear-gradient(135deg, #fff3c4, #ffd75e 45%, #d4af37);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  opacity: 0.9;
}

.hr-oval-sub {
  margin-top: 3px;
  font-size: 10.5px;
  letter-spacing: 3px;
  color: rgba(200, 180, 140, 0.55);
}

/* 跑道容器 */

/* 每一圈跑道 */
.hr-ring {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  border: 1px dashed rgba(255, 255, 255, 0.13);
  /* 跑道內側淡淡的綠色草地感 */
  box-shadow: inset 0 0 22px rgba(60, 110, 70, 0.1);
}

/* 起跑點標記（12 點鐘方向） */
.hr-ring-start {
  position: absolute;
  left: 50%;
  top: -2px;
  width: 6px;
  height: 6px;
  margin-left: -3px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.35);
}

/* 圓形跑道上的馬 */
.hr-ring .hr-horse {
  position: absolute;
  left: 50%;
  top: 50%;
  font-size: 17px;
  line-height: 1;
  z-index: 3;
  filter: drop-shadow(0 1px 3px rgba(0, 0, 0, 0.8));
  /* 位移由 JS 計算，這裡只設基礎置中 */
  transform: translate(-50%, -50%);
  white-space: nowrap;
}

/* 馬名（跟著馬跑） */
.hr-ring-name {
  position: absolute;
  left: 50%;
  top: 100%;
  transform: translateX(-50%);
  margin-top: 1px;
  font-size: 8px;
  font-weight: 700;
  letter-spacing: 0.3px;
  color: rgba(255, 255, 255, 0.72);
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.95);
  pointer-events: none;
}

/* 跑到上半圈時，名字改到馬上方，避免壓到內圈 */
.hr-ring .hr-horse.flip .hr-ring-name {
  top: auto;
  bottom: 100%;
  margin-top: 0;
  margin-bottom: 1px;
}

/* 名次 */
.hr-ring-rank {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  font-size: 9px;
  font-weight: 900;
  color: #ffd75e;
  text-shadow: 0 0 6px rgba(0, 0, 0, 1);
  opacity: 0;
  pointer-events: none;
}

.hr-ring.done .hr-ring-rank {
  opacity: 1;
}

/* 冠軍圈 */
.hr-ring.winner {
  border-color: rgba(255, 215, 94, 0.85);
  border-style: solid;
  box-shadow:
    inset 0 0 22px rgba(255, 215, 94, 0.18),
    0 0 16px rgba(255, 215, 94, 0.28);
}

.hr-ring.winner .hr-ring-name {
  color: #ffd75e;
}

/* 金色跑道（蘇巧慧） */
.hr-ring[data-horse="1"] {
  border-color: rgba(212, 175, 55, 0.45);
  box-shadow:
    inset 0 0 24px rgba(212, 175, 55, 0.16),
    0 0 8px rgba(212, 175, 55, 0.12);
}

/* 岩石跑道（李四川） */
.hr-ring[data-horse="2"] {
  border-color: rgba(139, 115, 85, 0.6);
  border-style: dotted;
  box-shadow:
    inset 0 0 24px rgba(90, 75, 55, 0.35),
    0 0 8px rgba(139, 115, 85, 0.18);
}

/* 金色爆閃（技能觸發） */
.hr-ring.gold-rush {
  animation: goldRush 5s ease-out 2;
}

/* 岩石震動（技能觸發） */
.hr-ring.rock-rush {
  animation: rockRush 4s ease-out 2;
}

/* 手機微調 */
@media (max-width: 480px) {
  .hr-oval {
    aspect-ratio: 1 / 1;
    max-height: 58vh;
  }

  .hr-oval-title {
    font-size: 15px;
    letter-spacing: 3px;
  }

  .hr-ring .hr-horse {
    font-size: 15px;
  }

  .hr-ring-name {
    font-size: 7.5px;
  }
}


/* ============================================================
   直線跑道（三匹馬）
   ============================================================ */

.hr-track {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 14px 10px;
  border-radius: 16px;
  background:
    repeating-linear-gradient(
      90deg,
      rgba(255, 255, 255, 0.022) 0 28px,
      transparent 28px 56px
    ),
    linear-gradient(180deg, #16211a, #0d1410);
  border: 1px solid rgba(255, 255, 255, 0.07);
}

/* 單一跑道 */
.hr-lane {
  position: relative;
  height: 52px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.035);
  border: 1px solid rgba(255, 255, 255, 0.06);
  overflow: hidden;
}

/* 起跑線 */
.hr-lane::before {
  content: "";
  position: absolute;
  left: 26px;
  top: 6px;
  bottom: 6px;
  width: 2px;
  border-radius: 2px;
  background: rgba(255, 255, 255, 0.22);
}

/* 終點線 */
.hr-lane::after {
  content: "";
  position: absolute;
  right: 18px;
  top: 0;
  bottom: 0;
  width: 8px;
  background:
    repeating-linear-gradient(
      45deg,
      rgba(255, 255, 255, 0.55) 0 4px,
      rgba(0, 0, 0, 0.6) 4px 8px
    );
  opacity: 0.8;
}

/* 馬 */
/*
 * 馬圖示。
 *
 * 🐎 這個 emoji 在絕大多數系統上是「馬頭朝左」，
 * 但我們的賽道是從左跑到右，
 * 所以用 scaleX(-1) 水平翻轉，讓馬頭朝右。
 *
 * ⚠️ translate 與 scaleX 寫在同一行 transform：
 *    先平移再翻轉，位置才不會被翻轉影響。
 */
.hr-lane .hr-horse {
  position: absolute;
  left: 0;
  top: 50%;
  font-size: 26px;
  line-height: 1;
  z-index: 2;
  white-space: nowrap;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.75));
  will-change: transform;
  transform: translate(28px, -50%) scaleX(-1);
}

/* 馬名（跟在馬下方） */
.hr-lane-name {
  position: absolute;
  left: 50%;
  top: 102%;
  /*
   * 父層馬圖示被 scaleX(-1) 翻轉，
   * 中文名字會被鏡射，所以這裡再翻一次抵銷。
   */
  transform: translateX(-50%) scaleX(-1);
  font-size: 9.5px;
  font-weight: 800;
  letter-spacing: 0.5px;
  color: rgba(255, 255, 255, 0.85);
  text-shadow: 0 1px 4px rgba(0, 0, 0, 1);
  pointer-events: none;
  white-space: nowrap;
}

/* 名次 */
.hr-lane-rank {
  position: absolute;
  right: 30px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 13px;
  font-weight: 900;
  color: #ffd75e;
  text-shadow: 0 0 8px rgba(0, 0, 0, 1);
  opacity: 0;
  z-index: 3;
  transition: opacity 0.3s;
}

.hr-lane.done .hr-lane-rank {
  opacity: 1;
}

/* 冠軍跑道 */
.hr-lane.winner {
  background: rgba(232, 194, 90, 0.13);
  border-color: rgba(255, 215, 94, 0.55);
  box-shadow: inset 0 0 20px rgba(255, 215, 94, 0.15);
}

/* 金色跑道（蘇巧慧） */
.hr-lane[data-horse="1"] {
  background:
    linear-gradient(90deg, rgba(212, 175, 55, 0.18), rgba(212, 175, 55, 0.05));
  border-color: rgba(212, 175, 55, 0.4);
}

/* 岩石跑道（李四川） */
.hr-lane[data-horse="2"] {
  background:
    radial-gradient(circle at 15% 35%, rgba(120, 100, 75, 0.4) 0 4px, transparent 4px),
    radial-gradient(circle at 45% 70%, rgba(100, 82, 60, 0.45) 0 5px, transparent 5px),
    radial-gradient(circle at 72% 30%, rgba(130, 108, 82, 0.35) 0 4px, transparent 4px),
    linear-gradient(135deg, rgba(92, 78, 58, 0.45), rgba(58, 48, 36, 0.3));
  border-color: rgba(139, 115, 85, 0.6);
}

/* 紫色跑道（蘇輝湟） */
.hr-lane[data-horse="3"] {
  background:
    linear-gradient(90deg, rgba(139, 92, 246, 0.16), rgba(139, 92, 246, 0.04));
  border-color: rgba(139, 92, 246, 0.35);
}

/* 手機微調 */
@media (max-width: 480px) {
  .hr-track {
    gap: 8px;
    padding: 11px 8px;
  }

  .hr-lane {
    height: 46px;
  }

  .hr-lane .hr-horse {
    font-size: 22px;
  }

  .hr-lane-name {
    font-size: 8.5px;
  }
}

/* ---------- 負向技能（一事無成）：灰色洩氣 ---------- */

@keyframes slumpShake {
  0%, 100% {
    box-shadow: inset 0 0 14px rgba(0, 0, 0, 0.45);
    transform: translateX(0);
  }
  20% { transform: translateX(-3px); }
  40% { transform: translateX(3px); }
  60% { transform: translateX(-2px); }
  80% { transform: translateX(2px); }
}

.hr-lane.slump-rush,
.hr-ring.slump-rush {
  animation: slumpShake 0.8s ease-in-out 2;
  border-color: rgba(120, 120, 120, 0.85) !important;
  filter: grayscale(0.75);
}

/* 灰色技能文字 */
.hr-skill-shout.slump {
  background: linear-gradient(135deg, #2a2a2a, #161616);
  border: 1.5px solid #7a7a7a;
  color: #b8b8b8;
  -webkit-text-fill-color: #b8b8b8;
  text-shadow:
    0 0 8px rgba(140, 140, 140, 0.8),
    0 2px 0 rgba(0, 0, 0, 0.8);
  box-shadow:
    0 0 16px rgba(120, 120, 120, 0.5),
    inset 0 0 12px rgba(90, 90, 90, 0.2);
  letter-spacing: 2.5px;
}

/* ============================================================
   NFT 兌換卡片
   ============================================================ */

.hr-nft {
  margin: 16px 0;
  padding: 15px 13px;
  border-radius: 16px;
  background: linear-gradient(160deg, #fdf9ef, #f7f0dc);
  border: 1px solid rgba(212, 175, 55, 0.28);
}

.hr-nft-notice {
  margin: 0 0 12px;
  font-size: 11.5px;
  line-height: 1.6;
  color: #7a6a45;
  text-align: center;
}

.hr-nft-notice b {
  color: #b8860b;
  font-weight: 800;
}

.hr-nft-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}

/* 單張 NFT 卡片 */
.hr-nft-card {
  display: flex;
  flex-direction: column;
  position: relative;
  padding: 0;
  min-width: 0;
  border: 0;
  border-radius: 13px;
  background: #fff;
  overflow: hidden;
  cursor: pointer;
  font-family: inherit;
  text-align: left;
  box-shadow: 0 3px 12px rgba(140, 110, 40, 0.14);
  transition: transform 0.18s, box-shadow 0.18s;
}

.hr-nft-card:active {
  transform: scale(0.97);
}

.hr-nft-card:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

/*
 * 圖片區。
 *
 * 尺寸：96 x 96 的圓角方形縮圖。
 *
 * 為什麼不用圓形：
 *   原本用 border-radius: 50% + object-fit: cover，
 *   正方形圖片被塞進圓形容器，
 *   上下左右都會被裁掉（臉被切一半、「銅級」字也被切）。
 *   改成圓角方形 + object-fit: contain，
 *   整張圖完整顯示，一點都不會被切。
 */
.hr-nft-img-wrap {
  display: block;
  position: relative;
  width: 96px;
  height: 96px;
  margin: 11px auto 0;
  border-radius: 10px;
  overflow: hidden;
  background: #efe6cd;
  border: 2px solid rgba(212, 175, 55, 0.55);
  box-shadow: 0 2px 8px rgba(140, 110, 40, 0.18);
  box-sizing: border-box;
}

.hr-nft-img {
  display: block;
  width: 100%;
  height: 100%;

  /*
   * contain：完整顯示整張圖，不裁切。
   * 圖片是正方形、容器也是正方形，所以不會有留白。
   */
  object-fit: contain;
  object-position: center;
}

/*
 * 銅級標記。
 *
 * 圖片縮成 74px 圓形後，
 * 原本壓在左上角的標籤會擋住臉，
 * 改成放在圓形右下角的小徽章。
 */
.hr-nft-tier {
  position: absolute;
  right: 2px;
  bottom: 2px;
  padding: 1px 5px;
  border-radius: 8px;
  background: linear-gradient(135deg, #c8792f, #8a4d17);
  border: 1.5px solid #fff;
  color: #fff;
  font-size: 8px;
  font-weight: 800;
  letter-spacing: 0.3px;
  line-height: 1.4;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.3);
}

/* 已兌換打勾 */
.hr-nft-owned {
  position: absolute;
  right: 2px;
  top: 2px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #22c55e;
  color: #fff;
  font-size: 13px;
  font-weight: 900;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 8px rgba(34, 197, 94, 0.5);
}

/* 文字區（圖片置中，文字也跟著置中） */
.hr-nft-body {
  /* 同樣是 span，要轉成 block 排版才會正確 */
  display: block;
  padding: 8px 10px 11px;
  text-align: center;
}

.hr-nft-name {
  display: block;
  font-size: 12.5px;
  font-weight: 800;
  color: #3a2f16;
  line-height: 1.35;
}

.hr-nft-skill {
  display: block;
  margin-top: 3px;
  font-size: 9.5px;
  line-height: 1.4;
  color: #8a7a52;
}

/* 價格（圖片改成縮圖後，整體置中對齊） */
.hr-nft-price {
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 3px;
  margin-top: 6px;
  padding-top: 6px;
  border-top: 1px dashed rgba(184, 134, 11, 0.22);
}

.hr-nft-amount {
  font-size: 15px;
  font-weight: 900;
  color: #b8860b;
}

.hr-nft-unit {
  font-size: 9.5px;
  font-weight: 700;
  color: #a89670;
}

.hr-nft-get {
  margin-left: auto;
  font-size: 10px;
  font-weight: 800;
  color: #fff;
  background: linear-gradient(135deg, #e8c25a, #b8860b);
  padding: 3px 9px;
  border-radius: 20px;
}

/* 已兌換清單 */
.hr-nft-redeemed {
  margin-top: 10px;
  font-size: 10.5px;
  line-height: 1.7;
  color: #8a7a52;
  text-align: center;
}

.hr-nft-redeemed b {
  color: #b8860b;
}

@media (max-width: 380px) {
  .hr-nft-grid {
    grid-template-columns: 1fr;
  }

  .hr-nft-name {
    font-size: 12px;
  }
}

/* ---------- 兌換按鈕（卡片內） ---------- */

.hr-nft-btn {
  display: block;
  width: 100%;
  margin-top: 8px;
  padding: 9px 8px;
  border: 0;
  border-radius: 9px;
  font-family: inherit;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.5px;
  color: #3a2a00;
  background: linear-gradient(135deg, #f5d76e, #d4af37 55%, #b8860b);
  box-shadow: 0 3px 10px rgba(184, 134, 11, 0.32);
  cursor: pointer;
  transition: transform 0.14s, box-shadow 0.14s, filter 0.14s;
}

.hr-nft-btn:active:not(:disabled) {
  transform: scale(0.96);
  box-shadow: 0 1px 5px rgba(184, 134, 11, 0.28);
}

.hr-nft-btn.owned {
  background: #e8e2d2;
  color: #9a8d6d;
  box-shadow: none;
  cursor: default;
}

.hr-nft-btn.poor {
  background: #ece6d8;
  color: #a89a78;
  box-shadow: none;
  cursor: not-allowed;
}

/* ---------- 底部整排兌換按鈕 ---------- */

.hr-nft-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 12px;
}

.hr-nft-action-btn {
  width: 100%;
  padding: 13px 12px;
  border: 1.5px solid rgba(212, 175, 55, 0.55);
  border-radius: 12px;
  font-family: inherit;
  font-size: 13.5px;
  font-weight: 800;
  letter-spacing: 0.8px;
  color: #3a2a00;
  background: linear-gradient(135deg, #fff6d9, #f5e3a8);
  box-shadow: 0 3px 12px rgba(184, 134, 11, 0.18);
  cursor: pointer;
  transition: transform 0.14s, box-shadow 0.14s;
}

.hr-nft-action-btn:active:not(:disabled) {
  transform: scale(0.975);
  box-shadow: 0 1px 6px rgba(184, 134, 11, 0.2);
}

.hr-nft-action-btn.poor {
  background: #f0ece1;
  border-color: rgba(160, 150, 120, 0.4);
  color: #a89a78;
  box-shadow: none;
  cursor: not-allowed;
}

.hr-nft-alldone {
  padding: 11px;
  border-radius: 11px;
  background: rgba(34, 197, 94, 0.12);
  border: 1px solid rgba(34, 197, 94, 0.35);
  color: #2f7d45;
  font-size: 12.5px;
  font-weight: 800;
  text-align: center;
}

/* 台北市標籤（在賽馬標題上，排在新北市前面） */
.hr-city-taipei {
  background: #dce9f5;
  border-color: rgba(30, 64, 120, 0.42);
  color: #000 !important;
  -webkit-text-fill-color: #000 !important;
}

@media (max-width: 480px) {
  .hr-city-inline {
    margin-left: 5px;
  }

  .hr-city-taipei {
    margin-left: 6px;
  }
}

/* ---------- 城市切換按鈕 ---------- */

button.hr-city-inline {
  /* button 有預設外觀，全部重置 */
  font-family: inherit;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  transition: transform 0.14s, box-shadow 0.14s, opacity 0.14s;
}

button.hr-city-inline:active {
  transform: scale(0.94);
}

/* 未選中的城市淡化 */
button.hr-city-inline:not(.on) {
  opacity: 0.45;
}

/* 選中的城市：加陰影凸顯 */
button.hr-city-inline.on {
  box-shadow: 0 0 0 2px rgba(184, 134, 11, 0.55), 0 2px 8px rgba(140, 110, 40, 0.28);
  opacity: 1;
}

button.hr-city-inline.hr-city-taipei.on {
  box-shadow: 0 0 0 2px rgba(30, 64, 120, 0.55), 0 2px 8px rgba(30, 64, 120, 0.25);
}

/* 台南市標籤（綠色系） */
.hr-city-tainan {
  background: #dff0dd;
  border-color: rgba(40, 100, 45, 0.42);
  color: #000 !important;
  -webkit-text-fill-color: #000 !important;
}

button.hr-city-inline.hr-city-tainan.on {
  box-shadow: 0 0 0 2px rgba(40, 100, 45, 0.55), 0 2px 8px rgba(40, 100, 45, 0.25);
}

/* 三個城市標籤在小螢幕要換行 */
@media (max-width: 480px) {
  .nav-header-title {
    flex-wrap: wrap;
    row-gap: 3px;
  }
}

/* 總統之路標籤（紅色系） */
.hr-city-president {
  background: #f5dcdc;
  border-color: rgba(140, 40, 40, 0.42);
  color: #000 !important;
  -webkit-text-fill-color: #000 !important;
}

button.hr-city-inline.hr-city-president.on {
  box-shadow: 0 0 0 2px rgba(140, 40, 40, 0.55), 0 2px 8px rgba(140, 40, 40, 0.25);
}

/* ---------- USDT / USDS 切換按鈕 ---------- */

.hr-unit-switch {
  display: inline-flex;
  gap: 3px;
  margin-left: 8px;
  vertical-align: middle;
}

.hr-unit-btn {
  padding: 2px 8px 3px;
  border: 1px solid rgba(184, 134, 11, 0.35);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.55);
  font-family: inherit;
  font-size: 9.5px;
  font-weight: 800;
  letter-spacing: 0.5px;
  color: #9a8d6d;
  cursor: pointer;
  transition: all 0.15s;
  appearance: none;
  -webkit-appearance: none;
}

.hr-unit-btn.on {
  background: linear-gradient(135deg, #e8c25a, #b8860b);
  border-color: #b8860b;
  color: #fff;
  box-shadow: 0 1px 5px rgba(184, 134, 11, 0.35);
}

.hr-unit-btn:active {
  transform: scale(0.94);
}

@media (max-width: 480px) {
  .hr-unit-btn {
    font-size: 9px;
    padding: 2px 6px 3px;
  }

  .hr-unit-switch {
    margin-left: 6px;
  }
}

/* ---------- 錢包 USDS 偵測按鈕 ---------- */

.hr-balance-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-left: auto;
}

.hr-sync-btn {
  padding: 7px 12px;
  border: 1px solid rgba(212, 175, 55, 0.6);
  border-radius: 18px;
  background: linear-gradient(135deg, #fff6d9, #f5e3a8);
  font-family: inherit;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.3px;
  color: #7a5a00;
  cursor: pointer;
  white-space: nowrap;
  transition: transform 0.14s, box-shadow 0.14s;
  appearance: none;
  -webkit-appearance: none;
  box-shadow: 0 2px 8px rgba(184, 134, 11, 0.18);
}

.hr-sync-btn:active:not(:disabled) {
  transform: scale(0.96);
}

.hr-sync-btn:disabled {
  opacity: 0.6;
  cursor: wait;
}

@media (max-width: 480px) {
  .hr-sync-btn {
    font-size: 10px;
    padding: 6px 9px;
  }

  .hr-balance-actions {
    gap: 4px;
  }
}

/* ---------- 贖回按鈕 ---------- */

.hr-withdraw-btn {
  padding: 7px 12px;
  border: 1px solid rgba(120, 170, 225, 0.6);
  border-radius: 18px;
  background: linear-gradient(135deg, #eaf3fc, #cfe2f5);
  font-family: inherit;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.3px;
  color: #1e4a7a;
  cursor: pointer;
  white-space: nowrap;
  transition: transform 0.14s, box-shadow 0.14s;
  appearance: none;
  -webkit-appearance: none;
  box-shadow: 0 2px 8px rgba(30, 74, 122, 0.15);
}

.hr-withdraw-btn:active:not(:disabled) {
  transform: scale(0.96);
}

.hr-withdraw-btn:disabled {
  opacity: 0.6;
  cursor: wait;
}

@media (max-width: 480px) {
  .hr-withdraw-btn {
    font-size: 10px;
    padding: 6px 9px;
  }
}
