/* Fenrir Sports PWA v0.1.1 — mobile-first, calm live cues */
:root {
  --bg0: #07140f;
  --bg1: #0b1f17;
  --panel: rgba(18, 42, 33, 0.92);
  --line: rgba(180, 220, 200, 0.14);
  --text: #e8f5ee;
  --muted: #9bb5a8;
  --accent: #6fbf8c;
  --live: #ff5a4a;
  --live-soft: rgba(255, 90, 74, 0.18);
  --finished: #7f93a3;
  --radius: 16px;
  --shadow: 0 14px 32px rgba(0, 0, 0, 0.32);
  font-family: "Avenir Next", "Segoe UI", "Helvetica Neue", sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  min-height: 100%;
  background:
    radial-gradient(1200px 600px at 10% -10%, rgba(111, 191, 140, 0.18), transparent 55%),
    radial-gradient(900px 500px at 100% 0%, rgba(255, 90, 74, 0.12), transparent 45%),
    linear-gradient(180deg, var(--bg1), var(--bg0));
  color: var(--text);
}

body {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

.skip-link {
  position: absolute;
  left: -999px;
}

.topbar, .shell, .footer {
  width: min(720px, calc(100% - 1.5rem));
  margin-inline: auto;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.1rem 0 0.4rem;
}

.brand {
  display: flex;
  gap: 0.85rem;
  align-items: center;
}

.brand-mark {
  width: 2.4rem;
  height: 2.4rem;
  border-radius: 0.85rem;
  background:
    linear-gradient(145deg, #8fd9a8, #2f6b4c 55%, #163528);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.15);
}

.brand-kicker {
  margin: 0;
  color: var(--muted);
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.topbar h1 {
  margin: 0.1rem 0 0;
  font-size: 1.35rem;
  font-weight: 700;
}

.shell {
  flex: 1;
  padding-bottom: 2rem;
}

.tabs {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.15rem;
  margin: 0.8rem 0 0.65rem;
  padding: 0.22rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(0,0,0,0.18);
  overflow: hidden;
}

.tab, .ghost-btn, .offline-card button {
  border: 0;
  background: transparent;
  color: var(--text);
  font: inherit;
  cursor: pointer;
}

.tab {
  border-radius: 999px;
  padding: 0.55rem 0.1rem;
  color: var(--muted);
  font-size: 0.78rem;
  letter-spacing: -0.01em;
  white-space: nowrap;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

.tab.is-active {
  background: rgba(111, 191, 140, 0.18);
  color: var(--text);
}

.ghost-btn {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.45rem 0.85rem;
  color: var(--muted);
}

.meta {
  margin: 0 0 0.7rem;
  color: var(--muted);
  font-size: 0.82rem;
  letter-spacing: 0.01em;
}

.match-list {
  display: grid;
  gap: 0.55rem;
}

.match-card {
  display: block;
  width: 100%;
  text-align: left;
  padding: 0.78rem 0.9rem;
  min-height: 4.4rem;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: var(--panel);
  box-shadow: var(--shadow);
  color: inherit;
  font: inherit;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.match-card:active {
  border-color: rgba(111, 191, 140, 0.35);
}

.match-card:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.match-card[data-category="live"] {
  border-color: rgba(255, 90, 74, 0.45);
  background:
    linear-gradient(180deg, var(--live-soft), transparent 48%),
    var(--panel);
}

.match-card[data-category="half_time"] {
  border-color: rgba(180, 200, 120, 0.28);
}

.card-body {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  min-width: 0;
}

.card-main {
  flex: 1 1 auto;
  min-width: 0;
  display: grid;
  gap: 0.28rem;
}

.card-aside {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  min-width: 3.1rem;
}

.card-status-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem 0.55rem;
  min-width: 0;
}

.card-date {
  color: var(--muted);
  font-size: 0.78rem;
  white-space: nowrap;
}

.teams {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.28rem 0.35rem;
  font-size: 1rem;
  font-weight: 650;
  line-height: 1.25;
  min-width: 0;
}

.team {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 100%;
}

.teams-sep {
  color: var(--muted);
  font-weight: 500;
  flex: 0 0 auto;
}

.venue {
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.2;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.score {
  font-variant-numeric: tabular-nums;
  font-size: 1.28rem;
  font-weight: 700;
  letter-spacing: 0.01em;
  text-align: right;
  line-height: 1;
  white-space: nowrap;
}

.card-time {
  font-variant-numeric: tabular-nums;
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: 0.01em;
  text-align: right;
  line-height: 1;
  color: var(--text);
  white-space: nowrap;
}

.card-time--empty {
  color: var(--muted);
  font-weight: 500;
}

.score.is-blink {
  animation: scorePulse 0.9s ease;
}

.status-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.16rem 0.5rem;
  border-radius: 999px;
  font-size: 0.68rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  background: rgba(255,255,255,0.06);
  color: var(--muted);
  white-space: nowrap;
}

.status-chip[data-category="live"] {
  background: var(--live-soft);
  color: #ffb4ac;
}

.status-chip[data-category="live"]::before {
  content: "";
  width: 0.42rem;
  height: 0.42rem;
  border-radius: 50%;
  background: var(--live);
  box-shadow: 0 0 0 0 rgba(255, 90, 74, 0.7);
  animation: livePulse 1.8s ease-out infinite;
}

.status-chip[data-category="half_time"] {
  background: rgba(200, 210, 120, 0.12);
  color: #d7e0a8;
}

.status-chip[data-category="finished"] {
  background: rgba(127, 147, 163, 0.16);
  color: #c4d0da;
}

.status-chip[data-category="upcoming"] {
  background: rgba(111, 191, 140, 0.1);
  color: #b7dcc6;
}

.status-minute {
  font-variant-numeric: tabular-nums;
  letter-spacing: 0;
  opacity: 0.95;
}

.row {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  align-items: center;
}

.kickoff {
  color: var(--muted);
  font-size: 0.9rem;
}

.detail-card {
  margin-top: 0.85rem;
  padding: 1.05rem 1rem 1.2rem;
  border-radius: calc(var(--radius) + 4px);
  border: 1px solid var(--line);
  background: var(--panel);
  box-shadow: var(--shadow);
}

.detail-card h2 {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.3rem 0.4rem;
  margin: 0.4rem 0 0.15rem;
  font-size: 1.35rem;
  line-height: 1.2;
}

.detail-card h2 .team {
  white-space: normal;
  overflow: visible;
  text-overflow: unset;
}

.detail-score {
  font-size: 2.35rem;
  font-weight: 760;
  font-variant-numeric: tabular-nums;
  margin: 0.45rem 0;
}

.detail-kickoff-time {
  font-size: 2rem;
  font-weight: 720;
  font-variant-numeric: tabular-nums;
  margin: 0.45rem 0;
  color: var(--text);
}

.detail-meta {
  display: grid;
  gap: 0.35rem;
  color: var(--muted);
  margin-bottom: 1.1rem;
  font-size: 0.9rem;
}

.detail-skeleton {
  display: grid;
  gap: 0.55rem;
  margin-top: 0.35rem;
}

.skeleton-line {
  height: 0.75rem;
  border-radius: 999px;
  background: linear-gradient(
    90deg,
    rgba(255, 255, 255, 0.05),
    rgba(255, 255, 255, 0.12),
    rgba(255, 255, 255, 0.05)
  );
  background-size: 200% 100%;
  animation: skeletonShimmer 1.2s ease-in-out infinite;
}

.skeleton-line--title { height: 1.25rem; width: 78%; }
.skeleton-line--score { height: 2rem; width: 30%; }
.skeleton-line--short { width: 55%; }
.skeleton-inline { min-height: 1em; }

@keyframes skeletonShimmer {
  0% { background-position: 100% 0; }
  100% { background-position: -100% 0; }
}

@media (prefers-reduced-motion: reduce) {
  .skeleton-line {
    animation: none;
  }
}

.timeline {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.55rem;
}

.timeline li {
  display: grid;
  grid-template-columns: 3.2rem 1fr;
  gap: 0.65rem;
  padding: 0.65rem 0.7rem;
  border-radius: 12px;
  background: rgba(0,0,0,0.18);
  border: 1px solid rgba(255,255,255,0.04);
}

.timeline .minute {
  font-variant-numeric: tabular-nums;
  color: var(--accent);
  font-weight: 650;
}

.timeline .event-type {
  font-size: 0.72rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}

.error {
  color: #ffb4ac;
  background: rgba(255, 90, 74, 0.12);
  border: 1px solid rgba(255, 90, 74, 0.25);
  border-radius: 12px;
  padding: 0.85rem 1rem;
}

.hidden { display: none !important; }

.footer {
  padding: 0.5rem 0 1.4rem;
  color: var(--muted);
  font-size: 0.8rem;
}

.offline-body {
  display: grid;
  place-items: center;
  min-height: 100dvh;
  padding: 1.5rem;
}

.offline-card {
  width: min(420px, 100%);
  padding: 1.4rem;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: var(--panel);
}

.offline-card button {
  margin-top: 1rem;
  padding: 0.7rem 1rem;
  border-radius: 999px;
  background: rgba(111, 191, 140, 0.2);
}

.date-group {
  margin: 0.85rem 0 0.45rem;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 650;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.date-group:first-child {
  margin-top: 0.15rem;
}

.event-summary {
  margin-top: 0.35rem;
  display: flex;
  flex-direction: column;
  gap: 0.18rem;
  min-width: 0;
}

.event-summary-goals {
  color: var(--text);
  font-size: 0.78rem;
  line-height: 1.25;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.event-summary-more,
.event-summary-cards {
  color: var(--muted);
  font-size: 0.74rem;
  line-height: 1.2;
}

.load-more-wrap {
  display: flex;
  justify-content: center;
  margin: 0.9rem 0 0.2rem;
}

.load-more-btn {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.55rem 1rem;
  background: rgba(111, 191, 140, 0.12);
  color: var(--text);
  font: inherit;
  cursor: pointer;
}

.h2h-section {
  margin-top: 1.1rem;
}

.h2h-section h3 {
  margin: 0 0 0.55rem;
  font-size: 0.95rem;
}

.h2h-list {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.h2h-item {
  width: 100%;
  text-align: left;
  border: 1px solid var(--line);
  border-radius: 0.85rem;
  padding: 0.65rem 0.75rem;
  background: rgba(0, 0, 0, 0.16);
  color: inherit;
  font: inherit;
  cursor: pointer;
}

.h2h-item .h2h-date {
  color: var(--muted);
  font-size: 0.75rem;
  margin-bottom: 0.2rem;
}

.h2h-item .h2h-row {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  align-items: baseline;
}

.h2h-item .h2h-teams {
  font-weight: 650;
  font-size: 0.92rem;
  min-width: 0;
}

.h2h-item .h2h-score {
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  white-space: nowrap;
}

@keyframes livePulse {
  0% { box-shadow: 0 0 0 0 rgba(255, 90, 74, 0.55); }
  70% { box-shadow: 0 0 0 0.55rem rgba(255, 90, 74, 0); }
  100% { box-shadow: 0 0 0 0 rgba(255, 90, 74, 0); }
}

@keyframes scorePulse {
  0% { transform: scale(1); color: var(--text); }
  35% { transform: scale(1.08); color: #fff6c8; }
  100% { transform: scale(1); color: var(--text); }
}

@media (prefers-reduced-motion: reduce) {
  .status-chip[data-category="live"]::before,
  .score.is-blink,
  .match-card {
    animation: none !important;
    transition: none !important;
  }
}

@media (max-width: 380px) {
  .teams {
    font-size: 0.95rem;
  }

  .score,
  .card-time {
    font-size: 1.05rem;
  }

  .card-aside {
    min-width: 2.75rem;
  }
}
