﻿.display-body {
  background: radial-gradient(circle at 20% 20%, #2a2f45 0%, transparent 50%),
    radial-gradient(circle at 80% 10%, rgba(247, 157, 101, 0.2), transparent 55%),
    linear-gradient(120deg, #0b0f1a 0%, #18161a 60%, #111319 100%);
  min-height: 100vh;
  position: relative;
  overflow-x: hidden;
  --qr-size: clamp(260px, 26vw, 520px);
}

.display-body.has-bg {
  background-image: linear-gradient(120deg, rgba(11, 15, 26, 0.75) 0%, rgba(17, 17, 19, 0.88) 60%, rgba(5, 6, 9, 0.9) 100%),
    var(--bg-image);
  background-size: auto, cover;
  background-position: center, center;
  background-repeat: no-repeat, no-repeat;
}

.display-shell {
  width: min(96vw, 2200px);
  margin: 0 auto;
  padding: clamp(32px, 6vw, 60px) clamp(16px, 4vw, 32px) 80px;
  position: relative;
  z-index: 2;
}

.display-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: clamp(20px, 3vw, 40px);
  flex-wrap: wrap;
}

.display-header h1 {
  font-family: var(--font-display);
  font-size: clamp(2.6rem, 4vw, 5.6rem);
  margin: 16px 0 12px;
}

.display-header p {
  color: var(--muted);
  margin: 0;
  max-width: 680px;
  font-size: clamp(0.95rem, 1.2vw, 1.25rem);
}

.display-controls {
  display: flex;
  align-items: center;
  gap: clamp(12px, 2vw, 24px);
  flex-wrap: wrap;
}

.timer {
  padding: clamp(14px, 1.6vw, 24px) clamp(16px, 1.8vw, 26px);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
  text-align: right;
  min-width: clamp(160px, 14vw, 260px);
}

.timer-label {
  text-transform: uppercase;
  font-size: clamp(10px, 0.8vw, 13px);
  letter-spacing: 1.4px;
  color: var(--muted);
}

.timer-value {
  font-size: clamp(1.7rem, 2.4vw, 3rem);
  font-weight: 600;
  margin-top: 6px;
}

.timer-meta {
  font-size: clamp(11px, 0.9vw, 14px);
  color: var(--accent-cool);
}

.display-main {
  margin-top: 28px;
  display: grid;
  grid-template-columns: 1fr;
  gap: clamp(16px, 2.6vw, 32px);
  align-items: start;
}

.display-main.with-qr {
  grid-template-columns: minmax(0, 1fr) var(--qr-size);
}

.display-board {
  padding: clamp(18px, 2.2vw, 34px);
}

.qr-panel {
  padding: clamp(16px, 1.8vw, 26px);
  text-align: center;
  position: sticky;
  top: 24px;
  width: var(--qr-size);
}

.qr-title {
  font-weight: 600;
  letter-spacing: 1px;
  margin-bottom: 12px;
  font-size: clamp(0.95rem, 1.2vw, 1.25rem);
}

.qr-image {
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: contain;
  border-radius: clamp(16px, 2vw, 24px);
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
  padding: clamp(8px, 1vw, 14px);
}

.qr-hint {
  font-size: clamp(11px, 0.9vw, 14px);
  color: var(--muted);
  margin-top: 10px;
}

.board-header {
  display: grid;
  grid-template-columns: minmax(70px, 8vw) 1.6fr minmax(90px, 9vw) minmax(160px, 1fr);
  gap: 12px;
  font-size: clamp(11px, 0.9vw, 14px);
  letter-spacing: 1.2px;
  text-transform: uppercase;
  color: var(--muted);
  padding-bottom: 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.board-body {
  display: flex;
  flex-direction: column;
  gap: var(--row-gap, clamp(12px, 1.4vw, 18px));
  padding-top: 12px;
}

.board-row {
  display: grid;
  grid-template-columns: minmax(70px, 8vw) 1.6fr minmax(90px, 9vw) minmax(160px, 1fr);
  gap: 12px;
  align-items: center;
  height: var(--row-height, auto);
  padding: var(--row-pad-y, clamp(12px, 1.4vw, 20px)) var(--row-pad-x, clamp(12px, 1.4vw, 20px));
  border-radius: clamp(14px, 1.4vw, 18px);
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid transparent;
  transition: transform 0.3s ease, border-color 0.3s ease;
}

.board-row:hover {
  transform: translateY(-2px);
  border-color: rgba(109, 211, 206, 0.4);
}

.rank-pill {
  font-size: clamp(1.1rem, 2.4vw, 2rem);
  font-weight: 700;
  color: var(--accent);
}

.program-name {
  font-weight: 600;
  font-size: clamp(0.95rem, 1.8vw, 1.35rem);
}

.program-dept {
  font-size: clamp(0.75rem, 1.4vw, 1.05rem);
  color: var(--muted);
  margin-top: var(--row-dept-gap, 4px);
}

.vote-count {
  font-size: clamp(1rem, 2.2vw, 1.7rem);
  font-weight: 600;
  text-align: center;
}

.bar-track {
  height: clamp(8px, 0.9vw, 12px);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.1);
  overflow: hidden;
}

.bar-fill {
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--accent-cool), var(--accent));
  width: 0%;
  transition: width 0.4s ease;
}

