:root {
  --green: #0b7a52;
  --green-soft: #e8f8ef;
  --green-strong: #08663f;
  --gold: #f5b52e;
  --gold-soft: #fff8e2;
  --gold-deep: #825b00;
  --ink: #111f2a;
  --ink-soft: #2a3a47;
  --muted: #626f78;
  --muted-soft: #8a96a0;
  --surface: #f4f7fa;
  --card: #ffffff;
  --border: #e7ecf1;
  --border-strong: #d4dce3;
  --navy: #07293a;
  --navy-soft: #1d3f55;
  --danger: #dc2626;
  --danger-soft: #fee2e2;
  --warning: #f59e0b;
  --shadow-sm: 0 1px 2px rgba(17, 31, 42, 0.04), 0 1px 3px rgba(17, 31, 42, 0.06);
  --shadow-md: 0 4px 12px rgba(17, 31, 42, 0.06), 0 2px 4px rgba(17, 31, 42, 0.04);
  --shadow-lg: 0 12px 32px rgba(17, 31, 42, 0.08), 0 4px 8px rgba(17, 31, 42, 0.04);
  --radius-sm: 10px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-xl: 26px;
  --max-w: 960px;
  --header-h: 76px;
  --tabbar-h: 52px;
}

* {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  margin: 0;
  padding: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif;
  font-size: 15px;
  line-height: 1.5;
  color: var(--ink);
  background: var(--surface);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

img {
  max-width: 100%;
  display: block;
}

button {
  font-family: inherit;
  cursor: pointer;
}

a {
  color: var(--green);
  text-decoration: none;
}

code {
  font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
  font-size: 0.9em;
  background: var(--surface);
  padding: 2px 6px;
  border-radius: 4px;
  color: var(--ink-soft);
}

.app-header {
  position: sticky;
  top: 0;
  z-index: 30;
  background: linear-gradient(135deg, var(--navy) 0%, var(--navy-soft) 100%);
  color: #fff;
  box-shadow: var(--shadow-sm);
}

.header-inner {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 14px 18px;
  display: flex;
  align-items: center;
  gap: 14px;
  min-height: var(--header-h);
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
  flex: 1;
  min-width: 0;
}

.brand-logo {
  width: 52px;
  height: 52px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.1);
  padding: 4px;
  flex-shrink: 0;
}

.brand-text {
  min-width: 0;
}

.brand-text h1 {
  margin: 0;
  font-size: 19px;
  font-weight: 700;
  letter-spacing: -0.01em;
  line-height: 1.2;
}

.brand-sub {
  margin: 2px 0 0;
  font-size: 12.5px;
  color: rgba(255, 255, 255, 0.75);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.icon-btn {
  width: 42px;
  height: 42px;
  border: none;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s, transform 0.3s;
}

.icon-btn:hover {
  background: rgba(255, 255, 255, 0.18);
}

.icon-btn.spinning svg {
  animation: spin 0.8s linear infinite;
}

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

.tabs {
  position: sticky;
  top: var(--header-h);
  z-index: 20;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 0 8px;
  overflow-x: auto;
  scrollbar-width: none;
}

.tabs::-webkit-scrollbar {
  display: none;
}

.tab {
  appearance: none;
  border: none;
  background: transparent;
  color: var(--muted);
  font-size: 14px;
  font-weight: 600;
  padding: 14px 14px;
  position: relative;
  transition: color 0.2s;
  flex: 0 0 auto;
  white-space: nowrap;
}

.tab.active {
  color: var(--green);
}

.tab.active::after {
  content: "";
  position: absolute;
  left: 14px;
  right: 14px;
  bottom: -1px;
  height: 3px;
  background: var(--green);
  border-radius: 3px 3px 0 0;
}

.tab-wrap {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 0 14px;
  display: flex;
}

.app-main {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 18px 14px 80px;
}

.tab-panel {
  animation: fade-in 0.25s ease;
}

.tab-panel[hidden] {
  display: none;
}

@keyframes fade-in {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

.banner {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  margin-bottom: 18px;
  background: var(--green-soft);
  border: 1px solid #c8ead7;
  border-radius: var(--radius-md);
  font-size: 13px;
  color: var(--green-strong);
  flex-wrap: wrap;
}

.banner-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 0 4px rgba(11, 122, 82, 0.18);
  flex-shrink: 0;
}

.banner-text {
  flex: 1;
  min-width: 0;
}

.banner-meta {
  font-size: 12px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.section {
  margin-bottom: 26px;
}

.section-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}

.section-title {
  margin: 0;
  font-size: 16px;
  font-weight: 700;
  color: var(--ink);
  letter-spacing: -0.01em;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.section-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 22px;
  height: 22px;
  padding: 0 8px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
}

.live-dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--danger);
  position: relative;
  flex-shrink: 0;
}

