:root {
  --bg-dark: #0a0a12;
  --bg-card: #14142a;
  --bg-surface: #1c1c3a;
  --accent: #ff6b35;
  --accent2: #00e5ff;
  --accent3: #ff2d78;
  --gold: #ffd700;
  --text: #e8e8f0;
  --text-dim: #7a7a9a;
  --success: #00e676;
  --danger: #ff1744;
  --radius: 16px;
  --radius-sm: 10px;
}

* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  width: 100%; height: 100%; height: 100dvh;
  overflow: hidden;
  font-family: 'Noto Sans KR', sans-serif;
  background: var(--bg-dark);
  color: var(--text);
}

body {
  background: 
    radial-gradient(ellipse at 20% 80%, rgba(255,107,53,0.08) 0%, transparent 50%),
    radial-gradient(ellipse at 80% 20%, rgba(0,229,255,0.06) 0%, transparent 50%),
    radial-gradient(ellipse at 50% 50%, rgba(255,45,120,0.04) 0%, transparent 60%),
    var(--bg-dark);
}

.screen { display: none; width: 100%; height: 100%; height: 100dvh; position: absolute; top: 0; left: 0; overflow-y: auto; overflow-x: hidden; -webkit-overflow-scrolling: touch; }
.screen.active { display: flex; flex-direction: column; }

/* ===== LOADING ===== */
#loadingScreen {
  align-items: center;
  justify-content: center;
  gap: 16px;
}
#loadingScreen .logo-icon { font-size: 64px; animation: float 3s ease-in-out infinite; }
#loadingScreen .logo-title {
  font-family: 'Black Han Sans', sans-serif;
  font-size: 48px;
  background: linear-gradient(135deg, var(--accent), var(--accent3), var(--accent2));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}
.loading-text { color: var(--text-dim); font-size: 14px; }
.loading-bar { width: 200px; height: 4px; background: var(--bg-surface); border-radius: 2px; overflow: hidden; }
.loading-bar-inner { width: 0%; height: 100%; background: var(--accent); border-radius: 2px; transition: width 0.3s; }

/* ===== MAIN MENU ===== */
#mainMenu {
  align-items: center;
  justify-content: flex-start;
  padding: 24px;
  gap: 20px;
  overflow-y: auto;
}
#mainMenu > :first-child { margin-top: auto; }
#mainMenu > :last-child { margin-bottom: auto; }

.logo-area { text-align: center; margin-bottom: 12px; }
.logo-icon { font-size: 64px; animation: float 3s ease-in-out infinite; }

@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-10px); }
}

.logo-title {
  font-family: 'Black Han Sans', sans-serif;
  font-size: 48px;
  background: linear-gradient(135deg, var(--accent), var(--accent3), var(--accent2));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  letter-spacing: -2px;
}

.logo-sub { color: var(--text-dim); font-size: 14px; margin-top: 4px; }

.menu-card {
  background: var(--bg-card);
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: var(--radius);
  padding: 20px;
  width: 100%;
  max-width: 380px;
}

.profile-section { display: flex; align-items: center; gap: 14px; }

.avatar {
  width: 56px; height: 56px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--accent3));
  display: flex; align-items: center; justify-content: center;
  font-size: 28px; flex-shrink: 0; cursor: pointer;
  transition: transform 0.2s;
}
.avatar:active { transform: scale(0.92); }

.profile-info { flex: 1; }
.profile-name { font-weight: 900; font-size: 18px; }
.profile-stats { color: var(--text-dim); font-size: 12px; margin-top: 2px; }

.input-field {
  width: 100%;
  padding: 14px 16px;
  background: var(--bg-surface);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 16px;
  font-family: inherit;
  outline: none;
  transition: border-color 0.2s;
}
.input-field:focus { border-color: var(--accent); }
.input-field::placeholder { color: var(--text-dim); }

.btn {
  width: 100%;
  padding: 16px;
  border: none;
  border-radius: var(--radius-sm);
  font-family: 'Black Han Sans', sans-serif;
  font-size: 18px;
  cursor: pointer;
  transition: all 0.15s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  letter-spacing: 1px;
  max-width: 380px;
}
.btn:active { transform: scale(0.97); }
.btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  box-shadow: none;
  transform: none;
}

.btn-primary {
  background: linear-gradient(135deg, var(--accent), #ff8f5a);
  color: white;
  box-shadow: 0 4px 20px rgba(255,107,53,0.3);
}

.btn-secondary {
  background: var(--bg-surface);
  color: var(--text);
  border: 1px solid rgba(255,255,255,0.1);
}

.auth-gate-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding:
    max(24px, env(safe-area-inset-top))
    max(18px, env(safe-area-inset-right))
    max(24px, env(safe-area-inset-bottom))
    max(18px, env(safe-area-inset-left));
  background:
    radial-gradient(circle at top, rgba(0,229,255,0.12), transparent 38%),
    linear-gradient(180deg, rgba(6,7,15,0.62), rgba(6,7,15,0.92));
  backdrop-filter: blur(18px);
}

.auth-gate-overlay[hidden] {
  display: none !important;
}

.auth-gate-panel {
  width: 100%;
  max-width: 430px;
  padding: 26px 22px 22px;
  border-radius: 28px;
  background:
    radial-gradient(circle at top right, rgba(255,255,255,0.14) 0%, transparent 34%),
    linear-gradient(145deg, rgba(22,22,46,0.96), rgba(11,16,32,0.96));
  border: 1px solid rgba(255,255,255,0.12);
  box-shadow:
    0 24px 60px rgba(0,0,0,0.45),
    0 0 0 1px rgba(255,255,255,0.02) inset;
}

.auth-gate-eyebrow {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 7px 12px;
  border-radius: 999px;
  background: rgba(0,229,255,0.16);
  color: #9df7ff;
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.08em;
}

.auth-gate-title {
  margin-top: 16px;
  font-family: 'Black Han Sans', sans-serif;
  font-size: 28px;
  line-height: 1.24;
  color: #fff;
}

.auth-gate-message {
  margin-top: 12px;
  color: rgba(232,232,240,0.82);
  font-size: 14px;
  line-height: 1.65;
}

.auth-gate-points {
  margin-top: 18px;
  display: grid;
  gap: 10px;
}

