/* Shell: page sizing, demo bar, mobile frame, toast, odds-change animations. */
html, body { margin: 0; }
body { min-height: 100vh; -webkit-text-size-adjust: 100%; -webkit-font-smoothing: antialiased; }
img { max-width: 100%; }
button { -webkit-tap-highlight-color: transparent; }

.board-ph { max-width: 520px; margin: 0 auto; min-height: 100vh; padding-bottom: 84px; box-sizing: border-box; }
.board-ph .tabbar { max-width: 520px; margin-left: auto; margin-right: auto; }
.board-dk { width: 1440px; zoom: var(--dz, 1); margin: 0 auto; min-height: 100vh; }
.board .odd { position: relative; overflow: hidden; }
[data-match] { cursor: pointer; }
[data-go="home"] { cursor: pointer; }

/* ---------- demo bar ---------- */
#demo-bar { font: 500 13px/1 Inter, system-ui, -apple-system, sans-serif; color: #fff; z-index: 1000; }
#demo-bar[hidden] { display: none; }
#demo-bar button { font: inherit; cursor: pointer; }
.db-desk { position: fixed; left: 50%; bottom: 16px; transform: translateX(-50%); display: flex; align-items: center; gap: 8px; padding: 5px; border-radius: 999px; background: rgba(13, 15, 22, .9); -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px); box-shadow: 0 12px 40px rgba(0, 0, 0, .35), 0 0 0 1px rgba(255, 255, 255, .1); }
.db-themes { display: flex; gap: 2px; }
.db-theme { display: flex; align-items: center; gap: 8px; height: 34px; padding: 0 13px 0 8px; border-radius: 999px; border: 0; background: none; color: #C9CED8; white-space: nowrap; }
.db-theme:hover { color: #fff; background: rgba(255, 255, 255, .08); }
.db-theme.on { background: #fff; color: #0D0F16; font-weight: 600; }
.db-theme i { width: 18px; height: 18px; border-radius: 50%; box-shadow: 0 0 0 1px rgba(255, 255, 255, .45); flex: 0 0 auto; }
.db-views { display: flex; padding: 2px; border-radius: 999px; background: rgba(255, 255, 255, .09); }
.db-views button { height: 30px; padding: 0 13px; border-radius: 999px; border: 0; background: none; color: #C9CED8; white-space: nowrap; }
.db-views button.on { background: #fff; color: #0D0F16; font-weight: 600; }
.db-note { padding: 0 12px 0 2px; color: #8D94A6; font-size: 12px; white-space: nowrap; }

.db-phone { position: fixed; right: 12px; bottom: 86px; }
.db-fab { display: flex; align-items: center; gap: 7px; height: 38px; padding: 0 14px 0 8px; border-radius: 999px; border: 0; color: #fff; background: rgba(13, 15, 22, .88); -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px); box-shadow: 0 8px 24px rgba(0, 0, 0, .35), 0 0 0 1px rgba(255, 255, 255, .14); font-weight: 600; }
.db-fab i, .db-sheet i { width: 20px; height: 20px; border-radius: 50%; box-shadow: 0 0 0 1px rgba(255, 255, 255, .45); flex: 0 0 auto; }
.db-sheet { display: none; position: absolute; right: 0; bottom: 46px; width: 240px; padding: 6px; border-radius: 16px; background: rgba(13, 15, 22, .96); box-shadow: 0 16px 40px rgba(0, 0, 0, .45), 0 0 0 1px rgba(255, 255, 255, .12); }
.db-phone.open .db-sheet { display: block; }
.db-sheet-h { padding: 8px 10px 6px; color: #8D94A6; font-size: 11px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; }
.db-sheet .db-theme { width: 100%; height: 48px; border-radius: 10px; padding: 0 10px; text-align: left; }
.db-sheet .db-theme span { display: flex; flex-direction: column; gap: 3px; }
.db-sheet .db-theme small { font-size: 11px; font-weight: 400; color: #8D94A6; }
.db-sheet .db-theme.on small { color: #555C6B; }

/* ---------- mobile frame ---------- */
html.framed body { background: radial-gradient(1200px 700px at 50% 30%, #2A2E3A, #0E1015) !important; overflow: hidden; }
#frame-wrap { position: fixed; inset: 0 0 64px; display: flex; align-items: center; justify-content: center; }
#frame-wrap[hidden] { display: none; }
.phone { flex: 0 0 auto; width: 390px; height: 844px; padding: 12px; border-radius: 56px; background: #07080B; box-shadow: 0 0 0 2px #30343F, 0 0 0 5px #15171D, 0 40px 90px rgba(0, 0, 0, .6); transform: scale(var(--ps, 1)); transform-origin: center; }
.phone iframe { width: 390px; height: 844px; border: 0; border-radius: 44px; display: block; background: #000; }
.frame-cap { position: absolute; top: 14px; left: 0; right: 0; text-align: center; color: #8D94A6; font: 500 12px/1 Inter, system-ui, sans-serif; letter-spacing: .04em; }

/* ---------- toast ---------- */
#toast { position: fixed; left: 50%; top: 18px; transform: translate(-50%, -140%); z-index: 1100; max-width: calc(100vw - 32px); padding: 11px 16px; border-radius: 12px; background: rgba(13, 15, 22, .94); color: #fff; font: 500 13px/1.35 Inter, system-ui, sans-serif; box-shadow: 0 12px 30px rgba(0, 0, 0, .35); transition: transform .25s ease, visibility 0s linear .25s; pointer-events: none; visibility: hidden; }
#toast.on { transform: translate(-50%, 0); visibility: visible; transition: transform .25s ease; }

/* ---------- odds-change animations (only cells whose value changed) ---------- */
@keyframes mp-shine { from { transform: translateX(-130%) skewX(-18deg); } to { transform: translateX(130%) skewX(-18deg); } }
@keyframes fl-glow { 0% { box-shadow: inset 0 0 0 2px #C8FF2E, 0 0 16px rgba(200, 255, 46, .75); } 100% { box-shadow: inset 0 0 0 0 rgba(200, 255, 46, 0), 0 0 0 rgba(200, 255, 46, 0); } }
@keyframes ml-pop { 0% { transform: scale(1); } 35% { transform: scale(1.09); box-shadow: 0 0 0 2px #FFB627, 0 0 18px rgba(255, 182, 39, .8); } 100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(255, 182, 39, 0); } }
@keyframes bc-flash { 0%, 45% { background: #FFD23F; color: #0B1F4D; } 100% { } }

html[data-theme="floodlight"] .chg { animation: fl-glow 1s ease-out; }
html[data-theme="floodlight"] .chg::after { content: ''; position: absolute; top: 0; bottom: 0; left: 0; width: 100%; background: linear-gradient(90deg, transparent 20%, rgba(255, 255, 255, .9) 50%, transparent 80%); animation: mp-shine .85s ease-out forwards; pointer-events: none; }
html[data-theme="mela"] .chg { animation: ml-pop .9s ease-out; z-index: 1; }
html[data-theme="mela"] .chg::after { content: ''; position: absolute; top: 0; bottom: 0; left: 0; width: 100%; background: linear-gradient(90deg, transparent 20%, rgba(255, 236, 170, .95) 50%, transparent 80%); animation: mp-shine .8s ease-out .1s backwards; pointer-events: none; }
html[data-theme="broadcast"] .chg { animation: bc-flash 1.1s ease-out; }
@keyframes bc-arrow { 0%, 70% { opacity: 1; } 100% { opacity: 0; } }
html[data-theme="broadcast"] .chg-up::before, html[data-theme="broadcast"] .chg-down::before { position: absolute; top: 2px; right: 3px; font-size: 8px; line-height: 1; animation: bc-arrow 1.6s ease-out forwards; }
html[data-theme="broadcast"] .chg-up::before { content: '▲'; color: #0E8A4F; }
html[data-theme="broadcast"] .chg-down::before { content: '▼'; color: #D7263D; }

@media (prefers-reduced-motion: reduce) {
  .chg, .chg::after, .chg::before { animation: none !important; }
}

/* ---------- animated promos (Floodlight, Mela) ---------- */
.ax-rail { display: flex; gap: 10px; overflow-x: auto; scrollbar-width: none; padding-right: 16px; }
.ax-rail::-webkit-scrollbar { display: none; }
.ax-tile { display: block; height: auto; aspect-ratio: 364 / 280; object-fit: cover; border-radius: 12px; cursor: pointer; }
.ax-rail .ax-tile { flex: 0 0 168px; width: 168px; }
.ax-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.ax-grid .ax-tile { width: 100%; }
.ax-strip { display: block; width: 100%; height: auto; aspect-ratio: 937 / 160; object-fit: cover; border-radius: 12px; cursor: pointer; }
.fl .ax-tile, .fd .ax-tile, .fl .ax-strip, .fd .ax-strip { box-shadow: 0 0 0 1px #26304A; }
.ml .ax-tile, .md .ax-tile, .ml .ax-strip, .md .ax-strip { box-shadow: 0 0 0 2px #FFB627; }
.md .ax-grid { gap: 16px; }
.ax-strips { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.md .ax-strips { gap: 16px; }

.ax-chip { position: fixed; left: 12px; bottom: 86px; z-index: 40; width: 66px; padding: 0; border: 0; background: none; cursor: pointer; display: flex; flex-direction: column; align-items: center; gap: 2px; }
.ax-chip img { width: 58px; height: 58px; display: block; filter: drop-shadow(0 6px 14px rgba(0, 0, 0, .5)); }
.ax-chip span { font: 700 10px/1.2 Inter, system-ui, sans-serif; color: #fff; padding: 3px 7px; border-radius: 999px; background: rgba(13, 15, 22, .85); white-space: nowrap; }
html[data-theme="mela"] .ax-chip span { background: #FFB627; color: #3A1A00; font-family: 'Baloo 2', Inter, sans-serif; }
html[data-layout="dk"] .ax-chip { left: 20px; bottom: 20px; width: 84px; }
html[data-layout="dk"] .ax-chip img { width: 76px; height: 76px; }

#popup { position: fixed; inset: 0; z-index: 1050; display: flex; align-items: center; justify-content: center; padding: 20px; background: rgba(5, 6, 10, .74); -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px); animation: pop-fade .25s ease-out; }
.pop-card { position: relative; width: 100%; text-align: center; animation: pop-in .4s cubic-bezier(.2, 1.3, .4, 1); }
.pop-card img { display: block; width: 100%; height: auto; border-radius: 16px; cursor: pointer; }
.pop-x { position: absolute; top: -14px; right: -12px; z-index: 1; width: 34px; height: 34px; border-radius: 50%; border: 2px solid #fff; background: #111; color: #fff; font: 400 20px/1 Inter, system-ui, sans-serif; cursor: pointer; }
.pop-cta { margin-top: 14px; height: 44px; padding: 0 30px; border-radius: 999px; border: 0; font: 700 15px/1 Inter, system-ui, sans-serif; cursor: pointer; }
html[data-theme="floodlight"] .pop-card img { box-shadow: 0 0 0 2px #C8FF2E, 0 0 44px rgba(200, 255, 46, .35); }
html[data-theme="floodlight"] .pop-cta { background: #C8FF2E; color: #0A1000; box-shadow: 0 0 24px rgba(200, 255, 46, .45); }
html[data-theme="mela"] .pop-card img { box-shadow: 0 0 0 3px #FFB627, 0 0 44px rgba(255, 182, 39, .45); }
html[data-theme="mela"] .pop-cta { background: linear-gradient(#FFD25A, #FFB627); color: #3A1A00; font-family: 'Baloo 2', Inter, sans-serif; font-size: 17px; }
@keyframes pop-fade { from { opacity: 0; } }
@keyframes pop-in { from { opacity: 0; transform: scale(.85); } }
@media (prefers-reduced-motion: reduce) { #popup, .pop-card { animation: none; } }
