/* Base styles for SB_Star_MatchTest */
:root {
  --bg: #0b0f1a;
  --fg: #f2f5f9;
  --muted: #9aa6b2;
  --accent: #7aa2ff;
}

html, body {
  height: 100%;
}

body {
  margin: 0;
  font-family: "Pretendard", system-ui, -apple-system, Segoe UI, Roboto, Noto Sans, Ubuntu, Cantarell, Helvetica Neue, Arial, "Apple SD Gothic Neo", "Malgun Gothic", sans-serif;
  background: var(--bg);
  color: var(--fg);
}

/* Quiz pages background */
body.quiz-mode {
  background: var(--bg);
}

#app {
  min-height: 100vh;
  display: grid;
  place-items: center;
}

.container {
  width: min(420px, 94vw);
}

.hidden { display: none; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 12px 18px;
  border-radius: 10px;
  background: var(--accent);
  color: #0b0f1a;
  font-weight: 700;
  border: none;
  cursor: pointer;
}

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

/* Start screen layout */
.topbar {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 12px;
  margin: 16px 0 8px 0;
  width: 100%;
}

.topbar .left,
.topbar .center,
.topbar .right { display: flex; align-items: center; }
.topbar .left { justify-content: flex-start; }
.topbar .center { justify-content: center; }
.topbar .right { justify-content: flex-end; gap: 8px; }

/* Hide language selector when not on start screen */
.worldcup-screen ~ * .topbar .right label,
.worldcup-result-screen ~ * .topbar .right label,
body:has(.worldcup-screen) .topbar .right label,
body:has(.worldcup-result-screen) .topbar .right label {
  display: none;
}

/* Alternative: hide language selector when start-screen is hidden */
.start-screen[style*="display: none"] ~ * .topbar .right label,
.start-screen[style*="display:none"] ~ * .topbar .right label {
  display: none;
}

.logo {
  height: 30px;
  object-fit: contain;
}
.logo.product { height: 36px; }

.start-screen {
  position: relative;
  width: 100%;
  min-height: calc(100vh - 90px);
  overflow: hidden;
  border-radius: 16px;
}

.start-bg {
  position: absolute;
  inset: 0;
  background: url('../assets/bg.jpg') center / cover no-repeat;
  filter: none;
  transform: none;
}

.start-overlay {
  position: absolute;
  inset: 0;
  display: block;
  /* remove dark gradient overlay on main */
  background: none;
  pointer-events: none;
}

/* Quiz screen background inside container */
.quiz-bg {
  position: absolute;
  inset: 0;
  background: url('../assets/bg-quiz.jpg') center / cover no-repeat;
  z-index: 0;
}

/* Use different background on results */
.quiz-complete .quiz-bg {
  background-image: url('../assets/bg-result1.jpg');
}

/* Ensure quiz content sits above background */
.quiz-screen > *:not(.quiz-bg),
.quiz-complete > *:not(.quiz-bg) {
  position: relative;
  z-index: 1;
}

.hero {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 32px 16px 48px;
  min-height: min(720px, 72vh);
}

.hero img.hero-img {
  position: absolute;
  top: 70%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: min(900px, 100vw);
  height: auto;
  z-index: 0;
  pointer-events: none;
  user-select: none;
  image-rendering: -webkit-optimize-contrast;
}

.hero h2,
.hero .cta {
  position: relative;
  z-index: 1;
  text-align: center;
}

.hero .vote-deadline{
  margin: 4px 0 0 0;
  font-size: 12px;
  color: var(--muted);
}

.hero .cta {
  margin-top: 16px;
  width: 100%;
  display: flex;
  justify-content: center;
}

.hero h2 {
  margin-top: 260px;
  text-shadow: 0 2px 12px rgba(0,0,0,0.9), 0 0 32px rgba(0,0,0,0.8);
}

/* Start button emphasis */
#startBtn {
  background: #ffea00;
  color: #0b0f1a;
  font-size: 18px;
  padding: 16px 28px;
  border-radius: 12px;
  box-shadow: 0 6px 18px rgba(0,0,0,0.25);
  width: 82%;
}

