:root {
  --bg: #0c0f14;
  --surface: #151a24;
  --border: #2a3344;
  --text: #e8edf5;
  --muted: #8b97ad;
  --accent: #3d8bfd;
  --accent-dim: rgba(61, 139, 253, 0.25);
  --live: #34c759;
  --focus: #f5a623;
  --touch-min: 48px;
}

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

html {
  font-size: clamp(16px, 1.1vw + 12px, 24px);
}

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  font-family: "Segoe UI", system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.45;
  -webkit-tap-highlight-color: transparent;
}

a {
  color: var(--accent);
}

/* Одна строка: только «Обновить», без лишней прокрутки пультом */
.toolbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 0.5rem 0.75rem;
  padding-top: calc(max(0.5rem, env(safe-area-inset-top)) + 1cm);
  background: var(--bg);
  border-bottom: 1px solid var(--border);
}

.btn {
  font: inherit;
  padding: 0.5rem 1.25rem;
  border-radius: 12px;
  border: 2px solid transparent;
  cursor: pointer;
  min-height: var(--touch-min);
  min-width: var(--touch-min);
}

.btn-refresh {
  width: 100%;
  max-width: 28rem;
  min-height: 3.5rem;
  font-size: 1.2rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.btn--ghost {
  background: var(--surface);
  color: var(--text);
  border-color: var(--border);
}

.btn--ghost:focus-visible,
.btn--primary:focus-visible,
.btn--ghost:focus {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}

main {
  padding: 0.5rem 1.25rem 2rem;
  padding-bottom: max(2rem, env(safe-area-inset-bottom));
  max-width: 1200px;
  margin: 0 auto;
}

.status {
  color: var(--muted);
  margin: 0 0 1rem;
  min-height: 1.5em;
}

.status--err {
  color: #ff6b6b;
}

.grid {
  display: grid;
  gap: 1rem;
  grid-template-columns: 1fr;
}

@media (min-width: 720px) {
  .grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (min-width: 1100px) {
  .grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

.card {
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: 12px;
  padding: 1.1rem 1rem 0.9rem;
  text-decoration: none;
  color: inherit;
  transition: border-color 0.15s, box-shadow 0.15s;
  outline: none;
  min-height: 200px;
  cursor: default;
}

.card:hover,
.card:focus-visible,
.card:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-dim);
}

.card:focus-visible,
.card:focus {
  outline: 3px solid var(--focus);
  outline-offset: 3px;
}

.card__teams {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}

.card__team {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  flex: 1;
  min-width: 0;
}

.card__logo {
  width: 64px;
  height: 64px;
  object-fit: contain;
  margin-bottom: 0.35rem;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.04);
}

.card__name {
  font-weight: 600;
  font-size: 0.95rem;
  word-break: break-word;
}

.card__vs {
  flex-shrink: 0;
  color: var(--muted);
  font-weight: 700;
  font-size: 0.9rem;
}

.card__time {
  font-size: 0.9rem;
  color: var(--muted);
  margin-bottom: 0.35rem;
}

.card__time strong {
  color: var(--text);
  font-weight: 600;
}

.card__countdown {
  font-size: 1.05rem;
  font-weight: 700;
  margin-bottom: 0.75rem;
  letter-spacing: 0.02em;
}

.card__countdown--live {
  color: var(--live);
}

.card__countdown--past {
  color: var(--muted);
  font-weight: 600;
}

.card__cta {
  margin-top: auto;
  padding-top: 0.5rem;
  border-top: 1px solid var(--border);
  color: var(--accent);
  font-weight: 600;
  font-size: 0.95rem;
}

@media (min-width: 1280px) {
  .card__logo {
    width: 80px;
    height: 80px;
  }
}

@media (min-width: 1920px) {
  main {
    max-width: 1600px;
  }

  .grid {
    gap: 1.25rem;
  }
}

/* Телевизоры / пульт: крупнее сетка и фокус */
@media (min-width: 1280px) and (min-height: 800px) {
  html {
    font-size: clamp(18px, 1.2vw + 14px, 28px);
  }

  .btn-refresh {
    min-height: 4rem;
    font-size: 1.3rem;
    max-width: 32rem;
  }
}

/* Samsung Tizen (браузер): крупнее цели и сетка 2 колонки — проще пультом, чем 3 */
@media (min-width: 1600px) and (min-height: 900px) {
  .grid {
    grid-template-columns: repeat(2, 1fr) !important;
  }

  :root {
    --touch-min: 52px;
  }
}
