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

@font-face {
  font-family: 'GameFont';
  src: local('Impact'), local('Arial Black'), local('sans-serif');
}

:root {
  --bg-dark: #1a0a2e;
  --bg-card: #2a1a4e;
  --accent: #ff6b35;
  --accent-glow: #ff8c5a;
  --danger: #ff2d55;
  --success: #34c759;
  --text: #ffffff;
  --text-dim: #a0a0c0;
  --gold: #ffd700;
  --silver: #c0c0c0;
  --bronze: #cd7f32;
}

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: var(--bg-dark);
  font-family: 'Impact', 'Arial Black', sans-serif;
  color: var(--text);
  touch-action: none;
}

#game-container {
  position: relative;
  width: 100%;
  height: 100%;
  max-width: 500px;
  margin: 0 auto;
}

#game-canvas {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 1;
  pointer-events: none;
}

#game-canvas.interactive {
  pointer-events: auto;
}

/* Screens */
.screen {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 10;
  padding: 20px;
  padding-top: env(safe-area-inset-top, 20px);
  padding-bottom: env(safe-area-inset-bottom, 20px);
}

.screen.active {
  display: flex;
}

/* Title Screen */
#title-screen {
  background: linear-gradient(180deg, #1a0a2e 0%, #2d1b69 50%, #1a0a2e 100%);
  gap: 0;
  padding: 0;
  justify-content: flex-start;
}

#title-screen.active {
  display: block;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

#title-screen > * {
  margin-left: auto;
  margin-right: auto;
}

.title-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 16px 20px;
  padding-top: env(safe-area-inset-top, 16px);
  padding-bottom: env(safe-area-inset-bottom, 20px);
  min-height: 100%;
  width: 100%;
  max-width: 400px;
  margin: 0 auto;
}

.title-wobble {
  text-align: center;
  animation: titleBounce 2s ease-in-out infinite;
}

.title-wobble h1 {
  font-size: 56px;
  line-height: 0.9;
  letter-spacing: 4px;
  background: linear-gradient(180deg, #ff6b35, #ff2d55);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  text-shadow: none;
  filter: drop-shadow(0 4px 8px rgba(255, 107, 53, 0.4));
}

.subtitle {
  font-family: 'Georgia', serif;
  font-style: italic;
  font-weight: normal;
  color: var(--text-dim);
  font-size: 15px;
  margin-top: 4px;
  letter-spacing: 2px;
}

@keyframes titleBounce {
  0%, 100% { transform: translateY(0) rotate(-1deg); }
  50% { transform: translateY(-10px) rotate(1deg); }
}

/* Buttons */
.btn {
  font-family: inherit;
  font-size: 22px;
  letter-spacing: 3px;
  padding: 16px 48px;
  border: none;
  border-radius: 50px;
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s;
  min-width: 220px;
}

.btn:active {
  transform: scale(0.95);
}

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

.btn-secondary {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text-dim);
  border: 2px solid rgba(255, 255, 255, 0.2);
}

.pulse {
  animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { box-shadow: 0 4px 20px rgba(255, 107, 53, 0.5); }
  50% { box-shadow: 0 4px 40px rgba(255, 107, 53, 0.8); }
}

/* Body Part Select */
#select-screen {
  background: linear-gradient(180deg, #1a0a2e, #2d1b69);
  gap: 20px;
}

#select-screen h2 {
  font-size: 28px;
  letter-spacing: 3px;
  color: var(--accent);
}

.body-parts-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  width: 100%;
  max-width: 360px;
}

.body-part-card {
  background: var(--bg-card);
  border: 2px solid rgba(255, 255, 255, 0.1);
  border-radius: 16px;
  padding: 20px 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  transition: transform 0.15s, border-color 0.15s;
  font-family: inherit;
  color: var(--text);
}

.body-part-card:active {
  transform: scale(0.95);
  border-color: var(--accent);
}

.card-icon {
  font-size: 40px;
}

.card-label {
  font-size: 20px;
  letter-spacing: 2px;
}

.card-diff {
  font-size: 12px;
  letter-spacing: 1px;
  padding: 2px 10px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.1);
  color: var(--text-dim);
}

.body-part-card[data-part="beard"] .card-diff { background: rgba(52, 199, 89, 0.3); color: var(--success); }
.body-part-card[data-part="legs"] .card-diff { background: rgba(255, 214, 0, 0.3); color: var(--gold); }
.body-part-card[data-part="arms"] .card-diff { background: rgba(255, 107, 53, 0.3); color: var(--accent); }
.body-part-card[data-part="back"] .card-diff { background: rgba(255, 45, 85, 0.3); color: var(--danger); }

/* HUD */
#hud {
  pointer-events: none;
  z-index: 15;
  justify-content: space-between;
  background: none;
}

#hud.active {
  display: flex;
}

.hud-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  width: 100%;
  padding: 10px;
}

.hud-score, .hud-time {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.hud-score .label, .hud-time .label {
  font-size: 11px;
  color: var(--text-dim);
  letter-spacing: 2px;
}

#hud-score-value {
  font-size: 36px;
  color: var(--gold);
  text-shadow: 0 2px 10px rgba(255, 215, 0, 0.5);
}

#hud-time-value {
  font-size: 28px;
}

.hud-combo {
  animation: comboPopIn 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

#hud-combo-value {
  font-size: 32px;
  color: var(--accent);
  text-shadow: 0 0 20px rgba(255, 107, 53, 0.8);
}

