:root {
  color-scheme: dark;
  --bg: #05080b;
  --panel: #0b131a;
  --panel-2: #101923;
  --line: rgba(154, 179, 204, .16);
  --text: #edf3fa;
  --muted: #8c98a6;
  --green: #52df8b;
  --red: #ff5b72;
  --yellow: #ffbd36;
  --blue: #7bb8ff;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at 80% -10%, rgba(60, 147, 209, .14), transparent 30%),
    linear-gradient(180deg, #05070a, #081018 55%, #05080b);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", sans-serif;
  letter-spacing: 0;
}

button, input { font: inherit; }
button { cursor: pointer; }

.app {
  width: min(100%, 520px);
  min-height: 100vh;
  margin: 0 auto;
  padding: max(18px, env(safe-area-inset-top)) 14px max(84px, env(safe-area-inset-bottom));
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 6px 4px 18px;
}

h1 {
  margin: 0;
  font-size: 30px;
  line-height: 1.05;
  font-weight: 800;
}

.topbar p {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 14px;
}

.online {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--green);
  font-weight: 700;
}

.online i, .sheet-title i {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 18px rgba(82, 223, 139, .6);
}

.stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--line);
  margin-bottom: 10px;
}

.stats div {
  min-height: 74px;
  padding: 13px 14px;
  background: linear-gradient(180deg, rgba(16, 30, 42, .95), rgba(9, 17, 24, .95));
}

.stats span {
  display: block;
  color: var(--muted);
  font-size: 13px;
  margin-bottom: 8px;
  white-space: nowrap;
}

.stats strong {
  color: var(--green);
  font-size: 18px;
}

.tabs {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(8, 14, 20, .92);
  overflow: hidden;
  margin: 0 0 12px;
}

.tab {
  position: relative;
  min-height: 58px;
  border: 0;
  border-right: 1px solid var(--line);
  background: transparent;
  color: #8e98a6;
  font-weight: 750;
}

.tab:last-child { border-right: 0; }
.tab.active { color: var(--green); }
.tab.active::after {
  content: "";
  position: absolute;
  left: 14px;
  right: 14px;
  bottom: 0;
  height: 2px;
  border-radius: 999px;
  background: var(--green);
}

.toolbar {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  margin-bottom: 10px;
}

.hidden { display: none !important; }

.search {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(13, 22, 31, .95);
  color: var(--muted);
}

.search input {
  width: 100%;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--text);
}

.chip {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(13, 22, 31, .95);
  color: var(--muted);
  padding: 0 12px;
  font-weight: 700;
}

.section-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin: 10px 4px 8px;
  color: var(--muted);
}

.section-head strong {
  color: var(--text);
  font-size: 15px;
}

.content {
  display: grid;
  gap: 10px;
}

.card {
  border: 1px solid var(--line);
  border-radius: 14px;
  background: linear-gradient(180deg, rgba(13, 25, 35, .96), rgba(8, 14, 20, .96));
  overflow: hidden;
  box-shadow: 0 14px 38px rgba(0, 0, 0, .2);
}

.card.finished { opacity: .62; }

.card-head {
  display: grid;
  grid-template-columns: 118px 1fr auto;
  gap: 10px;
  align-items: start;
  padding: 14px 14px 10px;
}

.time {
  font-size: 20px;
  font-weight: 800;
}

.country {
  margin-top: 5px;
  color: var(--muted);
  font-size: 14px;
}

.match {
  min-width: 0;
  font-size: 21px;
  line-height: 1.15;
  font-weight: 850;
}

.status-text {
  margin-top: 6px;
  color: var(--muted);
  font-size: 13px;
}

.badge {
  border: 1px solid currentColor;
  border-radius: 12px;
  padding: 10px 12px;
  font-weight: 850;
  white-space: nowrap;
}

.badge.up { color: var(--green); background: rgba(82, 223, 139, .08); }
.badge.down { color: var(--red); background: rgba(255, 91, 114, .08); }

.rows {
  border-top: 1px solid var(--line);
}

.row {
  display: grid;
  grid-template-columns: 96px 1fr;
  gap: 12px;
  align-items: center;
  min-height: 46px;
  padding: 0 14px;
  border-bottom: 1px solid rgba(154, 179, 204, .1);
}

.row:last-child { border-bottom: 0; }
.label { color: var(--muted); font-weight: 700; }
.value { font-size: 19px; font-weight: 850; }
.odds { white-space: nowrap; font-size: 18px; }
.green { color: var(--green); }
.red { color: var(--red); }
.yellow { color: var(--yellow); }
.muted { color: var(--muted); }

