@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;500;700;800&display=swap');

:root {
  --primary-gradient: linear-gradient(135deg, #FF6B6B, #FFD93D, #6BCBFF);
  --glass-bg: rgba(18, 18, 30, 0.65);
  --glass-bg-dense: rgba(18, 18, 30, 0.85);
  --glass-border: rgba(255, 255, 255, 0.12);
  --glass-blur: blur(20px) saturate(180%);
  --glass-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
  --accent-color: #FFD93D;
  --text-light: #F5F5F5;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: 'Outfit', sans-serif;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
}

/* --- Global Scrollbar Styling (Premium Glassmorphic Theme) --- */
* {
  scrollbar-width: thin;
  /* Opaque colours: older macOS Safari renders semi-transparent scrollbar parts
     against the OS's light base, so translucent rgba tracks/thumbs came out solid
     WHITE. Solid dark values can never blend to white on any engine. */
  scrollbar-color: #39485c #10151f;
}

::-webkit-scrollbar {
  /* -webkit-appearance:none is REQUIRED on macOS Safari: without it, Safari draws
     its default translucent OVERLAY scrollbar (which reads as a white bar) and
     ignores the track/thumb colours below entirely. Forcing appearance:none makes
     WebKit render the custom, styleable scrollbar so our dark colours take effect. */
  -webkit-appearance: none;
  appearance: none;
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: #10151f; /* opaque dark — never blends to white on older Safari */
  border-radius: 10px;
}

::-webkit-scrollbar-thumb {
  background: #39485c; /* opaque slate thumb */
  border-radius: 10px;
  border: 1px solid transparent;
  background-clip: padding-box;
  transition: background-color 0.2s ease;
}

::-webkit-scrollbar-corner { background: #10151f; } /* kill the white corner box too */

/* Header profile button: green dot when signed in (persistent login-status cue). */
.icon-btn.logged-in { position: relative; }
.icon-btn.logged-in::after {
  content: '';
  position: absolute;
  top: 6px;
  right: 6px;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #22c55e;
  box-shadow: 0 0 6px rgba(34, 197, 94, 0.9);
  border: 1.5px solid rgba(0, 0, 0, 0.45);
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(56, 189, 248, 0.45); /* Interactive cyan hover glow */
  border: 1px solid transparent;
  background-clip: padding-box;
}

::-webkit-scrollbar-thumb:active {
  background: rgba(56, 189, 248, 0.65);
  border: 1px solid transparent;
  background-clip: padding-box;
}

html, body {
  width: 100%;
  height: 100%;
  touch-action: none;
  overscroll-behavior: none;
}

body {
  background: #0f0f13;
  color: var(--text-light);
  /* Use dynamic viewport height if supported to prevent Safari UI cutoff */
  height: 100dvh;
  overflow: hidden;
  display: flex;
  justify-content: center;
  align-items: center;
}

#game-container {
  position: relative;
  width: 100%;
  height: 100%;
  overflow: hidden;
}

/* The Canvas Layer */
#game-canvas {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 1;
  background-color: #2b3a42; /* Default background representing the ground */
  cursor: crosshair;
  touch-action: none; /* JS owns all touch handling on the canvas */
}

/* UI Overlay Layer */
#ui-layer {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 10;
  pointer-events: none; /* Let clicks pass through by default */
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 20px;
  padding-top: max(20px, env(safe-area-inset-top));
  padding-bottom: max(20px, env(safe-area-inset-bottom));
  padding-left: max(20px, env(safe-area-inset-left));
  padding-right: max(20px, env(safe-area-inset-right));
}

/* Top Bar Stats */
.top-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  pointer-events: auto; /* Enable clicks on the bar */
}

.glass-panel {
  background: var(--glass-bg);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border: 1px solid var(--glass-border);
  border-radius: 16px;
  box-shadow: var(--glass-shadow);
  padding: 12px 24px;
}

.title-container {
  display: flex;
  align-items: center;
}



.game-logo {
  height: 60px;
  object-fit: contain;
  filter: drop-shadow(0 4px 6px rgba(0, 0, 0, 0.2));
  transform-origin: center center;
  opacity: 0; /* Hidden initially, shown after fly-in */
  transition: opacity 0.3s ease-out;
}
.game-logo.visible {
  opacity: 1;
}

.stats-container {
  display: flex;
  align-items: center;
  gap: 24px;
}

.stat-item {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 20px;
  font-weight: 700;
  line-height: 1;
  color: var(--text-light);
}

.stat-item .icon {
  font-size: 24px;
}

.stat-item.lives .value { color: #FF6B6B; }
.stat-item.money .value { color: #FFD93D; }
.stat-item.wave .value { color: #6BCBFF; }
.stat-item.difficulty .value { color: #FF9F43; }

#ui-difficulty-title {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 380px;
  display: inline-block;
  vertical-align: middle;
}

.stat-icon {
  display: block;
  width: 24px;
  height: 24px;
  object-fit: contain;
  margin: 0;
}

.icon-btn img {
  width: auto;
  height: 32px;
  object-fit: contain;
  pointer-events: none;
}

.ctx-icon {
  width: 18px;
  height: 18px;
  object-fit: contain;
  vertical-align: middle;
  margin-right: 4px;
}

.game-controls {
  display: none;
  position: absolute;
  top: 112px;
  right: 20px;
  background: var(--glass-bg-dense);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border: 1px solid var(--glass-border);
  border-radius: 18px;
  box-shadow: 0 20px 50px rgba(0,0,0,0.6);
  padding: 14px;
  flex-direction: column;
  gap: 8px;
  z-index: 1500;
  width: max-content;
  min-width: 250px;
  pointer-events: auto;
}

#pp-music-panel {
  position: absolute !important;
  top: 112px !important;
  right: 20px !important;
  background: var(--glass-bg-dense) !important;
  backdrop-filter: var(--glass-blur) !important;
  -webkit-backdrop-filter: var(--glass-blur) !important;
  border: 1px solid var(--glass-border) !important;
  border-radius: 18px !important;
  box-shadow: 0 20px 50px rgba(0,0,0,0.6) !important;
  color: #fff !important;
  font: 13px system-ui, sans-serif !important;
  overflow: hidden !important;
  z-index: 1500 !important;
  width: 320px !important;
  max-width: calc(100vw - 40px) !important;
}

.game-controls.show-menu {
  display: flex !important;
}

.menu-label {
  display: inline-block;
  font-size: 16px;
  font-weight: 600;
  color: var(--text-light);
  letter-spacing: 0.3px;
  white-space: nowrap;
}

.hamburger-btn {
  display: flex !important;
  cursor: pointer;
  user-select: none;
}

.icon-btn {
  background: transparent;
  border: none;
  border-radius: 0;
  color: var(--text-light);
  font-size: 24px;
  width: auto;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: transform 0.2s ease, opacity 0.2s ease;
  box-shadow: none;
  opacity: 0.85;
}

.game-controls .icon-btn {
  width: 100%;
  height: 52px;
  padding: 10px 18px;
  border-radius: 12px;
  justify-content: flex-start;
  gap: 12px;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.04);
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.game-controls .icon-btn:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.15);
  transform: translateX(4px);
  opacity: 1;
}

.game-controls .icon-btn img,
.game-controls .icon-btn svg {
  height: 30px;
  width: 30px;
  filter: drop-shadow(0 2px 5px rgba(0,0,0,0.3));
  transition: transform 0.2s ease;
}

.game-controls .icon-btn:hover img,
.game-controls .icon-btn:hover svg {
  transform: scale(1.1);
}

.icon-btn:hover {
  background: transparent;
  transform: scale(1.1);
  opacity: 1;
}

.icon-btn.active {
  opacity: 1;
  filter: drop-shadow(0 0 5px rgba(255, 217, 61, 0.6));
}

/* Modal Overlay */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 1;
  transition: opacity 0.3s ease;
  pointer-events: auto;
}

.modal-overlay.hidden {
  opacity: 0;
  pointer-events: none;
  visibility: hidden;
}

