/* Equest Racing — Traditional Horse Racing */

@import url('https://fonts.googleapis.com/css2?family=Cormorant+Garamond:ital,wght@0,400;0,600;0,700;1,400&family=DM+Sans:wght@400;500;600;700&family=JetBrains+Mono:wght@400;500;700&display=swap');

* { margin: 0; padding: 0; box-sizing: border-box; }
.hidden { display: none !important; }

:root {
  --bg: #0d0d0d;
  --bg-card: #151515;
  --bg-elevated: #1a1a1a;
  --bg-hover: #1f1f1f;
  --border: #252525;
  --border-light: #333;
  --text: #f5f0eb;
  --text-secondary: #a09888;
  --text-muted: #6b6157;
  --gold: #c9a84c;
  --gold-light: #dfc16a;
  --gold-dim: rgba(201, 168, 76, 0.12);
  --gold-glow: rgba(201, 168, 76, 0.25);
  --burgundy: #7a2332;
  --burgundy-dim: rgba(122, 35, 50, 0.15);
  --green-win: #4caf50;
  --red: #c0392b;
  --silver: #b8b8b8;
  --bronze: #a0724a;
  --radius: 6px;
  --radius-sm: 4px;
  --serif: 'Cormorant Garamond', Georgia, serif;
  --sans: 'DM Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  --mono: 'JetBrains Mono', monospace;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  overflow-x: hidden;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

/* ===== HEADER ===== */

.header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 28px;
  background: linear-gradient(180deg, #181818 0%, #111 100%);
  border-bottom: 1px solid var(--border);
}

.logo-wrap {
  display: flex;
  align-items: center;
  gap: 14px;
}

.logo-img {
  height: 42px;
  width: auto;
}

.logo {
  font-family: var(--serif);
  font-size: 26px;
  font-weight: 700;
  color: var(--gold);
  letter-spacing: 2px;
  text-transform: uppercase;
}

.logo-sub {
  font-family: var(--sans);
  font-size: 10px;
  color: var(--text-muted);
  font-weight: 500;
  margin-top: 1px;
  letter-spacing: 3px;
  text-transform: uppercase;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.wallet-btn {
  background: transparent;
  color: var(--gold);
  border: 1px solid var(--gold);
  padding: 8px 22px;
  font-family: var(--sans);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  border-radius: var(--radius);
  transition: all 0.2s;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

.wallet-btn:hover {
  background: var(--gold);
  color: var(--bg);
}

.wallet-btn.connected {
  border-color: var(--green-win);
  color: var(--green-win);
}

.wallet-btn.connected:hover {
  background: var(--green-win);
  color: #fff;
}

.wallet-addr {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--text-secondary);
}

/* ===== RACE INFO BAR ===== */

.race-info {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 28px;
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
}

.race-id {
  font-family: var(--serif);
  font-size: 16px;
  font-weight: 700;
  color: var(--text-secondary);
  font-style: italic;
}

.phase-label {
  font-family: var(--sans);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 2px;
  text-transform: uppercase;
}

.countdown {
  font-family: var(--mono);
  font-size: 24px;
  font-weight: 700;
  color: var(--gold);
  min-width: 50px;
  text-align: right;
}

.countdown.urgent {
  color: var(--red);
  animation: pulse 0.6s ease-in-out infinite;
}

.phase-label.blink-red {
  color: var(--red) !important;
  animation: blink-red 1s ease-in-out infinite;
}

@keyframes pulse {
  50% { opacity: 0.3; }
}

@keyframes blink-red {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.3; }
}

.total-pool {
  font-family: var(--mono);
  font-size: 13px;
  font-weight: 600;
  color: var(--gold);
}

/* ===== RACE CANVAS ===== */

.race-container {
  position: relative;
  width: 100%;
  background: #000;
  border-bottom: 1px solid var(--border);
}

#race-canvas {
  display: block;
  width: 100%;
}

/* ===== RESULT BANNER ===== */

.result-banner {
  padding: 18px 28px;
  background: linear-gradient(135deg, #1a1510, #15120d);
  border-bottom: 1px solid var(--gold);
  transition: all 0.3s;
}

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

.result-podium {
  display: flex;
  justify-content: center;
  gap: 16px;
  margin-bottom: 12px;
}

.podium-entry {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 18px;
  background: var(--bg-elevated);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  font-size: 13px;
}

.podium-entry.gold { border-color: var(--gold); background: var(--gold-dim); }
.podium-entry.silver { border-color: var(--silver); background: rgba(184,184,184,0.06); }
.podium-entry.bronze { border-color: var(--bronze); background: rgba(160,114,74,0.06); }

.podium-pos {
  font-family: var(--serif);
  font-weight: 700;
  font-size: 14px;
  font-style: italic;
}

.podium-entry.gold .podium-pos { color: var(--gold); }
.podium-entry.silver .podium-pos { color: var(--silver); }
.podium-entry.bronze .podium-pos { color: var(--bronze); }

.podium-horse { font-weight: 600; }
.podium-odds { color: var(--text-muted); font-size: 12px; font-family: var(--mono); }

.result-details {
  font-size: 12px;
  color: var(--text-muted);
  text-align: center;
  margin-bottom: 6px;
}

.result-payouts {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--green-win);
  text-align: center;
}

/* Active bet tracker bar (under race canvas) */

.active-bets-bar {
  display: flex;
  gap: 10px;
  padding: 8px 24px;
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  overflow-x: auto;
  align-items: center;
}

.active-bets-bar.hidden { display: none; }

.active-bet-tag {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  background: var(--gold-dim);
  border: 1px solid var(--gold);
  border-radius: var(--radius);
  font-size: 12px;
  white-space: nowrap;
  flex-shrink: 0;
}

.active-bet-label {
  font-weight: 700;
  color: var(--gold);
  font-size: 10px;
  letter-spacing: 0.5px;
}

