:root {
  /* Surfaces — layered dark navy with depth */
  --bg-0: #070b16;
  --bg-1: #0b1120;
  --surface: #131c30;
  --surface-2: #182238;
  --surface-3: #1e2b45;
  --line: rgba(255,255,255,.09);
  --line-2: rgba(255,255,255,.14);

  /* Text */
  --text: #f2f5ff;
  --muted: #8ea0c4;
  --faint: #5f7099;

  /* Accents (semantic) */
  --accent: #2ee06a;      /* brand / six */
  --accent-2: #16a34a;
  --blue: #3d8bff;        /* four */
  --amber: #f7b23b;       /* chase / extras */
  --danger: #f5455c;      /* wicket */

  /* Elevation */
  --sh-1: 0 1px 0 rgba(255,255,255,.05) inset, 0 10px 24px -14px rgba(0,0,0,.7);
  --sh-2: 0 1px 0 rgba(255,255,255,.06) inset, 0 20px 44px -20px rgba(0,0,0,.8);
  --glow-blue: 0 8px 26px -8px rgba(61,139,255,.55);
  --glow-green: 0 8px 26px -8px rgba(46,224,106,.5);
  --glow-red: 0 8px 26px -8px rgba(245,69,92,.5);

  --r-lg: 22px; --r-md: 16px; --r-sm: 11px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; height: 100%; }
