/* Bundled fonts (OFL, latin subset). Weight 800 falls back to 700. */
@font-face { font-family: 'Rajdhani'; font-style: normal; font-weight: 500; font-display: swap; src: url('../fonts/rajdhani-500.woff2') format('woff2'); }
@font-face { font-family: 'Rajdhani'; font-style: normal; font-weight: 600; font-display: swap; src: url('../fonts/rajdhani-600.woff2') format('woff2'); }
@font-face { font-family: 'Rajdhani'; font-style: normal; font-weight: 700; font-display: swap; src: url('../fonts/rajdhani-700.woff2') format('woff2'); }
@font-face { font-family: 'Poppins'; font-style: normal; font-weight: 400; font-display: swap; src: url('../fonts/poppins-400.woff2') format('woff2'); }
@font-face { font-family: 'Poppins'; font-style: normal; font-weight: 500; font-display: swap; src: url('../fonts/poppins-500.woff2') format('woff2'); }
@font-face { font-family: 'Poppins'; font-style: normal; font-weight: 600; font-display: swap; src: url('../fonts/poppins-600.woff2') format('woff2'); }
@font-face { font-family: 'Poppins'; font-style: normal; font-weight: 700; font-display: swap; src: url('../fonts/poppins-700.woff2') format('woff2'); }
:root {
  --jo-tap: 44px; --jo-ctl-h: 52px; --jo-ico: 24px; --jo-ico-sm: 20px;
  --jo-dur-fast: 120ms; --jo-dur: 200ms; --jo-dur-slow: 300ms; --jo-ease-out: cubic-bezier(0.2, 0.8, 0.2, 1);
  --jo-lh-tight: 1.2; --jo-lh: 1.4; --jo-lh-loose: 1.55; --jo-track: 0.04em; --jo-fs-2xs: 11px;
  --jo-z-raise: 1; --jo-z-actions: 50; --jo-z-bar: 100; --jo-z-dsheet: 9990; --jo-z-sheet: 9998; --jo-z-toast: 9999;
  --jo-topbar-shadow: 0 8px 30px rgba(242, 2, 137, 0.14);
}

/* offline.css - offline-only layout (home, history, top bar). Linked LAST on every offline page.
   Tokens only: var(--ui-*) / var(--jf-*). No new hex colours. */
html body.jg-offline { min-height: 100%; margin: 0; padding: 0 var(--ui-page-x) calc(var(--ui-section-gap) + var(--jo-safe-bottom, env(safe-area-inset-bottom, 0px))); }
html body.jg-offline .jo-wrap { max-width: 520px; margin: 0 auto; padding-top: var(--jo-safe-top, env(safe-area-inset-top, 0px)); }

/* top bar */
html body.jg-offline .jo-topbar, html body.jg-tictactoe .jo-topbar, html body.jg-barah .jo-topbar, html body.jg-ludo .jo-topbar { display: flex; align-items: center; justify-content: space-between; gap: var(--ui-gap-sm); min-height: var(--ui-topbar-h, 56px); padding: var(--ui-gap-sm) 0; }
html body.jg-offline .jo-brand, html body.jg-tictactoe .jo-brand, html body.jg-barah .jo-brand, html body.jg-ludo .jo-brand { display: flex; align-items: center; gap: var(--ui-gap-sm); min-width: 0; }
html body.jg-offline .jo-topbar-host, html body.jg-tictactoe .jo-topbar-host, html body.jg-barah .jo-topbar-host, html body.jg-ludo .jo-topbar-host { position: sticky; top: 0; z-index: var(--jo-z-bar); width: 100vw; max-width: 100vw; margin: 0 0 var(--ui-gap-sm) calc(50% - 50vw); padding: var(--jo-safe-top, env(safe-area-inset-top, 0px)) var(--ui-gap-sm) 0; box-sizing: border-box; background: var(--jf-nav-bg); border: 0; border-bottom: 1px solid var(--jf-nav-border); border-radius: 0; box-shadow: var(--jo-topbar-shadow); -webkit-backdrop-filter: var(--jf-blur); backdrop-filter: var(--jf-blur); }
/* edge-to-edge: pull the bar up over the body top padding (home/history: the .jo-wrap safe-area padding; game pages: dashboard body padding 6/8/10/20px) */
html body.jg-offline .jo-topbar-host { margin-top: calc(-1 * var(--jo-safe-top, env(safe-area-inset-top, 0px))); }
html body.jg-tictactoe .jo-topbar-host, html body.jg-barah .jo-topbar-host, html body.jg-ludo .jo-topbar-host { margin-top: calc(-10px - var(--jo-safe-top, env(safe-area-inset-top, 0px))); }
@media (max-width: 768px) { html body.jg-tictactoe .jo-topbar-host, html body.jg-barah .jo-topbar-host, html body.jg-ludo .jo-topbar-host { margin-top: calc(-8px - var(--jo-safe-top, env(safe-area-inset-top, 0px))); } }
@media (max-width: 480px) { html body.jg-tictactoe .jo-topbar-host, html body.jg-barah .jo-topbar-host, html body.jg-ludo .jo-topbar-host { margin-top: calc(-6px - var(--jo-safe-top, env(safe-area-inset-top, 0px))); } }
@media (min-width: 1024px) { html body.jg-tictactoe .jo-topbar-host, html body.jg-barah .jo-topbar-host, html body.jg-ludo .jo-topbar-host { margin-top: calc(-20px - var(--jo-safe-top, env(safe-area-inset-top, 0px))); } }
html body.jg-offline .jo-topbar-host.jo-stuck, html body.jg-tictactoe .jo-topbar-host.jo-stuck, html body.jg-barah .jo-topbar-host.jo-stuck, html body.jg-ludo .jo-topbar-host.jo-stuck { box-shadow: var(--jo-topbar-shadow); }
html body.jg-offline .jo-back-btn, html body.jg-tictactoe .jo-back-btn, html body.jg-barah .jo-back-btn, html body.jg-ludo .jo-back-btn { display: inline-flex; align-items: center; justify-content: center; width: var(--jo-tap); height: var(--jo-tap); flex: none; margin-left: calc(-1 * var(--ui-s1)); padding: 0; border: 0; border-radius: var(--ui-r-pill); background: transparent; color: var(--ui-text); cursor: pointer; -webkit-tap-highlight-color: transparent; }
html body.jg-offline .jo-back-btn svg, html body.jg-tictactoe .jo-back-btn svg, html body.jg-barah .jo-back-btn svg, html body.jg-ludo .jo-back-btn svg { width: 24px; height: 24px; display: block; }
html body.jg-offline .jo-back-btn:active, html body.jg-tictactoe .jo-back-btn:active, html body.jg-barah .jo-back-btn:active, html body.jg-ludo .jo-back-btn:active { background: var(--jf-glass-strong); }
html body.jg-offline .jo-back-btn:focus-visible, html body.jg-tictactoe .jo-back-btn:focus-visible, html body.jg-barah .jo-back-btn:focus-visible, html body.jg-ludo .jo-back-btn:focus-visible { outline: 2px solid var(--ui-focus, var(--ui-accent)); outline-offset: 2px; }
html body.jg-offline .jo-bar-title, html body.jg-tictactoe .jo-bar-title, html body.jg-barah .jo-bar-title, html body.jg-ludo .jo-bar-title { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-family: var(--ui-font-display); font-size: var(--ui-fs-lg); font-weight: 700; color: var(--ui-text); line-height: var(--jo-lh-tight); }
html body.jg-offline .jo-logo, html body.jg-tictactoe .jo-logo, html body.jg-barah .jo-logo, html body.jg-ludo .jo-logo { font-family: var(--ui-font-display); font-size: var(--ui-fs-xl); font-weight: 700; color: var(--ui-accent-text); line-height: 1; }
html body.jg-offline .jo-chip, html body.jg-tictactoe .jo-chip, html body.jg-barah .jo-chip, html body.jg-ludo .jo-chip { display: inline-block; padding: 2px var(--ui-gap-sm); border-radius: var(--ui-r-pill); background: var(--jf-glass-strong); border: 1px solid var(--ui-glass-edge); color: var(--ui-muted); font-size: var(--ui-fs-xs); font-weight: 600; white-space: nowrap; font-variant-numeric: tabular-nums; max-width: 100%; overflow: hidden; text-overflow: ellipsis; }
html body.jg-offline .jo-online, html body.jg-tictactoe .jo-online, html body.jg-barah .jo-online, html body.jg-ludo .jo-online { display: inline-flex; align-items: center; gap: var(--ui-gap-sm); min-height: var(--jo-tap); padding: 0 var(--ui-pad-md); box-sizing: border-box; border-radius: var(--ui-r-pill); background: var(--jf-glass-strong); border: 1px solid var(--ui-glass-edge); color: var(--ui-accent-text); font-family: var(--ui-font-display); font-size: var(--ui-fs-md); font-weight: 700; cursor: pointer; flex-shrink: 0; -webkit-tap-highlight-color: transparent; }
html body.jg-offline .jo-online svg, html body.jg-tictactoe .jo-online svg, html body.jg-barah .jo-online svg, html body.jg-ludo .jo-online svg { width: 20px; height: 20px; display: block; }
html body.jg-offline .jo-online:active, html body.jg-tictactoe .jo-online:active, html body.jg-barah .jo-online:active, html body.jg-ludo .jo-online:active { transform: scale(0.97); }
html body.jg-offline .jo-online:focus-visible, html body.jg-tictactoe .jo-online:focus-visible, html body.jg-barah .jo-online:focus-visible, html body.jg-ludo .jo-online:focus-visible { outline: 2px solid var(--ui-focus, var(--ui-accent)); outline-offset: 2px; }
html body .jo-sheet { display: none; position: fixed; left: 0; top: 0; right: 0; bottom: 0; z-index: var(--jo-z-sheet); align-items: flex-end; justify-content: center; background: var(--ui-scrim-40); opacity: 0; transition: opacity var(--jo-dur) var(--jo-ease-out); }
html body .jo-sheet.jo-sheet--show { display: flex; }
html body .jo-sheet.jo-sheet--open { opacity: 1; }
html body .jo-sheet-panel { width: 100%; max-width: 520px; box-sizing: border-box; padding: var(--ui-pad-lg) var(--ui-pad-lg) calc(var(--ui-pad-lg) + var(--jo-safe-bottom, env(safe-area-inset-bottom, 0px))); background: var(--ui-surface-solid); border: 1px solid var(--jf-glass-border); border-radius: var(--ui-r-lg) var(--ui-r-lg) 0 0; opacity: 0; transform: translateY(12px); transition: transform var(--jo-dur-slow) var(--jo-ease-out), opacity var(--jo-dur-slow) var(--jo-ease-out); }
html body .jo-sheet--open .jo-sheet-panel { opacity: 1; transform: none; }
html body .jo-sheet-title { font-family: var(--ui-font-display); font-size: var(--ui-fs-lg); font-weight: 700; text-align: center; color: var(--ui-text); margin: 0 0 var(--ui-gap-sm); line-height: var(--jo-lh-tight); }
html body .jo-sheet-txt { margin: 0 0 var(--ui-gap); text-align: center; font-size: var(--ui-fs-md); color: var(--ui-text); line-height: var(--jo-lh-loose); }
html body .jo-sheet-warn { display: none; margin: 0 0 var(--ui-gap); text-align: center; font-size: var(--ui-fs-sm); font-weight: 600; color: var(--ui-accent-text); line-height: var(--jo-lh); }
html body .jo-sheet-btns { display: flex; flex-direction: column; gap: var(--ui-gap-sm); }
html body .jo-sheet-btns .jx-btn { width: 100%; min-height: 48px; }
@media (prefers-reduced-motion: reduce) { html body .jo-sheet, html body .jo-sheet-panel { transition: none; } }

/* headings */

