
html[data-layout="mobile"] body { display: block; height: 100dvh; min-height: 0; margin: 0; padding: env(safe-area-inset-top) env(safe-area-inset-right) max(env(safe-area-inset-bottom), var(--session-notice-height, 0px)) env(safe-area-inset-left); overflow: hidden; }
html[data-layout="mobile"] .home-app {
    --mobile-video-height:min(360px,calc((100vw - env(safe-area-inset-left) - env(safe-area-inset-right)) * 9 / 16));
    display: grid; width: 100%; max-width: 700px; min-width: 0;
    height: 100%; min-height: 0; margin: 0 auto; padding: 0;
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: clamp(34px, 5.5vh, 46px) var(--mobile-video-height) minmax(0, min(24vh, 210px)) clamp(34px, 5.5vh, 44px) clamp(64px, 12vh, 100px) minmax(0, 1fr);
    grid-template-areas: 'header' 'race' 'best' 'betting' 'distance' 'results';
    gap: 4px; overflow: hidden;
  }
html[data-layout="mobile"] .app-header { --header-label-size:11px; grid-area: header; min-height: 0; height: 100%; padding: 3px 5px; display: block; overflow: hidden; }
html[data-layout="mobile"] .app-header .left { width: 100%; height: 100%; display: grid; grid-template-columns: auto auto minmax(0, 1fr) auto auto; grid-template-rows: minmax(0,1fr); gap: 4px; justify-content: initial; }
html[data-layout="mobile"] .app-header .site-logo { grid-column:1;grid-row:1; }
html[data-layout="mobile"] .app-header .player { grid-column:2;grid-row:1; }
html[data-layout="mobile"] .app-header .center { grid-column:3;grid-row:1;padding:0; }
html[data-layout="mobile"] .app-header #clock { grid-column:4;grid-row:1; }
html[data-layout="mobile"] .app-header #exit-btn { grid-column:5;grid-row:1; }
html[data-layout="mobile"] .app-header .site-logo { width: 64px; max-width:64px; height:auto; max-height:100%; object-fit:contain; flex: none; }
html[data-layout="mobile"] .app-header .player { min-width: 0; font-size:var(--header-label-size); }
html[data-layout="mobile"] .app-header .online-status { padding: 2px 4px; font-size:var(--header-label-size); }
html[data-layout="mobile"] .app-header .center { display:block;min-width:0;font-size:var(--header-label-size);line-height:1.15; }
html[data-layout="mobile"] .app-header .round-info,
html[data-layout="mobile"] .app-header #philippine-date { font-size:var(--header-label-size); white-space: nowrap; }
html[data-layout="mobile"] .app-header .right { display: contents; }
html[data-layout="mobile"] .app-header #clock { font-size:var(--header-label-size); width: 8ch; }
html[data-layout="mobile"] .app-header #exit-btn { width:clamp(28px,4.5vh,38px);height:clamp(28px,4.5vh,38px);padding:0; }
html[data-layout="mobile"] #race-visual { grid-area: race; width: 100%; height: 100%; min-height: 0; margin: 0; align-self: stretch; }
html[data-layout="mobile"] .race-phase { font-size: 9px; padding: 3px 6px; top: 4px; right: 4px; }
html[data-layout="mobile"] #best-horses { grid-area: best; min-height: 0; display: flex; flex-direction: column; margin: 0; padding: 0 3px; overflow: hidden; }
html[data-layout="mobile"] .horse-category__banner { flex:0 0 auto;height:auto;margin:0 0 3px; }
html[data-layout="mobile"] .horse-category__banner-image { width:100%;height:auto;object-fit:contain; }
html[data-layout="mobile"] .horse-category__cards { flex: 1; min-height: 0; height: 100%; gap: 3px; align-items: stretch; }
html[data-layout="mobile"] .horse-card { display: flex; flex-direction: column; min-height: 0; }
html[data-layout="mobile"] .horse-card__title { flex: 0 0 22px; min-height: 0; height: 22px; padding: 2px 0; font-size: 7px; line-height: 1; }
html[data-layout="mobile"] .horse-card__media { flex: 1; min-height: 0; height: auto; }
html[data-layout="mobile"] .horse-card__media img { object-fit: contain !important; transform: none !important; }
html[data-layout="mobile"] #betting-panel { grid-area: betting; width: 100%; min-width: 0; height: 100%; min-height: 0; padding: 2px 4px; gap: 4px; }
html[data-layout="mobile"] #betting-panel .credits,
html[data-layout="mobile"] #betting-panel .bet-box,
html[data-layout="mobile"] #betting-panel .player-name-display { height: 100%; min-height: 0; font-size: 9px; padding: 4px; }
html[data-layout="mobile"] #betting-panel .green-btn { display: none; }
html[data-layout="mobile"] #distance-area { grid-area: distance; width: 100%; height: 100%; min-height: 0; margin: 0; padding: 0 4px; align-self: stretch; }
html[data-layout="mobile"] #distance-area .race-track__visual { width: 100%; height: 100%; aspect-ratio: auto; }
html[data-layout="mobile"] #distance-area .race-track__distance { font-size: 25px; }
html[data-layout="mobile"] #recent-results { grid-area: results; visibility: visible !important; width: calc(100% - 8px); min-height: 0; margin: 0 4px; padding: 6px !important; overflow: auto; scrollbar-width: none; }
html[data-layout="mobile"] #recent-results::-webkit-scrollbar { display: none; }
html[data-layout="mobile"] #recent-results .results-heading { margin: 0 0 4px; }
html[data-layout="mobile"] #recent-results .results-title { font-size: 11px; }
html[data-layout="mobile"] #recent-results .betting-history-button { font-size: 9px; }
html[data-layout="mobile"] #recent-results table { min-width: 0; width: 100%; table-layout: fixed; font-size: 9px !important; }
html[data-layout="mobile"] #recent-results th,
html[data-layout="mobile"] #recent-results td { padding: 4px 2px !important; height: auto; font-size: 9px; overflow-wrap: anywhere; white-space: normal; }
html[data-layout="mobile"] #recent-results > table[hidden],
html[data-layout="mobile"] .mobile-current-bets[hidden],
html[data-layout="mobile"] .mobile-no-bet-note[hidden],
html[data-layout="mobile"] .mobile-current-bets__notice[hidden],
html[data-layout="mobile"] #recent-results[data-mobile-view="bets"] #result-history-note { display:none; }
html[data-layout="mobile"] .mobile-current-bets { color:#edf4fc; font-variant-numeric:tabular-nums; }
html[data-layout="mobile"] .mobile-current-bets__meta { display:flex; flex-wrap:wrap; align-items:baseline; justify-content:space-between; gap:4px 10px; padding:4px 0 6px; font:600 11px/1.4 Montserrat,Arial,sans-serif; color:#d2dfed; }
html[data-layout="mobile"] .mobile-current-bets__meta strong { color:#ffe4a1; font-size:12px; }
html[data-layout="mobile"] .mobile-current-bets__rows { list-style:none; margin:0; padding:0; }
html[data-layout="mobile"] .mobile-current-bets__row { display:grid; grid-template-columns:minmax(0,1fr) auto; align-items:center; gap:6px 12px; min-height:42px; padding:6px 5px; border-top:1px solid #354357; }
html[data-layout="mobile"] .mobile-current-bets__row:nth-child(odd) { background:#152335; }
html[data-layout="mobile"] .mobile-current-bets__selection { display:flex; flex-wrap:wrap; align-items:baseline; gap:3px 8px; min-width:0; }
html[data-layout="mobile"] .mobile-current-bets__selection span { color:#c6d6e9; font:600 10px/1.4 Montserrat,Arial,sans-serif; }
html[data-layout="mobile"] .mobile-current-bets__selection strong { font:700 14px/1.3 Montserrat,Arial,sans-serif; }
html[data-layout="mobile"] .mobile-current-bets__selection small { flex-basis:100%; color:#acd7c7; font:600 9px/1.3 Montserrat,Arial,sans-serif; }
html[data-layout="mobile"] .mobile-current-bets__row[data-status="NOT ACCEPTED"] small { color:#ffb8b5; }
html[data-layout="mobile"] .mobile-current-bets__row[data-status="CHECKING"] small,
html[data-layout="mobile"] .mobile-current-bets__row[data-status="SENDING"] small,
html[data-layout="mobile"] .mobile-current-bets__row[data-status="UNSENT"] small { color:#ffe1a0; }
html[data-layout="mobile"] .mobile-current-bets__amount { display:flex; flex-direction:column; align-items:flex-end; gap:3px; font:700 12px/1.3 Montserrat,Arial,sans-serif; overflow-wrap:anywhere; max-width:36vw; }
html[data-layout="mobile"] .mobile-current-bets__amount small { color:#cad8ea; font-size:10px; font-weight:500; }
html[data-layout="mobile"] .mobile-current-bets__notice,
html[data-layout="mobile"] .mobile-no-bet-note { margin:0 0 5px; padding:4px 0; color:#ffe1a0; font:500 11px/1.4 Montserrat,Arial,sans-serif; }
html[data-layout="mobile"] .results-empty-row td { font-size: 10px; padding: 7px 2px !important; }
html[data-layout="mobile"] .bottom-icons { display: flex; --floating-control-size: 50px; gap: 7px; right: max(5px, calc((100vw - min(700px, 100vw)) / 2 + 5px)); bottom: max(calc(7px + var(--session-notice-height, 0px)), env(safe-area-inset-bottom)); }
html[data-layout="mobile"] .menu-popover { gap: 5px; bottom: calc(100% + 7px); }
html[data-layout="mobile"] .desktop-tabs { display: none; }
html[data-layout="mobile"] #content-overlay.is-open { pointer-events: none; }
html[data-layout="mobile"] #content-overlay .content-sheet { pointer-events:auto; }
html[data-layout="mobile"] #content-overlay .content-overlay__backdrop { display: block;pointer-events:auto;top:var(--content-sheet-top,25vh);bottom:var(--mobile-nav-space,64px); }
html[data-layout="mobile"] #content-overlay .content-sheet,
html[data-layout="mobile"] #content-overlay:has(.content-sheet__close) .content-sheet {
    top: var(--content-sheet-top, 25vh); left: 0; right: 0; bottom: var(--session-notice-height, 0px);
    width: min(700px, 100%); max-width: 100%; height: auto; margin: 0 auto;
    padding-top: 0; border-radius: 10px 10px 0 0;
  }
html[data-layout="mobile"] #content-overlay .content-sheet::before { display: none; }
html[data-layout="mobile"] #content-overlay .content-sheet__title { width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0,0,0,0); }
html[data-layout="mobile"] #content-overlay .content-sheet__close { display: flex; width: 56px; height: 32px; min-height: 32px; top: 4px; right: 4px; padding: 0; gap: 2px; flex-direction: row; align-items: center; justify-content: center; border: 0; background: transparent; box-shadow: none; }
html[data-layout="mobile"] #content-overlay .content-sheet__close::before { display: block; inset: 2px; width: auto; height: auto; border: 1px solid #c4a05c; border-radius: 6px; background: linear-gradient(180deg, #243344f2, #0d1824f2); }
html[data-layout="mobile"] #content-overlay .content-sheet__close span { color: #ffda6b; font: 600 16px/1 Arial, sans-serif; }
html[data-layout="mobile"] #content-overlay .content-sheet__close small { color: #ffe9ad; font: 800 8px/1 Montserrat, sans-serif; letter-spacing: 0; }
html[data-layout="mobile"] #content-overlay .content-sheet__close:hover::before,
html[data-layout="mobile"] #content-overlay .content-sheet__close:active::before { border-color: #ffda6b; background: #40341f; }
html[data-layout="mobile"] #content-overlay:has(.content-sheet__close[aria-label='Close Betting Menu']) .content-sheet__body,
html[data-layout="mobile"] #content-overlay:has(.content-sheet__close[aria-label='Close EZ Bet']) .content-sheet__body { padding-top: 0; }
html[data-layout="mobile"] #content-overlay[data-active-panel="betting-menu"] { --betting-menu-available-height: calc(100dvh - var(--content-sheet-top, 25vh) - var(--session-notice-height, 0px) - 2px); }
.orientation-notice { display: none; }
@media (orientation: landscape) {
 html[data-layout="mobile"] .orientation-notice { display: flex; position: fixed; inset: 0; z-index: 30000; background: #08121d; color: #f5dfaa; align-items: center; justify-content: center; flex-direction: column; gap: 16px; padding: 24px; text-align: center; font: 600 18px/1.5 Montserrat, sans-serif; }
 html[data-layout="mobile"] .orientation-notice::before { content: "↻"; display: block; font: 60px/1 Georgia, serif; color: #d6b25d; }
 html[data-layout="mobile"] .home-app, html[data-layout="mobile"] #content-overlay, html[data-layout="mobile"] .session-notice { visibility: hidden; }
html[data-layout="mobile"] .home-app *, html[data-layout="mobile"] #content-overlay * { visibility: hidden !important; }
}

html[data-layout="mobile"] #distance-area > .bottom-icons { position:absolute;top:5px;right:6px;bottom:auto;margin:0;flex-direction:row;--floating-control-size:44px;gap:6px;z-index:12; }
html[data-layout="mobile"] #distance-area > .bottom-icons .menu-popover { left:0;right:auto; }
html[data-layout="mobile"] #distance-area .race-track__distance { left:42px;transform:none;font-size:24px; }

html[data-layout="mobile"] #distance-area { position:relative; }

/* The mobile navigation has its own space and remains available across panels. */
html[data-layout="mobile"] body { --mobile-nav-height:64px; --mobile-nav-space:calc(var(--mobile-nav-height) + env(safe-area-inset-bottom)); padding-bottom:0; }
html[data-layout="mobile"] .home-app {
  height:calc(100% - var(--mobile-nav-space) - var(--session-notice-height,0px));
  grid-template-rows:clamp(34px,5.5vh,46px) var(--mobile-video-height) minmax(0,min(20vh,166px)) clamp(34px,5.5vh,44px) clamp(52px,9vh,76px) minmax(0,1fr);
}
html[data-layout="mobile"] .horse-card__numbers { bottom:5px; height:42px; background:linear-gradient(180deg,#07101830,#071018eb 45%); }
html[data-layout="mobile"] .horse-card__numbers > strong { font-size:clamp(25px,8vw,34px); letter-spacing:-1px; }
/* Keep the artwork readable even when a short screen puts ranks over most of it. */
html[data-layout="mobile"] .horse-card__numbers {
  -webkit-backdrop-filter:none;backdrop-filter:none;
  background:linear-gradient(180deg,#07101818,#07101866 65%,#07101899);
}
html[data-layout="mobile"] .horse-card__media::after { opacity:.3; }
/* Rotate briefly, then return to an untransformed plane for crisp resting text. */
html[data-layout="mobile"] .horse-category__cards { perspective:900px; }
html[data-layout="mobile"] .horse-card.is-card-flipping {
  animation:category-card-turn var(--category-turnMs,1200ms) cubic-bezier(.4,0,.2,1);backface-visibility:hidden;
}
html[data-layout="mobile"] .horse-card.is-card-energized .horse-card__media img {
  animation:none;filter:none;scale:1;
}
html[data-layout="mobile"] .horse-card.is-card-energized .horse-card__numbers {
  animation:none;transform:none;backface-visibility:visible;
}
html[data-layout="mobile"] .horse-card.is-card-energized .horse-card__numbers > strong {
  animation:category-rank-arrive var(--category-rankMs,900ms) cubic-bezier(.4,0,.2,1) var(--category-firstDelayMs,150ms) backwards;
}
html[data-layout="mobile"] .horse-card.is-card-energized .horse-card__secondary span:nth-child(1) {
  animation:category-rank-arrive var(--category-rankMs,900ms) cubic-bezier(.4,0,.2,1) var(--category-secondDelayMs,1150ms) backwards;
}
html[data-layout="mobile"] .horse-card.is-card-energized .horse-card__secondary span:nth-child(2) {
  animation:category-rank-arrive var(--category-rankMs,900ms) cubic-bezier(.4,0,.2,1) var(--category-thirdDelayMs,2150ms) backwards;
}
@media(prefers-reduced-motion:reduce) {
  html[data-layout="mobile"] .horse-card.is-card-flipping,
  html[data-layout="mobile"] .horse-card.is-card-energized .horse-card__numbers > strong,
  html[data-layout="mobile"] .horse-card.is-card-energized .horse-card__secondary span { animation:none; }
}
html[data-layout="mobile"] .mobile-footer {
  position:fixed;left:50%;right:auto;bottom:0;transform:translateX(-50%);z-index:10020;
  display:grid;grid-template-columns:repeat(5,minmax(0,1fr));gap:0;align-items:stretch;
  width:min(700px,100%);height:var(--mobile-nav-space);padding:0 3px env(safe-area-inset-bottom);
  background:#0c1824;border:1px solid #867044;border-bottom:0;border-radius:12px 12px 0 0;overflow:hidden;--floating-control-size:34px;
}
html[data-layout="mobile"] .mobile-footer[hidden],
html[data-layout="mobile"] .mobile-footer > .menu-button,
html[data-layout="mobile"] .mobile-footer > .menu-popover { display:none!important; }
html[data-layout="mobile"] .mobile-footer > button {
  width:100%;height:var(--mobile-nav-height);min-width:0;min-height:44px;display:flex;flex-direction:column;
  align-items:center;justify-content:center;gap:2px;padding:3px 1px;border:0;border-top:2px solid transparent;
  border-radius:0;background:transparent;color:#e6d8b5;box-shadow:none;cursor:pointer;transform:none;
}
html[data-layout="mobile"] .mobile-footer > button img,
html[data-layout="mobile"] .mobile-footer > button svg { width:34px;height:34px;flex:none;object-fit:contain; }
html[data-layout="mobile"] .mobile-footer > button .label { display:block;font:700 8px/1.2 Montserrat,Arial,sans-serif;letter-spacing:0;white-space:nowrap; }
html[data-layout="mobile"] .mobile-footer > button[aria-pressed="true"] { border-top-color:#f1cc78;background:#233244;color:#ffe6a1; }
html[data-layout="mobile"] .mobile-footer > button:active { background:#304359; }
html[data-layout="mobile"] .mobile-footer > button:focus-visible { outline:2px solid #f1cc78;outline-offset:-3px; }
html[data-layout="mobile"] .session-notice { bottom:calc(var(--mobile-nav-space) + 4px); }
html[data-layout="mobile"] #content-overlay .content-sheet,
html[data-layout="mobile"] #content-overlay:has(.content-sheet__close) .content-sheet { bottom:calc(var(--mobile-nav-space) + var(--session-notice-height,0px)); }
html[data-layout="mobile"] #content-overlay[data-active-panel="betting-menu"] { --betting-menu-available-height:calc(100dvh - var(--content-sheet-top,25vh) - var(--mobile-nav-space) - var(--session-notice-height,0px) - 2px); }
@media(max-height:700px) and (orientation:portrait) {
  html[data-layout="mobile"] .home-app { grid-template-rows:34px var(--mobile-video-height) 118px 34px 52px minmax(0,1fr); }
}
@media(max-height:600px) and (orientation:portrait) {
  html[data-layout="mobile"] .home-app { grid-template-rows:34px var(--mobile-video-height) minmax(0,96px) 34px 44px minmax(72px,1fr); }
  html[data-layout="mobile"] #best-horses { overflow:auto; }
  html[data-layout="mobile"] .horse-category__cards { flex:1 0 64px;min-height:64px;height:auto; }
  html[data-layout="mobile"] .horse-category__banner { height:auto; }
  html[data-layout="mobile"] .horse-card__title { font-size:6px; }
  html[data-layout="mobile"] .horse-card__numbers { bottom:0;height:32px; }
  html[data-layout="mobile"] .horse-card__numbers > strong { font-size:25px; }
}
/* An unfolded phone has more width, but still needs room for race information. */
@media(min-width:540px) and (orientation:portrait) {
  html[data-layout="mobile"] .home-app {
    --mobile-video-height:min(360px,32dvh,calc(min(700px,100vw - env(safe-area-inset-left) - env(safe-area-inset-right)) * 9 / 16));
  }
}
@media(orientation:landscape) { html[data-layout="mobile"] .mobile-footer { visibility:hidden; } }

html[data-layout="mobile"] #distance-area .race-track__distance { top:5px;right:10px;bottom:auto;left:auto;transform:none;max-width:50%;font-size:20px;line-height:1.1;text-align:right;white-space:nowrap;text-shadow:0 1px 3px #000,0 0 8px #0009;pointer-events:none; }

.betting-open-notice { position:fixed;left:50%;bottom:calc(var(--mobile-nav-space,64px) + var(--session-notice-height,0px) + 10px);transform:translateX(-50%);z-index:10500;width:max-content;max-width:calc(100% - 32px);padding:9px 15px;border:1px solid #dfbf74;border-radius:9px;background:#11251ff5;color:#ffe6a4;box-shadow:0 6px 18px #0009;font:800 11px/1.4 Montserrat,Arial,sans-serif;letter-spacing:.08em;text-align:center;pointer-events:none; }
.betting-open-notice[hidden] { display:none; }
.betting-open-notice::before { content:'';display:inline-block;width:6px;height:6px;margin-right:8px;border-radius:50%;background:#8ce3af;vertical-align:1px; }
.betting-open-notice[data-state="closed"] { background:#30191df5; }
.betting-open-notice[data-state="closed"]::before { background:#ff9690; }
html[data-layout="mobile"] .mobile-footer > .bet-button.is-betting-open .label { color:#ffe4a0; }
html[data-layout="mobile"] .mobile-footer > .bet-button.is-betting-open .label::after { content:'';display:inline-block;width:4px;height:4px;margin-left:4px;border-radius:50%;background:#8ce3af;vertical-align:1px; }
html[data-layout="mobile"] .mobile-footer > .bet-button { position:relative;isolation:isolate; }
html[data-layout="mobile"] .mobile-footer > .bet-button.is-betting-opening::before { content:'';position:absolute;left:50%;top:5px;width:44px;height:44px;transform:translateX(-50%);z-index:-1;border:1px solid #ffe3a0;border-radius:50%;background:#bd862421;box-shadow:0 3px 10px #dfa83e80;pointer-events:none;opacity:0;animation:bet-menu-open-ring 1s ease-in-out var(--bet-open-delay,0ms) 6; }
html[data-layout="mobile"] .mobile-footer > .bet-button.is-betting-opening img { animation:bet-menu-open-glow 1s ease-in-out var(--bet-open-delay,0ms) 6;transform-origin:center; }
@keyframes bet-menu-open-glow {
  0%,100% { transform:scale(1);filter:brightness(1); }
  45% { transform:scale(1.22);filter:brightness(1.5) saturate(1.1) drop-shadow(0 2px 7px #ffd16ac2); }
}
@keyframes bet-menu-open-ring { 0%,100%{opacity:.12;}45%{opacity:.95;} }
@media(prefers-reduced-motion:reduce){html[data-layout="mobile"] .mobile-footer > .bet-button.is-betting-opening img{animation:none;filter:brightness(1.1);}html[data-layout="mobile"] .mobile-footer > .bet-button.is-betting-opening::before{animation:none;opacity:.5;}}
@media(orientation:landscape){html[data-layout="mobile"] .betting-open-notice,html[data-layout="mobile"] .system-feedback{display:none;}}