body {
  background:
    radial-gradient(1100px 700px at 50% -15%, #17233f 0%, transparent 60%),
    radial-gradient(900px 600px at 100% 0%, rgba(61,139,255,.10), transparent 55%),
    radial-gradient(900px 700px at 0% 100%, rgba(46,224,106,.08), transparent 55%),
    var(--bg-0);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior: none;
  font-variant-numeric: tabular-nums;
}
#app { min-height: 100%; }

.wrap { max-width: 640px; margin: 0 auto; padding: calc(14px + var(--safe-top)) 16px calc(28px + var(--safe-bottom)); }

/* Typography */
h1, h2, h3 { margin: 0; font-weight: 800; letter-spacing: -0.02em; }
.muted { color: var(--muted); }
.tiny { font-size: 12px; }
.center { text-align: center; }
.eyebrow { font-size: 11px; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; color: var(--faint); }

/* Brand */
.brand { display: flex; align-items: center; gap: 10px; justify-content: center; margin: 8px 0 4px; }
.brand h1 { font-size: 26px; }
.subtitle { text-align: center; color: var(--muted); margin-bottom: 22px; font-size: 14px; }

.hero-logo {
  display: flex; justify-content: center; margin: 6px auto 14px; padding: 22px 26px; max-width: 380px;
  background: linear-gradient(180deg, #ffffff, #eef2f7); border-radius: var(--r-lg);
  box-shadow: 0 18px 40px -18px rgba(0,0,0,.7), inset 0 1px 0 rgba(255,255,255,.6);
}
.hero-logo img { width: 300px; max-width: 100%; height: auto; display: block; }
.logo-chip { display: inline-grid; place-items: center; width: 40px; height: 40px; border-radius: 11px; padding: 5px; background: linear-gradient(180deg, #ffffff, #e9edf3); box-shadow: 0 3px 10px rgba(0,0,0,.35); }
.logo-chip img { display: block; }

/* Cards */
.card {
  background: linear-gradient(180deg, var(--surface), var(--surface-2));
  border: 1px solid var(--line); border-radius: var(--r-lg); padding: 18px; margin-bottom: 14px;
  box-shadow: var(--sh-1);
}
.card h2 { font-size: 15px; margin-bottom: 14px; display: flex; align-items: center; gap: 9px; letter-spacing: -.01em; }
.card h2 .ic { color: var(--accent); }

/* Buttons */
button, .btn {
  font: inherit; font-weight: 700; color: var(--text);
  background: var(--surface-3); border: 1px solid var(--line-2); border-radius: var(--r-md);
  padding: 14px 16px; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  transition: transform .08s cubic-bezier(.2,.8,.3,1), filter .15s, background .15s, border-color .15s, box-shadow .15s;
  touch-action: manipulation; user-select: none;
}
button:active, .btn:active { transform: scale(.96); filter: brightness(1.08); }
button:disabled { opacity: .35; pointer-events: none; }
.btn-primary { background: linear-gradient(180deg, var(--accent), var(--accent-2)); border-color: transparent; color: #042311; box-shadow: var(--glow-green); }
.btn-blue { background: linear-gradient(180deg, #4f97ff, #2f6fe6); border-color: transparent; color: #fff; box-shadow: var(--glow-blue); }
.btn-danger { background: linear-gradient(180deg, #ff5568, #e0324a); border-color: transparent; color: #fff; box-shadow: var(--glow-red); }
.btn-ghost { background: transparent; border-color: transparent; }
.btn-ghost:hover { background: rgba(255,255,255,.05); }
.btn-block { display: flex; width: 100%; }
.btn-lg { padding: 17px 18px; font-size: 17px; min-height: 56px; }

.ic { flex: 0 0 auto; display: block; }
svg.ic { vertical-align: middle; }

/* Inputs */
input[type=text], input[type=number], select {
  font: inherit; width: 100%; color: var(--text);
  background: #0c1424; border: 1px solid var(--line-2); border-radius: var(--r-sm);
  padding: 13px 13px; outline: none; transition: border-color .15s, box-shadow .15s;
}
input:focus, select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(46,224,106,.18); }
label.field { display: block; margin-bottom: 12px; }
label.field .lbl { display: block; font-size: 12px; color: var(--muted); margin-bottom: 7px; font-weight: 700; letter-spacing: .02em; }
.inline { display: flex; align-items: center; gap: 10px; }
.row { display: flex; gap: 10px; }
.row > * { flex: 1; }
.stack > * + * { margin-top: 10px; }

/* Section label */
.lbl-sec { font-size: 11px; font-weight: 800; letter-spacing: .14em; text-transform: uppercase; color: var(--faint); margin: 18px 0 9px; }

/* Code pill */
.codepill { display: inline-flex; align-items: center; gap: 8px; background: #0c1424; border: 1px dashed var(--accent); color: var(--accent); font-weight: 800; letter-spacing: 4px; font-size: 22px; padding: 12px 18px; border-radius: 14px; }

/* Segmented control */
.seg { display: flex; background: #0c1424; border: 1px solid var(--line); border-radius: 14px; padding: 5px; gap: 4px; }
.seg button { flex: 1; background: transparent; border: none; padding: 12px; border-radius: 10px; color: var(--muted); font-weight: 700; }
.seg button.active { background: var(--surface-3); color: var(--text); box-shadow: 0 2px 8px -2px rgba(0,0,0,.5); }

/* Chips (players) */
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.chip { display: inline-flex; align-items: center; gap: 8px; background: #0c1424; border: 1px solid var(--line-2); border-radius: 999px; padding: 8px 8px 8px 13px; font-size: 14px; font-weight: 600; }
.chip button { padding: 0; width: 22px; height: 22px; border-radius: 999px; background: rgba(255,255,255,.06); border: none; color: var(--muted); }
.chip button:hover { color: var(--danger); }

/* Zone editor rows */
.zone-row { display: grid; grid-template-columns: 1fr 68px auto; gap: 8px; align-items: center; margin-bottom: 8px; }
.swatch { width: 14px; height: 14px; border-radius: 4px; flex: none; }
.toggle { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); white-space: nowrap; }
.toggle input { width: 18px; height: 18px; accent-color: var(--accent); }

/* Steps */
.steps { display: flex; flex-direction: column; gap: 14px; }
.step { display: flex; align-items: center; gap: 12px; }
.step-n { flex: 0 0 auto; width: 30px; height: 30px; border-radius: 10px; display: grid; place-items: center; font-weight: 800; font-size: 14px; background: linear-gradient(180deg, var(--accent), var(--accent-2)); color: #042311; }
.step-text { color: var(--muted); font-size: 14px; line-height: 1.35; }
.step-text b { color: var(--text); font-weight: 700; }

/* Topbar */
.topbar { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.topbar .code { font-weight: 800; letter-spacing: 3px; font-size: 15px; }
.status-dot { width: 8px; height: 8px; border-radius: 999px; background: var(--accent); display: inline-block; box-shadow: 0 0 0 3px rgba(46,224,106,.2); }
.status-dot.off { background: var(--danger); box-shadow: 0 0 0 3px rgba(245,69,92,.2); }
.badge { display: inline-flex; align-items: center; font-size: 11px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; padding: 6px 11px; border-radius: 999px; background: #0c1424; border: 1px solid var(--line-2); color: var(--muted); }

/* ============ SCORER HERO ============ */
.hero {
  border-radius: var(--r-lg); padding: 20px 18px 16px; margin-bottom: 14px; position: relative; overflow: hidden;
  background:
    radial-gradient(120% 100% at 50% -20%, rgba(61,139,255,.16), transparent 60%),
    linear-gradient(180deg, var(--surface-2), var(--surface));
  border: 1px solid var(--line-2); box-shadow: var(--sh-2);
}
.hero-team { text-align: center; font-weight: 800; font-size: 15px; letter-spacing: .02em; color: var(--muted); }
.hero-team b { color: var(--text); }
.hero-score { display: flex; align-items: baseline; justify-content: center; gap: 12px; margin: 2px 0 4px; }
.hs-num { font-size: 68px; font-weight: 900; line-height: 1; letter-spacing: -.04em; }
.hs-num .sep { color: var(--faint); margin: 0 2px; font-weight: 800; }
.hs-num .wkts { color: var(--muted); }
.hs-overs { display: inline-flex; align-items: baseline; gap: 4px; font-weight: 800; color: var(--muted); font-size: 16px; }
.hs-overs .ovlabel { font-size: 11px; letter-spacing: .1em; text-transform: uppercase; color: var(--faint); }
.hero-chips { display: flex; flex-wrap: wrap; justify-content: center; gap: 7px; margin-top: 8px; }
.stat { display: inline-flex; align-items: center; gap: 6px; background: rgba(255,255,255,.05); border: 1px solid var(--line); border-radius: 999px; padding: 6px 11px; font-size: 12px; font-weight: 700; color: var(--muted); }
.stat b { color: var(--text); }
.chase { margin-top: 12px; display: flex; align-items: center; justify-content: center; gap: 8px; padding: 11px; border-radius: 13px; background: linear-gradient(180deg, rgba(247,178,59,.16), rgba(247,178,59,.06)); border: 1px solid rgba(247,178,59,.35); color: var(--amber); font-weight: 800; font-size: 15px; }
.chase .big { font-size: 20px; }

/* current over dots */
.over-dots { display: flex; align-items: center; justify-content: center; gap: 7px; margin-top: 14px; }
.odot { width: 26px; height: 26px; border-radius: 999px; display: grid; place-items: center; font-size: 11px; font-weight: 800; background: rgba(255,255,255,.04); border: 1px solid var(--line); color: var(--muted); }
.odot.empty { border-style: dashed; color: transparent; }
.odot.four { background: var(--blue); border-color: transparent; color: #fff; }
.odot.six { background: var(--accent-2); border-color: transparent; color: #fff; }
.odot.w { background: var(--danger); border-color: transparent; color: #fff; }
.odot.ex { background: rgba(247,178,59,.18); border-color: rgba(247,178,59,.5); color: var(--amber); font-size: 10px; }

/* ============ BATTER / BOWLER STRIP ============ */
.figs-card { padding: 6px 4px; }
.batter-row, .bowler-row { display: flex; align-items: center; justify-content: space-between; padding: 12px 14px; border-radius: 12px; }
.batter-row.on { background: linear-gradient(90deg, rgba(46,224,106,.10), transparent); }
.batter-row + .batter-row { margin-top: 2px; }
.batter-row .name, .bowler-row .name { font-weight: 700; display: inline-flex; align-items: center; }
.batter-row .figs, .bowler-row .figs { color: var(--muted); font-weight: 700; font-size: 14px; }
.batter-row .figs b { color: var(--text); font-size: 16px; }
.bowler-row { border-top: 1px solid var(--line); margin-top: 6px; border-radius: 0 0 12px 12px; color: var(--muted); }
.striker-dot { flex: 0 0 auto; width: 9px; height: 9px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 3px rgba(46,224,106,.2); margin-right: 9px; }

/* ============ KEYPAD ============ */
.keypad { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.key { min-width: 0; aspect-ratio: 1.3; border-radius: 16px; font-size: 26px; font-weight: 900; letter-spacing: -.02em; background: linear-gradient(180deg, var(--surface-3), #16203a); border: 1px solid var(--line-2); }
.key:active { transform: scale(.94); }
.key-boundaries { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-top: 10px; }
.key-big { min-width: 0; border-radius: 16px; padding: 20px 0; font-size: 30px; font-weight: 900; }
.key-4 { background: linear-gradient(180deg, #4f97ff, #2f6fe6); border-color: transparent; color: #fff; box-shadow: var(--glow-blue); }
.key-6 { background: linear-gradient(180deg, var(--accent), var(--accent-2)); border-color: transparent; color: #042311; box-shadow: var(--glow-green); }

/* Zones */
.grid-zones { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.grid-zones .zone-btn { min-width: 0; }
.zone-btn { text-align: left; padding: 14px; border-radius: 14px; flex-direction: column; align-items: flex-start; justify-content: center; gap: 6px; background: linear-gradient(180deg, var(--surface-3), #16203a); border-width: 1.5px; }
.zone-btn .z-top { display: flex; align-items: baseline; gap: 8px; width: 100%; }
.zone-btn .z-name { font-weight: 800; font-size: 15px; }
.zone-btn .z-runs { font-size: 13px; color: var(--muted); font-weight: 700; margin-left: auto; }
.z-pill { font-size: 10px; font-weight: 800; letter-spacing: .04em; text-transform: uppercase; color: var(--amber); background: rgba(247,178,59,.14); border: 1px solid rgba(247,178,59,.35); padding: 3px 8px; border-radius: 999px; }

/* Extras chips */
.extras-row { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.extras-row button { min-width: 0; padding: 13px 4px; font-size: 13px; font-weight: 700; border-radius: 12px; background: #0f1830; }

/* Toolbar (undo/swap) */
.toolbar { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.toolbar button { background: transparent; border: 1px solid var(--line-2); color: var(--muted); font-weight: 700; }
.toolbar button:hover { color: var(--text); }

/* Ball-by-ball strip */
.timeline { display: flex; gap: 7px; overflow-x: auto; padding: 4px 0; scrollbar-width: none; }
.timeline::-webkit-scrollbar { display: none; }
.ball { flex: none; min-width: 34px; height: 34px; display: grid; place-items: center; border-radius: 999px; font-weight: 800; font-size: 13px; background: rgba(255,255,255,.04); border: 1px solid var(--line); color: var(--muted); }
.ball.w { background: var(--danger); border-color: transparent; color: #fff; }
.ball.four { background: var(--blue); border-color: transparent; color: #fff; }
.ball.six { background: var(--accent-2); border-color: transparent; color: #fff; }
.ball.ex { background: rgba(247,178,59,.16); border-color: rgba(247,178,59,.4); color: var(--amber); }

/* ============ DISPLAY (broadcast) ============ */
.display-wrap { min-height: 100vh; display: flex; flex-direction: column; padding: calc(22px + var(--safe-top)) 22px calc(22px + var(--safe-bottom)); }
.disp-top { display: flex; align-items: center; justify-content: space-between; }
.disp-code { font-weight: 800; letter-spacing: 3px; color: var(--faint); }
.disp-center { margin: auto 0; text-align: center; }
.display-team { font-size: clamp(24px, 6vw, 44px); font-weight: 800; letter-spacing: -.01em; }
.display-team .accent { display: inline-block; width: 44px; height: 5px; border-radius: 999px; background: var(--accent); vertical-align: middle; margin-bottom: 8px; }
.display-score { font-size: clamp(76px, 22vw, 200px); font-weight: 900; line-height: 1.02; letter-spacing: -.045em; margin: 6px 0 8px; }
.display-score .sep { color: var(--faint); }
.display-score .wkts { color: var(--muted); }
.display-overs { font-size: clamp(18px, 5vw, 34px); color: var(--muted); font-weight: 700; }
.disp-chips { display: flex; justify-content: center; flex-wrap: wrap; gap: 10px; margin-top: 14px; }
.disp-chips .stat { font-size: clamp(13px, 2.4vw, 18px); padding: 8px 14px; }
.display-target { margin-top: 16px; display: inline-flex; align-items: center; gap: 10px; color: var(--amber); font-size: clamp(17px, 4vw, 30px); font-weight: 800; padding: 10px 18px; border-radius: 14px; background: linear-gradient(180deg, rgba(247,178,59,.14), rgba(247,178,59,.05)); border: 1px solid rgba(247,178,59,.35); }
.display-result { margin-top: 16px; font-size: clamp(22px, 5vw, 40px); font-weight: 900; color: var(--accent); }
.disp-balls { display: flex; justify-content: center; gap: 8px; margin: 18px 0; }
.display-batters { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.display-batters .b { background: linear-gradient(180deg, var(--surface-2), var(--surface)); border: 1px solid var(--line); border-radius: 16px; padding: 16px 18px; box-shadow: var(--sh-1); }
.display-batters .b.on { border-color: rgba(46,224,106,.4); background: linear-gradient(180deg, rgba(46,224,106,.10), var(--surface)); }
.display-batters .b .n { font-weight: 800; font-size: clamp(17px, 4vw, 26px); display: inline-flex; align-items: center; }
.display-batters .b .f { color: var(--muted); font-size: clamp(14px, 3.5vw, 22px); font-weight: 700; margin-top: 2px; }
.display-batters .b .n .striker-dot { width: 13px; height: 13px; margin-right: 11px; }
.disp-bowler { display: flex; align-items: center; justify-content: center; gap: 12px; margin-top: 16px; flex-wrap: wrap; }
.disp-bowler .db-label { font-size: 11px; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; color: var(--amber); background: rgba(247,178,59,.14); border: 1px solid rgba(247,178,59,.35); padding: 5px 11px; border-radius: 999px; }
.disp-bowler .db-name { font-weight: 800; font-size: clamp(15px, 3.4vw, 22px); color: var(--text); }
.disp-bowler .db-figs { font-weight: 700; font-size: clamp(14px, 3vw, 20px); color: var(--muted); font-variant-numeric: tabular-nums; }

/* Modal */
.modal-back { position: fixed; inset: 0; background: rgba(3,7,18,.72); backdrop-filter: blur(4px); display: grid; place-items: end center; z-index: 50; }
.modal { width: 100%; max-width: 640px; background: linear-gradient(180deg, var(--surface-2), var(--bg-1)); border-top-left-radius: 26px; border-top-right-radius: 26px; border: 1px solid var(--line-2); padding: 10px 16px calc(20px + var(--safe-bottom)); box-shadow: 0 -20px 50px -20px rgba(0,0,0,.8); }
.modal::before { content: ""; display: block; width: 40px; height: 4px; border-radius: 999px; background: var(--line-2); margin: 6px auto 14px; }
.modal h3 { margin-bottom: 14px; font-size: 18px; }
.list-btns { display: grid; gap: 8px; }
.list-btns button { text-align: left; justify-content: flex-start; padding: 15px 16px; }

/* Toast */
.toast { position: fixed; left: 50%; bottom: calc(24px + var(--safe-bottom)); transform: translateX(-50%); background: var(--surface-2); border: 1px solid var(--line-2); padding: 13px 18px; border-radius: 13px; z-index: 60; box-shadow: var(--sh-2); font-weight: 600; }

.hr { height: 1px; background: var(--line); border: none; margin: 14px 0; }
.mini-meta { display: flex; justify-content: space-between; color: var(--muted); font-size: 13px; margin-top: 6px; }

/* ---- Camera overlay ---- */
.cam-overlay { position: fixed; inset: 0; background: #000; z-index: 80; display: flex; flex-direction: column; }
.cam-overlay video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.cam-top { position: relative; z-index: 2; display: flex; justify-content: space-between; align-items: center; padding: calc(12px + var(--safe-top)) 14px 12px; }
.cam-status { background: rgba(0,0,0,.55); padding: 9px 13px; border-radius: 999px; font-weight: 700; font-size: 14px; }
.cam-status.ok { background: var(--accent); color: #042311; }
.cam-close { background: rgba(0,0,0,.55); border: none; padding: 10px 14px; border-radius: 999px; }
.cam-pos { position: absolute; top: 40%; left: 50%; transform: translate(-50%,-50%); z-index: 3; font-size: 22px; font-weight: 900; background: rgba(0,0,0,.6); padding: 12px 18px; border-radius: 14px; opacity: 0; transition: opacity .2s; text-align: center; }
.cam-pos.show { opacity: 1; }
.cam-help { position: absolute; bottom: 220px; left: 0; right: 0; z-index: 2; text-align: center; color: #cbd5e1; font-size: 12px; padding: 0 20px; text-shadow: 0 1px 4px #000; }
.cam-zones { position: relative; margin-top: auto; z-index: 2; display: flex; flex-wrap: wrap; gap: 8px; padding: 14px 14px calc(18px + var(--safe-bottom)); background: linear-gradient(0deg, rgba(0,0,0,.85), transparent); }
.cam-zone { background: rgba(0,0,0,.55); border: 2px solid #fff; border-radius: 12px; padding: 12px 14px; font-weight: 700; font-size: 14px; }
.cam-zone.plain { flex: 0 0 auto; min-width: 52px; border-color: var(--line-2); }
.cam-zone .cz-runs { color: var(--accent); font-weight: 900; }
.cam-zone.hot { animation: pulse .6s ease infinite alternate; border-color: var(--accent); background: rgba(46,224,106,.35); }
@keyframes pulse { from { transform: scale(1); } to { transform: scale(1.06); } }

/* Camera-device page */
.cam-badge { display: inline-flex; align-items: center; gap: 8px; background: rgba(0,0,0,.6); border: 1px solid rgba(255,255,255,.2); padding: 9px 14px; border-radius: 999px; font-weight: 800; }
.cam-badge .ic { color: var(--accent); }
.cam-flagbar { position: relative; margin-top: auto; z-index: 2; padding: 16px 16px calc(20px + var(--safe-bottom)); background: linear-gradient(0deg, rgba(0,0,0,.85), transparent); }
.cam-flag { width: 100%; padding: 18px; border-radius: 16px; font-size: 18px; font-weight: 800; background: linear-gradient(180deg, var(--accent), var(--accent-2)); border: none; color: #042311; box-shadow: var(--glow-green); }

/* Camera count badge on the scorer */
.badge.cam-count .ic { color: var(--accent); margin-right: 2px; }

/* Scorer alert when a camera reports a hit */
.cam-alert-wrap { position: fixed; top: calc(10px + var(--safe-top)); left: 0; right: 0; z-index: 70; display: flex; flex-direction: column; align-items: center; gap: 8px; pointer-events: none; padding: 0 12px; }
.cam-alert { pointer-events: none; display: inline-flex; align-items: center; gap: 10px; background: linear-gradient(180deg, var(--surface-2), var(--surface)); border: 1px solid var(--accent); border-radius: 999px; padding: 10px 16px; font-size: 14px; box-shadow: var(--sh-2); animation: camAlertIn .3s ease, camAlertOut .4s ease 3.8s forwards; }
.cam-alert .ca-ic { display: inline-flex; color: var(--accent); }
.cam-alert .ca-side { color: var(--amber); font-weight: 800; text-transform: uppercase; letter-spacing: .04em; }
@keyframes camAlertIn { from { transform: translateY(-12px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
@keyframes camAlertOut { to { transform: translateY(-12px); opacity: 0; } }

/* ---- Celebration overlay ---- */
.celebrate { position: fixed; inset: 0; z-index: 90; pointer-events: none; display: grid; place-items: center; animation: celebBackdrop 1.9s ease forwards; }
.celeb-inner { position: relative; display: flex; flex-direction: column; align-items: center; }
.celeb-word { font-weight: 900; letter-spacing: -0.03em; line-height: 1; font-size: clamp(90px, 26vw, 360px); animation: celebWord 1.9s cubic-bezier(.2,.9,.2,1) forwards; }
.celeb-sub { margin-top: 6px; font-weight: 800; text-transform: uppercase; letter-spacing: 6px; font-size: clamp(16px, 4vw, 34px); opacity: 0; animation: celebSub 1.9s ease forwards; }
.celeb-shake { animation: celebWord 1.9s cubic-bezier(.2,.9,.2,1) forwards, celebShake .5s ease 3; }
@keyframes celebBackdrop { 0% { background: rgba(0,0,0,0); } 18% { background: rgba(5,10,20,.72); } 75% { background: rgba(5,10,20,.66); } 100% { background: rgba(0,0,0,0); } }
@keyframes celebWord { 0% { transform: scale(.3) rotate(-8deg); opacity: 0; } 18% { transform: scale(1.18) rotate(3deg); opacity: 1; } 32% { transform: scale(.98) rotate(0); } 42% { transform: scale(1.02); } 78% { transform: scale(1); opacity: 1; } 100% { transform: scale(1.12); opacity: 0; } }
@keyframes celebSub { 0%, 20% { opacity: 0; transform: translateY(10px); } 36% { opacity: 1; transform: translateY(0); } 78% { opacity: 1; } 100% { opacity: 0; } }
@keyframes celebShake { 0%,100% { margin-left: 0; } 25% { margin-left: -18px; } 75% { margin-left: 18px; } }
.celeb-burst { position: absolute; inset: 0; display: grid; place-items: center; }
.celeb-dot { position: absolute; width: 14px; height: 14px; border-radius: 3px; opacity: 0; animation: celebDot 1.2s ease-out forwards; }
@keyframes celebDot { 0% { transform: translate(0,0) scale(.3); opacity: 0; } 15% { opacity: 1; } 100% { transform: translate(var(--tx), var(--ty)) scale(1) rotate(240deg); opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .celeb-word, .celeb-sub, .celeb-dot, .celebrate { animation-duration: .8s; } .celeb-shake { animation: celebWord .8s ease forwards; } }

/* ===== Home (Option 1) ===== */
.home { max-width: 640px; margin: 0 auto; padding: calc(10px + var(--safe-top)) 18px calc(30px + var(--safe-bottom)); position: relative; }
.home::before { content:""; position:fixed; inset:0; z-index:-1; pointer-events:none;
  background:
    linear-gradient(180deg, rgba(7,11,22,.45) 0%, rgba(7,11,22,.78) 52%, #070b16 86%),
    url('/stadium.svg') center top / cover no-repeat; }
.home-top { display:flex; justify-content:space-between; align-items:center; }
.icon-btn { background:transparent; border:none; color:var(--muted); padding:8px; width:42px; height:42px; }
.icon-btn:hover { color:var(--text); }
.home-hero { text-align:center; padding: 8px 0 22px; }
.hero-logo-img { width: 300px; max-width: 84%; height:auto; display:inline-block; }
.hero-tag { margin-top: 16px; font-size: 20px; font-weight: 800; letter-spacing:-.01em; line-height:1.3; }

.hcard { background: linear-gradient(180deg,#101a31,#0b1322); border:1px solid var(--line-2); border-radius:20px; padding:18px; margin-bottom:16px; box-shadow: var(--sh-2); }
.hcard-head { display:flex; align-items:center; gap:14px; }
.hc-icon { flex:0 0 auto; width:56px; height:56px; border-radius:16px; display:grid; place-items:center; }
.hc-icon.green { color:var(--accent); background:rgba(46,224,106,.12); border:1.5px solid rgba(46,224,106,.55); }
.hc-icon.blue { color:var(--blue); background:rgba(61,139,255,.12); border:1.5px solid rgba(61,139,255,.55); }
.hc-text { flex:1; min-width:0; }
.hc-title { font-weight:800; font-size:18px; }
.hc-sub { color:var(--muted); font-size:13.5px; margin-top:3px; line-height:1.35; }
.hc-chev { color:var(--faint); flex:0 0 auto; }

.btn-xl { width:100%; margin-top:16px; padding:17px; border-radius:14px; font-size:17px; font-weight:800; border:none; cursor:pointer;
  display:inline-flex; align-items:center; justify-content:center; gap:10px; transition:transform .08s, filter .15s; }
.btn-xl:active { transform:scale(.98); filter:brightness(1.06); }
.btn-xl-green { background:linear-gradient(180deg,#2ee06a,#16a34a); color:#042311; box-shadow:var(--glow-green); }
.btn-xl-blue { background:linear-gradient(180deg,#3d8bff,#2f6fe6); color:#fff; box-shadow:var(--glow-blue); }
.btn-xl:disabled { opacity:.5; pointer-events:none; }

.code-field { display:flex; gap:10px; margin-top:14px; }
.code-input { flex:1; text-align:center; letter-spacing:6px; font-weight:800; font-size:18px; text-transform:uppercase; }
.code-input::placeholder { letter-spacing:4px; color:var(--faint); font-weight:700; }
.qr-btn { flex:0 0 auto; width:54px; border:1px solid var(--line-2); background:#0c1424; color:var(--muted); border-radius:12px; }
.qr-btn:hover { color:var(--text); }

.role-lbl { margin:16px 0 8px; font-size:13px; font-weight:700; color:var(--muted); }
.role-seg { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:10px; }
.role-pill { padding:12px 4px; border-radius:12px; background:#0c1424; border:1px solid var(--line-2); color:var(--muted); font-weight:700; font-size:14px;
  display:inline-flex; align-items:center; justify-content:center; gap:7px; }
.role-pill.active { color:var(--text); border-color:var(--blue); background:rgba(61,139,255,.12); }
.role-pill.active .ic { color:var(--blue); }

/* ===== New Scorer (mockup) ===== */
.sc { max-width: 640px; margin: 0 auto; padding: calc(6px + var(--safe-top)) 14px calc(94px + var(--safe-bottom)); }
.appbar { display: flex; align-items: center; gap: 10px; padding: 6px 2px 12px; }
.appbar-title { flex: 1; font-weight: 800; font-size: 18px; letter-spacing: .04em; }
.conn { display: inline-flex; align-items: center; gap: 7px; font-size: 13px; font-weight: 700; color: var(--accent); }
.conn.off { color: var(--danger); }
.conn-dot { width: 8px; height: 8px; border-radius: 50%; background: currentColor; box-shadow: 0 0 0 3px rgba(46,224,106,.18); }

.team-strip { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 10px;
  background: linear-gradient(180deg,#101a30,#0c1424); border: 1px solid var(--line-2); border-radius: 16px; padding: 14px 16px; box-shadow: var(--sh-1); }
.ts-side { display: flex; flex-direction: column; }
.ts-side.bowl { align-items: flex-end; text-align: right; }
.ts-name { font-size: 13px; font-weight: 800; letter-spacing: .02em; }
.ts-side.bat .ts-name { color: var(--blue); }
.ts-side.bowl .ts-name { color: var(--amber); }
.ts-score { font-size: 30px; font-weight: 900; letter-spacing: -.02em; }
.ts-bowl { font-size: 13px; font-weight: 700; color: var(--muted); margin-top: 4px; }
.ts-mid { text-align: center; }
.ts-ov { font-size: 22px; font-weight: 900; }
.ts-ov-l { font-size: 10px; letter-spacing: .12em; color: var(--faint); font-weight: 800; }
.ts-chase { text-align: center; margin-top: 8px; color: var(--amber); font-weight: 800; font-size: 14px; }

.strike-bar { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 12px 0; }
.sb-bat { display: flex; flex-direction: column; gap: 2px; padding: 11px 13px; border-radius: 13px; background: #0c1424; border: 1px solid var(--line); }
.sb-bat.on { background: linear-gradient(180deg, rgba(61,139,255,.14), rgba(61,139,255,.04)); border-color: rgba(61,139,255,.4); }
.sb-role { font-size: 10px; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; color: var(--faint); }
.sb-name { font-weight: 800; font-size: 15px; }
.sb-fig { color: var(--muted); font-weight: 700; font-size: 13px; }

.keypad-lg { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 10px; }
.key-lg { min-width: 0; aspect-ratio: 1.25; border-radius: 14px; font-size: 26px; font-weight: 900;
  background: linear-gradient(180deg, var(--surface-3), #16203a); border: 1px solid var(--line-2); }
.key-lg:active { transform: scale(.94); }
.key-lg.k4 { background: linear-gradient(180deg,#3d8bff,#2f6fe6); border-color: transparent; color: #fff; box-shadow: var(--glow-blue); }
.key-lg.k6 { background: linear-gradient(180deg,#2ee06a,#16a34a); border-color: transparent; color: #042311; box-shadow: var(--glow-green); }
.key-lg.k-dot { flex-direction: column; gap: 4px; font-size: 0; }
.key-lg.k-dot .kd { width: 12px; height: 12px; border-radius: 50%; background: var(--muted); }
.key-lg.k-dot .kd-l { font-size: 12px; font-weight: 700; color: var(--muted); }

.wicket-btn { width: 100%; margin-top: 12px; padding: 16px; border-radius: 14px; font-size: 18px; font-weight: 800;
  background: linear-gradient(180deg,#ff5568,#e0324a); border: none; color: #fff; box-shadow: var(--glow-red);
  display: inline-flex; align-items: center; justify-content: center; gap: 10px; }

.extras-lg { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 8px; }
.extras-lg button { min-width: 0; padding: 13px 4px; font-size: 13px; font-weight: 700; border-radius: 12px; background: #0f1830; border: 1px solid var(--line-2); }

/* Bottom tab bar */
.tabbar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 40; display: grid; grid-template-columns: repeat(5, 1fr);
  background: rgba(9,14,26,.92); backdrop-filter: blur(12px); border-top: 1px solid var(--line-2);
  padding: 8px 6px calc(8px + var(--safe-bottom)); }
.tab { display: flex; flex-direction: column; align-items: center; gap: 3px; background: transparent; border: none; color: var(--faint); font-size: 11px; font-weight: 700; padding: 4px; }
.tab.active { color: var(--accent); }
.tab .ic { display: block; }

/* ===== Duck (out for 0) ===== */
.duck-scene { background: transparent; }
.duck-stage { position: fixed; left: 0; bottom: 14%; width: 100%; height: 100px; pointer-events: none; }
.duck { position: absolute; bottom: 0; left: -140px; width: 96px; animation: duckCross 3s linear forwards; transform-origin: bottom center; }
.duck svg { display: block; animation: duckBob .32s ease-in-out infinite; }
.duck .d-legs rect { animation: duckStep .32s ease-in-out infinite; transform-origin: top center; }
.duck .d-legs rect:nth-child(2) { animation-delay: .16s; }
.duck-label { position: fixed; top: 34%; left: 0; right: 0; text-align: center; font-weight: 900; letter-spacing: .04em;
  font-size: clamp(34px, 9vw, 96px); color: #ffd23f; text-shadow: 0 0 40px rgba(255,210,63,.5), 0 6px 24px rgba(0,0,0,.6);
  animation: duckLabel 3s ease forwards; }
@keyframes duckCross { from { left: -140px; } to { left: 100%; } }
@keyframes duckBob { 0%,100% { transform: translateY(0) rotate(-2deg); } 50% { transform: translateY(-7px) rotate(2deg); } }
@keyframes duckStep { 0%,100% { transform: rotate(-16deg); } 50% { transform: rotate(16deg); } }
@keyframes duckLabel { 0% { opacity: 0; transform: scale(.7); } 14% { opacity: 1; transform: scale(1.06); } 26% { transform: scale(1); } 78% { opacity: 1; } 100% { opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .duck { animation-duration: 2s; } .duck svg, .duck .d-legs rect { animation: none; } }

/* ===== Match detail (Scoreboard/Scorecard/FoW/Overs sub-views) ===== */
.detail-wrap { padding: 4px 2px; }
.sbd-head { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 10px;
  background: linear-gradient(180deg,#101a30,#0c1424); border: 1px solid var(--line-2); border-radius: 16px; padding: 16px; }
.sbd-team { text-align: center; }
.sbd-team.a .sbd-tn { color: var(--blue); }
.sbd-team.b .sbd-tn { color: var(--amber); }
.sbd-tn { font-size: 13px; font-weight: 800; }
.sbd-ts { font-size: 30px; font-weight: 900; letter-spacing: -.02em; margin-top: 2px; }
.sbd-to { font-size: 12px; color: var(--muted); }
.sbd-vs { width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; border: 1px solid var(--line-2); font-weight: 800; font-size: 13px; color: var(--muted); }
.sbd-chase { display: flex; justify-content: space-between; gap: 8px; margin-top: 10px; padding: 10px 14px; background: #0c1424; border: 1px solid var(--line); border-radius: 12px; font-size: 13px; color: var(--muted); font-weight: 700; }
.sbd-chase b { color: var(--text); }
.accent-amber { color: var(--amber) !important; }
.sbd-result { text-align: center; margin-top: 12px; font-weight: 900; color: var(--accent); font-size: 18px; }

.st-head { display: flex; align-items: flex-end; justify-content: space-between; }
.st-cols { display: flex; gap: 0; }
.st-cols span { width: 40px; text-align: right; font-size: 10px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: var(--faint); }
.stat-table { background: #0c1424; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.st-row { display: grid; grid-template-columns: 1fr 84px 40px 40px 40px; align-items: center; padding: 11px 13px; border-bottom: 1px solid var(--line); font-size: 14px; }
.stat-table.bowl .st-row { grid-template-columns: 1fr 40px 40px 40px 40px; }
.st-row:last-child { border-bottom: none; }
.st-row.live { background: rgba(46,224,106,.06); }
.st-name { font-weight: 700; display: flex; align-items: center; min-width: 0; }
.st-name .st-out { color: var(--faint); font-weight: 600; font-size: 11.5px; margin-left: 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.st-runs { text-align: right; font-weight: 800; }
.st-c { text-align: right; color: var(--muted); font-variant-numeric: tabular-nums; }
.extras-line { color: var(--muted); font-size: 12.5px; margin: 8px 2px 0; }

.stat-cards { display: grid; grid-template-columns: repeat(auto-fit,minmax(90px,1fr)); gap: 10px; margin-top: 16px; }
.stat-card { background: #0c1424; border: 1px solid var(--line); border-radius: 12px; padding: 12px; text-align: center; }
.sc-lbl { font-size: 11px; font-weight: 700; color: var(--muted); }
.sc-val { font-size: 20px; font-weight: 900; margin-top: 4px; }

.sc-inn-head { font-weight: 800; font-size: 16px; margin: 8px 0 2px; }
.fow-list { background: #0c1424; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.fow-row { display: grid; grid-template-columns: 28px 64px 1fr auto; align-items: center; gap: 8px; padding: 11px 13px; border-bottom: 1px solid var(--line); font-size: 14px; }
.fow-row:last-child { border-bottom: none; }
.fow-n { width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; background: rgba(245,69,92,.16); color: var(--danger); font-weight: 800; font-size: 12px; }
.fow-score { font-weight: 800; }
.fow-name { font-weight: 600; }
.fow-ov { font-size: 12px; }

.ov-row { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 10px; padding: 10px 2px; border-bottom: 1px solid var(--line); }
.ov-num { font-size: 12px; font-weight: 800; color: var(--muted); width: 56px; }
.ov-balls { display: flex; gap: 6px; flex-wrap: wrap; }
.ov-balls .ball { width: 28px; height: 28px; min-width: 28px; font-size: 12px; }
.ov-runs { font-weight: 900; font-size: 16px; }

/* ===== Camera page (mockup) ===== */
.cam-page { max-width: 640px; margin: 0 auto; padding: calc(6px + var(--safe-top)) 14px calc(94px + var(--safe-bottom)); }
.cam-feed { position: relative; aspect-ratio: 16/10; border-radius: 16px; overflow: hidden; background: #05070d; border: 1px solid var(--line-2); }
.cam-vid { width: 100%; height: 100%; object-fit: cover; display: block; }
.cam-feed.no-feed::after { content: "Camera preview appears here on a real device"; position: absolute; inset: 0; display: grid; place-items: center; text-align: center; padding: 0 24px; color: var(--faint); font-size: 13px; font-weight: 600; }
.cam-feed-top { position: absolute; top: 12px; left: 12px; right: 12px; display: flex; justify-content: space-between; z-index: 2; }
.live-badge { display: inline-flex; align-items: center; gap: 6px; background: var(--danger); color: #fff; font-weight: 800; font-size: 12px; letter-spacing: .06em; padding: 5px 10px; border-radius: 8px; }
.lb-dot { width: 7px; height: 7px; border-radius: 50%; background: #fff; animation: pulse 1s infinite alternate; }
.view-count { display: inline-flex; align-items: center; gap: 5px; background: rgba(0,0,0,.55); color: #fff; font-weight: 700; font-size: 13px; padding: 5px 10px; border-radius: 8px; }
.cam-label-pill { position: absolute; left: 12px; bottom: 12px; z-index: 2; background: rgba(0,0,0,.55); color: #fff; font-weight: 700; font-size: 13px; padding: 5px 12px; border-radius: 999px; }
.cam-feed .cam-pos { z-index: 3; }

.cam-flag { width: 100%; margin-top: 14px; padding: 15px; border-radius: 14px; font-size: 16px; font-weight: 800;
  background: linear-gradient(180deg,#3d8bff,#2f6fe6); border: none; color: #fff; box-shadow: var(--glow-blue);
  display: inline-flex; align-items: center; justify-content: center; gap: 10px; }

.cam-angles { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 10px; }
.cam-angle { text-align: center; }
.ca-thumb { aspect-ratio: 16/11; border-radius: 12px; background: #0c1424; border: 1px solid var(--line-2); display: grid; place-items: center; color: var(--faint); }
.cam-angle.active .ca-thumb { border-color: var(--accent); color: var(--accent); box-shadow: 0 0 0 3px rgba(46,224,106,.15); }
.ca-name { font-size: 12px; font-weight: 700; color: var(--muted); margin-top: 6px; }
.cam-angle.active .ca-name { color: var(--text); }

.cam-controls { display: grid; grid-template-columns: repeat(5, minmax(0,1fr)); gap: 8px; }
.cam-ctl { flex-direction: column; gap: 6px; padding: 12px 2px; border-radius: 12px; background: #0c1424; border: 1px solid var(--line-2); color: var(--muted); font-size: 11px; font-weight: 700; }
.cam-ctl .ic { color: var(--text); }
.cam-ctl:active { transform: scale(.95); }

/* ===== Accounts / groups / admin ===== */
.acct-chip { display: inline-flex; align-items: center; gap: 8px; background: rgba(255,255,255,.06); border: 1px solid var(--line-2); border-radius: 999px; padding: 5px 12px 5px 5px; font-weight: 700; font-size: 13px; color: var(--text); }
.acct-av { width: 28px; height: 28px; border-radius: 50%; background: linear-gradient(180deg,var(--blue),#2f6fe6); display: grid; place-items: center; font-weight: 800; font-size: 13px; color: #fff; }
.ghost-link { width: 100%; margin: -6px 0 14px; background: transparent; border: none; color: var(--muted); font-weight: 700; display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 10px; }
.ghost-link:hover { color: var(--text); }
.ghost-link .ic { color: var(--accent); }

.group-row { display: flex; align-items: center; gap: 14px; text-align: left; width: 100%; margin-bottom: 10px; padding: 14px; }
.group-title { font-size: 22px; font-weight: 900; margin: 4px 0 6px; }

.hist-row, .user-row { display: flex; align-items: center; gap: 10px; padding: 11px 13px; border-bottom: 1px solid var(--line); }
.hist-row:last-child, .user-row:last-child { border-bottom: none; }
.hist-row > div:first-child, .user-row > div:first-child { flex: 1; min-width: 0; }
.hist-teams { font-weight: 700; font-size: 14px; }
.hist-sub { margin-top: 2px; }
.user-row { flex-wrap: wrap; }
.u-actions { display: flex; gap: 6px; flex-wrap: wrap; width: 100%; margin-top: 4px; }
.btn.tiny { padding: 7px 11px; font-size: 12px; border-radius: 9px; min-height: 0; }
.badge.ok { color: var(--accent); border-color: rgba(46,224,106,.4); }
.badge.warn { color: var(--amber); border-color: rgba(247,178,59,.4); }
.badge.bad { color: var(--danger); border-color: rgba(245,69,92,.4); }

.menu-acct { display: flex; align-items: center; gap: 12px; padding: 10px 4px 14px; border-bottom: 1px solid var(--line); margin-bottom: 6px; }
