/* Алфавит Филфича — механическое перекидное табло.
   Оранжевый отвечает за бренд, лайм — за деньги и борьбу. */

:root {
  --bg: #000000;
  --plate: #212328;
  --seam: #0e0f11;
  --edge: #2e3137;
  --dim: #4e535b;
  --live: #d8ff46;
  --final: #f4f1e8;
  --brand: #ff8a1f;
  --ink: #e9ebee;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }

.tb {
  max-width: 1180px;
  margin: 0 auto;
  min-height: 100vh;
}

/* ---------- шапка ---------- */

.tb-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  padding: 18px 20px;
  background: transparent;
}

.tb-mark { display: flex; gap: 3px; align-items: center; }

.tb-mark span {
  width: 27px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--plate);
  border-radius: 3px;
  color: var(--final);
  font-weight: 800;
  font-size: 19px;
  position: relative;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .05);
}

.tb-mark span::after {
  content: "";
  position: absolute;
  left: 0; right: 0; top: 50%;
  height: 1px;
  background: var(--seam);
}

.tb-mark .gap { width: 9px; background: none; box-shadow: none; }
.tb-mark .gap::after { display: none; }

.tb-mark span.br {
  color: var(--brand);
  background: #241b12;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .05), 0 0 14px rgba(255, 138, 31, .18);
}

.tb-stats { display: flex; gap: 10px; }

.tb-stat {
  background: var(--plate);
  border-radius: 4px;
  padding: 7px 14px;
  min-width: 94px;
}

.tb-stat b {
  display: block;
  font-size: 19px;
  font-weight: 800;
  color: var(--final);
  line-height: 1.1;
}

.tb-stat i {
  font-style: normal;
  font-size: 9px;
  letter-spacing: .14em;
  color: var(--dim);
  text-transform: uppercase;
}

.tb-stat.live b { color: var(--live); }

.tb-dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--live);
  display: inline-block;
  margin-right: 6px;
  box-shadow: 0 0 9px var(--live);
  animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse { 50% { opacity: .35; } }

.tb-back { font-size: 11px; color: var(--dim); letter-spacing: .1em; }
.tb-back:hover { color: var(--brand); }

/* ---------- бегущая строка ---------- */

.tb-ticker {
  display: flex;
  gap: 26px;
  padding: 9px 20px;
  background: transparent;
  font-size: 10px;
  color: var(--dim);
  letter-spacing: .07em;
  white-space: nowrap;
  overflow-x: auto;
  scrollbar-width: none;
}

.tb-ticker::-webkit-scrollbar { display: none; }
.tb-ticker b { color: var(--live); font-weight: 700; }
.tb-ticker u { color: #9aa0aa; text-decoration: none; }

/* ---------- табло ---------- */

.tb-board {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 9px;
  padding: 20px;
}

.tb-c {
  position: relative;
  aspect-ratio: 3 / 4;
  border-radius: 5px;
  overflow: hidden;
  background: var(--plate);
  container-type: size;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .045), 0 3px 7px rgba(0, 0, 0, .35);
  transition: transform .18s ease;
}

.tb-c:hover { transform: translateY(-2px); }

/* шов перекидной пластины */
.tb-c::after {
  content: "";
  position: absolute;
  left: 0; right: 0; top: 50%;
  height: 2px;
  background: var(--seam);
  z-index: 5;
  opacity: .85;
}

/* Пустая пластина: буква распёрта почти на всю плитку */
.tb-L {
  font-weight: 800;
  line-height: .78;
  color: var(--dim);
  letter-spacing: -.04em;
  font-size: 52px;
  font-size: 104cqh;
}

/* Постер — отдельный слой: иначе обесцвечивание закрытой буквы
   погасило бы и букву, и сумму, и метку FINAL. */
.tb-bg {
  position: absolute;
  inset: 0;
  z-index: 0;
  background-size: cover;
  background-position: center;
}

.tb-c.f::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
  background: linear-gradient(to top,
              rgba(10, 11, 13, .97) 30%,
              rgba(10, 11, 13, .35) 60%,
              rgba(10, 11, 13, .1));
}

.tb-c.f .tb-L {
  position: absolute;
  top: -.1em;
  left: .04em;
  z-index: 3;
  color: var(--live);
  font-size: 38px;
  font-size: 64cqh;
  text-shadow: 0 3px 18px rgba(0, 0, 0, .9);
}

