/* ==========================================================================
   RESET & CORE BASE (MOBILE-FIRST)
   ========================================================================== */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background-color: #0b0e14;
  color: #ffffff;
  overflow-x: hidden;
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
}

.screen {
  display: none;
  width: 100%;
  max-width: 480px;
  min-height: 100vh;
  padding: 20px;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  position: relative;
}

.screen.active {
  display: flex;
}

/* Branch Tag */
.top-branch-tag {
  position: fixed;
  top: 12px;
  left: 12px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.15);
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 11px;
  letter-spacing: 1px;
  color: #35e8ff;
  z-index: 100;
  backdrop-filter: blur(8px);
}

/* Toast */
.toast {
  position: fixed;
  top: -60px;
  left: 50%;
  transform: translateX(-50%);
  background: #ff7b9c;
  color: #fff;
  padding: 10px 20px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 600;
  transition: top 0.3s ease;
  z-index: 1000;
  box-shadow: 0 4px 15px rgba(255, 123, 156, 0.4);
}
.toast.show {
  top: 20px;
}

/* Buttons */
.primary-btn {
  background: linear-gradient(135deg, #ffd76a, #ff9d00);
  color: #000;
  border: none;
  padding: 14px 28px;
  border-radius: 25px;
  font-weight: 700;
  font-size: 15px;
  letter-spacing: 1px;
  cursor: pointer;
  width: 100%;
  box-shadow: 0 4px 15px rgba(255, 215, 106, 0.3);
}

.primary-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.secondary-btn {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.2);
  padding: 14px 24px;
  border-radius: 25px;
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
}

/* ==========================================================================
   MÀN HÌNH TRANG CHỦ & LOGIN
   ========================================================================== */
.home-card, .login-card, .thanks-card, .closed-card {
  background: rgba(20, 25, 35, 0.85);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 20px;
  padding: 30px 20px;
  width: 100%;
  text-align: center;
  backdrop-filter: blur(12px);
}

.logo-badge {
  display: inline-block;
  background: #ffd76a;
  color: #000;
  font-weight: 900;
  padding: 4px 12px;
  border-radius: 6px;
  font-size: 12px;
  margin-bottom: 15px;
}

.sub-title {
  color: #35e8ff;
  font-size: 13px;
  margin-top: 5px;
  letter-spacing: 1px;
}

.timer-box {
  margin: 25px 0;
  background: rgba(0, 0, 0, 0.4);
  padding: 15px;
  border-radius: 12px;
  border: 1px solid rgba(53, 232, 255, 0.2);
}

.timer-box small {
  color: #8a99ad;
  font-size: 10px;
  letter-spacing: 1px;
}

.timer-digits {
  font-size: 26px;
  font-weight: 800;
  color: #35e8ff;
  font-family: monospace;
  margin-top: 4px;
}

/* Voter List Search */
.search-box input {
  width: 100%;
  background: rgba(0, 0, 0, 0.5);
  border: 1px solid rgba(255, 255, 255, 0.15);
  padding: 12px 16px;
  border-radius: 12px;
  color: #fff;
  margin: 15px 0;
  outline: none;
}

.voter-list {
  max-height: 220px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 20px;
}

.voter-option {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid transparent;
  padding: 12px 16px;
  border-radius: 10px;
  color: #fff;
  cursor: pointer;
  text-align: left;
}

.voter-option.selected {
  border-color: #ffd76a;
  background: rgba(255, 215, 106, 0.15);
}

.action-btns {
  display: flex;
  gap: 10px;
}

.error-msg {
  color: #ff7b9c;
  font-size: 12px;
  margin-bottom: 10px;
}

/* ==========================================================================
   CYBERPUNK 3D SCANNER & POWER PIPES (MOBILE-FIRST)
   ========================================================================== */
#nomineeDrawScreen {
  padding: 15px 10px;
  justify-content: space-between;
}

.cyber-title {
  color: #35e8ff;
  font-size: 11px;
  letter-spacing: 2px;
  font-weight: 800;
}

.scan-status {
  font-size: 13px;
  font-weight: 700;
  color: #ffd76a;
  margin-top: 4px;
  min-height: 20px;
}

/* Lưới 20 ô nhỏ 4x5 */
.staff-grid-3d {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  width: 100%;
  margin: 15px 0;
}

.staff-card-blue {
  background: rgba(15, 25, 40, 0.8);
  border: 1px solid rgba(53, 232, 255, 0.2);
  border-radius: 8px;
  padding: 6px;
  text-align: center;
  transition: all 0.2s ease;
  position: relative;
}

.staff-card-blue img {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  object-fit: cover;
}

.avatar-fallback {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.1);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  margin: 0 auto;
}

.staff-name {
  font-size: 9px;
  color: #a0b0c0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 4px;
}

/* Quét Laser Active */
.staff-card-blue.active-scan {
  border-color: #35e8ff;
  box-shadow: 0 0 12px #35e8ff;
  transform: scale(1.08);
}