#startBtn:hover {
  filter: brightness(0.97);
}

/* Results: style restart button like start button */
.quiz-complete #restartBtn {
  background: #ffea00;
  color: #0b0f1a;
  font-size: 18px;
  padding: 16px 28px;
  border-radius: 12px;
  box-shadow: 0 6px 18px rgba(0,0,0,0.25);
  width: 100%;
  white-space: nowrap;
}
.quiz-complete #restartBtn:hover { filter: brightness(0.97); }

/* Results: preorder button (KR only) same width/centered below restart */
.quiz-complete .preorder-btn {
  background: #e53935;
  border: 1px solid #c62828;
  color: #fff;
  font-size: 18px;
  padding: 16px 28px;
  border-radius: 12px;
  box-shadow: 0 6px 18px rgba(0,0,0,0.25);
  width: 100%;
  box-sizing: border-box;
  display: flex;
  justify-content: center;
  text-decoration: none;
  margin-top: 10px;
}
.quiz-complete .cta .btn + .preorder-btn,
.quiz-complete .preorder-btn + .btn {
  margin-top: 12px;
}
.quiz-complete .preorder-btn:hover { filter: brightness(0.98); }

.home-meta { margin-top: 0px; display: grid; gap: 8px; justify-items: center; position: relative; z-index: 1; }
.home-meta .participants {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  background: rgba(11, 15, 26, 0.22);
  border: 1px solid #2a3347;
  border-radius: 999px;
  backdrop-filter: blur(6px);
}
.home-meta .participants strong { color: var(--fg); }
#loadStatus:empty { margin-top: 0 !important; }
.home-meta .participants { margin-top: 4px; }
.home-share {
  color: #ffffff;
  background: rgba(11, 15, 26, 0.22);
  border: 1px solid #2a3347;
  border-radius: 999px;
  backdrop-filter: blur(6px);
  padding: 6px 10px;
  margin-top: 12px;
}
.home-share .btn.share { background: transparent; color: var(--fg); padding: 0; border: 0; box-shadow: none; border-radius: 0; text-decoration: underline; }
.home-share .btn[disabled] { opacity: 0.6; cursor: default; text-decoration: none; }

@media (max-width: 640px) {
  .logo { height: 24px; }
  .logo.product { height: 28px; }
  .start-screen { border-radius: 10px; }
  .hero img.hero-img { top: 58%; left: 52%; }
  .quiz-screen, .quiz-complete { border-radius: 10px; }
}

/* Mobile-first refinements */
@media (max-width: 480px) {
  .topbar { grid-template-columns: auto 1fr auto; margin: 12px 0 6px 0; }
  .container { width: 94vw; }
  .hero { padding: 24px 8px 40px; min-height: min(640px, 74vh); }
  .hero h2 { margin-top: 260px; font-size: 20px; }
  #startBtn { width: 82%; padding: 14px 18px; font-size: 16px; }
  .home-meta { gap: 6px; }
  .home-share { gap: 8px; }
  .quiz-screen, .quiz-complete { padding: 16px 6px 40px; }
  .quiz-question { font-size: 18px; }
  .quiz-scenario { font-size: 14px; }
  .quiz-options { gap: 8px; width: 96%; }
  .quiz-options .btn { padding: 14px 12px; font-size: 15px; }
  .share-row { gap: 8px; }
  .share-buttons .btn.share, .home-share .btn.share { width: 40px; height: 40px; }
  .site-footer { bottom: calc(10px + env(safe-area-inset-bottom)); }
}

/* Quiz UI */
.quiz-screen, .quiz-complete {
  position: relative;
  width: 100%;
  min-height: calc(100vh - 90px);
  padding: 24px 8px 48px;
  overflow: hidden;
  border-radius: 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}