.modal-content {
  width: 400px;
  max-width: 90%;
  max-height: 90vh;
  overflow-y: auto;
  /* Allow vertical touch-scrolling inside modals - the global `* { touch-action: none }`
     would otherwise block scrolling modal content on iPad. */
  touch-action: pan-y;
  padding: 30px;
  border-radius: 20px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  box-shadow: 0 20px 50px rgba(0,0,0,0.5);
  color: var(--text-light);
}

/* Scrollable modal body (e.g. Course Library list) - allow vertical touch-scroll. */
.modal-body {
  touch-action: pan-y;
}

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

.modal-header h2 {
  margin: 0;
  font-size: 28px;
  color: var(--text-light);
}

.setting-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  color: var(--text-light);
}

.hidden {
  display: none !important;
}

.setting-row:last-child {
  border-bottom: none;
}

.setting-row label {
  flex: 1;
  text-align: left;
  margin-right: 20px;
  font-weight: 500;
  font-size: 15px;
  color: rgba(255, 255, 255, 0.9);
}

/* Slider Group holding custom range input and matching value */
.setting-row .slider-group {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 220px; /* Forces identical lengths and absolute vertical alignment! */
  justify-content: flex-end;
}

/* Premium Custom Range Sliders */
.setting-row .slider-group input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  background: transparent;
  cursor: pointer;
  flex: 1;
  width: 100%;
}

/* Track styling */
.setting-row .slider-group input[type="range"]::-webkit-slider-runnable-track {
  background: rgba(255, 255, 255, 0.08);
  height: 6px;
  border-radius: 3px;
  border: 1px solid rgba(255, 255, 255, 0.05);
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.3);
}

.setting-row .slider-group input[type="range"]::-moz-range-track {
  background: rgba(255, 255, 255, 0.08);
  height: 6px;
  border-radius: 3px;
  border: 1px solid rgba(255, 255, 255, 0.05);
}

/* Thumb styling */
.setting-row .slider-group input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  margin-top: -5px; /* Centers thumb on the track */
  background: #ffd93d;
  height: 16px;
  width: 16px;
  border-radius: 50%;
  box-shadow: 0 0 8px rgba(255, 217, 97, 0.6), inset 0 1px 0 rgba(255, 255, 255, 0.4);
  transition: transform 0.15s cubic-bezier(0.4, 0, 0.2, 1), background-color 0.2s ease;
}

.setting-row .slider-group input[type="range"]::-moz-range-thumb {
  background: #ffd93d;
  height: 16px;
  width: 16px;
  border-radius: 50%;
  border: none;
  box-shadow: 0 0 8px rgba(255, 217, 97, 0.6), inset 0 1px 0 rgba(255, 255, 255, 0.4);
  transition: transform 0.15s cubic-bezier(0.4, 0, 0.2, 1), background-color 0.2s ease;
}

/* Hover and active states for slider thumb */
.setting-row .slider-group input[type="range"]:hover::-webkit-slider-thumb {
  transform: scale(1.25);
  background: #ffea70;
  box-shadow: 0 0 12px rgba(255, 234, 112, 0.9);
}

.setting-row .slider-group input[type="range"]:active::-webkit-slider-thumb {
  transform: scale(0.95);
  background: #ffb700;
}

/* Fixed width numeric label */
.setting-row .slider-group span {
  width: 42px;
  text-align: right;
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  font-size: 14px;
  color: #ffd93d;
  text-shadow: 0 0 4px rgba(255, 217, 61, 0.2);
}

/* Premium Dropdown Select */
.setting-row select {
  background: rgba(255, 255, 255, 0.08) !important;
  border: 1px solid rgba(255, 255, 255, 0.15) !important;
  border-radius: 8px !important;
  color: #fff !important;
  padding: 6px 12px !important;
  font-family: inherit !important;
  font-size: 14px !important;
  outline: none !important;
  cursor: pointer !important;
  transition: all 0.2s ease !important;
  appearance: none;
  -webkit-appearance: none;
  padding-right: 32px !important;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='rgba(255,255,255,0.6)' stroke-width='2.5'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' d='M19.5 8.25l-7.5 7.5-7.5-7.5'/%3E%3C/svg%3E") !important;
  background-repeat: no-repeat !important;
  background-position: right 10px center !important;
  background-size: 12px !important;
}

.setting-row select:hover {
  background-color: rgba(255, 255, 255, 0.15) !important;
  border-color: rgba(255, 217, 61, 0.4) !important;
  box-shadow: 0 0 10px rgba(255, 217, 61, 0.15) !important;
}

.setting-row select:focus {
  border-color: rgba(255, 217, 61, 0.7) !important;
  box-shadow: 0 0 12px rgba(255, 217, 61, 0.3) !important;
}

.setting-row select option {
  background: #181825;
  color: #fff;
}

/* Premium Custom Checkboxes */
.setting-row input[type="checkbox"] {
  -webkit-appearance: none;
  appearance: none;
  width: 20px;
  height: 20px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 6px;
  cursor: pointer;
  display: grid;
  place-content: center;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.2);
  margin-right: 4px;
}

.setting-row input[type="checkbox"]:hover {
  background: rgba(255, 255, 255, 0.15);
  border-color: rgba(255, 255, 255, 0.35);
  box-shadow: 0 0 8px rgba(255, 255, 255, 0.15);
}

.setting-row input[type="checkbox"]:checked {
  background: rgba(255, 217, 61, 0.15) !important;
  border-color: rgba(255, 217, 61, 0.5) !important;
  box-shadow: 0 0 10px rgba(255, 217, 61, 0.3) !important;
}

.setting-row input[type="checkbox"]::before {
  content: "";
  width: 10px;
  height: 10px;
  transform: scale(0);
  transition: 120ms transform ease-in-out;
  box-shadow: inset 1em 1em #ffd93d;
  background-color: CanvasText;
  clip-path: polygon(14% 44%, 0 65%, 50% 100%, 100% 16%, 80% 0%, 43% 62%);
  border-radius: 1px;
}

.setting-row input[type="checkbox"]:checked::before {
  transform: scale(1.15);
}

/* Bottom Control Bar */
.bottom-bar {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  pointer-events: none;
}

/* Tower Selection Palette */
.tower-palette {
  display: flex;
  gap: 12px;
  pointer-events: auto;
}

.tower-btn {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--glass-border);
  border-radius: 12px;
  padding: 10px;
  width: 90px;
  height: 110px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  align-items: center;
  color: var(--text-light);
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
  box-shadow: 0 4px 15px rgba(0,0,0,0.2);
}

.tower-btn:hover {
  background: rgba(255, 255, 255, 0.15);
  transform: translateY(-5px);
  border-color: rgba(255, 255, 255, 0.3);
}

.tower-btn.selected {
  background: rgba(255, 217, 61, 0.2);
  border-color: var(--accent-color);
  transform: scale(1.05) translateY(-5px);
  box-shadow: 0 0 20px rgba(255, 217, 61, 0.4);
}

.tower-btn.disabled {
  opacity: 0.5;
  filter: grayscale(100%);
  cursor: not-allowed;
  transform: none;
}

.tower-icon {
  width: 48px;
  height: 48px;
  object-fit: contain;
  filter: drop-shadow(0 4px 6px rgba(0,0,0,0.5));
}

.tower-name {
  font-size: 11px;
  font-weight: 500;
  text-align: center;
  line-height: 1.2;
}

.tower-cost {
  font-size: 14px;
  font-weight: 800;
  color: var(--accent-color);
}

/* Action Buttons */
.action-controls {
  display: flex;
  flex-direction: column;
  gap: 12px;
  pointer-events: auto;
}

