/* Jonli ekran: proyektor / katta televizor (1920×1080) uchun. Tashqi CDN ishlatilmaydi. */
:root {
  --bg: #0a0f1f;
  --panel: #121a33;
  --text: #f4f6ff;
  --muted: #8f9cc6;
  --track: rgba(255, 255, 255, .07);
  --bar: #3b82f6;
  --gold: #fbbf24;
  --silver: #d6dde8;
  --bronze: #f59e0b;
  --bronze-bar: #c2702a;
  --plus: #4ade80;
  --flash: rgba(250, 204, 21, .38);
  --row-h: 36px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: var(--bg);
  color: var(--text);
  font-family: "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

body.idle { cursor: none; }

.screen {
  height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 1.2vh;
  padding: 1.8vh 1.6vw 1.2vh;
}

/* Sarlavha va jami son */
.head { display: flex; align-items: center; justify-content: space-between; gap: 2vw; }
.brand { display: flex; align-items: center; gap: 1.2vw; min-width: 0; }
.logo { height: 8vh; width: auto; }
h1 {
  margin: 0;
  font-size: 5.2vh;
  font-weight: 800;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.total { text-align: right; flex-shrink: 0; }
.total-label { color: var(--muted); font-size: 2vh; letter-spacing: .08em; text-transform: uppercase; }
.total-value {
  color: var(--gold);
  font-size: 8.5vh;
  font-weight: 800;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

/* Reyting */
.body { flex: 1; display: grid; grid-template-columns: minmax(0, 1fr) 23vw; gap: 1.6vw; min-height: 0; }
.board { position: relative; min-height: 0; }

.row {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: var(--row-h);
  display: grid;
  grid-template-columns: 2.6em minmax(0, 36%) minmax(0, 1fr) 3.4em;
  align-items: center;
  column-gap: .7em;
  padding: 0 .5em;
  border-radius: .3em;
  font-size: calc(var(--row-h) * .56);
  transition: transform .9s cubic-bezier(.22, .8, .24, 1);
  will-change: transform;
}
.rank { text-align: center; color: var(--muted); font-weight: 700; font-variant-numeric: tabular-nums; }
.name { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.track { height: 64%; background: var(--track); border-radius: .25em; overflow: hidden; }
.bar { width: 0; height: 100%; background: var(--bar); border-radius: .25em; transition: width .9s ease; }
.count { text-align: right; font-weight: 800; font-variant-numeric: tabular-nums; }

.row.r1 .bar { background: var(--gold); }
.row.r2 .bar { background: var(--silver); }
.row.r3 .bar { background: var(--bronze-bar); }
.row.r1 .count, .row.r1 .name { color: var(--gold); }
.row.r2 .count, .row.r2 .name { color: var(--silver); }
.row.r3 .count, .row.r3 .name { color: var(--bronze); }
.row.r1 .rank, .row.r2 .rank, .row.r3 .rank { font-size: 1.15em; }
.row.zero .name, .row.zero .count { color: var(--muted); font-weight: 500; }

/* Departament ko'p bo'lsa (live.js da TWO_COLUMNS_FROM) — ikki ustun: nom tepada, ustun (bar) pastda */
.board.two-col .row {
  right: auto;
  width: var(--col-w);
  grid-template-columns: 2.3em minmax(0, 1fr) 2.6em;
  grid-template-areas:
    "rank name count"
    "rank track count";
  row-gap: .2em;
  align-content: center;
  font-size: calc(var(--row-h) * .46);
}
.board.two-col .rank { grid-area: rank; }
.board.two-col .name { grid-area: name; }
.board.two-col .track { grid-area: track; height: .34em; }
.board.two-col .count { grid-area: count; }

/* Yangi ovoz kelganda qisqa "yonib-o'chish" */
.row.bump { animation: bump 1.6s ease-out; }
.row.bump .count { animation: pop 1.6s ease-out; }
@keyframes bump {
  0%, 25% { background: var(--flash); }
  100% { background: transparent; }
}
@keyframes pop {
  0% { transform: scale(1); }
  20% { transform: scale(1.35); }
  100% { transform: scale(1); }
}

/* So'nggi ovozlar */
.feed {
  display: flex;
  flex-direction: column;
  min-height: 0;
  padding: 2.2vh 1.3vw;
  background: var(--panel);
  border-radius: 1.2vh;
}
.feed h2 {
  margin: 0 0 1.6vh;
  color: var(--muted);
  font-size: 2.6vh;
  letter-spacing: .06em;
  text-transform: uppercase;
}
.recent { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 1.1vh; }
.recent li {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: baseline;
  gap: .6em;
  padding: 1.1vh .8vw;
  background: rgba(255, 255, 255, .045);
  border-radius: .8vh;
  font-size: 2.5vh;
}
.recent .t { color: var(--muted); font-variant-numeric: tabular-nums; }
.recent .d { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.recent .p { color: var(--plus); font-weight: 800; }
.recent li.new { animation: slide-in .8s ease-out; }
.recent li.none { display: block; color: var(--muted); background: none; }
@keyframes slide-in {
  from { opacity: 0; transform: translateX(25%); }
  to { opacity: 1; transform: none; }
}

/* Pastki qator */
.foot {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: .6em;
  color: var(--muted);
  font-size: 1.7vh;
  font-variant-numeric: tabular-nums;
}
.conn { display: inline-block; width: 1.1vh; height: 1.1vh; border-radius: 50%; background: var(--plus); }
.offline-note { display: none; color: #fca5a5; margin-right: 1em; }
.foot.off .conn { background: #ef4444; }
.foot.off .offline-note { display: inline; }

/* Telefon yoki tor ekranlar uchun */
@media (max-width: 900px) {
  html, body { overflow: auto; }
  .screen { height: auto; min-height: 100vh; }
  .body { grid-template-columns: 1fr; }
  .board { height: 70vh; }
  h1 { font-size: 3.2vh; white-space: normal; }
}