@keyframes comboPopIn {
  0% { transform: scale(0); }
  100% { transform: scale(1); }
}

.hud-bottom {
  width: 100%;
  padding: 10px;
}

.health-bar-container {
  width: 100%;
}

.health-bar-label {
  font-size: 10px;
  letter-spacing: 2px;
  color: var(--text-dim);
  margin-bottom: 4px;
  text-align: center;
}

.health-bar-bg {
  width: 100%;
  height: 12px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 6px;
  overflow: hidden;
}

.health-bar-fill {
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, var(--danger), var(--success));
  border-radius: 6px;
  transition: width 0.3s;
}

/* Game Over */
#gameover-screen {
  background: rgba(26, 10, 46, 0.97);
  padding: 0;
  display: none;
}

#gameover-screen.active {
  display: block;
}

.go-scroll {
  width: 100%;
  height: 100%;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  padding: 24px 20px;
  padding-top: env(safe-area-inset-top, 24px);
  padding-bottom: env(safe-area-inset-bottom, 30px);
  touch-action: pan-y;
}

.go-funny-msg {
  font-family: 'Georgia', serif;
  font-weight: normal;
  font-style: italic;
  font-size: 14px;
  color: #a0a0c0;
  text-align: center;
  opacity: 0.8;
}

#gameover-screen h2 {
  font-size: 40px;
  color: var(--danger);
  text-shadow: 0 0 30px rgba(255, 45, 85, 0.5);
  animation: shakeIn 0.5s ease-out;
}

@keyframes shakeIn {
  0% { transform: scale(2) rotate(-5deg); opacity: 0; }
  50% { transform: scale(1.1) rotate(3deg); }
  100% { transform: scale(1) rotate(0); opacity: 1; }
}

.go-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  width: 100%;
  max-width: 320px;
}

.go-stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 12px;
  padding: 10px 12px;
}

.go-stat-label {
  font-size: 10px;
  letter-spacing: 1px;
  color: var(--text-dim);
}

.go-stat-value {
  font-size: 24px;
  color: var(--accent);
}

#new-highscore {
  text-align: center;
}

#new-highscore h3 {
  font-size: 24px;
  color: var(--gold);
  text-shadow: 0 0 20px rgba(255, 215, 0, 0.5);
  animation: pulse 1s ease-in-out infinite;
  margin-bottom: 10px;
}

#player-name {
  font-family: inherit;
  font-size: 20px;
  padding: 12px 20px;
  border: 2px solid var(--accent);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.1);
  color: white;
  text-align: center;
  outline: none;
  width: 200px;
  margin-bottom: 10px;
}

/* Leaderboard */
#leaderboard-screen {
  background: linear-gradient(180deg, #1a0a2e, #2d1b69);
  gap: 20px;
}

#leaderboard-screen h2 {
  font-size: 32px;
  color: var(--gold);
  letter-spacing: 3px;
}

.score-list {
  width: 100%;
  max-width: 360px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 50vh;
  overflow-y: auto;
}

.score-entry {
  display: flex;
  align-items: center;
  padding: 12px 16px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 12px;
  gap: 12px;
}

.score-rank {
  font-size: 20px;
  width: 36px;
  text-align: center;
}

.score-rank.gold { color: var(--gold); }
.score-rank.silver { color: var(--silver); }
.score-rank.bronze { color: var(--bronze); }

.score-name {
  flex: 1;
  font-size: 18px;
  letter-spacing: 1px;
}

.score-value {
  font-size: 22px;
  color: var(--accent);
}

/* Personal best display on game over */
.go-personal-best {
  text-align: center;
}

.go-personal-best h3 {
  font-size: 24px;
  color: var(--gold);
  text-shadow: 0 0 20px rgba(255, 215, 0, 0.5);
  animation: pulse 1s ease-in-out infinite;
  margin: 0;
}

.go-prev-label {
  font-size: 11px;
  letter-spacing: 2px;
  color: var(--text-dim);
  display: block;
}

.go-prev-value {
  font-size: 22px;
  color: var(--text-dim);
}

/* Game Over inline leaderboard */
/* Rewarded ad button */
.btn-reward {
  font-family: inherit;
  font-size: 14px;
  letter-spacing: 2px;
  padding: 12px 28px;
  border: 2px solid var(--gold);
  border-radius: 50px;
  background: rgba(255, 215, 0, 0.1);
  color: var(--gold);
  cursor: pointer;
  min-width: 220px;
  transition: transform 0.15s;
}

.btn-reward:active {
  transform: scale(0.95);
  background: rgba(255, 215, 0, 0.2);
}

.go-divider {
  width: 60%;
  height: 1px;
  background: rgba(255, 255, 255, 0.1);
  margin: 6px 0;
}

.go-lb-heading {
  font-size: 22px;
  color: var(--gold);
  letter-spacing: 3px;
}

.go-lb-tabs {
  width: 100%;
  max-width: 360px;
}

.go-score-list {
  width: 100%;
  max-width: 360px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-height: 100px;
}

/* Spacer so content doesn't hide behind fixed bottom bar */
.go-spacer {
  height: 80px;
  flex-shrink: 0;
}

/* Fixed bottom bar */
.go-bottom-bar {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  display: flex;
  gap: 10px;
  padding: 12px 20px;
  padding-bottom: max(12px, env(safe-area-inset-bottom));
  background: linear-gradient(transparent, rgba(26, 10, 46, 0.95) 30%);
  z-index: 20;
}

