/* ======================================================================================================
   People Polly: the design system, and the look of the menu and in-match components.
   Loaded after style.css and layered over it. One palette, one type scale, one spacing step (4px), one corner radius.
   ====================================================================================================== */
:root {
  /* palette */
  --bg: #0a1430; --surface: #13224a; --surface-2: #1b2f63; --surface-3: #243c7a; --line: #2c437f; --line-soft: #ffffff14;
  --text: #f1f5ff; --muted: #a3b6df; --faint: #7489b8;
  --primary: #22c55e; --primary-2: #16a34a; --on-primary: #032712;    /* the main action: play, claim, bet */
  --accent: #ffb52e; --accent-2: #f59e0b; --on-accent: #2e1d00;      /* rewards, trophies, the cup */
  --info: #3b82f6; --danger: #ef4444; --danger-2: #dc2626;
  --go: var(--primary); --gold: var(--accent); --panel: var(--surface); --panel2: var(--surface-2);
  /* type scale */
  --t-xs: 12px; --t-sm: 13px; --t-md: 15px; --t-lg: 18px; --t-xl: 22px; --t-2xl: 30px;
  /* shape and depth */
  --r: 16px; --r-sm: 12px; --r-pill: 999px;
  --shadow: 0 6px 18px #0008; --shadow-sm: 0 2px 6px #0006;
  --press: scale(.96);
  --ease: cubic-bezier(.2, .8, .2, 1);
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; } }

