/* ============================================================
   Archerman Online — Core Styles
   Silhouette aesthetic: black on white, red blood
   ============================================================ */

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Segoe UI', 'Helvetica Neue', Arial, sans-serif;
  background: #ffffff;
  color: #000000;
  overflow: hidden;
  width: 100vw;
  height: 100vh;
  user-select: none;
  -webkit-user-select: none;
}

/* ---- Loading screen ---- */
#loading-screen {
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  background: #000;
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 9999;
  transition: opacity 0.4s ease;
}
#loading-screen.hidden {
  opacity: 0;
  pointer-events: none;
}
.loading-container {
  text-align: center;
}
.loading-title {
  font-size: 3rem;
  color: #fff;
  letter-spacing: 0.3em;
  margin-bottom: 2rem;
}
.loading-bar-track {
  width: 260px;
  height: 6px;
  background: #222;
  border-radius: 3px;
  margin: 0 auto 1rem;
  overflow: hidden;
}
.loading-bar-fill {
  width: 0%;
  height: 100%;
  background: #fff;
  border-radius: 3px;
  transition: width 0.2s ease;
}
.loading-text {
  color: #666;
  font-size: 0.85rem;
  letter-spacing: 0.1em;
}

/* ---- Screen management ---- */
.screen {
  display: none;
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 100%;
  justify-content: center;
  align-items: center;
}
.screen.active {
  display: flex;
}

/* ---- Main Menu ---- */
.menu-container {
  text-align: center;
}

.title-wrapper {
  position: relative;
  display: inline-block;
}

.game-title {
  font-size: 80px;
  font-weight: 900;
  letter-spacing: 10px;
  line-height: 1;
  margin-bottom: -5px;
}

.steam-splash {
  position: absolute;
  right: -32px;
  top: -8px;
  font-size: 14px;
  font-weight: 700;
  color: #ffdd00;
  background: #1b2838;
  padding: 4px 12px;
  border-radius: 4px;
  text-decoration: none;
  white-space: nowrap;
  transform-origin: center center;
  animation: splash-bounce 1.2s ease-in-out infinite;
  cursor: pointer;
  z-index: 10;
  box-shadow: 0 2px 8px rgba(0,0,0,0.3);
  border: 1px solid #ffdd00;
}

.steam-splash:hover {
  background: #2a475e;
  color: #fff;
  border-color: #fff;
}

@keyframes splash-bounce {
  0%, 100% { transform: rotate(-8deg) scale(1); }
  50%      { transform: rotate(-8deg) scale(1.15); }
}

.game-subtitle {
  font-size: 32px;
  font-weight: 300;
  letter-spacing: 18px;
  margin-bottom: 36px;
  color: #555;
}

.menu-buttons {
  display: flex;
  flex-direction: column;
  gap: 12px;
  align-items: center;
}

.menu-btn {
  background: #000;
  color: #fff;
  border: none;
  padding: 14px 48px;
  font-size: 18px;
  font-weight: 700;
  letter-spacing: 3px;
  cursor: pointer;
  transition: all 0.15s;
  min-width: 260px;
  text-transform: uppercase;
}

.menu-btn:hover {
  background: #333;
  transform: scale(1.03);
}

.menu-btn:active {
  transform: scale(0.97);
}

.menu-btn.small {
  padding: 10px 24px;
  font-size: 14px;
  min-width: 140px;
}

.menu-btn.back-btn {
  background: #666;
  margin-top: 20px;
  min-width: 160px;
}

#btn-rematch {
  width: 260px;
  box-sizing: border-box;
  text-align: center;
  overflow: hidden;
  white-space: nowrap;
}

.online-count {
  margin-top: 18px;
  font-size: 14px;
  color: #999;
  letter-spacing: 2px;
}

#online-count-num {
  font-weight: 700;
  color: #000;
}

/* ---- Lobby ---- */
.lobby-container {
  text-align: center;
  max-width: 400px;
  width: 90%;
}

.lobby-container h2 {
  font-size: 36px;
  font-weight: 900;
  letter-spacing: 6px;
  margin-bottom: 30px;
}

.lobby-form {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 24px;
}

.lobby-form label {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 3px;
  text-align: left;
  margin-top: 8px;
}

.lobby-form input,
.code-input-row input {
  background: #fff;
  border: 2px solid #000;
  padding: 10px 14px;
  font-size: 16px;
  font-family: inherit;
  letter-spacing: 2px;
  outline: none;
  width: 100%;
}

.lobby-form input:focus,
.code-input-row input:focus {
  border-color: #555;
}

.lobby-buttons {
  display: flex;
  flex-direction: column;
  gap: 12px;
  align-items: center;
  margin-bottom: 16px;
}

.friendly-section {
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: center;
  width: 100%;
}

.code-input-row {
  display: flex;
  gap: 8px;
  width: 100%;
}

.code-input-row input {
  flex: 1;
  text-transform: uppercase;
  text-align: center;
  font-weight: 700;
}

.lobby-status {
  min-height: 24px;
  font-size: 14px;
  letter-spacing: 2px;
  color: #555;
  margin-bottom: 10px;
}

/* ---- Game Screen ---- */
#game-screen {
  background: #fff;
}

#game-canvas {
  display: block;
  width: 100%;
  height: 100%;
  cursor: crosshair;
}

/* ---- HUD ---- */
#hud {
  position: absolute;
  top: 0; left: 0;
  width: 100%;
  pointer-events: none;
  display: flex;
  justify-content: space-between;
  padding: 14px 24px;
}

.hud-item {
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 2px;
  color: #000;
}

/* ---- Night-mode HUD overrides ---- */
.night-mode .hud-item {
  color: #ddd;
}
.night-mode #hud-wind {
  background: rgba(0, 0, 0, 0.55);
  color: #6ab4ff;
}
.night-mode #hud-ability {
  background: rgba(0, 0, 0, 0.55);
  color: #ff9966;
}
.night-mode #hud-poison {
  background: rgba(0, 40, 0, 0.6);
  color: #5eff7e;
}

/* ---- Sunset-mode HUD overrides ---- */
.sunset-mode .hud-item {
  color: #ffe0a0;
}
.sunset-mode #hud-wind {
  background: rgba(60, 20, 0, 0.6);
  color: #ffcc44;
}
.sunset-mode #hud-ability {
  background: rgba(60, 20, 0, 0.6);
  color: #ff9944;
}
.sunset-mode #hud-poison {
  background: rgba(40, 30, 0, 0.6);
  color: #ccff66;
}

