* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  user-select: none;
}

html, body {
  width: 100%;
  min-height: 100%;
}

body {
  background: #0f172a;
  color: #0f172a;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding: 10px;
}

.app-container {
  width: 100%;
  max-width: 480px;
  background: #f8fafc;
  border-radius: 14px;
  overflow: hidden;
  box-shadow: 0 15px 35px rgba(0, 0, 0, 0.4);
  display: flex;
  flex-direction: column;
  position: relative;
  min-height: 92vh;
}

.app-header {
  background: #009270;
  padding: 12px 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: #ffffff;
}

.brand-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: 'Teko', sans-serif;
  font-size: 24px;
  letter-spacing: 1px;
  line-height: 1;
}

.ball-icon { font-size: 18px; }

.live-dot-tag {
  background: #dc2626;
  color: #ffffff;
  font-size: 10px;
  font-weight: 800;
  padding: 2px 7px;
  border-radius: 12px;
  letter-spacing: 0.5px;
  font-family: 'Inter', sans-serif;
  animation: pulseDot 1.4s infinite;
}

@keyframes pulseDot {
  0% { opacity: 1; }
  50% { opacity: 0.35; }
  100% { opacity: 1; }
}

.admin-unlock-btn {
  background: rgba(255, 255, 255, 0.18);
  border: 1px solid rgba(255, 255, 255, 0.3);
  color: #ffffff;
  font-size: 11px;
  font-weight: 700;
  padding: 5px 10px;
  border-radius: 6px;
  cursor: pointer;
}

.top-nav-bar {
  background: #e2e8f0;
  padding: 8px 12px;
  display: flex;
  justify-content: flex-end;
  border-bottom: 1px solid #cbd5e1;
}

.back-nav-btn {
  background: #0284c7;
  color: #ffffff;
  border: none;
  font-size: 12px;
  font-weight: 700;
  padding: 6px 12px;
  border-radius: 6px;
  cursor: pointer;
}

.back-nav-btn:active { transform: scale(0.97); }

