@import url('https://fonts.googleapis.com/css2?family=Roboto:wght@400;500;700;900&family=Poppins:wght@500;700;900&family=Noto+Sans+Devanagari:wght@400;700&display=swap');

:root {
  --primary: #7c3aed;
  --secondary: #f59e0b;
  --accent: #22d3ee;
  --bg: #0b1020;
  --fg: #ffffff;
  --font: 'Roboto', sans-serif;
  --panel: rgba(15, 23, 42, 0.88);
  --panel-solid: #111827;
  --border: rgba(148, 163, 184, 0.28);
  --success: #22c55e;
  --danger: #ef4444;
}

* { box-sizing: border-box; }

html, body { margin: 0; padding: 0; font-family: var(--font); }

body.dashboard {
  min-height: 100vh;
  background: radial-gradient(circle at top left, #1e1b4b 0%, var(--bg) 55%);
  color: var(--fg);
}

body.light {
  --panel: rgba(255, 255, 255, 0.92);
  --panel-solid: #ffffff;
  --border: rgba(15, 23, 42, 0.12);
  background: #f1f5f9;
  color: #0f172a;
}

a { color: var(--accent); text-decoration: none; }
button, input, select, textarea { font-family: inherit; }

.container { width: min(1180px, 94vw); margin: 0 auto; padding: 24px 0 60px; }
.narrow { width: min(720px, 94vw); }

.topbar {
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; flex-wrap: wrap; padding: 18px 0; border-bottom: 1px solid var(--border);
  margin-bottom: 22px;
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 900; font-size: 20px; letter-spacing: -0.02em; }
.brand .ball { width: 30px; height: 30px; border-radius: 50%; background: var(--danger); box-shadow: inset -6px -4px 0 rgba(0,0,0,.25); }
.brand small { display: block; font-size: 11px; opacity: .65; font-weight: 500; }
.nav { display: flex; gap: 8px; flex-wrap: wrap; }

.btn {
  border: 1px solid var(--border); background: rgba(148,163,184,.12); color: inherit;
  padding: 10px 14px; border-radius: 10px; cursor: pointer; font-weight: 700; font-size: 14px;
  transition: transform .12s ease, background .2s ease, box-shadow .2s ease;
}
.btn:hover { background: rgba(148,163,184,.24); transform: translateY(-1px); }
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--primary); border-color: transparent; color: white; }
.btn.secondary { background: var(--secondary); border-color: transparent; color: #1f1300; }
.btn.danger { background: var(--danger); border-color: transparent; color: white; }
.btn.ghost { background: transparent; }
.btn.small { padding: 6px 10px; font-size: 12px; border-radius: 8px; }
.btn.active { box-shadow: 0 0 0 2px var(--accent); }
.btn:disabled { opacity: .45; cursor: not-allowed; transform: none; }

.card {
  background: var(--panel); border: 1px solid var(--border); border-radius: 16px;
  padding: 18px; box-shadow: 0 12px 40px rgba(0,0,0,.24); backdrop-filter: blur(10px);
}
.card h2, .card h3 { margin: 0 0 12px; }
.grid { display: grid; gap: 16px; }
.grid.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid.cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 860px) {
  .grid.cols-2, .grid.cols-3, .grid.cols-4 { grid-template-columns: 1fr; }
}

