/* 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; }

.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;
  /* soft gradient only for readability */
  background: linear-gradient(to bottom, rgba(0,0,0,0.55) 0%, rgba(0,0,0,0.35) 25%, rgba(0,0,0,0) 55%);
  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(840px, 90vw);
  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 .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.6);
  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.15);
  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.15);
  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;
}


