/* Mobile app shell, using the supplied red-and-gold game panels and buttons. */
.app-shell {
  height: 100dvh;
  min-height: 0;
  max-width: 760px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: #181410;
  padding-top: env(safe-area-inset-top);
}
.app-shell [hidden] {
  display: none !important;
}
.app-shell .topbar {
  height: 56px;
  flex-shrink: 0;
  padding: 0 14px;
  border-color: #514120;
  background: #231d13;
}
.app-shell .brand {
  font-size: 12px;
  letter-spacing: 1px;
  gap: 8px;
}
.app-shell .brand-mark {
  width: 28px;
  height: 32px;
  font-size: 23px;
}
.app-shell .header-right {
  gap: 8px;
}
.app-shell .room-name {
  display: block;
  font-size: 9px;
  letter-spacing: 0;
}
.app-shell .connection {
  font-size: 9px;
  padding: 6px 8px;
}
.app-shell main {
  width: 100%;
  min-height: 0;
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 0;
  overflow: hidden;
}
.app-shell .game-layout {
  display: block;
  flex-shrink: 0;
  margin: 0;
}
.app-shell .race-panel {
  border-radius: 0;
  border-width: 0 0 2px;
}
.app-shell .race-toolbar {
  height: 62px;
  padding: 7px 14px;
  gap: 6px;
}
.app-shell .race-toolbar .eyebrow {
  font-size: 8px;
  margin-bottom: 3px;
}
.app-shell .race-toolbar h2 {
  font-size: 21px;
}
.app-shell .phase-tag {
  font-size: 8px;
  padding: 6px;
  letter-spacing: 0.3px;
}
.app-shell .timer > span {
  font-size: 7px;
}
.app-shell .timer strong {
  font-size: 26px;
  min-width: 40px;
}
.app-shell .phase-progress {
  height: 3px;
}
.app-shell .gameplay-controls {
  min-height: 48px;
  padding: 2px 12px;
  gap: 8px;
}
.app-shell .gameplay-controls > span {
  font-size: 8px;
  letter-spacing: 0.2px;
}
.app-shell .asset-button {
  width: 44px;
  height: 44px;
}
.app-shell .sound-button {
  min-height: 44px;
}
.app-shell .sound-button img {
  width: 30px;
  height: 30px;
}
.app-shell .race-footer {
  display: none;
}
.app-shell .app-pane {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  margin: 0;
  padding: 14px;
  border: 0;
  border-radius: 0;
  background: #211a15;
  scrollbar-width: thin;
}
.app-shell .section-heading {
  margin-bottom: 10px;
}
.app-shell .section-heading .eyebrow {
  display: none;
}
.app-shell .section-heading h2,
.app-shell .section-row h2 {
  font-size: 21px;
  margin: 0;
}
.app-shell .section-heading p {
  margin: 5px 0 0;
  font-size: 11px;
}
.app-shell .horse-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}
.app-shell .horse-card {
  min-height: 90px;
  padding: 8px;
  display: grid;
  grid-template-columns: 58px 1fr;
  position: relative;
  gap: 3px;
  border: 2px solid #a48225;
  background: #74100b url('/assets/gui-panel.webp') center / 100% 100%;
  border-radius: 7px;
  text-align: left;
}
.app-shell .horse-card img {
  width: 62px;
  max-width: 100%;
}
.app-shell .horse-card .number {
  display: block;
  position: absolute;
  top: 5px;
  left: 7px;
  font-size: 10px;
  background: none;
  width: auto;
  height: auto;
}
.app-shell .horse-card strong {
  font-size: 12px;
  line-height: 1.2;
}
.app-shell .horse-card .horse-subtitle {
  font-size: 8px;
  line-height: 1.4;
  margin-top: 4px;
}
.app-shell .horse-card .radio {
  position: absolute;
  right: 6px;
  top: 6px;
  width: 12px;
  height: 12px;
}
.app-shell .horse-card.selected {
  border-color: #fff1a0;
  box-shadow: 0 0 0 2px #b48925;
}
.app-shell .horse-card:disabled {
  opacity: 0.68;
}
.app-shell .horse-card.selected:disabled {
  opacity: 1;
}
.app-shell .selection-summary {
  margin-top: 10px;
  padding: 10px;
  font-size: 12px;
  background: #42341a;
  border: 1px solid #85692a;
}
.app-shell .pick-note {
  margin: 8px 0 0;
  font-size: 9px;
}
.app-shell .error-message:empty {
  display: none;
}
.app-tabs {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  flex-shrink: 0;
  padding: 4px 10px calc(5px + env(safe-area-inset-bottom));
  background: #580806 url('/assets/gameplay-bar.webp') center / 100% 100%;
  border-top: 2px solid #c8a338;
}
.app-tabs button {
  min-height: 60px;
  border: 0;
  color: #f8dc8b;
  background: transparent;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  border-radius: 8px;
}
.app-tabs button img {
  width: 34px;
  height: 34px;
  opacity: 0.65;
}
.app-tabs button[aria-current] {
  background: #ffc93826;
  color: #fff3b5;
  box-shadow: inset 0 -3px #ffe88b;
}
.app-tabs button[aria-current] img {
  opacity: 1;
}
.app-shell .lower-grid {
  display: block;
}
.app-shell .results-board {
  margin: 0 0 14px;
  padding: 12px;
}
.app-shell .results-heading h2 {
  font-size: 19px;
}
.app-shell .podium {
  gap: 8px;
}
.app-shell .podium-card {
  padding: 10px 6px;
}
.app-shell .podium-horse {
  max-height: 78px;
}
.app-shell .podium-card h3 {
  font-size: 15px;
}
.app-shell .recent-panel {
  padding: 12px;
  border-color: #786126;
  background: #2c2118;
}
.app-shell .history {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
}
.app-shell .history-item {
  padding: 10px;
}
.app-shell .section-row {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
}
#standings-caption {
  color: #c8b68f;
  font-size: 10px;
  text-align: right;
}
#standings {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 5px;
}
#standings li {
  display: flex;
  align-items: center;
  min-height: 43px;
  gap: 9px;
  padding: 3px 10px;
  border: 1px solid #51412b;
  background: #302317;
  border-radius: 6px;
}
#standings li.my-runner {
  border-color: #edcc6b;
  background: #4e3419;
}
#standings li > b {
  width: 17px;
  color: #edcc6b;
}
#standings img {
  width: 49px;
  height: 35px;
  object-fit: contain;
}
#standings span {
  font-size: 12px;
  font-weight: 700;
  flex: 1;
}
#standings small {
  display: block;
  font-size: 8px;
  color: #cab898;
  margin-top: 3px;
}
#standings em {
  color: #ffe18e;
  font-style: normal;
  font-size: 9px;
}
.pick-cta {
  width: 100%;
  min-height: 46px;
  margin-top: 10px;
  border: 1px solid #e2ba41;
  background: #70100b url('/assets/gameplay-bar.webp') center / 100% 100%;
  color: #fff0ae;
  font-weight: 700;
  border-radius: 5px;
  cursor: pointer;
}
@media (max-width: 359px) {
  .app-shell .room-name {
    display: none;
  }
  .app-shell .app-pane {
    padding: 10px;
  }
  .app-shell .horse-card {
    grid-template-columns: 48px 1fr;
  }
  .app-shell .horse-card strong {
    font-size: 11px;
  }
}
@media (max-height: 550px) and (orientation: landscape) {
  .app-shell {
    max-width: none;
  }
  .app-shell .topbar {
    height: 40px;
  }
  .app-shell main {
    display: grid;
    grid-template-columns: 58% 42%;
  }
  .app-shell .app-pane {
    height: 100%;
  }
  .app-shell .game-layout {
    min-width: 0;
    overflow-y: auto;
  }
  .app-shell .race-toolbar {
    height: 49px;
  }
  .app-shell .gameplay-controls {
    min-height: 44px;
  }
  .app-tabs {
    padding-top: 2px;
    padding-bottom: calc(2px + env(safe-area-inset-bottom));
  }
  .app-tabs button {
    min-height: 44px;
    flex-direction: row;
  }
  .app-tabs button img {
    width: 29px;
    height: 29px;
  }
}
/* Landscape game layout: race scene left, scrollable app panel right. */
.app-shell {
  max-width: 1440px;
  position: relative;
}
.orientation-notice {
  display: none;
}
.lobby-scene {
  position: absolute;
  inset: 0;
  z-index: 3;
  background: #d8d3b6 url('/assets/lobby-day.webp') center / cover;
}
.lobby-scene[data-theme='night'] {
  background-image: url('/assets/lobby-night.webp');
}
.lobby-caption {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 12px 16px;
  background: linear-gradient(transparent, #271509f2 35%);
  display: flex;
  flex-direction: column;
  gap: 4px;
  text-shadow: 0 1px 2px #000;
}
.lobby-caption strong {
  color: #ffe88b;
  font-size: clamp(13px, 2vw, 23px);
  letter-spacing: 1px;
}
.lobby-caption span {
  font-size: clamp(11px, 1.5vw, 17px);
}
.lobby-caption small {
  color: #e5d5b5;
  font-size: 10px;
}
.app-shell .race-callout {
  z-index: 6;
}
@media (orientation: landscape) {
  .app-shell .topbar {
    height: 40px;
  }
  .app-shell main {
    display: grid;
    grid-template-columns: minmax(0, 68%) minmax(0, 32%);
    grid-template-rows: minmax(0, 1fr);
  }
  .app-shell .game-layout {
    min-height: 0;
    height: 100%;
    overflow: hidden;
  }
  .app-shell .race-panel {
    height: 100%;
    display: flex;
    flex-direction: column;
    border-right: 2px solid #a9872d;
  }
  .app-shell .race-toolbar {
    height: 54px;
    flex-shrink: 0;
  }
  .app-shell .phase-progress {
    flex-shrink: 0;
  }
  .app-shell .track-wrap {
    flex: 1;
    min-height: 0;
    aspect-ratio: auto;
  }
  .app-shell .gameplay-controls {
    min-height: 44px;
    flex-shrink: 0;
  }
  .app-shell .app-pane {
    height: 100%;
    padding: 10px 10px calc(68px + env(safe-area-inset-bottom));
  }
  .app-tabs {
    position: absolute;
    right: 0;
    bottom: 0;
    width: 32%;
    z-index: 10;
    padding: 3px 4px calc(4px + env(safe-area-inset-bottom));
  }
  .app-tabs button {
    flex-direction: column;
    min-height: 53px;
    font-size: 10px;
  }
  .app-tabs button img {
    width: 27px;
    height: 27px;
  }
  .app-shell .horse-list {
    grid-template-columns: 1fr;
    gap: 6px;
  }
  .app-shell .horse-card {
    min-height: 64px;
    grid-template-columns: 64px 1fr;
    padding: 4px 8px;
  }
  .app-shell .horse-card strong {
    font-size: 13px;
  }
  .app-shell .section-heading h2,
  .app-shell .section-row h2 {
    font-size: 18px;
  }
  .app-shell .section-row {
    flex-wrap: wrap;
  }
  .app-shell .section-heading p {
    font-size: 10px;
  }
  .app-shell .podium-card h3 {
    font-size: 12px;
  }
  .app-shell .results-board {
    padding: 8px;
  }
  .app-shell .results-heading h2 {
    font-size: 16px;
  }
  .app-shell .results-heading .eyebrow {
    font-size: 7px;
  }
  .app-shell .place-label {
    font-size: 26px;
  }
  .app-shell .results-rule,
  .app-shell #winner-message {
    font-size: 11px;
  }
  .app-shell .podium-horse {
    max-height: 58px;
  }
  .app-shell .runnerup-note {
    font-size: 7px;
  }
  .app-shell .pick-note {
    font-size: 8px;
  }
  .app-shell .track-results {
    width: 72%;
  }
}
@media (orientation: portrait) and (max-width: 900px) {
  .orientation-notice {
    position: fixed;
    inset: 0;
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    text-align: center;
    padding: 28px;
    background: #660904 url('/assets/gui-panel.webp') center / 100% 100%;
    color: #fff1b2;
  }
  .orientation-notice img {
    width: 180px;
  }
  .orientation-notice h2 {
    font-size: 24px;
  }
  .orientation-notice p {
    font-size: 14px;
  }
  .orientation-notice > span {
    font-size: 65px;
    color: #ffe16a;
  }
}
@media (orientation: landscape) and (min-height: 650px) {
  .app-shell {
    height: min(100dvh, 720px);
    margin-top: max(0px, calc((100dvh - 720px) / 2));
  }
  .app-shell .horse-card {
    min-height: 82px;
  }
}
.app-shell {
  padding-left: env(safe-area-inset-left);
  padding-right: env(safe-area-inset-right);
}
.app-shell .track-wrap {
  container-type: inline-size;
}
@container (max-width: 600px) {
  .app-shell .track-results {
    padding: 10px;
  }
  .app-shell .track-results > p {
    font-size: clamp(7px, 1.8cqw, 11px);
    margin-bottom: 7px;
  }
  .app-shell .track-places {
    gap: 6px;
  }
  .app-shell .track-places > div {
    padding: 8px 4px;
  }
  .app-shell .track-places b {
    font-size: clamp(7px, 2cqw, 11px);
  }
  .app-shell .track-places strong {
    font-size: clamp(10px, 2.8cqw, 16px);
  }
  .app-shell .track-results small {
    font-size: clamp(6px, 1.7cqw, 9px);
    margin-top: 7px;
  }
  .app-shell .track-caption {
    font-size: 6px;
    padding: 5px;
    left: 8px;
    top: 8px;
  }
  .app-shell .race-distance {
    font-size: 7px;
    padding: 5px;
    right: 8px;
    top: 8px;
  }
}
/* Forecast board uses the same supplied red and gold panel as the game. */
.credit-counter {
  color: #ffdf43;
  font-weight: 800;
  white-space: nowrap;
  font-size: 11px;
}
.credit-counter b {
  font-size: 20px;
}
.app-shell .lobby-scene {
  overflow: hidden;
  display: block;
  padding: 7px;
}
.app-shell .lobby-scene[hidden],
.app-shell .lobby-caption {
  display: none;
}
.odds-panel {
  height: 100%;
  min-height: 0;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  gap: 3px;
  background: #6d0d08 url('/assets/gui-panel.webp') center / 100% 100%;
  border: 2px solid #d5aa39;
  border-radius: 10px;
  padding: 8px 12px;
  box-shadow: 0 3px 10px #0008;
}
.odds-panel h2 {
  color: #ffe780;
  text-align: center;
  font: 900 clamp(12px, 2.6cqw, 22px) sans-serif;
  letter-spacing: 2px;
  margin: 0;
  text-shadow: 1px 2px #421006;
}
.odds-board {
  min-height: 0;
  display: grid;
  grid-template-columns: 22px repeat(6, minmax(0, 1fr));
  grid-template-rows: 18px repeat(6, minmax(0, 1fr));
  gap: 2px;
}
.odds-board > b {
  color: #fff1b1;
  text-align: center;
  align-self: center;
  font-size: clamp(12px, 2.5cqw, 20px);
}
.odds-board button {
  min-width: 0;
  min-height: 0;
  border: 1px solid #bd8b28;
  background: linear-gradient(#641c13, #32120d);
  color: #ffe779;
  padding: 0;
  border-radius: 5px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  cursor: pointer;
  box-shadow: inset 0 1px #ffe78330;
}
.odds-board button strong {
  font-size: clamp(10px, 2.2cqw, 20px);
  line-height: 1;
}
.odds-board button small {
  color: #ffb6a6;
  font-weight: 700;
  font-size: clamp(8px, 1.7cqw, 13px);
  border-left: 1px solid #bf7961;
  padding-left: 4px;
}
.odds-board button[aria-pressed='true'] {
  outline: 2px solid #fff4a6;
  outline-offset: -2px;
  background: linear-gradient(#ffd96c, #bd7620);
  color: #3d1805;
}
.odds-board button[aria-pressed='true'] small {
  color: #65220b;
}
.odds-board button:focus-visible {
  outline: 3px solid white;
  z-index: 1;
}
.invalid-pair {
  text-align: center;
  align-self: center;
  color: #c6966a;
}
.board-history {
  color: #ffedaa;
  font-size: clamp(8px, 1.6cqw, 12px);
  text-align: center;
  white-space: nowrap;
  padding-top: 2px;
}
.app-shell #horse-selection {
  display: flex;
  flex-direction: column;
  gap: 4px;
  overflow: hidden;
  padding: 8px 10px calc(64px + env(safe-area-inset-bottom));
  background: #251811;
}
.app-shell #horse-selection .section-heading {
  margin: 0;
}
.app-shell #horse-selection .section-heading h2 {
  font-size: clamp(14px, 2vw, 22px);
  color: #ffe394;
}
#horse-selection #pick-instruction {
  display: none;
}
#forecast-selection {
  font-size: clamp(10px, 1.5vw, 14px);
  color: #ffeac0;
  line-height: 1.3;
  min-height: 28px;
  display: flex;
  align-items: center;
}
.stake-chips,
.bet-actions {
  display: flex;
  gap: 4px;
  margin: 0;
  flex-shrink: 0;
}
.stake-chips button,
.bet-actions button,
.bet-pager button {
  min-height: 30px;
  flex: 1;
  background: linear-gradient(#692016, #35140b);
  color: #ffe179;
  border: 1px solid #ae7a29;
  border-radius: 5px;
  font-weight: 800;
  cursor: pointer;
}
.stake-chips button[aria-pressed='true'] {
  background: linear-gradient(#ffed8e, #d49b30);
  color: #35140b;
}
.app-shell #place-bet {
  width: 100%;
  min-height: 34px;
  margin: 0;
  padding: 5px;
  font-size: 13px;
  flex-shrink: 0;
}
.app-shell #horse-selection .selection-summary {
  margin: 0;
  padding: 4px;
  font-size: 10px;
  text-align: center;
}
.bet-ticket {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 4px;
  min-height: 26px;
}
#bet-list {
  min-width: 0;
  flex: 1;
}
#bet-list > div {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px;
  font-size: 10px;
}
#bet-list p {
  font-size: 10px;
  margin: 0;
}
#bet-list b {
  color: #ffe28b;
}
.bet-pager {
  display: flex;
  gap: 3px;
  align-items: center;
  font-size: 9px;
}
.bet-pager button {
  min-height: 26px;
  width: 24px;
  font-size: 18px;
}
.app-shell #horse-selection .pick-note {
  margin: 0;
  font-size: 9px;
}
.app-shell #horse-selection .error-message {
  margin: 0;
  padding: 3px;
  font-size: 10px;
}
button:disabled {
  cursor: default;
  opacity: 0.6;
}
@media (orientation: landscape) and (max-height: 360px) {
  .app-shell .lobby-scene {
    padding: 3px;
  }
  .odds-panel {
    padding: 4px 7px;
    gap: 1px;
  }
  .odds-board {
    grid-template-rows: 14px repeat(6, minmax(0, 1fr));
    gap: 1px;
  }
  .odds-board button {
    gap: 2px;
  }
  .odds-board button small {
    padding-left: 2px;
  }
  .app-shell #horse-selection {
    padding: 5px 6px 62px;
    gap: 3px;
  }
  #forecast-selection {
    min-height: 24px;
    font-size: 10px;
  }
  .stake-chips button,
  .bet-actions button {
    min-height: 25px;
    font-size: 10px;
  }
  .app-shell #place-bet {
    min-height: 28px;
  }
  .app-shell #horse-selection .pick-note {
    display: none;
  }
}
@media (max-width: 700px) {
  .credit-counter {
    font-size: 8px;
  }
  .credit-counter b {
    font-size: 14px;
  }
}
/* One full-width landscape surface: no right sidebar. */
.app-shell main {
  display: block;
  position: relative;
}
.app-shell .game-layout {
  width: 100%;
  height: 100%;
}
.app-shell .race-panel {
  border-right: 0;
}
.app-shell .odds-panel {
  padding-left: clamp(8px, 3vw, 36px);
  padding-right: clamp(8px, 3vw, 36px);
}
.app-shell .odds-board button {
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
}
.app-shell .odds-board button strong {
  font-size: clamp(12px, 2.6cqw, 26px);
}
.app-shell .odds-board button small {
  font-size: clamp(10px, 2cqw, 18px);
}
.app-shell .gameplay-controls {
  gap: 6px;
  padding: 3px 7px;
}
.bet-hud {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  min-width: 0;
}
.app-shell .bet-hud #selection-summary {
  padding: 0;
  margin: 0;
  border: 0;
  background: none;
  color: #ffdf66;
  font-size: clamp(12px, 2vw, 20px);
  font-weight: 900;
}
.app-shell .bet-hud #gameplay-status {
  font-size: clamp(7px, 1.2vw, 12px);
}
.compact-bet-action {
  color: #ffe894;
  background: linear-gradient(#8e2a20, #4d0804);
  border: 2px solid #c79b35;
  border-radius: 6px;
  font-weight: 900;
  min-height: 40px;
  padding: 4px 12px;
}
body:not([data-phase='picking']) .compact-bet-action {
  display: none;
}
.app-shell #pick-error {
  position: absolute;
  bottom: 55px;
  left: 12px;
  right: 12px;
  z-index: 40;
  background: #411408;
  border-radius: 5px;
  padding: 8px;
  margin: 0;
  text-align: center;
}
.app-shell #results-pane {
  position: absolute;
  inset: 6px 8%;
  z-index: 35;
  height: auto;
  padding: 10px;
  overflow: hidden;
  background: #32170f url('/assets/gui-panel.webp') center / 100% 100%;
  border: 2px solid #d5aa39;
  border-radius: 12px;
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 12px;
}
.app-shell #results-pane .results-board {
  min-height: 0;
  padding: 6px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  overflow: hidden;
}
.app-shell #results-pane .podium {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  min-height: 0;
  flex: 1;
}
.app-shell #results-pane .podium-card {
  padding: 5px;
  min-height: 0;
}
.app-shell #results-pane .podium-horse {
  height: clamp(35px, 10vh, 100px);
  width: auto;
  max-width: 90%;
  object-fit: contain;
}
.app-shell #results-pane .place-label {
  font-size: clamp(18px, 4vh, 30px);
}
.app-shell #results-pane .win-art {
  display: none;
}
.app-shell #results-pane .podium-card h3 {
  margin: 0;
}
.app-shell #results-pane .podium-card p {
  margin: 2px 0;
}
.app-shell #results-pane .results-rule,
.app-shell #results-pane #winner-message {
  margin: 0;
  font-size: clamp(9px, 1.4vw, 13px);
}
.app-shell #results-pane .history {
  display: grid;
  gap: 3px;
}
.app-shell #results-pane .history-item {
  padding: 5px;
  min-width: 0;
}
.app-shell #results-pane .history-item strong,
.app-shell #results-pane .history-second {
  font-size: 10px;
}
@media (orientation: landscape) and (max-height: 360px) {
  .compact-bet-action {
    min-height: 36px;
    padding: 3px 8px;
    font-size: 10px;
  }
  .app-shell #results-pane {
    inset: 3px 3%;
    padding: 5px;
  }
  .app-shell #results-pane .results-heading h2 {
    font-size: 13px;
  }
  .app-shell #results-pane .results-heading {
    margin: 0;
  }
  .app-shell #results-pane .history-item {
    padding: 3px;
  }
  .app-shell #results-pane .section-row h2 {
    font-size: 12px;
  }
}
.app-shell .race-payout {
  margin-top: 8px;
  padding: 8px;
  background: #241810ed;
  border: 1px solid #bf9340;
  border-radius: 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  color: #fff0ca;
}
.app-shell .race-payout > span {
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 2px;
}
.app-shell .race-payout > strong {
  font-size: clamp(20px, 4vw, 38px);
  line-height: 1.1;
}
.app-shell .race-payout.won {
  background: #23401bef;
  border-color: #ffdb62;
}
.app-shell .race-payout.won > strong {
  color: #ffe379;
}
.app-shell .race-payout > small {
  margin-top: 0;
  font-size: clamp(9px, 1.5vw, 13px);
}
@media (orientation: landscape) and (max-height: 430px) {
  .app-shell .track-results {
    padding: 7px 10px;
  }
  .app-shell .track-results > p {
    margin-bottom: 4px;
    font-size: 9px;
  }
  .app-shell .track-places > div {
    padding: 4px;
  }
  .app-shell .track-places strong {
    font-size: 13px;
  }
  .app-shell .track-places b {
    font-size: 9px;
  }
  .app-shell .race-payout {
    margin-top: 5px;
    padding: 5px;
    gap: 2px;
  }
  .app-shell .race-payout > strong {
    font-size: 24px;
  }
  .app-shell .track-results > small {
    margin-top: 4px;
    font-size: 8px;
  }
}
/* Fifteen unique pairs, arranged like the classic triangular board. */
.app-shell .odds-board {
  grid-template-columns: 24px repeat(5, minmax(0, 1fr));
  grid-template-rows: 20px repeat(5, minmax(0, 1fr));
}
.app-shell .odds-board button {
  position: relative;
}
.board-footer {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-width: 0;
}
.board-footer .board-history {
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}
#last-result-indicator {
  flex-shrink: 0;
  color: #fff29b;
  font-size: clamp(8px, 1.6cqw, 12px);
  font-weight: 900;
  white-space: nowrap;
  animation: last-result-blink 1.2s steps(1, end) infinite;
}
@keyframes last-result-blink {
  0%,
  49% {
    opacity: 1;
  }
  50%,
  100% {
    opacity: 0.4;
  }
}
@media (prefers-reduced-motion: reduce) {
  #last-result-indicator {
    animation: none;
  }
}
.betting-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.betting-heading h2 {
  flex: 1;
}
.last-win {
  display: flex;
  align-items: center;
  gap: 6px;
  border: 1px solid #ecc965;
  background: #331607;
  padding: 3px 8px;
  border-radius: 5px;
  color: #ffe795;
}
.last-win > span {
  font-size: 10px;
  font-weight: 800;
}
.last-win > strong {
  font-size: clamp(11px, 1.8vw, 20px);
}
.last-win > small {
  font-size: 9px;
  color: #fff0cb;
}
@media (max-height: 430px) {
  .last-win {
    padding: 2px 5px;
    gap: 4px;
  }
  .last-win > small {
    display: none;
  }
  .last-win > span {
    font-size: 8px;
  }
}
.betting-closed {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  z-index: 5;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  width: max-content;
  max-width: 90%;
  padding: 18px 28px;
  background: #650a05 url('/assets/gui-panel.webp') center / 100% 100%;
  border: 2px solid #f1cc65;
  border-radius: 12px;
  color: #ffe48b;
  text-align: center;
  box-shadow: 0 5px 30px #0009;
}
.betting-closed strong {
  font-size: clamp(18px, 4vw, 34px);
}
.betting-closed span {
  font-size: clamp(10px, 1.8vw, 15px);
  color: #fff1ce;
}
body[data-phase='closing'] .odds-panel {
  filter: brightness(0.65);
}
body[data-phase='closing'] .odds-board button {
  opacity: 1;
}
.course-section {
  position: absolute;
  left: 50%;
  top: 10px;
  transform: translateX(-50%);
  color: #fff0af;
  background: #142b1bd9;
  border: 1px solid #bca75b;
  border-radius: 6px;
  padding: 5px 12px;
  font-size: 11px;
  font-weight: 800;
  pointer-events: none;
}
.app-shell .lane-numbers {
  display: none;
}
body[data-phase='picking'] .course-section,
body[data-phase='closing'] .course-section {
  display: none;
}
.course-section {
  left: 12px;
  top: auto;
  bottom: 12px;
  transform: none;
}

