/* Gully Cricket Scorer - shared web styles. Mobile-first, no web fonts. */
:root {
  --bg: #f5f7f4;
  --surface: #ffffff;
  --surface-2: #eef2ec;
  --text: #14201a;
  --muted: #56645b;
  --border: #d8e0d8;
  --brand: #0f7a3d;
  --brand-ink: #ffffff;
  --accent: #f2b705;
  --wicket: #c62828;
  --wicket-ink: #ffffff;
  --four: #1565c0;
  --six: #6a1b9a;
  --boundary-ink: #ffffff;
  --warn-bg: #fff4d6;
  --warn-ink: #5c4300;
  --ok: #2e7d32;
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
  --radius: 14px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0e1411;
    --surface: #17201b;
    --surface-2: #1f2a24;
    --text: #e8efe9;
    --muted: #9fb0a5;
    --border: #2c3a32;
    --brand: #3fbf6f;
    --brand-ink: #06210f;
    --accent: #ffcf40;
    --wicket: #ef5350;
    --wicket-ink: #1a0000;
    --four: #64b5f6;
    --six: #ce93d8;
    --boundary-ink: #0b0b12;
    --warn-bg: #3a2f0d;
    --warn-ink: #ffe08a;
    --ok: #81c784;
    --shadow: none;
    color-scheme: dark;
  }
}

:root[data-theme="dark"] {
  --bg: #0e1411;
  --surface: #17201b;
  --surface-2: #1f2a24;
  --text: #e8efe9;
  --muted: #9fb0a5;
  --border: #2c3a32;
  --brand: #3fbf6f;
  --brand-ink: #06210f;
  --accent: #ffcf40;
  --wicket: #ef5350;
  --wicket-ink: #1a0000;
  --four: #64b5f6;
  --six: #ce93d8;
  --boundary-ink: #0b0b12;
  --warn-bg: #3a2f0d;
  --warn-ink: #ffe08a;
  --ok: #81c784;
  --shadow: none;
  color-scheme: dark;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", "Noto Sans Devanagari", sans-serif;
  padding-bottom: 88px; /* room for the sticky install banner */
  overflow-x: hidden;
}

a { color: var(--brand); }

img { max-width: 100%; height: auto; }

.wrap { max-width: 640px; margin: 0 auto; padding: 0 16px; }
.wrap.wide { max-width: 880px; }

/* Language-tagged blocks: only the active language shows. */
html[lang="hi"] [data-lang="en"],
html[lang="en"] [data-lang="hi"] { display: none !important; }

.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 12px 16px; background: var(--surface); border-bottom: 1px solid var(--border);
}
.brand { display: flex; align-items: center; gap: 8px; font-weight: 700; color: var(--text); text-decoration: none; }
.brand img { width: 28px; height: 28px; }
.lang-toggle {
  border: 1px solid var(--border); background: var(--surface-2); color: var(--text);
  border-radius: 999px; padding: 6px 12px; font: inherit; font-size: 14px; cursor: pointer; min-height: 36px;
}

.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 16px; margin: 12px 0;
}

.muted { color: var(--muted); }
.small { font-size: 14px; }
.center { text-align: center; }
h1 { font-size: 26px; line-height: 1.2; margin: 16px 0 8px; }
h2 { font-size: 20px; margin: 20px 0 8px; }
h3 { font-size: 17px; margin: 16px 0 6px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 48px; padding: 12px 20px; border-radius: 12px; border: 0;
  background: var(--brand); color: var(--brand-ink); font: inherit; font-weight: 700;
  text-decoration: none; cursor: pointer;
}
.btn.secondary { background: var(--surface-2); color: var(--text); border: 1px solid var(--border); }
.btn.big { width: 100%; font-size: 18px; min-height: 56px; }
.btn.danger { background: var(--wicket); color: var(--wicket-ink); }
.btn:disabled { opacity: 0.6; cursor: default; }

/* Sticky install banner (every public page). */
.install-banner {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 50;
  display: flex; align-items: center; gap: 12px; padding: 10px 16px;
  padding-bottom: calc(10px + env(safe-area-inset-bottom));
  background: var(--surface); border-top: 2px solid var(--brand); box-shadow: 0 -2px 8px rgba(0, 0, 0, 0.12);
}
.install-banner .txt { flex: 1; font-size: 14px; font-weight: 600; line-height: 1.3; }
.install-banner .btn { min-height: 44px; padding: 8px 16px; white-space: nowrap; }
.install-banner .close {
  background: none; border: 0; color: var(--muted); font-size: 22px; line-height: 1; padding: 4px 6px; cursor: pointer;
}