body { background: #050b1c; font-family: 'Nunito', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif; }
#app { background: radial-gradient(120% 60% at 50% -10%, #1b3576 0%, var(--bg) 55%); }
h2 { font-size: var(--t-lg); font-weight: 900; letter-spacing: .2px; }

/* ---------- buttons: one shape, a clear press, a real disabled state ---------- */
.btn {
  min-height: 44px; padding: 10px 16px; border-radius: var(--r-sm); border: 1px solid var(--line);
  background: var(--surface-2); color: var(--text); font: 800 var(--t-sm) 'Nunito', system-ui, sans-serif; letter-spacing: .2px;
  box-shadow: inset 0 1px 0 #ffffff1a, var(--shadow-sm); transition: transform .12s var(--ease), filter .12s, box-shadow .12s;
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
}
.btn:active:not(:disabled) { transform: var(--press); filter: brightness(1.08); box-shadow: inset 0 1px 0 #ffffff1a; }
.btn:disabled { opacity: 1; background: #1a2546; border-color: #24335e; color: #5f739f; box-shadow: none; }
.btn.go { background: linear-gradient(#34d670, var(--primary-2)); border-color: #15803d; color: var(--on-primary); }
.btn.gold { background: linear-gradient(#ffcd56, var(--accent-2)); border-color: #b45309; color: var(--on-accent); }
.btn.danger { background: linear-gradient(#f87171, var(--danger-2)); border-color: #991b1b; color: #fff; }
.btn.on { background: linear-gradient(#4f8dff, #2563eb); border-color: #93b4ff; color: #fff; }
.btn.quiet { background: #ffffff0d; }
.btn.big { min-height: 52px; padding: 14px 24px; font-size: var(--t-md); }
.btn small { display: block; font-size: var(--t-xs); font-weight: 700; opacity: .9; }
.btn.wide { display: flex; flex-direction: column; align-items: flex-start; min-height: 48px; }
.btn.wide[data-close] { align-items: center; }
.btn.pulse:not(:disabled) { animation: pulse 1.6s ease-in-out infinite; }
@keyframes pulse { 0%, 100% { box-shadow: 0 0 0 0 #ffb52e80, var(--shadow-sm); } 50% { box-shadow: 0 0 0 8px #ffb52e00, var(--shadow-sm); } }

/* ---------- top bar and tabs ---------- */
.topbar { background: #0d1a3ccc; backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); border-bottom: 1px solid var(--line-soft); }
.brand { font-size: var(--t-md); }
.pill { padding: 6px 12px; font-size: var(--t-sm); font-weight: 800; background: #00000040; border-color: var(--line-soft); }
.tabs { background: #0d1a3cf2; border-top: 1px solid var(--line-soft); padding: 6px 6px env(safe-area-inset-bottom); gap: 4px; }
.tabs button { min-height: 52px; border-radius: 14px; font-size: 22px; transition: background .2s var(--ease), color .2s; }
.tabs button span { font-size: var(--t-xs); font-weight: 800; }
.tabs button.on { color: #fff; box-shadow: none; background: linear-gradient(#ffffff1f, #ffffff0a); }
.tabs button.on span { color: var(--accent); }
.tabs button:active { transform: var(--press); }
.screen.active { animation: screen-in .28s var(--ease); }
@keyframes screen-in { from { opacity: 0; transform: translateY(8px); } }
#match:not([hidden]) { animation: match-in .35s var(--ease); }
@keyframes match-in { from { opacity: 0; } }

/* ---------- the Play tab (js/components/menu-screen.js) ---------- */
.mhero {
  position: relative; overflow: hidden; margin-top: 14px; padding: 16px; border-radius: 20px; border: 1px solid #ffffff26; color: #fff;
  background:
    radial-gradient(40% 30% at 12% 8%, #ffffffa0 0, #fff0 70%),              /* floodlights */
    radial-gradient(40% 30% at 88% 8%, #ffffffa0 0, #fff0 70%),
    repeating-linear-gradient(90deg, #ffffff10 0 22px, #0000 22px 44px),     /* mown stripes */
    linear-gradient(180deg, var(--sky) 0%, var(--sky2) 34%, color-mix(in srgb, var(--grass) 80%, #000) 62%, color-mix(in srgb, var(--grass) 55%, #000) 100%);
  box-shadow: var(--shadow);
}
.mhero::after { content: ''; position: absolute; inset: 0; background: linear-gradient(180deg, #0a143000 30%, #0a1430c0 100%); pointer-events: none; }
.mhero > * { position: relative; z-index: 1; }
.mh-top { display: flex; justify-content: space-between; align-items: center; }
.mh-league { padding: 6px 12px; border-radius: var(--r-pill); background: #00000059; font-size: var(--t-sm); font-weight: 900; letter-spacing: .3px; backdrop-filter: blur(4px); }
.chipbtn { min-height: 36px; padding: 6px 12px; border-radius: var(--r-pill); border: 1px solid #ffffff40; background: #00000059; color: #fff; font: 800 var(--t-xs) 'Nunito', sans-serif; }
.chipbtn.gold { background: var(--accent); color: var(--on-accent); }
.mh-trophies { display: flex; align-items: baseline; gap: 10px; margin-top: 54px; text-shadow: 0 2px 6px #0009; }
.mh-trophies b { font-size: var(--t-2xl); font-weight: 900; }
.mh-trophies span { font-size: var(--t-sm); font-weight: 700; color: #e6eeff; }
.mh-stats { display: flex; gap: 8px; margin: 10px 0 14px; }
.mh-stats span { flex: 1; display: flex; flex-direction: column; align-items: center; padding: 8px 4px; border-radius: var(--r-sm); background: #00000052; font-size: var(--t-xs); font-weight: 700; color: #d7e3ff; backdrop-filter: blur(4px); }
.mh-stats b { font-size: var(--t-lg); font-weight: 900; color: #fff; }
.mh-play {
  display: flex; flex-direction: column; align-items: center; width: 100%; min-height: 64px; padding: 10px; border: 0; border-radius: var(--r);
  background: linear-gradient(#3ee07c, #16a34a); color: var(--on-primary); box-shadow: inset 0 2px 0 #ffffff60, 0 6px 0 #0d6b31, 0 10px 18px #0007; cursor: pointer;
  transition: transform .12s var(--ease), box-shadow .12s;
}
.mh-play span { font-size: var(--t-xl); font-weight: 900; letter-spacing: 2px; }
.mh-play small { font-size: var(--t-xs); font-weight: 800; opacity: .85; }
.mh-play:active { transform: translateY(4px); box-shadow: inset 0 2px 0 #ffffff60, 0 2px 0 #0d6b31, 0 4px 10px #0007; }

.mprog { height: 8px; margin: 8px 0 4px; border-radius: var(--r-pill); background: #00000059; overflow: hidden; }
.mprog b { display: block; height: 100%; width: var(--w); border-radius: inherit; background: linear-gradient(90deg, #60a5fa, #3b82f6); }
.mprog.gold b { background: linear-gradient(90deg, #ffe08a, var(--accent)); }
.mprog.go b { background: linear-gradient(90deg, #86efac, var(--primary)); }
.mprog b.grow { animation: grow 1s var(--ease) both; }
@keyframes grow { from { width: 0; } }

.msec { display: flex; justify-content: space-between; align-items: baseline; margin: 22px 0 8px; }
.msec h2 { margin: 0; }
.msec span { font-size: var(--t-xs); font-weight: 800; color: var(--faint); }
.mcard, .mstad {
  display: flex; align-items: center; gap: 12px; margin-top: 10px; padding: 14px; border-radius: var(--r); border: 1px solid var(--line);
  background: linear-gradient(180deg, var(--surface-2), var(--surface)); box-shadow: var(--shadow-sm);
}
.mcard h3, .mstad h3 { font-size: var(--t-md); font-weight: 900; }
.mcard p, .mstad p { margin-top: 2px; font-size: var(--t-sm); color: var(--muted); }
.chal-end { display: flex; flex-direction: column; align-items: flex-end; gap: 8px; }
.chal.ready { border-color: #f59e0b; background: linear-gradient(180deg, #3a2c0e, var(--surface)); box-shadow: 0 0 0 1px #f59e0b55, 0 0 18px #f59e0b33; }
.chal.done { opacity: .62; }
.chal.done h3 { text-decoration: line-through; text-decoration-color: #ffffff60; }
.done-tick { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 50%; background: var(--primary); color: var(--on-primary); font-weight: 900; }
.rchip { display: inline-flex; align-items: center; gap: 4px; padding: 4px 10px; border-radius: var(--r-pill); font-size: var(--t-xs); font-weight: 900; white-space: nowrap; }
.rchip.coin { background: #ffb52e26; color: #ffd27a; border: 1px solid #ffb52e55; }
.rchip.gem { background: #60a5fa26; color: #a8ccff; border: 1px solid #60a5fa55; }
.rchips { display: flex; gap: 6px; margin-top: 8px; }
.mgrid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.mtile {
  display: flex; flex-direction: column; align-items: flex-start; gap: 2px; min-height: 120px; padding: 14px; border-radius: var(--r); border: 1px solid var(--line);
  color: var(--text); text-align: left; font-family: inherit; cursor: pointer; box-shadow: var(--shadow-sm); transition: transform .12s var(--ease);
}
.mtile.nets-bat { background: linear-gradient(150deg, #1e4fb8, #142a63); }
.mtile.nets-bowl { background: linear-gradient(150deg, #8a2f1d, #3a1a2e); }
.mtile i { font-size: 30px; font-style: normal; margin-bottom: auto; }
.mtile b { font-size: var(--t-md); font-weight: 900; }
.mtile small { font-size: var(--t-xs); color: #cfdcff; font-weight: 700; }
.mtile:active { transform: var(--press); }
.mcard.cup { border-color: #b8860b; background: linear-gradient(120deg, #4a3608, #1a2550); }
.cup-ico { font-size: 34px; font-style: normal; filter: drop-shadow(0 2px 6px #f59e0b99); }
.mstad { position: relative; overflow: hidden; background: linear-gradient(120deg, color-mix(in srgb, var(--a) 60%, #0a1430), color-mix(in srgb, var(--b) 60%, #0a1430)); border-color: #ffffff26; }
.mstad p { color: #e6eeff; }
.mstad .tags { display: flex; gap: 6px; margin-top: 8px; }
.mstad .tags span { padding: 3px 8px; border-radius: var(--r-pill); background: #00000047; font-size: var(--t-xs); font-weight: 800; color: #fff; }
.mstad.locked { filter: saturate(.35); }
.mstad.locked::before { content: ''; position: absolute; inset: 0; background: repeating-linear-gradient(135deg, #00000030 0 10px, #0000 10px 20px); pointer-events: none; }
.mstad .btn { position: relative; flex-direction: column; gap: 0; }
.stars { font-size: var(--t-sm); }

/* empty and sign-in states */
.empty, .auth { margin-top: 24px; padding: 24px 18px; border-radius: 20px; border: 1px solid var(--line); background: linear-gradient(180deg, var(--surface-2), var(--surface)); text-align: center; }
.empty > i, .auth > i { display: block; font-size: 44px; font-style: normal; margin-bottom: 6px; }
.empty h2, .auth h2 { margin: 0 0 6px; font-size: var(--t-xl); }
.empty p { color: var(--muted); font-size: var(--t-sm); margin-bottom: 16px; }
.perks { list-style: none; margin: 8px 0 16px; padding: 0; display: grid; gap: 6px; text-align: left; font-size: var(--t-sm); font-weight: 700; color: #d7e3ff; }
.perks li { padding: 10px 12px; border-radius: var(--r-sm); background: #ffffff0a; }
.auth .lead { margin: 12px 0 0; }
.form input, .form select { min-height: 48px; border-radius: var(--r-sm); background: #08112a; border-color: var(--line); }
.form input:focus, .form select:focus { outline: 2px solid var(--info); outline-offset: 1px; }

/* shared cards elsewhere (Team, Shop, Online) pick up the same surface */
.item, .stadium { border-radius: var(--r); background: linear-gradient(180deg, var(--surface-2), var(--surface)); box-shadow: var(--shadow-sm); }
.pcard { border-radius: var(--r); background: linear-gradient(180deg, var(--surface-2), var(--surface)); box-shadow: var(--shadow-sm); }
.sheet { border-radius: 20px; background: linear-gradient(180deg, var(--surface-2), var(--surface)); box-shadow: var(--shadow); animation: sheet-in .22s var(--ease); }
.modal { background: #000a; backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px); animation: fade-in .2s; }
@keyframes sheet-in { from { opacity: 0; transform: translateY(16px) scale(.98); } }
@keyframes fade-in { from { opacity: 0; } }
#toast { border-radius: var(--r-sm); padding: 12px 16px; font-weight: 800; background: #0b1530f2; border: 1px solid var(--line); box-shadow: var(--shadow); }

/* ======================================================================================================
   In the match. Sizes on the --u grid of the reference recording, with floors so nothing drops under ~12px.
   ====================================================================================================== */
.hud-top .banner span { font-size: max(12px, calc(34 * var(--u))); }
.hud-top .scores b small { font-size: .52em; font-weight: 900; opacity: .9; margin-left: 1px; }

/* the information panel (js/components/match-hud.js): top right, over the stands */
.hud-info {
  position: absolute; right: calc(24 * var(--u)); top: calc(790 * var(--u)); width: clamp(132px, calc(400 * var(--u)), 168px); z-index: 2; pointer-events: none;
  padding: 8px 10px; border-radius: var(--r-sm); background: #071233d9; border: 1px solid #ffffff1f; box-shadow: var(--shadow-sm);
  color: #fff; font-family: 'Nunito', system-ui, sans-serif;   /* no backdrop blur over the 3D view: it costs a full-screen pass every frame */
}
#match:has(#ball-info[hidden]) .hud-info, #match:has(#bowl-ctl:not([hidden])) .hud-info { top: calc(530 * var(--u)); }
.hi-title { display: block; margin-bottom: 4px; font-size: var(--t-xs); font-weight: 900; letter-spacing: .6px; text-transform: uppercase; color: var(--accent); }
.hi-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 2px 10px; }   /* two tallies a row: the panel stays short and over the stands */
.hi-stat { display: flex; align-items: baseline; justify-content: space-between; flex-direction: row-reverse; font-size: var(--t-xs); font-weight: 700; color: #cfdcff; }
.hi-stat em { font-style: normal; font-size: var(--t-md); font-weight: 900; color: #fff; }
.hi-stat::before { content: ''; order: 3; width: 7px; height: 7px; margin-right: 6px; border-radius: 50%; background: #ffffff60; }
.hi-stat { position: relative; padding-left: 13px; }
.hi-stat::before { position: absolute; left: 0; top: 50%; margin-top: -3.5px; }
.hi-stat.perfect::before { background: #6af8f8; } .hi-stat.good::before { background: #46da00; }
.hi-stat.miss::before { background: #feb50b; } .hi-stat.out::before { background: #ff3b47; }
.hi-line { display: block; margin-top: 3px; font-size: var(--t-xs); font-weight: 700; line-height: 1.3; color: #dbe6ff; text-transform: none; }
.hi-line b { color: #fff; font-weight: 900; }

/* practice options (js/components/shot-selector.js): one segmented control, at thumb height */
.shot-sel {
  position: absolute; left: 50%; transform: translateX(-50%); z-index: 3; display: flex; gap: 6px; align-items: center; pointer-events: auto;
  bottom: calc(max(calc(126 * var(--u)), calc(env(safe-area-inset-bottom) + 14px)) + clamp(48px, calc(140 * var(--u)), 60px));
  font-family: 'Nunito', system-ui, sans-serif;
}
#match:has(#bowl-ctl:not([hidden])) .shot-sel { bottom: calc(306 * var(--u)); }   /* bowling: just above BOWL, clear of the pitch where you aim */
.quality, .callout { z-index: 3; }   /* the result words go over the panels */
.ss-group { display: flex; padding: 3px; gap: 2px; border-radius: var(--r-pill); background: #071233e0; border: 1px solid #ffffff26; box-shadow: var(--shadow-sm); }
.ss-group button, .ss-toggle {
  min-height: 40px; min-width: 56px; padding: 0 12px; white-space: nowrap; border: 0; border-radius: var(--r-pill); background: none; color: #cfdcff; cursor: pointer;
  font: 800 var(--t-sm) 'Nunito', system-ui, sans-serif; transition: background .18s var(--ease), color .18s, transform .1s;
}
.ss-group button.on { background: #fff; color: #0b2a6b; box-shadow: 0 2px 6px #0006; }
.ss-group button:active, .ss-toggle:active { transform: var(--press); }
.ss-toggle { display: inline-flex; align-items: center; gap: 6px; background: #071233e0; border: 1px solid #ffffff26; }
.ss-toggle i { width: 26px; height: 16px; border-radius: 8px; background: #ffffff33; position: relative; transition: background .18s; }
.ss-toggle i::after { content: ''; position: absolute; left: 2px; top: 2px; width: 12px; height: 12px; border-radius: 50%; background: #fff; transition: transform .18s var(--ease); }
.ss-toggle.on { color: #fff; }
.ss-toggle.on i { background: var(--primary); }
.ss-toggle.on i::after { transform: translateX(10px); }

/* the timing meter: labels legible, and a glow in the zone the shot landed in (js/components/timing-meter.js) */
.t-legend { font-size: max(11px, calc(30 * var(--u))) !important; }
.timing .tbar { transition: box-shadow .3s; }
.timing.glow .tbar { animation: meter-glow 1.2s ease-out; }
.timing.perfect.glow .tbar { --g: #6af8f8; } .timing.good.glow .tbar { --g: #46da00; }
@keyframes meter-glow { 0% { box-shadow: 0 0 0 0 var(--g), 0 0 28px 6px var(--g); } 100% { box-shadow: 0 0 0 0 #0000, 0 0 0 0 #0000; } }
#timing-dot { box-shadow: 0 0 8px 2px #fff, 0 0 0 1px #0009; }

/* a wicket: the screen flashes red */
.flash { position: absolute; inset: 0; z-index: 4; pointer-events: none; opacity: 0; background: radial-gradient(ellipse at 50% 45%, #ff3b4700 30%, #ff1e2acc 100%); }
.flash.on { animation: flash .7s ease-out forwards; }
@keyframes flash { 0% { opacity: 0; } 15% { opacity: 1; } 100% { opacity: 0; } }

/* the match's dialogs (js/components/modal.js): one style, thumb-sized, the destructive action red */
.mdlg { background: #000000b3; animation: fade-in .18s; }
.mdlg .mbox {
  left: 50%; top: 50%; width: min(92vw, 380px); transform: translate(-50%, -50%); padding: 22px 18px 18px; border-radius: 22px;
  background: linear-gradient(180deg, #1d3a8f, #12286a); border: 1px solid #ffffff2e; box-shadow: 0 20px 50px #000c; text-align: center; animation: sheet-in .22s var(--ease);
}
.mdlg #menu-quit { top: 50%; }
.mdlg .mbox h3 { margin: 0 0 16px; font-size: var(--t-xl); }
.mdlg .mbox h3::after { display: none; }
.mdlg .mbox .mx { right: 10px; top: 10px; width: 44px; height: 44px; border-radius: 50%; font-size: 18px; background: #ffffff14; }
.mdlg .mrow { min-height: 56px; padding: 0 14px; border-radius: var(--r-sm); background: #ffffff12; font-size: var(--t-md); }
.mdlg .mswitch { width: 100%; border: 0; color: #fff; font: 800 var(--t-md) 'Nunito', system-ui, sans-serif; cursor: pointer; }
.mdlg .mrow.msg { padding: 14px; min-height: 0; background: none; font-size: var(--t-md); font-weight: 700; color: #dbe6ff; line-height: 1.45; }
.mdlg .mcheck { width: 52px; height: 30px; border-radius: 15px; background: #ffffff33; box-shadow: none; position: relative; transition: background .18s; }
.mdlg .mcheck::after { content: ''; position: absolute; left: 3px; top: 3px; width: 24px; height: 24px; margin: 0; border: 0; border-radius: 50%; background: #fff; transform: none; box-shadow: 0 1px 3px #0006; transition: transform .18s var(--ease); }
.mdlg .mcheck.on { background: var(--primary); box-shadow: none; }
.mdlg .mcheck.on::after { width: 24px; height: 24px; margin: 0; border: 0; transform: translateX(22px); }
.mdlg .mbtn {
  display: block; width: 100%; min-width: 0; height: 52px; margin: 10px 0 0; border-radius: var(--r-sm); font-size: var(--t-md); letter-spacing: .3px;
  transition: transform .12s var(--ease), filter .12s;
}
.mdlg .mbtn:active { transform: var(--press); filter: brightness(1.1); }
.mdlg .mbtn.ghost { background: #ffffff14; box-shadow: inset 0 0 0 1px #ffffff2e; }
.mdlg .mbtn.red { background: linear-gradient(#f87171, #dc2626); box-shadow: inset 0 1px 0 #ffffff50, 0 4px 0 #8f1414; }
.mdlg .mbtn.green { background: linear-gradient(#3ee07c, #16a34a); box-shadow: inset 0 1px 0 #ffffff50, 0 4px 0 #0d6b31; color: var(--on-primary); text-shadow: none; }
.mdlg .macts { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.mdlg .macts .mbtn { margin-top: 6px; }

/* the bowling sheet's buttons share the press feel */
.bcard:active, .bs-del button:active, .bseg button:active, .bs-others button:active, .field-btn:active, .ball-btn:active { transform: var(--press); }
.bs-del button, .bseg button, .bs-others button { transition: transform .12s var(--ease), background .18s; }
#match:has(#bowl-ctl:not([hidden])) .ss-group button { min-width: 0; padding: 0 11px; }   /* bowling: narrower, so it sits clear of the bowler card */

/* ---------- icons in place of words (js/components/icons.js): the screen is left to the ball ---------- */
#match svg .solid { fill: currentColor; stroke: none; }
.hud-info { width: auto; max-width: calc(100vw - 24px); padding: 6px 8px; display: flex; flex-direction: column; align-items: flex-end; gap: 5px; background: #071233c7; }
.hi-items { display: flex; gap: 8px; }
#match:not(.bowling) .hi-items { flex-direction: column; align-items: stretch; gap: 6px; }   /* batting: the tallies one above another */
#match:not(.bowling) .hi-item { justify-content: space-between; gap: 10px; }
.hi-item { display: inline-flex; align-items: center; gap: 3px; color: #fff; }
.hi-item svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; color: #cfdcff; }
.hi-item em { font: 900 var(--t-md)/1 'Nunito', system-ui, sans-serif; font-style: normal; }
.hi-item.perfect svg { color: #6af8f8; } .hi-item.good svg { color: #46da00; } .hi-item.miss svg { color: #feb50b; } .hi-item.out svg { color: #ff5a63; }
.hi-chips { display: flex; gap: 6px; }
.hi-chip { display: inline-flex; align-items: center; gap: 2px; padding: 3px 6px; border-radius: var(--r-pill); background: #ffffff14; border: 1px solid #ffffff26; }
.hi-chip svg { width: 16px; height: 16px; fill: none; stroke: #fff; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.hi-chip.good { border-color: #46da0080; } .hi-chip.good svg:first-child { stroke: #46da00; }
.hi-chip.miss { border-color: #feb50b80; } .hi-chip.miss svg:first-child { stroke: #feb50b; }

/* the practice selector: symbols at a thumb's size */
.ss-group button, .ss-toggle { min-width: 48px; min-height: 44px; padding: 0 10px; display: inline-flex; align-items: center; justify-content: center; }
.ss-group svg, .ss-toggle svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.ss-group button.on svg { color: #0b2a6b; }
.ss-toggle { border-radius: var(--r-pill); }
.ss-toggle.on { background: var(--primary); color: var(--on-primary); border-color: #86efac; }

/* bowling: under the field map, the field in use and a finger to say the map can be tapped */
.radar-tag {
  position: absolute; left: calc(236 * var(--u) - 34px); top: calc(925 * var(--u)); width: 68px; height: 30px; z-index: 2; pointer-events: none;
  display: flex; align-items: center; justify-content: center; gap: 6px; border-radius: var(--r-pill); background: #071233c7; border: 1px solid #ffffff26; color: #fff;
}
.radar-tag svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.radar-tag svg:last-child { color: #ffe08a; animation: nudge 1.6s ease-in-out infinite; }
@keyframes nudge { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-3px); } }

/* the bowler's card: face, skill, then the delivery and the field as symbols */
.bcard { gap: 6px; padding: 8px 6px; }
.bcard::after { content: none; }
.bcard .bicons { display: flex; gap: 6px; }
.bcard .bico { display: grid; place-items: center; width: 32px; height: 32px; border-radius: 10px; background: #0007; }
.bcard .bico svg { width: 20px; height: 20px; fill: none; stroke: #fff; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }

/* batting: the bowler, top right, is his face and the kind of ball he bowls */
.bowler-badge .kind { display: grid; place-items: center; width: 34px; height: 34px; margin: 4px auto 0; border-radius: 50%; background: #071233c7; border: 1px solid #ffffff33; }
.bowler-badge .kind svg { width: 20px; height: 20px; fill: none; stroke: #fff; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.field-btn b { display: none; }
/* bowling: the panel goes on the left under the field map, so the batter at the far end is never covered */
#match:has(#bowl-ctl:not([hidden])) .hud-info, #match.bowling .hud-info { right: auto; left: calc(24 * var(--u)); top: calc(1010 * var(--u)); align-items: flex-start; }

/* contact outcomes (js/match.js): an edge in amber; a six in gold with a bigger word, a four in blue */
.quality.edge, .quality.early, .quality.late { color: #ffe1b0; -webkit-text-stroke-color: #d9771a; }
.callout.runs.six:not(.theirs) b { -webkit-text-stroke-color: #c98a00; text-shadow: 0 0 calc(36 * var(--u)) #ffd23acc, 0 calc(6 * var(--u)) 0 #7a4f00; color: #fff6d0; }
.callout.runs.six:not(.theirs) span { background: linear-gradient(90deg, #ffd23a00, #ffb300 20%, #ffb300 80%, #ffd23a00); color: #3a2600; text-shadow: none; letter-spacing: calc(6 * var(--u)); }
.callout.runs.four span { letter-spacing: calc(6 * var(--u)); }

/* ---------- batting moments (js/match.js) ---------- */
/* a near miss: a line under the word */
.note {
  position: absolute; left: 50%; top: calc(50% + 96 * var(--u)); transform: translateX(-50%); z-index: 3; pointer-events: none; white-space: nowrap; opacity: 0;
  padding: 5px 12px; border-radius: 999px; background: #0a1422d1; font: 800 max(12px, calc(38 * var(--u)))/1.2 'Nunito', system-ui, sans-serif; color: #ffd9a0;
  animation: note 2.2s forwards;
}
.note:empty { display: none; }
@keyframes note { 0% { opacity: 0; margin-top: 8px; } 10%, 80% { opacity: 1; margin-top: 0; } 100% { opacity: 0; } }

/* LBW: the appeal, the umpire (and the review), ball tracking */
.appeal { position: absolute; inset: 0; z-index: 4; pointer-events: none; font-family: 'Nunito', system-ui, sans-serif; color: #fff; }
.appeal button { pointer-events: auto; }
.ap-howzat {
  position: absolute; left: 0; right: 0; top: 30%; text-align: center; font: italic 900 calc(170 * var(--u))/1 'Nunito', system-ui, sans-serif;
  -webkit-text-stroke: calc(6 * var(--u)) #c8102e; paint-order: stroke fill; text-shadow: 0 calc(10 * var(--u)) 0 #0007; animation: howzat .5s var(--ease) both;
}
@keyframes howzat { from { transform: scale(1.6) rotate(-4deg); opacity: 0; } to { transform: scale(1) rotate(-4deg); opacity: 1; } }
.ap-ump {
  position: absolute; left: 0; right: 0; top: 62%; margin: 0 auto; width: min(300px, 80vw); box-sizing: border-box; padding: 14px 16px; border-radius: 20px;   /* centred without a transform: the entrance animation uses one */
  display: flex; flex-direction: column; align-items: center; gap: 9px; background: #0a1422e6; border: 2px solid #ffffff2e; box-shadow: 0 10px 30px #0008; animation: sheet-in .22s var(--ease);
}
.ap-ump small { font-size: 12px; font-weight: 900; letter-spacing: 2px; color: #aeb5c2; }
.ap-ump > b { font-size: 34px; font-weight: 900; line-height: 1; }
.ap-ump > b.out { color: #ff6b73; }
.ap-review {
  display: inline-flex; align-items: center; gap: 8px; min-height: 46px; padding: 0 20px; border: 0; border-radius: 999px; cursor: pointer;
  background: #1f6feb; color: #fff; font: 900 16px 'Nunito', system-ui, sans-serif; box-shadow: 0 4px 0 #0d3f91;
}
.ap-review svg { width: 20px; height: 20px; fill: none; stroke: #fff; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
.ap-review:active { transform: translateY(2px); box-shadow: 0 2px 0 #0d3f91; }
.ap-accept { min-height: 36px; padding: 0 14px; border: 0; border-radius: 999px; background: #ffffff14; color: #c9ced8; font: 800 13px 'Nunito', system-ui, sans-serif; cursor: pointer; }
.ap-tag { position: absolute; left: 50%; top: 14%; transform: translateX(-50%); padding: 6px 14px; border-radius: 999px; background: #1f6feb; font-size: 13px; font-weight: 900; letter-spacing: 2px; white-space: nowrap; }
.ap-verdict {
  position: absolute; left: 0; right: 0; top: 20%; text-align: center; font: italic 900 calc(150 * var(--u))/1 'Nunito', system-ui, sans-serif;
  -webkit-text-stroke: calc(5 * var(--u)) #2fbf55; paint-order: stroke fill; text-shadow: 0 calc(8 * var(--u)) 0 #0007; animation: howzat .4s var(--ease) both;
}
.ap-verdict.out { -webkit-text-stroke-color: #c8102e; }
.ap-verdict small { display: block; margin-top: 6px; font: 900 13px 'Nunito', system-ui, sans-serif; letter-spacing: 2px; -webkit-text-stroke: 0; color: #ffd9a0; }
.appeal ul {
  position: absolute; left: 50%; top: 29%; transform: translateX(-50%); width: min(280px, 78vw);   /* up under the verdict, clear of the stumps */ box-sizing: border-box;
  margin: 0; padding: 10px 14px; list-style: none; border-radius: 16px; background: #0a1422e6; display: flex; flex-direction: column; gap: 6px;
}
.appeal ul:empty { display: none; }
.appeal li { display: flex; justify-content: space-between; font-size: 14px; font-weight: 900; animation: sheet-in .2s var(--ease); }
.appeal li span { color: #aeb5c2; } .appeal li b.ok { color: #7df58a; } .appeal li b.no { color: #ff7a7a; }

/* the last over of a chase: what is needed, a red edge with a heartbeat */
.pressure-pill {
  position: absolute; left: 50%; top: 20%; transform: translateX(-50%); z-index: 2; pointer-events: none; display: flex; align-items: center; gap: 10px; white-space: nowrap;
  padding: 8px 18px; border-radius: 999px; background: #c8102e; box-shadow: 0 4px 14px #0007; font: 900 max(18px, calc(66 * var(--u)))/1 'Nunito', system-ui, sans-serif; color: #fff;
  animation: beat .8s ease-in-out infinite;
}
.pressure-pill svg { width: 1em; height: 1em; fill: none; stroke: #fff; stroke-width: 2.6; stroke-linecap: round; stroke-linejoin: round; }
#match.pressure .vignette { box-shadow: inset 0 0 calc(220 * var(--u)) calc(50 * var(--u)) #c8102e8c; animation: beat .8s ease-in-out infinite; }
@keyframes beat { 0%, 100% { opacity: .75; } 12% { opacity: 1; } 28% { opacity: .82; } 40% { opacity: 1; } }

/* a field change, called out under the field map */
.field-call {
  position: absolute; left: calc(24 * var(--u)); top: calc(925 * var(--u)); z-index: 2; pointer-events: none; max-width: 62vw; opacity: 0;
  padding: 7px 12px; border-radius: 12px; background: #0a1422e0; border: 1px solid #ffb547; font: 800 max(12px, calc(36 * var(--u)))/1.25 'Nunito', system-ui, sans-serif; color: #fff;
  animation: note 3s forwards;
}
.field-call:empty { display: none; }
.field-call b { display: block; font-size: .78em; letter-spacing: 1px; color: #ffb547; }

/* a milestone: up on screen after the runs */
.milestone {
  position: absolute; left: 0; right: 0; top: 31%; z-index: 3; pointer-events: none; display: flex; flex-direction: column; align-items: center; gap: 6px; opacity: 0;
  animation: pop 2.6s 1.1s forwards;
}
.milestone:empty { display: none; }
.milestone b { font: italic 900 calc(230 * var(--u))/1 'Nunito', system-ui, sans-serif; color: #fff6d0; -webkit-text-stroke: calc(8 * var(--u)) #c98a00; paint-order: stroke fill; text-shadow: 0 0 calc(80 * var(--u)) #ffd23acc, 0 calc(14 * var(--u)) 0 #0006; }
.milestone span { padding: 6px 14px; border-radius: 999px; background: #0a1422d9; font: 900 15px 'Nunito', system-ui, sans-serif; color: #fff; }

/* watching someone else's match: a LIVE tag and the BET button; the odds come up as a sheet over the bottom of the game */
.spec-bar { position: absolute; right: 12px; bottom: calc(24px + env(safe-area-inset-bottom)); z-index: 3; display: flex; align-items: center; gap: 10px; }
.spec-live { padding: 6px 10px; border-radius: 999px; background: #c8102e; color: #fff; font: 900 12px 'Nunito', system-ui, sans-serif; letter-spacing: 1px; box-shadow: 0 2px 8px #0006; }
.spec-live::before { content: ''; display: inline-block; width: 8px; height: 8px; margin-right: 6px; border-radius: 50%; background: #fff; animation: beat 1s ease-in-out infinite; }
.spec-bets { min-width: 84px; min-height: 52px; padding: 0 18px; border: 0; border-radius: 999px; cursor: pointer; background: linear-gradient(#ffd23a, #f0a500); color: #3a2600; font: 900 20px 'Nunito', system-ui, sans-serif; box-shadow: 0 4px 0 #9a6a00, 0 6px 16px #0007; }
.spec-bets:active { transform: translateY(2px); box-shadow: 0 2px 0 #9a6a00; }
.spec-bets.locked { filter: grayscale(.6) brightness(.85); }
#modal.over-match { place-items: end center; padding: 0; background: #0005; backdrop-filter: none; -webkit-backdrop-filter: none; }
#modal.over-match .sheet { width: 100%; max-width: 520px; max-height: 64dvh; overflow-y: auto; border-radius: 20px 20px 0 0; padding-bottom: calc(14px + env(safe-area-inset-bottom)); }
#match:has(#spec-bar:not([hidden])) .hint { bottom: calc(92px + env(safe-area-inset-bottom)); }   /* watching: the line about the bowler sits above LIVE and BET */

/* friends: online (green) or not (grey), before the name */
.presence { display: inline-block; width: 10px; height: 10px; margin-right: 8px; border-radius: 50%; background: #5a6478; vertical-align: middle; }
.presence.on { background: #37e01f; box-shadow: 0 0 0 3px #37e01f40; }

/* the shop's bats: the blade face-on, and three bars for how it plays */
.bat-ico { display: grid; place-items: center; flex: none; width: 46px; height: 92px; }
.bat-ico svg { width: 30px; height: 88px; filter: drop-shadow(0 2px 3px #0007); }
.bat-stats { display: flex; flex-direction: column; gap: 4px; margin-top: 8px; }
.bat-stat { display: grid; grid-template-columns: 58px 1fr; align-items: center; gap: 8px; font-size: 12px; }
.bat-stat b { font-weight: 800; color: #c9d3e6; }
.bat-stat i { display: block; height: 7px; border-radius: 999px; background: #ffffff1f; overflow: hidden; }
.bat-stat s { display: block; height: 100%; border-radius: 999px; background: linear-gradient(90deg, #46da00, #c6ff3d); text-decoration: none; }

/* batting: the bowler's card under his face (js/match.js): name, kind, a line about him, his variations */
.bowler-badge .bb-name { font-size: max(13px, calc(37 * var(--u))); line-height: 1.2; }
.bowler-badge .bb-kind { font-size: max(11px, calc(30 * var(--u))); line-height: 1.2; color: #ffe14a; }
.bowler-badge .bb-desc { display: block; margin: 2px 0 4px; font-size: max(10px, calc(24 * var(--u))); line-height: 1.25; font-weight: 700; color: #dbe6ff; white-space: normal; }
.bowler-badge .bb-vars { display: flex; flex-direction: column; align-items: stretch; gap: 3px; }
.bowler-badge .bb-vars i { display: flex; align-items: center; gap: 5px; padding: 2px 7px; border-radius: var(--r-pill); background: #071233c7; border: 1px solid #ffffff26;
  font: 800 max(10px, calc(24 * var(--u)))/1.3 'Nunito', system-ui, sans-serif; font-style: normal; text-align: left; white-space: nowrap; text-shadow: none; transition: background .2s, border-color .2s; }
.bowler-badge .bb-vars i svg { flex: none; width: 13px; height: 13px; fill: none; stroke: #fff; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
.bowler-badge .bb-vars i svg .solid { fill: #fff; stroke: none; }
.bowler-badge .bb-vars i.on { background: #2f6bff; border-color: #fff; }
/* the tallies go on the left while you bat, clear of the bowler's card on the right */
#match:not(.bowling) .hud-info { right: auto; left: calc(24 * var(--u)); top: calc(930 * var(--u)); align-items: flex-start; }

/* ---------- gameplay additions: shot buttons, camera style, pitch conditions, bowling variations ---------- */
/* batting, bottom right: DRIVE, LOFT and DEFEND as round buttons (newgp/ reference). A lit one holds for every ball until tapped again */
.shot-type { position: absolute; right: max(calc(26 * var(--u)), 8px); bottom: max(calc(330 * var(--u)), calc(env(safe-area-inset-bottom) + 112px)); z-index: 2;
  display: grid; grid-template-columns: repeat(2, auto); grid-template-areas: '. drive' 'loft defend'; gap: 8px; pointer-events: auto; }
.shot-type[hidden] { display: none; }
.shot-type button { --d: max(58px, calc(150 * var(--u))); width: var(--d); height: var(--d); padding: 0; border-radius: 50%; border: 2px solid #ffffffb3; cursor: pointer;
  display: grid; place-items: center; align-content: center; gap: 1px; color: #fff; background: radial-gradient(circle at 50% 30%, #2f7ee8, #0d3f92 72%);
  box-shadow: 0 3px 0 #061f4f, 0 6px 14px #0007; font: 900 max(9px, calc(22 * var(--u))) 'Nunito', system-ui, sans-serif; letter-spacing: .4px;
  transition: transform .12s var(--ease), background .18s, border-color .18s; touch-action: manipulation; }
.shot-type button[data-shot="drive"] { grid-area: drive; } .shot-type button[data-shot="loft"] { grid-area: loft; } .shot-type button[data-shot="defend"] { grid-area: defend; }
.shot-type button svg { width: 40%; height: 40%; min-width: 22px; min-height: 22px; fill: none; stroke: #fff; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
.shot-type button:active { transform: var(--press); }
.shot-type button.on { background: radial-gradient(circle at 50% 30%, #3ce07a, #138a3f 72%); border: 3px solid #fff; transform: scale(1.08); box-shadow: 0 3px 0 #0a4a22, 0 0 0 5px #37e01f77, 0 6px 14px #0007; }
.shot-type button.on::after { content: '✓'; position: absolute; top: -4px; right: -4px; width: 20px; height: 20px; border-radius: 50%; background: #fff; color: #0c2462; font-size: 13px; line-height: 20px; }
.shot-type button { position: relative; }
.shot-type button[data-shot="loft"].on { background: radial-gradient(circle at 50% 30%, #57b5ff, #1565c7 72%); box-shadow: 0 3px 0 #0a2f73, 0 0 0 4px #3da5ff66, 0 6px 14px #0007; }
.shot-type button[data-shot="defend"].on { background: radial-gradient(circle at 50% 30%, #ffcd56, #c77a06 72%); box-shadow: 0 3px 0 #6b3d00, 0 0 0 4px #ffb52e66, 0 6px 14px #0007; }

/* Options: the camera style, its name and a few words about it on the right */
.mdlg .mval { display: flex; flex-direction: column; align-items: flex-end; font-weight: 900; color: var(--accent); line-height: 1.15; }
.mdlg .mval small { font-size: var(--t-xs); font-weight: 700; color: var(--muted); }

/* the pitch condition, before the toss and on the bowling sheet */
.pitch-chip { display: inline-block; margin-top: 10px; padding: 6px 12px; border-radius: var(--r-pill); background: #0006; border: 1px solid #ffffff26;
  box-shadow: inset 4px 0 0 var(--c, #f0b47a); font-size: var(--t-sm); line-height: 1.35; }
.bs-pitch { margin: 10px 0 0; padding: 8px 10px; border-radius: 10px; background: #0005; font-size: 12px; font-weight: 700; color: #dbe6ff; }
.bcard { position: relative; }
.bcard .bvary { position: absolute; left: 50%; bottom: -9px; transform: translateX(-50%); padding: 1px 8px; border-radius: var(--r-pill); background: #2f6bff; border: 1px solid #fff;
  font: 900 10px/1.4 'Nunito', system-ui, sans-serif; font-style: normal; color: #fff; white-space: nowrap; pointer-events: none; }

/* the People Polly logo in the top bar: a link to the website's home page */
a.brand { display: inline-flex; align-items: center; gap: 8px; color: #fff; text-decoration: none; font-style: normal; font-family: 'Barlow Condensed', 'Nunito', sans-serif; font-weight: 800; letter-spacing: .04em; }
a.brand img { width: 30px; height: 30px; border-radius: 7px; box-shadow: 0 0 0 1px #ffffff2e; }
a.brand span { color: #19C37D; }