/* Results occupy their own row so the frozen runners remain unobstructed. */
.app-shell .track-results {
  position: static;
  transform: none;
  width: 100%;
  flex: 0 0 auto;
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr);
  gap: 8px;
  padding: 5px 10px;
  box-shadow: none;
}
.app-shell .track-results > p,
.app-shell .track-results > small {
  display: none;
}
.app-shell .track-results .track-places {
  gap: 6px;
}
.app-shell .track-results .track-places > div {
  padding: 3px;
}
.app-shell .track-results .track-places b {
  font-size: 9px;
  margin-bottom: 2px;
}
.app-shell .track-results .track-places strong {
  font-size: clamp(10px, 1.5vw, 16px);
}
.app-shell .track-results .race-payout {
  margin: 0;
  padding: 3px 6px;
  gap: 1px;
}
.app-shell .track-results .race-payout > span {
  font-size: 8px;
  letter-spacing: 1px;
}
.app-shell .track-results .race-payout > strong {
  font-size: clamp(14px, 2vw, 22px);
}
.app-shell .track-results .race-payout > small {
  font-size: 9px;
}
.app-shell .phase-stack {
  position: relative;
  min-width: 110px;
  text-align: center;
}
.app-shell .phase-stack:has(.stretch-banner:not([hidden])) .phase-tag {
  visibility: hidden;
}
.app-shell .phase-stack .stretch-banner {
  position: absolute;
  inset: 0;
  transform: none;
  display: grid;
  place-items: center;
  padding: 2px 5px;
  text-align: center;
  font-size: 9px;
  letter-spacing: 1px;
}
#bet-amounts {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
  color: #ffe795;
  font-size: 10px;
  font-weight: 800;
}
#bet-amounts button {
  height: 38px;
  width: clamp(32px, 4.5vw, 48px);
  border: 1px solid #b9903c;
  border-radius: 3px;
  background: #730000 url('/assets/gui-panel.webp') center / 100% 100% no-repeat;
  color: #ffe795;
  font: inherit;
  font-size: clamp(12px, 1.8vw, 17px);
  font-weight: 900;
  text-shadow: 0 1px 2px #180000;
  padding: 3px;
  cursor: pointer;
}
#bet-amounts button[aria-pressed='true'] {
  border-color: #fff5a5;
  box-shadow:
    inset 0 0 0 2px #ffdc59,
    0 0 7px #ffcf4570;
  color: #fff;
  filter: brightness(1.3);
}
#bet-amounts button:active:not(:disabled) {
  transform: translateY(1px);
}
#bet-amounts button:disabled {
  opacity: 0.5;
  cursor: default;
}
#bet-amounts button:focus-visible {
  outline: 2px solid #66e7dc;
  outline-offset: 2px;
}
@media (max-width: 700px) {
  .betting-heading {
    gap: 5px;
  }
  .betting-heading h2 {
    font-size: 14px;
    min-width: 0;
  }
  #bet-amounts {
    gap: 3px;
    font-size: 8px;
  }
  #bet-amounts button {
    height: 34px;
  }
}