.tb-m { position: absolute; left: 7px; right: 7px; bottom: 6px; z-index: 4; }

.tb-n {
  display: -webkit-box;
  font-family: Manrope, system-ui, sans-serif;
  font-weight: 800;
  font-size: 10px;
  color: #fff;
  line-height: 1.2;
  overflow: hidden;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.tb-s {
  display: block;
  font-size: 11px;
  font-weight: 800;
  color: var(--live);
  margin-top: 3px;
}

.tb-rivals {
  position: absolute;
  top: 6px; right: 6px;
  z-index: 4;
  background: rgba(216, 255, 70, .16);
  color: var(--live);
  border: 1px solid rgba(216, 255, 70, .45);
  border-radius: 3px;
  font-size: 8px;
  font-weight: 700;
  padding: 2px 4px;
}

.tb-c.fin { box-shadow: inset 0 0 0 2px var(--final), 0 3px 7px rgba(0, 0, 0, .35); }
.tb-c.fin .tb-L { color: var(--final); }
.tb-c.fin .tb-s { color: #a8adb6; }

.tb-fin {
  position: absolute;
  top: 6px; right: 6px;
  z-index: 4;
  background: var(--final);
  color: #111;
  border-radius: 2px;
  font-size: 8px;
  font-weight: 800;
  padding: 2px 5px;
  letter-spacing: .08em;
}

/* ---------- раскрытая буква ---------- */

.tb-open {
  background: transparent;
  padding: 24px 20px;
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 26px;
}

.tb-hero {
  position: relative;
  border-radius: 6px;
  overflow: hidden;
  aspect-ratio: 2 / 3;
  background: var(--plate);
  background-size: cover;
  background-position: center;
  box-shadow: 0 10px 30px rgba(0, 0, 0, .6);
}

.tb-hero::after {
  content: "";
  position: absolute;
  left: 0; right: 0; top: 50%;
  height: 2px;
  background: var(--seam);
  opacity: .6;
}

.tb-hero b {
  position: absolute;
  top: -8px; left: 8px;
  font-size: 86px;
  font-weight: 800;
  color: var(--live);
  line-height: 1;
  text-shadow: 0 3px 20px rgba(0, 0, 0, .9);
}

.tb-hero-empty b { color: var(--dim); }

.tb-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 14px;
}

.tb-title {
  font-family: Manrope, system-ui, sans-serif;
  font-weight: 800;
  font-size: 26px;
  color: #fff;
  line-height: 1.1;
  margin: 0;
}

.tb-sub {
  font-size: 10px;
  color: var(--dim);
  letter-spacing: .13em;
  margin-top: 7px;
  text-transform: uppercase;
}

.tb-bank { text-align: right; flex-shrink: 0; }
.tb-bank b { display: block; font-size: 26px; font-weight: 800; color: var(--live); line-height: 1; }
.tb-bank i { font-style: normal; font-size: 9px; letter-spacing: .14em; color: var(--dim); }

.tb-lab {
  font-size: 9px;
  letter-spacing: .16em;
  color: var(--dim);
  text-transform: uppercase;
  margin: 20px 0 8px;
}

.tb-riv {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--plate);
  border-radius: 4px;
  padding: 9px 12px;
  margin-bottom: 5px;
  position: relative;
  overflow: hidden;
}

.tb-riv i { position: absolute; left: 0; top: 0; bottom: 0; background: rgba(216, 255, 70, .1); z-index: 0; }
.tb-riv.top i { background: rgba(216, 255, 70, .2); }
.tb-riv span, .tb-riv em, .tb-riv u { position: relative; z-index: 1; }

.tb-riv span {
  font-family: Manrope, system-ui, sans-serif;
  font-weight: 700;
  font-size: 13px;
  color: var(--ink);
  flex: 1;
}

.tb-riv em { font-style: normal; font-size: 13px; font-weight: 800; color: var(--dim); }
.tb-riv.top em { color: var(--live); }

.tb-riv u {
  text-decoration: none;
  font-size: 8px;
  letter-spacing: .1em;
  color: #0f1012;
  background: var(--live);
  border-radius: 2px;
  padding: 2px 5px;
  font-weight: 800;
}