.go-bottom-bar .btn {
  flex: 1;
  min-width: 0;
  padding: 14px 16px;
  font-size: 16px;
}

/* Score entry with date */
.score-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.score-date {
  font-family: 'Georgia', serif;
  font-weight: normal;
  font-size: 10px;
  color: rgba(160, 160, 190, 0.6);
  letter-spacing: 0.5px;
}

/* Highlighted player entry */
.score-highlight {
  background: rgba(255, 107, 53, 0.15) !important;
  border: 1px solid rgba(255, 107, 53, 0.3);
}

/* Game over leaderboard */
.go-leaderboard {
  width: 100%;
  max-width: 360px;
  max-height: 45vh;
  overflow-y: auto;
}

.go-lb-title {
  font-size: 18px;
  letter-spacing: 3px;
  color: var(--gold);
  text-align: center;
  margin-bottom: 10px;
}

.go-lb-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.go-lb-list .score-entry {
  padding: 10px 14px;
  font-size: 14px;
}

.go-lb-list .score-value {
  font-size: 18px;
}

.go-lb-list .score-rank {
  font-size: 16px;
}

/* ---- STORE ---- */
#store-screen {
  background: linear-gradient(180deg, #1a0a2e 0%, #2d1b69 50%, #1a0a2e 100%);
  gap: 12px;
  padding-top: 20px;
}

.store-header {
  text-align: center;
}

.store-header h2 {
  font-size: 32px;
  color: var(--accent);
  letter-spacing: 4px;
  margin-bottom: 6px;
}

.store-balance-display {
  font-size: 20px;
  color: var(--gold);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.store-tabs {
  display: flex;
  gap: 3px;
  width: 100%;
  max-width: 400px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 10px;
  padding: 3px;
}

.store-tab {
  flex: 1;
  font-family: inherit;
  font-size: 9px;
  letter-spacing: 1px;
  padding: 8px 2px;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: var(--text-dim);
  cursor: pointer;
  transition: background 0.2s, color 0.2s;
}

.store-tab.active {
  background: rgba(255, 107, 53, 0.25);
  color: var(--accent);
}

.store-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  width: 100%;
  max-width: 400px;
  max-height: 55vh;
  overflow-y: auto;
  padding: 4px;
}

.store-card {
  background: rgba(255, 255, 255, 0.05);
  border: 2px solid rgba(255, 255, 255, 0.08);
  border-radius: 14px;
  padding: 12px 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  transition: border-color 0.2s;
}

.store-preview {
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.store-swatch {
  width: 40px;
  height: 40px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.music-swatch {
  font-size: 24px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 50%;
}

.bg-swatch {
  border-radius: 6px;
  overflow: hidden;
}

.store-item-name {
  font-size: 11px;
  letter-spacing: 1px;
  color: var(--text);
  text-align: center;
}

.store-btn {
  font-family: inherit;
  font-size: 10px;
  letter-spacing: 1.5px;
  padding: 6px 12px;
  border: none;
  border-radius: 20px;
  cursor: pointer;
  transition: transform 0.15s;
  width: 100%;
}

.store-btn:active {
  transform: scale(0.95);
}

.store-btn.buy {
  background: linear-gradient(135deg, var(--accent), #ff2d55);
  color: white;
}

.store-btn.equip {
  background: rgba(255, 255, 255, 0.15);
  color: var(--text);
}

.store-btn.equipped {
  background: rgba(52, 199, 89, 0.2);
  color: var(--success);
  cursor: default;
}

.store-btn.locked {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-dim);
  opacity: 0.5;
  cursor: default;
}

/* Leaderboard tabs */
.lb-tabs {
  display: flex;
  gap: 4px;
  width: 100%;
  max-width: 360px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 12px;
  padding: 4px;
}

.lb-tab {
  flex: 1;
  font-family: inherit;
  font-size: 11px;
  letter-spacing: 1.5px;
  padding: 10px 4px;
  border: none;
  border-radius: 10px;
  background: transparent;
  color: var(--text-dim);
  cursor: pointer;
  transition: background 0.2s, color 0.2s;
}

.lb-tab.active {
  background: rgba(255, 107, 53, 0.25);
  color: var(--accent);
}

.lb-tab:active {
  opacity: 0.7;
}

.score-empty {
  text-align: center;
  color: var(--text-dim);
  font-size: 16px;
  padding: 40px;
  font-style: italic;
  font-family: 'Georgia', serif;
  font-weight: normal;
}

/* Back icon SVG */
.back-icon svg {
  display: block;
}

/* Locked level cards */
.body-part-card.locked {
  opacity: 0.4;
  pointer-events: none;
  position: relative;
}

.body-part-card.locked::after {
  content: '🔒';
  position: absolute;
  top: 8px;
  right: 8px;
  font-size: 18px;
}

.card-unlock-req {
  font-size: 10px;
  color: var(--text-dim);
  letter-spacing: 0.5px;
  margin-top: 2px;
}

.body-part-card.just-unlocked {
  animation: unlockPop 0.6s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  border-color: var(--gold);
  box-shadow: 0 0 20px rgba(255, 215, 0, 0.4);
}

@keyframes unlockPop {
  0% { transform: scale(0.8); opacity: 0.5; }
  50% { transform: scale(1.1); }
  100% { transform: scale(1); opacity: 1; }
}

/* Tutorial Screen */
#tutorial-screen {
  background: rgba(26, 10, 46, 0.97);
  gap: 10px;
}

.tutorial-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  max-width: 340px;
  text-align: center;
}

