:root {
  color-scheme: dark;
  --bg: #07131f;
  --surface: #0d1d2b;
  --surface-raised: #112434;
  --line: rgba(166, 199, 226, 0.16);
  --text: #f5fbff;
  --muted: #93aebe;
  --accent: #2dd4bf;
  --accent-deep: #0f766e;
  --error: #fb7185;
  --shadow: 0 14px 32px rgba(0, 0, 0, 0.22);
}

* { box-sizing: border-box; }
html, body { min-height: 100%; background: var(--bg); }
body { margin: 0; color: var(--text); font-family: "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif; background: linear-gradient(180deg, rgba(45, 212, 191, 0.05), transparent 220px), var(--bg); }
button, input { font: inherit; }
button { cursor: pointer; }

.app-shell { width: min(560px, 100%); min-height: 100vh; margin: 0 auto; padding: max(22px, env(safe-area-inset-top)) 14px calc(92px + env(safe-area-inset-bottom)); }
.score-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 48px; }
.score-header h1 { margin: 0; font-size: 27px; line-height: 1; letter-spacing: 0; }
.sync-state { min-height: 32px; padding: 0; border: 0; color: var(--muted); background: transparent; font-size: 13px; }
.sync-state::before { content: "↻"; margin-right: 5px; color: var(--accent); font-size: 18px; vertical-align: -1px; }
.sync-state.is-ok { color: var(--accent); }
.sync-state.is-error { color: var(--error); }

.date-switcher { display: grid; grid-template-columns: 42px minmax(0, 1fr) 42px; align-items: center; gap: 6px; margin-top: 12px; }
.date-arrow, .selected-date { min-height: 46px; border: 0; color: var(--text); background: transparent; }
.date-arrow { font-size: 37px; font-weight: 300; line-height: 1; }
.selected-date { font-size: 20px; font-weight: 800; }
.date-rail { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 8px 0 16px; }
.date-rail button { min-height: 48px; border: 1px solid transparent; border-radius: 12px; color: var(--muted); background: transparent; font-size: 15px; }
.date-rail button.is-active { border-color: rgba(45, 212, 191, 0.72); color: var(--accent); background: rgba(45, 212, 191, 0.04); font-weight: 800; }

.push-alert { display: grid; grid-template-columns: minmax(0, 1fr) 36px; align-items: center; min-height: 70px; margin-bottom: 16px; border: 1px solid rgba(45, 212, 191, 0.44); border-radius: 12px; background: rgba(15, 118, 110, 0.09); }
.push-alert[hidden] { display: none; }
.push-alert button { border: 0; background: transparent; }
.push-alert #pushAlertTarget { display: grid; grid-template-columns: 22px minmax(0, 1fr) auto; align-items: center; gap: 10px; padding: 13px 0 13px 14px; color: var(--text); text-align: left; }
.push-alert #pushAlertTarget > span, .push-alert #pushAlertTarget b { color: var(--accent); }
.push-alert #pushAlertTarget > span { font-size: 20px; }
.push-alert #pushAlertTarget strong { overflow: hidden; font-size: 14px; line-height: 1.35; text-overflow: ellipsis; white-space: nowrap; }
.push-alert #pushAlertTarget b { font-size: 13px; white-space: nowrap; }
.push-alert #dismissPushAlert { height: 100%; color: var(--muted); font-size: 24px; }

.feed-meta { min-height: 21px; margin: 0 2px 8px; color: var(--muted); font-size: 12px; }
.match-feed { display: grid; gap: 16px; }
.match-section, .records-list { overflow: hidden; border: 1px solid var(--line); border-radius: 14px; background: linear-gradient(145deg, rgba(255, 255, 255, 0.035), rgba(255, 255, 255, 0.01)), var(--surface); box-shadow: var(--shadow); }
.match-section > header { display: flex; align-items: center; justify-content: space-between; min-height: 58px; padding: 0 16px; border-bottom: 1px solid var(--line); }
.match-section h2 { margin: 0; color: var(--text); font-size: 18px; letter-spacing: 0; }
.match-section > header span { color: var(--muted); font-size: 13px; }
.section-list { display: grid; }
.section-empty, .empty-state { padding: 28px 16px; color: var(--muted); font-size: 14px; text-align: center; }