/* Keep the balance and branding inside the original game panels. */
.game-credits {
  display: flex;
  flex-direction: column;
  align-items: center;
  color: #ffe86c;
  flex-shrink: 0;
}
.game-credits > span {
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 1px;
}
.game-credits > strong {
  font-size: clamp(19px, 3vw, 29px);
  line-height: 1.1;
}
.game-brand {
  display: flex;
  flex-direction: column;
  flex: 0 0 auto;
  color: #ffe86c;
  font-size: clamp(9px, 1.3vw, 14px);
  font-weight: 900;
  letter-spacing: 1px;
  text-align: center;
}
.game-brand strong {
  color: white;
}
.connection-status {
  position: absolute;
  top: 56px;
  right: 8px;
  z-index: 40;
  padding: 4px 8px;
  color: #fff;
  background: #650b05;
  font-size: 10px;
}
.connection-status:not(.connecting) {
  display: none;
}
.horse-character-button {
  width: 48px;
  height: 44px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 2px;
  border: 1px solid #e8bf52;
  background: #730000 url('/assets/gui-panel.webp') center / 100% 100%;
  color: #ffe76c;
  border-radius: 3px;
  cursor: pointer;
}
.horse-character-button img {
  width: 39px;
  height: 28px;
  object-fit: contain;
}
.horse-character-button span {
  font-size: 7px;
  font-weight: 900;
}
#horse-characters {
  width: min(900px, 95vw);
  height: min(560px, 94dvh);
  max-width: none;
  max-height: none;
  margin: auto;
  padding: 12px;
  border: 2px solid #e8bf52;
  border-radius: 6px;
  color: #fff3bf;
  background: #650b05 url('/assets/gui-panel.webp') center / 100% 100%;
  overflow: hidden;
}
#horse-characters[open] {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
#horse-characters::backdrop {
  background: #000b;
}
.character-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex: 0 0 auto;
}
.character-heading h2 {
  font-size: clamp(14px, 2.5vw, 24px);
  margin: 0;
  color: #ffe76c;
}
.character-heading .asset-button {
  width: 36px;
  height: 36px;
}
#horse-character-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  grid-template-rows: repeat(2, minmax(0, 1fr));
  gap: 8px;
  flex: 1;
  min-height: 0;
}
.horse-character-card {
  position: relative;
  min-height: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  border: 1px solid #d6af4b;
  border-radius: 4px;
  background: #280600b8;
  padding: 5px;
}
.horse-character-card img {
  width: 100%;
  height: 60%;
  min-height: 0;
  object-fit: contain;
}
.character-number {
  position: absolute;
  top: 4px;
  left: 6px;
  font-weight: 900;
  color: #ffe76c;
  font-size: 13px;
}
.horse-character-card h3 {
  margin: 1px 0;
  font-size: clamp(11px, 1.8vw, 19px);
}
.horse-character-card p {
  margin: 0;
  font-size: clamp(8px, 1.1vw, 12px);
  text-align: center;
}
.character-note {
  margin: 0;
  font-size: 10px;
  text-align: center;
  flex-shrink: 0;
}
@media (max-width: 700px) {
  .app-shell .gameplay-controls {
    gap: 5px;
    padding-inline: 6px;
  }
  .game-brand {
    letter-spacing: 0.4px;
  }
  .horse-character-button {
    width: 40px;
  }
  .horse-character-button img {
    width: 34px;
  }
  #horse-characters {
    padding: 8px;
  }
  #horse-character-grid {
    gap: 5px;
  }
}
