/* Void Survivor - Cyber Dark Fantasy Styling */

:root {
  --bg-dark: #060810;
  --bg-panel: rgba(15, 23, 42, 0.85);
  --border-glow: rgba(56, 189, 248, 0.3);
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --accent-cyan: #38bdf8;
  --accent-gold: #fbbf24;
  --accent-purple: #a855f7;
  --accent-red: #ef4444;
  --accent-green: #22c55e;
}

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

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background-color: var(--bg-dark);
  font-family: 'Outfit', 'M PLUS 1p', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  color: var(--text-main);
}

/* Canvas Container */
#canvas-container {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
}

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

/* Hurt Flash Effect */
.hurt-flash {
  box-shadow: inset 0 0 100px rgba(239, 68, 68, 0.7);
  animation: flashAnim 0.2s ease-out;
}

@keyframes flashAnim {
  0% { filter: brightness(1.6) contrast(1.2); }
  100% { filter: brightness(1) contrast(1); }
}

/* HUD Overlay */
.hud-overlay {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 10;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 16px 20px;
}

/* Top Bar: EXP Gauge & Stats */
.top-hud {
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 100%;
  max-width: 900px;
  margin: 0 auto;
}

.exp-bar-wrapper {
  background: rgba(15, 23, 42, 0.8);
  border: 1px solid rgba(255, 255, 255, 0.15);
  height: 16px;
  border-radius: 10px;
  overflow: hidden;
  position: relative;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
}

.exp-bar-fill {
  background: linear-gradient(90deg, #06b6d4, #3b82f6, #8b5cf6);
  height: 100%;
  width: 0%;
  border-radius: 8px;
  box-shadow: 0 0 12px rgba(59, 130, 246, 0.8);
  transition: width 0.15s ease-out;
}

.top-stats-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--bg-panel);
  backdrop-filter: blur(8px);
  border: 1px solid var(--border-glow);
  padding: 8px 16px;
  border-radius: 12px;
}

.stat-pill {
  font-size: 1.1rem;
  font-weight: 800;
  display: flex;
  align-items: center;
  gap: 6px;
}

.time-pill {
  font-size: 1.4rem;
  letter-spacing: 1px;
  color: #fff;
  font-family: 'JetBrains Mono', monospace;
  text-shadow: 0 0 8px rgba(255, 255, 255, 0.5);
}