.quiz-progress {
  color: var(--muted);
  margin-bottom: 12px;
}
.quiz-question {
  margin: 8px 0 16px;
  text-align: center;
  color: #ffffff;
}
.quiz-scenario {
  margin: 0 0 16px;
  color: #ffffff;
  white-space: pre-line;
  text-align: center;
}
.quiz-options {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  width: 96%;
  margin: 0 auto;
}
.quiz-options .btn {
  background: #1f2a44;
  color: var(--fg);
}

.results-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
  margin-top: 16px;
}
.card {
  background: #111827;
  border: 1px solid #2a3347;
  border-radius: 12px;
  overflow: hidden;
}
.card-img { width: 100%; height: auto; display: block; }
.card-body { padding: 12px; }
.card-title { margin: 0 0 6px 0; }
.card-text { margin: 0; color: var(--muted); }

.share-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 16px;
  color: #ffffff;
  background: rgba(11, 15, 26, 0.22);
  border: 1px solid #2a3347;
  border-radius: 999px;
  backdrop-filter: blur(6px);
  padding: 6px 10px;
}
.share-buttons { display: flex; gap: 8px; }
.btn.share { background: #293957; color: var(--fg); }

/* Image-like circular share buttons (home + results) */
.home-share .btn.share,
.share-buttons .btn.share {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  padding: 0;
  border: none;
  box-shadow: 0 4px 12px rgba(0,0,0,0.25);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  position: relative;
  vertical-align: middle;
  line-height: 0; /* prevent baseline wobble */
}

/* Hide textual label while keeping accessible name from data-i18n */
.home-share .btn.share { color: transparent; font-size: 0; }
.share-buttons .btn.share { color: transparent; font-size: 0; }

/* center pseudo icons precisely */
.home-share .btn.share::after,
.share-buttons .btn.share::after { content: none; }

/* Image icons inside buttons (home buttons use inline <img>) */
.btn.share .share-icon {
  width: 31px;
  height: 31px;
  display: block;
  object-fit: contain;
}

/* Kakao */
#shareKakao { background: #FEE500; }
.share-buttons .btn.share[data-share="kakao"] {
  background: #FEE500 url('../assets/logo_kakaotalk.jpg') center / 31px 31px no-repeat;
}

/* X (Twitter) */
#shareTwitter { background: #000; }
.share-buttons .btn.share[data-share="twitter"] {
  background: #000 url('../assets/logo_x.jpg') center / 31px 31px no-repeat;
}

/* LINE */
#shareLine { background: #06C755; }
.share-buttons .btn.share[data-share="line"] {
  background: #06C755 url('../assets/logo_line.jpeg') center / 31px 31px no-repeat;
}

/* Link */
#shareLink { background: #80838a; }
#shareLink::after {
  content: '';
  width: 18px;
  height: 18px;
  background: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='18' height='18' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><path d='M10 13a5 5 0 0 0 7.07 0l2.83-2.83a5 5 0 0 0-7.07-7.07L10 5'/><path d='M14 11a5 5 0 0 0-7.07 0L4.1 13.83a5 5 0 0 0 7.07 7.07L14 19'/></svg>") no-repeat center / contain;
}
#shareLink.copied { background: #2e7d32; }
#shareLink.copied::after { content: '✓'; color: #fff; font-size: 18px; }

/* ensure container aligns buttons evenly */
.home-share { display: flex; align-items: center; gap: 10px; }