.tb-don { display: flex; flex-wrap: wrap; gap: 6px; }
.tb-don div { background: var(--plate); border-radius: 3px; padding: 7px 10px; font-size: 11px; color: #b7bcc4; }
.tb-don div b { color: var(--final); font-weight: 700; }
.tb-don div s { text-decoration: none; color: var(--live); font-weight: 800; margin-left: 7px; }

.tb-hist { list-style: none; margin: 0; padding: 0; font-size: 11px; color: #9aa0aa; }
.tb-hist li { padding: 5px 0; border-bottom: 1px solid var(--edge); }

/* ---------- кнопки и подвал ---------- */

.tb-cta { display: flex; gap: 8px; margin-top: 20px; flex-wrap: wrap; }

.tb-btn {
  flex: 1;
  min-width: 160px;
  text-align: center;
  padding: 13px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .1em;
}

.tb-btn.a { background: var(--brand); color: #140d05; }
.tb-btn.a:hover { background: #ff9c42; }
.tb-btn.b { background: transparent; border: 1px solid var(--edge); color: #9aa0aa; }
.tb-btn.b:hover { color: var(--ink); border-color: var(--dim); }

.tb-foot {
  padding: 22px 20px 40px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.tb-foot p { margin: 0; font-size: 11px; color: var(--dim); letter-spacing: .05em; max-width: 46ch; line-height: 1.6; }
.tb-foot .tb-btn { flex: 0 0 auto; }

/* ---------- флип пластины при перебивке ---------- */

.tb-c.flipping { animation: plate-flip .55s ease-in-out; }

@keyframes plate-flip {
  0%   { transform: rotateX(0deg); }
  49%  { transform: rotateX(-90deg); }
  50%  { transform: rotateX(-90deg); }
  100% { transform: rotateX(0deg); }
}

/* Анимация во весь экран у части зрителей вызывает тошноту. */
@media (prefers-reduced-motion: reduce) {
  .tb-c.flipping { animation: none; }
  .tb-dot { animation: none; }
  .tb-c:hover { transform: none; }
}

/* ---------- размеры экрана ---------- */

@media (max-width: 1100px) { .tb-board { grid-template-columns: repeat(5, 1fr); } }

@media (max-width: 860px) {
  .tb-board { grid-template-columns: repeat(4, 1fr); }
  .tb-open { grid-template-columns: 1fr; }
  .tb-hero { max-width: 220px; }
}

@media (max-width: 560px) {
  .tb-board { grid-template-columns: repeat(3, 1fr); gap: 7px; padding: 14px; }
  .tb-top { padding: 14px; }
  .tb-mark span { width: 21px; height: 29px; font-size: 15px; }
  .tb-title { font-size: 21px; }
}

.tb-hist-film { color: var(--ink); font-family: Manrope, system-ui, sans-serif; font-weight: 700; margin-right: 8px; }
.tb-hist-ev { color: var(--dim); letter-spacing: .08em; text-transform: uppercase; font-size: 9px; }

/* Донатеры: сумма слева, ник справа от неё, блок к правому краю */
.tb-lab.right { text-align: right; }
.tb-don { justify-content: flex-end; }
.tb-don div { display: flex; align-items: baseline; gap: 8px; }
.tb-don div s { order: 0; margin-left: 0; }
.tb-don div b { order: 1; }

/* Вторая кнопка доната — перебить */
.tb-btn.o { background: transparent; border: 1px solid var(--brand); color: var(--brand); }
.tb-btn.o:hover { background: rgba(255, 138, 31, .12); }
.tb-cta-hint { font-size: 11px; color: var(--dim); line-height: 1.7; margin: 10px 0 0; max-width: 60ch; }

/* Нижняя строка плитки: слева банк, справа тот, кто вложил больше всех */
.tb-row { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; margin-top: 3px; }
.tb-row .tb-s { margin-top: 0; }
.tb-d {
  font-size: 9px;
  color: #9aa0aa;
  max-width: 55%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex-shrink: 1;
}
.tb-c.fin .tb-d { color: #8b9099; }
.ov .tb-d { font-size: 7px; }

/* Закрытая буква — постер в чёрно-белом: фильм уже посмотрен,
   и выцветшая обложка отличает его от тех, за которые ещё идёт борьба. */
.tb-c.fin .tb-bg,
.tb-hero.fin .tb-bg { filter: grayscale(1) contrast(1.05); }
