:root {
  --gold: #d4af37;
  --gold-light: #f9e29c;
  --bg: #121212;
  --card-bg: #1e1e1e;
  --text: #ffffff;
}

body {
  font-family: "Prompt", sans-serif;
  background-color: var(--bg);
  color: var(--text);
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
  overflow-x: hidden; /* ซ่อนแถบเลื่อนแนวนอน ถ้ามันล้น */
  margin: 0; /* เผื่อไว้ */
}

/* --- Header --- */
.header {
  text-align: center;
  padding: 25px 20px;
  background: linear-gradient(to bottom, #000000, #1a1a1a);
  border-bottom: 1px solid var(--gold);
}

.header h1 {
  margin: 0;
  color: var(--gold);
  text-transform: uppercase;
  font-size: 20px;
  letter-spacing: 1px;
}
.header p {
  color: #aaa;
  font-size: 12px;
  margin-top: 5px;
}

.logo-miss-seven-queen {
  width: 60px;
  height: auto;
  filter: drop-shadow(0 0 10px rgba(212, 175, 55, 0.5));
}

/* --- Grid Layout --- */
.grid-container {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  padding: 15px;
}

.card {
  background: var(--card-bg);
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.5);
  cursor: pointer;
  transition: transform 0.2s;
  border: 1px solid #333;
  position: relative;
}

.card:active {
  transform: scale(0.98);
}

.card-img {
  width: 100%;
  aspect-ratio: 3/4;
  object-fit: cover;
  background-color: #333;
}

.card-info {
  padding: 8px;
  text-align: center;
}

.card-no {
  position: absolute;
  top: 5px;
  left: 5px;
  background: rgba(0, 0, 0, 0.7);
  color: var(--gold);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 10px;
  border: 1px solid var(--gold);
}

.card-name {
  font-size: 13px;
  color: #eee;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.card-nickname {
  color: var(--gold);
  font-size: 12px;
  margin-top: 2px;
}

.btn-vote-card {
  width: 100%;
  background: transparent;
  border: 1px solid var(--gold);
  color: var(--gold);
  padding: 5px;
  margin-top: 8px;
  border-radius: 4px;
  font-size: 11px;
}

/* --- Modal (Popup) แก้ไขใหม่! --- */
.modal {
  display: none;
  position: fixed;
  z-index: 1000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.85);
  justify-content: center;
  align-items: center;
  backdrop-filter: blur(5px);
}

.modal-content {
  background-color: var(--card-bg);
  width: 85%;
  max-width: 380px;
  max-height: 85vh;
  overflow-y: auto;

  padding: 20px;
  border: 1px solid var(--gold);
  border-radius: 15px;
  position: relative;
  text-align: center;
  box-shadow: 0 0 20px rgba(212, 175, 55, 0.2);
}

.modal-content::-webkit-scrollbar {
  width: 4px;
}
.modal-content::-webkit-scrollbar-thumb {
  background: var(--gold);
  border-radius: 4px;
}

/* 🖼️ Hero Image ใหญ่สะใจ */
.modal-hero-image {
  width: 100%;
  height: 450px; /* กำหนดความสูงให้สูงๆ เลย */
  position: relative;
  background-color: #000;
}

.modal-hero-image img {
  width: 100%;
  height: 100%;
  object-fit: cover; /* รูปเต็มกรอบไม่บีบ */
  object-position: top center; /* เน้นหน้า */
}

/* 📝 Body */
.modal-body {
  padding: 20px 25px 0px 25px;
  text-align: center;
  position: relative;
  margin-top: -40px; /* ดันข้อความขึ้นไปทับรูปนิดนึง */
  z-index: 10;
}

#modalName {
  font-size: 24px;
  margin-top: 30px;
  color: #d4af37; /* สีทอง */
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.8);
}

.modal-subtitle {
  color: #aaa;
  font-size: 14px;
  margin: -20px 0px 0px 0px;
}

.close-btn {
  position: absolute;
  top: 15px;
  right: 20px;
  color: #fff;
  font-size: 30px;
  font-weight: bold;
  z-index: 20;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.8);
  cursor: pointer;
}

.modal-img {
  width: 100px;
  height: 100px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--gold);
  margin-bottom: 10px;
  margin-top: 10px;
}

.qr-section {
  background: #fff;
  padding: 8px;
  border-radius: 8px;
  display: inline-block;
  margin: 10px 0;
}

.qr-code {
  width: 120px;
  height: 120px;
  object-fit: contain;
}

.price-tag {
  background: #2a2a2a;
  padding: 10px;
  border-radius: 8px;
  margin-bottom: 15px;
  font-size: 11px;
  text-align: left;
  border-left: 3px solid var(--gold);
}

