body {
  background: radial-gradient(ellipse at 20% 10%, #2a1b3a 0%, transparent 20%),
    radial-gradient(ellipse at 80% 90%, #2a1b3a 0%, transparent 18%),
    linear-gradient(180deg, #0b0b10 0%, #121018 60%, #1a1422 100%);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
  margin: 0;
  font-family: Arial, sans-serif;
  color: #fff;
}

#loginSection,
#gameSection {
  width: 100%;
  max-width: 1200px;
}

#loginSection {
  display: block;
  padding: 20px;
}

#gameSection {
  display: none;
  flex-direction: column;
  padding: 50px 20px 20px;
}

.login-card {
  background: linear-gradient(
    180deg,
    rgba(255, 255, 255, 0.02),
    rgba(255, 255, 255, 0.03)
  );
  padding: 28px 26px;
  border-radius: 16px;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.45),
    inset 0 1px 0 rgba(255, 255, 255, 0.02);
  width: 360px;
  text-align: center;
  margin: 0 auto;
  backdrop-filter: blur(6px);
  position: relative;
}

.login-card input {
  width: 100%;
  margin-bottom: 12px;
  padding: 10px 12px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.03);
  color: #fff;
  transition: box-shadow 180ms ease, transform 120ms ease,
    border-color 120ms ease;
}

.login-card input#userPw {
  color: #000;
}

.login-card .login-btn {
  background: linear-gradient(90deg, #ffd86a, #ffb84d);
  color: #fff;
  padding: 12px 18px;
  border: none;
  border-radius: 10px;
  cursor: pointer;
  width: 140px;
  box-shadow: 0 6px 18px rgba(255, 91, 91, 0.24);
}

.login-card .login-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 26px rgba(255, 91, 91, 0.32);
}

.login-card .register-btn {
  background: linear-gradient(90deg, #2bd9ff, #0077ff);
  color: #fff;
  padding: 12px 18px;
  border: none;
  border-radius: 10px;
  cursor: pointer;
  width: 140px;
  box-shadow: 0 6px 18px rgba(0, 123, 255, 0.18);
}

.login-card .register-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 26px rgba(0, 123, 255, 0.28);
}

.login-card .d-flex {
  gap: 24px; /* 버튼 간 간격 조정 */
}

/* 로그인 카드 데코: 위/아래 빛나는 원(파티클 효과) */
.login-card::before,
.login-card::after {
  content: "";
  position: absolute;
  width: 260px;
  height: 260px;
  border-radius: 50%;
  filter: blur(32px);
  opacity: 0.12;
  left: 50%;
  transform: translateX(-50%);
  pointer-events: none;
}
.login-card::before {
  top: -90px;
  background: radial-gradient(circle at 30% 30%, #4da6ff, transparent 40%);
}
.login-card::after {
  bottom: -110px;
  background: radial-gradient(circle at 70% 70%, #ff6b6b, transparent 40%);
}
/* subtle gold top accent */
.login-card::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  right: 0;
  height: 6px;
  border-top-left-radius: 14px;
  border-top-right-radius: 14px;
  background: linear-gradient(90deg, #ffd86a, #ffb84d);
  box-shadow: 0 6px 18px rgba(255, 180, 70, 0.08);
}

/* 입력 포커스 강조 */
.login-card input:focus {
  box-shadow: 0 6px 20px rgba(0, 123, 255, 0.12) inset,
    0 6px 18px rgba(77, 166, 255, 0.06);
  border-color: rgba(77, 166, 255, 0.9);
  outline: none;
  transform: translateY(-2px);
}

/* 버튼 애니메이션 그로우 */
.login-card .login-btn,
.login-card .register-btn {
  transition: transform 160ms ease, box-shadow 200ms ease;
}

/* 로딩 텍스트 스타일 */
.loading {
  color: #fff;
  font-weight: 600;
  letter-spacing: 0.6px;
}

/* 배경 파티클 (간단) */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  background: radial-gradient(
      ellipse at 10% 10%,
      rgba(77, 166, 255, 0.06),
      transparent 8%
    ),
    radial-gradient(
      ellipse at 90% 80%,
      rgba(255, 107, 107, 0.06),
      transparent 8%
    );
  z-index: -1;
  pointer-events: none;
}

/* 작은 화면 대응 */
@media (max-width: 480px) {
  .login-card {
    width: 92%;
    padding: 18px;
  }
  .login-card::before,
  .login-card::after {
    display: none;
  }
  .login-card input {
    font-size: 16px;
  }
  .login-card .login-btn,
  .login-card .register-btn {
    width: 48%;
  }
}

/* particles removed per user request */

#errorMessage {
  color: #721c24;
  background-color: #f8d7da;
  border-color: #f5c6cb;
  padding: 5px;
  margin-bottom: 10px;
  border-radius: 4px;
  display: none;
}

