.btn.loading {
  pointer-events: none;
  opacity: 0.7;
  position: relative;
}

.btn.loading:after {
  content: '';
  display: inline-block;
  width: 1em;
  height: 1em;
  border: 2px solid #00d4ff;
  border-radius: 50%;
  border-top-color: transparent;
  animation: spin 0.8s linear infinite;
  margin-left: 0.5em;
  vertical-align: middle;
}

@keyframes spin {
  to {
    animation: spinFrame 1s linear infinite;
  }
}

@keyframes spinFrame {
  to {
    opacity: 1;
  }
}

.btn.success {
  background: #28a745 !important;
  color: #fff !important;
  border-color: #28a745 !important;
}

.btn.failure {
  background: #dc3545 !important;
  color: #fff !important;
  border-color: #dc3545 !important;
}

.modal,
.card {
  transition:
    box-shadow 0.3s,
    transform 0.3s,
    opacity 0.3s;
}

.modal.hidden {
  opacity: 0;
  pointer-events: none;
  transform: scale(0.98);
}

.modal:not(.hidden) {
  opacity: 1;
  pointer-events: auto;
  transform: scale(1);
}

body.dark-mode,
.dark-mode .container,
.dark-mode .card,
.dark-mode .modal-content {
  background: #181a1b !important;
  color: #e0e0e0 !important;
}

.dark-mode .btn,
.dark-mode .btn-outline,
.dark-mode .theme-toggle-btn,
.dark-mode .connect-btn {
  background: #222 !important;
  color: #00d4ff !important;
  border: 2px solid #00d4ff !important;
}

.dark-mode .btn-outline {
  background: #181a1b !important;
  color: #00d4ff !important;
  border: 2px solid #00d4ff !important;
}

.dark-mode .text-gray {
  color: #aaa !important;
}

@media (max-width: 900px) {
  .container,
  .card,
  .cards-grid,
  .header,
  .wallet-section {
    width: 100% !important;
    max-width: 100vw;
    padding: 0.5em;
  }

  .cards-grid {
    grid-template-columns: 1fr !important;
  }

  .card {
    margin-bottom: 1.5em;
  }

  .modal-content {
    width: 95vw !important;
    min-width: unset;
  }
}

body,
.container,
.card,
.modal-content {
  background: #fff;
  color: #222;
}

.btn,
.btn-outline,
.theme-toggle-btn,
.connect-btn {
  background: #00d4ff;
  color: #222;
  border: 2px solid #222;
}

.btn-outline {
  background: #fff;
  color: #00d4ff;
  border: 2px solid #00d4ff;
}

.text-gray {
  color: #555 !important;
}

.focus-visible:focus,
button:focus,
a:focus,
input:focus,
select:focus {
  outline: 3px solid #00d4ff !important;
  outline-offset: 2px;
  box-shadow: 0 0 0 2px #fff, 0 0 8px #00d4ff;
  z-index: 2;
}

.help-icon {
  cursor: help;
  border-bottom: 1px dotted #00d4ff;
  color: #00d4ff;
  font-size: 1em;
  margin-left: 0.25em;
}

.help-icon[title]:hover:after {
  content: attr(title);
  position: absolute;
  background: #222;
  color: #fff;
  padding: 0.5em 1em;
  border-radius: 4px;
  font-size: 0.95em;
  white-space: pre-line;
  z-index: 9999;
  left: 0;
  top: 2em;
}

body {
  margin: 0;
  min-height: 100vh;
  background: radial-gradient(ellipse at center, #0a0a0a 0%, #1a1a2e 50%, #16213e 100%);
  overflow-x: hidden;
  position: relative;
}

body[data-theme='light'],
body.light-mode,
.container,
.card,
.modal-content {
  background: transparent !important;
  color: inherit;
}

#starfield-canvas {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  pointer-events: none;
  z-index: 0;
  opacity: 1;
}

body::before {
  display: none !important;
}
