:root {
  --background: #f5f7fa;
  --surface: #ffffff;
  --primary: #1d4ed8;
  --secondary: #dc2626;
  --available: #059669;
  --text-main: #1a1d2b;
  --text-muted: #6b7280;
  --border: #e5e7eb;
  --team-b: #ea580c;
  --shadow: 0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
}

* { box-sizing: border-box; }
body {
  margin: 0;
  min-height: 100vh;
  background: var(--background);
  color: var(--text-main);
  font-family: "Space Grotesk", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
button, summary { font: inherit; }
.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  border-bottom: 1px solid rgba(229,231,235,.9);
  background: rgba(255,255,255,.92);
  backdrop-filter: blur(14px);
}
.header-inner {
  max-width: 1120px;
  min-height: 64px;
  margin: 0 auto;
  padding: 10px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.brand { display: flex; align-items: center; min-width: 0; }
.brand, .brand:hover { color: inherit; text-decoration: none; }
.accent-dot {
  width: 8px;
  height: 8px;
  margin-right: 12px;
  border-radius: 999px;
  background: var(--primary);
  box-shadow: 0 0 10px rgba(29,78,216,.45);
  flex: 0 0 auto;
}
h1 { margin: 0; font-size: 22px; line-height: 1.1; letter-spacing: 0; }
.brand-wow {
  display: inline-block;
  margin-right: 4px;
  padding: 0 3px 2px;
  color: #1d4ed8;
  border-bottom: 3px solid #93c5fd;
  font-weight: 900;
  letter-spacing: 0;
}
.brand p { margin: 5px 0 0; color: var(--text-muted); font-size: 12px; }
.sync-panel { display: flex; align-items: center; justify-content: flex-end; gap: 8px; color: var(--text-muted); font-size: 12px; white-space: nowrap; }
.top-nav { display: flex; align-items: center; justify-content: flex-end; gap: 12px; flex-wrap: wrap; }
.top-nav > a { color: var(--primary); font-size: 13px; font-weight: 800; text-decoration: none; }
.top-nav > a:hover { text-decoration: underline; }
.sync-pill { display: inline-flex; align-items: center; border: 1px solid #a7f3d0; border-radius: 999px; padding: 4px 8px; background: #ecfdf5; color: var(--available); font-weight: 700; }
.sync-pill.error { border-color: #fecaca; background: #fef2f2; color: var(--secondary); }
.page-shell { max-width: 1120px; margin: 0 auto; padding: 20px 20px 56px; }
.notice { margin-bottom: 16px; padding: 10px 12px; border: 1px solid #fecaca; border-radius: 8px; background: #fff7f7; color: #991b1b; font-size: 13px; line-height: 1.55; }
.section-block { margin-bottom: 22px; }
.section-title-row { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.eyebrow { margin: 0 0 4px; color: var(--text-muted); font-size: 11px; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; }
h2 { margin: 0; font-size: 22px; line-height: 1.2; }
.icon-button { width: 40px; height: 40px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); color: var(--primary); cursor: pointer; display: inline-flex; align-items: center; justify-content: center; flex: 0 0 auto; }
.icon-button:hover { border-color: #bfdbfe; background: #eff6ff; }
.icon-button svg { width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.text-button { min-height: 40px; border: 1px solid #bfdbfe; border-radius: 8px; background: #eff6ff; color: var(--primary); cursor: pointer; padding: 0 13px; font-size: 13px; font-weight: 800; white-space: nowrap; }
.text-button:hover { background: #dbeafe; }
.text-button:disabled { cursor: wait; opacity: .65; }
.text-button.secondary { border-color: #d1d5db; background: #f8fafc; color: #334155; }
.text-button.ghost { border-color: transparent; background: transparent; color: var(--text-muted); }
.action-row { display: flex; align-items: center; justify-content: flex-end; gap: 8px; flex-wrap: wrap; }
.cards-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.loading, .empty-state { grid-column: 1 / -1; padding: 28px; border: 1px dashed #cbd5e1; border-radius: 8px; color: var(--text-muted); background: rgba(255,255,255,.65); text-align: center; }
.match-card { position: relative; overflow: hidden; border: 1px solid #a7f3d0; border-left: 3px solid var(--available); border-radius: 8px; background: var(--surface); box-shadow: var(--shadow); padding: 16px; }
.match-topline { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin-bottom: 14px; }
.stage { color: var(--primary); font-size: 11px; font-weight: 700; text-transform: uppercase; }
.time-chip { display: inline-flex; border: 1px solid #dbeafe; border-radius: 6px; background: #eff6ff; color: var(--primary); padding: 4px 7px; font-size: 12px; font-weight: 700; white-space: nowrap; }
.teams { display: grid; grid-template-columns: minmax(0,1fr) 48px minmax(0,1fr); gap: 8px; align-items: center; margin-bottom: 14px; }
.team { min-width: 0; text-align: center; }
.team-logo { width: 50px; height: 50px; margin: 0 auto 8px; border: 1px solid var(--border); border-radius: 999px; background: linear-gradient(135deg,#f3f4f6,#e5e7eb); display: flex; align-items: center; justify-content: center; overflow: hidden; }
.team-logo img { width: 36px; height: 36px; object-fit: contain; }
.team-logo span { color: #94a3b8; font-weight: 800; }
.team-name { display: block; min-height: 34px; font-size: 15px; font-weight: 800; line-height: 1.15; overflow-wrap: anywhere; }
.vs { text-align: center; color: #475569; font-weight: 800; letter-spacing: .06em; }
.support-row { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 7px; border-top: 1px solid #eef2f7; padding-top: 10px; }
.support-item { min-width: 0; border: 1px solid #e2e8f0; border-radius: 7px; background: #f8fafc; padding: 8px 6px; text-align: center; }
.support-item > strong { display: block; margin-bottom: 7px; color: var(--text-main); font-size: clamp(11px, 2.7vw, 13px); line-height: 1.15; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.support-item.home strong { color: var(--primary); }
.support-item.away strong { color: var(--team-b); }
.model-names { display: flex; flex-wrap: wrap; justify-content: center; gap: 3px; margin-bottom: 5px; }
.model-names span { display: inline-flex; align-items: center; justify-content: center; border: 1px solid #dbeafe; border-radius: 999px; background: #eff6ff; color: #1e40af; padding: 3px 5px; font-size: clamp(8px, 2vw, 10px); font-weight: 800; line-height: 1; white-space: nowrap; }
.support-count { color: #334155; font-size: clamp(10px, 2.6vw, 12px); font-weight: 800; line-height: 1.2; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.meta-line { margin-top: 12px; color: var(--text-muted); font-size: 12px; line-height: 1.45; }
.thanks-panel { margin: 0 0 22px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); box-shadow: var(--shadow); padding: 16px; display: flex; align-items: center; justify-content: space-between; gap: 18px; }
.thanks-copy p:last-child { margin: 8px 0 0; color: var(--text-muted); font-size: 13px; line-height: 1.55; }
.pay-qr { width: 132px; height: 132px; object-fit: contain; border: 1px solid var(--border); border-radius: 8px; background: #fff; padding: 6px; flex: 0 0 auto; }
.history-panel { border: 1px solid var(--border); border-radius: 8px; background: var(--surface); box-shadow: var(--shadow); }
.history-panel summary { cursor: pointer; padding: 15px 16px; display: flex; justify-content: space-between; gap: 12px; font-weight: 800; }
.history-panel summary::marker { color: var(--primary); }
.history-list { border-top: 1px solid var(--border); }
.history-row { display: grid; grid-template-columns: 132px minmax(0,1fr) 120px 70px; gap: 10px; align-items: center; padding: 12px 16px; border-top: 1px solid #f1f5f9; font-size: 13px; }
.history-row:first-child { border-top: 0; }
.history-row time { color: var(--text-muted); }
.history-row strong { overflow-wrap: anywhere; }
.history-pick { color: var(--primary); font-weight: 800; overflow-wrap: anywhere; }
.result { justify-self: end; color: var(--text-muted); font-weight: 800; }
.stats-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.stat-card { min-height: 110px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); box-shadow: var(--shadow); padding: 18px; }
.stat-card span { display: block; color: var(--primary); font-size: clamp(24px, 5vw, 34px); font-weight: 900; line-height: 1.1; overflow-wrap: anywhere; }
.stat-card p { margin: 8px 0 0; color: var(--text-muted); font-size: 13px; font-weight: 700; }
.stats-note { margin: 12px 0 0; color: var(--text-muted); font-size: 13px; line-height: 1.55; }
.login-shell { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 20px; background: var(--background); }
.login-panel { width: min(420px, 100%); border: 1px solid var(--border); border-radius: 8px; background: var(--surface); box-shadow: var(--shadow); padding: 22px; display: grid; gap: 12px; }
.login-panel h1 { font-size: 22px; }
.login-panel label { color: #334155; font-size: 13px; font-weight: 800; }
.login-panel input { width: 100%; height: 42px; border: 1px solid #cbd5e1; border-radius: 8px; padding: 0 12px; font-size: 16px; outline: none; }
.login-panel input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(29,78,216,.12); }
.login-panel a { color: var(--primary); font-size: 13px; font-weight: 800; text-decoration: none; }
.login-message { min-height: 20px; margin: 0; color: var(--secondary); font-size: 13px; font-weight: 700; }

@media (max-width: 760px) {
  .header-inner { align-items: flex-start; flex-direction: column; justify-content: center; }
  .top-nav, .sync-panel { justify-content: flex-start; white-space: normal; }
  h1 { font-size: 20px; }
  .page-shell { padding: 16px 12px 44px; }
  .cards-grid { grid-template-columns: 1fr; gap: 12px; }
  .section-title-row { align-items: flex-start; flex-direction: column; }
  .action-row { justify-content: flex-start; }
  .match-card { padding: 13px; }
  .teams { grid-template-columns: minmax(0,1fr) 38px minmax(0,1fr); }
  .team-logo { width: 44px; height: 44px; }
  .team-logo img { width: 32px; height: 32px; }
  .team-name { font-size: 14px; min-height: 32px; }
  .support-row { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 5px; }
  .support-item { padding: 7px 3px; }
  .model-names { gap: 2px; }
  .model-names span { padding: 3px 4px; font-size: clamp(8px, 2.35vw, 9px); }
  .support-count { font-size: clamp(9px, 2.8vw, 11px); }
  .thanks-panel { align-items: stretch; }
  .pay-qr { width: 112px; height: 112px; }
  .history-row { grid-template-columns: 1fr; gap: 5px; }
  .result { justify-self: start; }
  .stats-grid { grid-template-columns: 1fr; }
}

@media (max-width: 420px) {
  .thanks-panel { flex-direction: column; }
  .pay-qr { width: 148px; height: 148px; align-self: center; }
}
