/* ========================================================
   红桃视界 · 全站共享样式 /assets/site.css
   ======================================================== */

/* ---------- Reset ---------- */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

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

body {
  font-family: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei",
    "Noto Sans SC", "Helvetica Neue", Arial, sans-serif;
  background: var(--page-bg);
  color: var(--text-main);
  line-height: 1.75;
  padding-top: 96px;
  min-height: 100vh;
  font-variant-numeric: tabular-nums;
  font-size: 16px;
}

img, svg, video {
  display: block;
  max-width: 100%;
  height: auto;
}

ul, ol {
  list-style: none;
}

a {
  color: inherit;
  text-decoration: none;
}

button {
  font: inherit;
  border: none;
  background: none;
  cursor: pointer;
  color: inherit;
}

h1, h2, h3, h4, h5, h6 {
  font-weight: 800;
  line-height: 1.3;
  color: var(--text-main);
}

/* ---------- CSS Variables ---------- */
:root {
  --page-bg: #F5F6F8;
  --section-a: #1E293B;
  --section-b: #0F3D3E;
  --card-bg: #FFFFFF;
  --accent: #FFD60A;
  --status-online: #00C853;
  --status-update: #FF4D00;
  --status-offline: #9E9E9E;
  --tag-live: #FF6B35;
  --tag-replay: #2EC4B6;
  --tag-feature: #9B5DE5;
  --text-main: #111827;
  --border: #374151;
  --text-invert: #F9FAFB;
  --container-max: 1200px;
  --radius: 16px;
  --radius-sm: 10px;
  --shadow-hard: 4px 4px 0 rgba(17, 24, 39, 0.9);
  --shadow-soft: 0 8px 24px rgba(17, 24, 39, 0.08);
}

/* ---------- Container ---------- */
.container {
  max-width: var(--container-max);
  margin-left: auto;
  margin-right: auto;
  padding-left: 24px;
  padding-right: 24px;
}

/* ---------- Section Block ---------- */
.section-block {
  padding: 40px 0;
}

.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
  padding-bottom: 12px;
  border-bottom: 3px solid var(--text-main);
}

.section-head h2 {
  font-size: 28px;
  letter-spacing: 0.02em;
}

.section-link {
  font-size: 14px;
  font-weight: 700;
  color: var(--section-a);
  background: var(--accent);
  padding: 6px 14px;
  border-radius: 999px;
  border: 2px solid var(--text-main);
  transition: transform 0.15s, box-shadow 0.15s;
}

.section-link:hover {
  transform: translate(-2px, -2px);
  box-shadow: 2px 2px 0 var(--text-main);
}

/* ---------- Skip Link ---------- */
.skip-link {
  position: fixed;
  top: 8px;
  left: 8px;
  z-index: 9999;
  background: var(--accent);
  color: var(--text-main);
  font-weight: 700;
  font-size: 14px;
  padding: 10px 18px;
  border: 2px solid var(--text-main);
  border-radius: 8px;
  transform: translateY(-200%);
  transition: transform 0.2s;
  pointer-events: auto;
}

.skip-link:focus {
  transform: translateY(0);
}

/* ---------- Header ---------- */
.site-header {
  position: fixed;
  top: 16px;
  left: 0;
  right: 0;
  z-index: 1000;
  padding: 0 16px;
  pointer-events: none;
}

.header-inner {
  position: relative;
  max-width: var(--container-max);
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  background: var(--section-a);
  border: 2px solid var(--text-main);
  border-radius: 999px;
  box-shadow: var(--shadow-hard);
  pointer-events: auto;
}

/* ---------- Brand ---------- */
.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.brand-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  background: var(--accent);
  border: 2px solid var(--text-main);
  border-radius: 10px;
  font-size: 18px;
  font-weight: 900;
  color: var(--text-main);
  line-height: 1;
}

.brand-text {
  font-size: 18px;
  font-weight: 800;
  letter-spacing: 0.04em;
  color: var(--text-invert);
}