/* Status strip (offline / reconnecting). */
.status {
  display: none; margin: 12px 0 0; padding: 8px 12px; border-radius: 10px;
  background: var(--warn-bg); color: var(--warn-ink); font-size: 14px; font-weight: 600;
}
.status.show { display: block; }

/* ---------- live viewer ---------- */
.live-pill {
  display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 700;
  padding: 3px 10px; border-radius: 999px; background: var(--wicket); color: var(--wicket-ink);
}
.live-pill::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.done-pill { background: var(--surface-2); color: var(--text); border: 1px solid var(--border); }
.done-pill::before { display: none; }

.match-title { font-size: 15px; color: var(--muted); margin: 6px 0 0; }
.score-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.bat-team { font-size: 18px; font-weight: 700; }
.score-big { font-size: 44px; font-weight: 800; line-height: 1.05; letter-spacing: -0.5px; }
.score-big .ov { font-size: 18px; font-weight: 600; color: var(--muted); letter-spacing: 0; }
.rates { display: flex; flex-wrap: wrap; gap: 6px 16px; margin-top: 8px; font-size: 15px; }
.rates b { font-weight: 700; }
.chase {
  margin-top: 10px; padding: 10px 12px; border-radius: 10px; background: var(--surface-2);
  font-weight: 700; font-size: 16px;
}

.badge-freehit {
  display: inline-block; margin-top: 10px; padding: 4px 10px; border-radius: 8px;
  background: var(--accent); color: #1d1600; font-weight: 800; font-size: 14px; letter-spacing: 0.3px;
}

.players { width: 100%; border-collapse: collapse; font-size: 15px; }
.players th { text-align: left; font-weight: 600; color: var(--muted); font-size: 13px; padding: 4px 0; }
.players td { padding: 6px 0; border-top: 1px solid var(--border); }
.players td.num, .players th.num { text-align: right; font-variant-numeric: tabular-nums; }
.players .on-strike::after { content: " *"; color: var(--brand); font-weight: 800; }

.over-row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.ball {
  min-width: 40px; height: 40px; padding: 0 8px; border-radius: 20px;
  display: inline-flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 15px; background: var(--surface-2); color: var(--text);
  border: 2px solid var(--border);
}
.ball.wicket { background: var(--wicket); color: var(--wicket-ink); border-color: var(--wicket); }
.ball.four { background: var(--four); color: var(--boundary-ink); border-color: var(--four); }
.ball.six { background: var(--six); color: var(--boundary-ink); border-color: var(--six); }
.ball.extra { border-style: dashed; }
.ball.dot { color: var(--muted); }

.innings-list { list-style: none; margin: 0; padding: 0; }
.innings-list li { display: flex; justify-content: space-between; padding: 8px 0; border-top: 1px solid var(--border); }
.innings-list li:first-child { border-top: 0; }

.result { font-size: 20px; font-weight: 800; color: var(--ok); margin: 4px 0 12px; }
.scorecard-img { display: block; width: 100%; border-radius: 10px; border: 1px solid var(--border); margin: 12px 0; }

.updated { font-size: 13px; color: var(--muted); margin-top: 8px; }

.skeleton { height: 140px; border-radius: var(--radius); background: var(--surface-2); animation: pulse 1.2s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: 0.55; } }
@media (prefers-reduced-motion: reduce) { .skeleton { animation: none; } }

.empty { text-align: center; padding: 28px 16px; }
.empty .icon { font-size: 44px; }

/* ---------- marketing / docs ---------- */
.hero { padding: 24px 0 8px; text-align: center; }
.hero h1 { font-size: 30px; }
.features { list-style: none; padding: 0; margin: 0; display: grid; gap: 10px; }
.features li { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 12px 14px; }
.features b { display: block; }
.legal h2 { font-size: 18px; }
.legal p, .legal li { color: var(--text); }
footer.site { padding: 24px 16px; text-align: center; font-size: 14px; color: var(--muted); }
footer.site a { margin: 0 6px; }

/* ---------- admin ---------- */
.form-grid { display: grid; gap: 10px; }
.form-grid label { display: grid; gap: 4px; font-size: 14px; font-weight: 600; }
.form-grid input, .form-grid select {
  font: inherit; padding: 10px 12px; min-height: 44px; border-radius: 10px;
  border: 1px solid var(--border); background: var(--surface-2); color: var(--text); width: 100%;
}
.row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.sponsor { display: flex; gap: 12px; align-items: center; }
.sponsor img { width: 56px; height: 56px; object-fit: contain; border-radius: 8px; background: var(--surface-2); }
.sponsor .meta { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.tag { font-size: 12px; font-weight: 700; padding: 2px 8px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--border); }
.tag.off { color: var(--wicket); }
.error { color: var(--wicket); font-weight: 600; }