/* Wind value display (Wind Prophet ability) — battery bar */
#hud-wind {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 14px;
  font-weight: 600;
  color: #1a6bc4;
  background: rgba(255, 255, 255, 0.75);
  padding: 4px 10px;
  border-radius: 4px;
}

.wind-arrow {
  font-size: 18px;
  line-height: 1;
}

#wind-bars {
  display: flex;
  gap: 2px;
  align-items: center;
}

#wind-bars .wind-bar {
  width: 6px;
  height: 14px;
  background: rgba(0, 0, 0, 0.15);
  border: 1px solid rgba(0, 0, 0, 0.25);
}

#wind-bars .wind-bar.active {
  background: #1a6bc4;
  border-color: #135a9e;
}

.night-mode #wind-bars .wind-bar {
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.2);
}

.night-mode #wind-bars .wind-bar.active {
  background: #6ab4ff;
  border-color: #4e9ee8;
}

.sunset-mode #wind-bars .wind-bar {
  background: rgba(255, 200, 100, 0.15);
  border-color: rgba(255, 200, 100, 0.25);
}

.sunset-mode #wind-bars .wind-bar.active {
  background: #ffcc44;
  border-color: #e0b030;
}

/* Active ability indicator */
#hud-ability {
  font-size: 12px;
  font-weight: 600;
  color: #c44b1a;
  background: rgba(255, 255, 255, 0.75);
  padding: 3px 10px;
  border-radius: 4px;
}

/* Poison indicator */
#hud-poison {
  font-size: 12px;
  font-weight: 700;
  color: #2d8c3e;
  background: rgba(200, 255, 200, 0.8);
  padding: 3px 10px;
  border-radius: 4px;
  animation: poison-pulse 1.5s ease-in-out infinite;
}

@keyframes poison-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

/* Ability action bar */
#ability-bar {
  position: fixed;
  bottom: 14px;
  left: 14px;
  display: none;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  z-index: 50;
}

#game-screen.active ~ #ability-bar,
#game-screen.active #ability-bar {
  display: flex;
}

#ability-bar.hidden {
  display: none !important;
}

#ability-slots {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.ability-slot-btn {
  background: rgba(0, 0, 0, 0.65);
  color: #fff;
  border: 2px solid rgba(255, 255, 255, 0.5);
  padding: 8px 16px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 1px;
  cursor: pointer;
  font-family: inherit;
  white-space: nowrap;
  transition: background 0.15s, border-color 0.15s, transform 0.1s;
  text-transform: uppercase;
}

.ability-slot-btn:hover:not(:disabled) {
  background: rgba(0, 0, 0, 0.85);
  border-color: #fff;
  transform: scale(1.03);
}

.ability-slot-btn:active:not(:disabled) {
  transform: scale(0.97);
}

.ability-slot-btn:disabled {
  opacity: 0.45;
  cursor: default;
}

.ability-slot-btn.activated {
  background: rgba(196, 75, 26, 0.9);
  border-color: #fff;
  animation: ability-glow 1.2s ease-in-out infinite alternate;
}

.ability-slot-btn.used {
  background: rgba(80, 80, 80, 0.5);
  border-color: rgba(255, 255, 255, 0.25);
  color: rgba(255, 255, 255, 0.5);
  cursor: default;
  text-decoration: line-through;
}

@keyframes ability-glow {
  from { box-shadow: 0 0 4px rgba(196, 75, 26, 0.4); }
  to   { box-shadow: 0 0 12px rgba(196, 75, 26, 0.8); }
}

.ability-passive-info {
  font-size: 10px;
  color: rgba(255, 255, 255, 0.55);
  letter-spacing: 1px;
  padding: 2px 4px;
}

.aim-info {
  display: flex;
  gap: 20px;
}

.aim-info span {
  font-weight: 400;
}

.aim-info strong {
  font-weight: 900;
  font-size: 18px;
}

#wind-arrow {
  display: inline-block;
  transition: transform 0.3s;
}

/* ---- Overlays ---- */
.overlay {
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 100%;
  background: rgba(255, 255, 255, 0.97);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 100;
}

/* Body-level overlays (shop, inventory) need fixed positioning */
body > .overlay {
  position: fixed;
  z-index: 200;
}

.hidden {
  display: none !important;
}

.overlay.hidden {
  display: none;
}

.overlay-content {
  text-align: center;
}

.overlay-content h2 {
  font-size: 64px;
  font-weight: 900;
  letter-spacing: 8px;
  margin-bottom: 10px;
}

.overlay-content p {
  font-size: 18px;
  margin-bottom: 30px;
  color: #555;
  letter-spacing: 2px;
}

/* ---- Reconnection overlay ---- */
#reconnect-overlay {
  background: rgba(0, 0, 0, 0.75);
  z-index: 150;
}
#reconnect-overlay .overlay-content h2 {
  color: #fff;
  font-size: 36px;
  letter-spacing: 4px;
}
#reconnect-overlay .overlay-content p {
  color: #ccc;
  font-size: 16px;
}

/* ---- Coin Breakdown on game-over ---- */
.coin-breakdown {
  margin: 0 auto 24px auto;
  max-width: 260px;
  text-align: left;
  font-family: 'Segoe UI', Arial, sans-serif;
  font-size: 15px;
  letter-spacing: 1px;
  color: #333;
}

.coin-row {
  display: flex;
  justify-content: space-between;
  padding: 3px 0;
}

.coin-row .coin-label {
  color: #666;
}

.coin-row .coin-value {
  font-weight: 700;
  color: #000;
}

.coin-row.coin-total {
  border-top: 2px solid #000;
  margin-top: 6px;
  padding-top: 7px;
  font-size: 17px;
  font-weight: 900;
  letter-spacing: 2px;
}

.coin-row.coin-total .coin-label,
.coin-row.coin-total .coin-value {
  color: #000;
  font-weight: 900;
}

.coin-row.coin-cap-notice {
  margin-top: 4px;
  padding-top: 4px;
}

.coin-row.coin-cap-notice .coin-label {
  color: #c44b1a;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1px;
}

/* ---- Searching spinner ---- */
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.3; }
}

.searching {
  animation: pulse 1.5s infinite;
}

/* ---- Responsive ---- */
@media (max-width: 600px) {
  .game-title { font-size: 48px; letter-spacing: 5px; }
  .game-subtitle { font-size: 18px; letter-spacing: 8px; }
  .steam-splash { font-size: 11px; right: -24px; top: -10px; padding: 3px 8px; }
  .menu-btn { padding: 12px 30px; font-size: 15px; min-width: 200px; }
  #btn-rematch { width: 200px; }
  .lobby-container h2 { font-size: 24px; }
}

