:root {
  --ink: #202124;
  --muted: #73777f;
  --paper: #f3f5f8;
  --line: #dde1e7;
  --brand: #d71920;
  --brand-deep: #a90f15;
  --green: #15845a;
  --blue: #2764c4;
  --gray: #747b87;
  --gold: #c88a2b;
  --white: #ffffff;
  --panel: #fffaf5;
  --shadow: 0 12px 28px rgba(23, 28, 38, 0.1);
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--paper);
}

body {
  margin: 0;
  color: var(--ink);
  background:
    linear-gradient(180deg, #d71920 0, #d71920 268px, var(--paper) 268px, var(--paper) 100%);
  font-family: "Segoe UI", "PingFang SC", "Microsoft YaHei", Arial, sans-serif;
  letter-spacing: 0;
}

button,
input {
  font: inherit;
}

button {
  border: 0;
  cursor: pointer;
}

.site-shell {
  width: min(760px, 100%);
  min-height: 100vh;
  margin: 0 auto;
  padding: 0 12px 44px;
}

.score-header {
  color: var(--white);
  padding: 14px 0 10px;
}

.brand-line {
  display: grid;
  grid-template-columns: 46px 1fr auto;
  align-items: center;
  gap: 10px;
}

.brand-logo {
  display: grid;
  place-items: center;
  width: 42px;
  aspect-ratio: 1;
  border: 2px solid rgba(255, 255, 255, 0.78);
  border-radius: 8px;
  background: var(--brand-deep);
  font-size: 22px;
  font-weight: 900;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: 24px;
  line-height: 1.05;
}

h2 {
  font-size: 20px;
  line-height: 1.2;
}

.brand-line p {
  margin-top: 5px;
  color: rgba(255, 255, 255, 0.78);
  font-size: 12px;
}

.auth-pill {
  min-width: 74px;
  padding: 7px 9px;
  border: 1px solid rgba(255, 255, 255, 0.42);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.16);
  text-align: center;
  font-size: 12px;
  font-weight: 800;
}

.sport-tabs {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 4px;
  margin-top: 14px;
}

.sport-tab {
  min-height: 38px;
  border-radius: 6px;
  color: rgba(255, 255, 255, 0.78);
  background: rgba(128, 12, 18, 0.3);
  font-size: 14px;
  font-weight: 800;
}

.sport-tab.is-active {
  color: var(--brand);
  background: var(--white);
}

.sport-tab[aria-disabled="true"] {
  cursor: default;
}

.main-stage {
  padding-top: 8px;
}

.view {
  display: none;
}

.view.is-active {
  display: block;
}

.match-toolbar {
  display: grid;
  grid-template-columns: 1fr 76px;
  gap: 8px;
  align-items: center;
}

.status-tabs {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
  margin-top: 8px;
}

.status-tab {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: #555c67;
  background: rgba(255, 255, 255, 0.9);
  font-size: 13px;
  font-weight: 900;
  box-shadow: 0 8px 18px rgba(35, 37, 45, 0.06);
}

.status-tab span {
  min-width: 22px;
  padding: 2px 5px;
  border-radius: 999px;
  color: var(--white);
  background: #9198a4;
  font-size: 11px;
  line-height: 1.3;
}

.status-tab.is-active {
  color: var(--brand);
  border-color: rgba(215, 25, 32, 0.28);
  background: var(--white);
}

.status-tab.is-active span {
  background: var(--brand);
}

.date-pill,
.refresh-button,
.primary-action,
.admin-link,
.ghost {
  min-height: 40px;
  border-radius: 8px;
  font-weight: 800;
}

.date-pill {
  color: var(--ink);
  background: var(--white);
  box-shadow: var(--shadow);
}

.refresh-button {
  color: var(--brand);
  background: var(--white);
  box-shadow: var(--shadow);
}

.score-meta {
  min-height: 28px;
  padding: 9px 2px 6px;
  color: #5f636b;
  font-size: 12px;
}

.match-list {
  display: grid;
  gap: 8px;
}

.match-group {
  display: grid;
  gap: 8px;
}

.match-group + .match-group {
  margin-top: 8px;
}

.match-group-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 32px;
  padding: 0 10px;
  border-radius: 8px;
  color: #4d545f;
  background: rgba(255, 255, 255, 0.72);
  font-size: 13px;
  font-weight: 900;
}