/* ---------- Navigation ---------- */
.site-nav {
  display: flex;
  align-items: center;
  margin-left: auto;
}

.nav-list {
  display: flex;
  align-items: center;
  gap: 2px;
}

.nav-list a {
  display: block;
  padding: 7px 12px;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-invert);
  white-space: nowrap;
  transition: background 0.15s, color 0.15s;
}

.nav-list a:hover {
  background: rgba(255, 255, 255, 0.1);
  color: var(--accent);
}

.nav-list a[aria-current="page"] {
  background: var(--accent);
  color: var(--text-main);
  font-weight: 800;
}

/* ---------- Search Entry ---------- */
.search-entry {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  border-radius: 999px;
  background: var(--card-bg);
  border: 2px solid var(--text-main);
  font-size: 13px;
  font-weight: 700;
  color: var(--text-main);
  white-space: nowrap;
  flex-shrink: 0;
  transition: transform 0.15s, box-shadow 0.15s;
}

.search-entry:hover {
  transform: translate(-2px, -2px);
  box-shadow: 2px 2px 0 var(--text-main);
}

.search-entry-glyph {
  position: relative;
  display: inline-block;
  width: 12px;
  height: 12px;
  border: 2px solid var(--text-main);
  border-radius: 50%;
}

.search-entry-glyph::after {
  content: "";
  position: absolute;
  right: -5px;
  bottom: -3px;
  width: 7px;
  height: 2px;
  background: var(--text-main);
  border-radius: 1px;
  transform: rotate(45deg);
}

.search-entry-text {
  line-height: 1.3;
}

/* ---------- Nav Toggle ---------- */
.nav-toggle {
  display: none;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 5px;
  width: 40px;
  height: 40px;
  padding: 8px;
  border-radius: 50%;
  border: 2px solid transparent;
  flex-shrink: 0;
  transition: background 0.15s;
}

.nav-toggle:hover {
  background: rgba(255, 255, 255, 0.08);
}

.nav-toggle-line {
  display: block;
  width: 20px;
  height: 2px;
  background: var(--text-invert);
  border-radius: 2px;
  transition: transform 0.2s, opacity 0.2s;
}

.nav-toggle[aria-expanded="true"] .nav-toggle-line:nth-child(1) {
  transform: translateY(7px) rotate(45deg);
}

.nav-toggle[aria-expanded="true"] .nav-toggle-line:nth-child(2) {
  opacity: 0;
}

.nav-toggle[aria-expanded="true"] .nav-toggle-line:nth-child(3) {
  transform: translateY(-7px) rotate(-45deg);
}

/* ---------- Footer ---------- */
.site-footer {
  background: var(--section-b);
  color: var(--text-invert);
  margin-top: 60px;
}

.footer-grid {
  display: grid;
  grid-template-columns: 1.4fr 1fr 1.2fr;
  gap: 48px;
  padding: 56px 0 40px;
}

.footer-brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
}

.footer-brand .brand-mark {
  width: 32px;
  height: 32px;
  font-size: 16px;
}

.footer-brand .brand-text {
  font-size: 20px;
}

.footer-desc {
  font-size: 14px;
  line-height: 1.7;
  color: rgba(249, 250, 251, 0.72);
  max-width: 32em;
}

.footer-heading {
  font-size: 14px;
  font-weight: 800;
  color: var(--accent);
  letter-spacing: 0.08em;
  margin-bottom: 14px;
  padding-bottom: 8px;
  border-bottom: 1px solid rgba(249, 250, 251, 0.16);
}

.footer-link-list li {
  margin-bottom: 6px;
  font-size: 14px;
  color: rgba(249, 250, 251, 0.8);
}

.footer-link-list a {
  font-size: 14px;
  color: rgba(249, 250, 251, 0.8);
  transition: color 0.15s, padding-left 0.15s;
}

.footer-link-list a:hover {
  color: var(--accent);
  padding-left: 4px;
}