.staff-card-blue.selected-gold {
  border-color: #ffd76a;
  box-shadow: 0 0 15px #ffd76a;
  background: rgba(255, 215, 106, 0.2);
}

/* SVG Dây Năng Lượng */
.energy-svg {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 10;
}

.energy-pipe {
  fill: none;
  stroke: #ffd76a;
  stroke-width: 3;
  stroke-dasharray: 6 4;
  animation: pipeFlow 0.8s linear infinite;
  filter: drop-shadow(0 0 6px #ffd76a);
}

@keyframes pipeFlow {
  from { stroke-dashoffset: 20; }
  to { stroke-dashoffset: 0; }
}

/* Bục Vinh Danh Top 3 & Thẻ 3D Gold Lật */
.podium-container {
  display: flex;
  justify-content: space-around;
  width: 100%;
  gap: 10px;
  z-index: 20;
  margin-top: auto;
}

.podium-slot {
  flex: 1;
  perspective: 1000px;
}

.gold-card-3d {
  width: 100%;
  height: 130px;
  position: relative;
}

.card-inner {
  width: 100%;
  height: 100%;
  position: relative;
  transform-style: preserve-3d;
  transition: transform 0.8s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.gold-card-3d.flipped .card-inner {
  transform: rotateY(180deg);
}

.card-front, .card-back {
  position: absolute;
  width: 100%;
  height: 100%;
  backface-visibility: hidden;
  border-radius: 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 8px;
}

.card-front {
  background: rgba(20, 30, 45, 0.9);
  border: 1px dashed rgba(255, 215, 106, 0.4);
  color: #ffd76a;
  font-size: 24px;
  font-weight: 800;
}

.card-back {
  background: linear-gradient(145deg, #1e1b10, #3a2e0b);
  border: 2px solid #ffd76a;
  transform: rotateY(180deg);
  box-shadow: 0 0 15px rgba(255, 215, 106, 0.3);
}

.card-back img {
  width: 45px;
  height: 45px;
  border-radius: 50%;
  border: 2px solid #ffd76a;
  object-fit: cover;
}

.winner-name {
  font-size: 10px;
  font-weight: 700;
  color: #fff;
  margin-top: 6px;
  text-align: center;
}

.badge-gold {
  font-size: 8px;
  background: #ffd76a;
  color: #000;
  padding: 2px 6px;
  border-radius: 4px;
  font-weight: 800;
  margin-top: 4px;
}

/* ==========================================================================
   MÀN HÌNH BÌNH CHỌN 5 VÒNG (VOTE STAGE)
   ========================================================================== */
.vote-header {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 15px;
}

.round-tag {
  background: var(--stage-color, #ffd76a);
  color: #000;
  font-weight: 800;
  padding: 4px 12px;
  border-radius: 12px;
  font-size: 12px;
}

.exit-btn {
  background: none;
  border: none;
  color: #8a99ad;
  font-size: 20px;
  cursor: pointer;
}

.vote-stage {
  text-align: center;
  width: 100%;
}

.star-center-container {
  height: 80px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 10px 0;
}

.diamond-star {
  font-size: 48px;
  filter: drop-shadow(0 0 12px var(--stage-color, #ffd76a));
  transition: transform 0.3s ease;
}

.vote-hint {
  font-size: 11px;
  color: #8a99ad;
  letter-spacing: 1px;
  margin-bottom: 20px;
}

.candidate-grid {
  display: flex;
  justify-content: space-around;
  gap: 10px;
  width: 100%;
}

.candidate {
  background: none;
  border: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  cursor: pointer;
  flex: 1;
}

.candidate .avatar {
  width: 70px;
  height: 70px;
  border-radius: 50%;
  border: 3px solid #fff;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 8px;
}

.candidate .avatar img {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
}

.candidate-name {
  font-size: 12px;
  font-weight: 700;
  color: #fff;
}

.candidate-role {
  font-size: 10px;
  color: #8a99ad;
}

.star-bank {
  margin-top: 4px;
  min-height: 16px;
}

.mini-star {
  font-size: 12px;
  margin: 0 1px;
}
/* ==========================================================================
   CYBERPUNK 3D SCANNER & ENERGY PIPES SVG
   ========================================================================== */
#nomineeDrawScreen {
  position: relative;
  overflow: hidden;
}

.energy-svg {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 10;
}

.energy-pipe {
  fill: none;
  stroke: #35e8ff;
  stroke-width: 3px;
  stroke-linecap: round;
  filter: drop-shadow(0 0 8px #35e8ff) drop-shadow(0 0 15px #00f0ff);
  stroke-dasharray: 8 4;
  animation: pipeFlow 1s linear infinite;
}

@keyframes pipeFlow {
  from { stroke-dashoffset: 24; }
  to { stroke-dashoffset: 0; }
}

/* Thẻ Gold 3D Lật mặt */
.gold-card-3d {
  perspective: 1000px;
}
.gold-card-3d .card-inner {
  transition: transform 0.8s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  transform-style: preserve-3d;
}
.gold-card-3d.flipped .card-inner {
  transform: rotateY(180deg);
}