:root {
  --bg: #06101d;
  --panel: rgba(8, 22, 39, 0.86);
  --panel-strong: rgba(10, 29, 50, 0.96);
  --line: rgba(154, 195, 255, 0.2);
  --text: #f2f7ff;
  --muted: #9bb1cb;
  --accent: #2fd6b4;
  --accent-2: #ffd166;
  --blue: #4da3ff;
  --danger: #ff7070;
  --radius: 8px;
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  min-height: 100%;
}

body {
  margin: 0;
  overflow: hidden;
  font-family: "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  color: var(--text);
  background:
    linear-gradient(120deg, rgba(47, 214, 180, 0.12), transparent 35%),
    linear-gradient(250deg, rgba(255, 209, 102, 0.12), transparent 34%),
    linear-gradient(160deg, #071424, #0a1f36 56%, #06101d);
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.04) 1px, transparent 1px);
  background-size: 36px 36px;
  opacity: 0.35;
}

.tv-shell {
  position: relative;
  display: grid;
  grid-template-rows: 104px 142px 1fr 54px;
  gap: 16px;
  width: 100vw;
  height: 100vh;
  min-width: 1180px;
  min-height: 660px;
  padding: 28px 34px 22px;
}

.topbar,
.kpi-strip,
.layout,
.ticker {
  display: grid;
  gap: 16px;
}

.topbar {
  grid-template-columns: 1fr auto;
  align-items: end;
}

.brand-block {
  display: grid;
  gap: 10px;
}

.brand-title {
  display: flex;
  align-items: center;
  gap: 22px;
  min-width: 0;
}

.brand-title img {
  width: 360px;
  height: 86px;
  object-fit: contain;
  flex: 0 0 auto;
  filter: drop-shadow(0 10px 22px rgba(0, 0, 0, 0.28));
}

.eyebrow,
.panel__head p {
  margin: 0;
  color: var(--accent);
  font-size: 18px;
  font-weight: 700;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: 58px;
  line-height: 1;
}

.clock {
  min-width: 280px;
  padding: 16px 20px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.04);
  text-align: right;
}

.clock span {
  display: block;
  color: var(--accent-2);
  font-size: 44px;
  font-weight: 800;
  line-height: 1;
}

.clock small {
  display: block;
  margin-top: 8px;
  color: var(--muted);
  font-size: 15px;
}

.kpi-strip {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.stat,
.panel {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.28);
  backdrop-filter: blur(18px);
}

.stat {
  display: grid;
  align-content: center;
  min-width: 0;
  padding: 18px 20px;
}

.stat__label {
  color: var(--muted);
  font-size: 18px;
}