.bar-meta {
  display: flex;
  justify-content: space-between;
  font-size: clamp(11px, 0.9vw, 14px);
  color: var(--muted);
  margin-top: 6px;
}

.board-footer {
  margin-top: 16px;
  display: flex;
  justify-content: space-between;
  gap: 16px;
  font-size: clamp(12px, 0.9vw, 15px);
  color: var(--muted);
  flex-wrap: wrap;
}

.display-glow {
  position: fixed;
  width: 500px;
  height: 500px;
  background: radial-gradient(circle, rgba(109, 211, 206, 0.25), transparent 70%);
  bottom: -200px;
  right: -120px;
  filter: blur(10px);
  z-index: 1;
}

.display-grid {
  position: fixed;
  inset: 0;
  background-image: linear-gradient(rgba(255, 255, 255, 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.03) 1px, transparent 1px);
  background-size: 60px 60px;
  opacity: 0.35;
  pointer-events: none;
  z-index: 0;
}

.start-overlay {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(6, 8, 12, 0.5);
  backdrop-filter: blur(6px);
  z-index: 7;
}

.start-overlay[hidden] {
  display: none;
}

.start-card {
  width: min(80vw, 520px);
  padding: clamp(24px, 3vw, 40px);
  text-align: center;
  background: rgba(255, 255, 255, 0.12);
  border-radius: clamp(18px, 2vw, 28px);
  animation: fadeIn 0.4s ease;
}

.start-title {
  font-family: var(--font-display);
  font-size: clamp(1.4rem, 2vw, 2.2rem);
  color: var(--text);
  margin-bottom: 8px;
}

.start-count {
  font-size: clamp(3rem, 8vw, 7rem);
  font-weight: 700;
  color: var(--accent);
  letter-spacing: 2px;
  text-shadow: 0 0 24px rgba(247, 178, 103, 0.4);
  animation: pulseGlow 1s ease-in-out infinite;
}

.start-sub {
  font-size: clamp(0.9rem, 1.1vw, 1.1rem);
  color: var(--muted);
  margin-top: 6px;
}

.result-overlay {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(6, 8, 12, 0.58);
  backdrop-filter: blur(6px);
  z-index: 6;
  cursor: pointer;
}

.result-overlay[hidden] {
  display: none;
}

.result-card {
  width: min(92vw, 860px);
  padding: clamp(24px, 3vw, 44px);
  text-align: center;
  background: linear-gradient(160deg, rgba(255, 255, 255, 0.18), rgba(255, 255, 255, 0.08));
  border: 1px solid rgba(255, 255, 255, 0.18);
  box-shadow: 0 40px 90px rgba(0, 0, 0, 0.45);
  animation: fadeIn 0.4s ease;
  cursor: default;
  position: relative;
  overflow: hidden;
}

.result-card::before {
  content: '';
  position: absolute;
  inset: -40% -20% auto -20%;
  height: 55%;
  background: radial-gradient(circle, rgba(247, 178, 103, 0.25), transparent 70%);
  opacity: 0.7;
  pointer-events: none;
}

.result-title {
  font-family: var(--font-display);
  font-size: clamp(1.6rem, 2.4vw, 2.6rem);
  font-weight: 700;
  margin-bottom: 6px;
  letter-spacing: 1px;
}

