* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: "Inter", "Segoe UI", system-ui, -apple-system, sans-serif;
  background: #0b0f1a;
  color: #f8fafc;
  min-height: 100vh;
}

.container {
  max-width: 540px;
  margin: 0 auto;
  padding: 24px 16px 48px;
}

.app-title {
  font-size: 1.1rem;
  color: #94a3b8;
  font-weight: 500;
  margin-bottom: 8px;
  text-align: center;
}

.header {
  margin-bottom: 20px;
}

.title {
  font-size: 1.5rem;
  font-weight: 700;
}

.subtitle {
  margin-top: 6px;
  color: #94a3b8;
  font-size: 0.95rem;
}

.team-indicator {
  margin-top: 8px;
  color: #fbbf24;
  font-size: 0.9rem;
  font-weight: 600;
}

.team-names-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 16px;
  margin-bottom: 16px;
}

.team-name-edit {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.team-name-text {
  font-size: 0.95rem;
  font-weight: 600;
  color: #e2e8f0;
}

.team-name-edit-btn {
  background: none;
  border: none;
  color: #94a3b8;
  cursor: pointer;
  padding: 4px;
  font-size: 1rem;
  line-height: 1;
  border-radius: 4px;
  flex-shrink: 0;
}

.team-name-edit-btn:hover {
  color: #e2e8f0;
}

.team-name-edit-btn:disabled {
  opacity: 0.4;
  cursor: default;
}

.team-name-input {
  font-size: 0.95rem;
  font-weight: 600;
  color: #e2e8f0;
  background: #1f2937;
  border: 1px solid #334155;
  border-radius: 6px;
  padding: 4px 8px;
  width: 100%;
  max-width: 180px;
}

.team-name-input:focus {
  outline: none;
  border-color: #64748b;
}

.score-card {
  background: #111827;
  border-radius: 16px;
  padding: 24px;
  margin-bottom: 16px;
  border: 1px solid #1f2937;
}

.score-main {
  display: flex;
  align-items: baseline;
  gap: 10px;
  justify-content: center;
  margin-bottom: 20px;
}

.score-runs {
  font-size: 3rem;
  font-weight: 700;
  letter-spacing: 1px;
}

.score-divider {
  font-size: 2rem;
  color: #94a3b8;
}

.score-wickets {
  font-size: 2.5rem;
  font-weight: 600;
  color: #fbbf24;
}

.score-meta {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.meta-block {
  background: #0f172a;
  border-radius: 12px;
  padding: 12px;
  text-align: center;
}

.meta-label {
  display: block;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #94a3b8;
  margin-bottom: 4px;
}

.meta-value {
  font-size: 1.2rem;
  font-weight: 600;
}

.status-card {
  background: #0f172a;
  border-radius: 12px;
  padding: 16px;
  border: 1px solid #1f2937;
}

.status-text {
  font-size: 1rem;
  margin-bottom: 8px;
}

.status-updated {
  font-size: 0.85rem;
  color: #94a3b8;
}

.editor-card {
  background: #0f172a;
  border-radius: 12px;
  padding: 16px;
  border: 1px solid #1f2937;
  margin-bottom: 16px;
}

.editor-card.disabled {
  opacity: 0.7;
}

.section-title {
  font-size: 1rem;
  margin-bottom: 12px;
  color: #e2e8f0;
}

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

.button-row {
  display: flex;
  gap: 10px;
  margin-bottom: 12px;
}

.score-button {
  flex: 1;
  background: #1f2937;
  color: #f8fafc;
  border: none;
  border-radius: 10px;
  padding: 12px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.05s ease, background 0.2s ease;
}

.score-button:active {
  transform: scale(0.98);
}

.score-button:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.score-button.accent {
  background: #f97316;
  color: #0f172a;
}

.score-button.warning {
  background: #facc15;
  color: #0f172a;
}

.score-button.secondary {
  background: #334155;
}

.score-button.danger {
  background: #ef4444;
}

.warning-text {
  margin-top: 10px;
  background: #1f2937;
  padding: 10px 12px;
  border-radius: 10px;
  color: #fbbf24;
  font-size: 0.9rem;
}

.link-row {
  margin-top: 10px;
  background: #0f172a;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid #1f2937;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.link-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.link-preview {
  font-size: 0.8rem;
  color: #cbd5f5;
  word-break: break-all;
}

.link-preview.muted {
  color: #94a3b8;
}

.score-button.small {
  font-size: 0.9rem;
  padding: 10px;
}

.error-card {
  background: #1f2937;
  border-radius: 12px;
  padding: 18px;
  border: 1px solid #334155;
}

.error-title {
  font-size: 1.1rem;
  margin-bottom: 6px;
}

.error-message {
  color: #cbd5f5;
  font-size: 0.95rem;
}

.hidden {
  display: none;
}

.teams-container {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-bottom: 16px;
}

.team-card {
  background: #111827;
  border-radius: 16px;
  padding: 20px;
  border: 1px solid #1f2937;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.team-card.active {
  border-color: #fbbf24;
  box-shadow: 0 0 0 2px rgba(251, 191, 36, 0.2);
}

.team-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}

.team-name {
  font-size: 1.1rem;
  font-weight: 600;
  color: #f8fafc;
}

.team-status {
  font-size: 0.85rem;
  padding: 4px 10px;
  border-radius: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.team-status.batting {
  background: #10b981;
  color: #0f172a;
}

.team-status.completed {
  background: #6b7280;
  color: #f8fafc;
}

.overs-section {
  background: #0f172a;
  border-radius: 12px;
  padding: 16px;
  border: 1px solid #1f2937;
  margin-top: 16px;
  margin-bottom: 16px;
}

.overs-toggle {
  background: none;
  border: none;
  color: #cbd5f5;
  font-size: 0.95rem;
  cursor: pointer;
  padding: 12px 0;
  width: 100%;
  text-align: left;
  font-weight: 600;
  transition: color 0.2s ease, background-color 0.2s ease, opacity 0.15s ease;
  border-radius: 8px;
  position: relative;
}

.overs-toggle:hover {
  color: #f8fafc;
  background-color: rgba(31, 41, 55, 0.3);
}

.overs-toggle:active {
  opacity: 0.8;
  background-color: rgba(31, 41, 55, 0.5);
}

.overs-content {
  margin-top: 12px;
  max-height: 300px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-right: 20px;
  position: relative;
}

/* Strong bottom gradient overlay to indicate scrollable content */
.overs-content-gradient {
  position: sticky;
  bottom: 0;
  left: 0;
  right: 20px;
  height: 48px;
  min-height: 48px;
  background: linear-gradient(
    to bottom,
    rgba(15, 23, 42, 0) 0%,
    rgba(15, 23, 42, 0.3) 25%,
    rgba(15, 23, 42, 0.6) 50%,
    rgba(15, 23, 42, 0.85) 75%,
    rgba(15, 23, 42, 1) 100%
  );
  pointer-events: none;
  z-index: 10;
  transition: opacity 0.4s ease;
  opacity: 1;
  flex-shrink: 0;
  align-self: stretch;
  /* Overlay content using absolute positioning within sticky context */
  margin-top: -48px;
  margin-bottom: 0;
}

.overs-content-gradient.hidden {
  opacity: 0;
}

/* Hide gradient when user has scrolled down */
.overs-content.scrolled::after {
  opacity: 0;
}

.overs-content.hidden {
  display: none !important;
}

.innings-group {
  margin-bottom: 16px;
}

.innings-group:last-child {
  margin-bottom: 0;
}

.innings-header {
  font-weight: 600;
  color: #e2e8f0;
  font-size: 0.95rem;
  margin-bottom: 8px;
  padding-bottom: 8px;
  border-bottom: 1px solid #1f2937;
}

.over-row {
  display: flex;
  align-items: baseline;
  gap: 8px;
  padding: 8px 0;
  border-bottom: 1px solid #1f2937;
  font-size: 0.9rem;
}

.over-row:last-child {
  border-bottom: none;
}

.over-label {
  font-weight: 600;
  color: #e2e8f0;
  min-width: 70px;
}

.over-balls {
  flex: 1;
  color: #cbd5f5;
  font-family: "Courier New", monospace;
  letter-spacing: 0.1em;
}

.over-total {
  color: #fbbf24;
  font-weight: 600;
  min-width: 40px;
  text-align: right;
}

.footer-links {
  margin-top: 32px;
  padding-top: 20px;
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.footer-link {
  font-size: 0.85rem;
  color: #94a3b8;
  text-decoration: underline;
  text-decoration-color: rgba(148, 163, 184, 0.85);
  transition: color 0.2s ease;
}

.footer-link:hover {
  color: #cbd5e1;
  text-decoration-color: #cbd5e1;
}

.footer-link.promotional {
  color: #a8b8cc;
  text-decoration-color: rgba(168, 184, 204, 0.85);
}

.footer-link.promotional:hover {
  color: #cbd5e1;
  text-decoration-color: #cbd5e1;
}

@media (min-width: 600px) {
  .container {
    padding-top: 40px;
  }

  .score-runs {
    font-size: 3.5rem;
  }

  .score-wickets {
    font-size: 2.8rem;
  }
}
