/* =========================================================
   BASE
   ========================================================= */

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: Inter, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
}

button {
  font: inherit;
}

.app {
  max-width: 1680px;
  margin: 0 auto;
  padding: 20px;
}


/* =========================================================
   HEADER / TOPBAR
   ========================================================= */

.topbar {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 14px;
  margin-bottom: 18px;
  align-items: start;
}

.topbar-main {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  align-items: flex-start;
}

.topbar h1 {
  margin: 0 0 6px 0;
  font-size: 30px;
}

.topbar-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  align-items: center;
}

.topbar-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  grid-column: 1 / -1;
}


/* =========================================================
   NAVIGATION
   ========================================================= */

.topnav {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.nav-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  padding: 0 14px;
  border-radius: 999px;
  border: 1px solid rgba(99, 179, 237, 0.25);
  background: var(--card);
  color: #63b3ed;
  text-decoration: none;
  box-shadow: var(--shadow);
  font-weight: 600;
  transition: all 0.18s ease;
}

.nav-link:hover {
  background: rgba(99, 179, 237, 0.08);
  border-color: rgba(99, 179, 237, 0.45);
  color: #8ac8f5;
}

.nav-link-active {
  border-color: rgba(99, 179, 237, 0.45);
  color: #63b3ed;
  box-shadow: 0 0 0 1px rgba(99, 179, 237, 0.2), var(--shadow);
}


/* =========================================================
   SUBTITLE
   ========================================================= */

.subtitle {
  color: var(--muted);
}

.subtitle-accent {
  color: #63b3ed;
  font-weight: 600;
}

.subtitle-live-hot {
  color: #ef4444;
  animation: subtitleLivePulse 1.8s ease-in-out infinite;
}

@keyframes subtitleLivePulse {
  0% {
    color: #ef4444;
    text-shadow: 0 0 0 rgba(239, 68, 68, 0);
  }
  50% {
    color: #f87171;
    text-shadow: 0 0 10px rgba(239, 68, 68, 0.35);
  }
  100% {
    color: #ef4444;
    text-shadow: 0 0 0 rgba(239, 68, 68, 0);
  }
}


/* =========================================================
   LIVE BANNER
   ========================================================= */

.live-banner {
  height: 2px;
  width: 100%;
  background: #22c55e;
  box-shadow: 0 0 8px rgba(34, 197, 94, 0.5);
  position: sticky;
  top: 0;
  z-index: 50;
}

.live-banner.hidden {
  display: none;
}


/* =========================================================
   PILLS / BADGES
   ========================================================= */

.pill,
.badge {
  background: var(--card-2);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 999px;
  padding: 8px 12px;
  font-size: 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.pill-fixed {
  min-width: 170px;
  text-align: center;
}

.pill-count {
  min-width: 110px;
  text-align: center;
  gap: 6px;
}

.pill-good {
  border-color: rgba(34, 197, 94, 0.35);
}

.pill-warn {
  border-color: rgba(245, 158, 11, 0.35);
}

.pill-info {
  border-color: rgba(99, 179, 237, 0.28);
}


/* =========================================================
   STATE PILLS
   ========================================================= */

.pill-idle {
  border-color: rgba(156, 163, 175, 0.35);
  color: var(--muted);
}

.pill-prelive {
  border-color: rgba(245, 158, 11, 0.45);
  color: #f59e0b;
  box-shadow: 0 0 8px rgba(245, 158, 11, 0.18);
  animation: pulsePreLive 2.2s infinite;
}

.pill-error {
  border-color: rgba(239, 68, 68, 0.5);
  color: #ef4444;
  box-shadow: 0 0 10px rgba(239, 68, 68, 0.25);
}

.pill-live {
  border-color: rgba(34, 197, 94, 0.4);
  color: #22c55e;
  font-weight: 600;
  box-shadow: 0 0 8px rgba(34, 197, 94, 0.2);
  animation: pulseLive 2s infinite;
}

@keyframes pulsePreLive {
  0% { box-shadow: 0 0 0 rgba(245, 158, 11, 0); }
  50% { box-shadow: 0 0 12px rgba(245, 158, 11, 0.28); }
  100% { box-shadow: 0 0 0 rgba(245, 158, 11, 0); }
}

@keyframes pulseLive {
  0% { box-shadow: 0 0 0 rgba(34, 197, 94, 0); }
  50% { box-shadow: 0 0 12px rgba(34, 197, 94, 0.35); }
  100% { box-shadow: 0 0 0 rgba(34, 197, 94, 0); }
}


/* =========================================================
   CARDS / SECTIONS
   ========================================================= */

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 20px;
  box-shadow: var(--shadow);
}