/* ---- Menu secondary buttons row ---- */
.menu-secondary {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  margin-top: 16px;
}

.menu-secondary .settings-gear {
  min-width: auto;
  padding: 8px 16px;
  font-size: 12px;
}

#btn-stats {
  min-width: 160px;
}

/* ---- Settings ---- */
.settings-gear {
  margin-top: 0;
  background: transparent;
  color: #999;
  border: 2px solid #ccc;
  min-width: 160px;
}
.settings-gear:hover {
  background: #f0f0f0;
  color: #000;
  border-color: #999;
}

.settings-content h2 {
  font-size: 40px;
  margin-bottom: 24px;
}

.settings-section {
  margin-bottom: 20px;
}

.settings-section-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 3px;
  color: #999;
  margin-bottom: 8px;
  text-transform: uppercase;
}

.settings-name-current {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}

.settings-name-current span {
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 2px;
}

.settings-row {
  display: flex;
  gap: 16px;
  justify-content: center;
  margin-bottom: 8px;
  flex-wrap: wrap;
}

.settings-toggle {
  min-width: 140px;
  padding: 12px 24px;
  font-size: 15px;
}

.settings-toggle.off {
  background: #aaa;
  color: #fff;
}
.settings-toggle.off:hover {
  background: #888;
}

/* ---- Version + credits ---- */
#menu-credits {
  position: absolute;
  bottom: 18px;
  left: 22px;
  font-size: 11px;
  color: #aaa;
  letter-spacing: 1px;
  user-select: none;
}
#menu-credits a {
  color: #aaa;
  text-decoration: none;
}
#menu-credits a:hover {
  color: #333;
  text-decoration: underline;
}

/* ---- Leaderboard ---- */
.leaderboard-content {
  max-width: 480px;
  width: 90%;
  /* Fixed height prevents vertical re-centering when content changes */
  height: 520px;
  display: flex;
  flex-direction: column;
}

.leaderboard-content h2 {
  font-size: 40px;
  margin-bottom: 12px;
  flex-shrink: 0;
}

.lb-tabs {
  display: flex;
  gap: 0;
  margin-bottom: 14px;
  flex-shrink: 0;
}

.lb-tab {
  flex: 1;
  padding: 8px 0;
  background: transparent;
  border: none;
  font-family: inherit;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 1.5px;
  color: #999;
  cursor: pointer;
  transition: background 0.2s ease, color 0.2s ease;
}

.lb-tab:hover {
  color: #000;
  background: #eee;
}

.lb-tab.active {
  color: #fff;
  background: #000;
}

.leaderboard-list {
  flex: 1;
  overflow-y: auto;
  margin-bottom: 20px;
  text-align: left;
  transition: opacity 0.2s ease;
}

.leaderboard-list.fading {
  opacity: 0;
}

.match-history-notice {
  font-size: 11px;
  color: #999;
  letter-spacing: 0.5px;
  padding: 6px 4px 10px;
  border-bottom: 1px solid #e0e0e0;
}

.leaderboard-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 4px;
  border-bottom: 1px solid #e0e0e0;
  font-size: 15px;
  letter-spacing: 1px;
}

.lb-rank {
  min-width: 36px;
  color: #999;
  font-size: 13px;
  font-weight: 700;
}

.lb-name {
  flex: 1;
  font-weight: 700;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.lb-wins {
  font-weight: 900;
  color: #000;
  min-width: 50px;
  text-align: right;
}

/* ---- Your Glory section ---- */
.lb-my-glory {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  margin-top: 4px;
  margin-bottom: 10px;
  background: #000;
  border: 2px solid #000;
  border-radius: 0;
  flex-shrink: 0;
}

.lb-my-glory-label {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 2px;
  color: #999;
}

.lb-my-glory-value {
  font-size: 18px;
  font-weight: 900;
  color: #fff;
  letter-spacing: 1px;
}

.lb-losses {
  color: #999;
  font-size: 13px;
  min-width: 42px;
  text-align: right;
}

/* ---- Name section (main menu) ---- */
#name-section {
  margin-top: 8px;
  margin-bottom: 4px;
  min-height: 20px;
}

.name-hello-text {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 1px;
  color: #555;
  margin-right: 6px;
}

.name-input-row {
  display: flex;
  gap: 6px;
  justify-content: center;
  align-items: center;
  margin-bottom: 0;
}

.name-input-row input {
  background: #fff;
  border: 1px solid #000;
  padding: 5px 8px;
  font-size: 12px;
  font-family: inherit;
  letter-spacing: 1px;
  outline: none;
  width: 150px;
}

.name-input-row input:focus {
  border-color: #555;
}

/* ---- Google Auth section ---- */
.auth-section {
  margin-top: 8px;
  margin-bottom: 4px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.auth-guest {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  transform: scale(0.75);
  transform-origin: center center;
}

.auth-hint {
  font-size: 11px;
  color: #999;
  letter-spacing: 1px;
}

.auth-linked {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

.auth-info {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 1px;
  color: #333;
}

.auth-icon {
  font-size: 16px;
  color: #2a7a2a;
}

.auth-email {
  color: #555;
  font-weight: 400;
}

.auth-btn {
  min-width: 120px !important;
  padding: 6px 16px !important;
  font-size: 12px !important;
  background: #888 !important;
}

.auth-btn:hover {
  background: #666 !important;
}

/* ---- Room code display (lobby) ---- */
.room-code-box {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin: 10px 0 4px;
  flex-wrap: wrap;
}

.room-code-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 3px;
  color: #999;
}

.room-code-value {
  font-size: 28px;
  font-weight: 900;
  letter-spacing: 8px;
  color: #000;
}

.room-code-waiting {
  font-size: 13px;
  letter-spacing: 2px;
  color: #666;
  margin-bottom: 8px;
  animation: pulse 1.5s infinite;
}

.copy-btn {
  margin-top: 0 !important;
  background: #000;
  color: #fff;
  min-width: 80px !important;
}

.copy-btn.copied {
  background: #2a7a2a;
}

/* ---- Mode selector (local/AI setup) ---- */
.mode-selector {
  margin-bottom: 24px;
}

.mode-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 3px;
  color: #999;
  margin-bottom: 8px;
}

.mode-buttons {
  display: flex;
  gap: 8px;
  justify-content: center;
  flex-wrap: wrap;
}

.mode-btn {
  min-width: 90px !important;
  background: #ccc !important;
  color: #555 !important;
  border: 2px solid #ccc !important;
}

.mode-btn:hover {
  background: #aaa !important;
  color: #000 !important;
}