.tutorial-content h2 {
  font-size: 36px;
  color: var(--accent);
  letter-spacing: 4px;
}

.tutorial-text {
  font-family: 'Georgia', serif;
  font-weight: normal;
  font-size: 18px;
  line-height: 1.5;
  color: var(--text-dim);
}

.yank {
  color: var(--accent);
  font-family: 'Impact', 'Arial Black', sans-serif;
  font-size: 22px;
  letter-spacing: 2px;
}

.tutorial-warn {
  font-family: 'Georgia', serif;
  font-weight: normal;
  font-size: 14px;
  color: var(--danger);
  line-height: 1.4;
  opacity: 0.8;
}

.tutorial-demo {
  position: relative;
  width: 120px;
  height: 140px;
  margin: 10px 0;
}

.demo-hair {
  position: absolute;
  left: 50%;
  top: 30%;
  width: 3px;
  height: 40px;
  background: #4a3a2a;
  border-radius: 2px;
  transform: translateX(-50%) rotate(-5deg);
  transform-origin: bottom center;
}

.demo-hair::after {
  content: '';
  position: absolute;
  bottom: -4px;
  left: 50%;
  transform: translateX(-50%);
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: rgba(0,0,0,0.2);
}

.demo-finger {
  position: absolute;
  font-size: 44px;
  animation: swipeDemo 2s ease-in-out infinite;
  filter: drop-shadow(0 4px 8px rgba(0,0,0,0.3));
}

@keyframes swipeDemo {
  0%   { left: 35%; top: 55%; opacity: 0; transform: rotate(0deg); }
  15%  { left: 38%; top: 40%; opacity: 1; transform: rotate(0deg); }
  30%  { left: 38%; top: 38%; opacity: 1; transform: rotate(-5deg); }
  55%  { left: 60%; top: 10%; opacity: 1; transform: rotate(-20deg) scale(1.1); }
  70%  { left: 65%; top: 5%;  opacity: 0.5; transform: rotate(-25deg) scale(1); }
  100% { left: 35%; top: 55%; opacity: 0; transform: rotate(0deg); }
}

/* Username Screen */
#username-screen {
  background: linear-gradient(180deg, #1a0a2e 0%, #2d1b69 50%, #1a0a2e 100%);
  gap: 10px;
}

.username-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  max-width: 320px;
  text-align: center;
}

.username-content h2 {
  font-size: 32px;
  color: var(--accent);
  letter-spacing: 3px;
}

.username-subtitle {
  font-family: 'Georgia', serif;
  font-weight: normal;
  font-style: italic;
  color: var(--text-dim);
  font-size: 16px;
}

#username-input {
  font-family: inherit;
  font-size: 24px;
  padding: 14px 24px;
  border: 2px solid rgba(255, 255, 255, 0.2);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.08);
  color: white;
  text-align: center;
  outline: none;
  width: 100%;
  letter-spacing: 2px;
  transition: border-color 0.3s;
}

#username-input:focus {
  border-color: var(--accent);
}

.username-status {
  font-size: 14px;
  min-height: 20px;
  letter-spacing: 1px;
}

.username-status.available {
  color: var(--success);
}

.username-status.taken {
  color: var(--danger);
}

.username-status.checking {
  color: var(--text-dim);
}

/* HUD Pluck Bucks */
.hud-bucks {
  display: flex;
  align-items: center;
  gap: 4px;
  background: rgba(255, 215, 0, 0.15);
  padding: 4px 10px;
  border-radius: 20px;
}

#hud-bucks-value {
  font-size: 18px;
  color: var(--gold);
}

.bucks-icon {
  font-size: 10px;
  color: var(--gold);
  opacity: 0.7;
  letter-spacing: 1px;
}

/* Title balance */
.title-balance {
  font-size: 16px;
  color: var(--gold);
  letter-spacing: 1px;
  display: flex;
  align-items: center;
  gap: 6px;
}

/* Game over Pluck Bucks breakdown */
.go-bucks-breakdown {
  width: 100%;
  max-width: 280px;
  background: rgba(255, 215, 0, 0.08);
  border-radius: 12px;
  padding: 12px 16px;
}

.go-bucks-title {
  font-size: 11px;
  letter-spacing: 2px;
  color: var(--gold);
  text-align: center;
  margin-bottom: 8px;
}

.go-bucks-row {
  display: flex;
  justify-content: space-between;
  font-family: 'Georgia', serif;
  font-weight: normal;
  font-size: 14px;
  color: var(--text-dim);
  padding: 2px 0;
}

.go-bucks-total {
  display: flex;
  justify-content: space-between;
  font-size: 18px;
  color: var(--gold);
  padding-top: 6px;
  margin-top: 6px;
  border-top: 1px solid rgba(255, 215, 0, 0.2);
}

/* HUD username display */
.hud-username {
  text-align: center;
  font-size: 12px;
  color: var(--text-dim);
  letter-spacing: 1px;
}

/* Welcome / Splash Screen */
#welcome-screen {
  background: linear-gradient(180deg, #1a0a2e 0%, #2d1b69 40%, #1a0a2e 100%);
  gap: 0;
}