#loginId {
  color: #000 !important;
  background: #fff;
  border: 1px solid rgba(0, 0, 0, 0.12);
  padding: 10px 12px;
  border-radius: 8px;
}
#loginId::placeholder {
  color: rgba(0, 0, 0, 0.45);
}
#loginId:focus {
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.06) inset;
  border-color: rgba(0, 0, 0, 0.18);
  outline: none;
}

.user-section {
  background-color: #fff;
  width: 100%;
  margin: 0 auto;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.user-section-content {
  display: flex;
  justify-content: space-between;
  align-items: center;
  max-width: 1200px;
  width: 100%;
  margin: 0 auto;
  padding: 5px 20px;
}

.user-info {
  font-size: 16px;
  color: #000;
}

.logout-btn {
  background-color: #ff3333;
  color: #fff;
  padding: 10px;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  width: 100px;
}

.logout-btn:hover {
  background-color: #e60000;
}

/* Wallet / Item button shared styles */
.wallet-btn {
  background: linear-gradient(90deg, #ffd86a, #ffb84d);
  border: none;
  color: #0b0b10;
  padding: 8px 12px;
  margin-left: 8px;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 700;
  box-shadow: 0 6px 14px rgba(0, 0, 0, 0.2);
  transition: transform 140ms ease, box-shadow 140ms ease, opacity 120ms ease;
}
.wallet-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 26px rgba(0, 0, 0, 0.26);
}

/* item button — slightly different accent */
.item-btn {
  background: linear-gradient(90deg, #7bffb3, #00d1ff);
  color: #003046;
  padding: 8px 14px;
}

/* responsive shrink */
@media (max-width: 480px) {
  .wallet-btn,
  .item-btn {
    padding: 6px 8px;
    font-size: 13px;
    margin-left: 6px;
  }
}

/* withdraw button distinct color (overrides .wallet-btn for #withdrawBtn) */
#withdrawBtn {
  background: linear-gradient(90deg, #8e6cff, #d27bff);
  color: #ffffff;
  padding: 8px 14px;
  margin-left: 8px;
  border: none;
  border-radius: 8px;
  font-weight: 700;
  box-shadow: 0 6px 14px rgba(142, 108, 255, 0.12);
}
#withdrawBtn:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 26px rgba(142, 108, 255, 0.18);
}

.game-list-header {
  text-align: center;
  font-size: 28px;
  margin-bottom: 20px;
  color: #fff;
  text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
}

.game-grid {
  padding: 15px;
  border-radius: 10px;
  position: absolute;
  top: 10%;
  left: 20%;
  right: 20%;
  margin: 0 auto;
  max-width: 1024px;
}

.game_button {
  width: 100%;
  max-width: 512px;
  aspect-ratio: 512 / 254;
  object-fit: cover;
  border-radius: 10px;
  cursor: pointer;
  border: 2px solid rgba(255, 255, 255, 0.2);
}

.game_list {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  column-gap: 20px;
  row-gap: 20px;
  padding: 0;
  margin: 0;
}

.game_list li {
  list-style: none;
  transition: transform 0.2s ease;
  text-align: center;
}

.game_list li:hover {
  transform: scale(1.05);
}

.game_button:hover {
  border-color: #ff3333;
}
.bg-video {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  object-fit: cover;
  z-index: -1;
  pointer-events: none;
  display: none;
}
.bg-video[style*="display: none"] {
  display: none !important;
}

#bg-image-home {
  display: none;
  position: fixed;
  left: 0; /* 왼쪽 끝에 붙임 */
  top: 0;
  height: 100vh; /* 창 세로에 맞춤 */
  width: auto; /* 이미지 원본 비율 유지 */
  z-index: -1;
  pointer-events: none;
  opacity: 0.5; /* 투명도, 필요시 조절 */
  background: none;
}