.match-group-title strong {
  display: grid;
  place-items: center;
  min-width: 24px;
  min-height: 22px;
  border-radius: 999px;
  color: var(--white);
  background: var(--status-color, var(--brand));
  font-size: 12px;
}

.match-group.status-live,
.match-row.status-live {
  --status-color: var(--green);
}

.match-group.status-upcoming,
.match-row.status-upcoming {
  --status-color: var(--blue);
}

.match-group.status-finished,
.match-row.status-finished {
  --status-color: var(--gray);
}

.match-row {
  display: grid;
  grid-template-columns: 68px minmax(0, 1fr) 96px minmax(0, 1fr);
  gap: 8px;
  align-items: center;
  min-height: 104px;
  padding: 10px 9px;
  border: 1px solid var(--line);
  border-left: 5px solid var(--status-color, var(--brand));
  border-radius: 8px;
  background: var(--white);
  box-shadow: 0 8px 18px rgba(35, 37, 45, 0.07);
}

.match-side {
  display: grid;
  gap: 6px;
  align-content: center;
}

.issue {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.league-chip {
  width: fit-content;
  max-width: 64px;
  padding: 4px 6px;
  border-left: 4px solid var(--league-color, var(--gold));
  border-radius: 6px;
  color: var(--ink);
  background: #f7f1e7;
  font-size: 12px;
  font-weight: 800;
  overflow-wrap: anywhere;
}

.team-block {
  display: grid;
  justify-items: center;
  gap: 5px;
  min-width: 0;
}

.team-logo {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  object-fit: contain;
  background: #eef1f5;
  color: var(--brand);
  font-size: 15px;
  font-weight: 900;
}

.team-name {
  width: 100%;
  color: var(--ink);
  font-size: 14px;
  font-weight: 900;
  line-height: 1.22;
  text-align: center;
  overflow-wrap: anywhere;
}

.team-rank {
  min-height: 16px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.2;
  text-align: center;
  overflow-wrap: anywhere;
}

.score-block {
  display: grid;
  justify-items: center;
  gap: 3px;
  min-width: 0;
}

.match-time,
.half-score {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.15;
}

.score-number {
  color: var(--brand);
  font-family: "Cascadia Mono", "Consolas", monospace;
  font-size: 22px;
  font-weight: 900;
  line-height: 1.1;
  white-space: nowrap;
}

.match-status {
  min-height: 22px;
  padding: 4px 7px;
  border-radius: 999px;
  background: #eef1f5;
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
}

.match-status.is-live {
  background: #e7f5ef;
  color: var(--green);
}

.match-status.is-upcoming {
  background: #eaf1ff;
  color: var(--blue);
}

.match-status.is-finished {
  background: #f1f3f5;
  color: #565b64;
}

.empty {
  padding: 34px 16px;
  border: 1px dashed #c5cad3;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.72);
  color: var(--muted);
  text-align: center;
}

.bottom-tabs {
  display: grid;
  grid-template-columns: repeat(2, minmax(108px, 1fr));
  gap: 6px;
  width: 100%;
  margin-top: 8px;
  padding: 6px;
  border: 1px solid rgba(255, 255, 255, 0.26);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: var(--shadow);
}

.bottom-tab {
  min-height: 42px;
  border-radius: 6px;
  color: var(--muted);
  background: transparent;
  font-weight: 900;
}

.bottom-tab.is-active {
  color: var(--white);
  background: var(--brand);
}

.module-head,
.admin-section-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 12px;
  margin: 12px 0;
}

.module-head {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--white);
  box-shadow: 0 8px 18px rgba(35, 37, 45, 0.06);
}

.module-head p,
.admin-header p {
  margin-top: 5px;
  color: var(--muted);
  font-size: 12px;
}

.tool-strip,
.admin-panel,
.token-form {
  display: grid;
  gap: 10px;
  align-items: end;
  margin-bottom: 14px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--white);
}

.tool-strip {
  grid-template-columns: repeat(2, minmax(0, 1fr)) 84px;
}

.assist-search {
  grid-template-columns: repeat(3, minmax(0, 1fr)) 84px;
}

.admin-panel {
  grid-template-columns: repeat(5, minmax(0, 1fr)) 80px;
}

.token-form {
  grid-template-columns: 1fr 120px;
}

label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

input {
  width: 100%;
  min-height: 40px;
  padding: 0 10px;
  border: 1px solid #cbd1da;
  border-radius: 6px;
  background: var(--white);
  color: var(--ink);
}

.primary-action {
  padding: 0 14px;
  color: var(--white);
  background: var(--brand);
}