.btn {
  padding: 14px 28px;
  border-radius: 12px;
  border: 1px solid rgba(255,255,255,0.08);
  font-size: 16px;
  font-weight: 700;
  color: #fff;
  background: rgba(255, 255, 255, 0.12);
  backdrop-filter: blur(10px);
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 4px 15px rgba(0,0,0,0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.btn:hover {
  background: rgba(255, 255, 255, 0.2);
  transform: translateY(-1px);
}

#btn-confirm-yes {
  background: linear-gradient(135deg, #3a7bd5, #3a6073);
  border: none;
}

#btn-confirm-yes:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(58, 123, 213, 0.4);
}

.btn:disabled, .btn[disabled] {
  opacity: 0.5;
  filter: grayscale(100%);
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.btn-start {
  background: rgba(126, 231, 135, 0.12) !important;
  backdrop-filter: var(--glass-blur) !important;
  -webkit-backdrop-filter: var(--glass-blur) !important;
  border: 1px solid rgba(126, 231, 135, 0.32) !important;
  color: #7ee787 !important;
  box-shadow: 0 8px 32px rgba(12, 12, 28, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.1) !important;
  border-radius: 14px !important;
  font-weight: 700 !important;
  letter-spacing: 0.5px !important;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5) !important;
  transition: all 0.25s cubic-bezier(0.25, 0.8, 0.25, 1) !important;
}

.btn-start:hover {
  background: rgba(126, 231, 135, 0.22) !important;
  border-color: rgba(126, 231, 135, 0.55) !important;
  box-shadow: 0 12px 30px rgba(126, 231, 135, 0.25), inset 0 1px 0 rgba(255, 255, 255, 0.15) !important;
  transform: translateY(-2px) !important;
  color: #a3f7ab !important;
}

.btn-start:active {
  transform: translateY(1px) !important;
  box-shadow: 0 4px 15px rgba(126, 231, 135, 0.15) !important;
}

.btn-action {
  background: rgba(255,255,255,0.1);
  border: 1px solid var(--glass-border);
  backdrop-filter: blur(5px);
}

.btn-action:hover {
  background: rgba(255,255,255,0.2);
}

/* Context Menu for Upgrades */
#context-menu {
  position: fixed;
  bottom: 120px;
  left: 50%;
  transform: translateX(-50%);
  display: none;
  pointer-events: auto;
  min-width: 250px;
  width: max-content;
  max-width: 95vw;
  animation: slideUp 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  z-index: 1000;
}

#context-menu.active {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.context-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid rgba(255,255,255,0.1);
  padding-bottom: 8px;
  margin-bottom: 8px;
}

.context-title {
  color: var(--text-light);
  font-weight: 700;
}

.context-levels {
  display: flex;
  gap: 12px;
  margin-bottom: 12px;
}

.level-card {
  flex: 1;
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid var(--glass-border);
  border-radius: 8px;
  padding: 10px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  width: 150px;
  transition: transform 0.2s, box-shadow 0.2s;
}

.level-card.active {
  background: rgba(255, 217, 61, 0.1);
  border-color: var(--accent-color);
  box-shadow: 0 0 10px rgba(255, 217, 61, 0.2);
  transform: scale(1.05);
  z-index: 2;
}

.level-card.locked {
  opacity: 0.5;
  filter: grayscale(100%);
}

.lvl-icon {
  width: 60px;
  height: 60px;
  object-fit: contain;
  margin-bottom: 8px;
}

.lvl-label {
  font-weight: 700;
  color: var(--text-light);
  margin-bottom: 4px;
  font-size: 14px;
}

.lvl-flavor {
  font-size: 12px;
  line-height: 1.3;
  color: #FFD93D;
  font-style: italic;
  margin-bottom: 10px;
  flex-grow: 1;
}

.lvl-status {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 1px;
  padding: 4px 8px;
  border-radius: 4px;
  background: rgba(255,255,255,0.1);
  color: #ccc;
  width: 100%;
}

.level-card.active .lvl-status {
  background: var(--accent-color);
  color: #000;
  font-weight: 700;
}

.btn-action-card {
  width: 100%;
  margin-top: 8px;
}

/* Affordable upgrade = warm GOLD (matches the Permit currency it spends), with a
   glow so it clearly reads as buyable. */
.btn-upgrade {
  background: linear-gradient(135deg, #ffd54a, #e6a417);
  color: #3a2a06;
  font-weight: 800;
  border: 1px solid rgba(255, 255, 255, 0.4);
  box-shadow: 0 0 0 1px rgba(255, 214, 74, 0.4), 0 4px 14px rgba(230, 164, 23, 0.5);
}
.btn-upgrade:not(:disabled):hover,
.btn-upgrade:not(:disabled):active {
  background: linear-gradient(135deg, #ffe071, #f2b42a);
  box-shadow: 0 0 0 1px rgba(255, 231, 150, 0.65), 0 6px 20px rgba(230, 164, 23, 0.65);
  transform: translateY(-1px);
}
/* Can't afford yet: unmistakably inert — flat, dim, no glow (overrides the generic
   .btn:disabled so the difference from the bright buyable state is obvious). */
.btn-upgrade:disabled,
.btn-upgrade[disabled] {
  background: #2a3340 !important;
  color: rgba(255, 255, 255, 0.4) !important;
  border-color: rgba(255, 255, 255, 0.08);
  box-shadow: none !important;
  filter: none !important;
  opacity: 1 !important;
}

.btn-downgrade {
  background: linear-gradient(135deg, #FFB86B, #e67e22);
}

.btn-sell {
  background: linear-gradient(135deg, #ff6b6b, #c0392b);
}

@keyframes slideUp {
  from { opacity: 0; transform: translate(-50%, 20px); }
  to { opacity: 1; transform: translate(-50%, 0); }
}

/* Info tooltip */
.camera-dropdown {
  position: relative;
  display: inline-block;
}

.camera-dropdown-content {
  position: absolute;
  top: 100%;
  right: 0;
  margin-top: 10px;
  background: rgba(30, 30, 45, 0.95);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 12px;
  padding: 8px;
  min-width: 140px;
  display: flex;
  flex-direction: column;
  gap: 5px;
  z-index: 100;
  box-shadow: 0 10px 25px rgba(0,0,0,0.5);
  transition: opacity 0.2s, transform 0.2s;
}

.camera-dropdown-content.hidden {
  display: none;
}

.camera-mode-btn {
  background: transparent;
  color: #fff;
  border: 1px solid transparent;
  border-radius: 6px;
  padding: 8px 12px;
  font-family: inherit;
  font-weight: 500;
  cursor: pointer;
  text-align: left;
  transition: all 0.2s;
}

.camera-mode-btn:hover {
  background: rgba(255,255,255,0.1);
}

.camera-mode-btn.active {
  background: var(--accent-color);
  color: black;
  font-weight: bold;
}

#info-tooltip {
  position: absolute;
  top: 90px;
  left: 50%;
  transform: translateX(-50%);
  color: rgba(255,255,255,0.8);
  font-size: 14px;
  font-weight: 300;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.3s;
}

#info-tooltip.visible {
  opacity: 1;
}

/* Loading Overlay */
#loading-overlay {
  position: fixed;
  top: -10px; left: -10px; right: -10px; bottom: -10px;
  background: #0f0f13;
  z-index: 100;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  color: #fff;
  transition: opacity 0.5s, background 1.2s cubic-bezier(0.16, 1, 0.3, 1);
}






.spinner {
  width: 50px;
  height: 50px;
  border: 5px solid rgba(255,255,255,0.1);
  border-top-color: var(--accent-color);
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin-bottom: 20px;
}

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

.tower-btn img {
    -webkit-user-drag: none;
    user-select: none;
    pointer-events: none;
}

/* Mobile Responsiveness */
@media (max-width: 768px) {
  #ui-layer {
    padding: 10px;
    padding-top: max(10px, env(safe-area-inset-top));
    padding-bottom: max(10px, env(safe-area-inset-bottom));
    padding-left: max(10px, env(safe-area-inset-left));
    padding-right: max(10px, env(safe-area-inset-right));
  }

  .glass-panel {
    padding: 8px 12px;
  }

  .top-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 12px;
    align-items: center;
    justify-content: space-between;
    padding: 8px 14px;
  }

  .title-container {
    width: auto;
    flex: 1 1 auto;
    justify-content: flex-start;
    order: 1;
    display: flex;
  }

  .top-bar-controls-container {
    position: relative;
    order: 2;
    margin-left: auto;
    display: flex;
    align-items: center;
  }

  .hamburger-btn {
    display: flex !important;
  }

  .game-controls {
    display: none;
    position: absolute;
    top: 76px;
    right: 10px;
    background: var(--glass-bg-dense);
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    box-shadow: var(--glass-shadow);
    padding: 10px;
    flex-direction: column;
    gap: 10px;
    z-index: 1500;
    pointer-events: auto;
  }

  #pp-music-panel {
    top: calc(76px + env(safe-area-inset-top)) !important;
    right: max(10px, env(safe-area-inset-right)) !important;
    border-radius: 16px !important;
    max-width: calc(100vw - 20px) !important;
  }

  .game-controls.show-menu {
    display: flex;
  }

  .game-logo {
    height: 40px;
  }

  .stat-item {
    font-size: 16px;
    gap: 4px;
  }

  .stats-container {
    width: 100%;
    order: 3;
    gap: 10px;
    flex-wrap: nowrap;
    justify-content: space-around;
    padding-top: 6px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
  }

  #ui-difficulty-title {
    max-width: 110px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: inline-block;
    vertical-align: middle;
  }

  #ui-difficulty-icon {
    width: 24px !important;
    height: 24px !important;
  }

  .stat-icon {
    width: 20px;
    height: 20px;
  }

  .icon-btn {
    width: 40px;
    height: 40px;
    font-size: 20px;
  }

  .bottom-bar {
    flex-direction: column-reverse;
    align-items: center;
    gap: 10px;
  }

  .tower-palette {
    gap: 8px;
    width: 100%;
    justify-content: flex-start;
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none; /* Firefox */
    -ms-overflow-style: none; /* IE and Edge */
  }

  .tower-palette::-webkit-scrollbar {
    display: none; /* Chrome, Safari and Opera */
  }

  .tower-btn {
    width: 70px;
    height: 90px;
    padding: 6px;
  }

  .tower-icon {
    width: 36px;
    height: 36px;
  }

  .tower-name {
    font-size: 9px;
  }

  .tower-cost {
    font-size: 12px;
  }

  .btn {
    padding: 10px 20px;
    font-size: 14px;
  }

  .modal-content {
    padding: 20px;
  }

  .setting-row input[type="range"] {
    width: 100px;
  }

  #context-menu {
    bottom: 180px; /* Above the stacked bottom bar */
    width: 95vw;
  }

  .context-levels {
    flex-direction: column;
    gap: 8px;
    max-height: 40vh;
    overflow-y: auto;
  }

  .level-card {
    width: 100%;
    flex-direction: row;
    text-align: left;
    padding: 8px;
    height: auto;
  }

  .lvl-icon {
    width: 45px;
    height: 45px;
    margin-right: 12px;
    margin-bottom: 0;
  }
  
  .lvl-label {
    min-width: 60px;
    margin-bottom: 0;
    margin-right: 10px;
  }

  .lvl-flavor {
    margin-bottom: 0;
    margin-right: 10px;
  }

  .lvl-status {
    width: auto;
    margin-left: auto;
  }

  .context-actions {
    flex-direction: column;
  }
}