.welcome-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 28px;
  max-width: 360px;
  width: 100%;
  padding: 20px;
}

.welcome-hero {
  text-align: center;
}

.welcome-title {
  font-size: 64px;
  line-height: 0.9;
  letter-spacing: 4px;
  background: linear-gradient(180deg, #ff6b35, #ff2d55);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  filter: drop-shadow(0 4px 12px rgba(255, 107, 53, 0.4));
  margin-bottom: 12px;
  animation: titleBounce 2s ease-in-out infinite;
}

.welcome-tagline {
  font-family: 'Georgia', serif;
  font-weight: normal;
  font-style: italic;
  font-size: 17px;
  color: #a0a0c0;
  line-height: 1.4;
  letter-spacing: 1px;
}

.welcome-features {
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 100%;
}

.welcome-feat {
  display: flex;
  align-items: center;
  gap: 12px;
  background: rgba(255, 255, 255, 0.04);
  border-radius: 12px;
  padding: 12px 16px;
  font-family: 'Georgia', serif;
  font-weight: normal;
  font-size: 14px;
  color: #c0c0d0;
}

.welcome-feat span {
  font-size: 20px;
  flex-shrink: 0;
}

.welcome-buttons {
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: 100%;
}

.welcome-buttons .btn {
  width: 100%;
}

.welcome-note {
  font-family: 'Georgia', serif;
  font-weight: normal;
  font-size: 11px;
  color: rgba(160, 160, 190, 0.5);
  text-align: center;
}

/* Guest screen subtitle */
.auth-subtitle {
  font-family: 'Georgia', serif;
  font-weight: normal;
  font-style: italic;
  font-size: 15px;
  color: #a0a0c0;
}

/* Loading Screen */
#loading-screen {
  background: var(--bg-dark);
}

.loading-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 30px;
}

.loading-logo {
  font-size: 48px;
  line-height: 0.9;
  letter-spacing: 4px;
  background: linear-gradient(180deg, #ff6b35, #ff2d55);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  text-align: center;
}

.loading-spinner {
  width: 32px;
  height: 32px;
  border: 3px solid rgba(255,255,255,0.1);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Auth Screens (Register + Login) */
#register-screen,
#login-screen {
  background: linear-gradient(180deg, #1a0a2e 0%, #2d1b69 50%, #1a0a2e 100%);
  gap: 10px;
}

.auth-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  max-width: 320px;
  width: 100%;
  text-align: center;
}

.auth-content h2 {
  font-size: 28px;
  color: var(--accent);
  letter-spacing: 3px;
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: 100%;
}

.auth-input {
  font-family: 'Georgia', serif;
  font-size: 16px;
  padding: 14px 18px;
  border: 2px solid rgba(255, 255, 255, 0.15);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.06);
  color: white;
  outline: none;
  width: 100%;
  transition: border-color 0.3s;
}

.auth-input:focus {
  border-color: var(--accent);
}

.auth-input::placeholder {
  color: rgba(255, 255, 255, 0.3);
}

.auth-field-status {
  font-size: 12px;
  min-height: 16px;
  letter-spacing: 0.5px;
  margin-top: -6px;
  text-align: left;
  padding-left: 4px;
}

.auth-field-status.available { color: var(--success); }
.auth-field-status.taken { color: var(--danger); }
.auth-field-status.checking { color: var(--text-dim); }

.auth-checkbox {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  padding: 4px 0;
}

.auth-checkbox input[type="checkbox"] {
  display: none;
}

.checkmark {
  width: 22px;
  height: 22px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-radius: 6px;
  flex-shrink: 0;
  position: relative;
  transition: background 0.2s, border-color 0.2s;
}

.auth-checkbox input[type="checkbox"]:checked + .checkmark {
  background: var(--accent);
  border-color: var(--accent);
}

.auth-checkbox input[type="checkbox"]:checked + .checkmark::after {
  content: '';
  position: absolute;
  left: 6px;
  top: 2px;
  width: 6px;
  height: 11px;
  border: solid white;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}

.checkbox-label {
  font-family: 'Georgia', serif;
  font-weight: normal;
  font-size: 14px;
  color: var(--text-dim);
}

.auth-error {
  font-size: 13px;
  color: var(--danger);
  min-height: 18px;
  text-align: center;
  font-family: 'Georgia', serif;
  font-weight: normal;
}

.auth-switch {
  font-family: 'Georgia', serif;
  font-weight: normal;
  font-size: 14px;
  color: var(--text-dim);
}

.auth-switch a {
  color: var(--accent);
  text-decoration: none;
  font-weight: bold;
}

.auth-switch a:active {
  opacity: 0.7;
}

/* Title user info + logout */
.title-user {
  font-size: 14px;
  color: var(--text-dim);
  letter-spacing: 1px;
  font-family: 'Georgia', serif;
  font-weight: normal;
}

.btn-text {
  font-family: inherit;
  font-size: 14px;
  letter-spacing: 2px;
  color: var(--text-dim);
  background: none;
  border: none;
  cursor: pointer;
  padding: 8px 16px;
  opacity: 0.6;
  transition: opacity 0.2s;
}

.btn-text:active {
  opacity: 1;
}

/* Auth divider */
.auth-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  margin: 4px 0;
}

.auth-divider::before,
.auth-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: rgba(255, 255, 255, 0.15);
}