.auth-gate-point {
  padding: 12px 14px;
  border-radius: 16px;
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.07);
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.auth-gate-point strong {
  font-size: 14px;
  color: #fff;
}

.auth-gate-point span {
  font-size: 12px;
  line-height: 1.55;
  color: var(--text-dim);
}

.auth-gate-actions {
  margin-top: 18px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.auth-gate-actions .btn {
  max-width: none;
}

.auth-gate-foot {
  margin-top: 12px;
  color: rgba(232,232,240,0.62);
  font-size: 12px;
  line-height: 1.55;
}

.auth-card {
  position: relative;
  overflow: hidden;
  background:
    radial-gradient(circle at top right, rgba(255,255,255,0.1) 0%, transparent 40%),
    linear-gradient(135deg, rgba(255,107,53,0.14), rgba(0,229,255,0.08)),
    var(--bg-card);
}

.auth-card-header {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  flex-wrap: wrap;
}

.auth-chip {
  flex-shrink: 0;
  min-width: 72px;
  padding: 6px 12px;
  border-radius: 999px;
  background: rgba(255,255,255,0.08);
  color: #fff;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-align: center;
}

.auth-copy {
  flex: 1 1 180px;
  min-width: 0;
}

.auth-title {
  font-family: 'Black Han Sans', sans-serif;
  font-size: 20px;
  color: #fff;
  line-height: 1.2;
}

.auth-subtitle {
  margin-top: 4px;
  color: var(--text-dim);
  font-size: 12px;
  line-height: 1.5;
}

.auth-account {
  margin-top: 16px;
  padding: 14px;
  border-radius: 14px;
  border: 1px solid rgba(255,255,255,0.08);
  background: rgba(255,255,255,0.04);
  display: flex;
  align-items: center;
  gap: 12px;
}

.auth-avatar {
  width: 54px;
  height: 54px;
  border-radius: 16px;
  background: linear-gradient(135deg, var(--accent), var(--accent3));
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  font-weight: 900;
  background-size: cover;
  background-position: center;
  flex-shrink: 0;
}

.auth-avatar.has-image {
  color: transparent;
}

.auth-account-copy {
  flex: 1;
  min-width: 0;
}

.auth-account-name {
  font-size: 16px;
  font-weight: 800;
  color: #fff;
  line-height: 1.3;
  word-break: break-word;
}

.auth-account-meta {
  margin-top: 4px;
  color: var(--text-dim);
  font-size: 12px;
  line-height: 1.45;
  word-break: break-word;
}

.auth-actions {
  margin-top: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.auth-login-btn,
.auth-logout-btn {
  max-width: none;
}

.auth-note {
  margin-top: 12px;
  color: var(--text-dim);
  font-size: 11px;
  line-height: 1.5;
}

.auth-card[data-auth-state="signed-in"] .auth-chip {
  background: rgba(0,230,118,0.18);
  color: #69f0ae;
}

.auth-card[data-auth-state="signed-out"] .auth-chip {
  background: rgba(255,255,255,0.12);
  color: #fff;
}

.auth-card[data-auth-state="loading"] .auth-chip {
  background: rgba(0,229,255,0.18);
  color: #9df7ff;
}

.auth-card[data-auth-state="error"] .auth-chip {
  background: rgba(255,23,68,0.18);
  color: #ff9db0;
}

.auth-guarded {
  position: relative;
}

.auth-guarded[data-auth-locked="true"]::after {
  content: 'LOGIN';
  position: absolute;
  top: 10px;
  right: 12px;
  padding: 4px 8px;
  border-radius: 999px;
  background: rgba(10,10,18,0.72);
  border: 1px solid rgba(255,255,255,0.12);
  color: rgba(255,255,255,0.78);
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 0.08em;
  pointer-events: none;
}

.auth-guarded[data-auth-locked="true"] {
  filter: saturate(0.92);
}

body[data-auth-gate-open="true"] #mainMenu,
body[data-auth-gate-open="true"] #lobby,
body[data-auth-gate-open="true"] #practiceSelect {
  filter: saturate(0.94);
}

/* ===== 게임 목록 버튼 (블링블링) ===== */
.btn-game-catalog {
  background: linear-gradient(135deg, #6e3aff, #00e5ff, #ff6b35, #ffd700);
  background-size: 300% 300%;
  animation: catalogGradient 4s ease infinite, catalogPulse 2s ease-in-out infinite;
  color: #fff;
  font-weight: 800;
  font-size: 16px;
  letter-spacing: 0.5px;
  border: none;
  position: relative;
  overflow: hidden;
  box-shadow:
    0 0 15px rgba(110,58,255,0.4),
    0 0 30px rgba(0,229,255,0.2),
    0 4px 20px rgba(0,0,0,0.3);
  text-shadow: 0 1px 3px rgba(0,0,0,0.3);
}

.btn-game-catalog::before {
  content: '';
  position: absolute;
  top: -50%;
  left: -60%;
  width: 40%;
  height: 200%;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(255,255,255,0.3),
    transparent
  );
  transform: skewX(-20deg);
  animation: catalogShine 3s ease-in-out infinite;
}

.btn-game-catalog:hover {
  transform: scale(1.03);
  box-shadow:
    0 0 25px rgba(110,58,255,0.6),
    0 0 50px rgba(0,229,255,0.3),
    0 0 15px rgba(255,215,0,0.3),
    0 6px 30px rgba(0,0,0,0.4);
}

.btn-game-catalog:active {
  transform: scale(0.98);
}

@keyframes catalogGradient {
  0%   { background-position: 0% 50%; }
  50%  { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

@keyframes catalogShine {
  0%   { left: -60%; opacity: 0; }
  20%  { opacity: 1; }
  100% { left: 120%; opacity: 0; }
}

@keyframes catalogPulse {
  0%, 100% { box-shadow: 0 0 15px rgba(110,58,255,0.4), 0 0 30px rgba(0,229,255,0.2), 0 4px 20px rgba(0,0,0,0.3); }
  50%      { box-shadow: 0 0 20px rgba(110,58,255,0.6), 0 0 40px rgba(0,229,255,0.35), 0 0 10px rgba(255,215,0,0.25), 0 4px 20px rgba(0,0,0,0.3); }
}

/* ===== PWA INSTALL BANNER ===== */
.pwa-install-banner {
  display: none;
  width: 100%;
  max-width: 380px;
  border-radius: var(--radius);
  background: linear-gradient(135deg, #1a1a3e 0%, #0d2137 100%);
  border: 1px solid rgba(0,229,255,0.25);
  flex-shrink: 0;
  overflow: hidden;
}
.pwa-install-banner.pwa-visible {
  display: block !important;
  animation: pwaSlideIn 0.5s cubic-bezier(0.16, 1, 0.3, 1) both;
}

@keyframes pwaSlideIn {
  from { opacity: 0; transform: translateY(-12px) scale(0.97); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

.pwa-install-content {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px;
}

.pwa-install-text {
  flex: 1;
  min-width: 0;
}

.pwa-install-title {
  font-family: 'Black Han Sans', sans-serif;
  font-size: 14px;
  color: #fff;
  line-height: 1.3;
}

.pwa-install-desc {
  font-size: 10px;
  color: var(--text-dim);
  margin-top: 2px;
  line-height: 1.2;
}

.pwa-install-btn {
  flex-shrink: 0;
  padding: 7px 14px;
  border: none;
  border-radius: 16px;
  background: linear-gradient(135deg, var(--accent2), #00b8d4);
  color: var(--bg-dark);
  font-family: 'Black Han Sans', sans-serif;
  font-size: 13px;
  letter-spacing: 0.5px;
  cursor: pointer;
  transition: all 0.15s;
  box-shadow: 0 2px 8px rgba(0,229,255,0.3);
}

.pwa-install-btn:active {
  transform: scale(0.93);
}

.pwa-install-close {
  flex-shrink: 0;
  width: 24px;
  height: 24px;
  border: none;
  border-radius: 50%;
  background: rgba(255,255,255,0.08);
  color: var(--text-dim);
  font-size: 12px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.pwa-install-close:active {
  background: rgba(255,255,255,0.15);
}

/* iOS guide row */
.pwa-ios-guide {
  padding: 0 16px 12px;
  position: relative;
  z-index: 1;
}

.pwa-ios-steps {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--text-dim);
  flex-wrap: wrap;
  justify-content: center;
}

.pwa-ios-step {
  background: rgba(255,255,255,0.06);
  padding: 4px 10px;
  border-radius: 6px;
}

.pwa-ios-step strong {
  color: var(--accent2);
}

.pwa-ios-share-icon {
  display: inline-block;
  transform: rotate(180deg);
  font-size: 14px;
}

.pwa-ios-arrow {
  color: var(--accent2);
  font-size: 14px;
}

.btn-accent2 {
  background: linear-gradient(135deg, var(--accent2), #00b8d4);
  color: var(--bg-dark);
  box-shadow: 0 4px 20px rgba(0,229,255,0.3);
}

.btn-small { padding: 10px 16px; font-size: 14px; width: auto; }

.join-row {
  display: flex; gap: 8px; width: 100%; max-width: 380px;
}

/* ===== LOBBY ===== */
#lobby.active {
  padding: 0;
  gap: 0;
  display: flex;
  flex-direction: column;
  height: 100%;
}

.lobby-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  flex-shrink: 0;
  border-bottom: 1px solid rgba(255,255,255,0.06);
}

.lobby-content {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  padding: 16px 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.lobby-footer {
  flex-shrink: 0;
  padding: 12px 20px;
  background: var(--bg-card);
  border-top: 1px solid rgba(255,255,255,0.06);
}

.back-btn {
  background: none; border: none; color: var(--text);
  font-size: 24px; cursor: pointer; padding: 8px;
  min-width: 44px; min-height: 44px;
}

.room-code-display {
  text-align: center; padding: 16px;
  background: var(--bg-card); border-radius: var(--radius);
  border: 1px solid rgba(255,255,255,0.06);
}
.room-code-label { font-size: 12px; color: var(--text-dim); margin-bottom: 4px; }
.room-code {
  font-family: 'Black Han Sans', sans-serif;
  font-size: 32px; letter-spacing: 6px; color: var(--accent2); cursor: pointer;
  min-height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.room-code-hint { font-size: 11px; color: var(--text-dim); margin-top: 4px; }

.share-btn-row { display: flex; gap: 8px; margin-top: 8px; justify-content: center; }
.share-btn {
  padding: 10px 14px; background: var(--bg-surface);
  border: 1px solid rgba(255,255,255,0.1); border-radius: var(--radius-sm);
  color: var(--text); font-size: 12px; font-weight: 700;
  cursor: pointer; font-family: inherit;
  min-height: 44px;
}
.share-btn:active { transform: scale(0.95); }

.players-section {
  flex-shrink: 0;
  margin-bottom: 8px;
}
.players-title { font-size: 14px; color: var(--text-dim); margin-bottom: 10px; font-weight: 700; }
.player-list { display: flex; flex-direction: column; gap: 8px; }

.player-item {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 16px; background: var(--bg-card);
  border-radius: var(--radius-sm);
  border: 1px solid rgba(255,255,255,0.04);
  animation: slideIn 0.3s ease;
}

@keyframes slideIn {
  from { opacity: 0; transform: translateX(-20px); }
  to { opacity: 1; transform: translateX(0); }
}

.player-avatar-sm {
  width: 40px; height: 40px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 20px; flex-shrink: 0;
}
.player-name { font-weight: 700; font-size: 15px; flex: 1; }
.host-badge {
  background: var(--gold); color: var(--bg-dark);
  font-size: 10px; font-weight: 900; padding: 3px 8px; border-radius: 20px;
}

.game-select {
  padding: 14px; background: var(--bg-card); border-radius: var(--radius);
  border: 1px solid rgba(255,255,255,0.06);
  flex-shrink: 0;
}
.game-select-title { font-size: 13px; color: var(--text-dim); margin-bottom: 8px; font-weight: 700; }
.game-options {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
  max-height: none;
  overflow-y: visible;
}

.game-option {
  padding: 10px 6px;
  background: var(--bg-surface);
  border: 2px solid transparent;
  border-radius: var(--radius-sm);
  text-align: center;
  cursor: pointer;
  transition: all 0.2s;
  font-size: 11px;
  font-weight: 700;
  min-height: 64px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
}
.game-option:active { transform: scale(0.95); }
.game-option.selected { border-color: var(--accent); background: rgba(255,107,53,0.15); }
.game-option .game-emoji { font-size: 24px; display: block; }
.game-option.disabled { opacity: 0.4; pointer-events: none; position: relative; }

/* ===== Game Carousel Overlay ===== */
.gc-overlay {
  position: fixed; inset: 0; z-index: 1000;
  display: flex; align-items: stretch; justify-content: center;
}
.gc-backdrop {
  position: absolute; inset: 0;
  background: rgba(0,0,0,0.95);
}
.gc-panel {
  position: relative; z-index: 1;
  width: 100%; max-width: 480px;
  display: flex; flex-direction: column;
  overflow-y: auto; overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
}

/* Header */
.gc-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 16px 8px;
  flex-shrink: 0;
}
.gc-title {
  font-family: 'Black Han Sans', sans-serif;
  font-size: 20px; color: #fff;
}
.gc-close-btn {
  background: none; border: none; color: rgba(255,255,255,0.6);
  font-size: 22px; cursor: pointer; padding: 4px 8px;
  transition: color 0.2s;
}
.gc-close-btn:active { color: #fff; }
.gc-grid-btn {
  background: rgba(255,255,255,0.08); border: 1px solid rgba(255,255,255,0.15);
  color: rgba(255,255,255,0.7); border-radius: 8px;
  width: 36px; height: 36px;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; transition: all 0.2s;
}
.gc-grid-btn:active { background: rgba(255,255,255,0.15); color: #fff; }

/* Carousel */
.gc-carousel-area {
  position: relative; flex-shrink: 0;
  padding: 8px 0 4px;
  overflow: hidden;
}
.gc-arrow {
  position: absolute; top: 50%; transform: translateY(-60%);
  z-index: 10; background: rgba(0,0,0,0.5);
  border: 1px solid rgba(255,255,255,0.15);
  color: #fff; font-size: 28px; line-height: 1;
  width: 36px; height: 36px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; transition: all 0.2s;
  -webkit-tap-highlight-color: transparent;
}
.gc-arrow:active { background: rgba(255,255,255,0.15); }
.gc-arrow-left { left: 4px; }
.gc-arrow-right { right: 4px; }
@media (max-width: 500px) {
  .gc-arrow { display: none; }

  .auth-card-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
  }

  .auth-chip {
    min-width: 0;
    padding: 5px 12px;
  }

  .auth-copy {
    width: 100%;
    flex-basis: auto;
  }

  .auth-title {
    font-size: 18px;
  }

  .auth-subtitle {
    margin-top: 6px;
  }
}

/* Track */
.gc-track-wrapper {
  overflow: hidden;
  padding: 8px 0;
}
.gc-track {
  display: flex; align-items: center;
  transition: transform 0.35s cubic-bezier(0.22, 0.61, 0.36, 1);
  will-change: transform;
  padding: 12px 0;
}

/* Card */
.gc-card {
  flex-shrink: 0;
  width: 100px; height: 100px;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 4px;
  background: var(--bg-surface);
  border: 2px solid transparent;
  border-radius: 14px;
  cursor: pointer;
  transition: all 0.35s cubic-bezier(0.22, 0.61, 0.36, 1);
  transform: scale(0.78);
  opacity: 0.45;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}
.gc-card-emoji {
  font-size: 32px; line-height: 1;
  transition: font-size 0.35s cubic-bezier(0.22, 0.61, 0.36, 1);
}
.gc-card-name {
  font-size: 11px; font-weight: 700; color: var(--text-dim);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  max-width: 90px; text-align: center;
  transition: all 0.35s cubic-bezier(0.22, 0.61, 0.36, 1);
}
.gc-card.active {
  transform: scale(1);
  opacity: 1;
  border-color: var(--accent);
  background: linear-gradient(145deg, rgba(255,107,53,0.18), var(--bg-surface));
  box-shadow: 0 0 24px rgba(255,107,53,0.2), 0 4px 16px rgba(0,0,0,0.4);
}
.gc-card.active .gc-card-emoji { font-size: 40px; }
.gc-card.active .gc-card-name { color: #fff; font-size: 12px; }
.gc-card.near {
  transform: scale(0.88);
  opacity: 0.7;
}
.gc-card.disabled {
  opacity: 0.25; pointer-events: none;
}

/* Dots */
.gc-dots {
  display: flex; justify-content: center; gap: 5px;
  padding: 4px 0 2px;
}
.gc-dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: rgba(255,255,255,0.2);
  transition: all 0.3s;
}
.gc-dot.active {
  width: 18px; border-radius: 3px;
  background: var(--accent);
}

/* Video Preview */
.gc-video-area {
  position: relative; flex-shrink: 0;
  margin: 6px 16px 0;
  border-radius: 14px;
  overflow: hidden;
  background: #0a0a14;
  aspect-ratio: 16/9;
  border: 1px solid rgba(255,255,255,0.08);
}
.gc-video {
  width: 100%; height: 100%;
  object-fit: cover;
  display: none;
}
.gc-video.playing { display: block; }
.gc-video-placeholder {
  position: absolute; inset: 0;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 8px;
}
.gc-video-ph-icon {
  font-size: 32px; color: rgba(255,255,255,0.15);
  width: 56px; height: 56px;
  display: flex; align-items: center; justify-content: center;
  border: 2px solid rgba(255,255,255,0.1);
  border-radius: 50%;
}
.gc-video-ph-text {
  font-size: 12px; color: rgba(255,255,255,0.3);
  text-align: center; padding: 0 20px;
}
.gc-video-loading {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  background: rgba(10,10,20,0.7);
}
.gc-video-spinner {
  width: 28px; height: 28px;
  border: 3px solid rgba(255,255,255,0.1);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: gc-spin 0.7s linear infinite;
}
@keyframes gc-spin { to { transform: rotate(360deg); } }

/* Game Info */
.gc-info {
  padding: 12px 16px 0;
  flex-shrink: 0;
}
.gc-info-top {
  display: flex; align-items: center; gap: 10px;
  margin-bottom: 6px;
}
.gc-info-emoji { font-size: 28px; }
.gc-info-meta { flex: 1; min-width: 0; }
.gc-info-name {
  font-size: 17px; font-weight: 800; color: #fff;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.gc-info-tags {
  display: flex; gap: 6px; margin-top: 2px; flex-wrap: wrap;
}
.gc-tag {
  font-size: 11px; color: var(--text-dim);
  background: rgba(255,255,255,0.06);
  padding: 2px 8px; border-radius: 10px;
}
.gc-info-desc {
  font-size: 13px; color: rgba(255,255,255,0.55);
  line-height: 1.5; margin-top: 4px;
}

/* Action */
.gc-action {
  padding: 12px 16px 20px;
  flex-shrink: 0;
}
.gc-select-btn {
  width: 100%;
  font-size: 15px; font-weight: 800;
  padding: 14px;
  border-radius: 12px;
}

/* ===== Grid View (All Games) ===== */
.gc-grid-overlay {
  position: absolute; inset: 0; z-index: 5;
  background: rgba(0,0,0,0.97);
  overflow-y: auto;
  animation: gcFadeIn 0.25s ease;
}
@keyframes gcFadeIn { from { opacity: 0; } to { opacity: 1; } }
.gc-grid-container {
  max-width: 480px; margin: 0 auto;
  padding: 0 16px 24px;
}
.gc-grid-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 0 12px;
  position: sticky; top: 0; z-index: 2;
  background: rgba(0,0,0,0.95);
}
.gc-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}
.gc-grid-item {
  display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 4px;
  padding: 12px 4px;
  background: var(--bg-surface);
  border: 2px solid transparent;
  border-radius: var(--radius-sm);
  cursor: pointer; transition: all 0.2s;
  min-height: 72px;
}
.gc-grid-item:active { transform: scale(0.95); }
.gc-grid-item.selected {
  border-color: var(--accent);
  background: rgba(255,107,53,0.15);
}
.gc-grid-item.disabled { opacity: 0.3; pointer-events: none; }
.gc-grid-item-emoji { font-size: 24px; }
.gc-grid-item-name { font-size: 11px; font-weight: 700; color: var(--text-dim); text-align: center; }

/* Bet mode selector */
.bet-mode-option {
  display: inline-flex; align-items: center; justify-content: center;
  padding: 6px 14px; border-radius: 20px; cursor: pointer;
  font-size: 13px; font-weight: 600; color: var(--text-dim);
  background: rgba(255,255,255,0.05); border: 1px solid rgba(255,255,255,0.1);
  transition: all 0.2s;
}
.bet-mode-option.selected {
  background: rgba(255,107,53,0.2); border-color: var(--accent); color: var(--accent);
}
.bet-mode-option:active { transform: scale(0.95); }

/* ===== POKER TABLE — Felt casino redesign ===== */
#pokerGame { padding: 0; gap: 0; position: relative; overflow: hidden; }

/* Green felt background */
.pk-felt {
  position: absolute; inset: 0;
  background:
    radial-gradient(ellipse at 40% 50%, #2a6b3a 0%, #1a4a28 40%, #0d2a14 80%, #061208 100%);
  border-radius: 12px;
  border: 3px solid #3a2a1a;
  box-shadow:
    0 0 0 2px #1a1008,
    0 0 0 5px #5a4a30,
    inset 0 0 60px rgba(0,0,0,0.3);
  overflow: hidden;
}
.pk-felt::before {
  content: '';
  position: absolute; inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg width='4' height='4' xmlns='http://www.w3.org/2000/svg'%3E%3Crect x='0' y='0' width='1' height='1' fill='rgba(0,0,0,0.05)'/%3E%3Crect x='2' y='2' width='1' height='1' fill='rgba(255,255,255,0.02)'/%3E%3C/svg%3E");
  opacity: 0.8;
}
.pk-felt::after {
  content: '';
  position: absolute;
  top: -40%; left: 10%; width: 60%; height: 80%;
  background: radial-gradient(ellipse, rgba(80,160,90,0.15) 0%, transparent 70%);
  pointer-events: none;
}

.pk-content {
  position: absolute; inset: 0;
  display: flex;
  flex-direction: column;
  padding: 10px;
  z-index: 2;
}

/* ── Opponent area: top, small ── */
.pk-opponent-area {
  display: flex; align-items: center; gap: 8px;
  flex-wrap: wrap; padding: 0 2px; z-index: 5;
  min-height: 28px;
}
/* Hide me-slot in portrait (hero cards already shown separately) */
.pk-me-slot { display: none; }
.pk-opp-slot {
  display: flex; align-items: center; gap: 4px;
  opacity: 0.85;
}
.pk-opp-slot.fold-overlay { opacity: 0.3; }
.pk-opp-label {
  color: rgba(255,255,200,0.7);
  font-size: 11px; font-weight: 700;
  text-shadow: 0 1px 3px rgba(0,0,0,0.6);
  max-width: 50px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.pk-opp-chips {
  font-size: 10px; color: #ffd700;
  text-shadow: 0 1px 2px rgba(0,0,0,0.5);
  font-weight: 700;
}
.pk-opp-bet {
  font-size: 10px; color: #ff9040;
  text-shadow: 0 1px 2px rgba(0,0,0,0.5);
  font-weight: 700;
}
.pk-opp-cards { display: flex; gap: 3px; }
.pk-opp-card {
  width: 26px; height: 37px;
  border-radius: 3px;
  display: flex; align-items: center; justify-content: center;
  position: relative; overflow: hidden;
  box-shadow: 0 1px 4px rgba(0,0,0,0.4);
}
.pk-opp-card.pk-card-back {
  background: linear-gradient(145deg, #3a2244, #1a0a22);
  border: 1px solid #6a4a7a;
}
.pk-opp-card.pk-card-back::before {
  content: '';
  position: absolute; inset: 2px;
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: 2px;
}
.pk-opp-card-pattern {
  width: 14px; height: 14px;
  background: repeating-linear-gradient(45deg, rgba(150,100,180,0.3), rgba(150,100,180,0.3) 2px, transparent 2px, transparent 5px);
  border-radius: 1px;
}
.pk-opp-card.pk-card-face {
  background: linear-gradient(145deg, #fff, #f0ece4);
  border: 1px solid #bbb;
  flex-direction: column;
  font-weight: 900;
}
.pk-opp-card .pk-small-rank { font-size: 10px; line-height: 1; }
.pk-opp-card .pk-small-suit { font-size: 9px; line-height: 1; }
.pk-opp-card.pk-red { color: #cc1111; }
.pk-opp-card.pk-black { color: #1a1a1a; }

.pk-opp-avatar {
  width: 26px; height: 26px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; transition: all 0.3s;
  flex-shrink: 0;
}
.pk-opp-avatar.active-turn {
  box-shadow: 0 0 0 2px #ffd700, 0 0 12px rgba(255,200,0,0.5);
  animation: pk-pulse 1.5s ease infinite;
}
@keyframes pk-pulse {
  0%, 100% { box-shadow: 0 0 0 2px #ffd700, 0 0 12px rgba(255,200,0,0.5); }
  50% { box-shadow: 0 0 0 3px #ffd700, 0 0 20px rgba(255,200,0,0.7); }
}

/* ── Community cards: top center ── */
.pk-community {
  display: flex; justify-content: center; gap: 5px;
  padding: 4px 0; z-index: 5; flex-wrap: wrap;
}
.pk-comm-card {
  width: 48px; height: 70px;
  border-radius: 5px;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  padding: 2px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.4);
  position: relative;
}
.pk-comm-card.pk-card-face {
  background: linear-gradient(145deg, #fff, #f0ece4);
  border: 1.5px solid #bbb;
  font-weight: 900;
}
.pk-comm-card.pk-card-back {
  background: linear-gradient(145deg, #3a2244, #1a0a22);
  border: 1.5px solid #6a4a7a;
}
.pk-comm-card .pk-comm-rank { font-size: 12px; line-height: 1; }
.pk-comm-card .pk-comm-suit { font-size: 16px; line-height: 1; }
.pk-comm-card.pk-red { color: #cc1111; }
.pk-comm-card.pk-black { color: #1a1a1a; }
.pk-comm-placeholder {
  width: 36px; height: 52px;
  border-radius: 4px;
  background: rgba(255,255,255,0.04);
  border: 1.5px dashed rgba(255,255,255,0.1);
}

/* ── My cards area: HERO, center ── */
.pk-my-area {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  position: relative;
  min-height: 0;
  z-index: 3;
}
.pk-card-glow {
  position: absolute;
  width: 80%; height: 80%;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  background: radial-gradient(ellipse, rgba(255,200,50,0.06) 0%, transparent 70%);
  pointer-events: none;
}

.pk-my-cards {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 18px;
  margin-bottom: 10px;
  perspective: 800px;
  width: 100%;
}

/* Large hero card */
.pk-hero-card {
  width: 180px; height: 260px;
  background: linear-gradient(145deg, #fff 0%, #f0ece4 50%, #e8e0d0 100%);
  border-radius: 14px;
  border: 2.5px solid #bbb;
  box-shadow:
    0 10px 30px rgba(0,0,0,0.5),
    0 3px 6px rgba(0,0,0,0.3),
    inset 0 1px 0 rgba(255,255,255,0.8);
  position: relative;
  overflow: hidden;
  transition: transform 0.3s ease;
}
.pk-hero-card:nth-child(1) { transform: rotate(-3deg); }
.pk-hero-card:nth-child(2) { transform: rotate(2deg); }

.pk-hero-inner {
  position: absolute; inset: 6px;
  border: 1px solid rgba(0,0,0,0.06);
  border-radius: 10px;
  display: flex;
  flex-direction: column;
  padding: 8px;
}
.pk-hero-corner {
  display: flex;
  flex-direction: column;
  align-items: center;
  line-height: 1;
}
.pk-hero-corner .pk-hero-rank {
  font-family: 'Oswald', 'Black Han Sans', sans-serif;
  font-size: 36px;
  font-weight: 700;
}
.pk-hero-corner .pk-hero-suit-sm {
  font-size: 22px;
  margin-top: -2px;
}
.pk-hero-corner.pk-corner-bottom {
  position: absolute;
  bottom: 8px; right: 10px;
  transform: rotate(180deg);
}
.pk-hero-center {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 80px;
  opacity: 0.9;
}
.pk-hero-card.pk-red { color: #cc1111; }
.pk-hero-card.pk-black { color: #1a1a1a; }

/* Hero card back (facedown) */
.pk-hero-card.pk-card-back {
  background: linear-gradient(145deg, #3a2244, #1a0a22);
  border-color: #6a4a7a;
}
.pk-hero-card.pk-card-back::before {
  content: '';
  position: absolute; inset: 8px;
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: 8px;
}
.pk-hero-back-pattern {
  width: 80px; height: 80px;
  background: repeating-linear-gradient(45deg, rgba(150,100,180,0.3), rgba(150,100,180,0.3) 4px, transparent 4px, transparent 9px);
  border-radius: 6px;
  position: absolute; top: 50%; left: 50%; transform: translate(-50%,-50%);
}

/* Hand name */
.pk-hand-name {
  font-family: 'Oswald', 'Black Han Sans', sans-serif;
  font-size: 32px;
  color: #ffe066;
  text-shadow:
    0 0 24px rgba(255,200,0,0.3),
    0 3px 6px rgba(0,0,0,0.8);
  letter-spacing: 5px;
  text-align: center;
  min-height: 28px;
  font-weight: 700;
  text-transform: uppercase;
}

/* ── Top bar: money + round + close ── */
.pk-top-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 6px;
  z-index: 10;
}
.pk-top-info {
  display: flex;
  gap: 6px;
  flex: 1;
}
.pk-chip-display, .pk-pot-display {
  display: flex;
  align-items: center;
  gap: 5px;
  background: linear-gradient(180deg, rgba(40,28,14,0.9), rgba(20,12,4,0.95));
  border: 1.5px solid #8a7a50;
  border-radius: 20px;
  padding: 5px 12px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.4), inset 0 1px 0 rgba(255,255,255,0.05);
}
.pk-chip-icon { font-size: 14px; }
.pk-chip-value {
  color: #ffe680;
  font-family: 'Oswald', 'Black Han Sans', sans-serif;
  font-size: 16px;
  font-weight: 700;
  text-shadow: 0 1px 3px rgba(0,0,0,0.5);
}
.pk-pot-display {
  border-color: #aa8a30;
  background: linear-gradient(180deg, rgba(60,40,10,0.9), rgba(30,20,4,0.95));
}
.pk-pot-label {
  color: #dda020;
  font-family: 'Oswald', 'Black Han Sans', sans-serif;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1px;
}
.pk-pot-value {
  color: #ffd700;
  font-family: 'Oswald', 'Black Han Sans', sans-serif;
  font-size: 18px;
  font-weight: 700;
  text-shadow: 0 0 8px rgba(255,200,0,0.3), 0 1px 3px rgba(0,0,0,0.5);
}
.pk-round-badge {
  background: rgba(0,0,0,0.5);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 14px;
  padding: 4px 10px;
  color: rgba(255,255,255,0.6);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1px;
  white-space: nowrap;
}
.pk-close-btn {
  background: rgba(0,0,0,0.3);
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: 50%;
  width: 28px; height: 28px;
  color: rgba(255,255,255,0.5);
  font-size: 14px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
  flex-shrink: 0;
}
.pk-close-btn:hover {
  background: rgba(255,50,50,0.3);
  color: #fff;
}

/* ── Bottom panel: actions / raise ── */
.pk-bottom-panel {
  z-index: 5;
  padding: 0 2px 4px;
}
.pk-actions {
  display: flex;
  gap: 5px;
}
.pk-action-btn {
  flex: 1;
  padding: 12px 4px;
  border: none;
  border-radius: 8px;
  font-family: 'Noto Sans KR', sans-serif;
  font-size: 14px;
  font-weight: 900;
  cursor: pointer;
  text-align: center;
  letter-spacing: 2px;
  transition: all 0.12s;
  position: relative;
  overflow: hidden;
  min-height: 44px;
}
.pk-action-btn::before {
  content: '';
  position: absolute; top: 0; left: 0; right: 0; height: 50%;
  background: linear-gradient(180deg, rgba(255,255,255,0.1), transparent);
  pointer-events: none;
}
.pk-action-btn:active { transform: scale(0.95); }
.pk-action-btn:disabled { opacity: 0.3; cursor: not-allowed; }

.pk-btn-call {
  background: linear-gradient(180deg, #2a8a3a, #1a6a28, #0e4a18);
  color: #fff;
  border: 1.5px solid #4aba5a;
  box-shadow: 0 3px 8px rgba(0,0,0,0.3), inset 0 -2px 3px rgba(0,0,0,0.2);
  text-shadow: 0 1px 2px rgba(0,0,0,0.5);
}
.pk-btn-check {
  background: linear-gradient(180deg, #2a8a3a, #1a6a28, #0e4a18);
  color: #fff;
  border: 1.5px solid #4aba5a;
  box-shadow: 0 3px 8px rgba(0,0,0,0.3), inset 0 -2px 3px rgba(0,0,0,0.2);
  text-shadow: 0 1px 2px rgba(0,0,0,0.5);
}
.pk-btn-raise {
  background: linear-gradient(180deg, #3a6aaa, #2a4a8a, #1a3a6a);
  color: #fff;
  border: 1.5px solid #5a8aca;
  box-shadow: 0 3px 8px rgba(0,0,0,0.3), inset 0 -2px 3px rgba(0,0,0,0.2);
  text-shadow: 0 1px 2px rgba(0,0,0,0.5);
}
.pk-btn-allin {
  background: linear-gradient(180deg, #cc2020, #a01010, #7a0808);
  color: #fff;
  border: 1.5px solid #ee4040;
  box-shadow: 0 3px 8px rgba(0,0,0,0.3), inset 0 -2px 3px rgba(0,0,0,0.2);
  text-shadow: 0 1px 2px rgba(0,0,0,0.5);
}
.pk-btn-fold {
  background: linear-gradient(180deg, #5a4a30, #3a2a18, #2a1a0a);
  color: #ccc;
  border: 1.5px solid #8a7a50;
  box-shadow: 0 3px 8px rgba(0,0,0,0.3), inset 0 -2px 3px rgba(0,0,0,0.2);
  text-shadow: 0 1px 2px rgba(0,0,0,0.5);
}

/* Raise panel — replaces action buttons when active */
.pk-raise-area {
  display: none;
  flex-direction: column;
  gap: 8px;
  background: linear-gradient(180deg, rgba(30,40,70,0.95), rgba(15,20,40,0.98));
  border: 1.5px solid #5a8aca;
  border-radius: 10px;
  padding: 12px 14px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.5), 0 0 20px rgba(80,120,200,0.15);
}
.pk-raise-area.visible { display: flex; }
.pk-raise-amount-row {
  text-align: center;
}
.pk-raise-amount {
  font-family: 'Oswald', 'Black Han Sans', sans-serif;
  font-size: 22px;
  color: #8abaff;
  text-shadow: 0 0 8px rgba(100,160,255,0.3);
  letter-spacing: 1px;
}
.pk-raise-row {
  display: flex;
  align-items: center;
  gap: 0;
}
.pk-raise-slider {
  flex: 1; -webkit-appearance: none; height: 6px;
  border-radius: 3px; background: rgba(255,255,255,0.15); outline: none;
}
.pk-raise-slider::-webkit-slider-thumb {
  -webkit-appearance: none; width: 24px; height: 24px;
  border-radius: 50%;
  background: linear-gradient(180deg, #6a9ada, #3a6aba);
  border: 2px solid #8abaff;
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(0,0,0,0.3);
}
.pk-raise-btns {
  display: flex;
  gap: 6px;
}
.pk-raise-btns .pk-action-btn {
  min-height: 40px;
  font-size: 14px;
}

/* ===== RESULT OVERLAY ===== */
.result-overlay {
  display: none; position: fixed; top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(10,10,18,0.95); z-index: 100;
  flex-direction: column; align-items: center; justify-content: center;
  padding: 24px; gap: 16px;
}
.result-overlay.active { display: flex; }
.result-title { font-family: 'Black Han Sans', sans-serif; font-size: 36px; }
.result-hand { font-size: 18px; color: var(--accent2); font-weight: 700; }
.result-cards { display: flex; gap: 8px; }
.result-pot { font-family: 'Black Han Sans', sans-serif; font-size: 24px; color: var(--gold); }

.winner-info {
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  padding: 16px; background: var(--bg-card); border-radius: var(--radius);
  width: 100%; max-width: 340px;
}

/* ===== AD BANNER ===== */
.ad-banner {
  width: 100%; max-width: 380px; height: 60px;
  background: var(--bg-card); border: 1px dashed rgba(255,255,255,0.1);
  border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  color: var(--text-dim); font-size: 12px; flex-shrink: 0;
}

/* ===== BUILD FOOTER ===== */
.build-footer {
  margin-top: 12px;
  padding: 8px 0;
  text-align: center;
  font-size: 10px;
  color: rgba(255,255,255,0.2);
  letter-spacing: 0.5px;
  flex-shrink: 0;
}

/* ===== TOAST ===== */
.toast {
  position: fixed; top: 20px; left: 50%;
  transform: translateX(-50%) translateY(-100px);
  background: var(--bg-surface); border: 1px solid rgba(255,255,255,0.1);
  padding: 12px 24px; border-radius: var(--radius-sm);
  font-size: 14px; font-weight: 700; z-index: 200;
  transition: transform 0.3s ease; white-space: nowrap;
  max-width: 90vw; overflow: hidden; text-overflow: ellipsis;
}
.toast.show { transform: translateX(-50%) translateY(0); }

.spinner {
  width: 32px; height: 32px;
  border: 3px solid var(--bg-surface); border-top-color: var(--accent);
  border-radius: 50%; animation: spin 0.8s linear infinite; margin: 0 auto;
}
@keyframes spin { to { transform: rotate(360deg); } }

::-webkit-scrollbar { width: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 2px; }

/* ===== DEBUG TOGGLE ===== */
.btn-debug-toggle {
  max-width: 380px;
  background: rgba(255,255,255,0.05);
  color: var(--text-dim);
  border: 1px dashed rgba(255,255,255,0.15);
  font-size: 13px;
  padding: 10px 16px;
  margin-top: 4px;
}
.btn-debug-toggle.active {
  background: rgba(255,107,53,0.15);
  color: var(--accent);
  border-color: var(--accent);
}
.debug-game-selector {
  max-width: 380px;
  width: 100%;
  background: var(--bg-card);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: var(--radius);
  padding: 16px;
  animation: fadeIn 0.2s ease;
}
.debug-selector-title {
  font-size: 13px;
  color: var(--text-dim);
  text-align: center;
  margin-bottom: 12px;
  font-weight: 700;
}
.debug-game-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}
.debug-game-btn {
  background: var(--bg-surface);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: var(--radius-sm);
  color: var(--text);
  padding: 10px 6px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.15s;
}
.debug-game-btn:active {
  transform: scale(0.95);
  background: rgba(255,107,53,0.2);
  border-color: var(--accent);
}
@keyframes fadeIn { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: translateY(0); } }

/* ===== ECONOMY BAR ===== */
.economy-bar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-top: 12px;
  width: 100%;
}
.eco-item {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--bg-surface);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 20px;
  padding: 6px 14px;
  font-size: 14px;
  font-weight: 700;
}
.eco-item.eco-sm {
  padding: 4px 10px;
  font-size: 12px;
  border-radius: 16px;
}
.eco-icon { font-size: 16px; }
.eco-sm .eco-icon { font-size: 13px; }
.eco-gold .eco-value { color: var(--gold); }
.eco-energy .eco-value { color: #76ff03; }
.eco-diamond .eco-value { color: #b388ff; }
.eco-countdown {
  font-size: 10px;
  color: var(--text-dim);
  margin-left: 2px;
}
.lobby-currency-bar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}

/* ===== LANDSCAPE MODE OVERLAY ===== */
#landscapeOverlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: rgba(10, 10, 18, 0.97);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
}

.landscape-prompt {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  text-align: center;
  padding: 32px;
}

.landscape-icon {
  font-size: 72px;
  animation: landscapeRotate 2.5s ease-in-out infinite;
  line-height: 1.2;
}

@keyframes landscapeRotate {
  0%, 100% { transform: rotate(0deg); }
  20% { transform: rotate(90deg); }
  40% { transform: rotate(90deg); }
  60% { transform: rotate(0deg); }
  80% { transform: rotate(0deg); }
}

.landscape-prompt p {
  font-family: 'Black Han Sans', sans-serif;
  font-size: 22px;
  color: #e8e8f0;
  letter-spacing: 1px;
}

.landscape-sub {
  font-family: 'Noto Sans KR', sans-serif !important;
  font-size: 14px !important;
  color: #7a7a9a !important;
  font-weight: 400;
}

/* ===== PORTRAIT OVERLAY ===== */
#portraitOverlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: rgba(10, 10, 18, 0.97);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
}

.portrait-prompt {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  text-align: center;
  padding: 32px;
}

.portrait-icon {
  font-size: 72px;
  animation: portraitRotate 2.5s ease-in-out infinite;
  line-height: 1.2;
}

@keyframes portraitRotate {
  0%, 100% { transform: rotate(90deg); }
  20% { transform: rotate(0deg); }
  40% { transform: rotate(0deg); }
  60% { transform: rotate(90deg); }
  80% { transform: rotate(90deg); }
}

.portrait-prompt p {
  font-family: 'Black Han Sans', sans-serif;
  font-size: 22px;
  color: #e8e8f0;
  letter-spacing: 1px;
}

.portrait-sub {
  font-family: 'Noto Sans KR', sans-serif !important;
  font-size: 14px !important;
  color: #7a7a9a !important;
  font-weight: 400;
}

/* ===== SAFE-AREA (notch / home indicator) ===== */
@supports (padding: env(safe-area-inset-top)) {
  #mainMenu {
    padding:
      max(24px, env(safe-area-inset-top))
      max(24px, env(safe-area-inset-right))
      max(24px, env(safe-area-inset-bottom))
      max(24px, env(safe-area-inset-left));
  }

  .screen {
    padding-top: env(safe-area-inset-top);
  }

}