@media (max-width: 480px) {
  .top-bar {
    padding: 6px 10px;
    gap: 6px 10px;
  }
  .game-logo {
    height: 30px;
  }
  .stats-container {
    gap: 6px;
    justify-content: space-between;
  }
  .stat-item {
    font-size: 13px;
    gap: 3px;
  }
  .stat-icon {
    width: 15px;
    height: 15px;
  }
  #ui-difficulty-title {
    max-width: 75px;
  }
  #ui-difficulty-icon {
    width: 20px !important;
    height: 20px !important;
  }
}


#intro-streamers {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  z-index: 100;
  pointer-events: none;
  perspective: 800px;
  transform-style: preserve-3d;
}



.blinking-text {
  animation: blink 1.5s infinite;
}

@keyframes blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.2; }
}

body.demo-mode-active .top-bar,
body.demo-mode-active .bottom-bar,
body.demo-mode-active .modal-overlay,
body.demo-mode-active #campaign-watermark,
body.demo-mode-active #tower-tray,
body.demo-mode-active #tower-info-panel {
  display: none !important;
}

/* Now Playing Music Toaster */
.music-toaster {
  position: absolute;
  top: 90px;
  right: 20px;
  width: 320px;
  background: rgba(15, 15, 30, 0.85);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(255, 215, 0, 0.3);
  border-left: 4px solid #FFD700;
  border-radius: 12px;
  padding: 12px 18px;
  display: flex;
  align-items: center;
  gap: 14px;
  color: #fff;
  font-family: 'Outfit', 'Inter', sans-serif;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5), inset 0 1px 1px rgba(255,255,255,0.1);
  z-index: 110;
  transform: translateX(360px);
  transition: transform 0.6s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.4s ease;
  opacity: 0;
  pointer-events: none;
}

.music-toaster.active {
  transform: translateX(0);
  opacity: 1;
  pointer-events: auto;
}

.music-icon-container {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  background: rgba(255, 215, 0, 0.1);
  border-radius: 10px;
  font-size: 1.5em;
  color: #FFD700;
  flex-shrink: 0;
  animation: pulse-gold 2s infinite ease-in-out;
}

.music-toaster-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex-grow: 1;
  min-width: 0;
}

.music-toaster-title {
  font-size: 1.05em;
  font-weight: 700;
  color: #FFD700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  letter-spacing: 0.5px;
}

.music-toaster-flavor {
  font-size: 0.85em;
  color: #cccccc;
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-overflow: ellipsis;
}

@keyframes pulse-gold {
  0%, 100% { transform: scale(1); box-shadow: 0 0 0 rgba(255, 215, 0, 0); }
  50% { transform: scale(1.05); box-shadow: 0 0 10px rgba(255, 215, 0, 0.3); }
}

/* Premium Top-Bar Camera Split Control */
.camera-control-group {
  display: flex;
  align-items: center;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 10px;
  height: 38px;
  position: relative;
  transition: all 0.25s ease;
}

.camera-control-group:hover {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.15);
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.camera-control-btn-main {
  background: transparent;
  border: none;
  height: 100%;
  padding: 0 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--text-light);
  transition: all 0.2s ease;
  border-radius: 9px 0 0 10px;
  opacity: 0.85;
}

.camera-control-btn-main:hover {
  background: rgba(255, 255, 255, 0.05);
  opacity: 1;
}

.camera-control-btn-main img {
  height: 20px;
  width: 20px;
  transition: transform 0.2s ease;
}

.camera-control-btn-main:hover img {
  transform: scale(1.15) rotate(-5deg);
}

.camera-control-btn-arrow {
  background: transparent;
  border: none;
  height: 100%;
  padding: 0 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: rgba(255, 255, 255, 0.5);
  transition: all 0.2s ease;
  border-left: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 0 9px 10px 0;
  font-size: 11px;
}

.camera-control-btn-arrow:hover {
  background: rgba(255, 255, 255, 0.05);
  color: #fff;
}

.camera-control-btn-arrow span {
  transition: transform 0.25s ease;
}

.camera-control-group.dropdown-active .camera-control-btn-arrow span {
  transform: rotate(180deg);
}

/* Glassmorphic Dropdown Overlay */
.top-camera-dropdown {
  position: absolute;
  top: 100%;
  right: 0;
  margin-top: 8px;
  background: rgba(18, 18, 30, 0.96);
  backdrop-filter: blur(20px) saturate(180%);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 12px;
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.6), inset 0 1px 0 rgba(255,255,255,0.05);
  padding: 6px;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 150px;
  transform-origin: top right;
  animation: dropdown-scale-in 0.22s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.top-camera-dropdown.hidden {
  display: none !important;
}

@keyframes dropdown-scale-in {
  0% { transform: scale(0.9) translateY(-6px); opacity: 0; }
  100% { transform: scale(1) translateY(0); opacity: 1; }
}

