:root {
  color-scheme: light;
  --bg: #eef6fb;
  --surface: #ffffff;
  --surface-soft: #f5fbff;
  --ink: #172033;
  --muted: #64748b;
  --line: rgba(23, 32, 51, .12);
  --brand: #1677ff;
  --brand-2: #08b6a4;
  --hot: #f43f5e;
  --warm: #ffb020;
  --radius: 8px;
  --shadow: 0 18px 48px rgba(25, 70, 110, .12);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  color: var(--ink);
  background:
    linear-gradient(120deg, rgba(22, 119, 255, .16), transparent 30rem),
    linear-gradient(300deg, rgba(8, 182, 164, .14), transparent 34rem),
    var(--bg);
}

body.soft-mode {
  --bg: #f7fafc;
  --surface-soft: #f8fbff;
}

a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }

.app-shell {
  display: grid;
  grid-template-columns: 244px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  z-index: 30;
  height: 100vh;
  padding: 18px 14px;
  border-right: 1px solid var(--line);
  background: rgba(255, 255, 255, .9);
  backdrop-filter: blur(16px);
}

.brand {
  display: flex;
  gap: 12px;
  align-items: center;
  min-height: 56px;
  margin-bottom: 18px;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  border-radius: var(--radius);
  color: #fff;
  background: linear-gradient(135deg, var(--brand), var(--brand-2));
  font-weight: 900;
}

.brand strong { display: block; font-size: 19px; }
.brand small { color: var(--muted); font-size: 12px; }

.side-nav {
  display: grid;
  gap: 7px;
}

.side-nav a {
  display: flex;
  gap: 10px;
  align-items: center;
  min-height: 42px;
  padding: 0 11px;
  border: 1px solid transparent;
  border-radius: var(--radius);
  color: var(--muted);
  font-weight: 900;
}

.side-nav a span {
  display: grid;
  place-items: center;
  width: 22px;
}

.side-nav a:hover,
.side-nav a.active {
  color: var(--brand);
  background: #e8f3ff;
  border-color: rgba(22, 119, 255, .22);
}

.download-card {
  position: absolute;
  left: 14px;
  right: 14px;
  bottom: 16px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-soft);
}