.stat__value {
  margin-top: 4px;
  overflow: hidden;
  color: var(--text);
  font-size: 42px;
  font-weight: 800;
  line-height: 1.08;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.stat__sub {
  margin-top: 8px;
  overflow: hidden;
  color: #d4e2f5;
  font-size: 16px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.slides {
  position: relative;
  min-height: 0;
}

.slide {
  position: absolute;
  inset: 0;
  opacity: 0;
  transform: translateX(26px);
  transition: opacity 500ms ease, transform 500ms ease;
  pointer-events: none;
}

.slide.is-active {
  opacity: 1;
  transform: translateX(0);
  pointer-events: auto;
}

.layout {
  height: 100%;
  min-height: 0;
}

.layout--overview {
  grid-template-columns: 1.25fr 0.72fr 0.72fr 0.9fr;
}

.layout--split {
  grid-template-columns: 0.82fr 1.18fr;
}

.panel {
  min-width: 0;
  min-height: 0;
  padding: 22px;
  overflow: hidden;
}

.panel--full,
.panel--ranking,
.panel--trend,
.panel--camera {
  display: grid;
  grid-template-rows: auto 1fr;
}

.panel__head {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 16px;
  margin-bottom: 16px;
}

.panel__head h2 {
  font-size: 32px;
  line-height: 1.1;
}

.camera-head {
  align-items: start;
}

.camera-status {
  flex: 0 0 auto;
  padding: 6px 10px;
  border: 1px solid rgba(47, 214, 180, 0.35);
  border-radius: 999px;
  color: #cbfff6;
  background: rgba(47, 214, 180, 0.08);
  font-size: 14px;
  font-weight: 800;
  white-space: nowrap;
}

.camera-player {
  position: relative;
  min-height: 0;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius);
  background: #02070d;
  aspect-ratio: 16 / 9;
}

.camera-player video {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  background: #02070d;
}

.camera-placeholder {
  position: absolute;
  inset: 0;
  display: grid;
  place-content: center;
  gap: 8px;
  padding: 18px;
  text-align: center;
  background:
    linear-gradient(135deg, rgba(47, 214, 180, 0.12), transparent 46%),
    linear-gradient(315deg, rgba(255, 209, 102, 0.12), transparent 42%),
    #07111f;
}

.camera-placeholder[hidden] {
  display: none;
}

.camera-placeholder strong {
  font-size: 22px;
  line-height: 1.2;
}

.camera-placeholder span {
  color: var(--muted);
  font-size: 15px;
  line-height: 1.4;
}

.camera-meta {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  margin-top: 12px;
  color: #dce9f8;
  font-size: 18px;
  font-weight: 800;
}

.camera-meta span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.trend {
  display: flex;
  align-items: end;
  gap: 20px;
  height: 100%;
  min-height: 0;
  padding-top: 28px;
}

.bar {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: end;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.bar__col {
  width: 100%;
  min-height: 18px;
  border-radius: 8px 8px 2px 2px;
  background: linear-gradient(180deg, var(--accent), var(--blue));
}

.bar__label,
.bar__value {
  color: var(--muted);
  font-size: 18px;
}

.bar__value {
  color: #cbfff6;
  font-weight: 800;
}

.rank-list,
.stack {
  display: grid;
  gap: 12px;
}

.item,
.stack-item {
  min-width: 0;
  padding: 14px 16px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.045);
}

.item__top {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 18px;
  align-items: baseline;
}

.item__name,
.item__value {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.item__name {
  font-size: 24px;
  font-weight: 800;
}

.item__value {
  color: var(--accent-2);
  font-size: 26px;
  font-weight: 900;
}

.item__meta,
.stack-item small {
  display: block;
  margin-top: 6px;
  color: var(--muted);
  font-size: 16px;
  line-height: 1.45;
}

.stack-item span,
.stack-item strong {
  display: block;
  color: var(--text);
  font-size: 21px;
  line-height: 1.35;
}

.table-wrap {
  min-height: 0;
  overflow: hidden;
}

.table-wrap--tall {
  height: 100%;
}

table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
  font-size: 22px;
}

th,
td {
  overflow: hidden;
  padding: 16px 14px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  text-align: left;
  text-overflow: ellipsis;
  white-space: nowrap;
}

thead th {
  color: var(--muted);
  font-size: 17px;
  font-weight: 700;
}

tbody tr:nth-child(odd) {
  background: rgba(255, 255, 255, 0.025);
}

.danger {
  color: var(--danger);
  font-weight: 900;
}

.ticker {
  grid-template-columns: 1fr auto;
  align-items: center;
  min-width: 0;
  padding: 0 2px;
}

#focusTicker {
  overflow: hidden;
  color: #dce9f8;
  font-size: 22px;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#slideDots {
  display: flex;
  gap: 10px;
}

.dot {
  width: 42px;
  height: 8px;
  border: 0;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.22);
}

.dot.is-active {
  background: var(--accent-2);
}

@media (max-aspect-ratio: 4 / 3) {
  body {
    overflow: auto;
  }

  .tv-shell {
    height: auto;
    min-width: 0;
    min-height: 100vh;
    grid-template-rows: auto;
  }

  .slides,
  .slide {
    position: static;
  }

  .slide {
    display: none;
  }

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

  .layout,
  .layout--overview,
  .layout--split,
  .kpi-strip,
  .topbar {
    grid-template-columns: 1fr;
  }
}