.auth-divider span {
  font-family: 'Georgia', serif;
  font-weight: normal;
  font-size: 13px;
  color: var(--text-dim);
  text-transform: lowercase;
}

/* Google Sign-In button */
.btn-google {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  font-family: inherit;
  font-size: 15px;
  letter-spacing: 2px;
  padding: 14px 24px;
  border: 2px solid rgba(255, 255, 255, 0.15);
  border-radius: 50px;
  background: rgba(255, 255, 255, 0.08);
  color: var(--text);
  cursor: pointer;
  min-width: 220px;
  transition: background 0.2s, border-color 0.2s;
}

.btn-google:active {
  background: rgba(255, 255, 255, 0.15);
  border-color: rgba(255, 255, 255, 0.3);
}

.btn-google svg {
  flex-shrink: 0;
}

/* Button loading state */
.btn.loading {
  opacity: 0.6;
  pointer-events: none;
}

/* Auth legal link */
.auth-legal {
  font-family: 'Georgia', serif;
  font-weight: normal;
  font-size: 11px;
  color: rgba(160, 160, 190, 0.5);
  text-align: center;
}

.auth-legal a {
  color: rgba(160, 160, 190, 0.7);
  text-decoration: underline;
}

/* Guest upgrade banner */
.guest-upgrade {
  width: 100%;
  max-width: 300px;
  text-align: center;
}

.guest-upgrade-text {
  font-family: 'Georgia', serif;
  font-weight: normal;
  font-size: 12px;
  color: var(--gold);
  opacity: 0.7;
  margin-bottom: 8px;
}

.btn-upgrade {
  font-family: inherit;
  font-size: 13px;
  letter-spacing: 2px;
  padding: 10px 24px;
  border: 2px solid var(--gold);
  border-radius: 50px;
  background: rgba(255, 215, 0, 0.08);
  color: var(--gold);
  cursor: pointer;
  width: 100%;
  transition: background 0.2s;
}

.btn-upgrade:active {
  background: rgba(255, 215, 0, 0.15);
}

/* Title meta row */
.title-meta {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.title-stats-row {
  display: flex;
  align-items: center;
  gap: 14px;
}

.title-streak {
  font-size: 14px;
  color: var(--gold);
  letter-spacing: 1px;
}

.online-count {
  font-family: 'Georgia', serif;
  font-weight: normal;
  font-size: 12px;
  color: rgba(160, 160, 190, 0.6);
}

.title-row {
  display: flex;
  gap: 10px;
  width: 100%;
  max-width: 300px;
}

.btn-half {
  flex: 1;
  min-width: 0;
  padding: 14px 10px;
  font-size: 16px;
}

/* Daily challenge card */
.daily-card {
  width: 100%;
  max-width: 300px;
  background: rgba(255, 215, 0, 0.06);
  border: 1px solid rgba(255, 215, 0, 0.15);
  border-radius: 12px;
  padding: 10px 14px;
  text-align: center;
}

.daily-card-label {
  font-size: 9px;
  letter-spacing: 2px;
  color: var(--gold);
  opacity: 0.7;
  margin-bottom: 4px;
}

.daily-card-text {
  font-family: 'Georgia', serif;
  font-weight: normal;
  font-size: 14px;
  color: var(--text);
  margin-bottom: 6px;
}

.daily-card-bar {
  width: 100%;
  height: 6px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 3px;
  overflow: hidden;
  margin-bottom: 4px;
}

.daily-card-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--gold), var(--accent));
  border-radius: 3px;
  transition: width 0.5s;
}

.daily-card-progress {
  font-size: 11px;
  color: var(--text-dim);
  letter-spacing: 0.5px;
}

/* HUD challenge bar */
.hud-challenge {
  display: flex;
  justify-content: center;
  gap: 8px;
  pointer-events: none;
  padding: 0 10px;
}

.hud-challenge-text {
  font-family: 'Georgia', serif;
  font-weight: normal;
  font-size: 11px;
  color: var(--gold);
  opacity: 0.7;
}

.hud-challenge-prog {
  font-size: 11px;
  color: var(--gold);
}

/* Power-up overlay */
.powerup-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 22;
  background: rgba(0, 0, 0, 0.75);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 20px;
  pointer-events: auto;
}

.powerup-prompt {
  font-size: 24px;
  letter-spacing: 4px;
  color: var(--gold);
  text-shadow: 0 0 20px rgba(255, 215, 0, 0.4);
}

.powerup-cards {
  display: flex;
  gap: 10px;
  width: 100%;
  max-width: 380px;
}

.powerup-card {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  background: rgba(255, 255, 255, 0.08);
  border: 2px solid rgba(255, 255, 255, 0.15);
  border-radius: 16px;
  padding: 16px 8px;
  cursor: pointer;
  transition: transform 0.15s, border-color 0.2s;
  font-family: inherit;
  color: var(--text);
}

.powerup-card:active {
  transform: scale(0.95);
  border-color: var(--accent);
}

.powerup-card:disabled {
  opacity: 0.3;
  pointer-events: none;
}

.pu-card-icon { font-size: 32px; }
.pu-card-name { font-size: 12px; letter-spacing: 2px; }
.pu-card-desc { font-family: 'Georgia', serif; font-weight: normal; font-size: 10px; color: var(--text-dim); text-align: center; line-height: 1.3; }
.pu-card-cost { font-size: 14px; color: var(--gold); letter-spacing: 1px; }

