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

body {
  background-color: #0d0d0d;
  color: #f0f0f0;
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  min-height: 100dvh;
  display: flex;
  align-items: stretch;
  justify-content: center;
  padding: 20px 16px;
}

.scoreboard {
  width: 100%;
  max-width: 860px;
  display: flex;
  flex-direction: column;
}

/* ── Header ── */
.header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
  padding-bottom: 14px;
  border-bottom: 1px solid #222;
  flex-wrap: wrap;
  gap: 8px;
}

.app-name {
  font-size: 1.4rem;
  font-weight: 800;
  color: #f97316;
  letter-spacing: 4px;
  text-transform: uppercase;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.date {
  font-size: 0.8rem;
  color: #555;
  text-transform: uppercase;
  letter-spacing: 1px;
}

/* ── Teams & Scores ── */
.teams-section {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  align-content: center;
  gap: 10px;
  flex: 1;
}

.team-block {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.team-name {
  font-size: 1.3rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 3px;
  color: #777;
  text-align: center;
}

.team-name.clickable {
  cursor: pointer;
  padding: 6px 10px;
  border-radius: 6px;
  transition: background 0.15s, color 0.15s;
}

.team-name.clickable:hover {
  background: #1c1c1c;
  color: #f97316;
}

.score {
  font-size: clamp(4.5rem, 12vw, 7rem);
  font-weight: 900;
  line-height: 1;
  color: #ffffff;
  font-variant-numeric: tabular-nums;
}

.score-controls {
  display: flex;
  gap: 6px;
  width: 100%;
  justify-content: center;
}

.score-controls .btn {
  flex: 1;
}

/* ── Info Panel ── */
.info-section {
  background: #141414;
  border: 1px solid #222;
  border-radius: 10px;
  padding: 2px 14px;
  white-space: nowrap;
}

.info-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 0;
  border-bottom: 1px solid #1c1c1c;
  flex-wrap: wrap;
}

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

.info-label {
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 2px;
  color: #444;
  min-width: 64px;
}

.info-value {
  font-size: 0.95rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  flex: 1;
}

.jump-arrow {
  font-size: 1.8rem;
  flex: 1;
}

.info-controls {
  display: flex;
  gap: 6px;
  margin-left: auto;
}

.info-controls .btn {
  min-height: 32px;
  padding: 5px 10px;
  font-size: 0.72rem;
}

/* ── Buttons ── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 14px;
  min-height: 44px;
  border: none;
  border-radius: 8px;
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
  transition: opacity 0.15s, transform 0.1s;
  letter-spacing: 0.5px;
  white-space: nowrap;
  line-height: 1;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

.btn:hover  { opacity: 0.82; }
.btn:active { transform: scale(0.95); }

.btn-add      { background: #1d4ed8; color: #fff; }
.btn-danger   { background: #b91c1c; color: #fff; }
.btn-success  { background: #15803d; color: #fff; }
.btn-jump     { background: #f97316; color: #fff; font-size: 1.8rem; padding: 2px 16px; min-height: 32px; }

.btn-reset-all {
  padding: 10px 18px;
  min-height: 44px;
  background: transparent;
  color: #b91c1c;
  border: 1px solid #7f1d1d;
  border-radius: 8px;
  font-size: 0.75rem;
  font-weight: 700;
  cursor: pointer;
  letter-spacing: 1px;
  text-transform: uppercase;
  transition: background 0.15s;
  white-space: nowrap;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

.btn-reset-all:hover { background: #1a0505; }

/* ── Modal ── */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.78);
  z-index: 999;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.modal-overlay.active {
  display: flex;
}

.modal-box {
  background: #181818;
  border: 1px solid #333;
  border-radius: 14px;
  padding: 28px;
  width: 100%;
  max-width: 360px;
}

.modal-box h3 {
  margin-bottom: 18px;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 2px;
  color: #666;
}

.modal-box input {
  width: 100%;
  padding: 12px 14px;
  background: #0d0d0d;
  border: 1px solid #333;
  border-radius: 8px;
  color: #f0f0f0;
  font-size: 1rem;
  margin-bottom: 18px;
  outline: none;
}

.modal-box input:focus {
  border-color: #f97316;
}

.modal-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
}

.btn-secondary {
  background: #222;
  color: #aaa;
  border: none;
}

/* ── Login Page ── */
.login-container {
  min-height: 100dvh;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.login-box {
  background: #141414;
  border: 1px solid #222;
  border-radius: 18px;
  padding: 40px 32px;
  width: 100%;
  max-width: 360px;
}

.login-box h1 {
  text-align: center;
  color: #f97316;
  letter-spacing: 6px;
  margin-bottom: 32px;
  font-size: 2rem;
  font-weight: 900;
}

.field {
  margin-bottom: 20px;
}

.field label {
  display: block;
  font-size: 0.7rem;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: #555;
  margin-bottom: 8px;
}

.field input[type="password"] {
  width: 100%;
  padding: 14px 16px;
  background: #0d0d0d;
  border: 1px solid #2a2a2a;
  border-radius: 9px;
  color: #f0f0f0;
  font-size: 1rem;
  outline: none;
  transition: border-color 0.15s;
}

.field input:focus { border-color: #f97316; }

.login-box button[type="submit"] {
  width: 100%;
  padding: 14px;
  background: #f97316;
  color: #000;
  border: none;
  border-radius: 9px;
  font-size: 0.9rem;
  font-weight: 800;
  letter-spacing: 3px;
  text-transform: uppercase;
  cursor: pointer;
  transition: opacity 0.15s;
  touch-action: manipulation;
}

.login-box button:hover { opacity: 0.88; }

.login-error {
  background: #1a0505;
  color: #f87171;
  border: 1px solid #7f1d1d;
  border-radius: 8px;
  padding: 10px 14px;
  font-size: 0.85rem;
  text-align: center;
  margin-bottom: 18px;
}

/* ── Mobile ── */
@media (max-width: 520px) {
  body { padding: 12px; }

  /* Switch to flex so info section can be reordered below both teams */
  .teams-section {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
  }

  .team-block { flex: 1; min-width: 0; }

  /* At 390px wide: 22vw ≈ 86px — readable and safe for 3-digit scores */
  .score { font-size: clamp(4.5rem, 22vw, 6rem); }

  .score-controls { gap: 4px; }

  /* Info section drops below both teams, full width, centered */
  .info-section {
    order: 3;
    width: 100%;
    text-align: center;
    white-space: normal;
  }

  .info-row { justify-content: center; }

  .info-label { min-width: 56px; }
}