.top-camera-mode-btn {
  background: transparent;
  border: none;
  color: rgba(255, 255, 255, 0.7);
  padding: 10px 14px;
  border-radius: 8px;
  cursor: pointer;
  text-align: left;
  font-size: 13.5px;
  font-weight: 500;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.top-camera-mode-btn:hover {
  background: rgba(255, 255, 255, 0.06);
  color: #fff;
  transform: translateX(3px);
}

.top-camera-mode-btn.active {
  background: rgba(255, 215, 0, 0.1);
  color: #FFD700;
  font-weight: 600;
  border-left: 3px solid #FFD700;
  border-radius: 4px 8px 8px 4px;
}

/* Premium Seed Info Trigger & Popover Styles */
.seed-info-trigger {
  position: relative;
}

.seed-info-trigger:hover .seed-info-popover {
  opacity: 1 !important;
  pointer-events: auto !important;
  transform: translateX(-50%) translateY(0) !important;
}

/* ==========================================================================
   Left Slide-out Tower Tray Drawer & Tower Info Stats Panel Styles
   ========================================================================== */

#tower-tray {
  position: absolute;
  top: calc(125px + env(safe-area-inset-top));
  left: 0;
  bottom: calc(75px + env(safe-area-inset-bottom));
  width: 125px;
  touch-action: pan-y !important;
  z-index: 100;
  display: flex;
  flex-direction: column;
  padding: 16px 8px;
  border-radius: 0 20px 20px 0;
  border: 1px solid var(--glass-border);
  border-left: none;
  background: var(--glass-bg);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  box-shadow: 8px 0 25px rgba(0, 0, 0, 0.37);
  transform: translateX(0);
  transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
  pointer-events: auto;
}

#tower-tray.collapsed {
  transform: translateX(-100%);
}

/* Handle tab on the right edge of the tray - positioned elegantly near the top header */
.tray-toggle-btn {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  right: -31px; /* Overlap by 1px to hide borders perfectly */
  width: 32px;
  height: 120px;
  background: var(--glass-bg);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border: 1px solid var(--glass-border);
  border-left: none;
  border-radius: 0 16px 16px 0;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent-color);
  font-size: 16px;
  box-shadow: inset 0px 1.5px 0px rgba(255, 255, 255, 0.25), 0px 8px 32px rgba(0, 0, 0, 0.25);
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  z-index: 101; /* Lifted slightly above the tray to cover borders */
}

/* Mask the glass border of the tray on the left of the button to look completely attached */
.tray-toggle-btn::before {
  content: '';
  position: absolute;
  top: 1px;
  bottom: 1px;
  left: -4px;
  width: 5px;
  background: var(--glass-bg); /* Use matching semi-transparent glass background */
  z-index: 102; /* Positioned directly over the border */
}

.tray-toggle-btn:hover {
  background: var(--glass-bg-dense);
  color: #FFFFFF;
  border-color: rgba(255, 217, 61, 0.4); /* Elegant gold accent border glow */
  border-left: none;
  box-shadow: inset 0px 1.5px 0px rgba(255, 255, 255, 0.25), 
              0 0 15px rgba(255, 217, 61, 0.25), 
              0 8px 32px rgba(0, 0, 0, 0.35);
}

.tray-toggle-btn .toggle-icon {
  display: inline-block;
  transition: transform 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  color: var(--accent-color);
  font-size: 20px;
  font-weight: 700;
}

#tower-tray:not(.collapsed) .tray-toggle-btn:hover .toggle-icon {
  transform: translateX(-3px) scale(1.2);
  color: #FFFFFF;
}

#tower-tray.collapsed .tray-toggle-btn:hover .toggle-icon {
  transform: translateX(3px) scale(1.2);
  color: #FFFFFF;
}

.tray-header {
  text-align: center;
  margin-bottom: 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  padding-bottom: 6px;
}

.tray-header h3 {
  margin: 0;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: var(--text-light);
}

.tray-palette {
  display: flex;
  flex-direction: column;
  gap: 10px;
  overflow-y: auto;
  min-height: 0; /* Critical for nested flex scrolling */
  touch-action: pan-y !important;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch; /* Momentum mobile scrolling */
  flex: 1;
  scrollbar-width: thin; /* Firefox */
  scrollbar-color: rgba(0, 236, 255, 0.2) rgba(255, 255, 255, 0.02);
  padding: 4px 6px; /* amble space for glowing side box-shadows */
}

.tray-palette::-webkit-scrollbar {
  width: 6px;
}
.tray-palette::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.01);
  border-radius: 3px;
  border-left: 1px solid rgba(255, 255, 255, 0.02);
}
.tray-palette::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.12);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  border-radius: 3px;
  border: 1px solid rgba(255, 255, 255, 0.15);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.2), 0 1px 4px rgba(0, 0, 0, 0.15);
  transition: background 0.2s ease, border-color 0.2s ease;
}
.tray-palette::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.25);
  border-color: rgba(255, 255, 255, 0.3);
}

/* Redesign Tower Buttons inside the Tray */
#tower-tray .tower-btn {
  width: 100%;
  height: 85px;
  min-height: 85px;
  padding: 8px 4px;
  background: rgba(255, 255, 255, 0.02);
  border-radius: 12px;
  justify-content: space-around;
  transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
  border: 1px solid rgba(255, 255, 255, 0.05);
}

#tower-tray .tower-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  transform: scale(1.02); /* elegant scale zoom stays centered */
  border-color: rgba(0, 236, 255, 0.5);
  box-shadow: 0 0 12px rgba(0, 236, 255, 0.25);
}

#tower-tray .tower-btn.selected {
  background: rgba(0, 236, 255, 0.15);
  border-color: #00ecff;
  transform: scale(1.04); /* centered glowing focus */
  box-shadow: 0 0 15px rgba(0, 236, 255, 0.45);
}

#tower-tray .tower-btn.disabled {
  opacity: 0.5;
  filter: grayscale(80%);
  cursor: pointer; /* Keep cursor pointer to open the info-panel */
}

#tower-tray .tower-icon {
  width: 32px;
  height: 32px;
}

#tower-tray .tower-name {
  font-size: 9.5px;
  font-weight: 600;
  text-shadow: 1px 1px 2px black;
}

#tower-tray .tower-cost {
  font-size: 11px;
}

/* ==========================================================================
   Tower Info/Stats Panel Styles
   ========================================================================== */
#tower-info-panel {
  position: absolute;
  top: calc(125px + env(safe-area-inset-top));
  left: 140px; /* Sits right next to the tray */
  width: 350px;
  max-height: calc(100% - 250px - env(safe-area-inset-top) - env(safe-area-inset-bottom));
  touch-action: pan-y !important;
  z-index: 95;
  display: flex;
  flex-direction: column;
  padding: 20px;
  background: rgba(8, 8, 20, 0.94);
  border: 1px solid rgba(0, 236, 255, 0.25);
  box-shadow: 15px 0 35px rgba(0, 0, 0, 0.7), 0 0 20px rgba(0, 236, 255, 0.1);
  border-radius: 20px;
  pointer-events: auto;
  transform: translateX(0);
  opacity: 1;
  transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

#tower-info-panel.hidden {
  transform: translateX(-30px);
  opacity: 0;
  pointer-events: none;
}

.info-panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid rgba(0, 236, 255, 0.2);
  padding-bottom: 10px;
  margin-bottom: 12px;
}

#info-panel-title {
  margin: 0;
  font-size: 20px;
  color: #00ecff;
  text-shadow: 0 0 10px rgba(0, 236, 255, 0.5);
  font-weight: 800;
  letter-spacing: 1px;
}

.info-panel-body {
  flex: 1;
  overflow-y: auto;
  touch-action: pan-y !important;
  -webkit-overflow-scrolling: touch; /* Momentum mobile scrolling */
  scrollbar-width: none;
}

.info-panel-body::-webkit-scrollbar {
  display: none;
}

.info-level-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  touch-action: pan-y !important;
}

.info-level-row {
  display: flex;
  gap: 12px;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.04);
  border-radius: 12px;
  padding: 10px;
  align-items: center;
  transition: all 0.2s ease;
}

.info-level-row:hover {
  background: rgba(0, 236, 255, 0.04);
  border-color: rgba(0, 236, 255, 0.2);
}

.info-level-icon {
  width: 36px;
  height: 36px;
  object-fit: contain;
  filter: drop-shadow(0 2px 4px rgba(0,0,0,0.6));
}

.info-level-details {
  flex: 1;
}

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

.info-level-name {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-light);
}

.info-level-cost {
  font-size: 12px;
  font-weight: 800;
  color: var(--accent-color);
}

.info-level-desc {
  margin: 0;
  font-size: 11px;
  color: rgba(255, 255, 255, 0.65);
  line-height: 1.4;
}

