/* Video Karera (static/games/karera.js): the pair board, the horse badges, the race strips and the tags over the
   horses. The wallet, the coin pickers, the buttons and the banner are the shared gm-* HUD in games.css.
   Every class starts with kr-. Bump the ?v= on the link in templates/games/karera.html when this file changes. */
.kr-stage.racing .gm-foot { display: none; }

/* a horse number in its saddle-cloth colour */
.kr-n { display: inline-flex; align-items: center; justify-content: center; flex: none; width: 22px; height: 22px; border-radius: 6px; font: 800 13px/1 var(--ui); font-variant-numeric: tabular-nums; box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .35); }
.kr-pair { display: inline-flex; gap: 2px; padding: 2px; border-radius: 7px; background: rgba(255, 255, 255, .06); }
.kr-pair small { align-self: center; margin: 0 3px; font: 600 10px var(--ui); color: var(--g-muted); }

.kr-middle { place-items: start center; align-content: start; gap: 10px; }
.kr-middle > * { grid-area: auto; }
.kr-strip { display: flex; gap: 6px; align-items: center; background: var(--g-panel); border: 1px solid var(--g-line); border-radius: 12px; padding: 8px 12px; backdrop-filter: blur(8px); }
.kr-strip .gm-lbl { margin-right: 4px; }
#standings .kr-n { width: 30px; height: 30px; font-size: 17px; border-radius: 8px; }
.kr-mybets { flex-wrap: wrap; justify-content: center; max-width: 100%; box-sizing: border-box; }
.kr-bet { display: inline-flex; align-items: center; gap: 4px; font: 800 12px/1 var(--ui); }
.kr-bet.live .kr-pair { box-shadow: 0 0 0 2px var(--g-win); }
.kr-count { font: 400 72px 'Bungee', Impact, sans-serif; color: var(--g-marquee); text-shadow: 0 4px 0 #5a0d10, 0 0 30px rgba(255, 200, 60, .6); animation: gm-pop .3s; }
.kr-places { display: flex; gap: 14px; justify-content: center; flex-wrap: wrap; font-weight: 600; }
.kr-places span { display: inline-flex; gap: 6px; align-items: center; }

/* number tag that floats over each horse */
.kr-tags { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.kr-tag { position: absolute; left: 0; top: 0; display: flex; align-items: center; justify-content: center; width: 30px; height: 30px; border-radius: 8px; font: 800 18px/1 var(--ui); font-variant-numeric: tabular-nums; box-shadow: 0 0 0 2px rgba(0, 0, 0, .55), 0 4px 10px rgba(0, 0, 0, .5); will-change: transform; }
.kr-tag::after { content: ""; position: absolute; left: 50%; bottom: -7px; translate: -50% 0; border: 6px solid transparent; border-bottom: 0; border-top-color: inherit; }

/* the pair board */
.kr-board { pointer-events: auto; background: var(--g-panel); border: 1px solid var(--g-line); border-radius: 14px; backdrop-filter: blur(8px); padding: 10px; display: grid; gap: 8px; max-width: 100%; box-sizing: border-box; }
.kr-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 0 2px; }
.kr-field { display: flex; gap: 10px; flex-wrap: wrap; font-size: 12px; color: var(--g-muted); }
.kr-field span { display: inline-flex; gap: 5px; align-items: center; }
.kr-field .kr-n { width: 18px; height: 18px; font-size: 11px; border-radius: 5px; }
.kr-grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 6px; }
.kr-cell { position: relative; display: grid; justify-items: center; align-content: center; gap: 4px; padding: 8px 4px; min-width: 64px; border-radius: 10px; cursor: pointer; background: rgba(255, 255, 255, .06); border: 1px solid var(--g-line); color: var(--g-ink); font: 600 12px var(--ui); transition: transform .1s, background .15s; }
.kr-cell:hover:not(:disabled) { background: rgba(255, 255, 255, .13); transform: translateY(-1px); }
.kr-cell:disabled { cursor: not-allowed; opacity: .55; }
.kr-odds { font: 400 15px/1 'Bungee', Impact, sans-serif; color: var(--g-marquee); }
.kr-stake { position: absolute; top: -8px; right: -6px; font: 800 11px var(--ui); background: var(--g-marquee); color: #3a1a05; border-radius: 9px; padding: 1px 6px; box-shadow: 0 2px 6px rgba(0, 0, 0, .5); }
.kr-cell.hit { box-shadow: 0 0 0 2px var(--g-win), 0 0 20px rgba(102, 227, 140, .5); }

@media (max-width: 1024px) {
  .kr-field { display: none; }
  .kr-board { padding: 6px; width: 100%; max-width: 560px; }
  .kr-grid { gap: 5px; }
  .kr-cell { min-width: 0; padding: 6px 2px; }
  .kr-cell .kr-n { width: 21px; height: 21px; font-size: 13px; }
  .kr-odds { font-size: 14px; }
  .kr-count { font-size: 56px; }
  #standings .kr-n { width: 26px; height: 26px; font-size: 15px; }
  .kr-strip { padding: 6px 8px; gap: 4px; }
  #stage[data-race] #hist > :nth-child(n + 4) { display: none; }
}
@media (prefers-reduced-motion: reduce) { .kr-count { animation: none; } }
