/* PVP Core — страница голосования зрителей (мобильная). Макет: Figma PVP_Vote_Page.
   Один HTML на все телефоны: что показать в карточке DJ, решает CSS по её высоте (container queries). */

@font-face { font-family: 'IBM Plex Mono'; font-style: normal; font-weight: 400; font-display: block; src: url(/fonts/IBMPlexMono-400.woff2) format('woff2'); }
@font-face { font-family: 'IBM Plex Mono'; font-style: normal; font-weight: 700; font-display: block; src: url(/fonts/IBMPlexMono-700.woff2) format('woff2'); }
@font-face { font-family: 'Barlow Condensed'; font-style: normal; font-weight: 700; font-display: block; src: url(/fonts/BarlowCondensed-700.woff2) format('woff2'); }
@font-face { font-family: 'Barlow Condensed'; font-style: normal; font-weight: 900; font-display: block; src: url(/fonts/BarlowCondensed-900.woff2) format('woff2'); }

:root {
  --bg: #050505;
  --card: #0a0a0a;
  --blue: #00b4ff;
  --red: #ff2d55;
  --white: #ffffff;
  --muted: #8d8d8d;
  --dim: #3a3a3a;
  --track: #2a2a2a;
  --green: #35d06b;
  --amber: #ffb020;
  --mono: 'IBM Plex Mono', ui-monospace, Menlo, monospace;
  --display: 'Barlow Condensed', 'Arial Narrow', 'Helvetica Neue', sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  background: var(--bg) radial-gradient(ellipse 80% 50% at 50% 0%, #161616 0%, var(--bg) 70%);
  color: var(--white);
  font-family: var(--mono);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  overflow-x: hidden;
}
button { font: inherit; color: inherit; touch-action: manipulation; }
a { color: inherit; }

/* ---------- каркас ---------- */
.app {
  height: 100vh;
  height: 100dvh;
  max-width: 430px;
  margin: 0 auto;
  padding: calc(12px + env(safe-area-inset-top)) 16px calc(12px + env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* ---------- шапка ---------- */
.header {
  display: flex; align-items: center; gap: 10px;
  padding-bottom: 10px;
  border-bottom: 1px solid rgba(255,255,255,0.1);
}
.header img { width: 30px; height: 30px; display: block; }
.header .titles { flex: 1; min-width: 0; }
.header .kicker { font-size: 10px; font-weight: 700; letter-spacing: 0.2em; color: var(--muted); }
.header .title { font-size: 12px; font-weight: 700; letter-spacing: 0.08em; margin-top: 2px; }
.live {
  display: inline-flex; align-items: center; gap: 7px;
  height: 29px; padding: 0 12px 0 10px;
  border-radius: 15px;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.12);
  font-size: 10px; font-weight: 700; letter-spacing: 0.1em;
}
.live::before {
  content: ""; width: 7px; height: 7px; border-radius: 50%;
  background: var(--red); box-shadow: 0 0 8px var(--red);
  animation: pulse 1.6s ease-in-out infinite;
}
.live.rehearsal { color: var(--amber); }
.live.rehearsal::before { background: var(--amber); box-shadow: 0 0 8px var(--amber); }
@keyframes pulse { 50% { opacity: 0.35; } }

/* ---------- колода раундов: листается свайпом, точками и стрелками ---------- */
.deck {
  flex: 1; min-height: 0;
  display: flex; flex-direction: column; gap: 10px;
  touch-action: pan-y;
  will-change: transform;
}
.deck.dragging { transition: none; }
.deck.snap { transition: transform 0.18s ease-out; }
@keyframes slide-in-left  { from { transform: translateX(28px);  opacity: 0.3; } to { transform: none; opacity: 1; } }
@keyframes slide-in-right { from { transform: translateX(-28px); opacity: 0.3; } to { transform: none; opacity: 1; } }
.deck.enter-left  { animation: slide-in-left 0.22s ease-out; }
.deck.enter-right { animation: slide-in-right 0.22s ease-out; }

/* ---------- раунд ---------- */
.round { text-align: center; }
.round .name-row { display: flex; align-items: center; justify-content: center; gap: 6px; margin-top: 4px; }
.round .nav {
  width: 32px; height: 32px; border: 0; background: transparent; padding: 0;
  display: inline-flex; align-items: center; justify-content: center;
  color: var(--muted); cursor: pointer; opacity: 0.9;
}
.round .nav svg { width: 22px; height: 22px; stroke: currentColor; fill: none; stroke-width: 2.5; stroke-linecap: round; stroke-linejoin: round; }
.round .nav:disabled { opacity: 0.15; cursor: default; }
.round .nav:active:not(:disabled) { color: var(--white); }
.round .kicker { font-size: 10px; letter-spacing: 0.2em; color: var(--muted); text-transform: uppercase; min-height: 12px; }
.round .kicker.genre { color: rgba(255,255,255,0.75); font-weight: 700; }
.round .kicker b { color: var(--dim); font-weight: 400; margin: 0 6px; }
.round .name {
  font-family: var(--display); font-weight: 900; font-size: 26px; line-height: 1;
  letter-spacing: 0.02em; text-transform: uppercase; min-width: 150px;
}
.round .name small { font-size: 14px; color: #777; margin-left: 4px; }
.dots { display: flex; justify-content: center; gap: 7px; margin-top: 8px; min-height: 8px; }
.dots i {
  width: 8px; height: 8px; border-radius: 50%;
  background: #303030; border: 1px solid rgba(255,255,255,0.08);
}
.dots i.a    { background: var(--blue); box-shadow: 0 0 8px var(--blue); }
.dots i.b    { background: var(--red);  box-shadow: 0 0 8px var(--red); }
.dots i.draw { background: #9a9a9a; }
.dots i.now  { background: var(--white); box-shadow: 0 0 8px var(--white); animation: pulse 1.6s ease-in-out infinite; }
.dots i.cancelled { background: transparent; border-color: #444; }
.dots i.sel  { outline: 2px solid rgba(255,255,255,0.55); outline-offset: 2px; }
.dots i { cursor: pointer; }

/* ---------- таймер ---------- */
.timer { text-align: center; }
.timer .label { font-size: 10px; letter-spacing: 0.2em; color: var(--muted); margin-bottom: 2px; min-height: 12px; }
.timer .time {
  font-size: clamp(44px, 14vw, 58px); font-weight: 700; line-height: 1;
  letter-spacing: -0.02em;
  text-shadow: 0 0 24px rgba(255,255,255,0.35);
  font-variant-numeric: tabular-nums;
}
.timer .time.final { font-family: var(--display); font-weight: 900; letter-spacing: 0.04em; }
.timer .bar {
  width: 220px; max-width: 70%; height: 4px; margin: 10px auto 0;
  background: var(--track); border-radius: 2px; overflow: hidden;
}
.timer .bar i { display: block; height: 100%; width: 0; background: var(--white); transition: width 0.5s linear; }

/* ---------- арена ---------- */
.arena { flex: 1; display: flex; flex-direction: column; gap: 8px; min-height: 0; }
.card {
  --c: var(--blue);
  flex: 1 1 0;
  min-height: 0;
  container: card / size;
  display: flex; flex-direction: column;
  padding: 12px 10px 10px;
  background:
    linear-gradient(135deg, color-mix(in srgb, var(--c) 28%, transparent) 0%, transparent 55%),
    var(--card);
  border: 2px solid var(--c);
  box-shadow: 0 0 18px color-mix(in srgb, var(--c) 35%, transparent),
              inset 0 0 28px color-mix(in srgb, var(--c) 10%, transparent);
  transition: opacity 0.3s, filter 0.3s;
}
.card.b { --c: var(--red); }
.card .meta { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.corner {
  font-size: 10px; font-weight: 700; letter-spacing: 0.15em; color: var(--c);
  padding: 5px 8px; border: 1px solid var(--c); background: rgba(0,0,0,0.18); white-space: nowrap;
}
.channel {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 10px; font-weight: 700; letter-spacing: 0.12em; color: var(--c); white-space: nowrap;
}
.channel svg { width: 12px; height: 12px; stroke: var(--c); fill: none; stroke-width: 2; }
.card .body { flex: 1; min-height: 0; display: flex; flex-direction: column; justify-content: center; gap: 4px; }
/* низ карточки: панель во всю ширину — слева промо-группа, справа квадратные кнопки
   тех соцсетей, где у диджея есть ник. Пустая панель не рисуется */
.card .foot { display: flex; align-items: flex-end; min-height: 14px; flex-shrink: 0; }
.card .promo { width: 100%; }
.card .promo:empty { display: none; }
.card .panel {
  display: flex; align-items: center; justify-content: space-between; gap: 10px; width: 100%;
  padding: 6px 6px 6px 10px; background: rgba(0,0,0,0.35);
  border: 1px solid color-mix(in srgb, var(--c) 28%, transparent);
}
.card .ptxt {
  min-width: 0; font-size: 11px; font-weight: 700; letter-spacing: 0.14em; text-transform: uppercase; color: var(--c);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.card .ptxt small { display: block; font-size: 8px; font-weight: 400; letter-spacing: 0.2em; color: var(--muted); margin-bottom: 2px; }
.card .pbtns { display: flex; gap: 6px; flex: 0 0 auto; }
.card .sbtn {
  width: 34px; height: 34px; display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid color-mix(in srgb, var(--c) 70%, transparent);
  background: color-mix(in srgb, var(--c) 12%, transparent);
  box-shadow: 0 0 10px color-mix(in srgb, var(--c) 30%, transparent), inset 0 1px 0 rgba(255,255,255,0.08);
}
.card .sbtn svg { width: 18px; height: 18px; stroke: var(--c); fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.card .sbtn:active { background: var(--c); }
.card .sbtn:active svg { stroke: var(--bg); }
.card .dj {
  display: flex; align-items: center; min-width: 0;
  font-family: var(--display); font-weight: 900;
  font-size: clamp(40px, 13vw, 57px); line-height: 0.95;
  color: var(--c); text-transform: uppercase; letter-spacing: 0.01em;
  text-shadow: 0 0 22px color-mix(in srgb, var(--c) 55%, transparent);
  padding: 8px 0;
  overflow-wrap: anywhere;
}
.card .rule { height: 6px; background: var(--c); box-shadow: 0 0 14px var(--c); margin: 8px 0 10px; }
.vote {
  display: flex; align-items: center; justify-content: space-between;
  height: 48px; padding: 0 14px;
  background: var(--c); color: var(--bg); border: 0;
  font-family: var(--display); font-weight: 900; font-size: 20px; letter-spacing: 0.18em;
  box-shadow: 0 0 16px color-mix(in srgb, var(--c) 50%, transparent);
  cursor: pointer; width: 100%;
  transition: filter 0.15s, opacity 0.2s;
}
.vote:active { filter: brightness(0.85); }
.vote svg { width: 24px; height: 24px; stroke: currentColor; fill: none; stroke-width: 2.5; }
.vote:disabled { cursor: default; }
/* кнопка до открытия голосования: контур, не кликается */
.card.locked .vote { background: transparent; color: var(--c); border: 1px solid color-mix(in srgb, var(--c) 50%, transparent); box-shadow: none; opacity: 0.7; }
/* голос отдан за эту карточку */
.card.chosen .vote { background: var(--white); color: var(--bg); box-shadow: 0 0 18px rgba(255,255,255,0.45); }
/* вторая карточка после голоса и проигравший после финиша */
.card.faded { opacity: 0.45; filter: saturate(0.5); }
/* победитель */
.card.winner { box-shadow: 0 0 28px color-mix(in srgb, var(--c) 70%, transparent), inset 0 0 40px color-mix(in srgb, var(--c) 18%, transparent); }
.card.winner .vote { background: var(--white); color: var(--bg); }
.card.winner .vote svg { display: none; }
.card.winner .vote::after {
  content: ""; width: 22px; height: 22px; flex: 0 0 auto;
  background: var(--c); -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9H4.5a2.5 2.5 0 0 1 0-5H6'/%3E%3Cpath d='M18 9h1.5a2.5 2.5 0 0 0 0-5H18'/%3E%3Cpath d='M4 22h16'/%3E%3Cpath d='M10 14.66V17c0 .55-.47.98-.97 1.21C7.85 18.75 7 20.24 7 22'/%3E%3Cpath d='M14 14.66V17c0 .55.47.98.97 1.21C16.15 18.75 17 20.24 17 22'/%3E%3Cpath d='M18 2H6v7a6 6 0 0 0 12 0V2Z'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9H4.5a2.5 2.5 0 0 1 0-5H6'/%3E%3Cpath d='M18 9h1.5a2.5 2.5 0 0 0 0-5H18'/%3E%3Cpath d='M4 22h16'/%3E%3Cpath d='M10 14.66V17c0 .55-.47.98-.97 1.21C7.85 18.75 7 20.24 7 22'/%3E%3Cpath d='M14 14.66V17c0 .55.47.98.97 1.21C16.15 18.75 17 20.24 17 22'/%3E%3Cpath d='M18 2H6v7a6 6 0 0 0 12 0V2Z'/%3E%3C/svg%3E") center / contain no-repeat;
}
/* прошедший или пропущенный раунд без победителя */
.card.past .vote { background: transparent; color: var(--c); border: 1px solid color-mix(in srgb, var(--c) 35%, transparent); box-shadow: none; opacity: 0.6; }
.card.past .vote svg { display: none; }
.arena.hidden { display: none; }

/* ---------- VS / сообщение ---------- */
.vs { display: flex; align-items: center; gap: 12px; padding: 2px 24px; }
.vs::before, .vs::after {
  content: ""; flex: 1; height: 2px;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.6), transparent);
}
.vs span {
  background: var(--white); color: var(--card);
  font-family: var(--display); font-weight: 900; font-size: 22px; line-height: 1;
  padding: 4px 10px; transform: skewX(-8deg);
}
.notice {
  flex: 1; display: none; flex-direction: column; align-items: center; justify-content: center; gap: 10px;
  text-align: center; padding: 24px 12px;
  border: 1px solid rgba(255,255,255,0.1);
  background: linear-gradient(180deg, rgba(255,255,255,0.03), transparent);
}
.notice.visible { display: flex; }
.notice h2 { font-family: var(--display); font-weight: 900; font-size: 40px; line-height: 1; letter-spacing: 0.02em; }
.notice p { font-size: 11px; letter-spacing: 0.16em; color: var(--muted); max-width: 26ch; }

/* на высоких экранах имя крупнее; порог — по content-box карточки, без рамки и паддингов */
@container card (min-height: 330px) { .card .dj { font-size: clamp(48px, 15vw, 68px); } }

/* ---------- статус: утопленный экранчик, не кнопка ---------- */
.status {
  display: flex; align-items: center; justify-content: center; gap: 10px;
  height: 36px; padding: 0 12px;
  background: #030303;
  border: 1px solid rgba(255,255,255,0.05);
  border-radius: 4px;
  box-shadow: inset 0 2px 6px rgba(0,0,0,0.9), inset 0 0 0 1px rgba(0,0,0,0.6), 0 1px 0 rgba(255,255,255,0.05);
  font-size: 11px; font-weight: 700; letter-spacing: 0.18em;
  color: #9a9a9a; text-transform: uppercase;
  overflow: hidden; white-space: nowrap;
}
.status .label { color: #5a5a5a; font-weight: 400; }
.status .led { width: 6px; height: 6px; border-radius: 50%; flex: 0 0 auto; background: #555; }
.status[data-tone="green"] .led { background: var(--green); box-shadow: 0 0 6px var(--green); }
.status[data-tone="amber"] .led { background: var(--amber); box-shadow: 0 0 6px var(--amber); }
.status[data-tone="red"]   .led { background: var(--red);   box-shadow: 0 0 6px var(--red); animation: pulse 1s ease-in-out infinite; }
.status[data-tone="white"] .led { background: var(--white); box-shadow: 0 0 6px var(--white); }
.status[data-tone="red"] { color: #ff8da1; }

/* ---------- низкие вьюпорты (Android 640, Safari с панелями) ---------- */
@media (max-height: 700px) {
  .card .panel { padding: 4px 4px 4px 8px; }
  .card .ptxt small { display: inline; margin: 0 6px 0 0; }
  .card .sbtn { width: 28px; height: 28px; }
  .card .sbtn svg { width: 15px; height: 15px; }
  .app { gap: 7px; padding-top: calc(8px + env(safe-area-inset-top)); padding-bottom: calc(8px + env(safe-area-inset-bottom)); }
  .header { padding-bottom: 7px; }
  .round .name { font-size: 22px; }
  .round .name-row { margin-top: 2px; }
  .deck { gap: 7px; }
  .dots { margin-top: 6px; }
  .timer .time { font-size: clamp(40px, 12vw, 48px); }
  .timer .bar { margin-top: 7px; }
  .arena { gap: 6px; }
  .card { padding: 9px 10px 9px; }
  .card .dj { padding: 0; font-size: clamp(30px, 10vw, 42px); }
  .card .rule { margin: 6px 0 8px; }
  .vote { height: 44px; }
  .vs { padding: 0 24px; }
  .vs span { font-size: 19px; padding: 3px 9px; }
  .status { height: 32px; }
}

@media (prefers-reduced-motion: reduce) {
  .live::before, .dots i.now, .status .led, .deck { animation: none; }
}