.result-sub {
  font-size: clamp(0.95rem, 1.1vw, 1.2rem);
  color: var(--muted);
}

.result-podium {
  margin-top: clamp(18px, 2.4vw, 28px);
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: clamp(12px, 2vw, 20px);
  align-items: end;
}

.podium-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: clamp(10px, 1.6vw, 16px);
  text-align: center;
}

.podium-card {
  width: 100%;
  padding: clamp(10px, 1.4vw, 16px);
  border-radius: 16px;
  background: rgba(8, 10, 16, 0.35);
  border: 1px solid rgba(255, 255, 255, 0.14);
  backdrop-filter: blur(6px);
}

.podium-rank {
  font-weight: 700;
  letter-spacing: 1px;
  margin-bottom: 6px;
  color: var(--accent);
  font-size: clamp(0.85rem, 1.1vw, 1.1rem);
}

.podium-name {
  font-weight: 700;
  font-size: clamp(0.95rem, 1.4vw, 1.3rem);
}

.podium-dept {
  margin-top: 4px;
  font-size: clamp(0.75rem, 1vw, 0.95rem);
  color: var(--muted);
}

.podium-votes {
  margin-top: 8px;
  font-weight: 600;
  color: var(--accent-cool);
  font-size: clamp(0.85rem, 1.1vw, 1.05rem);
}

.podium-step {
  width: 100%;
  border-radius: 18px 18px 10px 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: clamp(1.4rem, 2.6vw, 2.4rem);
  color: rgba(10, 10, 14, 0.7);
  position: relative;
  overflow: hidden;
}

.podium-step::after {
  content: '';
  position: absolute;
  inset: 10% 12% auto 12%;
  height: 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.22);
}

.podium-first .podium-step {
  height: clamp(130px, 18vw, 220px);
  background: linear-gradient(180deg, rgba(247, 178, 103, 0.95), rgba(138, 86, 46, 0.95));
  box-shadow: 0 24px 50px rgba(247, 178, 103, 0.35);
}

.podium-second .podium-step {
  height: clamp(110px, 15vw, 185px);
  background: linear-gradient(180deg, rgba(206, 214, 225, 0.9), rgba(120, 128, 142, 0.9));
}

.podium-third .podium-step {
  height: clamp(96px, 13vw, 165px);
  background: linear-gradient(180deg, rgba(214, 160, 110, 0.9), rgba(128, 82, 50, 0.9));
}

.podium-first .podium-card {
  border-color: rgba(247, 178, 103, 0.6);
}

.podium-second .podium-card {
  border-color: rgba(206, 214, 225, 0.5);
}

.podium-third .podium-card {
  border-color: rgba(214, 160, 110, 0.5);
}

.podium-empty {
  opacity: 0.5;
}

@media (max-width: 720px) {
  .result-podium {
    grid-template-columns: 1fr;
  }

  .podium-item {
    flex-direction: row;
    align-items: stretch;
  }

  .podium-card {
    text-align: left;
  }

  .podium-step,
  .podium-first .podium-step,
  .podium-second .podium-step,
  .podium-third .podium-step {
    width: 84px;
    height: auto;
    min-height: 72px;
    border-radius: 14px;
  }

  .podium-step::after {
    display: none;
  }

  .podium-first {
    order: -1;
  }

  .podium-second {
    order: 0;
  }

  .podium-third {
    order: 1;
  }
}

@keyframes pulseGlow {
  0% {
    transform: scale(1);
    opacity: 0.9;
  }
  50% {
    transform: scale(1.06);
    opacity: 1;
  }
  100% {
    transform: scale(1);
    opacity: 0.9;
  }
}

@media (max-width: 900px) {
  .display-main,
  .display-main.with-qr {
    grid-template-columns: 1fr;
  }

  .qr-panel {
    position: static;
    order: 2;
    width: 100%;
  }

  .board-header,
  .board-row {
    grid-template-columns: 70px 1fr;
  }

  .board-header div:nth-child(3),
  .board-header div:nth-child(4),
  .board-row .vote-count,
  .board-row .bar-cell {
    display: none;
  }

  .vote-count {
    text-align: left;
  }
}

@media (max-width: 640px) {
  .display-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .display-controls {
    width: 100%;
    justify-content: space-between;
  }

  .display-board {
    padding: 18px;
  }
}