.live-dot::after {
  content: "";
  position: absolute;
  inset: -3px;
  border-radius: 50%;
  border: 2px solid var(--danger);
  opacity: 0.4;
  animation: pulse 1.4s ease-out infinite;
}

@keyframes pulse {
  0% { transform: scale(0.6); opacity: 0.6; }
  100% { transform: scale(1.6); opacity: 0; }
}

.section-toggle {
  width: 100%;
  appearance: none;
  border: none;
  background: transparent;
  padding: 4px 0;
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
  color: var(--ink);
}

.section-toggle .chevron {
  margin-left: auto;
  color: var(--muted);
  transition: transform 0.25s;
}

.section-toggle[aria-expanded="true"] .chevron {
  transform: rotate(180deg);
}

.section-toggle .section-title {
  flex: 0 0 auto;
}

.match-list {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}

.match-list.collapsed {
  display: none;
}

.match-card {
  background: var(--card);
  border-radius: var(--radius-lg);
  padding: 16px;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border);
  transition: box-shadow 0.2s, transform 0.2s;
}

.match-card:hover {
  box-shadow: var(--shadow-md);
}

.match-card.is-live {
  border-color: rgba(220, 38, 38, 0.45);
  background: linear-gradient(180deg, #fff7f7 0%, var(--card) 60%);
  box-shadow: 0 0 0 1px rgba(220, 38, 38, 0.08), var(--shadow-sm);
}

.match-card.is-finished {
  opacity: 0.95;
}

.match-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}

.match-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  font-size: 12px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 9px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.status-badge.status-live {
  background: var(--danger);
  color: #fff;
}

.status-badge.status-live::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #fff;
  animation: pulse-white 1.2s ease-in-out infinite;
}

@keyframes pulse-white {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

.status-badge.status-scheduled {
  background: #eaf0f5;
  color: var(--ink-soft);
}

.status-badge.status-finished {
  background: var(--green-soft);
  color: var(--green-strong);
}

.status-badge.status-postponed {
  background: #fef3c7;
  color: #92400e;
}

.status-badge.status-other {
  background: #eef2f5;
  color: var(--muted);
}

.match-round {
  font-weight: 500;
  color: var(--muted);
}

.match-time {
  font-weight: 600;
  color: var(--ink-soft);
}

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

.team {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.team.away {
  flex-direction: row-reverse;
  text-align: right;
}

.team-logo {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--surface);
  object-fit: contain;
  padding: 3px;
  flex-shrink: 0;
  border: 1px solid var(--border);
}

.team-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
  line-height: 1.25;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.team.is-predicted-winner .team-name {
  color: var(--green-strong);
}

.team.is-predicted-winner .team-logo {
  border-color: var(--green);
  box-shadow: 0 0 0 2px var(--green-soft);
}

.score-center {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 8px 12px;
  background: var(--navy);
  color: #fff;
  border-radius: var(--radius-md);
  min-width: 80px;
}

.score-line {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: 0.02em;
  font-variant-numeric: tabular-nums;
  line-height: 1;
}

.score-vs {
  font-size: 11px;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.65);
  letter-spacing: 0.08em;
}

.score-line.placeholder {
  color: rgba(255, 255, 255, 0.5);
}

.odds-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-top: 14px;
}

.odd-chip {
  text-align: center;
  padding: 8px 6px;
  background: #eef3f7;
  border-radius: var(--radius-sm);
  font-size: 12px;
  color: var(--ink);
  transition: background 0.2s, color 0.2s;
}

.odd-chip strong {
  display: block;
  font-size: 14px;
  font-weight: 700;
  margin-top: 2px;
  font-variant-numeric: tabular-nums;
}