.card h2,
.card h3 {
  margin-top: 0;
}

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


/* =========================================================
   LAYOUT
   ========================================================= */

.grid-top {
  display: grid;
  grid-template-columns: 1fr 1.4fr;
  gap: 16px;
  margin-bottom: 16px;
}

.grid-bottom {
  display: grid;
  grid-template-columns: 1fr 1.1fr;
  gap: 16px;
  margin-top: 16px;
}

.full-width {
  grid-column: 1 / -1;
}


/* =========================================================
   STATUS / STATE BOXES
   ========================================================= */

.status-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}

.stat-box {
  background: var(--card-2);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.stat-label {
  color: var(--muted);
  font-size: 13px;
}

.stat-value {
  font-size: 22px;
  font-weight: 700;
}


/* =========================================================
   FOCUS PANEL
   ========================================================= */

.focus-card {
  min-height: 280px;
}

.focus-empty {
  color: var(--muted);
  background: var(--card-2);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px;
  min-height: 180px;
  display: flex;
  align-items: center;
}

.focus-panel-inner {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.focus-title {
  font-size: 24px;
  font-weight: 700;
}

.focus-subtitle {
  color: var(--muted);
}

.focus-meta-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}

.focus-mini {
  background: var(--card-2);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px;
}

.focus-mini-label {
  color: var(--muted);
  font-size: 12px;
  margin-bottom: 6px;
  display: block;
}

.focus-mini-value {
  font-size: 18px;
  font-weight: 700;
}

.focus-charts {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.focus-chart-title {
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 8px;
}

.focus-flags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}


/* =========================================================
   WATCHLIST / LISTS
   ========================================================= */

.watch-columns {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.list-block {
  background: var(--card-2);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px;
  min-height: 120px;
  color: var(--muted);
}

.list-item {
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
}

.list-item:last-child {
  border-bottom: none;
}

.list-item-title {
  font-weight: 600;
  color: var(--text);
}

.list-item-meta {
  color: var(--muted);
  font-size: 13px;
  margin-top: 4px;
}


/* =========================================================
   TODAY PANEL
   ========================================================= */

.today-group {
  margin-bottom: 14px;
  background: var(--card-2);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px;
}

.today-group-title {
  font-weight: 700;
  margin-bottom: 10px;
}

.today-item {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
}

.today-item:last-child {
  border-bottom: none;
}

.today-item-main {
  font-weight: 500;
}

.today-item-time {
  color: var(--muted);
  white-space: nowrap;
}

.today-item-livehint {
  color: var(--danger);
  font-weight: 700;
}

.today-item-countdown {
  color: var(--accent);
  font-weight: 700;
}

.today-item-countdown {
  color: #f59e0b;
  font-weight: 700;
}

.today-item-livehint {
  color: #ef4444;
  font-weight: 700;
}


/* =========================================================
   TABLE
   ========================================================= */

.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th,
td {
  text-align: left;
  padding: 12px 10px;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
  font-size: 14px;
}

th {
  color: var(--muted);
  font-weight: 600;
}

.empty-row {
  text-align: center;
  color: var(--muted);
  padding: 24px;
}

.live-row {
  cursor: pointer;
  transition: background 0.15s ease;
}

.live-row:hover {
  background: rgba(99, 179, 237, 0.08);
}

.live-row.selected {
  background: rgba(99, 179, 237, 0.14);
}

.row-danger {
  box-shadow: inset 3px 0 0 var(--danger);
}

.row-entry {
  box-shadow: inset 3px 0 0 var(--accent);
}


/* =========================================================
   FLAGS / TAGS
   ========================================================= */

.cards-block {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.flag {
  display: inline-block;
  padding: 4px 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
}

.flag-entry {
  background: rgba(37, 99, 235, 0.16);
  color: var(--accent);
}

.flag-danger {
  background: rgba(239, 68, 68, 0.16);
  color: var(--danger);
}

.flag-calm {
  background: rgba(34, 197, 94, 0.16);
  color: var(--good);
}

.flag-neutral {
  background: rgba(245, 158, 11, 0.18);
  color: var(--warn);
}

.flag-chaotic {
  background: rgba(239, 68, 68, 0.16);
  color: var(--danger);
}

.flag-info {
  background: rgba(99, 179, 237, 0.16);
  color: var(--accent);
}

.flag-btts {
  background: rgba(139, 92, 246, 0.16);
  color: var(--btts);
}

.flag-over {
  background: rgba(6, 182, 212, 0.16);
  color: var(--over);
}

.flag-penalty {
  background: rgba(251, 191, 36, 0.2);
  color: var(--penalty);
}


/* =========================================================
   CHART BARS
   ========================================================= */

.metric-bar-wrap {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.metric-bar,
.momentum-bar {
  height: 12px;
  border-radius: 999px;
  overflow: hidden;
  background: var(--border);
  display: flex;
}

.metric-bar-home {
  background: linear-gradient(90deg, #3b82f6, #60a5fa);
}

.metric-bar-away {
  background: linear-gradient(90deg, #ef4444, #f87171);
}

.momentum-fill {
  height: 100%;
  border-radius: 999px;
}

.momentum-low {
  background: linear-gradient(90deg, #22c55e, #86efac);
}

.momentum-mid {
  background: linear-gradient(90deg, #f59e0b, #fcd34d);
}

.momentum-high {
  background: linear-gradient(90deg, #ef4444, #fca5a5);
}

.metric-bar-label {
  color: var(--muted);
  font-size: 12px;
}


/* =========================================================
   FOCUS TIMELINE
   ========================================================= */

.focus-timeline {
  margin-top: 14px;
  background: var(--card-2);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px;
}

.focus-timeline-title {
  font-size: 14px;
  font-weight: 700;
  margin-bottom: 10px;
}

.focus-timeline-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.focus-timeline-item {
  border-bottom: 1px solid var(--border);
  padding-bottom: 8px;
}

.focus-timeline-item:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.focus-timeline-line {
  font-size: 14px;
}

.focus-timeline-meta {
  color: var(--muted);
  font-size: 12px;
  margin-top: 3px;
}


/* =========================================================
   FOOTER
   ========================================================= */

.footer {
  margin-top: 40px;
  padding: 18px 20px;
  border-top: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.02);
}

.footer-inner {
  max-width: 1680px;
  margin: 0 auto;
  text-align: center;
  color: var(--muted);
  font-size: 13px;
  opacity: 0.7;
}

footer {
  margin-top: auto;
  padding-bottom: 10px;
}


/* =========================================================
   RESPONSIVE
   ========================================================= */

@media (max-width: 1100px) {
  .grid-top,
  .grid-bottom,
  .focus-charts {
    grid-template-columns: 1fr;
  }

  .watch-columns,
  .focus-meta-grid {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 760px) {
  .watch-columns,
  .focus-meta-grid,
  .status-grid {
    grid-template-columns: 1fr;
  }

  .topbar {
    grid-template-columns: 1fr;
  }

  .topbar-main {
    flex-direction: column;
  }

  .topnav {
    justify-content: flex-start;
  }

  .today-item {
    flex-direction: column;
  }

  .footer-inner {
    text-align: center;
    gap: 6px;
  }
}

/* =========================================================
   LAYOUT REWORK
   ========================================================= */

.hidden {
  display: none !important;
}

.grid-top-single {
  margin-bottom: 16px;
}

.full-width-card {
  width: 100%;
}

.today-main-section {
  margin-bottom: 16px;
}

.today-main-groups {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.today-filters {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.today-filter-btn {
  border: 1px solid var(--border);
  background: var(--card-2);
  color: var(--muted);
  border-radius: 999px;
  padding: 7px 12px;
  font-size: 13px;
  cursor: pointer;
}

.today-filter-btn-active {
  color: var(--text);
  border-color: rgba(99, 179, 237, 0.35);
  box-shadow: 0 0 0 1px rgba(99, 179, 237, 0.18);
}

.today-group {
  margin-bottom: 0;
}

.today-item {
  align-items: center;
}

.today-item-left {
  min-width: 74px;
  font-weight: 700;
  color: var(--text);
}

.today-item-main-wrap {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
}

.today-item-main {
  font-weight: 600;
}

.today-item-sub {
  font-size: 12px;
  color: var(--muted);
}

.today-item-right {
  min-width: 110px;
  text-align: right;
}

.today-status-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 74px;
  border-radius: 999px;
  padding: 5px 10px;
  font-size: 12px;
  font-weight: 700;
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--muted);
}

.today-status-upcoming {
  color: var(--accent);
  border-color: rgba(198, 168, 91, 0.28);
}

.today-status-live {
  color: #22c55e;
  border-color: rgba(34, 197, 94, 0.35);
  box-shadow: 0 0 8px rgba(34, 197, 94, 0.15);
}

.today-status-finished {
  color: var(--muted);
}

.focus-card {
  min-height: 320px;
}

.focus-header {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 12px;
  align-items: center;
}

.focus-team {
  font-size: 20px;
  font-weight: 700;
}

.focus-team-right {
  text-align: right;
}

.focus-score-block {
  text-align: center;
}

.focus-score {
  font-size: 34px;
  font-weight: 800;
  line-height: 1;
}

.focus-clock-line {
  color: var(--muted);
  font-size: 13px;
  margin-top: 6px;
}

.focus-alerts {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.focus-alert-pill {
  border-radius: 999px;
  padding: 7px 12px;
  font-size: 12px;
  font-weight: 800;
  border: 1px solid var(--border);
  background: var(--card-2);
}

.focus-alert-goal {
  color: #22c55e;
  border-color: rgba(34, 197, 94, 0.35);
}

.focus-alert-var {
  color: #a78bfa;
  border-color: rgba(167, 139, 250, 0.35);
}

.focus-alert-penalty {
  color: #fbbf24;
  border-color: rgba(251, 191, 36, 0.35);
}

.focus-alert-red {
  color: #ef4444;
  border-color: rgba(239, 68, 68, 0.35);
}

.focus-stats-block {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.stat-compare-row {
  display: grid;
  grid-template-columns: 56px 1fr 56px;
  gap: 10px;
  align-items: center;
}

.stat-compare-mid {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.stat-compare-label {
  text-align: center;
  font-size: 13px;
  color: var(--muted);
  font-weight: 600;
}

.stat-compare-bar {
  height: 10px;
  border-radius: 999px;
  overflow: hidden;
  background: rgba(255,255,255,0.06);
  display: flex;
}

.stat-compare-home {
  background: linear-gradient(90deg, #22c55e, #86efac);
}

.stat-compare-away {
  background: linear-gradient(90deg, #3b82f6, #93c5fd);
}

.stat-compare-value {
  font-size: 14px;
  font-weight: 800;
}

.stat-compare-value-right {
  text-align: right;
}

.momentum-mini {
  width: 110px;
  height: 8px;
  border-radius: 999px;
  overflow: hidden;
  background: rgba(255,255,255,0.06);
  display: flex;
}

.momentum-mini-home {
  background: linear-gradient(90deg, #22c55e, #86efac);
}

.momentum-mini-away {
  background: linear-gradient(90deg, #3b82f6, #93c5fd);
}

.live-actions {
  display: flex;
  gap: 6px;
}

.live-action-btn {
  border: 1px solid var(--border);
  background: var(--card-2);
  color: var(--muted);
  border-radius: 8px;
  padding: 4px 8px;
  font-size: 12px;
  cursor: pointer;
}

.live-row-low-priority {
  opacity: 0.45;
}

.floating-alerts {
  position: fixed;
  top: 18px;
  right: 18px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  z-index: 9999;
  pointer-events: none;
}

.floating-alert {
  min-width: 220px;
  max-width: 360px;
  border-radius: 14px;
  padding: 12px 14px;
  background: rgba(10, 10, 14, 0.96);
  border: 1px solid var(--border);
  box-shadow: 0 12px 30px rgba(0,0,0,0.35);
  font-size: 13px;
  font-weight: 700;
}

.floating-alert-goal {
  border-color: rgba(34, 197, 94, 0.35);
  color: #86efac;
}

.floating-alert-var {
  border-color: rgba(167, 139, 250, 0.35);
  color: #c4b5fd;
}

.floating-alert-penalty {
  border-color: rgba(251, 191, 36, 0.35);
  color: #fde68a;
}

.floating-alert-red {
  border-color: rgba(239, 68, 68, 0.35);
  color: #fca5a5;
}

@media (max-width: 760px) {
  .focus-header {
    grid-template-columns: 1fr;
    text-align: center;
  }

  .focus-team-right {
    text-align: center;
  }

  .today-item {
    flex-direction: column;
    align-items: flex-start;
  }

  .today-item-right {
    text-align: left;
    min-width: auto;
  }

  .stat-compare-row {
    grid-template-columns: 44px 1fr 44px;
  }
}