label { display: block; font-size: 12px; opacity: .78; margin: 10px 0 5px; }
input, select, textarea {
  width: 100%; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--border);
  background: rgba(15,23,42,.55); color: inherit; outline: none;
}
body.light input, body.light select, body.light textarea { background: #fff; color: #0f172a; }
input:focus, select:focus, textarea:focus { border-color: var(--accent); }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.row > * { flex: 1 1 auto; }
.muted { opacity: .68; }
.tiny { font-size: 11px; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
.center { text-align: center; }
.hidden { display: none !important; }
.badge {
  display: inline-flex; gap: 6px; align-items: center; padding: 3px 9px; border-radius: 999px;
  background: rgba(124,58,237,.2); border: 1px solid rgba(124,58,237,.45); font-size: 11px; font-weight: 800;
}
.badge.live { background: rgba(239,68,68,.22); border-color: rgba(239,68,68,.6); }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--border); white-space: nowrap; }
th { opacity: .7; font-size: 11px; text-transform: uppercase; letter-spacing: .05em; }
tbody tr:hover { background: rgba(148,163,184,.08); }
.toast {
  position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%);
  background: #0f172a; color: white; padding: 12px 18px; border-radius: 10px; z-index: 9999;
  box-shadow: 0 10px 30px rgba(0,0,0,.4); font-size: 14px;
}
.toast.error { background: #991b1b; }
.stat-value { font-size: 30px; font-weight: 900; letter-spacing: -.03em; }
.stat-label { font-size: 11px; opacity: .65; text-transform: uppercase; letter-spacing: .08em; }

/* Transparent OBS overlay helpers */
.obs-root { width: 1920px; height: 1080px; background: transparent; overflow: hidden; position: relative; }
.obs-root * { box-sizing: border-box; }
.overlay-panel { background: linear-gradient(135deg, rgba(15,23,42,.94), rgba(30,27,75,.9)); border: 1px solid rgba(255,255,255,.16); box-shadow: 0 18px 60px rgba(0,0,0,.55); border-radius: 18px; }
.overlay-hidden { display: none !important; }
.glow { text-shadow: 0 0 18px rgba(124,58,237,.85); }
.team-chip { display: inline-flex; align-items: center; gap: 8px; }
.team-logo { width: 38px; height: 38px; object-fit: contain; }
.ball-dot {
  display: inline-flex; align-items: center; justify-content: center; width: 34px; height: 34px;
  border-radius: 50%; font-weight: 800; font-size: 15px; background: rgba(255,255,255,.14);
  border: 1px solid rgba(255,255,255,.25);
}
.ball-dot.four { background: #2563eb; }
.ball-dot.six { background: #7c3aed; }
.ball-dot.wicket { background: #dc2626; }

@keyframes pop-in {
  0% { opacity: 0; transform: scale(.6) translateY(40px); }
  60% { opacity: 1; transform: scale(1.08) translateY(0); }
  100% { opacity: 1; transform: scale(1) translateY(0); }
}
@keyframes slide-up {
  from { opacity: 0; transform: translateY(60px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes pulse-glow {
  0%, 100% { filter: drop-shadow(0 0 8px rgba(124,58,237,.4)); }
  50% { filter: drop-shadow(0 0 22px rgba(124,58,237,.95)); }
}
@keyframes fade-out { to { opacity: 0; transform: scale(1.1); } }
.animate-pop { animation: pop-in .5s cubic-bezier(.2,.9,.3,1.3) both; }
.animate-slide { animation: slide-up .45s ease-out both; }
.animate-glow { animation: pulse-glow 1.2s ease-in-out infinite; }
.animate-out { animation: fade-out .45s ease-in forwards; }
.compact .ball-dot { width: 28px; height: 28px; font-size: 13px; }

/* Scorer keypad */
.scorer-root { width: min(560px, 100vw); margin: 0 auto; padding: 12px 12px 100px; }
.score-hero { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.score-hero .score { font-size: 58px; font-weight: 900; line-height: 1; letter-spacing: -.05em; }
.keypad { display: grid; grid-template-columns: repeat(4, 1fr); gap: 9px; }
.key {
  min-height: 68px; border-radius: 14px; border: 1px solid var(--border); background: rgba(148,163,184,.14);
  color: inherit; font-size: 22px; font-weight: 900; cursor: pointer; user-select: none; -webkit-tap-highlight-color: transparent;
}
.key:active { transform: scale(.96); background: rgba(124,58,237,.45); }
.key.extra { font-size: 14px; }
.key.wicket-key { background: rgba(239,68,68,.85); color: white; }
.key.undo-key { background: rgba(245,158,11,.85); color: #1f1300; }
.key.swap-key { background: rgba(34,211,238,.7); color: #06202a; }
.sticky-bottom { position: fixed; bottom: 0; left: 0; right: 0; background: rgba(11,16,32,.96); border-top: 1px solid var(--border); padding: 10px 12px; z-index: 50; }
.sticky-bottom .row { max-width: 560px; margin: 0 auto; }
body.light .sticky-bottom { background: rgba(255,255,255,.96); }

@media (max-width: 600px) {
  .container { padding: 12px 0 40px; }
  .card { padding: 14px; border-radius: 12px; }
  .key { min-height: 62px; font-size: 19px; }
}