.odd-chip.active {
  background: var(--gold-soft);
  color: var(--gold-deep);
}

.odd-chip.muted {
  color: var(--muted-soft);
}

.prediction-box {
  margin-top: 14px;
  padding: 12px 14px;
  background: var(--gold-soft);
  border-radius: var(--radius-md);
  border: 1px solid #f5e0a8;
}

.prediction-box.is-correct {
  background: var(--green-soft);
  border-color: #b8e2cb;
}

.prediction-box.is-incorrect {
  background: var(--danger-soft);
  border-color: #fbcaca;
}

.prediction-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--gold-deep);
  margin-bottom: 4px;
}

.prediction-box.is-correct .prediction-label {
  color: var(--green-strong);
}

.prediction-box.is-incorrect .prediction-label {
  color: var(--danger);
}

.prediction-value {
  display: flex;
  align-items: baseline;
  gap: 8px;
  flex-wrap: wrap;
}

.prediction-text {
  font-size: 16px;
  font-weight: 700;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}

.prediction-confidence {
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  margin-left: auto;
}

.prediction-confidence .bar {
  display: inline-block;
  width: 50px;
  height: 5px;
  background: rgba(0, 0, 0, 0.08);
  border-radius: 999px;
  overflow: hidden;
  vertical-align: middle;
  margin-right: 6px;
}

.prediction-confidence .bar > i {
  display: block;
  height: 100%;
  background: var(--gold);
  border-radius: 999px;
}

.prediction-box.is-correct .prediction-confidence .bar > i {
  background: var(--green);
}

.match-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 12px;
  gap: 8px;
  flex-wrap: wrap;
}

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

.compare-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.compare-badge.correct-score {
  background: var(--green);
  color: #fff;
}

.compare-badge.correct-result {
  background: var(--green-soft);
  color: var(--green-strong);
}

.compare-badge.correct-odds {
  background: #e0f2fe;
  color: #075985;
}

.compare-badge.incorrect {
  background: var(--danger-soft);
  color: var(--danger);
}

.compare-badge.pending {
  background: var(--surface);
  color: var(--muted);
}

.compare-badge .dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  margin-bottom: 20px;
}

.stat-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 14px;
  text-align: center;
}

.stat-value {
  display: block;
  font-size: 22px;
  font-weight: 700;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
  line-height: 1.1;
}

.stat-value.stat-good { color: var(--green); }
.stat-value.stat-bad { color: var(--danger); }
.stat-value.stat-warn { color: var(--gold-deep); }

.stat-label {
  display: block;
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-top: 4px;
}

.stat-bar {
  grid-column: 1 / -1;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 14px 16px;
}

.stat-bar-track {
  height: 8px;
  background: var(--surface);
  border-radius: 999px;
  overflow: hidden;
  display: flex;
  margin-top: 8px;
}

.stat-bar-track > span {
  height: 100%;
  display: block;
  transition: width 0.4s ease;
}

.stat-bar-track > .bar-correct-score { background: var(--green); }
.stat-bar-track > .bar-correct-result { background: #5fb98b; }
.stat-bar-track > .bar-correct-odds { background: #38bdf8; }
.stat-bar-track > .bar-incorrect { background: var(--danger); }
.stat-bar-track > .bar-pending { background: var(--border-strong); }

.stat-bar-meta {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: var(--muted);
  margin-top: 8px;
  flex-wrap: wrap;
  gap: 8px;
}

.empty-state {
  background: var(--card);
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius-lg);
  padding: 36px 18px;
  text-align: center;
  color: var(--muted);
  margin-top: 20px;
}

.empty-icon {
  font-size: 36px;
  margin-bottom: 10px;
}

.empty-state h3 {
  margin: 0 0 6px;
  color: var(--ink);
  font-size: 16px;
}

.empty-state p {
  margin: 0;
  font-size: 13px;
}

.dev-card {
  background: var(--card);
  border-radius: var(--radius-xl);
  padding: 28px 20px;
  text-align: center;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border);
}

.dev-logo {
  width: 110px;
  height: 110px;
  margin: 0 auto 14px;
  border-radius: 24px;
  background: var(--surface);
  padding: 6px;
}