/* Footer */
.site-footer {
  position: static;
  display: flex;
  justify-content: center;
  margin: 16px 0;
}
.footer-inner {
  display: flex;
  align-items: center;
  gap: 8px;
  background: transparent;
  border: none;
  backdrop-filter: none;
  padding: 0;
  border-radius: 0;
  pointer-events: auto;
}
.footer-logo { height: 18px; }
.footer-text, .footer-copy { color: var(--muted); font-size: 12px; }
.footer-link { color: #9ac7ff; font-size: 12px; text-decoration: underline; }
.footer-link:hover { text-decoration: underline; }
.sep { color: #2f3b52; }

/* YouTube videos section */
.youtube-section {
  margin: 16px auto;
  max-width: 520px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.youtube-video {
  width: 100%;
}

.youtube-video-title {
  margin: 0 0 8px 0;
  font-size: 16px;
  font-weight: 600;
  color: var(--fg);
  text-align: left;
}

.youtube-video-wrapper {
  position: relative;
  padding-bottom: 56.25%; /* 16:9 aspect ratio */
  height: 0;
  overflow: hidden;
  border-radius: 8px;
  background: #000;
}

.youtube-video-wrapper iframe {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border-radius: 8px;
}

@media (max-width: 640px) {
  .youtube-section {
    max-width: 100%;
    gap: 12px;
  }
  
  .youtube-video-title {
    font-size: 14px;
  }
}

/* Language-specific share button visibility */
/* Japanese: hide KakaoTalk */
body[data-lang="ja"] #shareKakao,
body[data-lang="ja"] .btn.share[data-share="kakao"] {
  display: none !important;
}

/* English/Global: hide KakaoTalk and LINE */
body[data-lang="en"] #shareKakao,
body[data-lang="en"] #shareLine,
body[data-lang="en"] .btn.share[data-share="kakao"],
body[data-lang="en"] .btn.share[data-share="line"] {
  display: none !important;
}


/* ========================================
   투표 시스템 스타일 (2025-10-24 추가)
   ======================================== */

/* 투표 홈 화면 */
.voting-home {
  position: relative;
  width: 100%;
  min-height: calc(100vh - 90px);
  overflow: hidden;
  border-radius: 16px;
}

.voting-home .subtitle {
  font-size: 16px;
  color: var(--muted);
  text-align: center;
  margin: 12px 0;
  position: relative;
  z-index: 1;
  text-shadow: 0 2px 8px rgba(0,0,0,0.7);
}

.voting-info {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 24px auto;
  padding: 16px;
  background: rgba(11, 15, 26, 0.6);
  border: 1px solid #2a3347;
  border-radius: 12px;
  backdrop-filter: blur(6px);
  max-width: 320px;
  position: relative;
  z-index: 1;
}

.voting-info .info-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  color: var(--fg);
}

.voting-info .info-item span:first-child {
  font-size: 20px;
}

.voting-info .info-item strong {
  color: var(--accent);
  font-weight: 700;
}

.hero .cta {
  margin-top: 16px;
  width: 82%;
  display: flex;
  flex-direction: column;
  gap: 12px;
  justify-content: center;
  align-items: center;
  position: relative;
  z-index: 1;
}

.btn.secondary {
  background: rgba(255, 255, 255, 0.1);
  color: var(--fg);
  border: 1px solid rgba(255, 255, 255, 0.2);
  width: 100%;
  padding: 16px 28px; /* align horizontal spacing with #startBtn */
  border-radius: 12px; /* match start button radius */
}

/* Start screen secondary buttons smaller and higher */
.start-screen .btn.secondary {
  padding: 14px 24px;
  width: 82%;
  font-size: 16px;
}

.btn.secondary:hover {
  background: rgba(255, 255, 255, 0.15);
}

#startVotingBtn {
  background: #ffea00;
  color: #0b0f1a;
  font-size: 18px;
  padding: 16px 28px;
  border-radius: 12px;
  box-shadow: 0 6px 18px rgba(0,0,0,0.25);
  width: 100%;
}

#startVotingBtn:hover {
  filter: brightness(0.97);
}

/* 캐릭터 갤러리 */
.character-gallery {
  min-height: 100vh;
  padding: 24px 16px 80px;
  background: var(--bg);
}