.pu-skip {
  font-family: inherit;
  font-size: 14px;
  letter-spacing: 2px;
  padding: 10px 32px;
  border: none;
  border-radius: 50px;
  background: rgba(255, 255, 255, 0.1);
  color: var(--text-dim);
  cursor: pointer;
}

.pu-skip:active { opacity: 0.7; }

.pu-balance {
  font-family: 'Georgia', serif;
  font-weight: normal;
  font-size: 12px;
  color: var(--text-dim);
}

/* Game over share row */
.go-share-row {
  display: flex;
  gap: 10px;
  width: 100%;
  max-width: 320px;
}

.btn-share {
  flex: 1;
  font-family: inherit;
  font-size: 13px;
  letter-spacing: 2px;
  padding: 10px 8px;
  border: 2px solid rgba(255, 255, 255, 0.2);
  border-radius: 50px;
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
  cursor: pointer;
  transition: background 0.2s;
}

.btn-share:active {
  background: rgba(255, 255, 255, 0.12);
}

/* One more game hook */
.go-hook-msg {
  font-family: 'Georgia', serif;
  font-weight: normal;
  font-size: 14px;
  color: var(--accent);
  text-align: center;
  line-height: 1.4;
}

/* Challenge banner */
.challenge-banner {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  z-index: 25;
  background: linear-gradient(135deg, rgba(255, 107, 53, 0.95), rgba(255, 45, 85, 0.95));
  padding: 20px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.challenge-banner p {
  font-family: 'Georgia', serif;
  font-weight: normal;
  font-size: 16px;
  color: white;
  line-height: 1.4;
}

/* Popup overlay */
.popup-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 30;
  background: rgba(0, 0, 0, 0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.popup-box {
  background: linear-gradient(180deg, #2d1b69, #1a0a2e);
  border: 2px solid rgba(255, 107, 53, 0.3);
  border-radius: 20px;
  padding: 30px 24px;
  text-align: center;
  max-width: 300px;
  width: 100%;
  animation: popupIn 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes popupIn {
  0% { transform: scale(0.7); opacity: 0; }
  100% { transform: scale(1); opacity: 1; }
}

.popup-icon { font-size: 48px; margin-bottom: 10px; }
.popup-title { font-size: 24px; color: var(--gold); letter-spacing: 2px; margin-bottom: 8px; }
.popup-text { font-family: 'Georgia', serif; font-weight: normal; font-size: 14px; color: var(--text-dim); line-height: 1.4; margin-bottom: 16px; }
.popup-btn { min-width: 150px; }

/* Achievements */
#achievements-screen {
  background: linear-gradient(180deg, #1a0a2e 0%, #2d1b69 50%, #1a0a2e 100%);
  gap: 10px;
}

.ach-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  width: 100%;
  max-width: 400px;
  height: 100%;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 20px;
  padding-top: env(safe-area-inset-top, 20px);
  padding-bottom: env(safe-area-inset-bottom, 20px);
}

.ach-content h2 {
  font-size: 28px;
  color: var(--accent);
  letter-spacing: 3px;
}

.ach-count {
  font-family: 'Georgia', serif;
  font-weight: normal;
  font-size: 14px;
  color: var(--text-dim);
}

.ach-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  width: 100%;
}

.ach-card {
  background: rgba(255, 255, 255, 0.05);
  border: 2px solid rgba(255, 255, 255, 0.08);
  border-radius: 14px;
  padding: 14px 10px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  text-align: center;
}

.ach-card.unlocked {
  background: rgba(255, 215, 0, 0.08);
  border-color: rgba(255, 215, 0, 0.25);
}

.ach-card.locked {
  opacity: 0.4;
}

.ach-icon { font-size: 28px; }

.ach-name {
  font-size: 11px;
  letter-spacing: 1px;
  color: var(--text);
}

.ach-desc {
  font-family: 'Georgia', serif;
  font-weight: normal;
  font-size: 10px;
  color: var(--text-dim);
  line-height: 1.3;
}

.ach-card.unlocked .ach-name { color: var(--gold); }

/* Invite CTA */
.btn-invite-cta {
  font-family: inherit;
  font-size: 11px;
  letter-spacing: 1.5px;
  padding: 10px 20px;
  border: none;
  border-radius: 10px;
  background: linear-gradient(135deg, rgba(255, 215, 0, 0.15), rgba(255, 107, 53, 0.15));
  color: var(--gold);
  cursor: pointer;
  width: 100%;
  max-width: 300px;
  transition: background 0.2s;
  text-align: center;
  line-height: 1.4;
}

.btn-invite-cta:active {
  background: linear-gradient(135deg, rgba(255, 215, 0, 0.25), rgba(255, 107, 53, 0.25));
}

/* Friends screen */
#friends-screen {
  background: linear-gradient(180deg, #1a0a2e 0%, #2d1b69 50%, #1a0a2e 100%);
  gap: 10px;
}

.friends-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  width: 100%;
  max-width: 380px;
  height: 100%;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 20px;
  padding-top: env(safe-area-inset-top, 20px);
  padding-bottom: env(safe-area-inset-bottom, 20px);
}

.friends-content h2 {
  font-size: 28px;
  color: var(--accent);
  letter-spacing: 3px;
}

.friends-add {
  display: flex;
  gap: 8px;
  width: 100%;
}

.friends-add .auth-input {
  flex: 1;
  padding: 12px 14px;
  font-size: 14px;
}

.friends-section-title {
  font-size: 13px;
  letter-spacing: 2px;
  color: var(--text-dim);
  width: 100%;
  text-align: left;
  margin-top: 8px;
}

.friends-list {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.friend-entry {
  display: flex;
  align-items: center;
  padding: 10px 14px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 12px;
  gap: 12px;
}

.friend-entry.is-me {
  background: rgba(255, 107, 53, 0.1);
  border: 1px solid rgba(255, 107, 53, 0.2);
}

.friend-name {
  flex: 1;
  font-size: 16px;
  letter-spacing: 1px;
}

.friend-score {
  font-size: 18px;
  color: var(--accent);
}

.friend-rank {
  font-size: 16px;
  width: 28px;
  text-align: center;
  color: var(--text-dim);
}

.friend-remove {
  font-family: inherit;
  font-size: 10px;
  letter-spacing: 1px;
  padding: 4px 10px;
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 8px;
  background: none;
  color: var(--text-dim);
  cursor: pointer;
}

.friend-remove:active {
  background: rgba(255, 45, 85, 0.2);
  border-color: var(--danger);
  color: var(--danger);
}

.friend-actions {
  display: flex;
  gap: 6px;
}

.friend-accept {
  font-family: inherit;
  font-size: 10px;
  letter-spacing: 1px;
  padding: 5px 12px;
  border: none;
  border-radius: 8px;
  background: var(--success);
  color: white;
  cursor: pointer;
}

.friend-decline {
  font-family: inherit;
  font-size: 10px;
  letter-spacing: 1px;
  padding: 5px 10px;
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 8px;
  background: none;
  color: var(--text-dim);
  cursor: pointer;
}

.friend-pending-tag {
  font-family: 'Georgia', serif;
  font-weight: normal;
  font-style: italic;
  font-size: 11px;
  color: var(--text-dim);
  opacity: 0.6;
}

.friend-entry.pending {
  opacity: 0.7;
}

/* Beta CTA */
.beta-cta {
  display: flex;
  align-items: center;
  gap: 10px;
  background: rgba(255, 107, 53, 0.12);
  border: 1px solid rgba(255, 107, 53, 0.3);
  border-radius: 14px;
  padding: 12px 16px;
  text-decoration: none;
  width: 100%;
  max-width: 300px;
  transition: background 0.2s;
}

.beta-cta:active {
  background: rgba(255, 107, 53, 0.2);
}

.beta-cta-badge {
  font-size: 10px;
  letter-spacing: 2px;
  background: linear-gradient(135deg, #ff6b35, #ff2d55);
  color: white;
  padding: 3px 8px;
  border-radius: 6px;
  flex-shrink: 0;
}

.beta-cta-text {
  font-family: 'Georgia', serif;
  font-weight: normal;
  font-size: 13px;
  color: #c0c0d0;
  flex: 1;
}

.beta-cta-arrow {
  font-size: 22px;
  color: #ff6b35;
}

/* Title footer */
.title-footer {
  display: flex;
  gap: 20px;
}

/* Settings */
#settings-screen,
#delete-confirm-screen {
  background: linear-gradient(180deg, #1a0a2e 0%, #2d1b69 50%, #1a0a2e 100%);
  gap: 10px;
}

.settings-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  max-width: 360px;
  width: 100%;
  text-align: center;
}

.settings-content h2 {
  font-size: 28px;
  color: var(--accent);
  letter-spacing: 3px;
}

.settings-list {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 2px;
  border-radius: 14px;
  overflow: hidden;
}

.settings-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
  text-decoration: none;
  font-family: inherit;
  font-size: 16px;
  letter-spacing: 1px;
  cursor: pointer;
  transition: background 0.2s;
  border: none;
}

.settings-item:active {
  background: rgba(255, 255, 255, 0.1);
}

.settings-arrow {
  font-size: 22px;
  color: var(--text-dim);
}

.settings-danger {
  color: var(--danger);
}

.settings-note {
  font-family: 'Georgia', serif;
  font-weight: normal;
  font-size: 12px;
  color: rgba(160, 160, 190, 0.5);
  line-height: 1.5;
  padding: 0 10px;
}

.danger-heading {
  color: var(--danger) !important;
}

.delete-warning {
  font-family: 'Georgia', serif;
  font-weight: normal;
  font-size: 15px;
  color: var(--text-dim);
  line-height: 1.5;
}

.delete-list {
  text-align: left;
  font-family: 'Georgia', serif;
  font-weight: normal;
  font-size: 14px;
  color: var(--text-dim);
  padding-left: 20px;
  line-height: 1.8;
  width: 100%;
}

.btn-danger {
  font-family: inherit;
  font-size: 18px;
  letter-spacing: 2px;
  padding: 14px 40px;
  border: none;
  border-radius: 50px;
  background: var(--danger);
  color: white;
  cursor: pointer;
  min-width: 220px;
  transition: transform 0.15s;
}

.btn-danger:active {
  transform: scale(0.95);
}

.btn-danger:disabled {
  opacity: 0.4;
  pointer-events: none;
}

.btn.loading::after {
  content: '';
  display: inline-block;
  width: 14px;
  height: 14px;
  border: 2px solid rgba(255,255,255,0.3);
  border-top-color: white;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
  margin-left: 8px;
  vertical-align: middle;
}