.download-card p {
  margin: 7px 0 12px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.qr-block {
  display: grid;
  place-items: center;
  width: 78px;
  height: 78px;
  border-radius: var(--radius);
  background:
    linear-gradient(90deg, #111 8px, transparent 8px) 0 0/18px 18px,
    linear-gradient(#111 8px, transparent 8px) 0 0/18px 18px,
    #fff;
  color: transparent;
}

.main {
  min-width: 0;
  padding: 14px clamp(14px, 3vw, 32px) 42px;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 0 14px;
  background: linear-gradient(180deg, var(--bg), rgba(238, 246, 251, .74));
  backdrop-filter: blur(12px);
}

.menu-btn { display: none; }

.search-wrap {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: 0 8px 24px rgba(25, 70, 110, .05);
}

.search-wrap span,
.eyebrow {
  color: var(--brand);
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

.search-wrap input {
  min-width: 0;
  width: 100%;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--ink);
}

.top-actions,
.hero-actions,
.match-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.primary-btn,
.outline-btn,
.ghost-btn,
.icon-btn,
.mini-btn,
.primary-mini {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  padding: 0 12px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  font-weight: 900;
  background: var(--surface);
}

.primary-btn,
.primary-mini {
  color: #fff;
  border-color: transparent;
  background: linear-gradient(135deg, var(--brand), var(--brand-2));
  box-shadow: 0 10px 22px rgba(22, 119, 255, .18);
}

.primary-btn { min-height: 42px; padding: 0 16px; }
.mini-btn,
.primary-mini { min-height: 32px; font-size: 12px; }
.outline-btn { color: var(--brand); background: rgba(255, 255, 255, .72); }
.full { width: 100%; }

.primary-mini:disabled {
  cursor: not-allowed;
  opacity: .45;
  box-shadow: none;
}

.hero-board {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 270px;
  gap: 12px;
  margin-bottom: 12px;
}

.hero-player {
  position: relative;
  min-height: 380px;
  overflow: hidden;
  border-radius: var(--radius);
  background: #dceef8;
  box-shadow: var(--shadow);
}

.hero-player img {
  width: 100%;
  height: 100%;
  min-height: 380px;
  object-fit: cover;
}

.hero-overlay {
  position: absolute;
  inset: auto 0 0 0;
  padding: 28px;
  color: #fff;
  background: linear-gradient(0deg, rgba(10, 20, 34, .82), transparent);
}

h1, h2, h3, p { margin-top: 0; }
h1 {
  max-width: 820px;
  margin-bottom: 10px;
  font-size: clamp(34px, 5vw, 62px);
  line-height: 1;
}
h2 { margin-bottom: 0; font-size: clamp(22px, 3vw, 32px); }
h3 { margin-bottom: 7px; }
p { color: var(--muted); line-height: 1.58; }

.hero-overlay p {
  color: rgba(255, 255, 255, .84);
  font-size: 16px;
}

.stacked-rail {
  display: grid;
  gap: 10px;
}

.rail-thumb {
  position: relative;
  min-height: 88px;
  overflow: hidden;
  border: 0;
  border-radius: var(--radius);
  color: #fff;
  text-align: left;
  background: #0b1a2c;
}

.rail-thumb img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: .78;
}

.rail-thumb span,
.rail-thumb strong {
  position: relative;
  z-index: 1;
  display: block;
  margin: 8px;
  text-shadow: 0 2px 8px rgba(0, 0, 0, .45);
}

.rail-thumb span {
  width: max-content;
  padding: 3px 7px;
  border-radius: 999px;
  background: var(--hot);
  font-size: 10px;
  font-weight: 900;
}

.notice-strip,
.ad-strip,
.content-panel,
.rail-card,
.live-row-section {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, .9);
  box-shadow: var(--shadow);
}

.notice-strip {
  display: flex;
  gap: 10px;
  align-items: center;
  min-height: 38px;
  padding: 0 12px;
  margin-bottom: 12px;
  overflow: hidden;
}

.notice-strip strong {
  color: #fff;
  background: var(--brand);
  border-radius: 5px;
  padding: 4px 8px;
  font-size: 12px;
}

#noticeTicker {
  min-width: 0;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ad-strip {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
  min-height: 96px;
  padding: 18px;
  margin-bottom: 14px;
  color: #fff;
  background:
    linear-gradient(110deg, rgba(22, 119, 255, .92), rgba(8, 182, 164, .86)),
    url("https://images.unsplash.com/photo-1431324155629-1a6deb1dec8d?auto=format&fit=crop&w=1600&q=80") center/cover;
}

.ad-strip span { display: block; font-size: 12px; font-weight: 900; text-transform: uppercase; }
.ad-strip strong { display: block; max-width: 760px; margin-top: 5px; font-size: clamp(20px, 3vw, 34px); }

.live-row-section {
  padding: 14px;
  margin-bottom: 14px;
}

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

.sub-section {
  margin-top: 22px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

select {
  min-height: 38px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--ink);
  background: #fff;
  font-weight: 900;
}

.match-ticker {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(190px, 1fr);
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 4px;
}

.score-tile {
  min-height: 84px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  text-align: left;
  background: var(--surface-soft);
}

.score-tile span,
.score-tile small {
  display: block;
  color: var(--muted);
  font-size: 11px;
}

.score-tile strong {
  display: block;
  margin: 5px 0;
  line-height: 1.2;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 330px;
  gap: 14px;
}

.content-panel,
.rail-card {
  padding: 14px;
}

.right-panel {
  display: grid;
  gap: 12px;
  align-content: start;
}

.compact h2 { font-size: 20px; }

.match-grid,
.hot-list,
.source-status,
.schedule-list,
.creator-grid,
.event-grid,
.room-list {
  display: grid;
  gap: 10px;
}

.match-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.match-card,
.hot-item,
.source-status article,
.schedule-row,
.creator-card,
.event-card,
.room-row {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.match-card {
  overflow: hidden;
}

.match-card img {
  display: block;
  width: 100%;
  height: 160px;
  object-fit: cover;
}

.match-body,
.hot-item,
.source-status article,
.schedule-row,
.creator-card,
.event-card,
.room-row {
  padding: 12px;
}

.meta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.meta-row span:last-child,
.hot-item span,
.source-status span,
.schedule-row small,
.creator-card span,
.room-row span,
.room-row small {
  color: var(--muted);
  font-size: 12px;
}

.live-chip {
  display: inline-flex;
  align-items: center;
  width: max-content;
  min-height: 24px;
  padding: 0 8px;
  border-radius: 999px;
  color: #fff;
  background: var(--hot);
  font-size: 12px;
  font-weight: 900;
}

.live-chip.upcoming {
  color: var(--brand);
  background: #e8f3ff;
}

.hot-item,
.room-row {
  display: grid;
  gap: 5px;
  width: 100%;
  text-align: left;
}

.source-status article strong {
  display: block;
  font-size: 22px;
}

.schedule-row {
  display: grid;
  grid-template-columns: 110px minmax(0, 1fr) 220px;
  gap: 12px;
  align-items: center;
}

.creator-grid,
.event-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.creator-card p {
  word-break: break-all;
  font-size: 13px;
}

.event-card {
  min-height: 150px;
  background:
    linear-gradient(135deg, rgba(22, 119, 255, .1), rgba(255, 176, 32, .16)),
    #fff;
}

.live-room-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 310px;
  gap: 12px;
}

.inline-player {
  position: relative;
  min-height: 430px;
  overflow: hidden;
  border-radius: var(--radius);
  background: #061427;
}

.inline-player img {
  width: 100%;
  height: 100%;
  min-height: 430px;
  object-fit: cover;
  opacity: .88;
}

.play-float {
  position: absolute;
  left: 50%;
  top: 50%;
  display: grid;
  place-items: center;
  width: 74px;
  height: 74px;
  border: 0;
  border-radius: 50%;
  color: var(--brand);
  background: #fff;
  transform: translate(-50%, -50%);
  font-size: 28px;
}

.inline-meta {
  position: absolute;
  left: 16px;
  right: 16px;
  bottom: 16px;
  display: grid;
  gap: 4px;
  padding: 12px;
  border-radius: var(--radius);
  color: #fff;
  background: rgba(10, 20, 34, .72);
}

.inline-meta span { color: rgba(255, 255, 255, .78); font-size: 13px; }

.modal,
.watch-modal {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: none;
  place-items: center;
  padding: 20px;
  background: rgba(10, 20, 34, .56);
}

.modal.open,
.watch-modal.open { display: grid; }

.modal-card,
.watch-dialog {
  position: relative;
  width: min(440px, 100%);
  border-radius: var(--radius);
  background: #fff;
  box-shadow: 0 24px 80px rgba(0, 0, 0, .25);
}

.modal-card { padding: 24px; }

.modal-card label {
  display: grid;
  gap: 7px;
  margin-bottom: 12px;
  color: var(--muted);
  font-weight: 800;
}

.modal-card input {
  min-height: 42px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.close-btn {
  position: absolute;
  right: 12px;
  top: 10px;
  border: 0;
  background: transparent;
  font-size: 24px;
}

.watch-dialog {
  width: min(1080px, 100%);
  overflow: hidden;
}

.watch-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  padding: 14px;
}

.watch-dialog iframe {
  display: block;
  width: 100%;
  height: min(64vh, 640px);
  border: 0;
  background: #061427;
}

.watch-shield {
  position: absolute;
  left: 0;
  right: 0;
  top: 76px;
  bottom: 0;
  z-index: 2;
  display: none;
  place-items: center;
  padding: 24px;
  color: #fff;
  text-align: center;
  background:
    radial-gradient(circle at 50% 35%, rgba(22, 119, 255, .24), transparent 28rem),
    linear-gradient(180deg, rgba(6, 20, 39, .94), rgba(6, 20, 39, .86));
}

.watch-shield.open {
  display: grid;
}

.watch-shield p {
  max-width: 420px;
  margin: 12px auto 0;
  color: rgba(255, 255, 255, .78);
}

.skeleton {
  min-height: 140px;
  border-radius: var(--radius);
  background: linear-gradient(90deg, #e8f0f7, #fff, #e8f0f7);
  background-size: 220% 100%;
  animation: shimmer 1.2s linear infinite;
}

.skeleton.narrow { min-width: 240px; min-height: 82px; }
.empty { color: var(--muted); }

@keyframes shimmer {
  to { background-position: -220% 0; }
}

@media (max-width: 1180px) {
  .hero-board,
  .workspace,
  .live-room-layout {
    grid-template-columns: 1fr;
  }

  .stacked-rail,
  .right-panel {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 920px) {
  .app-shell { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed;
    width: 250px;
    transform: translateX(-105%);
    transition: transform .2s ease;
  }
  .sidebar.open { transform: translateX(0); }
  .menu-btn { display: inline-flex; }
  .match-grid,
  .creator-grid,
  .event-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 640px) {
  .main { padding: 10px; }
  .topbar { flex-wrap: wrap; }
  .search-wrap { order: 3; flex-basis: 100%; }
  .top-actions { width: 100%; }
  .top-actions > * { flex: 1; }
  .hero-player,
  .hero-player img { min-height: 340px; }
  .hero-overlay { padding: 18px; }
  .ad-strip,
  .section-head,
  .watch-head {
    align-items: stretch;
    flex-direction: column;
  }
  .match-grid,
  .creator-grid,
  .event-grid,
  .stacked-rail,
  .right-panel {
    grid-template-columns: 1fr;
  }
  .schedule-row { grid-template-columns: 1fr; }
  .inline-player,
  .inline-player img { min-height: 320px; }
  .watch-dialog iframe { height: 54vh; }
}