#bg-image-home img {
  height: 100vh;
  width: auto;
  display: block;
}

/* Scope title image inside the wrapper for consistent positioning */
#titleWrap #titleImage {
  position: fixed; /* 화면 우측 상단에 고정 */
  top: 18px;
  right: 14px;
  /* responsive size: min 96px, preferred 12vw, max 240px */
  width: clamp(96px, 12vw, 240px);
  z-index: 220; /* 배경·비디오 위, 모달보다 아래 */
  pointer-events: none; /* 클릭 방지 */
  transform-origin: center right;
  transition: transform 240ms cubic-bezier(0.2, 0.9, 0.2, 1), filter 240ms ease,
    opacity 240ms ease;
  will-change: transform, filter, opacity;
  /* neon color variables for quick tweaks */
  --neon-a: 58, 212, 255; /* cyan */
  --neon-b: 255, 165, 85; /* warm gold */
  --neon-c: 200, 100, 255; /* magenta */
  /* layered drop-shadows give a bright neon halo */
  filter: drop-shadow(0 10px 28px rgba(var(--neon-a), 0.06))
    drop-shadow(0 6px 18px rgba(var(--neon-b), 0.04));
  opacity: 1;
  /* combine float, glow and neon-shift */
  animation: logoFloat 6.5s ease-in-out infinite,
    logoGlow 3.6s ease-in-out infinite, logoNeon 4.2s linear infinite,
    logoPulse 9s ease-in-out infinite;
}

/* duplicated image tint layer: gold hue + blur + breathing */
#titleWrap .titleTint {
  position: fixed;
  top: 18px;
  right: 14px;
  width: clamp(96px, 12vw, 240px);
  z-index: 210; /* behind the main image but above back */
  pointer-events: none;
  transform-origin: center right;
  filter: blur(8px) saturate(1.12)
    drop-shadow(0 12px 28px rgba(255, 200, 80, 0.14));
  mix-blend-mode: screen;
  opacity: 0.9;
  animation: tintBreath 9s ease-in-out infinite;
}

@keyframes tintBreath {
  0% {
    transform: translateY(0) scale(0.98);
    opacity: 0.82;
    filter: blur(7px) saturate(1.02);
  }
  50% {
    transform: translateY(-4px) scale(1.06);
    opacity: 1;
    filter: blur(10px) saturate(1.18);
  }
  100% {
    transform: translateY(0) scale(0.98);
    opacity: 0.82;
    filter: blur(7px) saturate(1.02);
  }
}

/* hover/tap affordance: slight scale and stronger glow */
#titleImage:hover,
#titleImage:focus {
  transform: translateY(-4px) scale(1.03) rotate(-0.5deg);
  filter: drop-shadow(0 18px 48px rgba(0, 150, 255, 0.16)) saturate(1.12)
    contrast(1.02);
  opacity: 1;
}