.footer-bottom {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  padding: 20px 0;
  border-top: 1px solid rgba(249, 250, 251, 0.12);
  font-size: 13px;
  color: rgba(249, 250, 251, 0.6);
}

/* ---------- Back to Top ---------- */
.back-top {
  position: fixed;
  right: 24px;
  bottom: 24px;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--section-a);
  border: 2px solid var(--text-main);
  color: var(--accent);
  font-size: 20px;
  font-weight: 700;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 800;
  opacity: 0;
  visibility: hidden;
  transform: translateY(10px);
  transition: opacity 0.2s, transform 0.2s, visibility 0.2s;
  box-shadow: 2px 2px 0 rgba(17, 24, 39, 0.9);
}

.back-top.is-visible {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.back-top:hover {
  background: var(--accent);
  color: var(--text-main);
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 20px;
  border-radius: 999px;
  background: var(--section-a);
  border: 2px solid var(--text-main);
  color: var(--text-invert);
  font-size: 14px;
  font-weight: 700;
  transition: transform 0.15s, box-shadow 0.15s, background 0.15s;
}

.btn:hover {
  transform: translate(-2px, -2px);
  box-shadow: 2px 2px 0 var(--text-main);
}

.btn-accent {
  background: var(--accent);
  color: var(--text-main);
}

.btn-outline {
  background: transparent;
  color: var(--text-main);
}

/* ---------- Card Grid ---------- */
.grid-cards {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 20px;
}

/* ---------- Card ---------- */
.card {
  background: var(--card-bg);
  border: 2px solid var(--text-main);
  border-radius: var(--radius);
  box-shadow: var(--shadow-hard);
  padding: 20px;
  transition: transform 0.15s, box-shadow 0.15s;
}

.card:hover {
  transform: translate(-2px, -2px);
  box-shadow: 6px 6px 0 rgba(17, 24, 39, 0.9);
}

.card-title {
  font-size: 18px;
  font-weight: 800;
  margin-bottom: 8px;
}

.card-meta {
  font-size: 13px;
  color: var(--status-offline);
  margin-bottom: 12px;
}

.card-desc {
  font-size: 14px;
  color: var(--text-main);
}

/* ---------- Magnet Tiles ---------- */
.magnet-tiles {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
}

.magnet-tile {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: 140px;
  padding: 20px;
  border: 2px solid var(--text-main);
  border-radius: var(--radius);
  box-shadow: var(--shadow-hard);
  overflow: hidden;
  transition: transform 0.15s, box-shadow 0.15s;
}

.magnet-tile:hover {
  transform: translate(-2px, -2px);
  box-shadow: 6px 6px 0 rgba(17, 24, 39, 0.9);
}

.magnet-tile .tile-label {
  font-size: 13px;
  font-weight: 700;
  opacity: 0.8;
}

.magnet-tile .tile-count {
  font-size: 32px;
  font-weight: 900;
  line-height: 1;
  margin-top: 8px;
}

.tile-live {
  background: var(--tag-live);
  color: var(--text-main);
}

.tile-replay {
  background: var(--tag-replay);
  color: var(--text-main);
}

.tile-feature {
  background: var(--tag-feature);
  color: var(--text-invert);
}

.tile-accent {
  background: var(--accent);
  color: var(--text-main);
}

.tile-dark {
  background: var(--section-a);
  color: var(--text-invert);
}

/* ---------- Entry List ---------- */
.entry-list {
  background: var(--card-bg);
  border: 2px solid var(--text-main);
  border-radius: var(--radius);
  box-shadow: var(--shadow-hard);
  overflow: hidden;
}

.entry-row {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 14px 18px;
  border-bottom: 1px solid rgba(17, 24, 39, 0.08);
  transition: background 0.12s;
}

.entry-row:last-child {
  border-bottom: none;
}

.entry-row:hover {
  background: #F0F2F4;
}

.entry-time {
  font-size: 13px;
  font-weight: 600;
  color: var(--section-a);
  background: rgba(30, 41, 59, 0.08);
  padding: 4px 10px;
  border-radius: 6px;
  flex-shrink: 0;
  font-variant-numeric: tabular-nums;
}

.entry-title {
  flex: 1;
  font-size: 15px;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.entry-extra {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

/* ---------- Tags ---------- */
.tag-block {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.tag {
  display: inline-flex;
  align-items: center;
  padding: 4px 12px;
  border-radius: 999px;
  border: 1.5px solid var(--text-main);
  font-size: 12px;
  font-weight: 700;
  line-height: 1.4;
}

.tag-live {
  background: rgba(255, 107, 53, 0.16);
  color: #C93D00;
  border-color: var(--tag-live);
}

.tag-replay {
  background: rgba(46, 196, 182, 0.16);
  color: #0B6B65;
  border-color: var(--tag-replay);
}

.tag-feature {
  background: rgba(155, 93, 229, 0.14);
  color: #5B21B6;
  border-color: var(--tag-feature);
}

/* ---------- Status Badge ---------- */
.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  border: 1.5px solid transparent;
  line-height: 1.4;
}

.status-badge::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: currentColor;
}

.status-badge.is-online {
  background: rgba(0, 200, 83, 0.12);
  color: #008B3E;
  border-color: rgba(0, 200, 83, 0.4);
}

.status-badge.is-new {
  background: rgba(255, 77, 0, 0.12);
  color: #C93D00;
  border-color: rgba(255, 77, 0, 0.4);
}

.status-badge.is-offline {
  background: rgba(158, 158, 158, 0.14);
  color: #616161;
  border-color: rgba(158, 158, 158, 0.35);
}

/* ---------- Index Number ---------- */
.index-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 32px;
  height: 32px;
  background: var(--section-a);
  color: var(--accent);
  font-size: 17px;
  font-weight: 900;
  border: 2px solid var(--text-main);
  border-radius: 8px;
  padding: 0 6px;
  box-shadow: 2px 2px 0 rgba(17, 24, 39, 0.9);
  flex-shrink: 0;
}

.index-num.is-top {
  background: var(--accent);
  color: var(--text-main);
}

/* ---------- Metric Bar ---------- */
.metric-bar {
  width: 100%;
  height: 8px;
  background: #E5E7EB;
  border-radius: 4px;
  overflow: hidden;
}

.metric-fill {
  height: 100%;
  background: var(--status-update);
  border-radius: 4px;
  width: 0;
}

.metric-fill.is-warm {
  background: var(--tag-live);
}

.metric-fill.is-cool {
  background: var(--status-online);
}

/* ---------- Index Bar ---------- */
.index-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 6px;
  background: var(--section-a);
  border: 2px solid var(--text-main);
  border-radius: 999px;
  box-shadow: var(--shadow-hard);
}

