
:root{
  --primary: <?= h($primaryColor ?: "#003f32") ?>;
  --secondary: <?= h($secondaryColor ?: "#002b22") ?>;
  --accent: <?= h($accentColor ?: "#84d846") ?>;

  --blue: <?= h($primaryColor ?: "#003f32") ?>;
  --blue-dark: <?= h($secondaryColor ?: "#002b22") ?>;
  --green: #007456;
  --red: #f11224;
  --orange: #f59e0b;

  --text: #111827;
  --muted: #6b7280;
  --soft: #f5f6f8;
  --card: #ffffff;
  --border: #e5e7eb;
  --shadow: 0 10px 30px rgba(0,63,50,.10);
}

*{
  box-sizing:border-box;
}

html{
  scroll-behavior:smooth;
}

body{
  margin:0;
  font-family:Inter,system-ui,-apple-system,BlinkMacSystemFont,"Segoe UI",sans-serif;
  background:var(--soft);
  color:var(--text);
  padding-bottom:82px;
}

a{
  color:inherit;
  text-decoration:none;
}

img{
  max-width:100%;
  display:block;
}

.page{
  max-width:520px;
  margin:0 auto;
  background:var(--soft);
  min-height:100vh;
}

/* =========================
   TOP HERO
========================= */

.match-hero{
  background:
    radial-gradient(circle at top right, rgba(132,216,70,.18), transparent 34%),
    linear-gradient(145deg, var(--blue), var(--blue-dark));
  color:#fff;
  padding:14px 14px 18px;
  border-radius:0 0 28px 28px;
  position:relative;
  overflow:hidden;
}

.match-hero:before{
  content:"";
  position:absolute;
  width:220px;
  height:220px;
  right:-80px;
  top:-70px;
  border-radius:50%;
  background:rgba(132,216,70,.10);
}

.match-hero:after{
  content:"";
  position:absolute;
  width:180px;
  height:180px;
  left:-70px;
  bottom:-90px;
  border-radius:50%;
  background:rgba(255,255,255,.07);
}

.match-header{
  position:relative;
  z-index:2;
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
}

.icon-btn{
  width:38px;
  height:38px;
  border-radius:15px;
  background:rgba(255,255,255,.14);
  color:#fff;
  border:1px solid rgba(255,255,255,.18);
  display:flex;
  align-items:center;
  justify-content:center;
  font-size:15px;
}

.header-title{
  flex:1;
  text-align:center;
  min-width:0;
}

.header-title strong{
  display:block;
  font-size:13px;
  font-weight:800;
  white-space:nowrap;
  overflow:hidden;
  text-overflow:ellipsis;
}

.header-title span{
  display:block;
  margin-top:2px;
  font-size:10px;
  font-weight:600;
  opacity:.78;
  letter-spacing:.4px;
  text-transform:uppercase;
}

.header-actions{
  display:flex;
  align-items:center;
  gap:8px;
}

.match-meta{
  position:relative;
  z-index:2;
  margin-top:16px;
  display:flex;
  justify-content:center;
  align-items:center;
  gap:8px;
  flex-wrap:wrap;
  font-size:11px;
  font-weight:700;
  opacity:.94;
}

.mf-badge{
  display:inline-flex;
  align-items:center;
  gap:6px;
  border-radius:999px;
  padding:5px 9px;
  font-size:10px;
  font-weight:900;
  letter-spacing:.4px;
  background:rgba(255,255,255,.18);
}

.mf-badge.live{
  background:var(--red);
  color:#fff;
}

.mf-badge.live span{
  width:6px;
  height:6px;
  border-radius:50%;
  background:#fff;
  box-shadow:0 0 0 5px rgba(241,18,36,.18);
}

.mf-badge.finished{
  background:rgba(255,255,255,.20);
}

.mf-badge.upcoming{
  background:rgba(255,255,255,.16);
}

.score-hero{
  position:relative;
  z-index:2;
  margin-top:18px;
  display:grid;
  grid-template-columns:1fr auto 1fr;
  align-items:center;
  gap:12px;
}

.team-box{
  text-align:center;
}

.team-logo{
  width:62px;
  height:62px;
  border-radius:22px;
  background:#fff;
  padding:9px;
  margin:0 auto 9px;
  object-fit:contain;
  box-shadow:0 12px 22px rgba(0,0,0,.14);
}

.team-code{
  font-size:16px;
  font-weight:900;
  line-height:1;
}

.team-name{
  margin-top:4px;
  font-size:10px;
  font-weight:600;
  opacity:.78;
  white-space:nowrap;
  overflow:hidden;
  text-overflow:ellipsis;
  max-width:120px;
}

.center-score{
  text-align:center;
  min-width:116px;
}