.empty, .denied {
  padding: 26px 18px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(13, 22, 31, .86);
  color: var(--muted);
  line-height: 1.45;
}

.status-grid {
  display: grid;
  gap: 10px;
}

.panel {
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: linear-gradient(180deg, rgba(13, 25, 35, .96), rgba(8, 14, 20, .96));
}

.panel h2 {
  margin: 0 0 12px;
  font-size: 18px;
}

.health {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--green);
  font-size: 22px;
  font-weight: 850;
}

.kv {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  padding: 9px 0;
  border-bottom: 1px solid rgba(154, 179, 204, .1);
}

.kv:last-child { border-bottom: 0; }
.kv span { color: var(--muted); }
.kv strong { text-align: right; }

.category-button {
  width: 100%;
  margin-top: 10px;
  min-height: 48px;
  border: 1px solid rgba(82, 223, 139, .45);
  border-radius: 12px;
  background: rgba(82, 223, 139, .08);
  color: var(--green);
  font-weight: 800;
}

.summary {
  position: fixed;
  left: 50%;
  bottom: max(10px, env(safe-area-inset-bottom));
  transform: translateX(-50%);
  width: min(calc(100% - 28px), 492px);
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(7, 12, 18, .9);
  backdrop-filter: blur(18px);
}

.summary span {
  padding: 12px 8px;
  text-align: center;
  color: var(--muted);
  font-size: 13px;
}

.summary b { color: var(--green); }

.sheet-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, .55);
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s ease;
}

.sheet {
  position: fixed;
  left: 50%;
  bottom: 0;
  transform: translate(-50%, 105%);
  width: min(100%, 520px);
  max-height: 78vh;
  display: flex;
  flex-direction: column;
  padding: 10px 14px max(14px, env(safe-area-inset-bottom));
  border: 1px solid var(--line);
  border-bottom: 0;
  border-radius: 24px 24px 0 0;
  background: #0b131b;
  transition: transform .24s ease;
  box-shadow: 0 -20px 70px rgba(0, 0, 0, .42);
}

.sheet.open { transform: translate(-50%, 0); }
.sheet-backdrop.open {
  opacity: 1;
  pointer-events: auto;
}

.handle {
  width: 42px;
  height: 4px;
  margin: 0 auto 12px;
  border-radius: 999px;
  background: rgba(237, 243, 250, .22);
}

.sheet-title {
  display: flex;
  justify-content: space-between;
  align-items: start;
}

.sheet-title h2 {
  margin: 0;
  font-size: 24px;
}

.sheet-title p {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 8px 0 0;
  color: var(--muted);
}

.icon-btn {
  width: 36px;
  height: 36px;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: rgba(255, 255, 255, .03);
  color: var(--text);
  font-size: 24px;
}

.mode {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1px;
  margin: 14px 0 10px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--line);
}

.mode button {
  min-height: 42px;
  border: 0;
  background: rgba(13, 22, 31, .95);
  color: var(--muted);
  font-weight: 750;
}

.mode .selected {
  color: var(--green);
  background: rgba(82, 223, 139, .08);
}

.quick {
  display: flex;
  gap: 8px;
  margin: 10px 0;
}

.quick button, .secondary, .primary {
  min-height: 42px;
  border-radius: 12px;
  border: 1px solid var(--line);
  padding: 0 14px;
  font-weight: 800;
}

.quick button, .secondary {
  background: rgba(255, 255, 255, .03);
  color: var(--text);
}

.primary {
  border-color: transparent;
  background: var(--green);
  color: #06100a;
}

.countries {
  overflow: auto;
  padding-right: 2px;
}

.country-row {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 12px;
  min-height: 58px;
  border-bottom: 1px solid rgba(154, 179, 204, .1);
}

.country-row strong { display: block; }
.country-row small { color: var(--muted); }
.toggle {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  color: var(--muted);
}

.toggle.on {
  border-color: var(--green);
  background: rgba(82, 223, 139, .14);
  color: var(--green);
}

.sheet-actions {
  margin-top: auto;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.sheet-actions p {
  margin: 0 0 10px;
  color: var(--muted);
  text-align: center;
}

.sheet-actions div {
  display: grid;
  grid-template-columns: 1fr 1.4fr;
  gap: 10px;
}

@media (max-width: 430px) {
  .card-head { grid-template-columns: 88px 1fr; }
  .badge { grid-column: 2; justify-self: start; padding: 7px 10px; }
  .match { font-size: 18px; }
  .row { grid-template-columns: 70px 1fr; }
  .value, .odds { font-size: 16px; }
}