/* cards */
html body.jg-offline .jo-card--soon { opacity: 0.6; cursor: default; }
html body.jg-offline .jo-pill { flex-shrink: 0; padding: 2px var(--ui-gap-sm); border-radius: var(--ui-r-pill); background: var(--jf-glass-strong); border: 1px solid var(--ui-glass-edge); color: var(--ui-muted); font-size: var(--ui-fs-xs); font-weight: 600; white-space: nowrap; font-variant-numeric: tabular-nums; }
html body.jg-offline .jo-note { margin: var(--ui-section-gap) 0 0; text-align: center; font-size: var(--ui-fs-sm); color: var(--ui-muted); line-height: var(--jo-lh-loose); }
html body.jg-offline #jo-recent { margin-top: var(--ui-section-gap); }
html body.jg-offline .jo-hero { display: flex; align-items: center; justify-content: space-between; gap: var(--ui-gap); padding: var(--ui-pad-lg); margin: 0 0 var(--ui-section-gap); border-radius: var(--ui-r-lg); background: var(--ui-grad-btn); color: var(--ui-on-accent); box-shadow: var(--ui-accent-shadow); }
html body.jg-offline .jo-hero-txt { min-width: 0; }
html body.jg-offline .jo-hero-title { font-family: var(--ui-font-display); font-size: var(--ui-fs-xl); font-weight: 700; margin: 0 0 var(--ui-s1); color: inherit; line-height: var(--jo-lh-tight); }
html body.jg-offline .jo-hero-sub { margin: 0; font-size: var(--ui-fs-sm); color: inherit; line-height: var(--jo-lh-loose); }
html body.jg-offline .jo-hero-btn { display: inline-flex; align-items: center; justify-content: center; min-height: var(--jo-tap); margin-top: var(--ui-gap-sm); padding: 0 var(--ui-pad-md); box-sizing: border-box; border-radius: var(--ui-r-pill); background: var(--jf-glass-strong); border: 1px solid var(--ui-glass-edge); color: var(--ui-accent-text); font-family: var(--ui-font-display); font-size: var(--ui-fs-md); font-weight: 700; text-decoration: none; -webkit-tap-highlight-color: transparent; }
html body.jg-offline .jo-hero-btn:active { transform: scale(0.97); }
html body.jg-offline .jo-hero-btn:focus-visible { outline: 2px solid var(--ui-focus, var(--ui-accent)); outline-offset: 2px; }
html body.jg-offline .jo-hero-btn[hidden] { display: none; }
html body.jg-offline .jo-hero-art { flex: none; width: 56px; height: 56px; opacity: 0.9; }
html body.jg-offline .jo-hero-art svg { width: 100%; height: 100%; display: block; }
html body.jg-offline .jo-section-title { margin: 0 0 var(--ui-gap-sm); font-family: var(--ui-font-display); font-size: var(--ui-fs-lg); font-weight: 700; color: var(--ui-text); scroll-margin-top: calc(var(--ui-topbar-h, 56px) + var(--ui-gap) + var(--jo-safe-top, env(safe-area-inset-top, 0px))); line-height: var(--jo-lh-tight); }
html body.jg-offline .jo-games { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--ui-gap); }
html body.jg-offline .jo-gcard { display: flex; flex-direction: column; align-items: flex-start; gap: var(--ui-gap-sm); min-height: 132px; padding: var(--ui-pad-lg); box-sizing: border-box; position: relative; overflow: hidden; transition: transform var(--jo-dur-fast) var(--jo-ease-out), box-shadow var(--ui-ease); min-width: 0; text-decoration: none; color: var(--ui-text); background: var(--jf-glass); border: 1px solid var(--jf-glass-border); border-radius: var(--ui-r-lg); box-shadow: var(--ui-shadow); -webkit-backdrop-filter: var(--jf-blur); backdrop-filter: var(--jf-blur); -webkit-tap-highlight-color: transparent; }
html body.jg-offline .jo-gcard:active { transform: scale(0.97); }
html body.jg-offline .jo-gcard:focus-visible { outline: 2px solid var(--ui-focus, var(--ui-accent)); outline-offset: -3px; }
html body.jg-offline .jo-gcard::before { content: ''; position: absolute; top: 0; right: 0; bottom: 0; left: 0; border-radius: inherit; opacity: 0.10; pointer-events: none; }
html body.jg-offline .jo-gcard > * { position: relative; z-index: var(--jo-z-raise); }
html body.jg-offline .jo-gcard--ludo::before { background: linear-gradient(135deg, var(--accent-orange), var(--ui-warn-deep)); }
html body.jg-offline .jo-gcard--ttt::before { background: linear-gradient(135deg, var(--primary-color), var(--primary-dark)); }
html body.jg-offline .jo-gcard--barah::before { background: linear-gradient(135deg, var(--accent-blue), var(--ui-info-deep)); }
html body.jg-offline .jo-gcount { display: inline-block; align-self: flex-start; margin-top: var(--ui-s1); padding: 2px var(--ui-gap-sm); border-radius: var(--ui-r-pill); background: var(--jf-glass-strong); border: 1px solid var(--ui-glass-edge); color: var(--ui-muted); font-size: var(--ui-fs-xs); font-weight: 600; white-space: nowrap; font-variant-numeric: tabular-nums; }
html body.jg-offline .jo-gcount[hidden] { display: none; }
html body.jg-offline .jo-gtext { min-width: 0; }
html body.jg-offline .jo-glast { display: block; margin-top: var(--ui-s1); font-size: var(--ui-fs-xs); line-height: var(--jo-lh); color: var(--ui-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
html body.jg-offline .jo-glast[hidden] { display: none; }
html body.jg-offline .jo-glast::before { content: ''; display: inline-block; width: 6px; height: 6px; margin-right: var(--ui-gap-sm); vertical-align: middle; border-radius: var(--ui-r-pill); background: var(--ui-muted); }
html body.jg-offline .jo-glast--win::before { background: var(--ui-ok); }
html body.jg-offline .jo-glast--loss::before { background: var(--ui-bad); }
html body.jg-offline .jo-glast--draw::before { background: var(--ui-muted); }
html body.jg-offline .jo-glast--live::before { background: var(--ui-accent); animation: jo-live 1.6s ease-in-out infinite; }
@keyframes jo-live { 0%, 100% { opacity: 1; } 50% { opacity: 0.35; } }
@media (prefers-reduced-motion: reduce) { html body.jg-offline .jo-glast--live::before { animation: none; } }
html body.jg-offline .jo-gplay--cont { background: var(--ui-grad-btn); color: var(--ui-on-accent); border-color: transparent; }
@media (prefers-reduced-motion: reduce) { html body.jg-offline .jo-gcard { transition: none; } html body.jg-offline .jo-gcard:active { transform: none; } }
html body.jg-offline .jo-gcard--wide { grid-column: 1 / -1; flex-direction: row; align-items: center; min-height: 120px; }
html body.jg-offline .jo-gicon { display: inline-flex; align-items: center; justify-content: center; width: 60px; height: 60px; flex: none; border-radius: var(--ui-r-md); color: var(--ui-on-accent); }
html body.jg-offline .jo-gicon svg { width: 30px; height: 30px; display: block; }
html body.jg-offline .jo-gcard--ludo .jo-gicon { background: linear-gradient(135deg, var(--accent-orange), var(--ui-warn-deep)); }
html body.jg-offline .jo-gcard--ttt .jo-gicon { background: linear-gradient(135deg, var(--primary-color), var(--primary-dark)); }
html body.jg-offline .jo-gcard--barah .jo-gicon { background: linear-gradient(135deg, var(--accent-blue), var(--ui-info-deep)); }
html body.jg-offline .jo-gtext { display: block; flex: 1 1 auto; min-width: 0; }
html body.jg-offline .jo-gtitle { display: block; font-family: var(--ui-font-display); font-size: var(--ui-fs-lg); font-weight: 700; line-height: var(--jo-lh-tight); }
html body.jg-offline .jo-gsub { display: block; font-size: var(--ui-fs-sm); color: var(--ui-muted); line-height: var(--jo-lh); }
html body.jg-offline .jo-gplay { flex: none; margin-top: var(--ui-s1); padding: 2px var(--ui-gap); border-radius: var(--ui-r-pill); background: var(--jf-glass-strong); border: 1px solid var(--ui-glass-edge); color: var(--ui-accent-text); font-size: var(--ui-fs-sm); font-weight: 700; }
html body.jg-offline .jo-gcard--wide .jo-gplay { margin-top: 0; margin-left: auto; }
html body.jg-offline .jo-gcard--wide .jo-gicon { width: 64px; height: 64px; }
/* Home card artwork: decorative watermark behind the text */
html body.jg-offline .jo-gcard > .jo-gart { position: absolute; right: calc(-1 * var(--ui-s2)); bottom: calc(-1 * var(--ui-s2)); width: 96px; height: 96px; opacity: 0.22; pointer-events: none; z-index: 0; }
html body.jg-offline .jo-gcard--ludo > .jo-gart, html body.jg-offline .jo-gcard--ttt > .jo-gart, html body.jg-offline .jo-gcard--barah > .jo-gart { right: var(--ui-s2); bottom: auto; top: 50%; width: 128px; height: 128px; opacity: 0.30; transform: translateY(-50%); }
html body.jg-offline .jo-gcard--ludo > .jo-gart { color: var(--accent-orange); }
html body.jg-offline .jo-gcard--ttt > .jo-gart { color: var(--primary-color); }
html body.jg-offline .jo-gcard--barah > .jo-gart { color: var(--accent-blue); }
html body.jg-offline .jo-gart-svg { width: 100%; height: 100%; display: block; }
@media (max-width: 359px) {
  html body.jg-offline .jo-gcard > .jo-gart, html body.jg-offline .jo-gcard--ludo > .jo-gart, html body.jg-offline .jo-gcard--ttt > .jo-gart, html body.jg-offline .jo-gcard--barah > .jo-gart { width: 80px; height: 80px; }
}
html body.jg-offline .jo-recent-head { display: flex; align-items: center; justify-content: space-between; gap: var(--ui-gap-sm); margin: 0 0 var(--ui-gap-sm); }
html body.jg-offline .jo-recent-head .jo-recent-title { margin: 0; }
html body.jg-offline .jo-see-all { display: inline-flex; align-items: center; min-height: var(--jo-tap); min-width: var(--jo-tap); font-size: var(--ui-fs-sm); font-weight: 700; color: var(--ui-accent-text); text-decoration: none; }

/* toast */
.jo-toast { display: none; position: fixed; left: 50%; bottom: calc(var(--ui-s5) + var(--jo-safe-bottom, env(safe-area-inset-bottom, 0px))); transform: translateX(-50%) translateY(8px); max-width: 90%; box-sizing: border-box; padding: var(--ui-gap-sm) var(--ui-pad-lg); border-radius: var(--ui-r-pill); background: var(--ui-toast-bg); color: var(--ui-on-accent); font-size: var(--ui-fs-sm); text-align: center; opacity: 0; transition: opacity var(--jo-dur) var(--jo-ease-out), transform var(--jo-dur) var(--jo-ease-out); z-index: var(--jo-z-toast); pointer-events: none; }
.jo-toast.jo-toast--show { opacity: 1; transform: translateX(-50%) translateY(0); }
html body .jo-tabbar { display: flex; justify-content: center; position: fixed; left: 0; right: 0; bottom: 0; z-index: var(--jo-z-bar); box-sizing: border-box; padding: var(--ui-s1) var(--ui-gap-sm) calc(var(--ui-s1) + var(--jo-safe-bottom, env(safe-area-inset-bottom, 0px))); background: var(--jf-nav-bg); border-top: 1px solid var(--jf-nav-border); box-shadow: var(--jf-nav-shadow); -webkit-backdrop-filter: var(--jf-blur); backdrop-filter: var(--jf-blur); }
html body .jo-tab { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; flex: 1 1 0; max-width: 130px; min-width: 0; min-height: 52px; padding: var(--ui-s1); border: 0; background: transparent; color: var(--ui-muted); font-family: var(--ui-font-display); font-size: var(--jo-fs-2xs); font-weight: 600; text-decoration: none; cursor: pointer; -webkit-tap-highlight-color: transparent; }
html body .jo-tab-lbl { min-width: 0; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; line-height: var(--jo-lh-tight); }
html body .jo-tab:focus-visible { outline: 2px solid var(--ui-focus, var(--ui-accent)); outline-offset: 2px; border-radius: var(--ui-r-sm); }
html body .jo-tab-ico { display: inline-flex; align-items: center; justify-content: center; width: 52px; height: 28px; border-radius: var(--ui-r-pill); }
html body .jo-tab-ico svg { width: 22px; height: 22px; display: block; }
html body .jo-tab--active { color: var(--ui-accent-text); }
html body .jo-tab--active .jo-tab-ico { background: var(--ui-grad-btn); color: var(--ui-on-accent); }
html body.jo-has-tabbar.jg-ui { padding-bottom: calc(92px + var(--ui-section-gap) + var(--jo-safe-bottom, env(safe-area-inset-bottom, 0px))); }
html body.jo-has-tabbar .jo-toast { bottom: calc(92px + var(--ui-s4) + var(--jo-safe-bottom, env(safe-area-inset-bottom, 0px))); }

@media (max-width: 340px) {
  html body .jo-tab-ico { width: 44px; }
  html body.jg-offline .jo-games { grid-template-columns: minmax(0, 1fr); }
  html body.jg-offline .jo-gcard { flex-direction: row; align-items: center; min-height: 72px; }
  html body.jg-offline .jo-gicon { width: 52px; height: 52px; }
  html body.jg-offline .jo-gicon svg { width: 28px; height: 28px; }
  html body.jg-offline .jo-gcard--ttt, html body.jg-offline .jo-gcard--barah { min-height: 72px; }
  html body.jg-offline .jo-gcard--wide .jo-gicon { width: 52px; height: 52px; }
  html body.jg-offline .jo-gplay { margin-top: 0; margin-left: auto; }
  html body.jg-offline .jo-hero-art { display: none; }
  html body.jg-offline .jo-online, html body.jg-tictactoe .jo-online, html body.jg-barah .jo-online, html body.jg-ludo .jo-online { padding: 0 var(--ui-gap-sm); }
  html body.jg-offline .jo-online-label, html body.jg-tictactoe .jo-online-label, html body.jg-barah .jo-online-label, html body.jg-ludo .jo-online-label { font-size: var(--ui-fs-sm); }
}

/* Tic Tac Toe page: setup card, side chips, turn line (the top bar rules above also apply to body.jg-tictactoe) */
html body.jg-tictactoe .container { padding-top: var(--jo-safe-top, env(safe-area-inset-top, 0px)); }
html body.jg-tictactoe #screen-setup .jo-setup-btn { width: 100%; min-height: var(--jo-ctl-h); }
html body.jg-tictactoe #screen-setup .jo-side { display: flex; flex-wrap: wrap; gap: var(--ui-gap-sm); margin: var(--ui-gap) 0; }
html body.jg-tictactoe #screen-setup .jo-side .jx-chip { flex: 1 1 140px; min-height: var(--jo-tap); }
html body.jg-tictactoe #match-info .jm-bar-col { min-width: 0; }
html body.jg-tictactoe #match-info #turn-text { font-size: var(--ui-fs-sm); }

/* Barah Tehni page: same setup card and turn pill rules as Tic Tac Toe (the top bar rules above also apply to body.jg-barah) */
html body.jg-barah .container { padding-top: var(--jo-safe-top, env(safe-area-inset-top, 0px)); }
html body.jg-barah #screen-setup .jo-setup-btn { width: 100%; min-height: var(--jo-ctl-h); }
html body.jg-barah #screen-setup .jo-side { display: flex; flex-wrap: wrap; gap: var(--ui-gap-sm); margin: var(--ui-gap) 0; }
html body.jg-barah #screen-setup .jo-side .jx-chip { flex: 1 1 140px; min-height: var(--jo-tap); }
html body.jg-barah #match-info .jm-bar-col { min-width: 0; }
html body.jg-barah #match-info #turn-text { font-size: var(--ui-fs-sm); }

/* Ludo page: setup card, seat rows, chips row, dice button (the top bar rules above also apply to body.jg-ludo) */
html body.jg-ludo .container { padding-top: var(--jo-safe-top, env(safe-area-inset-top, 0px)); }
html body.jg-ludo #screen-setup .jo-setup-btn { width: 100%; min-height: var(--jo-ctl-h); margin-top: var(--ui-gap-sm); }
html body.jg-ludo #screen-setup .jo-side { display: flex; flex-wrap: wrap; gap: var(--ui-gap-sm); margin: var(--ui-gap) 0; }
html body.jg-ludo #screen-setup .jo-side .jx-chip { flex: 1 1 90px; min-height: var(--jo-tap); }
html body.jg-ludo #match-info .jm-bar-col { min-width: 0; }
html body.jg-ludo #match-info #turn-text { font-size: var(--ui-fs-sm); }
html body.jg-ludo .jl-seats { display: flex; flex-direction: column; gap: var(--ui-gap-sm); margin: 0 0 var(--ui-gap); }
html body.jg-ludo .jl-seat { display: flex; align-items: center; gap: var(--ui-gap-sm); min-width: 0; }
html body.jg-ludo .jl-dot { display: inline-block; flex: none; width: 14px; height: 14px; border-radius: 50%; }
html body.jg-ludo .jl-seat-name { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; color: var(--ui-text); }
html body.jg-ludo .jl-toggle { display: inline-flex; flex: none; gap: var(--ui-gap-sm); }
html body.jg-ludo .jl-toggle .jx-chip { min-height: var(--jo-tap); min-width: 64px; }
html body.jg-ludo .jl-chips { display: flex; flex-wrap: wrap; justify-content: center; gap: var(--ui-gap-sm); min-width: 0; }
html body.jg-ludo .jl-chip { display: inline-flex; align-items: center; gap: var(--ui-s1); min-width: 0; max-width: 100%; box-sizing: border-box; padding: 2px var(--ui-gap-sm); border-radius: var(--ui-r-pill); background: var(--jf-glass-strong); border: 1px solid var(--ui-glass-edge); font-size: var(--ui-fs-xs); color: var(--ui-text); }
html body.jg-ludo .jl-chip--turn { box-shadow: 0 0 0 2px var(--ld-hl, var(--ui-accent)); }
html body.jg-ludo .jl-chip-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
html body.jg-ludo .jl-chip-sub { white-space: nowrap; color: var(--ui-muted); font-variant-numeric: tabular-nums; }
html body.jg-ludo #screen-match.jf-fit > .jl-chips, html body.jg-ludo #screen-match.jf-fit > #dice-box { flex: 0 0 auto; }
html body.jg-ludo #screen-match #dice-box { width: 64px; height: 64px; margin: var(--ui-s1) auto; flex: none; }
html body.jg-ludo #screen-match #dice-box.ld-face { padding: 10px; }
html body.jg-ludo #screen-match #dice-box .ld-pip { width: 12px; height: 12px; }
html body.jg-ludo #screen-match #dice-box[aria-disabled="true"] { cursor: default; }
@media (max-width: 340px) {
  html body.jg-ludo .jl-toggle .jx-chip { min-width: 52px; padding-left: var(--ui-gap-sm); padding-right: var(--ui-gap-sm); }
  html body.jg-ludo .jl-chip-sub { display: none; }
}
@media (min-width: 900px), (orientation: landscape) and (max-height: 520px) and (min-width: 560px) {
  html body.jg-ludo #screen-match.jf-fit[style*="display: block"] { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr) auto auto; }
}

/* History page + Home "Recent": filter chips, stat cards, row cards, confirm dialog */
html body.jg-offline .jo-filters { display: flex; flex-wrap: wrap; gap: var(--ui-gap-sm); margin: 0 0 var(--ui-gap); }
html body.jg-offline .jo-filters .jx-chip { min-height: var(--jo-tap); }
html body.jg-offline .jo-stats { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--ui-gap); margin: 0 0 var(--ui-gap); }
html body.jg-offline .jo-stat { display: flex; flex-direction: row-reverse; justify-content: space-between; align-items: center; gap: var(--ui-gap-sm); width: 100%; min-width: 0; padding: var(--ui-pad-lg); box-sizing: border-box; text-align: left; background: var(--jf-glass); border: 1px solid var(--jf-glass-border); border-radius: var(--ui-r-lg); box-shadow: var(--ui-shadow); }
html body.jg-offline .jo-stat-val { font-family: var(--ui-font-display); font-size: var(--ui-fs-lg); font-weight: 700; color: var(--ui-text); line-height: var(--jo-lh-tight); font-variant-numeric: tabular-nums; }
html body.jg-offline .jo-stat-lbl { font-size: var(--ui-fs-xs); color: var(--ui-muted); overflow-wrap: anywhere; letter-spacing: var(--jo-track); line-height: var(--jo-lh); }
html body.jg-offline .jo-row { display: block; width: 100%; margin: 0 0 var(--ui-gap); padding: var(--ui-pad-lg); box-sizing: border-box; min-width: 0; background: var(--jf-glass); border: 1px solid var(--jf-glass-border); border-radius: var(--ui-r-lg); box-shadow: var(--ui-shadow); }
html body.jg-offline .jo-row-top { display: flex; justify-content: space-between; align-items: baseline; flex-wrap: wrap; gap: var(--ui-s1); }
html body.jg-offline .jo-row-game { font-family: var(--ui-font-display); font-size: var(--ui-fs-md); font-weight: 700; color: var(--ui-text); line-height: var(--jo-lh); max-width: 100%; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
html body.jg-offline .jo-row-when { font-size: var(--ui-fs-sm); color: var(--ui-muted); line-height: var(--jo-lh); }
html body.jg-offline .jo-row-players { font-size: var(--ui-fs-sm); color: var(--ui-text); overflow-wrap: anywhere; line-height: var(--jo-lh); }
html body.jg-offline .jo-row-win { font-size: var(--ui-fs-sm); font-weight: 600; color: var(--ui-text); line-height: var(--jo-lh); }
html body.jg-offline .jo-row-meta { font-size: var(--ui-fs-sm); color: var(--ui-muted); line-height: var(--jo-lh); }
html body.jg-offline .jo-recent-title { margin: 0 0 var(--ui-gap-sm); font-family: var(--ui-font-display); font-size: var(--ui-fs-md); font-weight: 700; color: var(--ui-text); line-height: var(--jo-lh); }
html body.jg-offline .jo-empty { width: 100%; min-width: 0; margin-bottom: var(--ui-gap); padding: var(--ui-pad-lg); text-align: center; background: var(--jf-glass); border: 1px solid var(--jf-glass-border); border-radius: var(--ui-r-lg); box-shadow: var(--ui-shadow); }
html body.jg-offline .jo-empty-txt { margin: 0 0 var(--ui-gap); font-size: var(--ui-fs-sm); color: var(--ui-muted); line-height: var(--jo-lh-loose); }
html body.jg-offline .jo-empty-btn { text-decoration: none; min-height: 48px; }
html body.jg-offline .jo-more, html body.jg-offline .jo-clear { display: block; width: 100%; min-height: 48px; margin: var(--ui-gap) 0 0; }
html body.jg-offline .jo-dialog { position: fixed; left: 0; top: 0; right: 0; bottom: 0; z-index: var(--jo-z-sheet); align-items: center; justify-content: center; padding: var(--ui-gap); box-sizing: border-box; background: var(--ui-scrim-40); }
html body.jg-offline .jo-dialog-box { width: 100%; max-width: 360px; box-sizing: border-box; padding: var(--ui-pad-lg); background: var(--ui-surface-solid); border: 1px solid var(--jf-glass-border); border-radius: var(--ui-r-lg); }
html body.jg-offline .jo-dialog-txt { margin: 0 0 var(--ui-gap); text-align: center; font-size: var(--ui-fs-md); color: var(--ui-text); line-height: var(--jo-lh-loose); }
html body.jg-offline .jo-dialog-btns { display: flex; gap: var(--ui-gap-sm); }
html body.jg-offline .jo-dialog-btns .jx-btn { flex: 1 1 0; min-width: 0; min-height: 48px; }
html body #result-modal .jfx-res-icon { display: flex; align-items: center; justify-content: center; width: 88px; height: 88px; margin: 0 auto var(--ui-gap); border-radius: 50%; font-size: 44px; line-height: 1; background: var(--jf-glass-strong); border: 1px solid var(--ui-glass-edge); box-shadow: var(--ui-shadow); }
html body #result-modal.jfx-win .jfx-res-icon { background: var(--ui-grad-btn); border-color: transparent; box-shadow: var(--ui-accent-shadow); animation: jo-res-pop 0.45s ease-out both; }
@keyframes jo-res-pop { 0% { transform: scale(0.6); } 70% { transform: scale(1.08); } 100% { transform: scale(1); } }
html body .jo-res-stats { display: flex; flex-wrap: wrap; justify-content: center; gap: var(--ui-gap-sm); margin-top: var(--ui-gap); }
html body .jo-res-stats:empty { display: none; }
html body .jo-res-chip { display: inline-flex; align-items: baseline; gap: var(--ui-s1); padding: var(--ui-s1) var(--ui-gap); border-radius: var(--ui-r-pill); background: var(--jf-glass-strong); border: 1px solid var(--ui-glass-edge); font-size: var(--ui-fs-sm); font-variant-numeric: tabular-nums; }
html body .jo-res-lbl { color: var(--ui-muted); font-weight: 600; letter-spacing: var(--jo-track); }
html body .jo-res-val { color: var(--ui-text); font-weight: 700; font-family: var(--ui-font-display); font-variant-numeric: tabular-nums; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (prefers-reduced-motion: reduce) { html body #result-modal.jfx-win .jfx-res-icon { animation: none; } }
/* Card shell: radius --ui-r-lg, padding --ui-pad-lg, glass bg + border, --ui-shadow, margin-bottom --ui-gap, full width. Used by .jo-gcard, .jo-set-card, .jo-row, .jo-stat, .jo-sgame, .jo-empty. */
html body .jo-set-card { width: 100%; min-width: 0; box-sizing: border-box; padding: var(--ui-pad-lg); margin-bottom: var(--ui-gap); background: var(--jf-glass); border: 1px solid var(--jf-glass-border); border-radius: var(--ui-r-lg); box-shadow: var(--ui-shadow); }
html body .jo-set-row { display: flex; align-items: center; justify-content: space-between; gap: var(--ui-gap); min-height: 56px; }
html body .jo-set-text { min-width: 0; flex: 1 1 auto; }
html body .jo-set-label { font-family: var(--ui-font-display); font-size: var(--ui-fs-md); font-weight: 700; color: var(--ui-text); line-height: var(--jo-lh); }
html body .jo-set-sub { font-size: var(--ui-fs-sm); color: var(--ui-muted); line-height: var(--jo-lh-loose); }
html body .jo-switch { position: relative; flex: none; width: 52px; height: 30px; margin: 7px 0; padding: 0; box-sizing: border-box; border-radius: var(--ui-r-pill); background: var(--jf-glass-strong); border: 1px solid var(--ui-glass-edge); cursor: pointer; transition: background var(--jo-dur) var(--jo-ease-out), border-color var(--jo-dur) var(--jo-ease-out); -webkit-tap-highlight-color: transparent; }
html body .jo-switch::before { content: ''; position: absolute; top: 2px; left: 2px; width: 24px; height: 24px; border-radius: 50%; background: var(--ui-surface-solid); box-shadow: var(--ui-shadow); transform-origin: left center; transition: transform var(--jo-dur) var(--jo-ease-out); }
html body .jo-switch::after { content: ''; position: absolute; top: -8px; right: -4px; bottom: -8px; left: -4px; }
html body .jo-switch--on { background: var(--ui-grad-btn); border-color: transparent; }
html body .jo-switch--on::before { transform: translateX(22px); transform-origin: right center; }
html body .jo-switch:focus-visible { outline: 2px solid var(--ui-focus, var(--ui-accent)); outline-offset: 2px; }
html body .jo-switch[disabled] { opacity: 0.5; cursor: default; }
@media (prefers-reduced-motion: reduce) { html body .jo-switch, html body .jo-switch::before { transition: none; } }
/* setup screens: labels, segmented side/player control, sticky action bar */
html body.jg-tictactoe #screen-setup .jo-setup-label, html body.jg-barah #screen-setup .jo-setup-label, html body.jg-ludo #screen-setup .jo-setup-label { margin: var(--ui-gap) 0 var(--ui-gap-sm); font-size: var(--ui-fs-sm); font-weight: 700; color: var(--ui-muted); letter-spacing: var(--jo-track); }
html body.jg-tictactoe #screen-setup .jo-side, html body.jg-barah #screen-setup .jo-side, html body.jg-ludo #screen-setup .jo-side { display: flex; flex-wrap: nowrap; gap: 0; margin: 0 0 var(--ui-gap); overflow: hidden; border: 1px solid var(--ui-glass-edge); border-radius: var(--ui-r-pill); background: var(--jf-glass-strong); }
html body.jg-tictactoe #screen-setup .jo-side .jx-chip, html body.jg-barah #screen-setup .jo-side .jx-chip, html body.jg-ludo #screen-setup .jo-side .jx-chip { flex: 1 1 0; min-width: 0; min-height: var(--jo-tap); margin: 0; padding: 0 var(--ui-gap-sm); box-sizing: border-box; border: 0; border-radius: 0; background: transparent; font-size: var(--ui-fs-sm); line-height: 1.2; text-align: center; white-space: normal; overflow-wrap: anywhere; }
html body.jg-tictactoe #screen-setup .jo-side .jx-chip.active, html body.jg-barah #screen-setup .jo-side .jx-chip.active, html body.jg-ludo #screen-setup .jo-side .jx-chip.active { background: var(--ui-grad-btn); color: var(--ui-on-accent); }
html body.jg-tictactoe #screen-setup .jo-setup-actions, html body.jg-barah #screen-setup .jo-setup-actions, html body.jg-ludo #screen-setup .jo-setup-actions { position: sticky; bottom: calc(92px + var(--jo-safe-bottom, env(safe-area-inset-bottom, 0px))); z-index: var(--jo-z-actions); display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--ui-gap-sm); margin-top: var(--ui-gap); padding: var(--ui-gap-sm); box-sizing: border-box; background: var(--jf-nav-bg); border-top: 1px solid var(--jf-nav-border); border-radius: var(--ui-r-md); -webkit-backdrop-filter: var(--jf-blur); backdrop-filter: var(--jf-blur); }
html body.jg-tictactoe #screen-setup .jo-setup-actions .jo-setup-btn, html body.jg-barah #screen-setup .jo-setup-actions .jo-setup-btn, html body.jg-ludo #screen-setup .jo-setup-actions .jo-setup-btn { width: 100%; min-width: 0; margin: 0; }
html body.jg-ludo #screen-setup .jo-setup-actions { grid-template-columns: repeat(2, minmax(0, 1fr)); }
html body.jg-ludo #screen-setup .jo-setup-actions #btn-start { grid-column: 1 / -1; }
html body.jg-ludo #screen-setup .jl-seat { min-height: var(--jo-tap); }
html body.jg-ludo #screen-setup .jl-seats { margin-bottom: 0; }
/* turn banner states (Tic Tac Toe + Barah Tehni) */
html body .jm-bar { transition: border-color var(--ui-ease), box-shadow var(--ui-ease), background var(--ui-ease); }
html body .jm-bar--you { border-color: var(--ui-accent); box-shadow: var(--ui-accent-shadow); }
html body .jm-bar--you #turn-text { color: var(--ui-accent-text); font-weight: 700; }
html body .jm-bar--think #turn-text { color: var(--ui-muted); }
html body .jm-bar--think #turn-text::after { content: '...'; display: inline-block; overflow: hidden; width: 0; vertical-align: bottom; animation: jo-dots 1.2s steps(4, end) infinite; }
@keyframes jo-dots { to { width: 1.2em; } }
html body .jm-bar--friend { background: var(--jf-glass-strong); }
html body .jm-bar--friend #turn-text { color: var(--ui-text); }
html body .jm-bar--over { box-shadow: var(--ui-shadow); }
html body .jo-turn-pop { animation: jo-turn-pop 0.25s ease-out; }
@keyframes jo-turn-pop { 0% { transform: scale(0.96); } 50% { transform: scale(1.04); } 100% { transform: scale(1); } }
@media (prefers-reduced-motion: reduce) { html body .jm-bar { transition: none; } html body .jo-turn-pop { animation: none; } html body .jm-bar--think #turn-text::after { animation: none; width: 1.2em; } }
/* Ludo turn chips + dice hint (turn banner reuses the .jm-bar--* rules above) */
html body.jg-ludo .jl-chip { opacity: 0.85; transition: transform var(--ui-ease), box-shadow var(--ui-ease), border-color var(--ui-ease), opacity var(--ui-ease); }
html body.jg-ludo .jl-chip--turn { opacity: 1; transform: scale(1.03); border-color: var(--ui-accent); box-shadow: 0 0 0 2px var(--ld-hl, var(--ui-accent)), var(--ui-accent-shadow); }
html body.jg-ludo .jl-chip--turn .jl-dot { box-shadow: 0 0 0 2px var(--ui-surface-solid); }
html body.jg-ludo #screen-match #dice-box[aria-disabled="false"]:not(.rolling):not(.landed) { animation: jo-dice-pulse 1.4s ease-in-out infinite; }
@keyframes jo-dice-pulse { 0%, 100% { box-shadow: 0 0 0 2px var(--ld-hl-gap, transparent), 0 0 0 5px var(--ld-hl, var(--ui-accent)), var(--ui-accent-shadow); } 50% { box-shadow: 0 0 0 2px var(--ld-hl-gap, transparent), 0 0 0 8px var(--ld-hl, var(--ui-accent)), var(--ui-accent-shadow); } }
@media (prefers-reduced-motion: reduce) { html body.jg-ludo .jl-chip { transition: none; } html body.jg-ludo .jl-chip--turn { transform: none; } html body.jg-ludo #screen-match #dice-box[aria-disabled="false"] { animation: none; } }
/* history detail sheet */
html body .jo-dsheet { display: none; position: fixed; left: 0; top: 0; right: 0; bottom: 0; z-index: var(--jo-z-dsheet); align-items: flex-end; justify-content: center; background: var(--ui-scrim-40); }
html body .jo-dsheet-panel { width: 100%; max-width: 520px; max-height: 80%; overflow-y: auto; box-sizing: border-box; padding: var(--ui-pad-lg) var(--ui-pad-lg) calc(var(--ui-pad-lg) + var(--jo-safe-bottom, env(safe-area-inset-bottom, 0px))); background: var(--ui-surface-solid); border: 1px solid var(--jf-glass-border); border-radius: var(--ui-r-lg) var(--ui-r-lg) 0 0; transform: translateY(100%); transition: transform var(--jo-dur) var(--jo-ease-out); }
html body .jo-dsheet--open .jo-dsheet-panel { transform: none; }
html body .jo-dsheet-head { display: flex; align-items: center; justify-content: space-between; gap: var(--ui-gap-sm); margin: 0 0 var(--ui-gap-sm); }
html body .jo-dsheet-title { min-width: 0; font-family: var(--ui-font-display); font-size: var(--ui-fs-lg); font-weight: 700; color: var(--ui-text); overflow-wrap: anywhere; line-height: var(--jo-lh-tight); }
html body .jo-dsheet-x { flex: none; width: var(--jo-tap); height: var(--jo-tap); padding: 0; border: 0; border-radius: 50%; background: transparent; color: var(--ui-muted); font-size: var(--ui-fs-xl); line-height: 1; cursor: pointer; -webkit-tap-highlight-color: transparent; }
html body .jo-dsheet-x:focus-visible { outline: 2px solid var(--ui-focus, var(--ui-accent)); outline-offset: 2px; }
html body .jo-dsheet-line { display: flex; justify-content: space-between; gap: var(--ui-gap); padding: var(--ui-s1) 0; font-size: var(--ui-fs-sm); }
html body .jo-dsheet-lbl { flex: none; color: var(--ui-muted); font-weight: 600; letter-spacing: var(--jo-track); }
html body .jo-dsheet-val { min-width: 0; text-align: right; color: var(--ui-text); font-weight: 600; overflow-wrap: anywhere; font-variant-numeric: tabular-nums; }
html body .jo-dsheet-sub { margin: var(--ui-gap-sm) 0 var(--ui-s1); font-size: var(--ui-fs-sm); font-weight: 700; color: var(--ui-muted); letter-spacing: var(--jo-track); }
html body .jo-dsheet-player { padding: var(--ui-s1) 0; font-size: var(--ui-fs-sm); color: var(--ui-text); overflow-wrap: anywhere; }
html body .jo-dsheet-btn { display: flex; align-items: center; justify-content: center; width: 100%; min-height: 48px; margin-top: var(--ui-gap); box-sizing: border-box; text-decoration: none; }
html body.jg-offline .jo-row[role="button"] { min-height: var(--jo-tap); cursor: pointer; -webkit-tap-highlight-color: transparent; }
html body.jg-offline .jo-row[role="button"]:active { transform: scale(0.97); }
html body.jg-offline .jo-row[role="button"]:focus-visible { outline: 2px solid var(--ui-focus, var(--ui-accent)); outline-offset: 2px; }
@media (prefers-reduced-motion: reduce) { html body .jo-dsheet-panel { transition: none; } }
/* skeleton placeholders + illustrated empty state */
html body.jg-offline .jo-empty { max-width: 100%; box-sizing: border-box; }
html body.jg-offline .jo-empty-art { display: block; width: 72px; height: 72px; margin: 0 auto var(--ui-gap-sm); color: var(--ui-accent-text); }
html body.jg-offline .jo-empty-title { margin: 0 0 var(--ui-s1); font-family: var(--ui-font-display); font-size: var(--ui-fs-lg); font-weight: 700; color: var(--ui-text); line-height: var(--jo-lh-tight); }
html body.jg-offline .jo-empty-btn { display: inline-flex; align-items: center; justify-content: center; max-width: 100%; box-sizing: border-box; }
html body.jg-offline .jo-skel { position: relative; overflow: hidden; margin-bottom: var(--ui-gap-sm); background: var(--jf-glass-strong); border: 1px solid var(--ui-glass-edge); border-radius: var(--ui-r-lg); }
html body.jg-offline .jo-skel--row { height: 72px; }
html body.jg-offline .jo-skel--stat { height: 64px; margin-bottom: 0; }
html body.jg-offline .jo-skel::after { content: ''; position: absolute; top: 0; right: 0; bottom: 0; left: 0; background: linear-gradient(90deg, transparent, var(--jf-glass), transparent); transform: translateX(-100%); animation: jo-skel 1.2s linear infinite; }
@keyframes jo-skel { to { transform: translateX(100%); } }
@media (prefers-reduced-motion: reduce) { html body.jg-offline .jo-skel::after { animation: none; display: none; } }
/* Step 8: page transitions and micro-animations (no transform stays on any element after the animation) */
html body.jg-offline .jo-wrap > *:not(#jo-topbar) { animation: jo-enter 0.22s ease-out backwards; }
html body.jg-offline .jo-wrap > :nth-child(2):not(#jo-topbar) { animation-delay: 0ms; }
html body.jg-offline .jo-wrap > :nth-child(3):not(#jo-topbar) { animation-delay: 30ms; }
html body.jg-offline .jo-wrap > :nth-child(4):not(#jo-topbar) { animation-delay: 60ms; }
html body.jg-offline .jo-wrap > :nth-child(5):not(#jo-topbar) { animation-delay: 90ms; }
html body.jg-offline .jo-wrap > :nth-child(6):not(#jo-topbar) { animation-delay: 120ms; }
@keyframes jo-enter { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
html body.jg-tictactoe #screen-setup, html body.jg-tictactoe #screen-match, html body.jg-barah #screen-setup, html body.jg-barah #screen-match, html body.jg-ludo #screen-setup, html body.jg-ludo #screen-match { animation: jo-fade 0.18s ease-out; }
@keyframes jo-fade { from { opacity: 0; } to { opacity: 1; } }
html body .jx-btn:active, html body .jx-chip:active, html body .jo-tab:active { transform: scale(0.97); }
html body .jo-tab { transition: transform var(--jo-dur-fast) var(--jo-ease-out), color var(--jo-dur) var(--jo-ease-out); }
html body .jo-tab--active .jo-tab-ico svg { animation: jo-tab-pop var(--jo-dur-slow) var(--jo-ease-out); }
@keyframes jo-tab-pop { 0% { transform: scale(0.85); } 60% { transform: scale(1.08); } 100% { transform: scale(1); } }
html body.jg-offline .jo-row:nth-child(-n+6) { animation: jo-fade 0.18s ease-out backwards; }
html body.jg-offline .jo-row:nth-child(1) { animation-delay: 0ms; }
html body.jg-offline .jo-row:nth-child(2) { animation-delay: 20ms; }
html body.jg-offline .jo-row:nth-child(3) { animation-delay: 40ms; }
html body.jg-offline .jo-row:nth-child(4) { animation-delay: 60ms; }
html body.jg-offline .jo-row:nth-child(5) { animation-delay: 80ms; }
html body.jg-offline .jo-row:nth-child(6) { animation-delay: 100ms; }
html body .jo-dialog-box { animation: jo-modal-in var(--jo-dur-slow) var(--jo-ease-out) both; }
@keyframes jo-pop-in { from { opacity: 0; transform: translateY(8px) scale(0.98); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { html body.jg-offline .jo-wrap > *:not(#jo-topbar), html body.jg-tictactoe #screen-setup, html body.jg-tictactoe #screen-match, html body.jg-barah #screen-setup, html body.jg-barah #screen-match, html body.jg-ludo #screen-setup, html body.jg-ludo #screen-match, html body .jo-tab--active .jo-tab-ico svg, html body.jg-offline .jo-row:nth-child(-n+6), html body .jo-dialog-box { animation: none; } html body .jo-tab, html body .jx-btn, html body .jx-chip { transition: none; } }
/* Step 9: accessibility and small-screen polish */
html body .jo-sr-only { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
html body .jx-chip { min-height: var(--jo-tap); }
html body .jm-gear { position: relative; }
html body .jm-gear::after { content: ''; position: absolute; top: -5px; right: -5px; bottom: -5px; left: -5px; }
html body .jfx-mute::after { top: -4px; right: -4px; bottom: -4px; left: -4px; }
html body .jm-settings-x { width: var(--jo-tap); height: var(--jo-tap); }
html body .jm-set-ctl .jx-switch::after { content: ''; position: absolute; top: -10px; right: -2px; bottom: -10px; left: -2px; }
html body :is(.close-modal, .jm-gear, .jfx-mute, .jm-settings-x, .jo-see-all, .ld-dice):focus-visible { outline: 2px solid var(--ui-focus, var(--ui-accent)); outline-offset: 2px; }
html body.jg-offline :is(.jo-row-game, .jo-row-win, .jo-row-meta, .jo-stat-val) { overflow-wrap: anywhere; }
html body .jo-res-chip { max-width: 100%; min-width: 0; box-sizing: border-box; }
html body .jo-res-val { min-width: 0; overflow-wrap: anywhere; }
html body #result-modal :is(.jfx-res-title, .jfx-res-note, .jfx-res-reason) { overflow-wrap: anywhere; }
@media (max-width: 340px) {
  html body.jg-tictactoe #screen-setup .jo-setup-btn, html body.jg-barah #screen-setup .jo-setup-btn, html body.jg-ludo #screen-setup .jo-setup-btn { padding: 0 var(--ui-gap-sm); font-size: var(--ui-fs-sm); line-height: 1.2; }
  html body #set-clear { flex: none; padding: 0 var(--ui-pad-md); }
}

/* Game Pack: three-chip Bot level row (one row of equal width, also at 320 px) */
html body #screen-setup .jo-side.jo-side--3 .jx-chip { flex: 1 1 0; min-width: 0; padding: 0 var(--ui-s1); }

/* Game Pack: Player names card (Settings) */
html body .jo-name-row { display: flex; flex-direction: column; gap: var(--ui-s1); margin-top: var(--ui-gap-sm); min-width: 0; }
html body .jo-input { display: block; width: 100%; min-width: 0; height: var(--jo-tap); box-sizing: border-box; padding: 0 var(--ui-gap); font-family: inherit; font-size: var(--ui-fs-md); color: var(--ui-text); background: var(--jf-glass-strong); border: 1px solid var(--ui-glass-edge); border-radius: var(--ui-r-md); }
html body .jo-input::placeholder { color: var(--ui-muted); }
html body .jo-input:focus-visible { outline: 2px solid var(--ui-focus, var(--ui-accent)); outline-offset: 2px; }
html body .jo-name-btns { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--ui-gap-sm); margin-top: var(--ui-gap); }
html body .jo-name-btns .jx-btn { min-width: 0; min-height: var(--jo-tap); }
html body.jg-tictactoe #match-info .jm-bar-val, html body.jg-barah #match-info .jm-bar-val { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Game Pack: Stats page + link on History */
html body.jg-offline #btn-stats { gap: var(--ui-s1); margin: 0 0 var(--ui-gap-sm); }
html body.jg-offline .jo-snote { margin: 0 0 var(--ui-gap-sm); font-size: var(--ui-fs-sm); color: var(--ui-muted); line-height: var(--jo-lh-loose); }
html body.jg-offline .jo-sgame { width: 100%; min-width: 0; padding: var(--ui-pad-lg); margin-bottom: var(--ui-gap); box-sizing: border-box; background: var(--jf-glass); border: 1px solid var(--jf-glass-border); border-radius: var(--ui-r-lg); box-shadow: var(--ui-shadow); }
html body.jg-offline .jo-sgame-head { display: flex; align-items: center; gap: var(--ui-gap-sm); margin-bottom: var(--ui-gap-sm); min-width: 0; }
html body.jg-offline .jo-sgame-name { min-width: 0; font-family: var(--ui-font-display); font-size: var(--ui-fs-md); font-weight: 700; color: var(--ui-text); overflow-wrap: anywhere; line-height: var(--jo-lh); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
html body.jg-offline .jo-sgame-dot { flex: none; width: 14px; height: 14px; border-radius: 50%; }
html body.jg-offline .jo-sgame-dot--ludo { background: linear-gradient(135deg, var(--accent-orange), var(--ui-warn-deep)); }
html body.jg-offline .jo-sgame-dot--ttt { background: linear-gradient(135deg, var(--primary-color), var(--primary-dark)); }
html body.jg-offline .jo-sgame-dot--barah { background: linear-gradient(135deg, var(--accent-blue), var(--ui-info-deep)); }
html body.jg-offline .jo-sline { display: flex; align-items: baseline; justify-content: space-between; gap: var(--ui-gap-sm); min-height: 28px; font-size: var(--ui-fs-sm); line-height: var(--jo-lh); }
html body.jg-offline .jo-sline-lbl { min-width: 0; color: var(--ui-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
html body.jg-offline .jo-sline-val { flex: none; font-weight: 700; color: var(--ui-text); font-family: var(--ui-font-display); font-variant-numeric: tabular-nums; }
html body.jg-offline .jo-bar { height: 8px; margin: 2px 0 var(--ui-gap-sm); overflow: hidden; border-radius: var(--ui-r-pill); background: var(--jf-glass-strong); border: 1px solid var(--ui-glass-edge); }
html body.jg-offline .jo-bar-fill { display: block; height: 100%; border-radius: var(--ui-r-pill); background: var(--ui-grad-btn); }
html body.jg-offline .jo-sgame-note { margin-top: var(--ui-gap-sm); font-size: var(--ui-fs-sm); color: var(--ui-muted); line-height: var(--jo-lh-loose); }

/* Game Pack: Undo button in the match bar */
html body .jo-undo { position: relative; width: var(--jo-tap); height: var(--jo-tap); margin-right: var(--ui-s1); }
html body .jo-undo-n { position: absolute; top: -3px; right: -3px; min-width: 16px; height: 16px; padding: 0 3px; box-sizing: border-box; border-radius: var(--ui-r-pill); background: var(--ui-grad-btn); color: var(--ui-on-accent); font-size: var(--jo-fs-2xs); font-weight: 700; line-height: 16px; text-align: center; pointer-events: none; font-variant-numeric: tabular-nums; }
html body .jo-undo:disabled { opacity: 0.4; pointer-events: none; }

/* Game Pack: Discard link in the Home hero */
html body.jg-offline .jo-hero-link { display: inline-flex; align-items: center; min-height: var(--jo-tap); margin: var(--ui-gap-sm) 0 0 var(--ui-gap-sm); padding: 0 var(--ui-s1); font-size: var(--ui-fs-sm); font-weight: 700; color: inherit; text-decoration: none; }
html body.jg-offline .jo-hero-link[hidden] { display: none; }
html body.jg-offline .jo-hero-link:focus-visible { outline: 2px solid var(--ui-focus, var(--ui-accent)); outline-offset: 2px; }

/* Step 3: icon set, illustrations, logo in the top bar */
.jo-ico { width: var(--jo-ico); height: var(--jo-ico); display: block; flex: none; }
.jo-ico--sm { width: var(--jo-ico-sm); height: var(--jo-ico-sm); }
.jo-ico--lg { width: 40px; height: 40px; }
html body.jg-offline .jo-gicon .jo-ico--lg { width: 40px; height: 40px; }
html body.jg-offline .jo-illus { display: block; width: 96px; height: 96px; max-width: 100%; margin: 0 auto var(--ui-gap-sm); }
.jo-logo-img { width: 40px; height: 40px; margin-left: var(--ui-gap-sm); display: block; flex: none; }

/* Step 4: micro-interactions (transform / opacity / colour only; all off under prefers-reduced-motion) */
html body.jg-ui.jg-ui :is(.jx-btn, .modal-btn, .jo-online) { transition: transform var(--jo-dur-fast) var(--jo-ease-out), background-color var(--ui-ease), border-color var(--ui-ease), color var(--ui-ease), box-shadow var(--ui-ease), opacity var(--ui-ease); }
html body .modal-btn:active { transform: scale(0.97); }
html body.jg-offline .jo-row[role="button"] { transition: transform var(--jo-dur-fast) var(--jo-ease-out); }
html body .jo-switch:active::before { transform: scaleX(1.12); }
html body .jo-switch--on:active::before { transform: translateX(22px) scaleX(1.12); }
html body .jo-tab-ico { transition: background-color var(--jo-dur) var(--jo-ease-out), color var(--jo-dur) var(--jo-ease-out); }
html body .jo-tab--active .jo-tab-ico { animation: jo-pill-in var(--jo-dur) var(--jo-ease-out) both; }
@keyframes jo-pill-in { from { opacity: 0.4; transform: scale(0.8); } to { opacity: 1; transform: scale(1); } }
html body.jg-offline .jo-games > .jo-gcard, html body.jg-offline #jo-recent .jo-row, html body.jg-offline #jo-list .jo-row { animation: jo-enter var(--jo-dur-slow) var(--jo-ease-out) backwards; animation-delay: calc(var(--i, 0) * 40ms); }
html body .modal { animation: jo-scrim-in var(--jo-dur) var(--jo-ease-out) both; }
html body .modal-content { animation: jo-modal-in var(--jo-dur-slow) var(--jo-ease-out) both; }
html body.jg-offline .jo-dialog { animation: jo-scrim-in var(--jo-dur) var(--jo-ease-out) both; }
html body .jo-dsheet--open { animation: jo-scrim-in var(--jo-dur) var(--jo-ease-out) both; }
@keyframes jo-scrim-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes jo-modal-in { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) {
  html body.jg-ui.jg-ui :is(.jx-btn, .modal-btn, .jo-online), html body.jg-offline .jo-row[role="button"], html body .jo-tab-ico, html body .jo-tab, html body .jo-toast, html body .jo-switch::before, html body.jg-offline .jo-gcard { transition: none; }
  html body .jo-switch:active::before { transform: none; }
  html body .jo-switch--on:active::before { transform: translateX(22px); }
  html body .jo-tab--active .jo-tab-ico, html body.jg-offline .jo-games > .jo-gcard, html body.jg-offline #jo-recent .jo-row, html body.jg-offline #jo-list .jo-row, html body .modal, html body .modal-content, html body.jg-offline .jo-dialog, html body.jg-offline .jo-dialog-box, html body .jo-dsheet--open { animation: none; }
}

/* Step 5: Ludo dice tumble (transform only; off under prefers-reduced-motion) */
@keyframes jo-dice-tumble { 0% { transform: rotate(0) translateY(0) scale(1); } 30% { transform: rotate(120deg) translateY(-8px) scale(1.1); } 60% { transform: rotate(250deg) translateY(0) scale(1.05); } 100% { transform: rotate(360deg) translateY(0) scale(1); } }
@keyframes jo-dice-land { 0% { transform: scale(1.18); } 100% { transform: scale(1); } }
html body.jg-ludo .ld-dice.jo-dice-roll { animation: jo-dice-tumble var(--jo-dur-slow) linear infinite; will-change: transform; }
html body.jg-ludo .ld-dice.jo-dice-land { animation: jo-dice-land var(--jo-dur) var(--jo-ease-out) both; }
@media (prefers-reduced-motion: reduce) { html body.jg-ludo .ld-dice.jo-dice-roll, html body.jg-ludo .ld-dice.jo-dice-land { animation: none; will-change: auto; } }

/* Step 6: result screen polish + Share button */
html body #result-modal .jfx-res-icon { color: var(--ui-muted); }
html body #result-modal.jfx-win .jfx-res-icon { color: var(--ui-on-accent); }
html body #result-modal .jfx-res-icon .jo-ico { margin: 0 auto; }
html body #result-modal.jfx-win .jfx-res-title { font-family: var(--ui-font-display); font-size: var(--ui-fs-xl); line-height: var(--jo-lh-tight); }
html body #result-modal.jfx-loss .jfx-res-title { color: var(--ui-muted); }
html body #res-share { align-items: center; justify-content: center; gap: var(--ui-s2); }
@media (max-width: 359px) { html body #result-modal .jfx-res-footer { flex-direction: column; } }

/* Step 7: Settings premium (section headers, row icons, dividers, About, What's new) */
html body .jo-set-head { margin: var(--ui-section-gap) 0 var(--ui-gap-sm); padding: 0 0 0 var(--ui-s1); font-size: var(--ui-fs-xs); font-weight: 700; line-height: var(--jo-lh); text-transform: uppercase; letter-spacing: var(--jo-track); color: var(--ui-muted); }
html body .jo-set-row + .jo-set-row { border-top: 1px solid var(--ui-border); }
html body .jo-set-ico { display: inline-flex; align-items: center; justify-content: center; flex: none; width: 36px; height: 36px; border-radius: 50%; background: var(--jf-glass-strong); color: var(--ui-accent-text); }
html body .jo-about { text-align: center; }
html body .jo-about-logo { display: block; width: 56px; height: 56px; margin: 0 auto var(--ui-gap-sm); }
html body .jo-about-title { font-family: var(--ui-font-display); font-size: var(--ui-fs-lg); font-weight: 700; line-height: var(--jo-lh-tight); color: var(--ui-text); }
html body .jo-about-txt { margin-top: var(--ui-s1); line-height: var(--jo-lh-loose); }
html body .jo-update-btn { margin-top: var(--ui-gap); min-height: var(--jo-tap); }
html body .jo-update-btn[hidden], html body .jo-update-status[hidden] { display: none; }
html body .jo-update-status { margin-top: var(--ui-gap-sm); text-align: center; }
html body .jo-about .jo-update-btn { align-self: center; }
html body .jo-whatsnew { margin-top: var(--ui-gap); border-top: 1px solid var(--ui-border); text-align: left; }
html body .jo-whatsnew summary { display: flex; align-items: center; gap: var(--ui-gap-sm); min-height: var(--jo-tap); list-style: none; cursor: pointer; font-family: var(--ui-font-display); font-size: var(--ui-fs-md); font-weight: 700; color: var(--ui-text); -webkit-tap-highlight-color: transparent; }
html body .jo-whatsnew summary::-webkit-details-marker { display: none; }
html body .jo-whatsnew summary::after { content: ''; flex: none; width: 8px; height: 8px; margin-left: auto; margin-right: var(--ui-s1); border-right: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: rotate(-45deg); transition: transform var(--jo-dur) var(--jo-ease-out); }
html body .jo-whatsnew[open] summary::after { transform: rotate(45deg); }
html body .jo-whatsnew summary:focus-visible { outline: 2px solid var(--ui-focus, var(--ui-accent)); outline-offset: 2px; }
html body .jo-whatsnew ul { margin: 0; padding: 0 0 var(--ui-s2) var(--ui-s5); }
html body .jo-whatsnew li { font-size: var(--ui-fs-sm); line-height: var(--jo-lh); color: var(--ui-muted); }
@media (prefers-reduced-motion: reduce) { html body .jo-whatsnew summary::after { transition: none; } }

/* Cards + Update Pack step 3: selectable setup cards (style through .jo-side--cards, the scripts rewrite the chip className) */
html body #screen-setup .jo-side.jo-side--cards { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--ui-gap-sm); overflow: visible; border: 0; border-radius: 0; background: transparent; }
html body #screen-setup .jo-side.jo-side--cards.jo-side--3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
html body #screen-setup .jo-side.jo-side--cards .jx-chip { display: grid; grid-template-columns: auto minmax(0, 1fr); column-gap: var(--ui-gap-sm); align-items: center; text-align: left; min-height: 64px; margin: 0; padding: var(--ui-gap-sm) var(--ui-pad-md); box-sizing: border-box; position: relative; border: 2px solid transparent; border-radius: var(--ui-r-md); background: var(--jf-glass); color: var(--ui-text); white-space: normal; }
html body #screen-setup .jo-side.jo-side--cards .jx-chip.active { border-color: var(--ui-accent); background: var(--jf-glass-strong); color: var(--ui-text); }
html body #screen-setup .jo-side.jo-side--cards .jx-chip.active::after { content: '\2713'; position: absolute; top: 6px; right: 6px; width: 20px; height: 20px; border-radius: var(--ui-r-pill); background: var(--ui-accent); color: var(--ui-on-accent); font-size: var(--ui-fs-xs); font-weight: 700; line-height: 20px; text-align: center; }
html body #screen-setup .jo-side--cards .jo-opt-ico { grid-row: 1 / span 2; display: inline-flex; align-items: center; justify-content: center; width: 24px; height: 24px; color: var(--ui-accent-text); }
html body #screen-setup .jo-side--cards .jo-opt-ico svg { width: 24px; height: 24px; display: block; }
html body #screen-setup .jo-side--cards .jo-opt-t { grid-column: 2; padding-right: var(--ui-gap); font-family: var(--ui-font-display); font-size: var(--ui-fs-md); font-weight: 700; line-height: var(--jo-lh-tight); }
html body #screen-setup .jo-side--cards .jo-opt-d { grid-column: 2; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; font-size: var(--ui-fs-xs); color: var(--ui-muted); line-height: var(--jo-lh); }
@media (max-width: 419px) {
  html body #screen-setup .jo-side.jo-side--cards.jo-side--3 .jx-chip { grid-template-columns: minmax(0, 1fr); justify-items: center; text-align: center; padding: var(--ui-gap-sm); row-gap: 2px; }
  html body #screen-setup .jo-side.jo-side--cards.jo-side--3 .jo-opt-ico { grid-row: auto; }
  html body #screen-setup .jo-side.jo-side--cards.jo-side--3 .jo-opt-t, html body #screen-setup .jo-side.jo-side--cards.jo-side--3 .jo-opt-d { grid-column: 1; padding-right: 0; }
  html body #screen-setup .jo-side.jo-side--cards.jo-side--3 .jo-opt-t { font-size: var(--ui-fs-sm); }
}
/* Full-bleed cards: like the top bar and the tab bar, every card spans the whole screen width (the body side padding is cancelled with negative margins; the content keeps its own padding). Not for the game boards or the match screens. */
html body.jg-offline :is(.jo-hero, .jo-gcard, .jo-row, .jo-stat, .jo-sgame, .jo-empty, .jo-skel), html body .jo-set-card { width: auto; max-width: none; margin-left: calc(-1 * var(--ui-page-x)); margin-right: calc(-1 * var(--ui-page-x)); border-left-width: 0; border-right-width: 0; border-radius: 0; }

/* ===== Floating Pill nav: top bar pill + bottom pill (same size, same fixed mechanism) =====
   Appended last on purpose: same selectors as the rules above, so these win.
   The top host only reserves the space; the pill itself is fixed, exactly like .jo-tabbar. */
html body[class] .jo-topbar-host { box-sizing: border-box; height: calc(var(--jo-safe-top, env(safe-area-inset-top, 0px)) + 70px); padding: 0; background: transparent; border-bottom: 0; box-shadow: none; -webkit-backdrop-filter: none; backdrop-filter: none; }
html body[class] .jo-topbar-host.jo-stuck { background: transparent; box-shadow: none; }
html body[class] .jo-topbar { position: fixed; top: calc(10px + var(--jo-safe-top, env(safe-area-inset-top, 0px))); left: 12px; right: 12px; z-index: var(--jo-z-bar); box-sizing: border-box; max-width: 496px; height: 56px; min-height: 56px; margin: 0 auto; padding: 6px; border: 0; border-radius: 28px; background: var(--jf-nav-bg); box-shadow: 0 8px 24px rgba(232, 51, 143, 0.28); -webkit-backdrop-filter: var(--jf-blur); backdrop-filter: var(--jf-blur); }
html body[class] .jo-brand { gap: 6px; }
html body[class] .jo-logo-img { width: 44px; height: 44px; margin-left: 0; }
html body[class] .jo-back-btn { width: 44px; height: 44px; margin-left: 0; }
html body[class] .jo-bar-title { font-size: 18px; }
html body .jo-share { display: inline-flex; align-items: center; justify-content: center; flex: none; width: 44px; height: 44px; margin: 0; padding: 0; border: 0; border-radius: 50%; background: var(--ui-grad-btn); color: var(--ui-on-accent); cursor: pointer; box-shadow: 0 2px 8px rgba(232, 51, 143, 0.3); -webkit-tap-highlight-color: transparent; }
html body .jo-share:active { transform: scale(0.95); }
html body .jo-share:focus-visible { outline: 2px solid var(--ui-focus, var(--ui-accent)); outline-offset: 2px; }
html body .jo-tabbar { left: 12px; right: 12px; bottom: calc(10px + var(--jo-safe-bottom, env(safe-area-inset-bottom, 0px))); max-width: 496px; margin: 0 auto; padding: 6px; border: 0; border-radius: 28px; justify-content: space-between; gap: 4px; box-shadow: 0 8px 24px rgba(232, 51, 143, 0.28); }
html body .jo-tab { flex: 0 0 auto; flex-direction: row; gap: 0; max-width: none; min-height: 44px; padding: 0 14px; border-radius: 22px; transition: transform var(--jo-dur-fast) var(--jo-ease-out), background-color var(--jo-dur) var(--jo-ease-out), color var(--jo-dur) var(--jo-ease-out); }
html body .jo-tab-lbl { display: none; }
html body .jo-tab-ico { width: auto; height: auto; border-radius: 0; background: none; }
html body .jo-tab--active { flex: 1 1 auto; justify-content: center; gap: 6px; background: var(--ui-grad-btn); color: var(--ui-on-accent); }
html body .jo-tab--active .jo-tab-lbl { display: inline; }
html body .jo-tab--active .jo-tab-ico { background: none; color: inherit; animation: none; }


/* ===== Home: Soft 3D (neumorphic) cards =====
   Games cards, "Play anywhere" hero, Recent matches rows, empty state, skeleton. Home page only:
   every selector is scoped to .jo-games / .jo-wrap > .jo-hero / #jo-recent, so History, Stats and Settings are untouched.
   Appended last on purpose (same or higher specificity than the rules above, so it wins). */
html body.jg-offline .jo-games > .jo-gcard.jo-gcard--ludo{--c1:#FFA24D;--c2:#F57C00;--ct:#9A4B00;--cg:245,124,0}
html body.jg-offline .jo-games > .jo-gcard.jo-gcard--ttt{--c1:#F54AA6;--c2:#C4006E;--ct:#A3005F;--cg:232,51,143}
html body.jg-offline .jo-games > .jo-gcard.jo-gcard--barah{--c1:#6FA0FF;--c2:#1565C0;--ct:#1F4FA8;--cg:21,101,192}
html body.jg-offline .jo-games > .jo-gcard{margin-left:0;margin-right:0;border-width:1px;border-style:solid;border-radius:22px;border-color:var(--jf-glass-border)}
html body.jg-offline .jo-games{gap:20px}
html body.jg-offline .jo-games > .jo-gcard{--nb:#FFF1F7;min-height:110px;border:0;border-radius:28px;background:var(--nb);box-shadow:9px 9px 20px rgba(214,140,175,.40),-8px -8px 18px rgba(255,255,255,.95);-webkit-backdrop-filter:none;backdrop-filter:none}
html body.jg-offline .jo-games > .jo-gcard:active{transform:scale(.985);box-shadow:inset 6px 6px 14px rgba(214,140,175,.40),inset -6px -6px 14px rgba(255,255,255,.95)}
html body.jg-offline .jo-games > .jo-gcard::before{display:none}
html body.jg-offline .jo-games > .jo-gcard .jo-gicon{width:62px;height:62px;border-radius:50%;background:var(--nb);color:var(--c2);box-shadow:inset 5px 5px 11px rgba(214,140,175,.42),inset -5px -5px 11px rgba(255,255,255,.95)}
html body.jg-offline .jo-games > .jo-gcard .jo-gtitle{font-size:21px}
html body.jg-offline .jo-games > .jo-gcard .jo-gplay{background:var(--nb);color:var(--ct);border:0;padding:9px 20px;font-size:15px;box-shadow:5px 5px 10px rgba(214,140,175,.42),-5px -5px 10px rgba(255,255,255,.95)}
html body.jg-offline .jo-games > .jo-gcard>.jo-gart{color:var(--c1);opacity:.12}
html body.jg-offline .jo-wrap > .jo-hero{--nb:#FFF1F7;margin:0 0 24px;padding:20px;border:0;border-radius:28px;background:var(--nb);color:var(--ui-text);box-shadow:9px 9px 20px rgba(214,140,175,.40),-8px -8px 18px rgba(255,255,255,.95)}
html body.jg-offline .jo-wrap > .jo-hero .jo-hero-title{color:#A3005F}
html body.jg-offline .jo-wrap > .jo-hero .jo-hero-sub{color:var(--ui-muted)}
html body.jg-offline .jo-wrap > .jo-hero .jo-hero-art{display:inline-flex;align-items:center;justify-content:center;width:72px;height:72px;padding:16px;box-sizing:border-box;border-radius:50%;background:var(--nb);color:#C4006E;opacity:1;box-shadow:inset 5px 5px 11px rgba(214,140,175,.42),inset -5px -5px 11px rgba(255,255,255,.95)}
html body.jg-offline .jo-wrap > .jo-hero .jo-hero-btn{background:var(--nb);color:#A3005F;border:0;padding:0 20px;box-shadow:5px 5px 10px rgba(214,140,175,.42),-5px -5px 10px rgba(255,255,255,.95)}
html body.jg-offline .jo-wrap > .jo-hero .jo-hero-btn:active{box-shadow:inset 4px 4px 9px rgba(214,140,175,.42),inset -4px -4px 9px rgba(255,255,255,.95)}
html body.jg-offline .jo-wrap > .jo-hero .jo-hero-link{color:#A3005F}
html body.jg-offline #jo-recent .jo-row,html body.jg-offline #jo-recent .jo-empty,html body.jg-offline #jo-recent .jo-skel{--nb:#FFF1F7;margin-left:0;margin-right:0;margin-bottom:20px;border:0;border-radius:24px;background:var(--nb);box-shadow:8px 8px 18px rgba(214,140,175,.38),-7px -7px 16px rgba(255,255,255,.95);-webkit-backdrop-filter:none;backdrop-filter:none}
html body.jg-offline #jo-recent .jo-row{padding:16px 18px}
html body.jg-offline #jo-recent .jo-row .jo-row-game{color:#A3005F}
html body.jg-offline #jo-recent .jo-row .jo-row-win{color:var(--ui-text)}
html body.jg-offline #jo-recent .jo-skel::after{display:none}
html body.jg-offline #jo-recent .jo-empty{padding:20px}
html body.jg-offline #jo-recent .jo-empty .jo-empty-art{width:80px;height:80px;padding:16px;box-sizing:border-box;border-radius:50%;background:var(--nb);color:#C4006E;box-shadow:inset 5px 5px 11px rgba(214,140,175,.42),inset -5px -5px 11px rgba(255,255,255,.95)}
html body.jg-offline #jo-recent .jo-empty .jo-empty-btn{background:var(--nb);color:#A3005F;border:0;padding:0 24px;box-shadow:5px 5px 10px rgba(214,140,175,.42),-5px -5px 10px rgba(255,255,255,.95)}
html body.jg-offline #jo-recent .jo-empty .jo-empty-btn:active{box-shadow:inset 4px 4px 9px rgba(214,140,175,.42),inset -4px -4px 9px rgba(255,255,255,.95)}

/* ===== Soft 3D (neumorphic): History, Stats, Settings, game setup, match chrome, dialogs, bars =====
   Same look as the Home block above. Appended last on purpose: every selector is equal to or higher than the rule it overrides
   (html body.jg-ui.jg-ui = the same prefix as jfun-ui.css, and #screen-setup / ids where jfun-ui.css uses .jg-wide).
   Not touched: board, cells, pieces, dice, canvas, Home cards. Light theme only (data-jf-lock="light"). */
html body.jg-ui.jg-ui {
  --nb: #FFF1F7; --nb-ink: #A3005F; --nb-ico: #C4006E;
  --nb-out: 9px 9px 20px rgba(214, 140, 175, .40), -8px -8px 18px rgba(255, 255, 255, .95);
  --nb-out-md: 6px 6px 13px rgba(214, 140, 175, .40), -6px -6px 12px rgba(255, 255, 255, .95);
  --nb-out-sm: 5px 5px 10px rgba(214, 140, 175, .42), -5px -5px 10px rgba(255, 255, 255, .95);
  --nb-out-pri: 5px 5px 11px rgba(196, 0, 110, .30), -5px -5px 10px rgba(255, 255, 255, .95);
  --nb-in: inset 5px 5px 11px rgba(214, 140, 175, .42), inset -5px -5px 11px rgba(255, 255, 255, .95);
  --nb-in-sm: inset 4px 4px 9px rgba(214, 140, 175, .42), inset -4px -4px 9px rgba(255, 255, 255, .95);
  --nb-line: rgba(214, 140, 175, .28);
}

/* 1. Cards: reset the old full-bleed rule (negative margin, border, radius 0), then raised surface */
html body.jg-ui.jg-ui :is(.jo-row, .jo-stat, .jo-sgame, .jo-empty, .jo-skel, .jo-set-card) { margin-left: 0; margin-right: 0; border: 0; border-radius: 24px; background: var(--nb); box-shadow: var(--nb-out); -webkit-backdrop-filter: none; backdrop-filter: none; }
html body.jg-ui.jg-ui .jo-row { margin-bottom: 18px; padding: 14px 16px; box-shadow: var(--nb-out-md); }
html body.jg-ui.jg-ui .jo-row[role="button"]:active { transform: scale(.985); box-shadow: var(--nb-in-sm); }
html body.jg-ui.jg-ui .jo-stats { gap: 20px; margin-bottom: 20px; }
html body.jg-ui.jg-ui .jo-stat { padding: 16px 20px; }
html body.jg-ui.jg-ui .jo-stat-val, html body.jg-ui.jg-ui .jo-row-game, html body.jg-ui.jg-ui .jo-sgame-name, html body.jg-ui.jg-ui .jo-empty-title, html body.jg-ui.jg-ui .jo-about-title { color: var(--nb-ink); }
html body.jg-ui.jg-ui .jo-sgame { margin-bottom: 20px; padding: 18px 20px; }
html body.jg-ui.jg-ui .jo-bar { border: 0; background: var(--nb); box-shadow: inset 2px 2px 4px rgba(214, 140, 175, .45), inset -2px -2px 4px rgba(255, 255, 255, .95); }
html body.jg-ui.jg-ui .jo-empty { margin-bottom: 20px; padding: 22px 20px; }
html body.jg-ui.jg-ui .jo-empty .jo-empty-art { width: 80px; height: 80px; padding: 16px; box-sizing: border-box; border-radius: 50%; background: var(--nb); color: var(--nb-ico); box-shadow: var(--nb-in); }
html body.jg-ui.jg-ui .jo-skel::after { display: none; }
html body.jg-ui.jg-ui .jo-skel--row { margin-bottom: 18px; }
html body.jg-ui.jg-ui .jo-see-all { color: var(--nb-ink); }

/* 2. Buttons (every .jx-btn / .modal-btn): primary = gradient pill, outline / cancel = raised surface pill. :active = pressed in. */
html body.jg-ui.jg-ui :is(.jx-btn, .modal-btn) { border: 0; border-radius: var(--ui-r-pill); box-shadow: var(--nb-out-pri); }
html body.jg-ui.jg-ui :is(.jx-btn--outline, .jx-btn--ghost, .modal-btn.cancel), html body.jg-ui.jg-ui :is(.jx-btn--outline, .jx-btn--ghost):hover { border: 0; background: var(--nb); color: var(--nb-ink); box-shadow: var(--nb-out-sm); filter: none; }
html body.jg-ui.jg-ui .jx-btn--danger { background: var(--ui-danger-btn); color: var(--ui-on-accent); box-shadow: var(--nb-out-sm); }
html body.jg-ui.jg-ui :is(.jx-btn, .modal-btn):not(:disabled):not(.disabled):active { box-shadow: inset 4px 4px 9px rgba(120, 0, 60, .38), inset -3px -3px 8px rgba(255, 255, 255, .22); }
html body.jg-ui.jg-ui :is(.jx-btn--outline, .jx-btn--ghost, .modal-btn.cancel):not(:disabled):not(.disabled):active { box-shadow: var(--nb-in-sm); }
html body.jg-ui.jg-ui .jo-more, html body.jg-ui.jg-ui .jo-clear { margin-top: 18px; }

/* 3. Chips: raised pill; selected = gradient. The :hover rule of jfun-ui.css is repeated so a sticky touch-hover cannot undo it. */
html body.jg-ui.jg-ui .jx-chip, html body.jg-ui.jg-ui .jx-chip:hover:not(.active):not(:disabled) { border: 0; background: var(--nb); color: var(--nb-ink); box-shadow: var(--nb-out-sm); }
html body.jg-ui.jg-ui .jx-chip.active { background: var(--ui-grad-btn); color: var(--ui-on-accent); box-shadow: var(--nb-out-pri); }
html body.jg-ui.jg-ui .jx-chip:not(:disabled):active { box-shadow: var(--nb-in-sm); }
html body.jg-ui.jg-ui .jo-filters { gap: 12px; padding: 4px 4px 8px; margin-bottom: 16px; }
html body.jg-ui.jg-ui .jo-filters .jx-chip { min-height: var(--jo-tap); padding: 0 16px; }

/* 4. Settings */
html body.jg-ui.jg-ui .jo-set-card { margin-bottom: 20px; padding: 14px 20px; }
html body.jg-ui.jg-ui .jo-set-row + .jo-set-row, html body.jg-ui.jg-ui .jo-whatsnew { border-top: 1px solid var(--nb-line); }
html body.jg-ui.jg-ui .jo-set-label { color: var(--nb-ink); }
html body.jg-ui.jg-ui .jo-set-ico { width: 40px; height: 40px; background: var(--nb); color: var(--nb-ico); box-shadow: inset 4px 4px 8px rgba(214, 140, 175, .42), inset -4px -4px 8px rgba(255, 255, 255, .95); }
html body.jg-ui.jg-ui .jo-switch { border: 1px solid transparent; background: var(--nb); box-shadow: inset 3px 3px 6px rgba(214, 140, 175, .50), inset -3px -3px 6px rgba(255, 255, 255, .95); }
html body.jg-ui.jg-ui .jo-switch::before { background: var(--nb); box-shadow: 2px 2px 5px rgba(214, 140, 175, .55), -2px -2px 4px rgba(255, 255, 255, .95); }
html body.jg-ui.jg-ui .jo-switch--on { background: var(--ui-grad-btn); box-shadow: inset 3px 3px 6px rgba(120, 0, 60, .38), inset -2px -2px 5px rgba(255, 255, 255, .20); }
html body.jg-ui.jg-ui .jo-input { height: 48px; padding: 0 18px; border: 0; border-radius: 18px; background: var(--nb); color: var(--ui-text); box-shadow: var(--nb-in-sm); }
html body.jg-ui.jg-ui .jo-name-btns { gap: 14px; margin-top: 18px; }
html body.jg-ui.jg-ui .jo-name-btns .jx-btn { min-height: 48px; }
html body.jg-ui.jg-ui .jo-about .jo-update-btn { margin-top: 16px; }
html body.jg-ui.jg-ui .jo-whatsnew summary { color: var(--nb-ink); }

/* 5. Game setup screens (#screen-setup only) */
html body.jg-ui.jg-ui #screen-setup .merged-card { padding: 16px 12px; border: 0; border-radius: 28px; background: var(--nb); box-shadow: var(--nb-out); -webkit-backdrop-filter: none; backdrop-filter: none; }
html body.jg-ui.jg-ui #screen-setup .jf-game-icon { width: 56px; height: 56px; border-radius: 50%; background: var(--nb); box-shadow: var(--nb-in); color: var(--nb-ico); }
html body.jg-ui.jg-ui #screen-setup .jf-game-icon.ludo { color: #A64F00; }
html body.jg-ui.jg-ui #screen-setup .jf-game-icon.barah { color: #1565C0; }
html body.jg-ui.jg-ui #screen-setup .jf-game-name { font-family: var(--ui-font-display); font-size: 20px; color: var(--nb-ink); }
html body.jg-ui.jg-ui #screen-setup .jf-game-desc { color: var(--ui-muted); }
html body.jg-ui.jg-ui #screen-setup .jo-side.jo-side--cards { gap: 12px; }
html body.jg-ui.jg-ui #screen-setup .jo-side.jo-side--cards .jx-chip { border: 2px solid transparent; border-radius: 22px; background: var(--nb); box-shadow: var(--nb-out-sm); }
html body.jg-ui.jg-ui #screen-setup .jo-side.jo-side--cards .jx-chip.active { border-color: var(--ui-accent); background: var(--nb); color: var(--ui-text); box-shadow: var(--nb-in-sm); }
html body.jg-ui.jg-ui #screen-setup .jo-side--cards .jo-opt-ico { color: var(--nb-ico); }
html body.jg-ui.jg-ui #screen-setup .jo-side--cards .jo-opt-t { color: var(--nb-ink); }
html body.jg-ui.jg-ui #screen-setup .jo-setup-actions { gap: 12px; padding: 12px; border: 0; border-radius: 28px; background: var(--nb); box-shadow: var(--nb-in); -webkit-backdrop-filter: none; backdrop-filter: none; }
html body.jg-ui.jg-ui #screen-setup .jo-setup-btn { min-height: var(--jo-ctl-h); }

/* 6. Match screens: no Soft 3D chrome - bar, gear / undo, chips keep the website (design1) look */

/* 7. Dialogs and sheets */
html body.jg-ui.jg-ui .modal-content, html body.jg-ui.jg-ui .jx-modal, html body.jg-ui.jg-ui .jm-settings-panel, html body.jg-ui.jg-ui .jo-dialog-box, html body.jg-ui.jg-ui .jo-sheet-panel, html body.jg-ui.jg-ui .jo-dsheet-panel { border: 0; background: var(--nb); box-shadow: var(--nb-out); -webkit-backdrop-filter: none; backdrop-filter: none; }
html body.jg-ui.jg-ui :is(.modal-content, .jx-modal, .jo-dialog-box, .jm-settings-panel) { border-radius: 28px; }
html body.jg-ui.jg-ui :is(.jo-sheet-panel, .jo-dsheet-panel) { border-radius: 28px 28px 0 0; }
html body.jg-ui.jg-ui :is(.modal-header, .modal-footer) { border-color: var(--nb-line); }
html body.jg-ui.jg-ui :is(.modal-title, .jo-dsheet-title, .jo-sheet-title, .jm-settings-title) { color: var(--nb-ink); }
html body.jg-ui.jg-ui :is(.close-modal, .jo-dsheet-x, .jm-settings-x) { background: var(--nb); color: var(--nb-ico); box-shadow: var(--nb-out-sm); }

/* 8. Common bars: floating pills (host stays transparent), small raised buttons */
html body.jg-ui.jg-ui .jo-topbar, html body.jg-ui.jg-ui .jo-tabbar { border: 0; background: var(--nb); box-shadow: var(--nb-out-md); -webkit-backdrop-filter: none; backdrop-filter: none; }
html body.jg-ui.jg-ui .jo-tab { color: var(--ui-muted); }
html body.jg-ui.jg-ui .jo-tab--active { background: var(--ui-grad-btn); color: var(--ui-on-accent); box-shadow: var(--nb-out-pri); }
html body.jg-ui.jg-ui .jo-tab:not(.jo-tab--active):active { box-shadow: var(--nb-in-sm); }
html body.jg-ui.jg-ui :is(.jo-share, .jo-back-btn, .jo-online) { border: 0; background: var(--nb); color: var(--nb-ink); box-shadow: var(--nb-out-sm); -webkit-backdrop-filter: none; backdrop-filter: none; }
html body.jg-ui.jg-ui :is(.jo-back-btn, .jo-share) { color: var(--nb-ico); }
html body.jg-ui.jg-ui :is(.jo-share, .jo-back-btn, .jo-online):active { box-shadow: var(--nb-in-sm); }
html body.jg-ui.jg-ui .jo-bar-title { color: var(--nb-ink); }

/* 9. Small screens + reduced motion */
@media (max-width: 359px) {
  html body.jg-ui.jg-ui #screen-setup .merged-card { padding: 14px 10px; }
  html body.jg-ui.jg-ui #screen-setup .jo-side.jo-side--cards { gap: 8px; }
  html body.jg-ui.jg-ui #screen-setup .jo-setup-actions { padding: 10px; }
}
@media (prefers-reduced-motion: reduce) {
  html body.jg-ui.jg-ui :is(.jx-btn, .modal-btn, .jx-chip, .jo-tab, .jo-share, .jo-back-btn, .jo-online, .jm-gear, .jo-row[role="button"]):active { transform: none; }
  html body.jg-ui.jg-ui :is(.jx-btn, .modal-btn, .jx-chip, .jo-tab, .jo-share, .jo-back-btn, .jo-online, .jm-gear, .jm-bar, .jm-chip, .jl-chip, .jo-switch, .jo-switch::before) { transition: none; }
}

/* ===== Share App button = same look as the active bottom tab (gradient pill: icon + label) ===== */
html body.jg-ui.jg-ui .jo-share { width: auto; min-width: 0; height: 44px; padding: 0 16px; gap: 6px; border-radius: 22px; background: var(--ui-grad-btn); color: var(--ui-on-accent); box-shadow: var(--nb-out-pri); font-family: var(--ui-font-display); font-size: var(--jo-fs-2xs); font-weight: 600; }
html body.jg-ui.jg-ui .jo-share:active { box-shadow: inset 4px 4px 9px rgba(120, 0, 60, .38), inset -3px -3px 8px rgba(255, 255, 255, .22); }
html body.jg-ui.jg-ui .jo-share-lbl { white-space: nowrap; line-height: var(--jo-lh-tight); }

/* Layout: ludo setup option 10 (start options first, Players / Bot level / Seats as separate raised cards, bead seats) */
html body.jg-ludo.jg-ui.jg-ui #screen-setup .merged-card{padding:0;background:transparent;box-shadow:none;border-radius:0}
html body.jg-ludo.jg-ui.jg-ui #screen-setup .jf-game-head{margin:0 4px 16px!important}
html body.jg-ludo.jg-ui.jg-ui #screen-setup .jo-sec,html body.jg-ludo.jg-ui.jg-ui #screen-setup #lvl-row{margin-bottom:16px;padding:12px;border-radius:24px;background:var(--nb);box-shadow:var(--nb-out-md)}
html body.jg-ludo.jg-ui.jg-ui #screen-setup .jo-sec .jo-setup-label,html body.jg-ludo.jg-ui.jg-ui #screen-setup #lvl-row .jo-setup-label{margin-top:0}
html body.jg-ludo.jg-ui.jg-ui #screen-setup .jo-sec .jo-side,html body.jg-ludo.jg-ui.jg-ui #screen-setup #lvl-row .jo-side{margin-bottom:0}
html body.jg-ludo.jg-ui.jg-ui #screen-setup #seat-list{margin-bottom:0}
html body.jg-ludo.jg-ui.jg-ui #screen-setup .jo-setup-actions{position:static;margin:0 0 16px;border-radius:24px;box-shadow:var(--nb-out-md);background:var(--nb)}
html body.jg-ludo.jg-ui.jg-ui #screen-setup .jl-seats{gap:10px}
html body.jg-ludo.jg-ui.jg-ui #screen-setup .jl-dot{box-sizing:content-box;width:16px;height:16px;border:5px solid var(--nb);box-shadow:var(--nb-out-sm)}
html body.jg-ludo.jg-ui.jg-ui #screen-setup .jl-seat{gap:12px}
html body.jg-ludo.jg-ui.jg-ui #screen-setup .jl-toggle{gap:0;padding:4px;border-radius:999px;background:var(--nb);box-shadow:var(--nb-in)}
html body.jg-ludo.jg-ui.jg-ui #screen-setup .jl-toggle .jx-chip{min-width:60px;padding:0 10px;border-radius:999px;background:transparent;box-shadow:none;justify-content:center;text-align:center}
html body.jg-ludo.jg-ui.jg-ui #screen-setup .jl-toggle .jx-chip.active{background:var(--ui-grad-btn);box-shadow:var(--nb-out-pri)}

/* Layout: tic tac toe setup option 10 (same as Ludo: actions first, Your side / Bot level as separate raised cards) */
html body.jg-tictactoe.jg-ui.jg-ui #screen-setup .merged-card{padding:0;background:transparent;box-shadow:none;border-radius:0}
html body.jg-tictactoe.jg-ui.jg-ui #screen-setup .jf-game-head{margin:0 4px 16px!important}
html body.jg-tictactoe.jg-ui.jg-ui #screen-setup .jo-sec{margin-bottom:16px;padding:12px;border-radius:24px;background:var(--nb);box-shadow:var(--nb-out-md)}
html body.jg-tictactoe.jg-ui.jg-ui #screen-setup .jo-sec .jo-setup-label{margin-top:0}
html body.jg-tictactoe.jg-ui.jg-ui #screen-setup .jo-sec .jo-side{margin-bottom:0}
html body.jg-tictactoe.jg-ui.jg-ui #screen-setup .jo-setup-actions{position:static;margin:0 0 16px;border-radius:24px;box-shadow:var(--nb-out-md);background:var(--nb)}

/* Layout: barah tehni setup option 10 (same as Ludo: actions first, Your side / Bot level as separate raised cards) */
html body.jg-barah.jg-ui.jg-ui #screen-setup .merged-card{padding:0;background:transparent;box-shadow:none;border-radius:0}
html body.jg-barah.jg-ui.jg-ui #screen-setup .jf-game-head{margin:0 4px 16px!important}
html body.jg-barah.jg-ui.jg-ui #screen-setup .jo-sec{margin-bottom:16px;padding:12px;border-radius:24px;background:var(--nb);box-shadow:var(--nb-out-md)}
html body.jg-barah.jg-ui.jg-ui #screen-setup .jo-sec .jo-setup-label{margin-top:0}
html body.jg-barah.jg-ui.jg-ui #screen-setup .jo-sec .jo-side{margin-bottom:0}
html body.jg-barah.jg-ui.jg-ui #screen-setup .jo-setup-actions{position:static;margin:0 0 16px;border-radius:24px;box-shadow:var(--nb-out-md);background:var(--nb)}

/* Layout: ludo board screen = design1 structure and look (corner chips, 3D dice in the roller's yard, hint). No override: the website css of jfun/ludo.css + ludo-dashboard.css styles it. */

/* ===== Pro button: top bar of the Home page only, last button after Share App (Pro is the red gradient pill; Share App is the raised pale pill); both always show their names ===== */
html body .jo-actions { display: flex; align-items: center; flex: none; gap: var(--ui-gap-sm); }
html body.jg-ui.jg-ui .jo-actions .jo-share:not(.jo-pro) { background: var(--nb); color: var(--nb-ink); box-shadow: var(--nb-out-sm); }
html body.jg-ui.jg-ui .jo-actions .jo-share:not(.jo-pro):active { box-shadow: var(--nb-in-sm); }

/* ===== Match screens: no bottom bar. Undo + Settings gear sit in the top bar (gear last); the turn text stays only for screen readers ===== */
html body.jg-ui.jg-ui #match-info.jm-bar { position: absolute; left: -9999px; top: auto; bottom: auto; width: 1px; height: 1px; min-height: 0; overflow: hidden; padding: 0; margin: 0; border: 0; box-shadow: none; background: none; opacity: 0; pointer-events: none; }
html body.jg-ui.jg-ui .jo-actions .jm-gear { width: 44px; height: 44px; margin: 0; padding: 0; border: 0; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; background: var(--nb); color: var(--nb-ico); box-shadow: var(--nb-out-sm); }
html body.jg-ui.jg-ui .jo-actions .jm-gear:active { box-shadow: var(--nb-in-sm); }
html body.jg-ui.jg-ui .jo-actions .jo-undo { margin-right: 0; }

/* ===== Bars without their own shadow: the buttons inside keep the soft 3D (top bar and bottom tab bar) ===== */
html body.jg-ui.jg-ui .jo-topbar, html body.jg-ui.jg-ui .jo-tabbar { box-shadow: none; }
html body.jg-ui.jg-ui .jo-actions .jm-gear .jo-ico { width: 22px; height: 22px; }

/* ===== Ludo board: edge to edge (cancels the 4px page padding and the 4px box padding), so the board is as wide as the screen ===== */
html body.jg-ludo #screen-match.jf-fit > .ld-corners { width: auto; margin-left: -4px; margin-right: -4px; padding-left: 0; padding-right: 0; }
html body.jg-ludo #board-wrap > :not(#dice-box):not(#turn-hint) { border-radius: 0 !important; }   /* the board frame sets its radius inline (ludo-board.js), so !important is needed here */
html body.jg-ludo .ld-chip-red, html body.jg-ludo .ld-chip-blue { margin-left: 6px; }
html body.jg-ludo .ld-chip-green, html body.jg-ludo .ld-chip-yellow { margin-right: 6px; }

/* ===== Ludo board: no panel of its own behind the board (the page background shows through); inline styles of the board frame need !important ===== */
html body.jg-ludo #board-wrap > :not(#dice-box):not(#turn-hint) { background: transparent !important; box-shadow: none !important; border-color: transparent !important; }

/* ===== Ludo yard glow: pulled slightly inward so the pulsing light is no longer cut at the screen edge (scaled about its own centre; the board draws it as an svg rect in ludo-board.js) ===== */
html body.jg-ludo .ld-yard-glow { transform-box: fill-box; transform-origin: center; transform: scale(0.92); }

/* ===== Ludo: the dark purple (nearly black) highlight ring around movable tokens (and the hint / dice ring) becomes the app's pink accent; the white gap ring stays. The board reads --ld-hl from the root element, so it is set there. ===== */
html:root:root { --ld-hl: #C4006E; }

/* ===== Ludo yards: the dice sits exactly in the middle of its yard and of the four tokens (the base .ld-dice margin-top pushed it 4px down) ===== */
html body.jg-ludo #board-wrap > #dice-box { margin: 0; }

/* ===== Cards ("tables") on all screens: no white highlight shadow, only the soft pink shadow. Buttons, switches and inset wells keep theirs. ===== */
html body.jg-ui.jg-ui { --nb-out: 9px 9px 20px rgba(214, 140, 175, .40); --nb-out-md: 6px 6px 13px rgba(214, 140, 175, .40); }
html body.jg-offline .jo-games > .jo-gcard { box-shadow: 9px 9px 20px rgba(214, 140, 175, .40); }
html body.jg-offline #jo-recent .jo-row, html body.jg-offline #jo-recent .jo-empty, html body.jg-offline #jo-recent .jo-skel { box-shadow: 8px 8px 18px rgba(214, 140, 175, .38); }
html body.jg-offline .jo-wrap > .jo-hero { box-shadow: 9px 9px 20px rgba(214, 140, 175, .40); }

/* ===== History filter: the four chips (All / Ludo / Tic Tac Toe / Barah Tehni) are now ONE drop-down list ===== */
html body.jg-ui.jg-ui .jo-dd { position: relative; display: block; padding: 4px 0 8px; margin-bottom: 16px; }
html body.jg-ui.jg-ui .jo-dd-btn { width: 100%; min-height: var(--jo-tap); padding: 0 16px; display: flex; align-items: center; justify-content: space-between; gap: 8px; border: 0; border-radius: var(--ui-r-pill); background: var(--nb); color: var(--nb-ink); box-shadow: var(--nb-out-sm); font-family: var(--ui-font-display); font-size: var(--ui-fs-md); font-weight: 700; cursor: pointer; }
html body.jg-ui.jg-ui .jo-dd-btn:active, html body.jg-ui.jg-ui .jo-dd--open .jo-dd-btn { box-shadow: var(--nb-in-sm); }
html body.jg-ui.jg-ui .jo-dd-chev { flex: none; color: var(--nb-ico); transition: transform .2s ease; }
html body.jg-ui.jg-ui .jo-dd--open .jo-dd-chev { transform: rotate(180deg); }
html body.jg-ui.jg-ui .jo-dd-list { position: absolute; left: 0; right: 0; top: calc(100% - 4px); z-index: 30; padding: 8px; border-radius: 22px; background: var(--nb); box-shadow: var(--nb-out); }
html body.jg-ui.jg-ui .jo-dd-opt { display: block; width: 100%; min-height: var(--jo-tap); padding: 0 16px; margin: 0; border: 0; border-radius: var(--ui-r-pill); background: transparent; color: var(--nb-ink); text-align: left; font-family: var(--ui-font-display); font-size: var(--ui-fs-md); font-weight: 600; cursor: pointer; }
html body.jg-ui.jg-ui .jo-dd-opt:active { box-shadow: var(--nb-in-sm); }
html body.jg-ui.jg-ui .jo-dd-opt.active { background: var(--ui-grad-btn); color: var(--ui-on-accent); box-shadow: var(--nb-out-pri); }

/* ===== Tic Tac Toe + Barah Tehni boards, same as the Ludo board: no panel / frame of their own, edge to edge (390 x 390 on a 390px phone), square corners ===== */
html body.jg-tictactoe .ttt-board::before, html body.jg-tictactoe .ttt-board.my-turn::before { background: transparent; border-color: transparent; box-shadow: none; -webkit-backdrop-filter: none; backdrop-filter: none; animation: none; }
html body.jg-tictactoe #screen-match.jf-fit .jf-board-wrap { margin-left: -6px; margin-right: -6px; }
html body.jg-tictactoe .ttt-board { width: 100%; max-width: none; border-radius: 0; padding: 0 4px; box-sizing: border-box; }   /* 4px keeps the outer cell borders from touching the screen edge */
html body.jg-barah #screen-match.jf-fit .jf-board-wrap { margin-left: -6px; margin-right: -6px; }
html body.jg-barah #board-wrap canvas { border-radius: 0 !important; box-shadow: none !important; animation: none !important; -webkit-backdrop-filter: none; backdrop-filter: none; }   /* radius and shadow are set inline by barah-board.js, hence !important */
html:root:root { --bt-board-a: transparent; --bt-board-b: transparent; --bt-board-border: transparent; }


/* Expert Bot: four-chip Bot level group = 2 x 2 grid, equal chip height, no overflow at 320 px */
html body #screen-setup .jo-side.jo-side--cards.jo-side--4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
html body #screen-setup .jo-side.jo-side--cards.jo-side--4 .jx-chip { min-width: 0; min-height: 64px; height: 100%; }
html body #screen-setup .jo-side.jo-side--cards.jo-side--4 .jo-opt-ico { grid-row: 1 / span 2; width: 24px; height: 24px; }
html body #screen-setup .jo-side.jo-side--cards.jo-side--4 .jo-opt-t { grid-column: 2; padding-right: var(--ui-gap); font-family: var(--ui-font-display); font-size: var(--ui-fs-md); font-weight: 700; line-height: var(--jo-lh-tight); overflow-wrap: anywhere; }
html body #screen-setup .jo-side.jo-side--cards.jo-side--4 .jo-opt-d { grid-column: 2; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; font-size: var(--ui-fs-xs); line-height: var(--jo-lh); overflow-wrap: anywhere; }
@media (max-width: 419px) {
  html body #screen-setup .jo-side.jo-side--cards.jo-side--4 .jx-chip { grid-template-columns: minmax(0, 1fr); justify-items: center; text-align: center; padding: var(--ui-gap-sm); row-gap: 2px; }
  html body #screen-setup .jo-side.jo-side--cards.jo-side--4 .jo-opt-ico { grid-row: auto; }
  html body #screen-setup .jo-side.jo-side--cards.jo-side--4 .jo-opt-t, html body #screen-setup .jo-side.jo-side--cards.jo-side--4 .jo-opt-d { grid-column: 1; padding-right: 0; }
  html body #screen-setup .jo-side.jo-side--cards.jo-side--4 .jo-opt-t { font-size: var(--ui-fs-sm); }
}

/* Sound Pack: Volume slider row (slider on its own line, full row width) */
html body .jo-set-row--vol { flex-wrap: wrap; }
html body .jo-range { flex: 1 1 100%; width: 100%; min-width: 0; height: 28px; margin: 0 0 var(--ui-gap-sm); padding: 0; box-sizing: border-box; background: transparent; accent-color: var(--ui-accent); -webkit-appearance: none; appearance: none; }
html body .jo-range::-webkit-slider-runnable-track { height: 6px; border-radius: var(--ui-r-pill); background: var(--jf-glass-strong); }
html body .jo-range::-webkit-slider-thumb { -webkit-appearance: none; appearance: none; width: 28px; height: 28px; margin-top: -11px; border-radius: 50%; border: 0; background: var(--ui-accent); box-shadow: var(--ui-shadow); }
html body .jo-range:focus-visible { outline: 2px solid var(--ui-focus, var(--ui-accent)); outline-offset: 2px; }
html body .jo-range[disabled] { opacity: 0.5; }

/* Dark Theme: Settings > Appearance chips (two equal chips in one row) */
html body .jo-theme-chips { display: flex; gap: var(--ui-gap-sm); margin-top: var(--ui-gap-sm); }
html body .jo-theme-chips .jx-chip { flex: 1 1 0; min-width: 0; min-height: var(--jo-tap, 44px); }

/* ===== Dark Theme, step 2: Home, History, Stats, Settings, setup screens, bars, dialogs (match screens + result modal = step 3).
   Every rule starts with html[data-theme="dark"], so the light theme is untouched. Colours reuse the dark values of jfun-brand.css / jfun-ui.css
   (page #150A16, surface #2C162E, text --text-color, accent --jf-active). The Soft 3D look keeps its structure: raised = dark drop shadow + faint 1px ring, pressed = dark inset. ===== */
html[data-theme="dark"] { color-scheme: dark; }
html[data-theme="dark"]:root {
  --jo-dk-surface: #2C162E;
  --jo-topbar-shadow: 0 8px 30px rgba(0, 0, 0, 0.45);
  --jf-blob-pink: transparent; --jf-blob-lilac: transparent; --jf-blob-peach: transparent;
}
html[data-theme="dark"] body.jg-ui.jg-ui {
  --nb: var(--jo-dk-surface); --nb-ink: var(--text-color); --nb-ico: var(--jf-active);
  --nb-out: 9px 9px 20px rgba(0, 0, 0, .45), 0 0 0 1px rgba(255, 255, 255, .06);
  --nb-out-md: 6px 6px 13px rgba(0, 0, 0, .45), 0 0 0 1px rgba(255, 255, 255, .06);
  --nb-out-sm: 5px 5px 10px rgba(0, 0, 0, .45), 0 0 0 1px rgba(255, 255, 255, .08);
  --nb-out-pri: 5px 5px 11px rgba(0, 0, 0, .45), -3px -3px 8px rgba(255, 255, 255, .05);
  --nb-in: inset 5px 5px 11px rgba(0, 0, 0, .50), inset -5px -5px 11px rgba(255, 255, 255, .05);
  --nb-in-sm: inset 4px 4px 9px rgba(0, 0, 0, .50), inset -4px -4px 9px rgba(255, 255, 255, .05);
  --nb-line: rgba(255, 255, 255, .10);
}

/* Home: game cards (the light rules set --nb and the pastel shadows on the element itself) */
html[data-theme="dark"] body.jg-offline .jo-games > .jo-gcard.jo-gcard--ludo { --c1: #FFA24D; --c2: #FFA24D; --ct: #FFA24D; }
html[data-theme="dark"] body.jg-offline .jo-games > .jo-gcard.jo-gcard--ttt { --c1: #F54AA6; --c2: var(--jf-active); --ct: var(--jf-active); }
html[data-theme="dark"] body.jg-offline .jo-games > .jo-gcard.jo-gcard--barah { --c1: #6FA0FF; --c2: #6FA0FF; --ct: #6FA0FF; }
html[data-theme="dark"] body.jg-offline .jo-games > .jo-gcard { --nb: var(--jo-dk-surface); box-shadow: var(--nb-out); }
html[data-theme="dark"] body.jg-offline .jo-games > .jo-gcard:active { box-shadow: var(--nb-in); }
html[data-theme="dark"] body.jg-offline .jo-games > .jo-gcard .jo-gicon { box-shadow: var(--nb-in); }
html[data-theme="dark"] body.jg-offline .jo-games > .jo-gcard .jo-gplay { box-shadow: var(--nb-out-sm); }
html[data-theme="dark"] body.jg-offline .jo-games > .jo-gcard>.jo-gart { opacity: .16; }

/* Home: Resume hero */
html[data-theme="dark"] body.jg-offline .jo-wrap > .jo-hero { --nb: var(--jo-dk-surface); box-shadow: var(--nb-out); }
html[data-theme="dark"] body.jg-offline .jo-wrap > .jo-hero .jo-hero-title, html[data-theme="dark"] body.jg-offline .jo-wrap > .jo-hero .jo-hero-link, html[data-theme="dark"] body.jg-offline .jo-wrap > .jo-hero .jo-hero-btn { color: var(--nb-ink); }
html[data-theme="dark"] body.jg-offline .jo-wrap > .jo-hero .jo-hero-art { color: var(--nb-ico); box-shadow: var(--nb-in); }
html[data-theme="dark"] body.jg-offline .jo-wrap > .jo-hero .jo-hero-btn { box-shadow: var(--nb-out-sm); }
html[data-theme="dark"] body.jg-offline .jo-wrap > .jo-hero .jo-hero-btn:active { box-shadow: var(--nb-in-sm); }

/* Home: Recent matches rows, empty state, skeleton */
html[data-theme="dark"] body.jg-offline #jo-recent .jo-row, html[data-theme="dark"] body.jg-offline #jo-recent .jo-empty, html[data-theme="dark"] body.jg-offline #jo-recent .jo-skel { --nb: var(--jo-dk-surface); box-shadow: var(--nb-out-md); }
html[data-theme="dark"] body.jg-offline #jo-recent .jo-row .jo-row-game { color: var(--nb-ink); }
html[data-theme="dark"] body.jg-offline #jo-recent .jo-empty .jo-empty-art { color: var(--nb-ico); box-shadow: var(--nb-in); }
html[data-theme="dark"] body.jg-offline #jo-recent .jo-empty .jo-empty-btn { color: var(--nb-ink); box-shadow: var(--nb-out-sm); }
html[data-theme="dark"] body.jg-offline #jo-recent .jo-empty .jo-empty-btn:active { box-shadow: var(--nb-in-sm); }

/* History, Stats, Settings, setup: hard-coded light shadows / colours of the Soft 3D block */
html[data-theme="dark"] body.jg-ui.jg-ui .jo-bar { box-shadow: inset 2px 2px 4px rgba(0, 0, 0, .50), inset -2px -2px 4px rgba(255, 255, 255, .05); }
html[data-theme="dark"] body.jg-ui.jg-ui .jo-set-ico { box-shadow: var(--nb-in-sm); }
html[data-theme="dark"] body.jg-ui.jg-ui .jo-switch { background: rgba(255, 255, 255, .14); box-shadow: var(--nb-in-sm); }
html[data-theme="dark"] body.jg-ui.jg-ui .jo-switch::before { background: var(--text-secondary); box-shadow: 2px 2px 5px rgba(0, 0, 0, .55); }
html[data-theme="dark"] body.jg-ui.jg-ui .jo-switch--on { background: var(--ui-grad-btn); box-shadow: inset 3px 3px 6px rgba(0, 0, 0, .35), inset -2px -2px 5px rgba(255, 255, 255, .12); }
html[data-theme="dark"] body.jg-ui.jg-ui .jo-switch--on::before { background: var(--ui-on-accent); }
html[data-theme="dark"] body.jg-ui.jg-ui #screen-setup .jf-game-icon.ludo { color: #FFA24D; }
html[data-theme="dark"] body.jg-ui.jg-ui #screen-setup .jf-game-icon.barah { color: #6FA0FF; }
html[data-theme="dark"] body.jg-ui.jg-ui :is(.jx-btn, .modal-btn):not(:disabled):not(.disabled):active, html[data-theme="dark"] body.jg-ui.jg-ui .jo-share:active { box-shadow: inset 4px 4px 9px rgba(0, 0, 0, .40), inset -3px -3px 8px rgba(255, 255, 255, .10); }
html[data-theme="dark"] body.jg-ui.jg-ui :is(.jx-btn--outline, .jx-btn--ghost, .modal-btn.cancel):not(:disabled):not(.disabled):active { box-shadow: var(--nb-in-sm); }

/* Settings: Volume slider track (the glass-strong track is too close to the card colour) */
html[data-theme="dark"] body .jo-range::-webkit-slider-runnable-track { background: rgba(255, 255, 255, .22); }

/* ===== Dark Theme, step 3: match screens (Ludo, Tic Tac Toe, Barah Tehni) + result modal.
   jfun-game.css already holds the dark values of the board tokens (--ld-*, --ttt-*, --bt-*), the turn banners, chips and the result modal use tokens, and
   the modals / bars / buttons got their dark surface in step 2. Only what the light-locked rules above still force, or what is too faint on the dark page, is set here.
   Every rule starts with html[data-theme="dark"]; the board scripts read these variables when the page loads. ===== */
html[data-theme="dark"]:root:root {
  /* Ludo: the pink movable-token ring of the light theme (--ld-hl #C4006E) is too dark on the dark board and too close to the red player; a near-white ring is distinct from all four player colours */
  --ld-hl: var(--text-color);
  /* Ludo: the board has no panel of its own, so the cells get the surface colour and a clearer outline against the page */
  --ld-cell: var(--jo-dk-surface);
  --ld-yard-inner: var(--jo-dk-surface);
  --ld-cell-border: rgba(255, 255, 255, .26);
  /* Tic Tac Toe: cell outline */
  --ttt-cell-border: rgba(255, 255, 255, .28);
  /* Barah Tehni: board lines and nodes (the board frame is transparent, see above) */
  --bt-line: rgba(255, 255, 255, .36);
  --bt-node-stroke: rgba(255, 255, 255, .45);
}

/* Ludo Modes: two-chip groups (Game style, Teams) = 2 equal columns, same chip look and height as the 3 / 4 chip groups, no overflow at 320 px */
html body #screen-setup .jo-side.jo-side--cards.jo-side--2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
html body #screen-setup .jo-side.jo-side--cards.jo-side--2 .jx-chip { min-width: 0; min-height: 64px; height: 100%; }
html body #screen-setup .jo-side.jo-side--cards.jo-side--2 .jo-opt-ico { grid-row: 1 / span 2; width: 24px; height: 24px; }
html body #screen-setup .jo-side.jo-side--cards.jo-side--2 .jo-opt-t { grid-column: 2; padding-right: var(--ui-gap); font-family: var(--ui-font-display); font-size: var(--ui-fs-md); font-weight: 700; line-height: var(--jo-lh-tight); overflow-wrap: anywhere; }
html body #screen-setup .jo-side.jo-side--cards.jo-side--2 .jo-opt-d { grid-column: 2; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; font-size: var(--ui-fs-xs); line-height: var(--jo-lh); overflow-wrap: anywhere; }
@media (max-width: 419px) {
  html body #screen-setup .jo-side.jo-side--cards.jo-side--2 .jx-chip { grid-template-columns: minmax(0, 1fr); justify-items: center; text-align: center; padding: var(--ui-gap-sm); row-gap: 2px; }
  html body #screen-setup .jo-side.jo-side--cards.jo-side--2 .jo-opt-ico { grid-row: auto; }
  html body #screen-setup .jo-side.jo-side--cards.jo-side--2 .jo-opt-t, html body #screen-setup .jo-side.jo-side--cards.jo-side--2 .jo-opt-d { grid-column: 1; padding-right: 0; }
  html body #screen-setup .jo-side.jo-side--cards.jo-side--2 .jo-opt-t { font-size: var(--ui-fs-sm); }
}

/* Ludo Play Feel: destination ghost (dashed ring where a legal token would land; solid + larger when it captures) */
html body .ld-ghost { box-sizing: border-box; margin: -1.8% 0 0 -1.8%; background: transparent; border: 2px dashed var(--ld-hl); border-radius: 50%; opacity: .85; animation: ld-ghost-pulse 1.2s ease-in-out infinite; }
html body .ld-ghost.ld-ghost--cap { border-style: solid; border-color: var(--ld-last); transform: scale(1.2); }
@keyframes ld-ghost-pulse { 0%, 100% { opacity: .85; } 50% { opacity: .4; } }
@media (prefers-reduced-motion: reduce) {
  html body .ld-ghost { animation: none; }
}

/* Ludo Play Feel: danger ring (own token an opponent can capture next turn); sits outside the highlight ring of a movable token */
html body .ld-danger::after { content: ''; position: absolute; left: -35%; top: -35%; right: -35%; bottom: -35%; box-sizing: border-box; border: 2px solid var(--ui-danger-btn); border-radius: 50%; pointer-events: none; animation: ld-danger-pulse 1s ease-in-out infinite; }
@keyframes ld-danger-pulse { 0%, 100% { opacity: 1; transform: scale(1); } 50% { opacity: .35; transform: scale(1.08); } }
@media (prefers-reduced-motion: reduce) {
  html body .ld-danger::after { animation: none; }
}

/* Ludo Skins: Board look / Token style rows inside the LUDO card (equal-width chips, no overflow at 320 px) */

/* ===== Ludo Skins, step 2: board looks (Wood, Neon) and token style (Flat). Classic + Glossy = no rule here, so the default stays unchanged.
   Skins only override the --ld-* variables that ludo-board.js reads with cssVar(). :root:root raises the specificity to match / beat the
   existing html:root:root and html[data-theme="dark"]:root:root --ld-* rules above (later in the file wins on a tie). ===== */

/* Wood, light */
html[data-ludo-skin="wood"]:root:root {
  --ld-red: #B8322E;    --ld-red-hi: #D9807C;    --ld-red-lo: #7E1F1D;    --ld-red-edge: #8F2522;
  --ld-green: #3F7A2E;  --ld-green-hi: #8DB67E;  --ld-green-lo: #2A5420;  --ld-green-edge: #2F6023;
  --ld-yellow: #B8860B; --ld-yellow-hi: #D9BC6B; --ld-yellow-lo: #7F5C06; --ld-yellow-edge: #8A6409;
  --ld-blue: #2A5FA8;   --ld-blue-hi: #7FA3D4;   --ld-blue-lo: #1B4073;   --ld-blue-edge: #1E4B86;
  --ld-board-bg: linear-gradient(160deg, #A8743F 0%, #7A4A22 100%);
  --ld-board-border: #5A3416;
  --ld-board-shadow: 0 0 0 1px rgba(255, 238, 204, 0.35), 0 10px 28px rgba(60, 30, 10, 0.35);
  --ld-cell: #E8CFA3;
  --ld-cell-border: #6B4220;
  --ld-yard-inner: #F1DDB8;
  --ld-star: #5E3512;
  --ld-centre-alpha: 0.92;
  --ld-centre-edge: #F6E7C8;
  --ld-centre-line: #F6E7C8;
  --ld-centre-dot: #F6E7C8;
  --ld-centre-ring: #5A3416;
  --ld-gloss: #FFF3D6;
  --ld-hl: #C4006E;
  --ld-hl-gap: #FFF3D6;
  --ld-last: #3B1F0A;
  --ld-token-shadow: 0 3px 6px rgba(50, 25, 8, 0.45);
  --ld-token-ring: rgba(255, 243, 214, 0.85);
  --ld-token-shine: rgba(255, 243, 214, 0.60);
}

/* Wood, dark (darker wood) */
html[data-theme="dark"][data-ludo-skin="wood"]:root:root {
  --ld-red: #CE4A44;    --ld-red-hi: #E8958F;    --ld-red-lo: #8C2420;    --ld-red-edge: #A32D29;
  --ld-green: #5A9A46;  --ld-green-hi: #A2CC93;  --ld-green-lo: #3A6A2B;  --ld-green-edge: #447D33;
  --ld-yellow: #D9A21E; --ld-yellow-hi: #EDCB78; --ld-yellow-lo: #98700C; --ld-yellow-edge: #A97B0F;
  --ld-blue: #4A82D0;   --ld-blue-hi: #93B7E6;   --ld-blue-lo: #2E5799;   --ld-blue-edge: #3568AD;
  --ld-board-bg: linear-gradient(160deg, #5A3A20 0%, #3A2312 100%);
  --ld-board-border: #1F1209;
  --ld-board-shadow: 0 0 0 1px rgba(255, 220, 170, 0.18), 0 12px 32px rgba(0, 0, 0, 0.55);
  --ld-cell: #8A5E36;
  --ld-cell-border: #2B190B;
  --ld-yard-inner: #A06E40;
  --ld-star: #F6E7C8;
  --ld-centre-edge: #F6E7C8;
  --ld-centre-ring: #F6E7C8;
  --ld-hl: #FFFFFF;
  --ld-hl-gap: transparent;
  --ld-last: #FFE9B8;
  --ld-token-shadow: 0 3px 6px rgba(0, 0, 0, 0.55);
  --ld-token-ring: rgba(255, 243, 214, 0.80);
}

/* Neon: dark navy / black board in both themes, cyan outlines + glow, bright player colours */
html[data-ludo-skin="neon"]:root:root {
  --ld-red: #FF2D6F;    --ld-red-hi: #FF8FB3;    --ld-red-lo: #B0113F;    --ld-red-edge: #FF2D6F;
  --ld-green: #20E070;  --ld-green-hi: #8CF5B5;  --ld-green-lo: #0D9A46;  --ld-green-edge: #20E070;
  --ld-yellow: #FFD60A; --ld-yellow-hi: #FFE97A; --ld-yellow-lo: #C79D00; --ld-yellow-edge: #FFD60A;
  --ld-blue: #2D8CFF;   --ld-blue-hi: #8DC0FF;   --ld-blue-lo: #1052B8;   --ld-blue-edge: #2D8CFF;
  --ld-board-bg: linear-gradient(160deg, #0A1030 0%, #04060F 100%);
  --ld-board-border: #00E5FF;
  --ld-board-shadow: 0 0 0 1px rgba(0, 229, 255, 0.35), 0 0 22px rgba(0, 229, 255, 0.35), 0 12px 32px rgba(0, 0, 0, 0.55);
  --ld-cell: #0B1233;
  --ld-cell-border: rgba(0, 229, 255, 0.75);
  --ld-yard-inner: #0B1233;
  --ld-star: #7DF3FF;
  --ld-centre-alpha: 0.95;
  --ld-centre-edge: #00E5FF;
  --ld-centre-line: #E6FBFF;
  --ld-centre-dot: #04060F;
  --ld-centre-ring: #00E5FF;
  --ld-gloss: #FFFFFF;
  --ld-hl: #FFFFFF;
  --ld-hl-gap: #04060F;
  --ld-last: #B388FF;
  --ld-token-shadow: 0 0 8px rgba(0, 229, 255, 0.85);
  --ld-token-ring: #00E5FF;
  --ld-token-shine: rgba(255, 255, 255, 0.55);
  --ld-die-face: #0B1233;
  --ld-die-border: #00E5FF;
  --ld-die-glow: 0 0 14px rgba(0, 229, 255, 0.45);
  --ld-die-inset: inset 0 0 8px rgba(0, 229, 255, 0.35);
  --ld-die-floor: rgba(0, 0, 0, 0.75);
  --ld-pip: #E6FBFF;
}

/* Flat tokens: no gloss / shine, flat player colour (-hi and -lo = base), lighter shadow; every board look, both themes (placed after the skins so Neon's shine / shadow do not win) */
html[data-token-style="flat"]:root:root {
  --ld-gloss: transparent;
  --ld-token-shine: transparent;
  --ld-red-hi: var(--ld-red);       --ld-red-lo: var(--ld-red);
  --ld-green-hi: var(--ld-green);   --ld-green-lo: var(--ld-green);
  --ld-yellow-hi: var(--ld-yellow); --ld-yellow-lo: var(--ld-yellow);
  --ld-blue-hi: var(--ld-blue);     --ld-blue-lo: var(--ld-blue);
  --ld-token-shadow: 0 1px 2px rgba(0, 0, 0, 0.25);
}

/* ---- Settings page: tidy rows + Ludo options in the match settings sheet ---- */
html body.jg-ui.jg-ui .jo-set-card { padding: 6px 18px; }
html body.jg-ui.jg-ui .jo-set-card > .jo-set-label { padding-top: 12px; }
html body.jg-ui.jg-ui .jo-set-row { gap: 14px; min-height: 64px; padding: 12px 0; box-sizing: border-box; }
html body.jg-ui.jg-ui .jo-set-row .jo-set-ico { margin: 0; }
html body.jg-ui.jg-ui .jo-set-row .jo-set-text { display: flex; flex-direction: column; gap: 2px; }
html body.jg-ui.jg-ui .jo-set-row .jo-switch { margin: 0; }
html body.jg-ui.jg-ui .jo-set-row--vol { display: grid; grid-template-columns: 40px minmax(0, 1fr); align-items: center; row-gap: 4px; padding-bottom: 8px; }
html body.jg-ui.jg-ui .jo-set-row--vol .jo-range { grid-column: 1 / -1; width: 100%; margin: 0; }
html body.jg-ui.jg-ui .jo-theme-chips { margin: 10px 0 16px; }
html body.jg-ui.jg-ui .jo-name-row { display: flex; flex-direction: column; gap: 6px; padding: 6px 0; }
html body.jg-ui.jg-ui .jo-name-btns { display: flex; gap: 12px; padding: 14px 0 12px; }
html body.jg-ui.jg-ui .jo-name-btns .jx-btn { flex: 1 1 0; min-width: 0; margin: 0; }
html body.jg-ui.jg-ui .jo-whatsnew summary { padding: 12px 0; display: flex; align-items: center; gap: 14px; min-height: 56px; box-sizing: border-box; }
html body.jg-ui.jg-ui .jo-whatsnew ul { margin: 0 0 12px; padding-left: 52px; }

html body.jg-ui.jg-ui .jm-settings-panel { max-height: calc(100% - 32px); overflow-y: auto; -webkit-overflow-scrolling: touch; }
html body.jg-ui.jg-ui .jm-ludo-opts { margin: 6px 0 0; padding-top: 6px; border-top: 1px solid var(--nb-line); }
html body.jg-ui.jg-ui .jm-lrow { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 52px; padding: 8px 0; }
html body.jg-ui.jg-ui .jm-lrow + .jm-lrow { border-top: 1px solid var(--nb-line); }
html body.jg-ui.jg-ui .jm-lrow--chips { display: block; }
html body.jg-ui.jg-ui .jm-lrow--chips .jo-theme-chips { margin: 8px 0 4px; }
html body.jg-ui.jg-ui .jm-ltext { min-width: 0; flex: 1 1 auto; }
html body.jg-ui.jg-ui .jm-llabel { font-family: var(--ui-font-display); font-size: var(--ui-fs-sm); font-weight: 700; color: var(--nb-ink); line-height: 1.3; }
html body.jg-ui.jg-ui .jm-lsub { font-size: var(--ui-fs-xs); color: var(--ui-muted); line-height: 1.35; }
html body.jg-ui.jg-ui .jm-lrow .jo-switch { margin: 0; }
html body.jg-ui.jg-ui .jm-lrow--chips .jx-chip { padding-left: 6px; padding-right: 6px; overflow-wrap: anywhere; }
html body.jg-ui.jg-ui .jm-set-label { color: var(--nb-ink); font-family: var(--ui-font-display); }
html body.jg-ui.jg-ui .jo-theme-chips .jx-chip { display: flex; align-items: center; justify-content: center; text-align: center; padding-left: 8px; padding-right: 8px; }

/* Ludo: tokens on the outer cells keep their full body and highlight ring (the board wrapper no longer clips them) */
html body.jg-ludo #board-wrap, html body.jg-ludo #screen-match.jf-fit .ld-corners > #board-wrap, html body.jg-ludo #screen-match.jf-fit > .jf-board-wrap, html body.jg-ludo #screen-match.jf-fit .ld-corners { overflow: visible !important; }
/* Ludo: the edge-to-edge board reaches 4px past the match screen box; let the outer-column tokens show fully (the page itself never scrolls sideways) */
html body.jg-ludo #screen-match, html body.jg-ludo #screen-match.jf-fit[style*="display: block"], html body.jg-ludo #screen-match.jf-fit[style*="display: flex"] { overflow: visible !important; }
/* Ludo: no pulsing glow ring on movable tokens */
html body.jg-ludo #board-wrap div[style*="cursor: pointer"] > div { animation: none !important; }

/* Ludo door: when it opens, the bar fades and the lock pops once */
@keyframes ld-door-fade { from { opacity: 1; } to { opacity: .45; } }
html body.jg-ludo .ld-door-anim { animation: ld-door-fade .5s ease-out both; }
@media (prefers-reduced-motion: reduce) { html body.jg-ludo .ld-door-anim { animation: none; } }
@keyframes ld-lock-out { from { opacity: 1; transform-box: fill-box; } to { opacity: 0; } }
html body.jg-ludo .ld-lock-out { animation: ld-lock-out .5s ease-out both; }
@media (prefers-reduced-motion: reduce) { html body.jg-ludo .ld-lock-out { animation: none; opacity: 0; } }

/* ---- Ludo polish: dice six glow, setup summary, result winner card + standings ---- */
@keyframes ld-six-glow { 0% { filter: drop-shadow(0 0 0 rgba(255, 201, 60, 0)); } 25% { filter: drop-shadow(0 0 12px rgba(255, 201, 60, 1)) drop-shadow(0 0 4px #fff3b0); } 100% { filter: drop-shadow(0 0 0 rgba(255, 201, 60, 0)); } }
html body.jg-ludo .ld-dice.ld-six { animation: ld-six-glow 1.2s ease-out 1 !important; }
@media (prefers-reduced-motion: reduce) { html body.jg-ludo .ld-dice.ld-six { animation: none !important; filter: drop-shadow(0 0 8px rgba(255, 201, 60, .9)); } }

html body.jg-ui.jg-ui .jo-sum { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 14px; padding: 0 6px; }
html body.jg-ui.jg-ui .jo-sum-chip { display: inline-flex; align-items: center; padding: 6px 12px; border-radius: 999px; background: var(--nb); box-shadow: var(--nb-out-sm); font-size: var(--ui-fs-xs); font-weight: 700; color: var(--nb-ink); line-height: 1.2; }

html body.jg-ui.jg-ui .ld-res-win { display: flex; justify-content: center; margin: 4px 0 2px; }
html body.jg-ui.jg-ui .ld-res-win:empty { display: none; }
html body.jg-ui.jg-ui .ld-res-disc { width: 58px; height: 58px; border-radius: 50%; background: radial-gradient(circle at 34% 30%, rgba(255, 255, 255, .55), var(--wc) 55%, var(--wc)); box-shadow: 0 0 0 4px rgba(255, 255, 255, .9), 0 0 0 7px var(--wc), 0 6px 14px rgba(0, 0, 0, .25); }
html body.jg-ui.jg-ui .ld-res-rank { display: flex; flex-direction: column; gap: 6px; margin: 12px 0 4px; text-align: left; }
html body.jg-ui.jg-ui .ld-res-row { display: flex; align-items: center; gap: 10px; padding: 8px 12px; border-radius: 16px; background: var(--nb); box-shadow: var(--nb-in-sm); }
html body.jg-ui.jg-ui .ld-res-row--win { box-shadow: var(--nb-out-sm); }
html body.jg-ui.jg-ui .ld-res-pos { flex: none; width: 22px; height: 22px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 700; color: #fff; background: var(--ui-grad-btn); }
html body.jg-ui.jg-ui .ld-res-dot { flex: none; width: 12px; height: 12px; border-radius: 50%; }
html body.jg-ui.jg-ui .ld-res-name { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 700; color: var(--nb-ink); font-size: var(--ui-fs-sm); }
html body.jg-ui.jg-ui .ld-res-score { flex: none; font-size: var(--ui-fs-xs); font-weight: 700; color: var(--ui-muted); }