.gallery-header {
  max-width: 1200px;
  margin: 0 auto 32px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.gallery-header h2 {
  font-size: 28px;
  text-align: center;
  margin: 0;
  color: var(--fg);
}

.filter-controls {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 12px;
  align-items: center;
}

.search-input {
  width: 100%;
  padding: 12px 16px;
  border-radius: 8px;
  border: 1px solid #2a3347;
  background: rgba(255, 255, 255, 0.05);
  color: var(--fg);
  font-size: 16px;
  font-family: inherit;
}

.search-input::placeholder {
  color: var(--muted);
}

.search-input:focus {
  outline: none;
  border-color: var(--accent);
  background: rgba(255, 255, 255, 0.08);
}

.sort-select {
  padding: 12px 16px;
  border-radius: 8px;
  border: 1px solid #2a3347;
  background: rgba(255, 255, 255, 0.05);
  color: var(--fg);
  font-size: 16px;
  font-family: inherit;
  cursor: pointer;
  min-width: 120px;
}

.sort-select:focus {
  outline: none;
  border-color: var(--accent);
}

/* 캐릭터 그리드 */
.character-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 24px;
  max-width: 1200px;
  margin: 0 auto;
}

.character-card {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  overflow: hidden;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  display: flex;
  flex-direction: column;
}

.character-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
}

.character-card.voted {
  border-color: var(--accent);
  box-shadow: 0 0 20px rgba(122, 162, 255, 0.3);
}

.character-image {
  width: 100%;
  height: 320px;
  object-fit: cover;
  display: block;
}

.character-body {
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: 1;
}

.character-name {
  font-size: 20px;
  font-weight: 700;
  margin: 0;
  color: var(--fg);
}

.character-desc {
  font-size: 14px;
  color: var(--muted);
  margin: 0;
  line-height: 1.5;
  flex: 1;
  display: -webkit-box;
  line-clamp: 2;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.vote-stats {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 16px;
  margin-top: 8px;
}

.vote-count {
  color: var(--accent);
  font-weight: 700;
}

.vote-label {
  color: var(--muted);
  font-size: 14px;
}

.vote-progress {
  height: 8px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 4px;
  overflow: hidden;
  margin: 8px 0;
}

.vote-progress-bar {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), #56ccf2);
  transition: width 0.5s ease;
  border-radius: 4px;
}

.vote-btn {
  width: 100%;
  margin-top: 8px;
}

.vote-btn:disabled {
  background: #555;
  cursor: not-allowed;
  opacity: 0.6;
}

/* 무한 스크롤 트리거 */
.load-more-trigger {
  text-align: center;
  padding: 40px 20px;
  color: var(--muted);
  font-size: 14px;
}

/* 순위 화면 */
.rankings-section {
  min-height: 100vh;
  padding: 24px 16px 80px;
  background: var(--bg);
}

.rankings-header {
  max-width: 800px;
  margin: 0 auto 32px;
  text-align: center;
}

.rankings-header h2 {
  font-size: 32px;
  margin: 0 0 8px;
  color: var(--fg);
}

.rankings-period {
  color: var(--muted);
  font-size: 16px;
  margin: 8px 0 16px;
}