.info-panel-footer {
  margin-top: 15px;
  padding-top: 10px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

#btn-info-purchase {
  width: 100%;
  font-size: 14px;
  font-weight: 700;
  padding: 10px;
  background: linear-gradient(135deg, #00ecff, #0082b3) !important;
  border: none;
  box-shadow: 0 0 15px rgba(0, 236, 255, 0.3);
  text-transform: uppercase;
  letter-spacing: 1px;
}

#btn-info-purchase:hover {
  background: linear-gradient(135deg, #00f3ff, #009ad1) !important;
  box-shadow: 0 0 20px rgba(0, 236, 255, 0.5);
}

#btn-info-purchase.disabled {
  background: rgba(255, 255, 255, 0.08) !important;
  color: rgba(255, 255, 255, 0.3) !important;
  cursor: not-allowed;
  box-shadow: none;
}

/* ==========================================================================
   Responsive Overrides for Mobile/Tablets
   ========================================================================== */
@media (max-width: 768px) {
  #tower-tray {
    top: calc(135px + env(safe-area-inset-top));
    bottom: calc(85px + env(safe-area-inset-bottom));
    width: 95px;
    padding: 10px 4px;
  }
  
  .tray-toggle-btn {
    top: 50%;
    transform: translateY(-50%);
    right: -26px;
    width: 26px;
    height: 80px;
    border: 1.5px solid rgba(5, 5, 10, 0.95);
    border-left: none;
    border-radius: 0 12px 12px 0;
    font-size: 13px;
    box-shadow: inset 0px 1px 0px rgba(255, 255, 255, 0.25), 3px 0 12px rgba(0, 236, 255, 0.1);
  }
  
  .tray-header h3 {
    font-size: 9px;
    letter-spacing: 1px;
  }
  
  #tower-tray .tower-btn {
    height: 70px;
    min-height: 70px;
    padding: 4px 2px;
  }
  
  #tower-tray .tower-icon {
    width: 24px;
    height: 24px;
  }
  
  #tower-tray .tower-name {
    font-size: 8px;
  }
  
  #tower-tray .tower-cost {
    font-size: 9.5px;
  }
  
  #tower-info-panel {
    top: calc(135px + env(safe-area-inset-top));
    left: 105px;
    width: calc(100% - 120px);
    max-height: calc(100% - 150px - env(safe-area-inset-top) - env(safe-area-inset-bottom));
    padding: 12px;
  }

  /* Right-align difficulty tooltip on mobile so it never overflows off-screen */
  .difficulty-tooltip {
    left: auto !important;
    right: 0 !important;
    transform: translateY(-10px) !important;
  }
  .stat-item.difficulty:hover .difficulty-tooltip,
  .stat-item.difficulty.active .difficulty-tooltip {
    transform: translateY(0) !important;
  }
  .difficulty-tooltip::before {
    left: auto !important;
    right: 15px !important;
    transform: none !important;
  }
  
  #info-panel-title {
    font-size: 16px;
  }
  
  .info-level-row {
    padding: 6px;
    gap: 8px;
  }
  
  .info-level-icon {
    width: 28px;
    height: 28px;
  }
  
  .info-level-name, .info-level-cost {
    font-size: 10.5px;
  }
  
  .info-level-desc {
    font-size: 9.5px;
  }

  #btn-info-purchase {
    font-size: 11.5px;
    padding: 8px;
    letter-spacing: 0.5px;
  }
}

.difficulty-icon-wrapper {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

/* Difficulty HUD Tooltip */
.difficulty-tooltip {
  position: absolute;
  top: calc(100% + 10px);
  left: 50%;
  transform: translateX(-50%) translateY(-10px);
  width: 180px;
  padding: 8px 12px;
  background: rgba(10, 20, 35, 0.96);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 10px;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.5);
  text-align: center;
  pointer-events: none;
  opacity: 0;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  z-index: 10000;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.difficulty-tooltip::before {
  content: '';
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%);
  border-width: 6px;
  border-style: solid;
  border-color: transparent transparent rgba(10, 20, 35, 0.96) transparent;
}

.stat-item.difficulty {
  position: relative;
  cursor: pointer;
}

.stat-item.difficulty:hover .difficulty-tooltip,
.stat-item.difficulty.active .difficulty-tooltip {
  opacity: 1;
  pointer-events: auto;
  transform: translateX(-50%) translateY(0);
}

.difficulty-tooltip .tooltip-title {
  font-size: 13px;
  font-weight: 800;
  color: #fff;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  text-shadow: 0 0 8px rgba(255, 159, 67, 0.4);
}

.difficulty-tooltip .tooltip-detail {
  font-size: 11px;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.65);
}

/* Landscape / Low-Height Screen Overrides (e.g. Mobile Landscape) */
@media (max-height: 520px) {
  /* Slim Top Bar */
  .top-bar {
    padding: 4px 12px !important;
    gap: 4px 8px !important;
  }

  .game-logo {
    height: 26px !important;
  }

  .stats-container {
    gap: 8px !important;
  }

  .stat-item {
    font-size: 13px !important;
    gap: 4px !important;
  }

  .stat-icon {
    width: 15px !important;
    height: 15px !important;
  }

  #ui-difficulty-title {
    max-width: 120px !important;
  }

  #ui-difficulty-icon {
    width: 20px !important;
    height: 20px !important;
  }

  .icon-btn {
    width: 32px !important;
    height: 32px !important;
    font-size: 15px !important;
  }

  .icon-btn img {
    width: 18px !important;
    height: 18px !important;
  }

  .camera-control-btn-main {
    height: 32px !important;
    padding: 0 6px !important;
  }

  .camera-control-btn-main img {
    width: 18px !important;
    height: 18px !important;
  }

  .camera-control-btn-arrow {
    height: 32px !important;
    width: 18px !important;
  }

  /* Compact Tower Tray starting below slim header */
  #tower-tray {
    top: 48px !important;
    bottom: 8px !important;
    width: 80px !important;
    padding: 6px 4px !important;
  }

  .tray-toggle-btn {
    height: 60px !important;
    right: -22px !important;
    width: 22px !important;
    font-size: 11px !important;
  }

  .tray-header {
    margin-bottom: 4px !important;
  }

  .tray-header h3 {
    font-size: 8px !important;
    letter-spacing: 0.5px !important;
  }

  .tray-palette {
    gap: 5px !important;
    padding: 2px 2px !important;
  }

  #tower-tray .tower-btn {
    height: 48px !important;
    min-height: 48px !important;
    padding: 2px 2px !important;
    border-radius: 6px !important;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 2px !important;
  }

  #tower-tray .tower-icon {
    width: 20px !important;
    height: 20px !important;
  }

  #tower-tray .tower-name {
    display: none !important; /* Hide tower name on landscape sidebar to fit everything vertically */
  }

  #tower-tray .tower-cost {
    font-size: 8.5px !important;
    line-height: 1 !important;
  }

  /* Compact Adjacent Info Panel */
  #tower-info-panel {
    top: 48px !important;
    left: 90px !important;
    width: 260px !important; /* Keep floating panel narrow to leave space for the game field on the right! */
    max-height: calc(100% - 56px) !important;
    padding: 10px !important;
    border-radius: 12px !important;
  }

  .info-panel-header {
    padding-bottom: 6px !important;
    margin-bottom: 8px !important;
  }

  #info-panel-title {
    font-size: 14px !important;
  }

  .info-level-list {
    gap: 5px !important;
  }

  .info-level-row {
    padding: 4px 6px !important;
    gap: 8px !important;
    border-radius: 6px !important;
  }

  .info-level-icon {
    width: 22px !important;
    height: 22px !important;
  }

  .info-level-name, .info-level-cost {
    font-size: 9.5px !important;
  }

  .info-level-desc {
    font-size: 8.5px !important;
    margin: 2px 0 0 0 !important;
    line-height: 1.2 !important;
  }

  .info-panel-footer {
    margin-top: 6px !important;
  }

  #btn-info-purchase {
    font-size: 10.5px !important;
    padding: 6px !important;
    letter-spacing: 0.5px !important;
  }
}