.mode-btn.active-mode {
  background: #000 !important;
  color: #fff !important;
  border-color: #000 !important;
}

/* ---- AI lobby sliders ---- */
.ai-sliders {
  margin-bottom: 20px;
}
.slider-group {
  margin-bottom: 14px;
}
.slider-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 3px;
  color: #999;
  margin-bottom: 6px;
}
.slider-label span {
  color: #000;
  margin-left: 6px;
}
.lobby-slider {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  max-width: 280px;
  height: 6px;
  background: #ccc;
  border-radius: 3px;
  outline: none;
  cursor: pointer;
}
.lobby-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #000;
  cursor: pointer;
  border: 2px solid #fff;
  box-shadow: 0 0 0 1px #000;
}
.lobby-slider::-moz-range-thumb {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #000;
  cursor: pointer;
  border: 2px solid #fff;
  box-shadow: 0 0 0 1px #000;
}

/* ---- Debug panel (VS AI, toggled with I key) ---- */
.debug-panel {
  position: fixed;
  bottom: 10px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0,0,0,0.75);
  color: #fff;
  padding: 8px 18px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  gap: 18px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 2px;
  z-index: 9999;
  user-select: none;
}
.debug-panel.hidden { display: none; }
.debug-title {
  color: #0f0;
  margin-right: 4px;
}
.debug-item {
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
}
.debug-item input[type="checkbox"] {
  accent-color: #0f0;
  width: 14px;
  height: 14px;
  cursor: pointer;
}
.debug-slider {
  -webkit-appearance: none;
  appearance: none;
  width: 120px;
  height: 4px;
  background: #555;
  border-radius: 2px;
  outline: none;
  cursor: pointer;
}
.debug-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #0f0;
  cursor: pointer;
}
.debug-slider::-moz-range-thumb {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #0f0;
  cursor: pointer;
  border: none;
}

/* ---- Lobby extras (shop/inventory inside lobbies) ---- */
.lobby-extras {
  display: flex;
  gap: 8px;
  justify-content: center;
  margin-top: 16px;
}

.lobby-extras .settings-gear {
  min-width: auto;
  padding: 8px 16px;
  font-size: 12px;
  margin-top: 0;
}

/* ---- Emote bar (game screen) ---- */
#emote-bar {
  position: fixed;
  bottom: 14px;
  right: 14px;
  display: none;           /* shown only when game screen is active */
  flex-direction: row;
  align-items: center;
  gap: 6px;
  max-width: calc(100vw - 28px);
  z-index: 50;
}

#game-screen.active ~ #emote-bar,
#game-screen.active #emote-bar {
  display: flex;
}

#btn-emote-toggle {
  background: rgba(0, 0, 0, 0.72);
  color: #fff;
  border: 2px solid #fff;
  padding: 7px 12px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 2px;
  cursor: pointer;
  font-family: inherit;
  white-space: nowrap;
  transition: background 0.1s;
}

#btn-emote-toggle:hover {
  background: rgba(0, 0, 0, 0.9);
}

#emote-list {
  display: flex;
  flex-direction: row;
  flex-wrap: nowrap;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch; /* iOS momentum scroll */
  scrollbar-width: none;             /* hide scrollbar Firefox */
  gap: 5px;
  align-items: center;
  max-width: calc(100vw - 120px);    /* leave room for toggle button */
}

#emote-list::-webkit-scrollbar {
  display: none; /* hide scrollbar Chrome/Safari */
}

.emote-btn {
  background: rgba(255, 255, 255, 0.92);
  color: #000;
  border: 2px solid #000;
  padding: 6px 9px;
  font-size: 13px;
  font-family: inherit;
  cursor: pointer;
  min-width: 36px;
  flex-shrink: 0;            /* never compress in scroll container */
  text-align: center;
  transition: background 0.1s, opacity 0.1s;
  line-height: 1;
}

.emote-btn:hover {
  background: #000;
  color: #fff;
}

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

.emote-btn.cooldown {
  opacity: 0.45;
  cursor: default;
  pointer-events: none;
}

/* ---- Stats overlay ---- */
.stats-content {
  max-width: 520px;
  width: 92%;
  /* Fixed height prevents vertical re-centering when content changes */
  height: 560px;
  display: flex;
  flex-direction: column;
}

.stats-content h2 {
  font-size: 40px;
  margin-bottom: 16px;
  flex-shrink: 0;
}

.stats-tabs {
  display: flex;
  gap: 0;
  justify-content: center;
  margin-bottom: 18px;
  flex-shrink: 0;
}

.stats-tab {
  background: transparent;
  border: none;
  padding: 10px 24px;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 3px;
  cursor: pointer;
  color: #999;
  font-family: inherit;
  transition: background 0.2s ease, color 0.2s ease;
}

.stats-tab:hover {
  color: #000;
  background: #eee;
}

.stats-tab.active {
  color: #fff;
  background: #000;
}

.stats-panel {
  text-align: left;
  margin-bottom: 10px;
  flex: 1;
  overflow-y: auto;
  transition: opacity 0.2s ease;
}

.stats-panel.panel-hidden {
  display: none;
}

.stats-panel.panel-fading {
  opacity: 0;
}

/* Stats grid */
#stats-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px 20px;
  max-height: 380px;
  overflow-y: auto;
}

.stat-card {
  padding: 10px 12px;
  border: 1px solid #e0e0e0;
}

.stat-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 3px;
  color: #999;
  margin-bottom: 3px;
  text-transform: uppercase;
}

.stat-value {
  font-size: 22px;
  font-weight: 900;
  letter-spacing: 1px;
  line-height: 1.2;
}

.stat-sub {
  font-size: 11px;
  color: #777;
  letter-spacing: 1px;
  margin-top: 2px;
}

.stat-card.wide {
  grid-column: 1 / -1;
}

/* Match history */
#match-history-list {
  max-height: 380px;
  overflow-y: auto;
  border-top: 2px solid #000;
}

.match-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 6px;
  border-bottom: 1px solid #e0e0e0;
  font-size: 13px;
  letter-spacing: 1px;
}

.match-result {
  font-weight: 900;
  font-size: 14px;
  min-width: 18px;
  text-align: center;
}

.match-result.win {
  color: #000;
}

.match-result.loss {
  color: #aaa;
}

.match-result.draw {
  color: #666;
}

.match-type {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 2px;
  color: #999;
  min-width: 50px;
  text-transform: uppercase;
}