.rankings-list {
  max-width: 800px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.ranking-item {
  display: grid;
  grid-template-columns: 60px 60px 1fr;
  grid-template-rows: auto auto;
  align-items: center;
  gap: 16px;
  padding: 16px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  transition: transform 0.2s ease;
}

.ranking-item:hover {
  transform: translateX(4px);
}

.ranking-item.top-3 {
  background: linear-gradient(135deg, rgba(255, 215, 0, 0.1), rgba(255, 140, 0, 0.1));
  border-color: rgba(255, 215, 0, 0.3);
}

.rank-number {
  font-size: 28px;
  font-weight: 700;
  text-align: center;
  color: var(--fg);
  grid-row: 1 / 3;
}

.character-avatar {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid rgba(255, 255, 255, 0.2);
  grid-row: 1 / 3;
}

.character-info {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.character-info .character-name {
  font-size: 18px;
  font-weight: 700;
  color: var(--fg);
}

.vote-info {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 14px;
}

.vote-info .vote-count {
  color: var(--accent);
  font-weight: 700;
}

.vote-info .vote-percentage {
  color: var(--muted);
}

.vote-bar-container {
  grid-column: 2 / -1;
  height: 8px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 4px;
  overflow: hidden;
}

.vote-bar {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), #56ccf2);
  transition: width 0.5s ease;
  border-radius: 4px;
}

/* 내 투표 섹션 */
.my-vote-section {
  max-width: 800px;
  margin: 32px auto 0;
  padding: 24px;
  background: rgba(122, 162, 255, 0.1);
  border: 2px solid var(--accent);
  border-radius: 12px;
}

.my-vote-section h3 {
  font-size: 20px;
  margin: 0 0 16px;
  text-align: center;
  color: var(--fg);
}

.my-vote-card {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 8px;
}

.my-vote-card img {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  object-fit: cover;
}

.my-vote-info {
  flex: 1;
}

.my-vote-name {
  font-size: 22px;
  font-weight: 700;
  margin-bottom: 4px;
  color: var(--fg);
}

.my-vote-rank {
  font-size: 18px;
  color: var(--accent);
}

/* 공유 섹션 */
.share-section {
  max-width: 800px;
  margin: 32px auto 0;
  text-align: center;
}

.share-section p {
  margin: 0 0 16px;
  color: var(--muted);
}

.share-section .share-buttons {
  display: flex;
  justify-content: center;
  gap: 12px;
}

/* 모바일 최적화 */
@media (max-width: 768px) {
  .character-grid {
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 16px;
  }

  .character-image {
    height: 280px;
  }

  .gallery-header h2 {
    font-size: 24px;
  }

  .filter-controls {
    grid-template-columns: 1fr;
  }

  .ranking-item {
    grid-template-columns: 50px 50px 1fr;
    gap: 12px;
    padding: 12px;
  }

  .rank-number {
    font-size: 24px;
  }

  .character-avatar {
    width: 50px;
    height: 50px;
  }

  .character-info .character-name {
    font-size: 16px;
  }

  .vote-info {
    font-size: 12px;
  }

  .my-vote-card {
    flex-direction: column;
    text-align: center;
  }

  .voting-info {
    font-size: 13px;
  }
}

@media (max-width: 480px) {
  .character-grid {
    grid-template-columns: 1fr;
    gap: 16px;
  }

  .character-image {
    height: 320px;
  }

  .hero .cta {
    width: 100%;
  }

  .ranking-item {
    grid-template-columns: 40px 40px 1fr;
    gap: 8px;
    padding: 12px;
  }

  .vote-bar-container {
    grid-column: 1 / -1;
    margin-top: 8px;
  }

  .rankings-header h2 {
    font-size: 26px;
  }
}

/* ===== 월드컵 토너먼트 스타일 ===== */

.worldcup-container {
  position: relative;
  width: 100%;
  min-height: calc(100vh - 90px);
  display: flex;
  flex-direction: column;
  background: linear-gradient(180deg, #0b0f1a 0%, #1a1f2e 100%);
  border-radius: 16px;
  overflow: hidden;
}

/* 결과 화면용 스타일 */
.worldcup-result-screen {
  padding: 24px 8px 48px;
  justify-content: center;
}

.worldcup-header {
  padding: 20px;
  text-align: center;
  background: rgba(255, 255, 255, 0.05);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.worldcup-round {
  font-size: 24px;
  font-weight: 700;
  color: #FFD700;
  margin: 0 0 8px;
}

.worldcup-match-info {
  font-size: 14px;
  color: var(--muted);
  margin: 0 0 12px;
}

.worldcup-progress {
  max-width: 300px;
  margin: 0 auto;
}

.worldcup-progress-bar {
  height: 6px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 3px;
  overflow: hidden;
}

.worldcup-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), #a5c4ff);
  transition: width 0.3s ease;
}

.worldcup-progress-text {
  font-size: 12px;
  color: var(--muted);
  margin-top: 4px;
}

/* 대결 화면 */
.worldcup-battle {
  flex: 1;
  display: grid;
  grid-template-columns: 1fr 30px 1fr;
  gap: 0;
  padding: 8px 0; /* add small vertical padding */
  align-items: stretch;
  min-height: 460px; /* slightly shorter to improve aspect */
}

.worldcup-character {
  position: relative;
  cursor: pointer;
  overflow: hidden;
  transition: transform 0.2s ease, filter 0.2s ease;
  display: flex;
  flex-direction: column;
  justify-content: flex-start; /* align from top */
  background: none; /* show illustration by default */
}

.worldcup-character .worldcup-figure {
  position: relative;
  width: 100%;
  flex: 0 0 auto; /* fixed size, no grow/shrink */
  overflow: hidden;
  margin-bottom: 0; /* no gap */
  padding-bottom: 0; /* no gap */
  display: flex;
  align-items: flex-start;
}

.worldcup-character:hover {
  transform: scale(1.02);
  /* remove whitening effect */
}

.worldcup-character:active {
  transform: scale(0.98);
}

.worldcup-character-image {
  position: relative;
  inset: auto;
  width: 100%;
  max-height: clamp(360px, 48vh, 540px); /* limit max height instead of fixed */
  height: auto; /* auto height to fit content */
  display: block;
  object-fit: contain;
  object-position: center top;
  background: #0b0f1a;
  z-index: 0;
  transform: translateX(var(--img-offset-x, 0px)) translateY(var(--img-offset-y, 0px)) scale(var(--img-scale, 1));
  transform-origin: center top;
}

.worldcup-character-info {
  position: static;
  padding: 0 12px 12px; /* no top padding */
  background: transparent;
  text-align: center;
  z-index: 1;
  box-sizing: border-box;
  margin-top: 0; /* directly below image */
  flex: 0 0 auto; /* fixed size, no grow/shrink */
}

.worldcup-character-name {
  font-size: 22px;
  font-weight: 700;
  color: var(--fg);
  margin: 0 0 4px; /* tight spacing */
  padding-top: 0; /* no top padding */
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.8);
}