.assist-list {
  display: grid;
  gap: 10px;
}

.assist-lock {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
  padding: 12px;
  border: 1px solid rgba(215, 25, 32, 0.18);
  border-radius: 8px;
  background: #fff5f5;
}

.assist-lock.is-hidden {
  display: none;
}

.assist-lock div {
  display: grid;
  gap: 4px;
}

.assist-lock strong {
  font-size: 15px;
}

.assist-lock span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.tool-strip.is-locked {
  opacity: 0.82;
}

.assist-card,
.admin-section,
.overview-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--white);
  box-shadow: 0 8px 18px rgba(35, 37, 45, 0.06);
}

.assist-card {
  padding: 13px;
}

.assist-title {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 10px;
}

.assist-card h3 {
  margin: 0 0 8px;
  font-size: 16px;
}

.assist-title span {
  flex: 0 0 auto;
  max-width: 42%;
  padding: 4px 7px;
  border-radius: 999px;
  color: var(--brand);
  background: #fff0f1;
  font-size: 12px;
  font-weight: 900;
  overflow-wrap: anywhere;
}

.assist-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 8px;
}

.assist-meta span {
  padding: 4px 7px;
  border-radius: 999px;
  color: #61512e;
  background: #fff4df;
  font-size: 12px;
  font-weight: 800;
}

.assist-card p {
  color: #3f444c;
  font-size: 13px;
  line-height: 1.65;
  white-space: pre-wrap;
}

.auth-dialog {
  width: min(420px, calc(100vw - 28px));
  border: 0;
  padding: 0;
  background: transparent;
}

.auth-dialog::backdrop {
  background: rgba(20, 23, 28, 0.48);
}

.dialog-card {
  display: grid;
  gap: 14px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--white);
  box-shadow: var(--shadow);
}

.dialog-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.ghost {
  width: 38px;
  color: var(--ink);
  background: #eef1f5;
  font-size: 22px;
}

#authMessage {
  min-height: 18px;
  color: var(--brand);
  font-size: 13px;
}

.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  max-width: min(360px, calc(100vw - 36px));
  padding: 12px 14px;
  border-radius: 8px;
  color: var(--white);
  background: #252930;
  box-shadow: 0 12px 26px rgba(20, 23, 28, 0.2);
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.18s ease, transform 0.18s ease;
  pointer-events: none;
  z-index: 20;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

.admin-body {
  background: var(--paper);
}

.admin-shell {
  width: min(1120px, calc(100vw - 28px));
  margin: 0 auto;
  padding: 22px 0 44px;
}

.admin-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 18px;
}

.admin-link {
  display: inline-grid;
  place-items: center;
  padding: 0 14px;
  color: var(--brand);
  background: var(--white);
  text-decoration: none;
}

.admin-main {
  display: grid;
  gap: 14px;
}

.admin-section {
  padding: 14px;
}

.admin-section h2 {
  margin-bottom: 12px;
}

.overview-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.overview-card {
  display: grid;
  gap: 8px;
  min-height: 88px;
  padding: 12px;
}

.overview-card span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.overview-card strong {
  font-size: 15px;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.key-box {
  min-height: 126px;
  margin: 0;
  padding: 12px;
  overflow: auto;
  border-radius: 8px;
  background: #20242b;
  color: #f6f8fb;
  font-family: "Cascadia Mono", "Consolas", monospace;
  font-size: 12px;
  line-height: 1.55;
}

button:focus-visible,
input:focus-visible,
a:focus-visible {
  outline: 3px solid var(--gold);
  outline-offset: 2px;
}

@media (max-width: 720px) {
  .site-shell {
    padding-inline: 8px;
  }

  .match-row {
    grid-template-columns: 58px minmax(0, 1fr) 82px minmax(0, 1fr);
    gap: 6px;
    padding: 9px 7px;
  }

  .issue,
  .league-chip,
  .match-time,
  .half-score,
  .match-status,
  .team-rank {
    font-size: 10px;
  }

  .score-number {
    font-size: 19px;
  }

  .status-tabs {
    grid-template-columns: repeat(2, 1fr);
  }

  .team-name {
    font-size: 13px;
  }

  .tool-strip,
  .assist-search,
  .admin-panel,
  .token-form,
  .overview-grid {
    grid-template-columns: 1fr;
  }

  .admin-header,
  .module-head,
  .admin-section-head {
    align-items: stretch;
    flex-direction: column;
  }
}

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