.price-tag div {
  margin-bottom: 4px;
}

.file-upload {
  position: relative;
  display: block;
  margin-top: 10px;
}
input[type="file"] {
  display: none;
}

.custom-file-upload {
  display: block;
  border: 1px dashed var(--gold);
  padding: 12px;
  cursor: pointer;
  border-radius: 8px;
  color: var(--gold);
  font-size: 13px;
  background: rgba(212, 175, 55, 0.05);
}

.btn-confirm {
  width: 100%;
  padding: 12px;
  background: linear-gradient(135deg, #d4af37, #b8860b);
  border: none;
  border-radius: 25px;
  color: #000;
  font-size: 16px;
  font-weight: bold;
  margin-top: 15px;
  cursor: pointer;
  box-shadow: 0 4px 15px rgba(212, 175, 55, 0.3);
}

/* กล่องบัญชีธนาคาร */
.bank-details-box {
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid #333;
  border-radius: 10px;
  padding: 15px;
  margin: 15px 0;
  display: flex;
  align-items: center;
  gap: 15px;
  text-align: left;
}

.bank-icon img {
  width: 50px;
  height: 50px;
  border-radius: 10px;
}

.bank-info {
  flex: 1;
}

.bank-name {
  font-size: 12px;
  color: #aaa;
}

.ac-name {
  font-size: 13px;
  color: #eee;
  margin-bottom: 5px;
}

.ac-number-row {
  display: flex;
  align-items: center;
  gap: 10px;
  background: #000;
  padding: 5px 10px;
  border-radius: 5px;
  border: 1px solid var(--gold);
}

.ac-number {
  font-family: monospace;
  font-size: 16px;
  font-weight: bold;
  color: var(--gold);
  flex: 1;
  letter-spacing: 1px;
}

.btn-copy {
  background: var(--gold);
  border: none;
  color: #000;
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 11px;
  cursor: pointer;
  font-weight: bold;
}

.btn-copy:active {
  transform: scale(0.95);
  background: #fff;
}

.btn-howto {
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid var(--gold);
  color: var(--gold);
  padding: 8px 15px;
  border-radius: 20px;
  font-size: 13px;
  cursor: pointer;
  margin-top: 15px;
  transition: all 0.3s;
}

.btn-howto:hover {
  background: var(--gold);
  color: #000;
}

.howto-step {
  display: flex;
  align-items: center;
  gap: 15px;
  margin-bottom: 15px;
  background: rgba(255, 255, 255, 0.05);
  padding: 10px;
  border-radius: 8px;
}

.step-icon {
  background: var(--gold);
  color: #000;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  display: flex;
  justify-content: center;
  align-items: center;
  font-weight: bold;
  flex-shrink: 0;
}

.step-text {
  font-size: 13px;
  color: #ddd;
  line-height: 1.4;
}

.point-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 10px;
  font-size: 13px;
}

.point-table th {
  background: #333;
  color: var(--gold);
  padding: 10px;
  text-align: center;
}

.point-table td {
  border-bottom: 1px solid #333;
  padding: 10px;
  text-align: center;
  color: #eee;
}

.point-table .bonus {
  color: #2ecc71;
}

.point-table .total {
  color: var(--gold);
  font-weight: bold;
}

.highlight-row {
  background: rgba(212, 175, 55, 0.1);
}

.point-table th {
  background: #222;
  color: var(--gold);
  padding: 8px;
  font-size: 14px;
}
.point-table td {
  padding: 8px;
  border-bottom: 1px solid #333;
}
.bonus {
  color: #2ecc71;
  font-weight: bold;
}