.worldcup-character-desc {
  font-size: 14px;
  color: #e6ebf5;
  line-height: 1.6;
  margin: 0;
  display: block;
  overflow: visible;
  text-shadow: none;
}

/* VS 구분선 */
.worldcup-vs {
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(180deg, rgba(122, 162, 255, 0.1), rgba(122, 162, 255, 0.2));
  position: relative;
  z-index: 2;
}

.worldcup-vs-text {
  font-size: 32px;
  font-weight: 900;
  color: var(--accent);
  text-shadow: 0 0 20px rgba(122, 162, 255, 0.8);
  writing-mode: vertical-rl;
  letter-spacing: 8px;
}

/* 결과 화면 */
.worldcup-results {
  width: 100%;
  max-width: 100%;
  margin: 0 auto;
}

.worldcup-results-header {
  text-align: center;
  margin-bottom: 32px;
}

.worldcup-results-header h2 {
  font-size: 28px;
  font-weight: 700;
  color: var(--fg);
  margin: 0 0 12px;
}

.worldcup-results-header p {
  font-size: 14px;
  color: var(--muted);
  margin: 0;
}

.worldcup-ranking-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-bottom: 32px;
}

.worldcup-ranking-item {
  display: grid;
  grid-template-columns: 60px 80px 1fr;
  gap: 16px;
  align-items: center;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 12px;
  padding: 16px;
  transition: transform 0.2s ease, background 0.2s ease;
}

.worldcup-ranking-item:hover {
  background: rgba(255, 255, 255, 0.08);
  transform: translateY(-2px);
}

.worldcup-ranking-item.rank-1 {
  background: linear-gradient(135deg, rgba(255, 215, 0, 0.2), rgba(255, 215, 0, 0.05));
  border: 2px solid rgba(255, 215, 0, 0.5);
}

.worldcup-ranking-item.rank-2 {
  background: linear-gradient(135deg, rgba(192, 192, 192, 0.2), rgba(192, 192, 192, 0.05));
  border: 2px solid rgba(192, 192, 192, 0.5);
}

