:root {
  --bg: #0c1017;
  --panel: #151b26;
  --border: #263041;
  --text: #e8edf5;
  --muted: #8b98ab;
  --accent: #3d8bfd;
  --accent2: #22c55e;
  --danger: #f43f5e;
  --radius: 12px;
  --font: system-ui, "Segoe UI", Roboto, "PingFang SC", "Microsoft YaHei", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  min-height: 100vh;
}

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

a:hover {
  text-decoration: underline;
}

.topbar {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 10px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  background: linear-gradient(180deg, #121826 0%, var(--bg) 100%);
}

.brand {
  font-weight: 700;
  font-size: 1.15rem;
  letter-spacing: 0.02em;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.toolbar-label {
  color: var(--muted);
  font-size: 0.8rem;
  margin-right: 4px;
}

.brand span {
  color: var(--accent);
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.btn {
  border: 1px solid var(--border);
  background: var(--panel);
  color: var(--text);
  padding: 8px 14px;
  border-radius: 999px;
  cursor: pointer;
  font-size: 0.92rem;
}

.btn:hover {
  border-color: var(--accent);
}

.btn.active {
  background: rgba(61, 139, 253, 0.2);
  border-color: var(--accent);
}

.input,
.select {
  background: var(--panel);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 8px 12px;
  border-radius: var(--radius);
  min-width: 140px;
  font-size: 0.92rem;
}

.select.select-day {
  min-width: 7.5rem;
  max-width: 10rem;
}

.meta {
  padding: 10px 20px;
  color: var(--muted);
  font-size: 0.85rem;
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
  padding: 8px 20px 32px;
}

.card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: transform 0.12s ease, border-color 0.12s ease;
}

.card:hover {
  transform: translateY(-2px);
  border-color: #3a4a63;
}

a.card.card--clickable {
  text-decoration: none;
  color: inherit;
  cursor: pointer;
}

a.card.card--clickable .card-cta {
  color: var(--accent);
  font-weight: 500;
}

a.card.card--clickable:hover .card-cta {
  text-decoration: underline;
}

a.card.card--clickable:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.card-img {
  width: 100%;
  aspect-ratio: 16/9;
  object-fit: cover;
  background: #0a0d12;
}

.card-body {
  padding: 12px 14px 14px;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.card-title {
  font-size: 0.98rem;
  font-weight: 600;
  line-height: 1.35;
  margin: 0;
}

.pills {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.pill {
  font-size: 0.75rem;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(34, 197, 94, 0.15);
  color: var(--accent2);
  border: 1px solid rgba(34, 197, 94, 0.35);
}

.pill.gray {
  background: rgba(139, 152, 171, 0.15);
  color: var(--muted);
  border-color: var(--border);
}

.card-date {
  font-size: 0.8rem;
  color: var(--muted);
  padding: 4px 8px;
  background: rgba(59, 130, 246, 0.1);
  border-radius: 4px;
  display: inline-block;
}

.card-footer {
  margin-top: auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.8rem;
  color: var(--muted);
}

.empty {
  padding: 48px 20px;
  text-align: center;
  color: var(--muted);
}

/* 首页赛程列表（一行一场） */
.list-stats {
  padding: 8px 20px 10px;
  color: var(--muted);
  font-size: 0.88rem;
  border-bottom: 1px solid var(--border);
}

.list-stats strong {
  color: var(--text);
  font-weight: 600;
}

.schedule-list-host {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 12px 28px;
}

.schedule-head,
.schedule-row {
  display: grid;
  grid-template-columns: 44px 5.5rem 3.25rem 1fr minmax(100px, 240px);
  gap: 10px;
  align-items: center;
  padding: 10px 8px;
}

@media (max-width: 720px) {
  .schedule-head,
  .schedule-row {
    grid-template-columns: 40px 4.5rem 3rem 1fr minmax(88px, 1fr);
    gap: 6px;
    padding: 8px 4px;
  }
}

.schedule-head {
  font-size: 0.78rem;
  color: var(--muted);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  background: var(--bg);
  z-index: 1;
}

.schedule-head__ph {
  display: block;
}

.schedule-head__lines {
  text-align: right;
}

.schedule-row {
  border-bottom: 1px solid rgba(38, 48, 65, 0.55);
  cursor: pointer;
  color: inherit;
  text-decoration: none;
}

.schedule-row:hover {
  background: rgba(61, 139, 253, 0.06);
}

.schedule-row:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
}

.schedule-row__logo {
  width: 40px;
  height: 40px;
  border-radius: 8px;
  background: #0a0d12;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  flex-shrink: 0;
}

.schedule-row__logo img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.schedule-row__logo--empty {
  background: linear-gradient(135deg, #1a2230 0%, #0f1419 100%);
}

.schedule-row__date {
  font-size: 0.82rem;
  color: var(--muted);
}

.schedule-row__time {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--accent2);
}

.schedule-row__title {
  font-size: 0.92rem;
  font-weight: 600;
  line-height: 1.3;
  margin: 0;
}

.schedule-row__sub {
  font-size: 0.76rem;
  color: var(--muted);
  margin-top: 2px;
}

.schedule-row__lines {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  justify-content: flex-end;
  align-items: center;
}

.schedule-line-link {
  font-size: 0.72rem;
  padding: 2px 8px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: rgba(21, 27, 38, 0.9);
  color: var(--accent);
  text-decoration: none;
  white-space: nowrap;
  max-width: 8.5rem;
  overflow: hidden;
  text-overflow: ellipsis;
}

.schedule-line-link:hover {
  border-color: var(--accent);
}

.schedule-line-more {
  font-size: 0.72rem;
  color: var(--muted);
}

/* watch page */
.watch-wrap {
  max-width: 1100px;
  margin: 0 auto;
  padding: 16px;
}

.player-box {
  background: #000;
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--border);
  aspect-ratio: 16/9;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

.player-box video {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.player-placeholder {
  color: var(--muted);
  padding: 24px;
  text-align: center;
}

.lines-panel {
  margin-top: 16px;
  padding: 14px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.lines-panel h3 {
  margin: 0 0 10px;
  font-size: 1rem;
}

.line-btns {
  display: flex;
  flex-flow: row wrap;
  align-items: stretch;
  gap: 10px;
}

.line-btn {
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  padding: 10px 14px;
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 0.9rem;
  text-align: left;
}

.line-btn:hover {
  border-color: var(--accent);
}

.line-btn.active {
  border-color: var(--accent);
  background: rgba(61, 139, 253, 0.15);
}

.line-btn small {
  display: block;
  color: var(--muted);
  margin-top: 4px;
  font-size: 0.78rem;
}

.quality-row {
  margin-top: 12px;
}

.quality-head {
  margin-bottom: 8px;
}

.quality-head h4 {
  margin: 0;
  font-size: 0.9rem;
  color: var(--muted);
  font-weight: 600;
}

.quality-controls-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 14px;
}

.quality-controls-row .quality-btns {
  flex: 0 1 auto;
}

.quality-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.quality-toolbar-label {
  font-size: 0.8rem;
  color: var(--muted);
}

.seg {
  display: inline-flex;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.seg-btn {
  border-radius: 0 !important;
  border: none !important;
  margin: 0 !important;
  font-size: 0.82rem;
  padding: 6px 12px !important;
}

.seg-btn + .seg-btn {
  border-left: 1px solid var(--border) !important;
}

.seg-btn.active {
  background: rgba(61, 139, 253, 0.18);
}

.seg-btn.seg-unavailable {
  opacity: 0.35;
  cursor: not-allowed;
}

.btn-accent {
  border-color: var(--accent2);
  font-size: 0.85rem;
}

.quality-btns {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.quality-pills {
  display: contents;
}

.quality-btns .btn {
  border-radius: var(--radius);
}

.quality-btns .btn.active {
  border-color: var(--accent2);
  background: rgba(34, 197, 94, 0.12);
}

.copy-hint {
  margin: 8px 0 0;
  min-height: 1.2em;
  color: var(--accent2);
  font-size: 0.85rem;
}

.modal-root.is-open {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
}

.modal-panel {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 400px;
  padding: 18px;
  background: var(--bg);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
}

.modal-panel h4 {
  margin: 0 0 6px;
  font-size: 1rem;
}

.modal-panel h4 small {
  font-weight: normal;
  color: var(--muted);
}

.modal-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 12px 0 14px;
}

.modal-actions .btn {
  width: 100%;
  justify-content: center;
}

.line-btns > .line-btn {
  flex: 0 0 auto;
  width: max-content;
  max-width: min(320px, 100%);
  box-sizing: border-box;
}

.anim-frame {
  margin-top: 16px;
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--border);
  /* 与整页暗色一致；iframe 内白底无法去掉，但避免外框再叠一块刺眼白板 */
  background: var(--panel);
  width: 100%;
  position: relative;
  /* 略高于 16:9 以容纳记分条；max-height 限制宽屏过高，减少 iframe 内大块留白 */
  aspect-ratio: 16 / 9.75;
  min-height: 480px;
  max-height: min(680px, 88vh);
}

.anim-frame iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
}

.tabs-inline {
  display: flex;
  gap: 8px;
  margin-bottom: 10px;
}

@media (max-width: 640px) {
  .anim-frame {
    aspect-ratio: 16 / 10;
    min-height: 400px;
    max-height: min(560px, 78vh);
  }
}
