:root {
  color-scheme: dark;
  --bg: #07120c;
  --panel: rgba(11, 31, 20, 0.92);
  --panel-2: rgba(17, 48, 31, 0.95);
  --line: rgba(255, 255, 255, 0.1);
  --text: #f4fff7;
  --muted: rgba(244, 255, 247, 0.62);
  --green: #35d26f;
  --green-2: #1fa755;
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  min-height: 100%;
  margin: 0;
  background:
    radial-gradient(circle at 20% 0%, rgba(53, 210, 111, 0.18), transparent 32%),
    linear-gradient(180deg, #0b1c12 0%, var(--bg) 100%);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
}

.page {
  min-height: 100vh;
  padding: calc(env(safe-area-inset-top) + 14px) 14px calc(env(safe-area-inset-bottom) + 14px);
}

body.player-mode {
  background: #061008;
}

body.player-mode .page {
  width: 100%;
  min-height: 100vh;
  max-width: none;
  padding: 0;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 54px;
  margin-bottom: 12px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--panel);
  box-shadow: 0 14px 40px rgba(0, 0, 0, 0.24);
}

body.player-mode .topbar {
  display: none;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--green);
  font-size: 11px;
  letter-spacing: 0.12em;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: 18px;
  line-height: 1.25;
}

body.player-mode .eyebrow {
  display: none;
}

body.player-mode h1 {
  font-size: 14px;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

button {
  min-width: 56px;
  min-height: 36px;
  padding: 0 14px;
  border: 0;
  border-radius: 999px;
  background: linear-gradient(135deg, var(--green), var(--green-2));
  color: #041108;
  font-size: 14px;
  font-weight: 700;
}

button:active {
  opacity: 0.82;
}

body.player-mode button {
  min-width: 48px;
  min-height: 28px;
  padding: 0 10px;
  font-size: 12px;
}

.state-card {
  display: grid;
  place-items: center;
  min-height: calc(100vh - 110px);
  gap: 10px;
  padding: 28px;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: var(--panel-2);
  text-align: center;
}

.state-card p {
  color: var(--muted);
  font-size: 13px;
}

.player-shell {
  overflow: hidden;
  height: calc(100vh - 110px);
  min-height: 520px;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: #061008;
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.28);
}

body.player-mode .player-shell {
  --frame-scale: 1;
  --frame-height: 395px;
  width: 100vw;
  height: var(--frame-height);
  min-height: 0;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding-top: env(safe-area-inset-top);
}

iframe {
  display: block;
  width: 100%;
  height: 100%;
  border: 0;
  background: #061008;
}

body.player-mode iframe {
  width: 560px;
  height: 395px;
  flex: 0 0 auto;
  transform: scale(var(--frame-scale));
  transform-origin: top center;
}

.info-panel {
  padding: 12px 12px calc(env(safe-area-inset-bottom) + 18px);
  background: linear-gradient(180deg, #061008 0%, #0b1c12 100%);
}

.match-card,
.section-card {
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--panel);
  box-shadow: 0 12px 34px rgba(0, 0, 0, 0.22);
}

.match-card {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 10px;
  padding: 14px 12px;
}

.team-block,
.match-center {
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.team-logo {
  width: 42px;
  height: 42px;
  margin-bottom: 8px;
  border-radius: 50%;
  object-fit: contain;
  background: rgba(255, 255, 255, 0.08);
}

.team-logo.placeholder {
  display: grid;
  place-items: center;
  color: var(--green);
  font-weight: 800;
}

.team-name {
  max-width: 100%;
  overflow: hidden;
  color: var(--text);
  font-size: 14px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.league-name,
.match-time {
  color: var(--muted);
  font-size: 12px;
}

.score-text {
  margin: 4px 0;
  color: var(--green);
  font-size: 20px;
  line-height: 1.2;
}

.section-card {
  margin-top: 12px;
  padding: 14px 12px;
}

.section-card h2 {
  margin-bottom: 12px;
  font-size: 15px;
}

.summary-item + .summary-item,
.event-row + .event-row,
.standing-row + .standing-row {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
}

.summary-team {
  display: block;
  margin-bottom: 4px;
  color: var(--green);
  font-size: 13px;
  font-weight: 700;
}

.summary-text,
.event-content,
.standing-row {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
}

.stat-row {
  display: grid;
  grid-template-columns: 48px 1fr 48px;
  align-items: center;
  gap: 8px;
}

.stat-row + .stat-row {
  margin-top: 12px;
}

.stat-value {
  color: var(--text);
  font-size: 13px;
  font-weight: 700;
  text-align: center;
}

.stat-label {
  margin-bottom: 5px;
  color: var(--muted);
  font-size: 12px;
  text-align: center;
}

.stat-bars {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 3px;
}

.bar-side {
  height: 6px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
}

.bar-side.home {
  direction: rtl;
}

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

.bar-fill.home {
  background: var(--green);
}

.bar-fill.away {
  background: #5b8def;
}

.event-row {
  display: grid;
  grid-template-columns: 42px 54px 1fr;
  gap: 8px;
  align-items: start;
}

.event-minute {
  color: var(--green);
  font-size: 13px;
  font-weight: 800;
}

.event-type {
  color: var(--text);
  font-size: 13px;
  font-weight: 700;
}

.standing-row {
  display: flex;
  justify-content: space-between;
  gap: 10px;
}

.hidden {
  display: none !important;
}

.spinner {
  width: 34px;
  height: 34px;
  border: 3px solid rgba(255, 255, 255, 0.18);
  border-top-color: var(--green);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

@media (min-width: 768px) {
  .page {
    max-width: 960px;
    margin: 0 auto;
  }
}
