:root {
  --bg: #000000;
  --panel: #000000;
  --line: #ffffff;
  --text: #ffffff;
  --muted: #d7d7d7;
  --accent: #39ff14;
  --danger: #ff0000;
  --a1: #00a651;
  --b1: #1340b0;
  --goal-flash: transparent;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body {
  margin: 0;
  font-family: 'Lexend', system-ui, sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at 50% 18%, var(--goal-flash) 0%, transparent 35%),
    repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.04) 0 2px, transparent 2px 74px),
    linear-gradient(180deg, #030303 0%, #000 100%);
  min-height: 100vh;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  height: 64px;
  border-bottom: 2px solid var(--line);
  padding: 0 14px;
  background: #000;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.brand { display: flex; align-items: center; gap: 10px; }
.brand-logo {
  width: 28px;
  height: 28px;
  object-fit: contain;
  border-radius: 999px;
}
.brand h1 {
  margin: 0;
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 900;
  letter-spacing: 0.02em;
  color: var(--accent);
  font-size: clamp(24px, 6vw, 32px);
  font-style: italic;
}
.icon-btn {
  min-width: 44px;
  min-height: 44px;
  border-radius: 0;
  border: 2px solid #fff;
  background: #000;
  color: #fff;
  display: grid;
  place-items: center;
}

.app {
  max-width: 760px;
  margin: 0 auto;
  padding: 10px 10px 24px;
}
.cardless { margin: 8px 0 14px; }
.card {
  border: 3px solid #fff;
  background: #000;
  padding: 12px;
  margin-bottom: 12px;
}

.live-block {
  display: grid;
  place-items: center;
  gap: 6px;
}
.live-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--accent);
  color: #000;
  font-weight: 900;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  padding: 6px 12px;
}
.live-pill.running .dot {
  animation: pulseFade 1.1s ease-in-out infinite;
}
.dot {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: #000;
}
.period {
  font-size: 13px;
  color: var(--muted);
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}
.clock {
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 900;
  font-size: clamp(56px, 15vw, 90px);
  line-height: 0.95;
  letter-spacing: -0.02em;
  text-shadow: 2px 2px 0 #000;
}
.overtime {
  min-height: 24px;
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 900;
  font-size: 22px;
  letter-spacing: 0.14em;
  color: var(--accent);
}

.scoreboard {
  position: relative;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 12px;
}
.team-slot {
  display: grid;
  gap: 6px;
}
.team-tag {
  text-align: center;
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.16em;
  color: #fff;
}
.team-panel {
  border: 4px solid #fff;
  min-height: 178px;
  padding: 12px;
  text-align: center;
  display: grid;
  justify-items: center;
  align-content: center;
  gap: 10px;
}
.team-a {
  border-color: var(--a1);
  background: radial-gradient(circle at 22% 22%, color-mix(in srgb, var(--a1) 45%, transparent), transparent 58%), #000;
}
.team-b {
  border-color: var(--b1);
  background: radial-gradient(circle at 78% 22%, color-mix(in srgb, var(--b1) 45%, transparent), transparent 58%), #000;
}
.team-panel strong {
  font-family: 'Anton SC', sans-serif;
  font-size: clamp(24px, 4.6vw, 40px);
  text-transform: uppercase;
  line-height: 1;
  color: #fff;
}
.score-number {
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 900;
  font-size: clamp(72px, 18vw, 128px);
  line-height: 0.86;
  color: #fff;
  text-shadow: 2px 2px 0 #000;
  transition: transform 180ms ease, filter 180ms ease;
}
.score-a {
  filter: drop-shadow(0 0 8px color-mix(in srgb, var(--a1) 70%, transparent));
}
.score-b {
  filter: drop-shadow(0 0 8px color-mix(in srgb, var(--b1) 70%, transparent));
}
.vs-chip {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  border: 2px solid #fff;
  background: #000;
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 900;
  padding: 4px 10px;
  letter-spacing: 0.12em;
}

.goal-buttons-outside {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 12px;
}
button {
  border: 3px solid #fff;
  border-radius: 0;
  padding: 10px 12px;
  font-family: 'Lexend', sans-serif;
  font-weight: 900;
  font-size: 14px;
  min-height: 44px;
}
button:active { transform: translateY(1px); }