/* Custom Super-Compact HUD for Extremely Narrow Screens (e.g., iPhone SE/13/14 Pro in Portrait) */
@media (max-width: 480px) {
  .stats-container {
    gap: 4px !important;
    justify-content: space-between !important;
  }
  .stat-item {
    font-size: 13px !important;
    gap: 2px !important;
  }
  .stat-icon {
    width: 15px !important;
    height: 15px !important;
  }
  #ui-difficulty-title {
    max-width: 65px !important;
  }
  #ui-difficulty-icon {
    width: 18px !important;
    height: 18px !important;
  }
}

/* Modal Responsive Padding & Sizes for Small/Short Mobile Viewports */
@media (max-width: 768px) {
  .modal-content {
    padding: 20px !important;
    border-radius: 16px !important;
  }
}
@media (max-height: 480px) {
  .modal-content {
    padding: 12px 16px !important;
    gap: 12px !important;
  }
  .modal-header h2 {
    font-size: 20px !important;
  }
}

/* ==========================================================================
   End of Game (Victory & Game Over) Modal Styles
   ========================================================================== */

/* Enhanced Overlay with denser glass blurring */
#victory-modal, #game-over-modal {
  background: rgba(8, 8, 14, 0.78);
  backdrop-filter: blur(14px) saturate(140%);
  -webkit-backdrop-filter: blur(14px) saturate(140%);
}

/* Custom modal content wrapper */
.end-game-card {
  width: 460px !important;
  max-width: 92% !important;
  border-radius: 24px !important;
  padding: 32px !important;
  text-align: center;
  position: relative;
  overflow: hidden;
  transition: all 0.5s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: inset 0px 1.5px 0px rgba(255, 255, 255, 0.15), 
              0 24px 64px rgba(0, 0, 0, 0.5) !important;
}

#victory-modal .end-game-card {
  border: 1px solid rgba(74, 222, 128, 0.35) !important; /* Subtle green highlight border */
  background: linear-gradient(180deg, rgba(20, 32, 24, 0.85) 0%, rgba(12, 12, 22, 0.85) 100%) !important;
}

#game-over-modal .end-game-card {
  border: 1px solid rgba(239, 68, 68, 0.35) !important; /* Subtle red highlight border */
  background: linear-gradient(180deg, rgba(32, 20, 20, 0.85) 0%, rgba(12, 12, 22, 0.85) 100%) !important;
}

/* Animated header logos */
.end-game-logo {
  max-width: 85%;
  height: auto;
  display: block;
  margin: 0 auto;
  transform-origin: center;
}

#victory-modal .end-game-logo {
  animation: logo-pulse-green 4s ease-in-out infinite;
}

#game-over-modal .end-game-logo {
  animation: logo-pulse-red 4s ease-in-out infinite;
}

@keyframes logo-pulse-green {
  0% { filter: drop-shadow(0 4px 12px rgba(74, 222, 128, 0.2)); transform: scale(1); }
  50% { filter: drop-shadow(0 12px 28px rgba(74, 222, 128, 0.45)); transform: scale(1.02); }
  100% { filter: drop-shadow(0 4px 12px rgba(74, 222, 128, 0.2)); transform: scale(1); }
}

@keyframes logo-pulse-red {
  0% { filter: drop-shadow(0 4px 12px rgba(239, 68, 68, 0.2)); transform: scale(1); }
  50% { filter: drop-shadow(0 12px 28px rgba(239, 68, 68, 0.45)); transform: scale(1.02); }
  100% { filter: drop-shadow(0 4px 12px rgba(239, 68, 68, 0.2)); transform: scale(1); }
}

/* Subtitles */
.end-game-subtitle {
  color: rgba(255, 255, 255, 0.95);
  font-size: 1.25em;
  font-weight: 700;
  margin: 20px 0 15px 0;
  letter-spacing: 0.5px;
}

/* Row-capsule stats */
.stats-capsules-container {
  display: flex;
  gap: 12px;
  justify-content: space-between;
  margin: 20px 0;
}

.stat-capsule {
  flex: 1;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 14px;
  padding: 12px 8px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  align-items: center;
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.stat-capsule:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.2);
  transform: translateY(-2px);
}

.stat-capsule-label {
  font-size: 0.8em;
  font-weight: 500;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.5);
  letter-spacing: 1px;
}

.stat-capsule-val {
  font-size: 1.25em;
  font-weight: 800;
}

/* Score displays */
.score-card-badge {
  background: linear-gradient(135deg, rgba(255, 217, 61, 0.12) 0%, rgba(255, 217, 61, 0.03) 100%);
  border: 1px solid rgba(255, 217, 61, 0.35);
  box-shadow: 0 0 25px rgba(255, 217, 61, 0.06), inset 0 1px 0 rgba(255, 255, 255, 0.15);
  border-radius: 16px;
  padding: 16px 28px;
  margin: 15px auto;
  width: fit-content;
  display: flex;
  flex-direction: column;
  gap: 4px;
  align-items: center;
  transition: all 0.3s ease;
}

.score-card-badge:hover {
  border-color: rgba(255, 217, 61, 0.6);
  box-shadow: 0 0 30px rgba(255, 217, 61, 0.12), inset 0 1px 0 rgba(255, 255, 255, 0.2);
  transform: scale(1.03);
}

.score-card-label {
  font-size: 0.85em;
  font-weight: 500;
  text-transform: uppercase;
  color: rgba(255, 217, 61, 0.7);
  letter-spacing: 1.5px;
}

.score-card-val {
  font-size: 1.8em;
  font-weight: 800;
  color: var(--accent-color);
  text-shadow: 0 0 12px rgba(255, 217, 61, 0.3);
}

.wallet-score-info {
  font-size: 1.05em;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.85);
  margin-top: 5px;
}

/* Warnings */
.modal-warn-block {
  margin: 15px auto 25px auto;
  max-width: 380px;
  padding: 12px 18px;
  border-radius: 14px;
  background: rgba(239, 68, 68, 0.08);
  border: 1px solid rgba(239, 68, 68, 0.35);
  color: #fca5a5;
  font-size: 0.9em;
  line-height: 1.4;
  text-align: center;
  box-shadow: 0 4px 12px rgba(239, 68, 68, 0.05);
}

/* Replay / Next level button styles */
.end-game-btn-container {
  display: flex;
  gap: 16px;
  justify-content: center;
  margin-top: 24px;
  flex-wrap: wrap;
}

.btn-replay-frosted {
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.08) 0%, rgba(255, 255, 255, 0.03) 100%) !important;
  border: 1px solid rgba(255, 255, 255, 0.16) !important;
  backdrop-filter: blur(10px) saturate(140%) !important;
  -webkit-backdrop-filter: blur(10px) saturate(140%) !important;
  color: #FFFFFF !important;
  box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37), inset 0 1px 0 rgba(255, 255, 255, 0.1) !important;
  min-width: 170px;
  height: 50px;
  border-radius: 14px !important;
  font-weight: 700 !important;
  font-size: 0.95em !important;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 8px !important;
}

.btn-replay-frosted:hover {
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.16) 0%, rgba(255, 255, 255, 0.06) 100%) !important;
  border-color: rgba(255, 255, 255, 0.32) !important;
  transform: translateY(-3px) scale(1.03) !important;
  box-shadow: 0 12px 40px 0 rgba(255, 255, 255, 0.15), inset 0 1px 0 rgba(255, 255, 255, 0.2) !important;
}

.btn-next-emerald {
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.25) 0%, rgba(5, 150, 105, 0.1) 100%) !important;
  border: 1px solid rgba(52, 211, 153, 0.5) !important;
  backdrop-filter: blur(10px) saturate(140%) !important;
  -webkit-backdrop-filter: blur(10px) saturate(140%) !important;
  color: #a7f3d0 !important;
  box-shadow: 0 8px 32px 0 rgba(16, 185, 129, 0.2), inset 0 1px 0 rgba(255, 255, 255, 0.1) !important;
  min-width: 170px;
  height: 50px;
  border-radius: 14px !important;
  font-weight: 700 !important;
  font-size: 0.95em !important;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 8px !important;
}