.viewer-main-section {
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.live-match-card {
  background: #ffffff;
  border-radius: 10px;
  padding: 14px;
  border: 1px solid #e2e8f0;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.match-meta-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 11px;
  font-weight: 700;
  color: #64748b;
  text-transform: uppercase;
}

.match-session-tag {
  color: #0284c7;
  background: #e0f2fe;
  padding: 2px 6px;
  border-radius: 4px;
}

.match-teams-line {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 6px;
}

.team-name {
  font-size: 17px;
  font-weight: 800;
  color: #0f172a;
}

.vs-badge {
  font-size: 12px;
  color: #94a3b8;
  font-weight: 700;
}

.toss-info-line {
  font-size: 12px;
  color: #15803d;
  font-weight: 600;
  margin-top: 2px;
}

.score-display-box {
  background: #f1f5f9;
  border-radius: 8px;
  padding: 12px;
  margin-top: 10px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.score-number-row {
  display: flex;
  align-items: baseline;
  gap: 4px;
}

.runs, .wickets {
  font-family: 'Teko', sans-serif;
  font-size: 54px;
  line-height: 0.9;
  font-weight: 700;
  color: #009270;
}

.slash {
  font-family: 'Teko', sans-serif;
  font-size: 40px;
  color: #94a3b8;
}

.overs-bracket {
  font-size: 15px;
  font-weight: 700;
  color: #475569;
  margin-left: 6px;
}

.rate-info-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12px;
  color: #475569;
  font-weight: 600;
}

.chase-equation {
  color: #dc2626;
  font-weight: 700;
}

.live-panel-title {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
  color: #475569;
  letter-spacing: 0.5px;
  margin-top: 14px;
  margin-bottom: 6px;
}

.click-hint {
  font-size: 10px;
  color: #0284c7;
  font-weight: 600;
  text-transform: none;
}

.cricket-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.cricket-table th {
  text-align: left;
  font-size: 11px;
  font-weight: 700;
  color: #94a3b8;
  text-transform: uppercase;
  padding: 4px 6px;
  border-bottom: 1px solid #e2e8f0;
}

.cricket-table td {
  padding: 6px;
  border-bottom: 1px solid #f1f5f9;
  color: #1e293b;
}

.cricket-table td.text-right, .cricket-table th.text-right {
  text-align: right;
}

.active-batter-row {
  background: #f0fdf4;
}

.striker-star {
  color: #009270;
  font-weight: bold;
}

.dot-space {
  color: #94a3b8;
}

/* Clickable Player Links */
.player-name-link {
  color: #0284c7;
  font-weight: 700;
  cursor: pointer;
  text-decoration: underline;
  text-decoration-style: dotted;
  text-underline-offset: 3px;
}

.player-name-link:hover {
  color: #009270;
}

.this-over-strip {
  display: flex;
  align-items: center;
  gap: 6px;
  min-height: 32px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  padding: 4px 8px;
  overflow-x: auto;
}

.empty-over-text {
  font-size: 12px;
  color: #94a3b8;
}

.ball-circle {
  min-width: 26px;
  height: 26px;
  padding: 0 4px;
  border-radius: 13px;
  background: #e2e8f0;
  color: #0f172a;
  font-size: 11px;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.ball-circle.four { background: #0284c7; color: #ffffff; }
.ball-circle.six { background: #16a34a; color: #ffffff; }
.ball-circle.wkt { background: #dc2626; color: #ffffff; }
.ball-circle.extra { background: #d97706; color: #ffffff; }

.match-result-banner {
  margin-top: 12px;
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  color: #1d4ed8;
  font-size: 13px;
  font-weight: 700;
  padding: 8px 10px;
  border-radius: 6px;
  text-align: center;
}

/* All Matches View */
.section-top-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.section-heading {
  font-size: 14px;
  font-weight: 800;
  color: #1e293b;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.history-cards-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.history-card-item {
  background: #ffffff;
  border-radius: 8px;
  padding: 12px;
  border: 1px solid #e2e8f0;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
  display: flex;
  flex-direction: column;
  gap: 6px;
  cursor: pointer;
}

.history-card-top {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: #64748b;
  font-weight: 700;
  text-transform: uppercase;
}

.history-card-teams {
  display: flex;
  justify-content: space-between;
  font-size: 14px;
  font-weight: 700;
  color: #0f172a;
}

.history-card-result {
  font-size: 12px;
  color: #0284c7;
  font-weight: 600;
}

.no-history-msg {
  background: #ffffff;
  padding: 20px;
  text-align: center;
  font-size: 13px;
  color: #94a3b8;
  border-radius: 8px;
  border: 1px dashed #cbd5e1;
}

/* Player Details Card in Modal */
.player-info-card {
  background: #f1f5f9;
  padding: 8px 12px;
  border-radius: 6px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.player-badge-pill {
  background: #0284c7;
  color: white;
  font-size: 11px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 10px;
}

.player-team-label {
  font-size: 12px;
  color: #475569;
  font-weight: 600;
}

.profile-stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin: 6px 0;
}

.stat-box {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  padding: 8px 4px;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.stat-num {
  font-size: 15px;
  font-weight: 800;
  color: #0f172a;
}

.stat-lbl {
  font-size: 10px;
  color: #64748b;
  font-weight: 700;
  text-transform: uppercase;
}

/* Scorer Admin Drawer */
.scorer-admin-drawer {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: #0f172a;
  border-top: 2px solid #009270;
  border-radius: 14px 14px 0 0;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  box-shadow: 0 -10px 30px rgba(0, 0, 0, 0.6);
  z-index: 500;
}

.drawer-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: #ffffff;
}

.drawer-header h4 {
  font-size: 14px;
  font-weight: 700;
  color: #4ade80;
}

.close-drawer-btn {
  background: transparent;
  border: none;
  color: #94a3b8;
  font-size: 16px;
  cursor: pointer;
}

.admin-top-actions {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 6px;
}

.admin-quick-switches {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
}

.btn-setup {
  background: #009270;
  color: #ffffff;
  border: none;
  font-size: 12px;
  font-weight: 700;
  padding: 8px 4px;
  border-radius: 6px;
  cursor: pointer;
}

.btn-end {
  background: #b91c1c;
  color: #ffffff;
  border: none;
  font-size: 12px;
  font-weight: 700;
  padding: 8px 4px;
  border-radius: 6px;
  cursor: pointer;
}

.btn-switch {
  background: #1e293b;
  color: #38bdf8;
  border: 1px solid #334155;
  font-size: 11px;
  font-weight: 700;
  padding: 6px 4px;
  border-radius: 6px;
  cursor: pointer;
}

.scorer-keypad {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
}

.scorer-keypad button {
  height: 44px;
  border-radius: 6px;
  border: none;
  font-weight: 800;
  font-size: 16px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.scorer-keypad button:active { transform: scale(0.96); }

.run-btn { background: #1e293b; color: #ffffff; }
.run-btn.four { background: #0284c7; color: #ffffff; }
.run-btn.six { background: #16a34a; color: #ffffff; }
.extra-btn { background: #b45309; color: #fef08a; font-size: 12px; }
.extra-btn.nb { background: #7c3aed; color: #ede9fe; }
.extra-btn.wkt { background: #dc2626; color: #ffffff; }
.util-btn { background: #334155; color: #cbd5e1; font-size: 12px; }

/* Modals */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.85);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 1000;
  padding: 14px;
}

.modal-overlay.hidden, .hidden {
  display: none !important;
}

.modal-box {
  background: #ffffff;
  border-radius: 10px;
  padding: 16px;
  width: 100%;
  max-width: 420px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  color: #0f172a;
  max-height: 88vh;
  overflow-y: auto;
}

.modal-header-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.modal-header-row h3 {
  font-size: 16px;
  font-weight: 700;
}

.close-btn {
  background: transparent;
  border: none;
  font-size: 16px;
  color: #64748b;
  cursor: pointer;
}

.field-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.field-group label {
  font-size: 11px;
  font-weight: 700;
  color: #475569;
}

.field-group input, .field-group select {
  width: 100%;
  padding: 8px 10px;
  border-radius: 6px;
  border: 1px solid #cbd5e1;
  font-size: 13px;
  outline: none;
  background: #ffffff;
  color: #0f172a;
}

.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.opt-btn {
  background: #f1f5f9;
  border: 1px solid #cbd5e1;
  color: #475569;
  font-size: 12px;
  font-weight: 700;
  padding: 8px;
  border-radius: 6px;
  cursor: pointer;
}

.opt-btn.active {
  background: #009270;
  border-color: #009270;
  color: #ffffff;
}

.primary-btn {
  background: #009270;
  color: #ffffff;
  font-size: 14px;
  font-weight: 700;
  border: none;
  padding: 10px;
  border-radius: 6px;
  cursor: pointer;
}

.primary-btn.red-bg { background: #dc2626; }

.cancel-btn {
  background: #f1f5f9;
  border: 1px solid #cbd5e1;
  color: #475569;
  font-size: 14px;
  font-weight: 700;
  padding: 10px;
  border-radius: 6px;
  cursor: pointer;
}