/* mobile tweaks: keep smaller top/right and remove heavy shadows for battery */
@media (max-width: 480px) {
  /* center the logo for vertical layouts */
  #titleImage {
    position: fixed;
    top: 12px;
    left: 50%;
    right: auto;
    transform: translateX(-50%);
    width: clamp(72px, 24vw, 160px);
    animation-duration: 8s, 4.5s;
    filter: drop-shadow(0 8px 22px rgba(0, 150, 255, 0.08));
  }

  /* decorative sweep overlay */
  #titleImage::after {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: 6px;
    pointer-events: none;
    background: linear-gradient(
      120deg,
      rgba(255, 255, 255, 0) 0%,
      rgba(255, 255, 255, 0.06) 32%,
      rgba(255, 255, 255, 0) 60%
    );
    mix-blend-mode: screen;
    opacity: 0.9;
    transform: translateX(-30%);
    animation: logoSweep 2.8s ease-in-out infinite;
  }

  /* sparkle accent */
  #titleImage::before {
    content: "";
    position: absolute;
    width: 12px;
    height: 12px;
    right: 6%;
    top: 6%;
    background: radial-gradient(
      circle,
      rgba(255, 255, 255, 0.95) 0%,
      rgba(255, 255, 255, 0.4) 30%,
      transparent 60%
    );
    filter: blur(2px) drop-shadow(0 2px 6px rgba(255, 255, 255, 0.12));
    opacity: 0.9;
    transform-origin: center;
    animation: logoSpark 4.2s linear infinite;
    pointer-events: none;
  }
}

@keyframes logoSweep {
  0% {
    transform: translateX(-40%);
    opacity: 0;
  }
  50% {
    transform: translateX(40%);
    opacity: 0.9;
  }
  100% {
    transform: translateX(-40%);
    opacity: 0;
  }
}

@keyframes logoSpark {
  0% {
    transform: scale(0.8);
    opacity: 0;
  }
  10% {
    transform: scale(1);
    opacity: 1;
  }
  30% {
    transform: scale(1.2);
    opacity: 0.6;
  }
  100% {
    transform: scale(0.8);
    opacity: 0;
  }
}

@keyframes logoFloat {
  0% {
    transform: translateY(0) rotate(0deg) scale(1);
  }
  50% {
    transform: translateY(-6px) rotate(-0.2deg) scale(1.01);
  }
  100% {
    transform: translateY(0) rotate(0deg) scale(1);
  }
}

@keyframes logoGlow {
  0% {
    filter: drop-shadow(0 8px 30px rgba(0, 150, 255, 0.06));
    opacity: 0.96;
  }
  50% {
    filter: drop-shadow(0 20px 48px rgba(0, 150, 255, 0.14));
    opacity: 1;
  }
  100% {
    filter: drop-shadow(0 8px 30px rgba(0, 150, 255, 0.06));
    opacity: 0.96;
  }
}