.index-bar a {
  padding: 8px 16px;
  border-radius: 999px;
  color: var(--text-invert);
  font-size: 14px;
  font-weight: 600;
  transition: background 0.15s, color 0.15s;
}

.index-bar a:hover {
  color: var(--accent);
}

.index-bar a[aria-current="page"] {
  background: var(--accent);
  color: var(--text-main);
}

/* ---------- Horizontal Scroll Rail ---------- */
.hscroll-rail {
  display: flex;
  gap: 16px;
  overflow-x: auto;
  padding: 4px 4px 16px;
  -webkit-overflow-scrolling: touch;
  scroll-snap-type: x mandatory;
}

.rail-item {
  flex: 0 0 auto;
  width: 280px;
  scroll-snap-align: start;
}

/* ---------- Schedule Table ---------- */
.schedule-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.schedule-table th,
.schedule-table td {
  padding: 12px 14px;
  border: 1px solid rgba(17, 24, 39, 0.18);
  text-align: left;
}

.schedule-table thead th {
  background: var(--section-a);
  color: var(--text-invert);
  font-weight: 700;
  border-color: var(--section-a);
}

.schedule-table tbody tr:nth-child(even) {
  background: #F0F2F4;
}

.schedule-table tbody tr:hover {
  background: rgba(255, 214, 10, 0.12);
}