.level-badge {
  background: linear-gradient(135deg, #3b82f6, #8b5cf6);
  padding: 2px 10px;
  border-radius: 20px;
  font-size: 0.9rem;
}

/* Bottom Player Status (HP & Dash) */
.bottom-hud {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  width: 100%;
}

.player-status-box {
  background: var(--bg-panel);
  backdrop-filter: blur(8px);
  border: 1px solid var(--border-glow);
  padding: 12px 16px;
  border-radius: 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 260px;
}

.hp-bar-wrap {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.bar-label-group {
  display: flex;
  justify-content: space-between;
  font-size: 0.78rem;
  font-weight: 700;
}

.hp-bar-bg {
  background: rgba(0, 0, 0, 0.5);
  border-radius: 8px;
  height: 14px;
  overflow: hidden;
  border: 1px solid rgba(239, 68, 68, 0.3);
}

.hp-bar-fill {
  background: linear-gradient(90deg, #ef4444, #f97316);
  height: 100%;
  width: 100%;
  box-shadow: 0 0 10px rgba(239, 68, 68, 0.6);
  transition: width 0.15s ease-out;
}

.dash-bar-bg {
  background: rgba(0, 0, 0, 0.5);
  border-radius: 6px;
  height: 8px;
  overflow: hidden;
  border: 1px solid rgba(56, 189, 248, 0.3);
}

.dash-bar-fill {
  background: #38bdf8;
  height: 100%;
  width: 100%;
  box-shadow: 0 0 8px #38bdf8;
}

/* Action Controls (HUD Buttons) */
.hud-actions {
  display: flex;
  gap: 10px;
  pointer-events: auto;
}

.dash-trigger-btn {
  background: linear-gradient(135deg, #0ea5e9, #2563eb);
  color: #fff;
  border: none;
  border-radius: 50%;
  width: 64px;
  height: 64px;
  font-size: 1.6rem;
  cursor: pointer;
  box-shadow: 0 6px 20px rgba(37, 99, 235, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.3);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  transition: transform 0.1s;
}

.dash-trigger-btn span {
  font-size: 0.65rem;
  font-weight: 800;
  letter-spacing: 0.5px;
}

.dash-trigger-btn:active {
  transform: scale(0.92);
}

/* Generic Buttons */
.btn {
  background: rgba(30, 41, 59, 0.9);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: #fff;
  padding: 8px 14px;
  border-radius: 10px;
  font-size: 0.85rem;
  font-weight: 700;
  cursor: pointer;
  pointer-events: auto;
  transition: all 0.2s;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.btn:hover:not(:disabled) {
  background: rgba(51, 65, 85, 0.95);
  border-color: rgba(255, 255, 255, 0.3);
  transform: translateY(-1px);
}

.btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.btn-gold {
  background: linear-gradient(135deg, #f59e0b, #d97706);
  border: none;
}
.btn-gold:hover:not(:disabled) {
  filter: brightness(1.15);
  box-shadow: 0 4px 14px rgba(245, 158, 11, 0.4);
}

.btn-primary {
  background: linear-gradient(135deg, #3b82f6, #1d4ed8);
  border: none;
}

/* Modals */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(6, 8, 16, 0.85);
  backdrop-filter: blur(10px);
  z-index: 100;
  display: none;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none !important;
  transition: opacity 0.2s ease;
  padding: 16px;
}

.modal-overlay:not(.active) * {
  pointer-events: none !important;
}

.modal-overlay.active {
  display: flex !important;
  opacity: 1 !important;
  pointer-events: auto !important;
}

.modal-card {
  background: #0f172a;
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 20px;
  max-width: 680px;
  width: 100%;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.9), 0 0 30px rgba(56, 189, 248, 0.2);
  overflow: hidden;
  animation: popIn 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes popIn {
  0% { transform: scale(0.9); opacity: 0; }
  100% { transform: scale(1); opacity: 1; }
}

.modal-header {
  padding: 16px 20px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: rgba(30, 41, 59, 0.4);
}

.modal-title {
  font-size: 1.3rem;
  font-weight: 800;
}

.modal-close {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.5rem;
  cursor: pointer;
}

.modal-body {
  padding: 24px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.modal-footer {
  padding: 14px 20px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  background: rgba(30, 41, 59, 0.4);
}

/* Level Up Choices */
.levelup-cards-container {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
}

@media (max-width: 640px) {
  .levelup-cards-container {
    grid-template-columns: 1fr;
  }
}

.levelup-card {
  background: linear-gradient(145deg, #1e293b 0%, #0f172a 100%);
  border: 2px solid rgba(56, 189, 248, 0.3);
  border-radius: 16px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 8px;
  transition: transform 0.2s, border-color 0.2s, box-shadow 0.2s;
}

.levelup-card:hover {
  transform: translateY(-4px);
  border-color: #38bdf8;
  box-shadow: 0 10px 24px rgba(56, 189, 248, 0.25);
}

.lvl-card-icon {
  font-size: 2.8rem;
  margin: 4px 0;
}

.lvl-card-title {
  font-size: 1.05rem;
  font-weight: 800;
}

.lvl-card-lvl {
  font-size: 0.8rem;
  color: var(--accent-gold);
  font-weight: 700;
}

.lvl-card-desc {
  font-size: 0.78rem;
  color: var(--text-muted);
  line-height: 1.4;
  flex: 1;
}

.lvl-pick-btn {
  width: 100%;
  margin-top: 6px;
}

/* Meta Shop Items */
.shop-item-card {
  display: flex;
  align-items: center;
  gap: 14px;
  background: #1e293b;
  border: 1px solid rgba(255, 255, 255, 0.1);
  padding: 14px;
  border-radius: 14px;
}

.shop-card-icon {
  font-size: 2.2rem;
}

.shop-card-info {
  flex: 1;
}

.shop-card-title {
  font-size: 1rem;
  font-weight: 800;
}

.shop-lvl {
  font-size: 0.8rem;
  color: #38bdf8;
  margin-left: 6px;
}

.shop-card-desc {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-top: 2px;
}

.shop-card-stat {
  font-size: 0.82rem;
  color: #fbbf24;
  margin-top: 4px;
}

/* Toasts */
#toast-box {
  position: fixed;
  top: 70px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 200;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  pointer-events: none;
}

.toast-pill {
  background: rgba(15, 23, 42, 0.95);
  border: 1px solid rgba(255, 255, 255, 0.2);
  backdrop-filter: blur(8px);
  padding: 8px 18px;
  border-radius: 24px;
  font-size: 0.9rem;
  font-weight: 700;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.6);
  animation: toastPop 0.25s ease-out;
  transition: opacity 0.3s;
}

.toast-pill.toast-warning {
  border-color: #ef4444;
  color: #fca5a5;
  box-shadow: 0 0 16px rgba(239, 68, 68, 0.4);
}

.toast-pill.toast-relic {
  border-color: #fbbf24;
  color: #fbbf24;
  box-shadow: 0 0 16px rgba(251, 191, 36, 0.4);
}

.toast-pill.fade {
  opacity: 0;
}

@keyframes toastPop {
  0% { transform: translateY(-10px); opacity: 0; }
  100% { transform: translateY(0); opacity: 1; }
}

/* ==========================================================================
   Debug Mode & Console UI Styling
   ========================================================================== */

.debug-toggle-btn {
  position: fixed;
  top: 16px;
  right: 20px;
  z-index: 999;
  background: rgba(15, 23, 42, 0.92);
  border: 1px solid rgba(56, 189, 248, 0.5);
  color: #38bdf8;
  padding: 8px 16px;
  border-radius: 999px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.85rem;
  font-weight: 800;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  box-shadow: 0 0 16px rgba(56, 189, 248, 0.35);
  backdrop-filter: blur(10px);
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  pointer-events: auto;
}

.debug-toggle-btn:hover {
  background: rgba(56, 189, 248, 0.2);
  border-color: #38bdf8;
  color: #ffffff;
  box-shadow: 0 0 24px rgba(56, 189, 248, 0.65);
  transform: translateY(-2px);
}

.debug-modal-card {
  max-width: 680px;
  width: 95%;
  max-height: 88vh;
  display: flex;
  flex-direction: column;
}

.debug-tabs-bar {
  display: flex;
  gap: 8px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  padding-bottom: 12px;
  margin-bottom: 14px;
  overflow-x: auto;
}

.debug-tab-btn {
  background: rgba(30, 41, 59, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--text-muted);
  padding: 8px 14px;
  border-radius: 8px;
  font-size: 0.85rem;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.2s ease;
}

.debug-tab-btn:hover {
  background: rgba(56, 189, 248, 0.15);
  color: #f8fafc;
  border-color: rgba(56, 189, 248, 0.3);
}

.debug-tab-btn.active {
  background: linear-gradient(135deg, #0284c7, #2563eb);
  border-color: #38bdf8;
  color: #ffffff;
  box-shadow: 0 0 14px rgba(37, 99, 235, 0.45);
}

.debug-modal-body {
  overflow-y: auto;
  max-height: 58vh;
  padding-right: 4px;
}

.debug-modal-body::-webkit-scrollbar {
  width: 6px;
}
.debug-modal-body::-webkit-scrollbar-track {
  background: rgba(0, 0, 0, 0.2);
  border-radius: 4px;
}
.debug-modal-body::-webkit-scrollbar-thumb {
  background: rgba(56, 189, 248, 0.4);
  border-radius: 4px;
}

.debug-tab-pane {
  display: none;
  flex-direction: column;
  gap: 12px;
}

.debug-tab-pane.active {
  display: flex;
}

.debug-quick-bar {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  padding-bottom: 8px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.debug-items-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.debug-item-card {
  background: rgba(30, 41, 59, 0.55);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 10px;
  padding: 10px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  transition: border-color 0.2s ease;
}

.debug-item-card:hover {
  border-color: rgba(56, 189, 248, 0.3);
  background: rgba(30, 41, 59, 0.75);
}

.debug-item-left {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  min-width: 0;
}

.debug-item-icon {
  font-size: 1.6rem;
  line-height: 1;
}

.debug-item-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  overflow: hidden;
}

.debug-item-name {
  font-size: 0.92rem;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.debug-item-desc {
  font-size: 0.75rem;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.debug-item-right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.debug-lvl-pill {
  min-width: 46px;
  text-align: center;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.82rem;
  font-weight: 800;
  padding: 3px 8px;
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: #94a3b8;
}

.debug-lvl-pill.active {
  border-color: #38bdf8;
  color: #38bdf8;
  background: rgba(56, 189, 248, 0.1);
  box-shadow: 0 0 8px rgba(56, 189, 248, 0.25);
}

.debug-lvl-pill.evolved {
  border-color: #fbbf24;
  color: #fbbf24;
  background: rgba(251, 191, 36, 0.15);
  box-shadow: 0 0 10px rgba(251, 191, 36, 0.35);
}

.debug-stepper {
  display: flex;
  gap: 3px;
}

.debug-step-btn {
  background: rgba(15, 23, 42, 0.8);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: #f8fafc;
  padding: 4px 8px;
  border-radius: 6px;
  font-size: 0.8rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.15s ease;
}

.debug-step-btn:hover {
  background: #38bdf8;
  color: #060810;
  border-color: #38bdf8;
}

.debug-evo-btn {
  background: rgba(15, 23, 42, 0.8);
  border: 1px solid rgba(251, 191, 36, 0.3);
  color: #fbbf24;
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 0.78rem;
  font-weight: 800;
  cursor: pointer;
  transition: all 0.2s ease;
}

.debug-evo-btn:hover {
  background: rgba(251, 191, 36, 0.2);
  border-color: #fbbf24;
}

.debug-evo-btn.active {
  background: linear-gradient(135deg, #d97706, #f59e0b);
  color: #ffffff;
  border-color: #fde68a;
  box-shadow: 0 0 12px rgba(245, 158, 11, 0.5);
}

/* Tools Grid */
.debug-tools-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 10px;
}

.debug-tool-card {
  background: rgba(30, 41, 59, 0.5);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 10px;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

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

.debug-tool-title {
  font-size: 0.88rem;
  font-weight: 800;
}

.debug-tool-desc {
  font-size: 0.76rem;
  color: var(--text-muted);
  line-height: 1.35;
}

@media (max-width: 600px) {
  .debug-tools-grid {
    grid-template-columns: 1fr;
  }
  .debug-item-card {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
  }
  .debug-item-right {
    justify-content: flex-end;
  }
}