.match-opponent {
  flex: 1;
  font-weight: 700;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.match-duration {
  font-size: 11px;
  color: #999;
  min-width: 32px;
  text-align: right;
}

.match-replay-btn {
  background: #000;
  color: #fff;
  border: none;
  padding: 5px 12px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 2px;
  cursor: pointer;
  font-family: inherit;
  transition: background 0.15s;
}

.match-replay-btn:hover {
  background: #333;
}

.match-replay-btn:disabled {
  background: #ccc;
  cursor: default;
}

/* Replay HUD */
#replay-hud {
  position: absolute;
  top: 10px;
  left: 0;
  width: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 16px;
  pointer-events: none;
  z-index: 60;
}

#replay-hud > * {
  pointer-events: auto;
}

.replay-badge {
  font-size: 14px;
  font-weight: 900;
  letter-spacing: 4px;
  color: #000;
  background: rgba(255, 255, 255, 0.85);
  padding: 6px 18px;
  border: 2px solid #000;
}

.replay-exit-btn {
  min-width: 80px !important;
  padding: 6px 14px !important;
  font-size: 11px !important;
}

@media (max-width: 600px) {
  #stats-grid {
    grid-template-columns: 1fr;
  }
  .stats-content {
    max-width: 100%;
  }
  .stat-value {
    font-size: 18px;
  }
}

/* ---- Quests overlay ---- */
.quests-content {
  max-width: 480px;
  width: 92%;
  height: 540px;
  display: flex;
  flex-direction: column;
}

.quests-content h2 {
  font-size: 40px;
  margin-bottom: 8px;
  flex-shrink: 0;
}

.quests-coins {
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 2px;
  color: #555;
  margin-bottom: 14px;
  flex-shrink: 0;
}

.quests-list {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 12px;
  text-align: left;
}