/* ---------- Media Frame ---------- */
.media-frame {
  position: relative;
  overflow: hidden;
  background: #DDE1E6;
  border: 2px solid var(--text-main);
  border-radius: calc(var(--radius-sm) - 2px);
}

.media-frame::before {
  content: "";
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(
    -45deg,
    transparent 0 10px,
    rgba(30, 41, 59, 0.06) 10px 12px
  );
  pointer-events: none;
}

.media-frame::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 42px;
  height: 42px;
  border: 3px solid rgba(30, 41, 59, 0.14);
  border-radius: 50%;
  transform: translate(-50%, -50%);
  pointer-events: none;
}

.media-frame.ratio-169 { aspect-ratio: 16 / 9; }
.media-frame.ratio-43 { aspect-ratio: 4 / 3; }
.media-frame.ratio-11 { aspect-ratio: 1 / 1; }

/* ---------- Detail Item ---------- */
.detail-item {
  display: flex;
  gap: 12px;
  padding: 8px 0;
  border-bottom: 1px dashed rgba(17, 24, 39, 0.16);
}

.detail-item:last-child {
  border-bottom: none;
}

.detail-label {
  flex-shrink: 0;
  min-width: 90px;
  font-size: 13px;
  font-weight: 700;
  color: var(--status-offline);
}

.detail-value {
  font-size: 14px;
  color: var(--text-main);
}

/* ---------- Responsive: Tablet ---------- */
@media (max-width: 1024px) {
  .grid-cards {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .magnet-tiles {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* ---------- Responsive: Mobile ---------- */
@media (max-width: 900px) {
  body {
    padding-top: 84px;
  }

  .site-header {
    top: 12px;
  }

  .header-inner {
    gap: 8px;
    padding: 8px 12px;
  }

  .brand-mark {
    width: 30px;
    height: 30px;
    font-size: 16px;
  }

  .brand-text {
    font-size: 16px;
  }

  .nav-toggle {
    display: inline-flex;
    font-size: 0;
  }

  .site-nav {
    position: absolute;
    top: calc(100% + 10px);
    left: 0;
    right: 0;
    background: var(--section-a);
    border: 2px solid var(--text-main);
    border-radius: 16px;
    padding: 10px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-6px);
    transition: opacity 0.2s, transform 0.2s, visibility 0.2s;
    box-shadow: var(--shadow-hard);
  }

  .site-nav[data-open] {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
  }

  .nav-list {
    flex-direction: column;
    gap: 2px;
  }

  .nav-list a {
    padding: 12px 16px;
    border-radius: 10px;
    font-size: 15px;
  }

  .search-entry {
    width: 38px;
    height: 38px;
    padding: 0;
    justify-content: center;
    border-radius: 50%;
    margin-left: auto;
  }

  .search-entry-text {
    display: none;
  }

  .search-entry-glyph {
    width: 12px;
    height: 12px;
  }

  .footer-grid {
    grid-template-columns: 1fr 1fr;
    gap: 32px;
  }
}

@media (max-width: 600px) {
  .grid-cards {
    grid-template-columns: 1fr;
  }

  .magnet-tiles {
    grid-template-columns: 1fr;
  }

  .footer-grid {
    grid-template-columns: 1fr;
    gap: 28px;
    padding-top: 40px;
  }

  .footer-bottom {
    flex-direction: column;
    align-items: center;
    text-align: center;
  }

  .section-head {
    flex-direction: column;
    gap: 6px;
    align-items: flex-start;
  }

  .container {
    padding-left: 16px;
    padding-right: 16px;
  }

  .back-top {
    right: 16px;
    bottom: 16px;
  }

  .entry-row {
    flex-wrap: wrap;
    gap: 8px;
  }

  .entry-title {
    flex-basis: 100%;
  }
}

/* ---------- Focus Visible ---------- */
:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
  border-radius: 4px;
}

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

/* ---------- Reduced Motion ---------- */
@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}