.btn-next-emerald:hover {
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.4) 0%, rgba(5, 150, 105, 0.18) 100%) !important;
  border-color: rgba(52, 211, 153, 0.8) !important;
  color: #FFFFFF !important;
  transform: translateY(-3px) scale(1.03) !important;
  box-shadow: 0 12px 40px 0 rgba(16, 185, 129, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.15) !important;
}

.btn-retry-ruby {
  background: linear-gradient(135deg, rgba(239, 68, 68, 0.25) 0%, rgba(185, 28, 28, 0.1) 100%) !important;
  border: 1px solid rgba(248, 113, 113, 0.5) !important;
  backdrop-filter: blur(10px) saturate(140%) !important;
  -webkit-backdrop-filter: blur(10px) saturate(140%) !important;
  color: #fecaca !important;
  box-shadow: 0 8px 32px 0 rgba(239, 68, 68, 0.2), inset 0 1px 0 rgba(255, 255, 255, 0.1) !important;
  min-width: 170px;
  height: 50px;
  border-radius: 14px !important;
  font-weight: 700 !important;
  font-size: 0.95em !important;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 8px !important;
}

.btn-retry-ruby:hover {
  background: linear-gradient(135deg, rgba(239, 68, 68, 0.4) 0%, rgba(185, 28, 28, 0.18) 100%) !important;
  border-color: rgba(248, 113, 113, 0.8) !important;
  color: #FFFFFF !important;
  transform: translateY(-3px) scale(1.03) !important;
  box-shadow: 0 12px 40px 0 rgba(239, 68, 68, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.15) !important;
}

/* Premium Glassmorphic Schematic Lock */
.blueprint-lock-overlay {
  position: absolute;
  inset: 0;
  background: rgba(6, 15, 30, 0.45) !important;
  backdrop-filter: blur(12px) saturate(180%) !important;
  -webkit-backdrop-filter: blur(12px) saturate(180%) !important;
  display: flex !important;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border-radius: 6px;
  border: 1px solid rgba(255, 217, 61, 0.18) !important;
  padding: 6px;
  box-shadow: inset 0 0 8px rgba(255, 255, 255, 0.05), 0 4px 15px rgba(0, 0, 0, 0.5) !important;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  z-index: 10;
}

/* The overlay above sets `display: flex !important`, which (equal specificity,
   declared later) beat the generic `.hidden { display: none !important }` — so
   adding .hidden never actually hid the lock, and a paid/owned route stayed
   covered by the $ lock badge. This two-class rule has higher specificity and
   wins, so hiding the lock works. THIS is what made purchased routes invisible. */
.blueprint-lock-overlay.hidden { display: none !important; }

.lock-pulse-badge {
  width: 24px;
  height: 24px;
  background: rgba(255, 217, 61, 0.12);
  border: 1px solid rgba(255, 217, 61, 0.35);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 12px rgba(255, 217, 61, 0.25);
  animation: lockPulse 2s infinite ease-in-out;
  margin-bottom: 2px;
}

@keyframes lockPulse {
  0%, 100% {
    transform: scale(1);
    box-shadow: 0 0 8px rgba(255, 217, 61, 0.2);
    border-color: rgba(255, 217, 61, 0.35);
  }
  50% {
    transform: scale(1.08);
    box-shadow: 0 0 16px rgba(255, 217, 61, 0.45);
    border-color: rgba(255, 217, 61, 0.6);
  }
}

.btn-reveal-glass {
  background: linear-gradient(135deg, #FFD93D 0%, #FF9F1A 100%) !important;
  color: #040814 !important;
  border: none !important;
  font-size: 11px !important;
  font-weight: 900 !important;
  padding: 4px 12px !important;
  border-radius: 20px !important;
  cursor: pointer;
  text-transform: uppercase !important;
  letter-spacing: 0.5px !important;
  box-shadow: 0 3px 8px rgba(255, 159, 26, 0.3) !important;
  outline: none !important;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1) !important;
}

.btn-reveal-glass:hover {
  transform: translateY(-1px) scale(1.05) !important;
  box-shadow: 0 5px 15px rgba(255, 159, 26, 0.5), 0 0 0 2px rgba(255, 217, 61, 0.3) !important;
}

.btn-reveal-glass:active {
  transform: translateY(1px) scale(0.98) !important;
}

/* Premium Glassmorphic Zoom Controls Capsule Tray */
#zoom-controls {
  position: fixed;
  right: 18px;
  top: 50%;
  transform: translateY(-50%);
  /* Sit just under #ui-layer (z-index:10) so the hamburger menu / top-bar dropdowns
     overlay the camera controls, but still above the game canvas (z-index:1). Modals
     (z-index:2000+) remain above everything. Previously z-index:1000 put this whole
     capsule above the UI layer, so the open menu appeared BEHIND it. */
  z-index: 9;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 8px;
  background: rgba(10, 12, 22, 0.4);
  backdrop-filter: blur(20px) saturate(160%);
  -webkit-backdrop-filter: blur(20px) saturate(160%);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 30px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.4);
  pointer-events: auto;
}

/* Glassmorphic Zoom Buttons */
.zoom-btn {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  font-family: 'Outfit', system-ui, sans-serif;
  font-weight: 600;
  font-size: 26px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  color: rgba(255, 255, 255, 0.95);
  cursor: pointer;
  pointer-events: auto;
  touch-action: manipulation;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: inset 0 1px 1px rgba(255, 255, 255, 0.1);
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  outline: none;
}

/* Hover Glowing & Micro-animations */
.zoom-btn:hover {
  background: rgba(255, 217, 61, 0.15);
  color: #FFD93D;
  border-color: rgba(255, 217, 61, 0.4);
  transform: scale(1.1);
  box-shadow: 0 0 15px rgba(255, 217, 61, 0.25), inset 0 1px 1px rgba(255, 255, 255, 0.2);
}

/* Pressed Animation */
.zoom-btn:active {
  transform: scale(0.92);
  background: rgba(255, 217, 61, 0.25);
  color: #FF9F1A;
  border-color: rgba(255, 217, 61, 0.6);
  box-shadow: 0 0 5px rgba(255, 217, 61, 0.15);
}

/* Active toggled status (glows when action cam is on) */
.zoom-btn.active {
  background: rgba(255, 217, 61, 0.18) !important;
  color: #FFD93D !important;
  border-color: rgba(255, 217, 61, 0.5) !important;
  box-shadow: 0 0 15px rgba(255, 217, 61, 0.35), inset 0 1px 1px rgba(255, 255, 255, 0.2) !important;
}

/* Premium Glassmorphic Close Button to replace native red-cross emoji */
.modal-close-btn {
  background: rgba(255, 255, 255, 0.08) !important;
  border: 1px solid rgba(255, 255, 255, 0.2) !important;
  border-radius: 50% !important;
  color: rgba(255, 255, 255, 0.6) !important;
  width: 28px !important;
  height: 28px !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  cursor: pointer !important;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1) !important;
  padding: 0 !important;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15) !important;
}

.modal-close-btn:hover {
  background: rgba(239, 68, 68, 0.25) !important;
  border-color: rgba(239, 68, 68, 0.6) !important;
  color: #ff5f5f !important;
  transform: scale(1.1) rotate(90deg) !important;
  box-shadow: 0 0 12px rgba(239, 68, 68, 0.45) !important;
}

.modal-close-btn svg {
  width: 12px !important;
  height: 12px !important;
  stroke: currentColor !important;
  stroke-width: 3.5 !important;
  fill: none !important;
  stroke-linecap: round !important;
  stroke-linejoin: round !important;
  transition: transform 0.2s ease !important;
}

/* Responsive Profile Dashboard Layout for Wider Screens */
.profile-dashboard-grid {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

@media (min-width: 768px) {
  #auth-modal .modal-content.profile-wide-mode {
    width: 740px !important;
    max-width: 95% !important;
    transition: width 0.35s cubic-bezier(0.4, 0, 0.2, 1) !important;
  }
  
  .profile-dashboard-grid {
    display: grid !important;
    grid-template-columns: 1fr 1fr !important;
    gap: 24px !important;
    align-items: start !important;
  }
  
  .profile-col-left {
    border-right: 1px solid rgba(255, 255, 255, 0.08) !important;
    padding-right: 20px !important;
  }
}