.fixture-row { position: relative; display: grid; grid-template-columns: 112px minmax(0, 1fr) 58px; gap: 10px; padding: 17px 14px; border-bottom: 1px solid var(--line); }
.fixture-row:last-child { border-bottom: 0; }
.fixture-row.is-halftime { margin: 8px; padding: 16px 14px 14px; border: 1px solid rgba(45, 212, 191, 0.42); border-radius: 12px; background: rgba(45, 212, 191, 0.055); }
.fixture-time { display: grid; align-content: center; gap: 5px; border-right: 1px solid rgba(166, 199, 226, 0.13); }
.fixture-time strong { font-size: 22px; line-height: 1; letter-spacing: 0; }
.fixture-time span { color: var(--muted); font-size: 12px; }
.fixture-main { min-width: 0; }
.league-line { display: flex; align-items: center; gap: 6px; min-height: 20px; overflow: hidden; color: var(--muted); font-size: 12px; white-space: nowrap; }
.country-flag { display: inline-grid; place-items: center; width: 20px; height: 20px; flex: 0 0 auto; font-size: 15px; }
.country-flag-image { display: block; width: 20px; height: 14px; flex: 0 0 auto; object-fit: cover; border-radius: 2px; }
.league-line span:last-child { overflow: hidden; text-overflow: ellipsis; }
.fixture-teams { display: grid; gap: 7px; margin-top: 8px; }
.fixture-teams div { display: grid; grid-template-columns: 24px minmax(0, 1fr) auto; align-items: center; gap: 8px; min-width: 0; font-size: 16px; font-weight: 750; line-height: 1.2; }
.fixture-teams span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fixture-teams strong { flex: 0 0 auto; font-size: 21px; }
.team-logo { display: block; width: 22px; height: 22px; object-fit: contain; }
.team-logo.is-empty { border: 1px solid rgba(166, 199, 226, 0.14); border-radius: 50%; background: rgba(255, 255, 255, 0.025); }
.fixture-status { display: grid; align-content: center; justify-items: end; gap: 4px; color: var(--muted); font-size: 13px; text-align: right; }
.fixture-status.is-live { color: var(--accent); }
.fixture-status.is-halftime { color: var(--accent); font-weight: 900; }
.fixture-status.is-finished { color: var(--muted); }
.fixture-status b { font-size: 12px; font-weight: 700; }
.halftime-action { grid-column: 2 / -1; margin-top: 4px; }
.halftime-action button { width: 100%; min-height: 42px; border: 0; border-radius: 10px; color: #04131a; background: var(--accent); font-size: 14px; font-weight: 900; }
.system-push-mark { grid-column: 2 / -1; margin-top: 3px; color: var(--accent); font-size: 12px; }
.prediction-result { grid-column: 1 / -1; display: grid; gap: 10px; margin-top: 3px; padding: 12px; border: 1px solid rgba(45, 212, 191, 0.28); border-radius: 10px; background: rgba(45, 212, 191, 0.07); }
.prediction-result.is-error { border-color: rgba(251, 113, 133, 0.34); color: #fecdd3; background: rgba(251, 113, 133, 0.08); }
.prediction-result > header { display: flex; justify-content: space-between; color: var(--text); font-size: 14px; }
.prediction-result > header span { color: var(--accent); font-weight: 800; }
.market-prediction { display: grid; gap: 5px; padding-top: 10px; border-top: 1px solid rgba(166, 199, 226, 0.14); }
.market-prediction > div { display: flex; align-items: center; justify-content: space-between; color: var(--muted); font-size: 12px; }
.market-prediction > strong { font-size: 16px; }
.market-prediction small { color: var(--muted); font-size: 11px; }
.market-tier { padding: 3px 7px; border: 1px solid var(--line); border-radius: 999px; font-size: 11px; }
.market-tier.recommend { color: #031411; border-color: transparent; background: var(--accent); }
.market-tier.watch { color: var(--accent); border-color: rgba(45, 212, 191, 0.32); }

.record-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 14px; border-bottom: 1px solid var(--line); }
.record-row:last-child { border-bottom: 0; }
.record-row > div { display: grid; gap: 6px; min-width: 0; }
.record-row strong { overflow: hidden; font-size: 15px; text-overflow: ellipsis; white-space: nowrap; }
.record-row small { color: var(--muted); font-size: 12px; }
.record-result { flex: 0 0 auto; padding: 5px 8px; border: 1px solid var(--line); border-radius: 999px; color: var(--muted); font-size: 12px; }
.record-result.is-hit { color: #041d17; border-color: transparent; background: var(--accent); }
.record-result.is-miss { color: #fecdd3; border-color: rgba(251, 113, 133, 0.36); }
.push-record { display: grid; gap: 10px; padding: 14px; border-bottom: 1px solid var(--line); }
.push-record:last-child { border-bottom: 0; }
.push-record > header { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.push-record .fixture-teams { gap: 6px; }
.push-record > strong { font-size: 16px; }
.push-record-metrics { display: flex; flex-wrap: wrap; gap: 6px; }
.push-record-metrics span { padding: 5px 7px; border: 1px solid var(--line); border-radius: 7px; color: var(--muted); font-size: 12px; }
.push-record small, .push-record time { color: var(--muted); font-size: 12px; }

.bottom-tabs { position: fixed; right: 0; bottom: 0; left: 0; z-index: 20; display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); width: min(560px, 100%); margin: 0 auto; padding: 8px 10px max(8px, env(safe-area-inset-bottom)); border: 1px solid var(--line); border-bottom: 0; border-radius: 16px 16px 0 0; background: rgba(7, 19, 31, 0.98); backdrop-filter: blur(18px); }
.bottom-tabs button { display: grid; justify-items: center; gap: 4px; min-height: 52px; border: 0; color: var(--muted); background: transparent; font-size: 12px; }
.bottom-tabs button span { height: 22px; color: currentColor; font-size: 22px; line-height: 1; }
.bottom-tabs button.is-active { color: var(--accent); font-weight: 800; }

.auth-screen { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; padding: 18px; background: rgba(7, 19, 31, 0.98); }
.auth-screen[hidden] { display: none; }
.auth-panel { position: relative; display: grid; gap: 18px; width: min(420px, 100%); padding: 22px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); box-shadow: var(--shadow); }
.auth-close { position: absolute; top: 10px; right: 12px; width: 34px; height: 34px; border: 0; color: var(--muted); background: transparent; font-size: 24px; }
.auth-brand p, .auth-brand h1 { margin: 0; }
.auth-brand p, .auth-form span { color: var(--muted); font-size: 12px; }
.auth-brand h1 { margin-top: 5px; font-size: 26px; }
.auth-form { display: grid; gap: 12px; }
.auth-form label { display: grid; gap: 6px; }
.auth-form input { min-height: 44px; padding: 0 12px; border: 1px solid var(--line); border-radius: 10px; color: var(--text); background: rgba(255, 255, 255, 0.04); outline: none; }
.auth-form input:focus { border-color: var(--accent); }
.auth-form button, .auth-switch { min-height: 44px; border-radius: 10px; font-weight: 800; }
.auth-form button { border: 0; color: #04131a; background: var(--accent); }
.auth-switch { border: 1px solid var(--line); color: var(--text); background: transparent; }
.auth-error { min-height: 18px; color: var(--error); font-size: 12px; }
.auth-error:empty { display: none; }
.account-panel { display: grid; gap: 16px; padding: 20px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); box-shadow: var(--shadow); }
.account-panel p, .account-panel h2, .account-panel span { margin: 0; }
.account-panel p, .account-panel span, .account-details dt { color: var(--muted); font-size: 13px; }
.account-panel h2 { margin-top: 5px; font-size: 22px; }
.account-panel > button { min-height: 44px; border: 0; border-radius: 10px; color: #04131a; background: var(--accent); font-weight: 800; }
.account-panel > button.account-logout { color: #fecdd3; border: 1px solid rgba(251, 113, 133, 0.35); background: transparent; }
.account-details { display: grid; gap: 10px; margin: 0; }
.account-details > div { display: flex; justify-content: space-between; gap: 12px; padding: 11px 0; border-top: 1px solid var(--line); }
.account-details dt, .account-details dd { margin: 0; }
.account-details dd { font-size: 14px; }

@media (max-width: 380px) {
  .app-shell { padding-right: 10px; padding-left: 10px; }
  .fixture-row { grid-template-columns: 88px minmax(0, 1fr) 52px; gap: 8px; padding-right: 10px; padding-left: 10px; }
  .fixture-time strong { font-size: 19px; }
  .fixture-teams div { font-size: 14px; }
  .fixture-teams strong { font-size: 18px; }
  .score-header h1 { font-size: 25px; }
}