/* Desktop-only ornate effects: aura, shimmer and tiny sparkles */
@media (min-width: 481px) {
  /* soft aura behind logo */
  #titleImage::before {
    content: "";
    position: absolute;
    inset: -18% -22% -12% -6%;
    border-radius: 14px;
    pointer-events: none;
    background: radial-gradient(
        60% 40% at 30% 40%,
        rgba(0, 180, 255, 0.12),
        transparent 30%
      ),
      radial-gradient(
        40% 30% at 80% 80%,
        rgba(255, 120, 160, 0.06),
        transparent 30%
      );
    filter: blur(36px) saturate(1.1);
    mix-blend-mode: screen;
    opacity: 0.9;
    animation: logoAura 9s ease-in-out infinite;
  }

  /* shimmer streak */
  #titleImage::after {
    content: "";
    position: absolute;
    left: -10%;
    top: -6%;
    width: 140%;
    height: 60%;
    pointer-events: none;
    background: linear-gradient(
      120deg,
      rgba(255, 255, 255, 0) 0%,
      rgba(255, 255, 255, 0.16) 40%,
      rgba(255, 255, 255, 0.02) 60%,
      rgba(255, 255, 255, 0) 100%
    );
    mix-blend-mode: screen;
    transform: translateX(-30%) rotate(-6deg);
    filter: blur(6px);
    opacity: 0;
    animation: logoShimmer 3.2s linear infinite;
  }

  /* tiny sparkle particles using box-shadow trick on a pseudo element */
  #titleImage .sparkle-fake {
    display: none; /* placeholder selector for potential JS; kept hidden */
  }

  @keyframes logoAura {
    0% {
      opacity: 0.7;
      transform: scale(1);
    }
    50% {
      opacity: 1;
      transform: scale(1.03);
    }
    100% {
      opacity: 0.7;
      transform: scale(1);
    }
  }

  @keyframes logoShimmer {
    0% {
      transform: translateX(-40%) rotate(-6deg);
      opacity: 0;
    }
    20% {
      opacity: 0.5;
    }
    50% {
      transform: translateX(20%) rotate(-6deg);
      opacity: 0.95;
    }
    80% {
      opacity: 0.3;
    }
    100% {
      transform: translateX(-40%) rotate(-6deg);
      opacity: 0;
    }
  }

  /* wrapper to host multiple pseudo-elements for richer logo effects */
  #titleWrap {
    position: fixed;
    top: 14px;
    right: 16px;
    z-index: 220;
    pointer-events: none;
    display: inline-block;
    width: clamp(96px, 12vw, 240px);
    height: auto;
    transform-origin: center right;
  }

  /* conic/neon halo around the logo */
  #titleWrap::before {
    content: "";
    position: absolute;
    inset: -18% -22% -12% -6%;
    border-radius: 18px;
    background: conic-gradient(
      from 120deg at 40% 40%,
      rgba(0, 220, 255, 0.06),
      rgba(255, 128, 200, 0.04),
      rgba(255, 200, 90, 0.05),
      rgba(0, 220, 255, 0.06)
    );
    filter: blur(28px) saturate(1.05);
    mix-blend-mode: screen;
    opacity: 0.95;
    animation: logoAura 9s ease-in-out infinite;
    pointer-events: none;
  }

  /* radial highlight that slowly rotates to add motion */
  #titleWrap::after {
    content: "";
    position: absolute;
    left: -6%;
    top: -6%;
    width: 112%;
    height: 112%;
    background: radial-gradient(
      circle at 25% 35%,
      rgba(255, 255, 255, 0.06),
      transparent 25%
    );
    transform: rotate(0deg);
    filter: blur(8px);
    opacity: 0.9;
    animation: logoRotateHighlight 16s linear infinite;
    pointer-events: none;
  }

  @keyframes logoRotateHighlight {
    0% {
      transform: rotate(0deg);
    }
    100% {
      transform: rotate(360deg);
    }
  }

  /* neon color shift and pulse */
  @keyframes logoNeon {
    0% {
      filter: drop-shadow(0 10px 28px rgba(var(--neon-a), 0.06))
        drop-shadow(0 6px 18px rgba(var(--neon-b), 0.04));
    }
    25% {
      filter: drop-shadow(0 14px 36px rgba(var(--neon-c), 0.08))
        drop-shadow(0 10px 26px rgba(var(--neon-b), 0.06));
    }
    50% {
      filter: drop-shadow(0 18px 46px rgba(var(--neon-a), 0.12))
        drop-shadow(0 12px 30px rgba(var(--neon-b), 0.08));
    }
    75% {
      filter: drop-shadow(0 14px 36px rgba(var(--neon-c), 0.06))
        drop-shadow(0 10px 26px rgba(var(--neon-b), 0.04));
    }
    100% {
      filter: drop-shadow(0 10px 28px rgba(var(--neon-a), 0.06))
        drop-shadow(0 6px 18px rgba(var(--neon-b), 0.04));
    }
  }

  @keyframes logoPulse {
    0% {
      transform: translateY(0) scale(1);
    }
    50% {
      transform: translateY(-6px) scale(1.02);
    }
    100% {
      transform: translateY(0) scale(1);
    }
  }

  /* tiny moving sparkles: use multiple layered radial gradients on a pseudo-element */
  #titleImage::sparkles {
    content: "";
    position: absolute;
    inset: 4% 4% 4% 4%;
    pointer-events: none;
    border-radius: 8px;
    background-image: radial-gradient(
        circle at 12% 20%,
        rgba(255, 255, 255, 0.9) 0%,
        rgba(255, 255, 255, 0) 30%
      ),
      radial-gradient(
        circle at 82% 30%,
        rgba(255, 240, 200, 0.8) 0%,
        rgba(255, 240, 200, 0) 30%
      ),
      radial-gradient(
        circle at 60% 70%,
        rgba(180, 220, 255, 0.65) 0%,
        rgba(180, 220, 255, 0) 30%
      );
    mix-blend-mode: screen;
    opacity: 0;
    filter: blur(1.6px);
    animation: logoSparks 5.6s linear infinite;
  }

  @keyframes logoSparks {
    0% {
      opacity: 0;
      transform: translateY(0) rotate(0);
    }
    10% {
      opacity: 0.9;
      transform: translateY(-2px) rotate(3deg);
    }
    30% {
      opacity: 0.65;
      transform: translateY(-6px) rotate(-6deg);
    }
    60% {
      opacity: 0.2;
      transform: translateY(4px) rotate(10deg);
    }
    100% {
      opacity: 0;
      transform: translateY(0) rotate(0);
    }
  }

  /* removed .titleBack ornate layers; keep only .titleTint layer */

  /* duplicated image tint layer: gold hue + blur + breathing */
  #titleWrap .titleTint {
    position: fixed;
    top: 18px;
    right: 14px;
    width: clamp(96px, 12vw, 240px);
    z-index: 210; /* behind the main image */
    pointer-events: none;
    transform-origin: center right;
    filter: blur(8px) saturate(1.12)
      drop-shadow(0 12px 28px rgba(255, 200, 80, 0.14));
    mix-blend-mode: screen;
    opacity: 0.9;
    animation: tintBreath 9s ease-in-out infinite;
  }

  @keyframes tintBreath {
    0% {
      transform: translateY(0) scale(0.98);
      opacity: 0.82;
      filter: blur(7px) saturate(1.02);
    }
    50% {
      transform: translateY(-4px) scale(1.06);
      opacity: 1;
      filter: blur(10px) saturate(1.18);
    }
    100% {
      transform: translateY(0) scale(0.98);
      opacity: 0.82;
      filter: blur(7px) saturate(1.02);
    }
  }

  /* keep main image drop-shadow for subtle depth */
  #titleWrap #titleImage {
    position: fixed; /* 화면 우측 상단에 고정 */
    top: 18px;
    right: 14px;
    width: clamp(96px, 12vw, 240px);
    z-index: 220; /* 배경·비디오 위, 모달보다 아래 */
    pointer-events: none;
    transform-origin: center right;
    filter: drop-shadow(0 20px 44px rgba(0, 0, 0, 0.18));
  }

  /* Background home image layer with smooth fade */
  :root {
    --home-bg-opacity: 0.55; /* default opacity */
    --home-bg-z: 0; /* place above page background but behind UI */
  }
  #bg-image-home {
    position: fixed;
    inset: 0;
    display: none;
    pointer-events: none;
    z-index: var(--home-bg-z);
    opacity: 0;
    transition: opacity 0.48s ease, transform 0.48s ease;
    transform: scale(1.02);
    background: none;
  }
  #bg-image-home img {
    width: 100vw;
    height: 100vh;
    object-fit: cover;
    opacity: var(--home-bg-opacity);
    display: block;
  }
  #bg-image-home.bg-visible {
    opacity: 1;
    transform: scale(1);
  }

  /* utility: quick override to bring bg above certain layers when needed */
  .bg-on-top {
    z-index: 200 !important;
  }

  /* 작은 화면(세로 모바일) 최적화 */
  @media (max-width: 768px) {
    #titleImage {
      top: 10px;
      right: 10px;
      width: 140px;
    }
  }
}