.main-score{
  font-size:30px;
  line-height:1;
  font-weight:900;
  letter-spacing:-1.2px;
}

.main-overs{
  margin-top:5px;
  font-size:12px;
  font-weight:700;
  opacity:.85;
}

.vs-chip{
  display:inline-flex;
  margin-top:8px;
  border-radius:999px;
  padding:5px 11px;
  background:rgba(255,255,255,.16);
  font-size:10px;
  font-weight:900;
}

.match-note{
  position:relative;
  z-index:2;
  margin:16px auto 0;
  text-align:center;
  font-size:12px;
  font-weight:800;
  line-height:1.5;
  max-width:420px;
  color:var(--accent);
  opacity:.98;
}

.score-summary{
  position:relative;
  z-index:2;
  margin-top:16px;
  display:grid;
  grid-template-columns:1fr 1fr;
  gap:10px;
}

.summary-card{
  background:rgba(255,255,255,.14);
  border:1px solid rgba(255,255,255,.16);
  border-radius:18px;
  padding:10px;
  min-height:74px;
}

.summary-card small{
  display:block;
  font-size:10px;
  font-weight:800;
  opacity:.78;
  margin-bottom:6px;
  text-transform:uppercase;
}

.summary-card strong{
  display:block;
  font-size:15px;
  font-weight:900;
  line-height:1.3;
}

.summary-card span{
  display:block;
  margin-top:4px;
  font-size:10px;
  opacity:.78;
}

/* =========================
   TABS
========================= */

.sticky-tabs{
  position:sticky;
  top:0;
  z-index:20;
  background:rgba(255,255,255,.94);
  backdrop-filter:blur(16px);
  border-bottom:1px solid var(--border);
  overflow-x:auto;
  display:flex;
  gap:4px;
  padding:8px 10px 0;
  scrollbar-width:none;
}

.sticky-tabs::-webkit-scrollbar{
  display:none;
}

.sticky-tabs a{
  flex:0 0 auto;
  padding:12px 12px 11px;
  font-size:13px;
  font-weight:800;
  color:var(--muted);
  border-bottom:3px solid transparent;
}

.sticky-tabs a.active{
  color:var(--green);
  border-bottom-color:var(--green);
}

/* =========================
   CONTENT
========================= */

.content{
  padding:12px;
}

.tab-content{
  display:none;
}

.tab-content.active{
  display:block;
}

.card{
  background:var(--card);
  border:1px solid var(--border);
  border-radius:22px;
  box-shadow:0 8px 24px rgba(0,63,50,.05);
  margin-bottom:12px;
  overflow:hidden;
}

.card-pad{
  padding:14px;
}

.card-title{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
  padding:14px 14px 10px;
}

.card-title h3{
  margin:0;
  font-size:14px;
  font-weight:900;
  letter-spacing:-.2px;
  color:var(--text);
}

.card-title span{
  font-size:11px;
  color:var(--muted);
  font-weight:700;
}

.card-title .view-all{
  color:var(--green);
  font-size:12px;
  font-weight:900;
}

.grid-3{
  display:grid;
  grid-template-columns:repeat(3,1fr);
  gap:10px;
}

.stat-box{
  background:#f7f8fa;
  border:1px solid var(--border);
  border-radius:18px;
  padding:12px 8px;
  text-align:center;
}

.stat-box small{
  display:block;
  font-size:10px;
  font-weight:800;
  color:var(--muted);
  text-transform:uppercase;
}

.stat-box strong{
  display:block;
  margin-top:5px;
  font-size:18px;
  font-weight:900;
}

/* =========================
   TEAM INNINGS SCORES
========================= */

.innings-list{
  display:grid;
  gap:10px;
}

.innings-row{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
  background:#f7f8fa;
  border:1px solid var(--border);
  border-radius:18px;
  padding:11px;
}

.innings-team{
  display:flex;
  align-items:center;
  gap:9px;
  min-width:0;
}

.innings-team img{
  width:34px;
  height:34px;
  border-radius:12px;
  background:#fff;
  padding:5px;
  object-fit:contain;
  border:1px solid var(--border);
}

.innings-team strong{
  display:block;
  font-size:13px;
  font-weight:900;
}

.innings-team span{
  display:block;
  margin-top:2px;
  font-size:10px;
  color:var(--muted);
  font-weight:700;
}

.innings-score{
  text-align:right;
  font-size:15px;
  font-weight:900;
  white-space:nowrap;
}

/* =========================
   RECENT BALLS - NEW DESIGN
========================= */

.ball-list{
  display:grid;
  grid-template-columns:repeat(6, 1fr);
  gap:10px;
  align-items:center;
  width:100%;
}