.quest-card {
  border: 2px solid #ddd;
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.quest-card.claimed {
  opacity: 0.45;
}

.quest-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.quest-name {
  font-size: 14px;
  font-weight: 800;
  letter-spacing: 2px;
  text-transform: uppercase;
}

.quest-diff {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 2px;
  padding: 2px 8px;
  text-transform: uppercase;
}

.quest-diff.fixed  { color: #b8860b; border: 1px solid #b8860b; }
.quest-diff.easy   { color: #2e8b57; border: 1px solid #2e8b57; }
.quest-diff.medium { color: #4169e1; border: 1px solid #4169e1; }
.quest-diff.hard   { color: #7b2d8e; border: 1px solid #7b2d8e; }

.quest-desc {
  font-size: 13px;
  color: #666;
  letter-spacing: 1px;
}

.quest-progress-bar {
  width: 100%;
  height: 8px;
  background: #eee;
  border: 1px solid #ccc;
  position: relative;
}

.quest-progress-fill {
  height: 100%;
  background: #000;
  transition: width 0.3s ease;
}

.quest-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.quest-progress-text {
  font-size: 12px;
  color: #999;
  letter-spacing: 1px;
}

.quest-reward {
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 1px;
  color: #333;
}

.quest-claim-btn {
  padding: 4px 16px;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 2px;
  border: 2px solid #000;
  background: #000;
  color: #fff;
  cursor: pointer;
  font-family: inherit;
  transition: background 0.15s ease;
}

.quest-claim-btn:hover {
  background: #333;
}

.quest-claim-btn:disabled {
  background: #ccc;
  border-color: #ccc;
  cursor: default;
}

/* ============================================================
   UNIFIED SHOP — Redesigned card-based UI
   ============================================================ */

.shop-unified-content {
  position: relative;
  max-width: 960px;
  width: 95vw;
  height: 88vh;
  display: flex;
  flex-direction: column;
  padding: 0;
  background: #fff;
  border: 3px solid #000;
  border-radius: 4px;
  overflow: hidden;
}

/* Header */
.shop-header {
  display: flex;
  align-items: center;
  padding: 22px 60px 16px 28px; /* right pad reserves space for absolute close btn */
  flex-shrink: 0;
  border-bottom: 1px solid #e8e8e8;
  gap: 16px;
  position: relative;           /* anchor for absolute close btn */
}

.shop-title {
  font-size: 36px;
  font-weight: 900;
  letter-spacing: 8px;
  margin: 0;
  flex: 0 0 auto;
}

.shop-coins-display {
  flex: 1;
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 3px;
  color: #555;
  text-align: right;
}

.shop-coins-display .coin-icon {
  display: inline-block;
  width: 10px;
  height: 10px;
  background: #000;
  border-radius: 50%;
  margin-right: 5px;
  vertical-align: middle;
}

.shop-close-btn {
  position: absolute;           /* always top-right, immune to title width */
  top: 50%;
  right: 16px;
  transform: translateY(-50%);
  background: none;
  border: 2px solid #ccc;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: border-color 0.15s, background 0.15s, color 0.15s;
  font-family: inherit;
  color: #555;
  line-height: 1;
}

.shop-close-btn:hover {
  background: #000;
  border-color: #000;
  color: #fff;
}

/* Tabs */
.shop-tabs-bar {
  display: flex;
  flex-shrink: 0;
  border-bottom: 3px solid #000;
  padding: 0 28px;
  gap: 4px;
}

.shop-tab {
  padding: 11px 26px;
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 3px;
  text-transform: uppercase;
  background: none;
  border: none;
  border-bottom: 3px solid transparent;
  margin-bottom: -3px;
  cursor: pointer;
  font-family: inherit;
  color: #888;
  transition: color 0.15s, background 0.15s;
}

.shop-tab.active {
  background: #000;
  color: #fff;
  border-bottom-color: #000;
}

.shop-tab:not(.active):hover {
  color: #000;
  background: #f4f4f4;
}

/* Scrollable body */
.shop-body {
  flex: 1;
  overflow-y: auto;
  padding: 24px 28px;
  scroll-behavior: smooth;
}

.shop-body::-webkit-scrollbar { width: 5px; }
.shop-body::-webkit-scrollbar-track { background: transparent; }
.shop-body::-webkit-scrollbar-thumb { background: #ccc; border-radius: 3px; }
.shop-body::-webkit-scrollbar-thumb:hover { background: #aaa; }

/* Status message */
.shop-status-msg {
  text-align: center;
  color: #888;
  font-size: 13px;
  letter-spacing: 2px;
  padding: 48px 0;
  font-weight: 700;
}

.shop-status-msg.hidden { display: none; }

/* Section dividers */
.shop-section-header {
  grid-column: 1 / -1;
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 4px;
  color: #bbb;
  text-transform: uppercase;
  padding: 12px 0 8px;
  border-bottom: 1px solid #ebebeb;
  margin-bottom: 4px;
}

/* Card grid — responsive columns, fixed-ratio cards */
.shop-card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(148px, 1fr));
  gap: 18px;
  align-items: start;
}

/* ── Poker card ── */
.shop-card {
  aspect-ratio: 63 / 88;
  border: 2px solid #111;
  border-radius: 12px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  position: relative;
  cursor: pointer;
  background: #fff;
  box-shadow: 0 2px 8px rgba(0,0,0,0.07);
  transition: transform 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275),
              box-shadow 0.2s ease,
              border-color 0.2s ease;
  user-select: none;
  will-change: transform;
}

.shop-card:hover {
  transform: translateY(-7px) scale(1.03);
  box-shadow: 0 16px 36px rgba(0,0,0,0.18);
  border-color: #000;
  z-index: 3;
}

.shop-card:active {
  transform: translateY(-2px) scale(0.97);
  box-shadow: 0 4px 12px rgba(0,0,0,0.14);
  transition-duration: 0.07s;
}

/* Owned state */
.shop-card.owned {
  opacity: 0.52;
  cursor: default;
}

.shop-card.owned:hover {
  transform: none;
  box-shadow: 0 2px 8px rgba(0,0,0,0.07);
}

/* Owned checkmark badge */
.shop-card.owned::after {
  content: '\2713';
  position: absolute;
  top: 7px;
  right: 9px;
  font-size: 11px;
  font-weight: 900;
  color: #fff;
  background: rgba(0,0,0,0.75);
  width: 20px;
  height: 20px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 20px;
  text-align: center;
}

/* ── Card image area (black top section, ~57%) ── */
.shop-card-image {
  background: #0a0a0a;
  flex: 0 0 57%;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
}

/* Subtle texture overlay on image */
.shop-card-image::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at 30% 30%, rgba(255,255,255,0.06) 0%, transparent 65%);
  pointer-events: none;
}

/* Symbol text */
.shop-card-symbol {
  font-size: 38px;
  color: rgba(255,255,255,0.92);
  font-weight: 100;
  line-height: 1;
  font-family: 'Georgia', 'Times New Roman', serif;
  pointer-events: none;
  z-index: 1;
  transition: transform 0.2s ease;
}

.shop-card:hover .shop-card-symbol {
  transform: scale(1.08);
}

/* Tier / rarity badge (top-left of image) */
.shop-card-badge {
  position: absolute;
  top: 7px;
  left: 9px;
  font-size: 7.5px;
  font-weight: 900;
  letter-spacing: 1.5px;
  color: rgba(255,255,255,0.5);
  text-transform: uppercase;
  z-index: 2;
}

/* Rarity tints for cosmetic cards */
.shop-card-image.rarity-common    { background: #0a0a0a; }
.shop-card-image.rarity-rare      { background: linear-gradient(145deg, #08152b 55%, #12305a); }
.shop-card-image.rarity-epic      { background: linear-gradient(145deg, #130a25 55%, #37156a); }
.shop-card-image.rarity-legendary { background: linear-gradient(145deg, #1e1200 55%, #6b3c00); }

.shop-card-image.rarity-rare .shop-card-symbol      { color: rgba(100,170,255,0.9); }
.shop-card-image.rarity-epic .shop-card-symbol      { color: rgba(185,120,255,0.9); }
.shop-card-image.rarity-legendary .shop-card-symbol { color: rgba(255,195,80,0.9); }

/* ── Card info area (white bottom, ~43%) ── */
.shop-card-info {
  flex: 1;
  padding: 8px 10px 7px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-height: 0;
  border-top: 1.5px solid #111;
}

.shop-card-name {
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: #111;
  line-height: 1.25;
}

.shop-card-desc {
  font-size: 8.5px;
  color: #777;
  letter-spacing: 0.4px;
  line-height: 1.4;
  flex: 1;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
}

/* Buy / Owned footer */
.shop-card-footer {
  margin-top: 5px;
}

.shop-card-buy {
  width: 100%;
  padding: 5px 0;
  font-size: 9px;
  font-weight: 900;
  letter-spacing: 1.5px;
  border: 2px solid #000;
  background: #000;
  color: #fff;
  cursor: pointer;
  font-family: inherit;
  text-transform: uppercase;
  border-radius: 5px;
  transition: background 0.12s, transform 0.1s, box-shadow 0.12s;
}

.shop-card-buy:hover:not(:disabled) {
  background: #333;
  box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}

.shop-card-buy:active:not(:disabled) {
  transform: scale(0.95);
  transition-duration: 0.06s;
}

.shop-card-buy:disabled {
  background: #e0e0e0;
  border-color: #e0e0e0;
  color: #aaa;
  cursor: not-allowed;
}

.shop-card-owned-tag {
  font-size: 8.5px;
  font-weight: 900;
  letter-spacing: 2px;
  color: #aaa;
  text-transform: uppercase;
  text-align: center;
  padding: 4px 0 2px;
}

/* Locked badge for cosmetic market items */
.shop-card-lock {
  position: absolute;
  bottom: 8px;
  right: 9px;
  font-size: 11px;
  opacity: 0.5;
  cursor: pointer;
  z-index: 5;
  background: rgba(255,255,255,0.15);
  border-radius: 3px;
  padding: 1px 3px;
  transition: opacity 0.15s;
}

.shop-card-lock:hover { opacity: 1; }
.shop-card-lock.active { opacity: 0.9; color: #ffc800; }

/* Refresh row for cosmetics market sub-header */
.shop-market-meta {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 2px 0 10px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 2px;
  color: #888;
}

.shop-market-refresh-btn {
  padding: 5px 16px;
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 2px;
  border: 2px solid #000;
  background: none;
  color: #000;
  cursor: pointer;
  font-family: inherit;
  text-transform: uppercase;
  transition: background 0.12s, color 0.12s;
  border-radius: 4px;
}

.shop-market-refresh-btn:hover:not(:disabled) {
  background: #000;
  color: #fff;
}

.shop-market-refresh-btn:disabled {
  border-color: #ccc;
  color: #ccc;
  cursor: not-allowed;
}

/* Keep old .shop-coins class working for market overlay */
.shop-coins {
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 2px;
  color: #555;
  margin-bottom: 14px;
  flex-shrink: 0;
}

/* ---- Filter bar ---- */
.shop-filter-bar {
  display: flex;
  flex-shrink: 0;
  gap: 7px;
  padding: 10px 28px;
  border-bottom: 1px solid #ebebeb;
  flex-wrap: wrap;
  align-items: center;
  min-height: 44px;
}

.shop-filter-btn {
  padding: 4px 14px;
  font-size: 9.5px;
  font-weight: 900;
  letter-spacing: 2px;
  text-transform: uppercase;
  border: 1.5px solid #ccc;
  background: none;
  color: #aaa;
  cursor: pointer;
  font-family: inherit;
  border-radius: 20px;
  transition: border-color 0.15s, color 0.15s, background 0.15s;
}

.shop-filter-btn:hover {
  border-color: #888;
  color: #333;
}

.shop-filter-btn.active {
  border-color: #000;
  background: #000;
  color: #fff;
}

/* ---- Body wrap (card grid + preview panel) ---- */
.shop-body-wrap {
  display: flex;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

/* ---- Preview panel ---- */
.shop-preview-panel {
  width: min(218px, 40%);       /* never wider than 40% of the modal */
  flex-shrink: 0;
  border-left: 1px solid #ebebeb;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 24px 16px 16px;
  gap: 10px;
  background: #fafafa;
  overflow: hidden;             /* keep canvas inside */
}

.shop-preview-panel.hidden {
  display: none;
}

.shop-preview-label {
  font-size: 9px;
  font-weight: 900;
  letter-spacing: 4px;
  color: #bbb;
  text-transform: uppercase;
}

.shop-cosmetic-canvas {
  width: min(186px, calc(100% - 16px)); /* shrinks with the panel */
  aspect-ratio: 186 / 260;
  height: auto;
  border: 1px solid #e0e0e0;
  border-radius: 8px;
  background: #f0f0f0;
  display: block;
}

/* ---- Equipped section (inventory abilities) ---- */
.inv-equipped-section {
  margin-bottom: 24px;
}

.inv-equipped-section.hidden {
  display: none;
}

.inv-section-header {
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 4px;
  color: #bbb;
  text-transform: uppercase;
  padding-bottom: 8px;
  border-bottom: 1px solid #ebebeb;
  margin-bottom: 14px;
}

/* 2-slot equipped bar */
.inv-ab-slots-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.inv-ab-slot {
  position: relative;
  height: 80px;
  border-radius: 10px;
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 12px;
  padding: 0 14px;
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s;
  overflow: hidden;
  user-select: none;
}

.inv-ab-slot.filled {
  background: #111;
  border: 2px solid #000;
  box-shadow: 0 0 0 2px #000, 0 4px 16px rgba(0,0,0,0.18);
  color: #fff;
}

.inv-ab-slot.filled:hover {
  transform: translateY(-3px) scale(1.02);
  box-shadow: 0 0 0 2px #c0392b, 0 8px 24px rgba(192,57,43,0.3);
  border-color: #c0392b;
}

.inv-ab-slot.filled:hover .inv-ab-slot-hint {
  color: #e74c3c;
}

.inv-ab-slot.empty {
  background: #f7f7f7;
  border: 2px dashed #ccc;
  color: #bbb;
  cursor: default;
}

.inv-ab-slot-badge {
  font-size: 7px;
  font-weight: 900;
  letter-spacing: 2px;
  background: #fff;
  color: #111;
  padding: 2px 7px;
  border-radius: 3px;
  white-space: nowrap;
}

.inv-ab-slot-symbol {
  font-size: 28px;
  line-height: 1;
  flex-shrink: 0;
}

.inv-ab-slot-text {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}

.inv-ab-slot-name {
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 1.5px;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.inv-ab-slot-hint {
  font-size: 7px;
  letter-spacing: 1px;
  color: #888;
  text-transform: uppercase;
}

.inv-ab-slot.filled:hover .inv-ab-slot-hint {
  color: #e74c3c;
}

.inv-ab-slot-plus {
  font-size: 28px;
  font-weight: 100;
  color: #ccc;
  line-height: 1;
  flex-shrink: 0;
}

.inv-equipped-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(148px, 1fr));
  gap: 18px;
}

/* Equipped card variant (bold ring) */
.shop-card.equipped {
  border-color: #000;
  box-shadow: 0 0 0 2px #000, 0 4px 16px rgba(0,0,0,0.12);
}

.shop-card.equipped:hover {
  transform: translateY(-4px) scale(1.02);
  box-shadow: 0 0 0 2px #000, 0 12px 28px rgba(0,0,0,0.18);
}

/* Dimmed card (already equipped — shown in grid as greyed out) */
.shop-card.inv-card-dimmed {
  opacity: 0.38;
  filter: grayscale(1);
  pointer-events: none;
}

/* Slots-full card (owned but can't equip more) */
.shop-card.inv-card-full {
  opacity: 0.55;
  cursor: not-allowed;
}

/* Unequip button */
.shop-card-unequip {
  width: 100%;
  padding: 5px 0;
  font-size: 9px;
  font-weight: 900;
  letter-spacing: 1.5px;
  border: 2px solid #aaa;
  background: none;
  color: #666;
  cursor: pointer;
  font-family: inherit;
  text-transform: uppercase;
  border-radius: 5px;
  transition: background 0.12s, color 0.12s, border-color 0.12s;
}

.shop-card-unequip:hover {
  border-color: #000;
  color: #000;
  background: #f5f5f5;
}

.shop-card-unequip:active {
  background: #ebebeb;
  transition-duration: 0.06s;
}

/* ---- Mailbox ---- */
.mailbox-btn {
  background: none;
  border: 2px solid #000;
  padding: 4px 10px;
  font-size: 18px;
  cursor: pointer;
  position: relative;
  margin-left: 10px;
  vertical-align: middle;
  transition: all 0.15s;
  line-height: 1;
}

.mailbox-btn:hover {
  background: #000;
  color: #fff;
}

.mail-badge {
  position: absolute;
  top: -8px;
  right: -8px;
  background: #c0392b;
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  min-width: 18px;
  height: 18px;
  border-radius: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
  line-height: 1;
}

.mail-content {
  max-width: 480px;
  width: 90%;
}

.mail-list {
  max-height: 400px;
  overflow-y: auto;
  margin-bottom: 16px;
}

.mail-item {
  border: 2px solid #000;
  padding: 14px 16px;
  margin-bottom: 8px;
  cursor: pointer;
  transition: all 0.15s;
}

.mail-item:hover {
  background: #f5f5f5;
}

.mail-item.unread {
  border-left: 5px solid #000;
}

.mail-item-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 4px;
}

.mail-item-subject {
  font-weight: 700;
  font-size: 15px;
  letter-spacing: 1px;
}

.mail-item-date {
  font-size: 11px;
  color: #999;
}

.mail-item-body {
  font-size: 13px;
  color: #555;
  line-height: 1.4;
  margin-bottom: 8px;
  white-space: pre-wrap;
}

.mail-item-reward {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.mail-coin-badge {
  display: inline-block;
  background: #000;
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  padding: 4px 12px;
  letter-spacing: 1px;
}

.mail-coin-badge.claimed {
  background: #999;
  text-decoration: line-through;
}

.mail-claim-btn {
  background: #000;
  color: #fff;
  border: none;
  padding: 6px 16px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 2px;
  cursor: pointer;
  transition: all 0.15s;
}

.mail-claim-btn:hover {
  background: #333;
}

.mail-claim-btn:disabled {
  background: #999;
  cursor: default;
}

.mail-empty {
  text-align: center;
  color: #999;
  padding: 30px 0;
  letter-spacing: 1px;
  font-size: 14px;
}

/* ==================== COSMETIC NAV BUTTONS (inside MY STATS) ==================== */

.stats-cosmetic-btns {
  display: flex;
  gap: 8px;
  justify-content: center;
  margin-bottom: 10px;
}

.cosmetic-nav-btn {
  font-size: 15px !important;
  padding: 9px 26px !important;
  letter-spacing: 2px;
}

/* ==================== BLACK MARKET ==================== */

.market-content {
  max-width: 820px;
  width: 95%;
  height: 80vh;
  display: flex;
  flex-direction: column;
}

.market-body {
  display: flex;
  gap: 16px;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

.market-body .market-slots {
  flex: 1;
  min-width: 0;
}

.market-body .cosmetic-preview {
  align-self: flex-start;
  position: sticky;
  top: 0;
  margin-top: 4px;
}

.market-refresh-row {
  display: flex;
  align-items: center;
  gap: 10px;
  justify-content: center;
  margin-bottom: 10px;
}

.market-refresh-cost {
  font-size: 12px;
  color: #999;
  letter-spacing: 1px;
}

.market-slots {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 4px 0;
}

.market-slot {
  background: #111;
  border: 2px solid #333;
  border-radius: 6px;
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  transition: border-color 0.2s;
}

.market-slot.purchased {
  opacity: 0.5;
}

.market-slot.locked {
  box-shadow: 0 0 6px rgba(255, 200, 0, 0.3);
}

.market-rarity {
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 3px;
  text-transform: uppercase;
}

.market-category {
  font-size: 10px;
  color: #888;
  letter-spacing: 2px;
}

.market-item-name {
  font-size: 16px;
  font-weight: 700;
  color: #fff;
  letter-spacing: 1px;
}

.market-item-desc {
  font-size: 12px;
  color: #aaa;
  line-height: 1.3;
}

.market-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 6px;
}

.market-buy-btn {
  background: #000;
  color: #fff;
  border: 1px solid #555;
  padding: 5px 14px;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 1px;
  cursor: pointer;
  transition: all 0.15s;
}

.market-buy-btn:hover:not(:disabled) {
  background: #222;
}

.market-buy-btn:disabled {
  opacity: 0.4;
  cursor: default;
}

.market-lock-btn {
  background: none;
  border: 1px solid #555;
  padding: 4px 8px;
  font-size: 14px;
  cursor: pointer;
  border-radius: 4px;
  transition: all 0.15s;
}

.market-lock-btn.active {
  border-color: #ffc800;
  box-shadow: 0 0 4px rgba(255, 200, 0, 0.3);
}

.market-bought-badge,
.market-owned-badge {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 2px;
  color: #666;
}

.market-bought-badge { color: #4ade80; }

/* ==================== COSMETIC PREVIEW CANVAS ==================== */

.cosmetic-preview {
  display: block;
  width: 150px;
  height: 190px;
  border: 1px solid #555;
  border-radius: 6px;
  background: #f0f0f0;
  flex-shrink: 0;
}

/* ==================== WARDROBE ==================== */

.wardrobe-content {
  max-width: 820px;
  width: 95%;
  height: 80vh;
  display: flex;
  flex-direction: column;
}

.wardrobe-body {
  display: flex;
  gap: 16px;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

.wardrobe-body .wardrobe-list {
  flex: 1;
  min-width: 0;
}

.wardrobe-body .cosmetic-preview {
  align-self: flex-start;
  position: sticky;
  top: 0;
  margin-top: 4px;
}

.wardrobe-tabs {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
  justify-content: center;
  margin-bottom: 10px;
}

.wardrobe-tab {
  background: #333;
  border: none;
  color: #aaa;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 2px;
  padding: 6px 12px;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  border-radius: 4px 4px 0 0;
  transition: all 0.15s;
}

.wardrobe-tab:hover {
  background: #444;
  color: #ccc;
}

.wardrobe-tab.active {
  background: #555;
  color: #fff;
  border-bottom-color: #fff;
}

.wardrobe-list {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 4px 0;
}

.wardrobe-empty {
  text-align: center;
  color: #999;
  padding: 30px 0;
  letter-spacing: 1px;
  font-size: 14px;
}

.wardrobe-item {
  background: #111;
  border: 1px solid #333;
  border-radius: 6px;
  padding: 10px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.wardrobe-item.equipped {
  border-color: #4ade80;
  box-shadow: 0 0 6px rgba(74, 222, 128, 0.15);
}

.wardrobe-item-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1;
}

.wardrobe-item-name {
  font-size: 14px;
  font-weight: 700;
  color: #fff;
  letter-spacing: 1px;
}

.wardrobe-item-rarity {
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 3px;
}

.wardrobe-item-desc {
  font-size: 11px;
  color: #aaa;
}

.wardrobe-equip-btn,
.wardrobe-unequip-btn {
  background: #000;
  color: #fff;
  border: 1px solid #555;
  padding: 5px 14px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 1px;
  cursor: pointer;
  transition: all 0.15s;
  flex-shrink: 0;
}

.wardrobe-equip-btn:hover {
  background: #222;
}

.wardrobe-unequip-btn {
  border-color: #4ade80;
  color: #4ade80;
}

.wardrobe-unequip-btn:hover {
  background: #1a3a1a;
}

/* ==================== RESPONSIVE — Narrow / Mobile ==================== */
@media (max-width: 540px) {
  /* Title shrinks so the header doesn't overflow (close btn is already absolute) */
  .shop-header {
    padding: 12px 52px 10px 12px;
    gap: 8px;
  }

  .shop-title {
    font-size: clamp(13px, 4.5vw, 28px);
    letter-spacing: clamp(1px, 1vw, 6px);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .shop-coins-display {
    font-size: 11px;
    letter-spacing: 1px;
    min-width: 0;
  }

  .shop-preview-label {
    font-size: 7px;
    letter-spacing: 2px;
  }
}