.goal-btn {
  min-height: 112px;
  display: grid;
  justify-items: center;
  align-content: center;
  gap: 6px;
  text-transform: uppercase;
  letter-spacing: 0.01em;
  font-size: 20px;
}
.goal-btn .material-symbols-outlined { font-size: 44px; }
.goal-btn-a {
  background: linear-gradient(160deg, color-mix(in srgb, var(--a1) 85%, #fff), var(--a1));
  color: #fff;
}
.goal-btn-b {
  background: linear-gradient(160deg, color-mix(in srgb, var(--b1) 85%, #fff), var(--b1));
  color: #fff;
  border-color: #fff;
}

.timer-box { border-color: #8a8a8a; }
.timer-actions {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}
button.ghost {
  background: #000;
  color: #fff;
  border: 3px solid #fff;
}
button.running {
  background: #ff2222;
  color: #fff;
}

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
}
h2 {
  margin: 0;
  font-size: 16px;
  letter-spacing: 0.15em;
  font-weight: 900;
  text-transform: uppercase;
  text-decoration: underline;
  text-decoration-color: var(--accent);
  text-decoration-thickness: 3px;
  text-underline-offset: 5px;
}

#goalsList {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 8px;
}
#goalsList li {
  border: 0;
  border-bottom: 1px solid rgba(255,255,255,.26);
  background: transparent;
  min-height: 50px;
  padding: 9px 2px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}
#goalsList li:last-child { border-bottom: 0; }
.goal-meta { font-size: 14px; font-weight: 800; }
.timeline-marker {
  border-bottom-style: dashed !important;
  opacity: 0.95;
}
.timeline-marker .goal-meta {
  color: #d9d9d9;
  letter-spacing: 0.01em;
}
.delete-goal {
  min-width: 44px;
  min-height: 44px;
  padding: 0;
  display: grid;
  place-items: center;
  font-size: 0;
  position: relative;
}
.delete-goal::before {
  content: '✕';
  font-size: 22px;
  line-height: 1;
  color: #fff;
}

.share h2 {
  text-align: center;
  margin-bottom: 10px;
}
.share-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.share-grid button { min-height: 52px; }
.webapp-row {
  margin-top: 10px;
  display: grid;
  gap: 6px;
}
.install-btn {
  min-height: 52px;
  background: var(--accent);
  color: #000;
  border: 3px solid #fff;
}
.install-hint {
  margin: 0;
  font-size: 12px;
  color: #d2d2d2;
}

.settings summary {
  cursor: pointer;
  font-weight: 900;
  font-size: 15px;
}
.settings-grid { margin-top: 10px; display: grid; gap: 10px; }
label { font-size: 13px; color: #fff; display: grid; gap: 6px; }
input {
  width: 100%;
  background: #000;
  border: 2px solid #fff;
  color: #fff;
  border-radius: 0;
  padding: 10px;
  font-size: 16px;
}
.palette { display: flex; flex-wrap: wrap; gap: 8px; }
.swatch {
  width: 28px;
  height: 28px;
  border-radius: 999px;
  border: 2px solid #fff;
}
.swatch.active { outline: 2px solid #39ff14; outline-offset: 2px; }

.tiny {
  text-align: center;
  color: #d2d2d2;
  font-size: 12px;
  margin: 10px 0 0;
}

.goal-banner {
  position: fixed;
  top: calc(env(safe-area-inset-top, 0px) + 6px);
  left: 50%;
  transform: translate(-50%, -220%);
  opacity: 0;
  pointer-events: none;
  z-index: 40;
  padding: 8px 16px;
  background: #fff01f;
  color: #000;
  border: 3px solid #000;
  font-family: 'Anton SC', sans-serif;
  font-size: 34px;
  letter-spacing: 0.06em;
  transition: transform 220ms ease, opacity 160ms ease;
}
.goal-banner.show {
  transform: translate(-50%, 0);
  opacity: 1;
}

.update-banner {
  position: fixed;
  left: 10px;
  right: 10px;
  top: calc(env(safe-area-inset-top, 0px) + 72px);
  z-index: 45;
  background: #111;
  border: 2px solid #39ff14;
  color: #fff;
  padding: 10px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  font-size: 13px;
}
.update-btn {
  min-height: 40px;
  padding: 8px 10px;
  border: 2px solid #fff;
  background: #39ff14;
  color: #000;
  font-weight: 900;
}

body.goal-flash-a { --goal-flash: color-mix(in srgb, var(--a1) 30%, transparent); }
body.goal-flash-b { --goal-flash: rgba(255,255,255,.12); }
.goal-burst { animation: goalBurst .4s ease; }
@keyframes goalBurst {
  0% { transform: scale(1); }
  35% { transform: scale(1.08); }
  100% { transform: scale(1); }
}
@keyframes pulseFade {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.25; }
}

@media (max-width: 640px) {
  .timer-actions { grid-template-columns: 1fr; }
}

@media (max-width: 420px) {
  .app { padding-left: 8px; padding-right: 8px; }
  .scoreboard { gap: 6px; }
  .team-panel { min-height: 160px; padding: 8px; }
  .goal-btn { min-height: 96px; font-size: 17px; }
}

@media (max-width: 360px) {
  .scoreboard, .goal-buttons-outside, .share-grid { grid-template-columns: 1fr; }
  .vs-chip { display: none; }
}