.active-bet-horses {
  color: var(--text);
  font-weight: 600;
}

.active-bet-odds {
  font-family: var(--mono);
  color: var(--text-secondary);
  font-size: 11px;
}

.active-bet-payout {
  font-family: var(--mono);
  color: var(--gold);
  font-weight: 700;
  font-size: 12px;
}

.active-bets-title {
  font-size: 10px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 1px;
  flex-shrink: 0;
}

/* Personal race result */
.my-race-result {
  padding: 12px 16px;
  border-radius: var(--radius);
  margin-bottom: 12px;
  text-align: center;
}

.my-result-won {
  background: rgba(76, 175, 80, 0.12);
  border: 1px solid var(--green-win);
}

.my-result-lost {
  background: rgba(192, 57, 43, 0.12);
  border: 1px solid var(--red);
}

.my-result-label {
  font-family: var(--serif);
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 4px;
}

.my-result-won .my-result-label { color: var(--green-win); }
.my-result-lost .my-result-label { color: var(--text-secondary); }

.my-result-amount {
  font-family: var(--mono);
  font-size: 22px;
  font-weight: 800;
  margin-bottom: 6px;
}

.my-result-won .my-result-amount { color: var(--green-win); }
.my-result-lost .my-result-amount { color: var(--red); }

.my-result-bet {
  font-size: 11px;
  color: var(--text-secondary);
  margin-top: 2px;
}

.payout-line { margin: 2px 0; }
.payout-tx-link { color: var(--gold); text-decoration: none; font-size: 10px; margin-left: 4px; }
.payout-tx-link:hover { text-decoration: underline; }

/* ===== MAIN LAYOUT ===== */

.main-content {
  display: grid;
  grid-template-columns: 1fr 360px;
  gap: 0;
  min-height: calc(100vh - 500px);
}

/* ===== HORSE LIST ===== */

.horses-panel {
  padding: 20px 28px;
}

.panel-title {
  font-family: var(--serif);
  font-size: 14px;
  font-weight: 700;
  color: var(--gold);
  margin-bottom: 14px;
  letter-spacing: 1px;
  text-transform: uppercase;
  font-style: italic;
}

.horse-list { display: flex; flex-direction: column; gap: 3px; }

.horse-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 14px;
  background: var(--bg-card);
  border: 1px solid transparent;
  border-radius: var(--radius);
  cursor: pointer;
  transition: all 0.15s;
  position: relative;
}

.horse-card:hover {
  background: var(--bg-hover);
  border-color: var(--border-light);
}

.horse-card.selected {
  background: var(--gold-dim);
  border-color: var(--gold);
}

.horse-number {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--sans);
  font-size: 15px;
  font-weight: 800;
  color: #fff;
  flex-shrink: 0;
  border-radius: var(--radius-sm);
  text-shadow: 0 1px 2px rgba(0,0,0,0.4);
}

.horse-info { flex: 1; min-width: 0; }

.horse-name {
  font-family: var(--serif);
  font-weight: 700;
  font-size: 16px;
  margin-bottom: 1px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.horse-stats {
  display: flex;
  gap: 16px;
  font-size: 12px;
}

.morning-odds {
  color: var(--gold);
  font-weight: 600;
  font-family: var(--mono);
  font-size: 12px;
}

.pool-amount {
  color: var(--text-secondary);
  font-family: var(--mono);
}

.live-odds {
  color: var(--text-muted);
  font-family: var(--mono);
}

.horse-color-bar {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3px;
  border-radius: var(--radius) 0 0 var(--radius);
}

.pick-badge {
  position: absolute;
  top: 8px;
  right: 12px;
  background: var(--gold);
  color: #000;
  font-family: var(--sans);
  font-size: 10px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 3px;
  letter-spacing: 0.5px;
}

.no-horses {
  padding: 48px 20px;
  text-align: center;
  color: var(--text-muted);
  font-family: var(--serif);
  font-size: 16px;
  font-style: italic;
}

/* ===== LIVE CHAT ===== */

.chat-section {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

.chat-messages {
  height: 180px;
  overflow-y: auto;
  margin-bottom: 8px;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.chat-msg {
  font-size: 12px;
  line-height: 1.4;
  padding: 4px 0;
}

.chat-name {
  font-weight: 700;
  color: var(--gold);
  margin-right: 6px;
  font-size: 11px;
}

.chat-text {
  color: var(--text);
}

.chat-system {
  color: var(--text-muted);
  font-size: 11px;
  font-style: italic;
}

.chat-input-row {
  display: flex;
  gap: 6px;
}

.chat-input {
  flex: 1;
  padding: 8px 12px;
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--text);
  font-family: var(--sans);
  font-size: 12px;
  border-radius: var(--radius-sm);
  outline: none;
}

.chat-input:focus {
  border-color: var(--gold);
}

.chat-input::placeholder {
  color: var(--text-muted);
}

.chat-send-btn {
  padding: 8px 16px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  font-family: var(--sans);
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  border-radius: var(--radius-sm);
  transition: all 0.15s;
}

.chat-send-btn:hover {
  background: var(--gold);
  color: #000;
  border-color: var(--gold);
}

/* ===== BET PANEL ===== */

.bet-panel {
  padding: 20px 24px;
  background: var(--bg-card);
  border-left: 1px solid var(--border);
}

.bet-type-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 4px;
  margin-bottom: 14px;
}

.bet-type-btn {
  padding: 9px 4px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  font-family: var(--sans);
  font-size: 10px;
  font-weight: 700;
  cursor: pointer;
  text-align: center;
  transition: all 0.15s;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-radius: var(--radius-sm);
}

.bet-type-btn:hover {
  background: var(--bg-hover);
  color: var(--text);
  border-color: var(--border-light);
}

.bet-type-btn.active {
  background: var(--gold);
  color: #000;
  border-color: var(--gold);
  font-weight: 800;
}

.bet-type-desc {
  font-family: var(--serif);
  font-size: 14px;
  color: var(--text-secondary);
  margin-bottom: 4px;
  text-align: center;
  font-style: italic;
}

.selection-info {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--gold);
  margin-bottom: 16px;
  text-align: center;
  min-height: 18px;
  font-weight: 600;
}