.example-box {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.ex-item {
  background: rgba(255, 255, 255, 0.05);
  border-left: 3px solid #666;
  padding: 10px 15px;
  border-radius: 0 8px 8px 0;
  font-size: 13px;
}

.ex-title {
  display: flex;
  justify-content: space-between;
  margin-bottom: 5px;
  color: #eee;
}

.badge-tier {
  background: #444;
  color: #aaa;
  font-size: 10px;
  padding: 2px 6px;
  border-radius: 4px;
}
.badge-tier.crown {
  background: var(--gold);
  color: #000;
  font-weight: bold;
}

.ex-calc {
  color: #888;
  font-family: monospace;
  font-size: 12px;
}
.ex-calc .plus {
  color: #2ecc71;
}
.ex-calc .result {
  color: var(--gold);
  font-weight: bold;
  font-size: 14px;
  margin-left: 5px;
}

.ex-item:hover {
  background: rgba(255, 255, 255, 0.1);
  border-left-color: var(--gold);
}

.sponsor-container {
  margin-top: 30px;
  margin-left: -20px;
  margin-right: -20px;
  width: calc(100% + 40px);
  background: #000;
  padding: 15px 0;
  border-bottom: 1px solid #333;
  border-top: 1px solid #333;
  overflow: hidden;
  position: relative;
}

.sponsor-title {
  text-align: center;
  font-size: 10px;
  color: #666;
  text-transform: uppercase;
  letter-spacing: 2px;
  margin-bottom: 10px;
}

.slider {
  height: 60px; /* ปรับสูงขึ้นนิดนึงเผื่อรูปแนวตั้ง */
  margin: auto;
  position: relative;
  width: 100%;
  display: grid;
  place-items: center;
  overflow: hidden;
}

.slide-track {
  display: flex;
  /* ✅ แก้ตรงนี้: 150px * 50 รูป (25 รูป x 2 ชุด) */
  width: calc(150px * 50);
  /* ปรับเวลาเป็น 40s เพราะรูปเยอะขึ้น เดี๋ยววิ่งเร็วไปมองไม่ทัน */
  animation: scroll 40s linear infinite;
}

/* กล่องใส่โลโก้แต่ละอัน */
.slide {
  height: 50px;
  width: 150px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 15px;
}

.slide img {
  max-height: 50px; /* ปรับขนาดรูปให้เต็มกล่องมากขึ้น */
  max-width: 100%;
  opacity: 0.7;
  transition: all 0.3s;
  object-fit: contain; /* ป้องกันรูปเบี้ยว */
}

.slide img:hover {
  filter: none;
  opacity: 1;
  transform: scale(1.1);
}

@keyframes scroll {
  0% {
    transform: translateX(0);
  }
  100% {
    /* ✅ แก้ตรงนี้: ขยับไปทางซ้ายเท่ากับความยาวของ 1 ชุด (25 รูป) */
    transform: translateX(calc(-150px * 25));
  }
}

/* Vignette Effect */
.slider::before,
.slider::after {
  background: linear-gradient(
    to right,
    rgba(0, 0, 0, 1) 0%,
    rgba(0, 0, 0, 0) 100%
  );
  content: "";
  height: 100%;
  position: absolute;
  width: 50px;
  z-index: 2;
  pointer-events: none; /* เพิ่มเพื่อให้คลิกทะลุได้ */
}
.slider::before {
  left: 0;
  top: 0;
}
.slider::after {
  right: 0;
  top: 0;
  transform: rotateZ(180deg);
}

.terms-content {
  max-height: 300px;
  overflow-y: auto;
  padding-right: 10px;
  font-size: 13px;
  line-height: 1.6;
  color: #ddd;
}

.terms-content h3 {
  color: var(--gold);
  border-bottom: 1px solid #333;
  padding-bottom: 5px;
  margin-top: 20px;
  font-size: 15px;
}

.terms-content ul {
  padding-left: 20px;
  margin: 5px 0;
}

.terms-content li {
  margin-bottom: 8px;
}

.terms-content::-webkit-scrollbar {
  width: 4px;
}
.terms-content::-webkit-scrollbar-thumb {
  background: #444;
  border-radius: 4px;
}

.footer {
  text-align: center;
  padding: 30px 20px 30px 20px;
  background: #0a0a0a;
  border-top: 1px solid #222;
  margin-top: 30px;
  color: #666;
  font-size: 12px;
}

.footer-logo {
  color: var(--gold);
  font-family: "Playfair Display", serif;
  font-size: 16px;
  letter-spacing: 2px;
  margin-bottom: 10px;
  font-weight: bold;
}

.footer-links {
  margin-top: 15px;
}

.footer-links a {
  color: #888;
  text-decoration: none;
  margin: 0 5px;
  transition: 0.3s;
}

.footer-links a:hover {
  color: var(--gold);
}

.footer-links i {
  font-size: 14px;
  margin-right: 3px;
}

/* =========================================
   🏆 SCOREBOARD STYLES (แก้ใหม่)
   ========================================= */

.scoreboard-container {
  max-width: 600px;
  margin: 0 auto;
  padding: 20px;
  padding-bottom: 60px;
}

.btn-back {
  display: inline-block;
  padding: 10px 25px;
  border: 1px solid #d4af37;
  color: #d4af37;
  text-decoration: none;
  border-radius: 30px;
  transition: 0.3s;
}
.btn-back:hover {
  background: #d4af37;
  color: #000;
}

/* --- 🥇 PODIUM AREA (Top 3 Styles) --- */
.podium-area {
  display: flex;
  flex-direction: row;
  justify-content: center;
  align-items: flex-end;
  margin-top: -35px;
  margin-bottom: 30px;
  gap: 15px; /* ระยะห่างระหว่างคน */
}

.podium-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  position: relative;
  width: 30%;
  transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.podium-item:hover {
  transform: translateY(-10px);
  z-index: 50;
}

/* --- 🖼️ กรอบรูปทรงซุ้มประตู (ไฮไลท์ของงานนี้) --- */
.photo-frame {
  position: relative;
  margin-bottom: -20px; /* วางทับลงไปในกล่องคะแนน */
  z-index: 5;
  padding: 3px;
  background: #fff;
  /* สูตรทำขอบโค้งด้านบน (ซุ้มประตู) */
  border-radius: 100px 100px 10px 10px;
  box-shadow: 0 10px 20px rgba(0, 0, 0, 0.5);
}

/* ตัวรูปภาพ */
.contestant-img {
  width: 100%;
  height: 100%;
  object-fit: cover; /* บังคับรูปให้เต็มกรอบ */
  border-radius: 95px 95px 8px 8px; /* ล้อไปกับกรอบนอก */
  display: block;
  background: #000;
}

/* 🏷️ ป้ายตัวเลขบอกอันดับ */
.rank-badge {
  position: absolute;
  bottom: -12px;
  left: 50%;
  transform: translateX(-50%);
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
  font-size: 14px;
  border: 2px solid #fff;
  z-index: 10;
  color: #fff;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.3);
}

/* --- การปรับแต่งแต่ละลำดับ --- */

/* 🥇 ที่ 1 */
.podium-rank-1 {
  order: 2;
  z-index: 10;
}
.podium-rank-1 .photo-frame {
  width: 120px;
  height: 170px; /* รูปแนวตั้ง */
  background: linear-gradient(45deg, #ffd700, #fdb931);
  box-shadow: 0 0 25px rgba(255, 215, 0, 0.6);
}
.podium-rank-1 .rank-badge {
  background: #d4af37;
}
.podium-rank-1 .score-box {
  height: 130px;
  border-top: 3px solid #d4af37;
  background: linear-gradient(to top, #111, #2a2a2a);
}

/* 🥈 ที่ 2 */
.podium-rank-2 {
  order: 1;
}
.podium-rank-2 .photo-frame {
  width: 100px;
  height: 140px;
  background: linear-gradient(45deg, #e0e0e0, #bdbdbd);
}
.podium-rank-2 .rank-badge {
  background: #a9a9a9;
}
.podium-rank-2 .score-box {
  height: 100px;
  border-top: 3px solid #a9a9a9;
}

/* 🥉 ที่ 3 */
.podium-rank-3 {
  order: 3;
}
.podium-rank-3 .photo-frame {
  width: 100px;
  height: 140px;
  background: linear-gradient(45deg, #cd7f32, #8b4513);
}
.podium-rank-3 .rank-badge {
  background: #cd7f32;
}
.podium-rank-3 .score-box {
  height: 90px;
  border-top: 3px solid #cd7f32;
}

/* --- ส่วนประกอบอื่นๆ --- */
.crown-icon {
  font-size: 28px;
  color: #ffd700;
  margin-bottom: 5px;
  animation: float 2s infinite ease-in-out;
  filter: drop-shadow(0 0 5px rgba(255, 215, 0, 0.8));
}

.score-box {
  width: 100%;
  border-radius: 15px 15px 0 0;
  padding: 35px 2px 10px 2px; /* เว้นด้านบนเยอะหน่อยให้รูปทับ */
  color: #fff;
  background: linear-gradient(to top, #000, #222);
  border: 1px solid #333;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  text-align: center;
}

.contestant-name {
  font-size: 12px;
  color: #ccc;
  margin-bottom: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  padding: 0 5px;
}

.score-val {
  font-size: 16px;
  font-weight: bold;
  color: #d4af37;
}

/* --- 📋 LIST AREA (4-Last) --- */
.list-area {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.list-item {
  display: flex;
  align-items: center;
  background: rgba(255, 255, 255, 0.05);
  padding: 8px 15px;
  border-radius: 50px;
  border: 1px solid #222;
}
.list-rank {
  width: 25px;
  font-weight: bold;
  color: #666;
  text-align: center;
}
.list-img {
  width: 35px;
  height: 35px;
  border-radius: 50%;
  object-fit: cover;
  margin: 0 10px;
  border: 1px solid #444;
}
.list-info {
  flex: 1;
}
.list-name {
  font-size: 13px;
  color: #eee;
}
.list-score {
  color: #d4af37;
  font-weight: bold;
  font-size: 13px;
}

@keyframes float {
  0%,
  100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-5px);
  }
}