.dev-name {
  margin: 0 0 6px;
  font-size: 22px;
  font-weight: 700;
  color: var(--ink);
}

.dev-desc {
  margin: 0 auto 18px;
  max-width: 420px;
  font-size: 14px;
  color: var(--muted);
  line-height: 1.55;
}

.dev-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-width: 280px;
  margin: 0 auto 18px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 12px 18px;
  border-radius: var(--radius-md);
  font-size: 14px;
  font-weight: 700;
  text-decoration: none;
  border: none;
  transition: transform 0.15s, box-shadow 0.2s;
}

.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(0); }

.btn-primary {
  background: var(--green);
  color: #fff;
  box-shadow: 0 4px 10px rgba(11, 122, 82, 0.25);
}

.btn-primary:hover { background: var(--green-strong); }

.btn-secondary {
  background: var(--green-soft);
  color: var(--green-strong);
}

.dev-meta {
  font-size: 12px;
  color: var(--muted);
  margin: 0;
}

.toast {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--ink);
  color: #fff;
  padding: 10px 16px;
  border-radius: 999px;
  font-size: 13px;
  box-shadow: var(--shadow-lg);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s, transform 0.25s;
  z-index: 100;
  max-width: calc(100% - 32px);
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.toast.error { background: var(--danger); }
.toast.success { background: var(--green); }

.ad-slot {
  display: flex;
  justify-content: center;
  align-items: center;
  width: 100%;
  background: var(--card);
  border-radius: var(--radius-md);
}

.ad-slot ins.adsbygoogle {
  display: block;
  width: 100%;
  min-height: 60px;
  margin: 0 auto;
}

.ad-slot:empty,
.ad-slot ins.adsbygoogle:empty {
  display: none;
}

.ad-banner {
  max-width: 728px;
  margin: 0 auto;
  padding: 6px 10px 8px;
  background: transparent;
}

.ad-banner ins.adsbygoogle {
  background: var(--card);
  border-radius: var(--radius-md);
  min-height: 0;
  max-height: 90px;
  overflow: hidden;
}

.ad-infeed {
  background: var(--card);
  border: 1px solid var(--border);
  padding: 10px;
  margin-bottom: 14px;
  min-height: 90px;
}

.ad-infeed ins.adsbygoogle {
  min-height: 70px;
}

.ad-anchor {
  display: none;
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 40;
  background: var(--card);
  border-top: 1px solid var(--border);
  padding: 6px 8px calc(6px + env(safe-area-inset-bottom));
  box-shadow: 0 -2px 8px rgba(17, 31, 42, 0.08);
}

.ad-anchor ins.adsbygoogle {
  min-height: 50px;
  max-width: 480px;
}

@media (max-width: 768px) {
  .ad-anchor {
    display: flex;
  }
  body {
    padding-bottom: calc(70px + env(safe-area-inset-bottom));
  }
  .app-main {
    padding-bottom: 20px;
  }
}

@media (max-width: 380px) {
  .ad-banner { padding: 6px 10px 12px; }
  .ad-infeed { padding: 8px; }
}

@media (min-width: 600px) {
  .app-main { padding: 24px 20px 80px; }
  .header-inner { padding: 16px 22px; }
  .brand-text h1 { font-size: 21px; }
  .match-list { grid-template-columns: repeat(2, 1fr); }
  .stats-grid { grid-template-columns: repeat(4, 1fr); }
  .stat-bar { grid-column: 1 / -1; }
  .dev-card { padding: 36px 32px; }
  .dev-logo { width: 130px; height: 130px; }
}

@media (min-width: 880px) {
  .match-list { grid-template-columns: repeat(2, 1fr); }
  .team-logo { width: 46px; height: 46px; }
  .team-name { font-size: 15px; }
  .score-center { min-width: 90px; }
  .score-line { font-size: 24px; }
}

@media (max-width: 380px) {
  .brand-logo { width: 44px; height: 44px; }
  .brand-text h1 { font-size: 17px; }
  .match-card { padding: 14px; }
  .team-logo { width: 36px; height: 36px; }
  .score-center { min-width: 70px; padding: 6px 10px; }
  .score-line { font-size: 20px; }
  .stat-card { padding: 12px 8px; }
  .stat-value { font-size: 18px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