.bet-input-group {
  margin-bottom: 12px;
}

.bet-label {
  font-family: var(--sans);
  font-size: 10px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 1.5px;
  margin-bottom: 6px;
}

.bet-input {
  width: 100%;
  padding: 12px;
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--text);
  font-family: var(--mono);
  font-size: 18px;
  font-weight: 600;
  text-align: center;
  outline: none;
  border-radius: var(--radius);
  transition: border-color 0.2s;
}

.bet-input:focus { border-color: var(--gold); }

.quick-bets {
  display: flex;
  gap: 6px;
  margin-bottom: 16px;
}

.quick-bet {
  flex: 1;
  padding: 8px;
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  text-align: center;
  border-radius: var(--radius-sm);
  transition: all 0.15s;
}

.quick-bet:hover {
  background: var(--bg-hover);
  border-color: var(--gold);
  color: var(--gold);
}

.place-bet-btn {
  width: 100%;
  padding: 14px;
  background: var(--gold);
  color: #000;
  border: none;
  font-family: var(--sans);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  border-radius: var(--radius);
}

.place-bet-btn:hover:not(:disabled) {
  background: var(--gold-light);
  transform: translateY(-1px);
  box-shadow: 0 4px 16px var(--gold-glow);
}

.place-bet-btn:disabled {
  background: var(--bg-elevated);
  color: var(--text-muted);
  cursor: not-allowed;
  box-shadow: none;
  transform: none;
}

/* ===== USER INFO (HEADER) ===== */

.user-info {
  display: flex;
  align-items: center;
  gap: 10px;
}

.user-info.hidden { display: none; }

.user-balance {
  font-family: var(--mono);
  font-size: 13px;
  font-weight: 700;
  color: var(--gold);
}

.user-name-btn {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 6px 14px;
  font-family: var(--sans);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  border-radius: var(--radius);
  transition: all 0.15s;
}

.user-name-btn:hover {
  border-color: var(--gold);
}

/* ===== USER DROPDOWN ===== */

.user-dropdown {
  position: absolute;
  top: 56px;
  right: 24px;
  width: 320px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  z-index: 500;
  box-shadow: 0 8px 32px rgba(0,0,0,0.6);
}

.user-dropdown.hidden { display: none; }

.dropdown-section {
  margin-bottom: 14px;
}

.dropdown-label {
  font-size: 10px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 1.5px;
  margin-bottom: 6px;
}

.dropdown-wallet-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.dropdown-address {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--gold);
  word-break: break-all;
  flex: 1;
  line-height: 1.4;
}

.copy-wallet-btn {
  padding: 4px 12px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  font-family: var(--sans);
  font-size: 10px;
  font-weight: 600;
  cursor: pointer;
  border-radius: var(--radius-sm);
  transition: all 0.15s;
  flex-shrink: 0;
}

.copy-wallet-btn:hover {
  border-color: var(--gold);
  color: var(--gold);
}

.dropdown-balance {
  font-family: var(--mono);
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
}

.fund-cta {
  background: var(--gold-dim);
  border: 1px solid var(--gold);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  margin-bottom: 14px;
}

.fund-cta.hidden { display: none; }

.fund-cta-text {
  font-size: 12px;
  color: var(--gold);
  line-height: 1.4;
}

.my-bets {
  font-size: 12px;
  color: var(--text-muted);
  max-height: 250px;
  overflow-y: auto;
}

.my-bet-entry {
  padding: 8px 10px;
  margin-bottom: 4px;
  background: var(--bg);
  border-radius: var(--radius-sm);
  border-left: 3px solid var(--border);
  font-size: 12px;
}

.my-bet-entry.bet-won { border-left-color: var(--green-win); }
.my-bet-entry.bet-lost { border-left-color: var(--red); }
.my-bet-entry.bet-pending { border-left-color: var(--gold); }

.my-bet-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 2px;
}

.my-bet-type {
  font-weight: 700;
  font-size: 10px;
  letter-spacing: 0.5px;
  color: var(--text-secondary);
}

.my-bet-result {
  font-family: var(--mono);
  font-weight: 700;
  font-size: 11px;
}

.bet-won .my-bet-result { color: var(--green-win); }
.bet-lost .my-bet-result { color: var(--red); }
.bet-pending .my-bet-result { color: var(--gold); }

.my-bet-detail {
  font-size: 11px;
  color: var(--text-muted);
}

/* ===== BET BALANCE (IN BET SLIP) ===== */

.bet-balance-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
  padding: 8px 12px;
  background: var(--bg);
  border-radius: var(--radius-sm);
}

.bet-balance-row.hidden { display: none; }

.bet-balance-label {
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 600;
}

.bet-balance-amount {
  font-family: var(--mono);
  font-size: 13px;
  font-weight: 700;
  color: var(--gold);
}

.bet-fund-cta {
  text-align: center;
  padding: 8px;
  margin-bottom: 10px;
  font-size: 11px;
  color: var(--gold);
  background: var(--gold-dim);
  border: 1px dashed var(--gold);
  border-radius: var(--radius-sm);
  cursor: pointer;
}

.bet-fund-cta.hidden { display: none; }

/* ===== VRF PROOF ===== */

.vrf-proof {
  margin-top: 16px;
  padding: 10px 12px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: var(--mono);
  font-size: 11px;
  color: var(--text-muted);
}

.vrf-link {
  color: var(--gold);
  text-decoration: none;
}

.vrf-link:hover { text-decoration: underline; }

/* ===== HISTORY ===== */

.history-panel {
  margin-top: 20px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
}

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