.worldcup-ranking-item.rank-3 {
  background: linear-gradient(135deg, rgba(205, 127, 50, 0.2), rgba(205, 127, 50, 0.05));
  border: 2px solid rgba(205, 127, 50, 0.5);
}

.worldcup-rank-badge {
  font-size: 36px;
  font-weight: 900;
  text-align: center;
  color: var(--accent);
}

.worldcup-rank-badge.rank-1 { color: #FFD700; }
.worldcup-rank-badge.rank-2 { color: #C0C0C0; }
.worldcup-rank-badge.rank-3 { color: #CD7F32; }

.worldcup-ranking-image {
  width: 80px;
  height: 80px;
  border-radius: 8px;
  object-fit: cover;
}

.worldcup-ranking-info {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.worldcup-ranking-name {
  font-size: 18px;
  font-weight: 700;
  color: var(--fg);
}

.worldcup-ranking-points {
  font-size: 14px;
  color: var(--muted);
}

.worldcup-ranking-points .points {
  color: var(--accent);
  font-weight: 700;
}

.worldcup-actions {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 24px;
}

.worldcup-actions .btn {
  width: 100%;
}

/* 모바일 최적화 */
@media (max-width: 768px) {
  .worldcup-container {
    border-radius: 10px;
  }

  .worldcup-battle {
    grid-template-columns: 1fr 24px 1fr; /* keep side-by-side on mobile */
    grid-template-rows: unset;
    gap: 0;
    min-height: 420px;
    padding: 6px 0;
  }

  .worldcup-character .worldcup-figure {
    flex: 0 0 auto;
    margin-bottom: 0;
    padding-bottom: 0;
    display: flex;
    align-items: flex-start;
  }

  .worldcup-character-image {
    max-height: clamp(300px, 46vh, 420px);
    height: auto;
  }

  .worldcup-vs {
    height: 30px;
  }

  .worldcup-vs-text {
    writing-mode: horizontal-tb;
    letter-spacing: 12px;
  }

  .worldcup-character-name {
    font-size: 20px;
  }

  .worldcup-character-desc {
    font-size: 13.5px;
    line-clamp: 4;
    -webkit-line-clamp: 4;
    color: #eef3ff;
  }

  .worldcup-ranking-item {
    grid-template-columns: 50px 60px 1fr;
    gap: 12px;
    padding: 12px;
  }

  .worldcup-rank-badge {
    font-size: 28px;
  }

  .worldcup-ranking-image {
    width: 60px;
    height: 60px;
  }

  .worldcup-ranking-name {
    font-size: 16px;
  }

  .worldcup-ranking-points {
    font-size: 12px;
  }

  .worldcup-result-screen {
    padding: 16px 6px 40px;
  }
}

@media (max-width: 480px) {
  .worldcup-round {
    font-size: 20px;
  }

  .worldcup-battle {
    min-height: 320px;
    padding: 6px 0;
  }

  .worldcup-character .worldcup-figure {
    flex: 0 0 auto;
    margin-bottom: 0;
    padding-bottom: 0;
    display: flex;
    align-items: flex-start;
  }

  .worldcup-character-image {
    max-height: clamp(280px, 44vh, 380px);
    height: auto;
  }

  .worldcup-character-info {
    padding: 0 10px calc(16px + env(safe-area-inset-bottom)); /* no top padding */
  }

  .worldcup-character-name {
    font-size: 18px;
    margin: 0 0 4px;
    padding-top: 0;
  }

  .worldcup-character-desc {
    font-size: 13px;
    line-clamp: 4;
    -webkit-line-clamp: 4;
    color: #eef3ff;
  }

  .worldcup-ranking-item {
    grid-template-columns: 40px 50px 1fr;
    gap: 8px;
    padding: 10px;
  }

  .worldcup-rank-badge {
    font-size: 24px;
  }

  .worldcup-ranking-image {
    width: 50px;
    height: 50px;
  }

  .worldcup-result-screen {
    padding: 16px 6px 40px;
  }
}