.ball{
  width:100%;
  aspect-ratio:1/1;
  max-width:42px;
  margin:auto;
  border-radius:16px;
  background:linear-gradient(180deg,#ffffff,#f1f5f9);
  color:#111827;
  border:1px solid #e5e7eb;
  box-shadow:
    0 6px 14px rgba(15,23,42,.08),
    inset 0 1px 0 rgba(255,255,255,.9);
  display:inline-flex;
  align-items:center;
  justify-content:center;
  font-size:13px;
  font-weight:950;
  line-height:1;
}

.ball.four{
  background:linear-gradient(180deg,#22c55e,#12843b);
  color:#fff;
  border-color:#16a34a;
  box-shadow:0 8px 18px rgba(22,163,74,.28);
}

.ball.six{
  background:linear-gradient(180deg,#84d846,#16a34a);
  color:#fff;
  border-color:#22c55e;
  box-shadow:0 8px 18px rgba(34,197,94,.32);
}

.ball.wicket{
  background:linear-gradient(180deg,#1f2937,#020617);
  color:#fff;
  border-color:#111827;
  box-shadow:0 8px 18px rgba(15,23,42,.32);
}

.ball.extra,
.ball.wide{
  background:linear-gradient(180deg,#eff6ff,#dbeafe);
  color:#1d4ed8;
  border-color:#bfdbfe;
  box-shadow:0 8px 18px rgba(29,78,216,.14);
}

@media(max-width:380px){
  .ball-list{
    gap:8px;
  }

  .ball{
    max-width:38px;
    border-radius:14px;
    font-size:12px;
  }
}

/* =========================
   TABLES
========================= */

.table-wrap{
  width:100%;
  overflow-x:auto;
}

.score-table{
  width:100%;
  border-collapse:collapse;
  font-size:12px;
}

.score-table th{
  background:#f8fafc;
  color:var(--muted);
  font-size:10px;
  text-align:right;
  padding:10px 8px;
  font-weight:900;
  border-bottom:1px solid var(--border);
  white-space:nowrap;
}

.score-table th:first-child{
  text-align:left;
}

.score-table td{
  padding:11px 8px;
  border-bottom:1px solid #f1f1f1;
  text-align:right;
  font-weight:700;
  white-space:nowrap;
}

.score-table td:first-child{
  text-align:left;
  white-space:normal;
}

.score-table tr:last-child td{
  border-bottom:0;
}

.player-link{
  color:var(--text);
  font-weight:900;
}

.player-link:hover{
  color:var(--green);
}

.player-sub{
  display:block;
  margin-top:3px;
  color:var(--muted);
  font-size:10px;
  font-weight:600;
}

.section-gap{
  height:8px;
}

/* =========================
   COMMENTARY
========================= */

.comm-item.wicket-card{
  background:linear-gradient(135deg,#dc2626,#991b1b);
  border-color:#b91c1c;
  color:#fff;
}

.comm-item.wicket-card .comm-ball{
  background:rgba(255,255,255,.15);
  border-color:rgba(255,255,255,.2);
  color:#fff;
}

.comm-item.wicket-card .comm-title,
.comm-item.wicket-card .comm-text,
.comm-item.wicket-card .comm-over,
.comm-item.wicket-card .comm-time,
.comm-item.wicket-card strong{
  color:#fff !important;
}

.comm-item.wicket-card .ball{
  background:#fff;
  color:#dc2626;
  border-color:#fff;
}

.comm-item.wicket-card .ball.wicket{
  background:#111827;
  color:#fff;
  border-color:#111827;
}
.commentary-list{
  display:grid;
  gap:10px;
  padding:0 12px 12px;
}

.comment-row{
  display:grid;
  grid-template-columns:48px 1fr;
  gap:10px;
  padding:12px;
  border:1px solid var(--border);
  border-radius:18px;
  background:#fff;
}

.over-ball{
  height:34px;
  border-radius:999px;
  background:#fff;
  color:var(--green);
  border:2px solid #d8f3df;
  display:flex;
  align-items:center;
  justify-content:center;
  font-size:12px;
  font-weight:900;
}

.comment-main strong{
  display:flex;
  align-items:center;
  gap:7px;
  margin-bottom:4px;
  font-size:13px;
  font-weight:900;
}

.comment-main p{
  margin:0;
  color:#333;
  font-size:12px;
  line-height:1.55;
  font-weight:600;
}

.comment-run{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  min-width:22px;
  height:22px;
  padding:0 6px;
  border-radius:999px;
  background:#f2f4f7;
  margin-right:5px;
  font-size:10px;
  font-weight:900;
}

.comment-run.four,
.comment-run.six{
  background:#16a34a;
  color:#fff;
}

.comment-run.wicket{
  background:#111827;
  color:#fff;
}

.comment-run.extra,
.comment-run.wide{
  background:#dbeafe;
  color:#1d4ed8;
}

/* =========================
   INFO / SQUADS
========================= */

.info-list{
  display:grid;
  gap:10px;
  padding:0 14px 14px;
}

.info-item{
  display:flex;
  justify-content:space-between;
  gap:14px;
  padding:12px;
  background:#f8fafc;
  border:1px solid var(--border);
  border-radius:16px;
}

.info-item span{
  color:var(--muted);
  font-size:12px;
  font-weight:700;
}

.info-item strong{
  text-align:right;
  font-size:12px;
  font-weight:900;
}

.squad-team{
  padding:0 14px 14px;
}

.squad-team-title{
  display:flex;
  align-items:center;
  gap:9px;
  margin-bottom:10px;
}

.squad-team-title img{
  width:30px;
  height:30px;
  border-radius:10px;
  background:#fff;
  border:1px solid var(--border);
  padding:5px;
  object-fit:contain;
}

.squad-team-title strong{
  font-size:14px;
  font-weight:900;
}

.player-grid{
  display:grid;
  gap:8px;
}

.squad-player{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
  background:#f8fafc;
  border:1px solid var(--border);
  border-radius:16px;
  padding:10px 11px;
}

.squad-player strong{
  font-size:12px;
  font-weight:900;
}

.squad-player span{
  color:var(--muted);
  font-size:10px;
  font-weight:800;
}

.role-tags{
  display:flex;
  gap:5px;
  flex-wrap:wrap;
  justify-content:flex-end;
}

.role-tag{
  border-radius:999px;
  padding:4px 7px;
  background:#e8f8ef;
  color:var(--green);
  font-size:9px;
  font-weight:900;
}

/* =========================
   FOOTER SCORE
========================= */

.footer-score{
  position:fixed;
  left:50%;
  bottom:0;
  transform:translateX(-50%);
  width:100%;
  max-width:520px;
  background:linear-gradient(135deg,var(--primary),var(--secondary));
  color:#fff;
  border-top:0;
  box-shadow:0 -8px 28px rgba(0,63,50,.18);
  padding:10px 12px calc(10px + env(safe-area-inset-bottom));
  z-index:50;
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
}

.footer-score strong{
  display:block;
  font-size:13px;
  font-weight:900;
}

.footer-score span{
  display:block;
  margin-top:2px;
  font-size:11px;
  color:#d7f1ea;
  font-weight:700;
}

.footer-score a{
  background:#0b8f3a;
  color:#fff;
  padding:10px 14px;
  border-radius:999px;
  font-size:12px;
  font-weight:900;
}

/* =========================
   EMPTY
========================= */

.empty{
  padding:18px;
  text-align:center;
  color:var(--muted);
  font-size:12px;
  font-weight:700;
}

/* =========================
   RESPONSIVE
========================= */

@media (max-width:380px){
  .main-score{
    font-size:25px;
  }

  .center-score{
    min-width:96px;
  }

  .team-logo{
    width:54px;
    height:54px;
  }

  .sticky-tabs a{
    padding-left:10px;
    padding-right:10px;
  }
}

.scorecard-switch{
  display:flex;
  gap:8px;
  overflow-x:auto;
  padding:12px 14px;
  border-top:1px solid #eef0f3;
  border-bottom:1px solid #eef0f3;
  background:#fff;
  scrollbar-width:none;
}

.scorecard-switch::-webkit-scrollbar{
  display:none;
}

.scorecard-switch-btn{
  min-width:132px;
  border:1px solid #e5e7eb;
  background:#f8fafc;
  color:#111827;
  border-radius:16px;
  padding:10px 12px;
  text-align:left;
  cursor:pointer;
  flex:0 0 auto;
}

.scorecard-switch-btn span{
  display:block;
  font-size:12px;
  font-weight:900;
  color:#64748b;
}

.scorecard-switch-btn strong{
  display:block;
  font-size:18px;
  font-weight:1000;
  margin-top:2px;
}

.scorecard-switch-btn small{
  display:block;
  font-size:11px;
  font-weight:800;
  color:#6b7280;
  margin-top:2px;
}

.scorecard-switch-btn.active{
  background:linear-gradient(135deg,#003f32,#007456);
  border-color:#007456;
  color:#fff;
  box-shadow:0 8px 22px rgba(0,63,50,.18);
}

.scorecard-switch-btn.active span,
.scorecard-switch-btn.active small{
  color:rgba(255,255,255,.82);
}

.scorecard-panel{
  display:none;
}

.scorecard-panel.active{
  display:block;
}