.history-entry {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 10px;
  background: var(--bg);
  border-radius: var(--radius-sm);
  font-size: 11px;
  gap: 8px;
  border-left: 2px solid var(--border);
}

.history-entry.history-won { border-left-color: var(--green-win); }
.history-entry.history-lost { border-left-color: var(--red); }

.history-name {
  font-weight: 600;
  color: var(--text);
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.history-bet-type {
  font-size: 9px;
  font-weight: 700;
  color: var(--text-muted);
  letter-spacing: 0.5px;
}

.history-result {
  font-family: var(--mono);
  font-weight: 700;
  font-size: 11px;
  white-space: nowrap;
}

.history-result.won { color: var(--green-win); }
.history-result.lost { color: var(--red); }

.history-winner {
  font-family: var(--serif);
  font-weight: 700;
  font-size: 13px;
}

.history-pool {
  color: var(--gold);
  font-family: var(--mono);
  font-weight: 600;
}

/* ===== TOAST ===== */

.toast-container {
  position: fixed;
  top: 16px;
  right: 16px;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toast {
  padding: 12px 18px;
  font-family: var(--sans);
  font-size: 13px;
  font-weight: 500;
  border-left: 3px solid;
  background: var(--bg-elevated);
  color: var(--text);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  transform: translateX(120%);
  transition: transform 0.25s ease-out;
  max-width: 320px;
  box-shadow: 0 4px 24px rgba(0,0,0,0.5);
}

.toast.show { transform: translateX(0); }
.toast-info { border-color: var(--gold); }
.toast-success { border-color: var(--green-win); }
.toast-error { border-color: var(--red); }

/* ===== LANDING HERO ===== */

.landing-hero {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background: radial-gradient(ellipse at 50% 30%, #1a1508 0%, #0d0d0d 70%);
  text-align: center;
  padding: 40px 20px;
}

.landing-logo { width: 160px; height: auto; border-radius: 12px; margin-bottom: 24px; }
.landing-title { font-family: var(--serif); font-size: clamp(48px, 8vw, 80px); font-weight: 700; color: var(--gold); letter-spacing: 4px; margin-bottom: 12px; }
.landing-subtitle { font-size: clamp(16px, 2.5vw, 22px); color: var(--text-secondary); max-width: 500px; margin-bottom: 48px; line-height: 1.5; }

.landing-cta {
  padding: 18px 56px;
  font-family: var(--serif);
  font-size: 22px;
  font-weight: 700;
  letter-spacing: 2px;
  background: linear-gradient(135deg, var(--gold) 0%, #a08530 100%);
  color: #0d0d0d;
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s;
  text-transform: uppercase;
}
.landing-cta:hover { transform: translateY(-2px); box-shadow: 0 8px 32px var(--gold-glow); }
.landing-cta:active { transform: translateY(0); }

.landing-features {
  display: flex;
  gap: 40px;
  margin-top: 64px;
  flex-wrap: wrap;
  justify-content: center;
}
.landing-feature {
  text-align: center;
  max-width: 160px;
}
.landing-feature-icon { font-size: 32px; margin-bottom: 8px; }
.landing-feature-label { font-size: 14px; color: var(--text-secondary); font-weight: 500; }

/* ===== LIVE GAME INDEX ===== */

.landing-index {
  margin-top: 64px;
  padding: 32px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  max-width: 680px;
  width: 100%;
}
.landing-index-title {
  font-family: var(--serif);
  font-size: 13px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: 24px;
  text-align: center;
}
.landing-index-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px 16px;
}
.index-stat {
  text-align: center;
}
.index-stat-value {
  font-family: var(--mono);
  font-size: clamp(22px, 4vw, 30px);
  font-weight: 700;
  color: var(--gold);
  line-height: 1.2;
}
.index-stat-label {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 4px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.landing-index-highlights {
  margin-top: 20px;
  display: flex;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;
}
.index-highlight {
  padding: 8px 14px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.4;
}
.index-highlight strong {
  color: var(--text);
}

@media (max-width: 480px) {
  .landing-index-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .landing-index {
    padding: 24px 16px;
    margin-top: 40px;
  }
}

/* ===== TAB BAR ===== */

.tab-bar {
  display: flex;
  gap: 0;
  background: #111;
  border-bottom: 1px solid var(--border);
  padding: 0 20px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.tab-btn {
  padding: 14px 24px;
  font-family: var(--sans);
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--text-muted);
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  cursor: pointer;
  transition: color 0.2s, border-color 0.2s;
  white-space: nowrap;
}
.tab-btn:hover { color: var(--text-secondary); }
.tab-btn.active { color: var(--gold); border-bottom-color: var(--gold); }

.tab-pane { display: none; }
.tab-pane.active { display: block; }

/* ===== SUB-TAB BAR ===== */

.sub-tab-bar {
  display: flex;
  gap: 0;
  border-bottom: 1px solid var(--border);
  margin-bottom: 24px;
}
.sub-tab-btn {
  padding: 10px 20px;
  font-size: 13px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  cursor: pointer;
  transition: color 0.2s, border-color 0.2s;
}
.sub-tab-btn:hover { color: var(--text-secondary); }
.sub-tab-btn.active { color: var(--gold); border-bottom-color: var(--gold); }

/* ===== SECTION LAYOUT ===== */

.section-padding { padding: 24px; max-width: 1200px; margin: 0 auto; }
.section-title { font-family: var(--serif); font-size: 24px; font-weight: 700; color: var(--text); margin-bottom: 20px; }
.section-grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }
.grid-3 { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
.grid-4 { grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); }

/* ===== STABLE VIEW ===== */

.stable-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 24px;
}
.stable-name { font-family: var(--serif); font-size: 28px; font-weight: 700; }
.stable-tier-badge {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-left: 12px;
}
.stable-meta { display: flex; gap: 24px; color: var(--text-secondary); font-size: 14px; }
.stable-meta span { display: flex; align-items: center; gap: 6px; }

.stable-upgrade-btn {
  padding: 10px 20px;
  background: linear-gradient(135deg, var(--gold) 0%, #a08530 100%);
  color: #0d0d0d;
  font-weight: 700;
  font-size: 13px;
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  transition: transform 0.15s;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.stable-upgrade-btn:hover { transform: translateY(-1px); }
.stable-upgrade-btn:disabled { opacity: 0.5; cursor: default; transform: none; }

.no-stable-cta {
  text-align: center;
  padding: 80px 20px;
}
.no-stable-cta h2 { font-family: var(--serif); font-size: 32px; color: var(--gold); margin-bottom: 12px; }
.no-stable-cta p { color: var(--text-secondary); margin-bottom: 24px; font-size: 16px; }

.create-stable-input {
  padding: 12px 20px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-family: var(--sans);
  font-size: 16px;
  width: 260px;
  margin-right: 12px;
}
.create-stable-input::placeholder { color: var(--text-muted); }

/* ===== HORSE CARD (STABLE VIEW) ===== */

.horse-card-stable {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  cursor: pointer;
  transition: border-color 0.2s, transform 0.15s;
}
.horse-card-stable:hover { border-color: var(--border-light); transform: translateY(-2px); }

.hcs-top { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 14px; }
.hcs-name { font-family: var(--serif); font-size: 20px; font-weight: 700; }
.hcs-tier {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.hcs-rating { font-family: var(--mono); font-size: 22px; font-weight: 700; color: var(--gold); }

.hcs-stats { margin-bottom: 14px; }
.stat-row { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.stat-label { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.5px; color: var(--text-muted); width: 60px; flex-shrink: 0; }
.stat-bar-bg { flex: 1; height: 8px; background: var(--bg); border-radius: 4px; overflow: hidden; }
.stat-bar-fill { height: 100%; border-radius: 4px; transition: width 0.3s ease; }
.stat-val { font-family: var(--mono); font-size: 11px; color: var(--text-secondary); width: 32px; text-align: right; flex-shrink: 0; }

.stat-color-low { background: #c0392b; }
.stat-color-mid { background: #e67e22; }
.stat-color-good { background: #f1c40f; }
.stat-color-great { background: #27ae60; }
.stat-color-max { background: var(--gold); }

.hcs-condition { display: flex; gap: 12px; margin-bottom: 14px; }
.condition-bar { flex: 1; }
.condition-label { font-size: 10px; font-weight: 600; text-transform: uppercase; color: var(--text-muted); margin-bottom: 3px; display: flex; justify-content: space-between; }
.condition-bar-bg { height: 6px; background: var(--bg); border-radius: 3px; overflow: hidden; }
.condition-bar-fill { height: 100%; border-radius: 3px; transition: width 0.3s; }
.condition-energy { background: #3498db; }
.condition-hunger { background: #27ae60; }
.condition-low { background: #c0392b; }

.hcs-training {
  padding: 10px 14px;
  background: var(--gold-dim);
  border-radius: var(--radius-sm);
  font-size: 13px;
  margin-bottom: 14px;
}
.hcs-training-stat { font-weight: 700; color: var(--gold); text-transform: uppercase; }
.hcs-training-timer { font-family: var(--mono); color: var(--text); }
.hcs-training-complete { color: var(--green-win); font-weight: 700; }

.hcs-equipment {
  display: flex;
  gap: 6px;
}
.equip-slot-icon {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  border: 1px dashed var(--border);
  font-size: 14px;
  background: var(--bg);
  position: relative;
}
.equip-slot-icon.filled { border-style: solid; }
.equip-slot-icon.broken { border-color: var(--red); }
.equip-slot-icon .slot-tier-dot {
  position: absolute;
  top: -2px;
  right: -2px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

.hcs-record { display: flex; gap: 16px; font-size: 12px; color: var(--text-muted); margin-top: 10px; }
.hcs-record span { display: flex; align-items: center; gap: 4px; }

/* ===== HORSE DETAIL MODAL ===== */

.horse-detail-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.8);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.horse-detail-panel {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  max-width: 600px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  padding: 28px;
}
.hd-close { float: right; background: none; border: none; color: var(--text-muted); font-size: 20px; cursor: pointer; padding: 4px 8px; }
.hd-close:hover { color: var(--text); }
.hd-name { font-family: var(--serif); font-size: 28px; font-weight: 700; margin-bottom: 4px; }
.hd-section { margin-top: 24px; }
.hd-section-title { font-size: 14px; font-weight: 700; text-transform: uppercase; letter-spacing: 1px; color: var(--text-muted); margin-bottom: 12px; border-bottom: 1px solid var(--border); padding-bottom: 6px; }

.hd-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 16px; }
.hd-btn {
  padding: 10px 18px;
  font-size: 13px;
  font-weight: 600;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-elevated);
  color: var(--text);
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}
.hd-btn:hover { background: var(--bg-hover); border-color: var(--border-light); }
.hd-btn:disabled { opacity: 0.4; cursor: default; }
.hd-btn-gold { background: linear-gradient(135deg, var(--gold) 0%, #a08530 100%); color: #0d0d0d; border-color: transparent; font-weight: 700; }
.hd-btn-gold:hover { opacity: 0.9; }
.hd-btn-red { border-color: var(--red); color: var(--red); }
.hd-btn-green { border-color: var(--green-win); color: var(--green-win); }

.hd-train-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.hd-train-card {
  padding: 12px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  text-align: center;
  cursor: pointer;
  transition: border-color 0.2s;
}
.hd-train-card:hover { border-color: var(--gold); }
.hd-train-stat { font-size: 12px; font-weight: 700; text-transform: uppercase; color: var(--text); margin-bottom: 4px; }
.hd-train-time { font-size: 11px; color: var(--text-muted); font-family: var(--mono); }
.hd-train-val { font-family: var(--mono); font-size: 13px; color: var(--gold); margin-bottom: 2px; }

.hd-equip-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.hd-equip-slot {
  padding: 12px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  text-align: center;
  min-height: 80px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
}
.hd-equip-slot.filled { border-color: var(--border-light); }
.hd-equip-slot-label { font-size: 10px; text-transform: uppercase; color: var(--text-muted); font-weight: 600; }
.hd-equip-slot-icon { font-size: 20px; }
.hd-equip-item-name { font-size: 11px; font-weight: 600; }
.hd-equip-durability { font-size: 10px; color: var(--text-muted); font-family: var(--mono); }

.hd-inventory-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 8px; max-height: 200px; overflow-y: auto; }

/* ===== ITEM CARD ===== */

.item-card {
  padding: 12px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: border-color 0.2s, transform 0.15s;
  text-align: center;
}
.item-card:hover { border-color: var(--border-light); transform: translateY(-1px); }
.item-card-icon { font-size: 20px; margin-bottom: 4px; }
.item-card-name { font-size: 12px; font-weight: 600; margin-bottom: 2px; }
.item-card-tier { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.5px; }
.item-card-stat { font-size: 10px; color: var(--text-muted); }
.item-card-durability { font-size: 10px; color: var(--text-muted); font-family: var(--mono); margin-top: 4px; }
.item-card.broken { opacity: 0.5; border-color: var(--red); }
.item-card.legendary { border-color: var(--gold); box-shadow: 0 0 12px var(--gold-glow); animation: legendaryPulse 2s ease-in-out infinite; }
.item-card.epic { border-color: #8e44ad; }

@keyframes legendaryPulse {
  0%, 100% { box-shadow: 0 0 8px var(--gold-glow); }
  50% { box-shadow: 0 0 20px var(--gold-glow); }
}

/* ===== SHOP CARDS ===== */

.shop-tier-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  text-align: center;
  transition: border-color 0.2s, transform 0.15s;
}
.shop-tier-card:hover { transform: translateY(-3px); border-color: var(--border-light); }
.shop-tier-label { font-family: var(--serif); font-size: 20px; font-weight: 700; margin-bottom: 8px; }
.shop-tier-price { font-family: var(--mono); font-size: 24px; font-weight: 700; color: var(--gold); margin-bottom: 8px; }
.shop-tier-range { font-size: 13px; color: var(--text-secondary); margin-bottom: 16px; }
.shop-tier-buy {
  width: 100%;
  padding: 12px;
  font-weight: 700;
  font-size: 14px;
  text-transform: uppercase;
  letter-spacing: 1px;
  border: 1px solid var(--gold);
  background: var(--gold-dim);
  color: var(--gold);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background 0.15s;
}
.shop-tier-buy:hover { background: var(--gold-glow); }

/* ===== PACK CARDS ===== */

.pack-card {
  background: var(--bg-card);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  padding: 28px 24px;
  text-align: center;
  transition: transform 0.2s, box-shadow 0.2s;
  position: relative;
  overflow: hidden;
}
.pack-card:hover { transform: translateY(-4px); box-shadow: 0 8px 32px rgba(0,0,0,0.4); }
.pack-card-label { font-family: var(--serif); font-size: 22px; font-weight: 700; margin-bottom: 6px; }
.pack-card-count { font-size: 14px; color: var(--text-secondary); margin-bottom: 4px; }
.pack-card-desc { font-size: 12px; color: var(--text-muted); margin-bottom: 16px; }
.pack-card-price { font-family: var(--mono); font-size: 28px; font-weight: 700; margin-bottom: 20px; }
.pack-card-open {
  width: 100%;
  padding: 14px;
  font-weight: 700;
  font-size: 15px;
  text-transform: uppercase;
  letter-spacing: 2px;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: transform 0.15s;
  color: #0d0d0d;
}
.pack-card-open:hover { transform: scale(1.02); }

/* ===== PACK REVEAL MODAL ===== */

.pack-reveal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.9);
  z-index: 2000;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 32px;
}
.pack-reveal-title { font-family: var(--serif); font-size: 28px; font-weight: 700; color: var(--gold); }
.pack-reveal-cards { display: flex; gap: 16px; flex-wrap: wrap; justify-content: center; }
.pack-reveal-card {
  width: 140px;
  height: 190px;
  perspective: 600px;
  cursor: default;
}
.pack-reveal-card-inner {
  width: 100%;
  height: 100%;
  position: relative;
  transform-style: preserve-3d;
  transition: transform 0.6s ease;
}
.pack-reveal-card.flipped .pack-reveal-card-inner {
  transform: rotateY(180deg);
}
.pack-reveal-card-front, .pack-reveal-card-back {
  position: absolute;
  inset: 0;
  backface-visibility: hidden;
  border-radius: var(--radius);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 16px;
}
.pack-reveal-card-front {
  background: linear-gradient(135deg, #1a1a1a, #222);
  border: 2px solid var(--border);
}
.pack-reveal-card-front::after {
  content: '?';
  font-family: var(--serif);
  font-size: 48px;
  color: var(--text-muted);
}
.pack-reveal-card-back {
  background: var(--bg-card);
  border: 2px solid var(--border);
  transform: rotateY(180deg);
  text-align: center;
  gap: 6px;
}
.pack-reveal-card-back.legendary {
  border-color: var(--gold);
  box-shadow: 0 0 24px var(--gold-glow);
  animation: legendaryPulse 1.5s ease-in-out infinite;
}
.pack-reveal-card-back.epic { border-color: #8e44ad; box-shadow: 0 0 16px rgba(142,68,173,0.3); }
.pack-reveal-card-back.rare { border-color: #3498db; }
.pack-reveal-icon { font-size: 28px; }
.pack-reveal-name { font-size: 13px; font-weight: 700; }
.pack-reveal-tier { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.5px; }
.pack-reveal-bonus { font-size: 10px; color: var(--text-secondary); }

.pack-reveal-close {
  padding: 12px 40px;
  font-size: 14px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: var(--radius-sm);
  cursor: pointer;
}
.pack-reveal-close:hover { background: var(--bg-hover); }

/* ===== MARKETPLACE CARDS ===== */

.market-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  transition: border-color 0.2s;
}
.market-card:hover { border-color: var(--border-light); }
.market-card-top { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 10px; }
.market-card-name { font-weight: 700; font-size: 15px; }
.market-card-price { font-family: var(--mono); font-weight: 700; color: var(--gold); font-size: 16px; }
.market-card-meta { font-size: 12px; color: var(--text-muted); margin-bottom: 12px; }
.market-card-buy {
  width: 100%;
  padding: 10px;
  font-weight: 700;
  font-size: 13px;
  text-transform: uppercase;
  border: 1px solid var(--gold);
  background: var(--gold-dim);
  color: var(--gold);
  border-radius: var(--radius-sm);
  cursor: pointer;
}
.market-card-buy:hover { background: var(--gold-glow); }

/* ===== LEADERBOARD ===== */

.leaderboard-table {
  width: 100%;
  border-collapse: collapse;
}
.leaderboard-table th {
  text-align: left;
  padding: 10px 16px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--gold);
  border-bottom: 1px solid var(--border);
}
.leaderboard-table td {
  padding: 12px 16px;
  font-size: 14px;
  border-bottom: 1px solid var(--border);
}
.leaderboard-table tr:hover td { background: var(--bg-hover); }
.lb-rank { font-family: var(--mono); font-weight: 700; color: var(--gold); width: 40px; }
.lb-name { font-weight: 600; }
.lb-value { font-family: var(--mono); color: var(--text-secondary); }

/* ===== STABLE UPGRADE CARD ===== */

.upgrade-card {
  background: var(--bg-card);
  border: 1px solid var(--gold-dim);
  border-radius: var(--radius);
  padding: 24px;
  text-align: center;
  max-width: 400px;
  margin: 0 auto;
}
.upgrade-card-current { font-size: 14px; color: var(--text-muted); margin-bottom: 8px; }
.upgrade-card-arrow { font-size: 24px; color: var(--gold); margin: 8px 0; }
.upgrade-card-next { font-family: var(--serif); font-size: 22px; font-weight: 700; color: var(--gold); margin-bottom: 8px; }
.upgrade-card-benefits { font-size: 13px; color: var(--text-secondary); margin-bottom: 16px; line-height: 1.6; }

/* ===== EMPTY STATE ===== */

.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-muted);
}
.empty-state-icon { font-size: 48px; margin-bottom: 12px; }
.empty-state-text { font-size: 16px; }

/* ===== HOW TO PLAY ===== */

/* === HOW TO PLAY — DOCS LAYOUT === */

.htp-docs {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 0;
  min-height: 100vh;
  position: relative;
}

/* --- Mobile TOC toggle --- */
.htp-toc-mobile-toggle {
  display: none;
  position: sticky;
  top: 48px;
  z-index: 50;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 16px;
  margin: 0 16px 12px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  align-items: center;
  justify-content: space-between;
}
.htp-toc-mobile-toggle.open svg { transform: rotate(180deg); }

/* --- Left sidebar TOC --- */
.htp-toc {
  position: sticky;
  top: 60px;
  align-self: start;
  height: calc(100vh - 80px);
  overflow-y: auto;
  padding: 24px 0 24px 20px;
  border-right: 1px solid var(--border);
}
.htp-toc-title {
  font-family: var(--serif);
  font-size: 13px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 16px;
  padding-left: 12px;
}
.htp-toc-link {
  display: block;
  padding: 6px 12px;
  font-size: 13px;
  color: var(--text-secondary);
  text-decoration: none;
  border-left: 2px solid transparent;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  transition: color .15s, border-color .15s, background .15s;
  margin-bottom: 1px;
}
.htp-toc-link:hover {
  color: var(--text);
  background: var(--bg-card);
}
.htp-toc-link.active {
  color: var(--gold);
  border-left-color: var(--gold);
  background: var(--bg-card);
}

/* --- Main content --- */
.htp-main {
  max-width: 740px;
  padding: 24px 32px 80px;
}
.htp-page-title {
  margin-bottom: 40px;
  padding-bottom: 24px;
  border-bottom: 1px solid var(--border);
}
.htp-page-title h1 {
  font-family: var(--serif);
  font-size: 30px;
  font-weight: 700;
  margin-bottom: 8px;
}
.htp-page-title p {
  font-size: 15px;
  color: var(--text-secondary);
  line-height: 1.6;
}

/* --- Doc sections --- */
.htp-doc-section {
  margin-bottom: 48px;
  scroll-margin-top: 70px;
}
.htp-doc-section h2 {
  font-family: var(--serif);
  font-size: 22px;
  font-weight: 700;
  margin-bottom: 16px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
}
.htp-doc-section h3 {
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
  margin: 20px 0 8px;
}
.htp-doc-section p {
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.7;
  margin-bottom: 10px;
}

/* --- Callout box --- */
.htp-callout {
  padding: 12px 16px;
  background: color-mix(in srgb, var(--gold) 6%, transparent);
  border: 1px solid color-mix(in srgb, var(--gold) 20%, transparent);
  border-radius: var(--radius-sm);
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.6;
  margin: 14px 0;
}

/* --- Table rows --- */
.htp-table {
  margin: 12px 0;
}
.htp-table-row {
  display: flex;
  gap: 16px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.6;
  align-items: baseline;
}
.htp-table-row:last-child { border-bottom: none; }
.htp-table-label {
  font-weight: 700;
  color: var(--text);
  min-width: 130px;
  flex-shrink: 0;
}

/* --- Grid & cards (reused) --- */
.htp-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 8px;
  margin: 12px 0;
}
.htp-card {
  padding: 12px 14px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.5;
}
.htp-card-title { font-weight: 700; color: var(--text); margin-bottom: 4px; }

/* --- Checklist --- */
.htp-checklist { }
.htp-check {
  padding: 10px 16px;
  font-size: 14px;
  color: var(--text-secondary);
  border-left: 2px solid var(--gold-dim);
  margin-bottom: 4px;
  transition: border-color 0.2s;
}
.htp-check:hover { border-color: var(--gold); color: var(--text); }

/* --- Mobile responsive --- */
@media (max-width: 860px) {
  .htp-docs {
    grid-template-columns: 1fr;
  }
  .htp-toc-mobile-toggle {
    display: flex;
  }
  .htp-toc {
    position: relative;
    top: auto;
    height: auto;
    max-height: 0;
    overflow: hidden;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    margin: 0 16px 12px;
    padding: 0 16px;
    transition: max-height .3s ease, padding .3s ease;
    border-right: none;
  }
  .htp-toc.open {
    max-height: 60vh;
    overflow-y: auto;
    padding: 12px 16px;
  }
  .htp-toc-title {
    display: none;
  }
  .htp-toc-link {
    padding: 10px 12px;
    font-size: 14px;
    border-left: none;
    border-radius: var(--radius-sm);
  }
  .htp-toc-link.active {
    background: color-mix(in srgb, var(--gold) 10%, transparent);
    border-left: none;
  }
  .htp-main {
    padding: 16px 16px 60px;
  }
  .htp-page-title h1 {
    font-size: 24px;
  }
  .htp-table-row {
    flex-direction: column;
    gap: 4px;
  }
  .htp-table-label {
    min-width: unset;
  }
}

/* ===== RESPONSIVE ===== */

@media (max-width: 768px) {
  .main-content { grid-template-columns: 1fr; }
  .bet-panel { border-left: none; border-top: 1px solid var(--border); }
  .header { flex-direction: column; gap: 10px; text-align: center; padding: 12px 16px; }
  .logo-wrap { justify-content: center; }
  .race-info { flex-wrap: wrap; gap: 8px; justify-content: center; padding: 10px 16px; }
  .horses-panel { padding: 16px; }
  .bet-panel { padding: 16px; }
  .bet-type-grid { grid-template-columns: repeat(2, 1fr); }
  .result-podium { flex-direction: column; align-items: center; gap: 6px; }
  .tab-bar {
    padding: 0 10px;
    -webkit-mask-image: linear-gradient(to right, #000 80%, transparent 100%);
    mask-image: linear-gradient(to right, #000 80%, transparent 100%);
  }
  .tab-bar::-webkit-scrollbar { display: none; }
  .tab-bar.scrolled-end {
    -webkit-mask-image: linear-gradient(to left, #000 80%, transparent 100%);
    mask-image: linear-gradient(to left, #000 80%, transparent 100%);
  }
  .tab-bar.scrolled-mid {
    -webkit-mask-image: linear-gradient(to right, transparent 0%, #000 10%, #000 80%, transparent 100%);
    mask-image: linear-gradient(to right, transparent 0%, #000 10%, #000 80%, transparent 100%);
  }
  .tab-btn { padding: 12px 16px; font-size: 12px; }
  .section-padding { padding: 16px; }
  .hd-train-grid { grid-template-columns: repeat(2, 1fr); }
  .hd-equip-grid { grid-template-columns: repeat(2, 1fr); }
  .landing-features { gap: 24px; }
  .pack-reveal-card { width: 110px; height: 150px; }
  .stable-header { flex-direction: column; gap: 12px; text-align: center; }
  .stable-race-cta { flex-direction: column; text-align: center; gap: 12px; }
}

/* ===== STABLE RACE ENTRY ===== */

.stable-race-cta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  margin-bottom: 20px;
  background: linear-gradient(135deg, rgba(201, 168, 76, 0.12) 0%, rgba(201, 168, 76, 0.04) 100%);
  border: 1px solid rgba(201, 168, 76, 0.35);
  border-radius: var(--radius);
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
  animation: cta-pulse 2s ease-in-out infinite;
}

.stable-race-cta:hover {
  border-color: var(--gold);
  background: linear-gradient(135deg, rgba(201, 168, 76, 0.18) 0%, rgba(201, 168, 76, 0.08) 100%);
}

@keyframes cta-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(201, 168, 76, 0); }
  50% { box-shadow: 0 0 20px 0 rgba(201, 168, 76, 0.15); }
}

.race-entry-horse {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: border-color 0.2s, background 0.2s;
}

.race-entry-horse.eligible {
  cursor: pointer;
  border-color: var(--green-win)44;
}

.race-entry-horse.eligible:hover {
  border-color: var(--green-win);
  background: rgba(76, 175, 80, 0.08);
}

.race-entry-horse.ineligible {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Persistent stable race indicator in race info bar */
.stable-race-indicator {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
  font-size: 11px;
  font-weight: 700;
  font-family: var(--mono);
  letter-spacing: 0.5px;
}

.sri-waiting {
  color: var(--text-muted);
}

.sri-waiting .sri-count {
  padding: 3px 10px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 12px;
}

.sri-soon .sri-next {
  padding: 3px 10px;
  background: var(--gold-dim);
  border: 1px solid rgba(201, 168, 76, 0.3);
  border-radius: 12px;
  color: var(--gold);
  animation: sri-pulse 1.5s ease-in-out infinite;
}

.sri-active {
  color: var(--gold);
}

.sri-active .sri-live {
  padding: 3px 10px;
  background: var(--gold);
  color: #000;
  border-radius: 12px;
  animation: sri-pulse 1.5s ease-in-out infinite;
}

.sri-active .sri-entries {
  padding: 3px 8px;
  background: var(--gold-dim);
  border: 1px solid var(--gold)44;
  border-radius: 12px;
  font-size: 10px;
}

@keyframes sri-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.7; }
}
