:root {
  --bg: #0A0F0A;
  --panelA: #1A2E1A;
  --panelB: #162E16;
  --text: #E8F0E8;
  --text-muted: #6B7B6B;
  --muted: #A8B8A8;
  --accent: #FF6A00;
  --accent2: #FF8A00;
  --accent3: #FF9A00;
  --border: #2D482D;
  --shadow: 0 24px 70px rgba(255, 106, 0, 0.15);
  --gradient-primary: linear-gradient(135deg, #FF6A00, #FF8A00, #FF9A00);
  --gradient-secondary: linear-gradient(135deg, #1A2E1A, #162E16, #0F2A0F);
  --neon-green: #FF6A00;
  --neon-cyan: #06B6D4;
  --neon-lime: #84CC16;
  --success: #FF6A00;
  --warning: #F59E0B;
  --error: #EF4444;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: Inter, system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Mobile optimizations */
@media (max-width: 640px) {
  body {
    font-size: 14px;
  }
}

/* Hide scrollbar for horizontal scroll */
.scrollbar-hide {
  -ms-overflow-style: none;
  scrollbar-width: none;
}

.scrollbar-hide::-webkit-scrollbar {
  display: none;
}

/* Unisat Button Sliding Animation */
#unisat-send-btn {
  transform: translateX(100%);
  opacity: 0;
  transition: all 3s cubic-bezier(0.4, 0, 0.2, 1);
  overflow: hidden;
  position: relative;
}

#unisat-send-btn.slide-in {
  transform: translateX(0) !important;
  opacity: 1 !important;
}

/* Ensure the button starts off-screen when hidden */
#unisat-send-btn.hidden {
  display: none;
}

/* When not hidden but not sliding in, keep off-screen */
#unisat-send-btn:not(.hidden):not(.slide-in) {
  transform: translateX(100%);
  opacity: 0;
  transition: all 3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Unisat Button Hover Effects */
#unisat-send-btn button:hover {
  transform: scale(1.02);
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.4);
}

#unisat-send-btn button:active {
  transform: scale(0.98);
}

/* Loading spinner animation */
@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.animate-spin {
  animation: spin 1s linear infinite;
}

/* History table styling */
.history-table {
  border-collapse: collapse;
  border-radius: 8px;
  overflow: hidden;
  width: 100%;
}

.history-table th {
  border-bottom: 1px solid var(--border);
  padding: 0.75rem;
  text-align: left;
  font-weight: 600;
  background-color: var(--panelB);
}

.history-table td {
  border-bottom: 1px solid var(--border);
  padding: 0.75rem;
}

.history-table tbody tr:last-child td {
  border-bottom: none;
}

.history-table tbody tr:hover {
  background-color: var(--panelB);
}

/* Mobile responsive history table */
@media (max-width: 768px) {
  .history-table {
    font-size: 0.875rem;
  }
  
  .history-table th,
  .history-table td {
    padding: 0.5rem 0.25rem;
  }
  
  .history-table th:nth-child(1),
  .history-table td:nth-child(1) {
    min-width: 80px;
  }
  
  .history-table th:nth-child(2),
  .history-table td:nth-child(2) {
    min-width: 60px;
  }
  
  .history-table th:nth-child(3),
  .history-table td:nth-child(3) {
    min-width: 80px;
  }
  
  .history-table th:nth-child(4),
  .history-table td:nth-child(4) {
    min-width: 100px;
  }
  
  .history-table th:nth-child(5),
  .history-table td:nth-child(5) {
    min-width: 60px;
  }
}

@media (max-width: 480px) {
  .history-table {
    font-size: 0.75rem;
  }
  
  .history-table th,
  .history-table td {
    padding: 0.375rem 0.125rem;
  }
  
  /* Stack table on very small screens */
  .history-table,
  .history-table thead,
  .history-table tbody,
  .history-table th,
  .history-table td,
  .history-table tr {
    display: block;
  }
  
  .history-table thead tr {
    position: absolute;
    top: -9999px;
    left: -9999px;
  }
  
  .history-table tr {
    border: 1px solid var(--border);
    margin-bottom: 0.5rem;
    padding: 0.5rem;
    border-radius: 8px;
    background-color: var(--panelA);
  }
  
  .history-table td {
    border: none;
    position: relative;
    padding: 0.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
  }
  
  .history-table td:before {
    content: attr(data-label) ": ";
    font-weight: 600;
    color: var(--accent);
    flex: 0 0 auto;
    margin-right: 1rem;
  }
  
  .history-table td > * {
    flex: 1;
    text-align: right;
  }
}

/* Copy button styling */
.history-table button {
  opacity: 0.6;
  transition: opacity 0.2s ease;
}

.history-table button:hover {
  opacity: 1;
}

.history-table button:active {
  transform: scale(0.95);
}

/* Device orders styling */
.device-order {
  background: var(--panelA);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1rem;
  margin-bottom: 0.75rem;
  cursor: pointer;
  transition: all 0.3s ease;
}

.device-order:hover {
  background: var(--panelB);
  border-color: var(--accent);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.1);
}

/* Mobile responsive device orders */
@media (max-width: 768px) {
  .device-order {
    padding: 0.75rem;
    margin-bottom: 0.5rem;
  }
  
  .device-order .font-mono {
    font-size: 0.875rem;
  }
  
  .device-order .text-sm {
    font-size: 0.75rem;
  }
}

@media (max-width: 480px) {
  .device-order {
    padding: 0.5rem;
  }
}

/* Pagination controls styling */
.pagination-controls {
  margin-top: 1.5rem;
  padding: 1rem 0;
}

.pagination-btn {
  background: var(--panelA);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 0.5rem 1rem;
  border-radius: 8px;
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.3s ease;
  min-width: 80px;
}

.pagination-btn:hover:not(.disabled) {
  background: var(--panelB);
  border-color: var(--accent);
  color: var(--accent);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.1);
}

.pagination-btn.disabled {
  opacity: 0.5;
  cursor: not-allowed;
  background: var(--panelA);
  border-color: var(--border);
  color: var(--text-muted);
}

.pagination-btn:active:not(.disabled) {
  transform: translateY(0);
  box-shadow: 0 2px 6px rgba(16, 185, 129, 0.1);
}

.pagination-info {
  padding: 0 1rem;
  font-weight: 500;
  color: var(--text-muted);
}

/* Mobile responsive pagination */
@media (max-width: 768px) {
  .pagination-controls {
    flex-direction: column;
    gap: 0.75rem;
  }
  
  .pagination-btn {
    width: 100%;
    max-width: 200px;
  }
  
  .pagination-info {
    order: -1;
    padding: 0;
  }
}

@media (max-width: 480px) {
  .pagination-controls {
    margin-top: 1rem;
    padding: 0.75rem 0;
  }
  
  .pagination-btn {
    padding: 0.75rem 1rem;
    font-size: 0.8rem;
  }
}

.device-order .font-mono {
  font-size: 0.75rem;
  word-break: break-all;
}

.device-order .text-sm {
  font-size: 0.6875rem;
}

.glass {
  background: var(--gradient-secondary);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(10px);
}

/* indexpre / landing: enhanced panel depth – dark shadow dividers like wfb */
.zbg-card {
  border-radius: 20px;
  border-color: rgba(0, 0, 0, 0.3);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.02);
}

.zbg-result-panel {
  box-shadow: inset 0 1px 0 rgba(0, 0, 0, 0.2);
}

/* Card header separator: dark shadow gradient instead of visible border */
.zbg-card-header {
  border-bottom: 1px solid rgba(0, 0, 0, 0.35);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25);
}

/* Pool header separator: same dark shadow */
.zbg-pool-header {
  border-bottom: 1px solid rgba(0, 0, 0, 0.35);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25);
}

/* Pool metrics: dark inset border, no visible line */
.zbg-pool-metrics {
  border: 1px solid rgba(0, 0, 0, 0.25);
  box-shadow: inset 0 1px 4px rgba(0, 0, 0, 0.2);
}

/* Accent bar (How fees work): dark shadow left line */
.zbg-accent-bar {
  border-left: 4px solid rgba(0, 0, 0, 0.5);
  box-shadow: inset 3px 0 6px -3px rgba(255, 106, 0, 0.15);
}

.zbg-header-safe {
  padding-top: env(safe-area-inset-top, 0);
}

/* Form controls (indexpre main) */
main.zbg-main input.zbg-input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]),
main.zbg-main select.zbg-input,
main.zbg-main textarea.zbg-input {
  min-height: 48px;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

main.zbg-main input.zbg-input:focus,
main.zbg-main select.zbg-input:focus,
main.zbg-main textarea.zbg-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(255, 106, 0, 0.22);
}

/* indexpre tiles: dark shadow borders instead of visible colored lines */
main.zbg-main .tile {
  border-color: rgba(0, 0, 0, 0.25);
  background: rgba(13, 26, 13, 0.6);
}

/* Currency tiles: larger icons + touch-friendly (indexpre) */
@media (max-width: 639px) {
  .currency-grid .tile {
    min-height: 52px;
  }
}

.currency-grid .tile img {
  width: 2.25rem;
  height: 2.25rem;
}

@media (min-width: 640px) {
  .currency-grid .tile img {
    width: 2.5rem;
    height: 2.5rem;
  }
}

/* Pool metric alternating rows: subtle dark tint */
.zbg-pool-metrics > .zbg-pool-row:nth-child(even) {
  background: rgba(0, 0, 0, 0.15);
}

/* Pool metric row dividers: dark shadow hairlines */
.zbg-pool-metrics > .zbg-pool-row + .zbg-pool-row {
  border-top: 1px solid rgba(0, 0, 0, 0.2);
}

.pill {
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: .25rem .6rem;
  color: var(--muted);
  display: flex;
  align-items: center;
  background: rgba(16, 185, 129, 0.1);
}

.tile {
  display: flex;
  align-items: center;
  gap: .5rem;
  padding: .5rem .75rem;
  border: 1px solid var(--border);
  border-radius: 12px;
  transition: .15s;
  cursor: pointer;
  position: relative;
  overflow: hidden;
  background: rgba(26, 26, 46, 0.5);
  min-height: 3rem;
  /* Firefox compatibility fixes */
  width: 100%;
  box-sizing: border-box;
  flex-shrink: 0;
  flex-grow: 1;
}

@media (min-width: 640px) {
  .tile {
    gap: .75rem;
    padding: .75rem 1rem;
    border-radius: 14px;
    min-height: auto;
  }
}

.tile > * {
  position: relative;
  z-index: 1;
}

.tile::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: var(--gradient-primary);
  opacity: 0;
  transition: opacity 0.3s ease;
  z-index: -1;
}

.tile:hover {
  border-color: rgba(255, 106, 0, 0.5);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(255, 106, 0, 0.15);
}

.tile:hover::before {
  opacity: 1;
}

.tile[aria-disabled="true"] {
  opacity: .45;
  pointer-events: none;
}

.tile.unavailable {
  opacity: 0.3;
  pointer-events: none;
  background: rgba(75, 85, 99, 0.3);
  border-color: rgba(75, 85, 99, 0.5);
}

.tile.unavailable:hover {
  transform: none;
  box-shadow: none;
  border-color: rgba(75, 85, 99, 0.5);
}

.tile.unavailable::before {
  opacity: 0;
}

.tile.selected {
  border-color: var(--accent);
  background: rgba(139, 69, 19, 0.15);
  box-shadow: 0 0 0 2px rgba(255, 106, 0, 0.4), 0 0 18px rgba(255, 106, 0, 0.1);
}

.tile.selected::before {
  opacity: 0;
}

.btn {
  background: var(--gradient-primary);
  color: #FFFFFF;
  border-radius: 14px;
  padding: .8rem 1rem;
  font-weight: 700;
  border: none;
  cursor: pointer;
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
  box-shadow: 0 4px 18px rgba(255, 106, 0, 0.22);
}

.btn::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
  transition: left 0.5s ease;
}

.btn:hover {
  background: linear-gradient(135deg, #FF8A00, #FF9A00, #FFB84D);
  transform: translateY(-2px);
  box-shadow: 0 8px 28px rgba(255, 106, 0, 0.45), 0 0 24px rgba(255, 106, 0, 0.25);
}

.btn:hover::before {
  left: 100%;
}

.btn:disabled {
  opacity: .6;
  cursor: not-allowed;
  transform: none;
}

.btn:disabled:hover {
  transform: none;
  box-shadow: none;
}

input, select {
  background: var(--panelB);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: .8rem 1rem;
  color: var(--text);
  transition: all 0.3s ease;
}

input:focus, select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.2);
}

input::placeholder {
  color: var(--muted);
}

.skeleton {
  background: linear-gradient(90deg, #1a1b20, #23242a 50%, #1a1b20);
  background-size: 200% 100%;
  animation: s 1.2s infinite;
  border-radius: 8px;
}

@keyframes s {
  0% { background-position: 0 0; }
  100% { background-position: -200% 0; }
}

.toast {
  position: fixed;
  right: 16px;
  bottom: 16px;
  background: var(--panelA);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: .8rem 1rem;
  display: none;
  z-index: 1000;
  box-shadow: 0 8px 32px rgba(16, 185, 129, 0.2);
  backdrop-filter: blur(10px);
}

.toast.show {
  display: block;
  animation: slideInUp 0.3s ease;
}

@keyframes slideInUp {
  from {
    transform: translateY(100%);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

/* Tab Navigation — pill style when .zbg-tab is used (indexpre) */
.tab-link {
  position: relative;
}

.tab-link.zbg-tab {
  display: inline-flex;
  align-items: center;
  border-radius: 9999px;
  border: 1px solid transparent;
  padding: 0.5rem 0.75rem;
  color: #a8b8a8;
  text-decoration: none;
}

.tab-link.zbg-tab:hover {
  color: #e8f0e8;
  border-color: rgba(255, 106, 0, 0.35);
  background: rgba(255, 106, 0, 0.06);
}

.tab-link.zbg-tab.active {
  color: #ff8d3a;
  border-color: rgba(255, 106, 0, 0.45);
  background: rgba(255, 106, 0, 0.12);
  font-weight: 600;
}

.tab-link.zbg-tab.active .zbg-tab-icon {
  color: #ff8d3a;
}

/* Legacy underline tabs (e.g. index.html without .zbg-tab) */
.tab-link:not(.zbg-tab).active {
  color: var(--text);
  border-bottom-color: var(--accent);
}

.tab-link:not(.zbg-tab).active::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--accent);
}

#events-menu-trigger.zbg-tab-events {
  border-radius: 9999px;
}

#events-menu-trigger.zbg-tab-events.active {
  color: #ff8d3a;
  border-color: rgba(255, 106, 0, 0.45);
  background: rgba(255, 106, 0, 0.12);
  font-weight: 600;
}

/* Tab Content */
.tab-content {
  display: none;
}

.tab-content.active {
  display: block;
}

/* Status Indicators */
.status-live {
  background: var(--success);
}

.status-maintenance {
  background: var(--warning);
}

.status-error {
  background: var(--error);
}

/* Countdown Animation */
.countdown-warning {
  color: var(--warning);
  animation: pulse 1s infinite;
}

.countdown-expired {
  color: var(--error);
  animation: pulse 0.5s infinite;
}

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

/* Order Status Badges */
.status-badge {
  padding: 0.25rem 0.5rem;
  border-radius: 6px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.status-awaiting_payment {
  background: rgba(245, 158, 11, 0.2);
  color: var(--warning);
  border: 1px solid rgba(245, 158, 11, 0.3);
}

.status-payment_confirming {
  background: rgba(16, 185, 129, 0.2);
  color: var(--accent);
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.status-paid {
  background: rgba(16, 185, 129, 0.2);
  color: var(--success);
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.status-payout_queued,
.status-payout_sent,
.status-payout_creating,
.status-payout_waiting,
.status-payout_processing,
.status-payout_sending {
  background: rgba(99, 102, 241, 0.2);
  color: var(--accent);
  border: 1px solid rgba(99, 102, 241, 0.3);
}

.status-completed {
  background: rgba(16, 185, 129, 0.2);
  color: var(--success);
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.status-underpaid {
  background: rgba(245, 158, 11, 0.2);
  color: var(--warning);
  border: 1px solid rgba(245, 158, 11, 0.3);
  animation: pulse 2s infinite;
}

.status-expired,
.status-payout_failed,
.status-manual_action_required {
  background: rgba(239, 68, 68, 0.2);
  color: var(--error);
  border: 1px solid rgba(239, 68, 68, 0.3);
}

/* History Table */
.history-table {
  width: 100%;
  border-collapse: collapse;
}

.history-table th,
.history-table td {
  padding: 1rem;
  text-align: left;
  border-bottom: 1px solid var(--border);
}

.history-table th {
  background: var(--panelB);
  font-weight: 600;
  color: var(--muted);
  font-size: 0.875rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.history-table tr:hover {
  background: rgba(16, 185, 129, 0.05);
}

/* Device Order Cards */
.device-order {
  background: var(--panelB);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1rem;
  transition: all 0.3s ease;
  cursor: pointer;
}

.device-order:hover {
  border-color: var(--neon-green);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.2);
}

/* QR Code Container */
#qr-code {
  display: inline-block;
  padding: 1rem;
  background: white;
  border-radius: 12px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

/* Loading States */
.loading {
  position: relative;
  pointer-events: none;
}

.loading::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 20px;
  height: 20px;
  margin: -10px 0 0 -10px;
  border: 2px solid var(--accent);
  border-top: 2px solid transparent;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

/* Responsive Design */
@media (max-width: 768px) {
  .glass {
    padding: 1rem;
  }
  
  .tile {
    padding: 0.5rem;
  }
  
  .btn {
    padding: 0.75rem 1rem;
    font-size: 0.875rem;
  }
  
  .history-table {
    font-size: 0.875rem;
  }
  
  .history-table th,
  .history-table td {
    padding: 0.5rem;
  }
}

@media (max-width: 480px) {
  .grid-cols-2 {
    grid-template-columns: 1fr;
  }
  
  .tile {
    flex-direction: column;
    text-align: center;
    gap: 0.5rem;
  }
  
  .tile img,
  .tile > div:first-child {
    margin-bottom: 0.25rem;
  }
}

/* Accessibility */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Focus states for keyboard navigation */
.tile:focus,
.btn:focus,
input:focus,
select:focus {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* Transitions: scoped to interactive elements (avoid tab/panel layout jank) */
button,
a.tab-link,
.tile,
.btn,
input,
select,
textarea,
.pill,
.tab-content,
.glass,
.footer a,
.social-link,
.powered-by-link,
.pagination-btn,
.recovery-tab-btn {
  transition: color 0.2s ease, background-color 0.2s ease, border-color 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease, opacity 0.2s ease;
}

/* Custom scrollbar */
::-webkit-scrollbar {
  width: 8px;
}

::-webkit-scrollbar-track {
  background: var(--panelB);
}

::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--accent);
}

/* Enhanced Order Management Animations */
.status-badge {
    transition: all 0.3s ease;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 500;
}

.status-quoted { background: var(--warning); color: #000; }
.status-awaiting_payment { background: var(--neon-cyan); color: #fff; }
.status-payment_confirming { background: var(--accent); color: #fff; }
.status-paid { background: var(--accent2); color: #fff; }
.status-payout_queued { background: var(--accent); color: #fff; }
.status-payout_sent { background: var(--accent); color: #fff; }
.status-payout_creating { background: var(--accent); color: #fff; }
.status-payout_waiting { background: var(--accent); color: #fff; }
.status-payout_processing { background: var(--accent); color: #fff; }
.status-payout_sending { background: var(--accent); color: #fff; }
.status-completed { background: var(--success); color: #fff; }
.status-payout_finished { background: var(--success); color: #fff; }
.status-cancelled { background: var(--error); color: #fff; }
.status-payout_failed { background: var(--error); color: #fff; }
.status-expired { background: var(--muted); color: #fff; }
.status-manual_action_required { background: var(--warning); color: #000; }

/* Progress bar animation */
#progress-bar {
    transition: width 0.5s ease-in-out;
}

/* Order panel animations */
#order-panel {
    animation: fadeInUp 0.4s ease-out;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Toast animations */
.toast {
    animation: slideInRight 0.3s ease-out;
}

@keyframes slideInRight {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* Button hover effects */
.btn, button {
    transition: all 0.2s ease;
}

.btn:hover, button:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

/* Copy button animations */
button[onclick*="copyToClipboard"] {
    transition: all 0.2s ease;
}

button[onclick*="copyToClipboard"]:hover {
    transform: scale(1.05);
}

/* Status indicator pulse animation */
#order-status-indicator {
    animation: pulse 2s infinite;
}

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

/* Instruction Modal */
#instruction-modal {
    backdrop-filter: blur(4px);
    animation: fadeIn 0.3s ease-out;
}

#instruction-modal .bg-\[#121214\] {
    animation: slideInUpModal 0.3s ease-out;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideInUpModal {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Modal scrollbar */
#instruction-modal .max-h-\[90vh\]::-webkit-scrollbar {
    width: 6px;
}

#instruction-modal .max-h-\[90vh\]::-webkit-scrollbar-track {
    background: #0F0F11;
    border-radius: 3px;
}

#instruction-modal .max-h-\[90vh\]::-webkit-scrollbar-thumb {
    background: #23242a;
    border-radius: 3px;
}

#instruction-modal .max-h-\[90vh\]::-webkit-scrollbar-thumb:hover {
    background: #2c2d34;
}

/* Scrollable Currency Grids */
.currency-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 0.75rem;
    max-height: 200px;
    overflow-y: auto;
    padding: 0.5rem;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--panelB);
    /* Cross-browser compatibility fixes */
    width: 100%;
    box-sizing: border-box;
    /* Ensure consistent grid behavior */
    grid-auto-rows: min-content;
    align-items: stretch;
    /* Prevent grid items from shrinking too much */
    min-width: 0;
}

.currency-grid::-webkit-scrollbar {
    width: 6px;
}

.currency-grid::-webkit-scrollbar-track {
    background: var(--panelA);
    border-radius: 3px;
}

.currency-grid::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 3px;
}

.currency-grid::-webkit-scrollbar-thumb:hover {
    background: var(--accent);
}

/* Mobile Responsive Currency Grids */
@media (max-width: 768px) {
    .currency-grid {
        grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
        gap: 0.5rem;
        max-height: 150px;
        /* Firefox mobile compatibility */
        width: 100%;
        box-sizing: border-box;
    }
    
    .tile {
        padding: 0.75rem;
        font-size: 0.875rem;
        /* Ensure tiles maintain proper sizing in Firefox */
        min-width: 0;
        flex-shrink: 1;
    }
    
    .tile img {
        width: 1.5rem;
        height: 1.5rem;
        flex-shrink: 0;
    }
}

@media (max-width: 480px) {
    .currency-grid {
        grid-template-columns: repeat(auto-fit, minmax(80px, 1fr));
        gap: 0.375rem;
        max-height: 120px;
        /* Firefox small mobile compatibility */
        width: 100%;
        box-sizing: border-box;
    }
    
    .tile {
        padding: 0.5rem;
        font-size: 0.75rem;
        /* Ensure tiles maintain proper sizing in Firefox */
        min-width: 0;
        flex-shrink: 1;
    }
    
    .tile img {
        width: 1.25rem;
        height: 1.25rem;
        flex-shrink: 0;
    }
}

/* Cross-browser compatibility fixes */
.currency-grid {
    /* Ensure consistent grid behavior across browsers */
    grid-auto-rows: min-content;
    align-items: stretch;
}

.tile {
    /* Ensure consistent flex behavior across browsers */
    flex-direction: row;
    justify-content: flex-start;
}

.tile > div {
    /* Prevent text from being squashed */
    flex: 1 1 auto;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Remove spinner arrows from number inputs */
input[type="number"]::-webkit-outer-spin-button,
input[type="number"]::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

/* Firefox and standard */
input[type="number"] {
    -moz-appearance: textfield;
    appearance: textfield;
}

/* Refresh button loading animation */
#refresh-status {
    position: relative;
    transition: all 0.3s ease;
}

#refresh-status.loading {
    pointer-events: none;
    opacity: 0.7;
}

#refresh-status.loading svg {
    animation: spin 1s linear infinite;
}

/* Pulse effect for better visual feedback */
#refresh-status:active {
    transform: scale(0.95);
    background-color: rgba(16, 185, 129, 0.1);
}

/* Payment Balances Scrollable */
.payment-balances-container {
    max-height: 300px;
    overflow-y: auto;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--panelB);
    padding: 1rem;
}

.payment-balances-container::-webkit-scrollbar {
    width: 6px;
}

.payment-balances-container::-webkit-scrollbar-track {
    background: var(--panelA);
    border-radius: 3px;
}

.payment-balances-container::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 3px;
}

.payment-balances-container::-webkit-scrollbar-thumb:hover {
    background: var(--accent);
}

/* Mobile Responsive Payment Balances */
@media (max-width: 768px) {
    .payment-balances-container {
        max-height: 250px;
        padding: 0.75rem;
    }
}

@media (max-width: 480px) {
    .payment-balances-container {
        max-height: 200px;
        padding: 0.5rem;
    }
}

/* Footer Styles */
.footer {
    background: var(--gradient-secondary);
    border-top: 1px solid #000000;
    padding: 2rem 0;
    margin-top: 3rem;
    backdrop-filter: blur(10px);
    position: relative;
    overflow: hidden;
}

.footer::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--accent), transparent);
    opacity: 0.6;
}

.footer-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1rem;
    display: flex;
    flex-direction: column;
    gap: 2rem;
    position: relative;
    z-index: 1;
}

.footer-main {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    gap: 2rem;
}

/* indexpre: single centered column */
.footer-main.zbg-footer-centered {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 1.5rem;
}

.footer-main.zbg-footer-centered .footer-copyright {
    align-items: center;
}

.footer.zbg-footer-tight {
    padding: 2rem 0;
    margin-top: 2rem;
}

@media (min-width: 640px) {
    .footer.zbg-footer-tight {
        padding: 3rem 0;
    }
}

.footer .social-link {
    min-width: 2.5rem;
    min-height: 2.5rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 0.5rem;
    transition: background-color 0.2s ease, transform 0.2s ease;
}

.footer .social-link:hover {
    background: rgba(45, 72, 45, 0.4);
}

.footer-copyright {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.5rem;
}

.footer-quote {
    margin-top: 0.25rem;
}

.footer-quote p {
    color: #A8B8A8;
    font-size: 0.875rem;
    font-style: italic;
    margin: 0;
    opacity: 0.8;
}

.footer-copyright p {
    color: var(--muted);
    font-size: 0.75rem;
    margin: 0;
}

.footer-copyright a {
    text-decoration: none;
    transition: all 0.3s ease;
}

.footer-copyright a:hover {
    transform: translateY(-1px);
}

/* Powered by Section */
.footer-powered-by {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    justify-self: center;
    max-width: 400px;
}

.powered-by-label {
    color: #A8B8A8;
    font-size: 0.625rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    opacity: 0.9;
}

.powered-by-logos {
    display: flex;
    gap: 1.5rem;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
}

.powered-by-link {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.375rem;
    padding: 0.75rem 1rem;
    border-radius: 8px;
    background: rgba(16, 185, 129, 0.03);
    border: 1px solid rgba(16, 185, 129, 0.08);
    text-decoration: none;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
    min-width: 85px;
}

.powered-by-link::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 106, 0, 0.1), transparent);
    transition: left 0.5s ease;
}

.powered-by-link:hover {
    background: rgba(16, 185, 129, 0.1);
    border-color: var(--accent);
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(255, 106, 0, 0.2);
}

.powered-by-link:hover::before {
    left: 100%;
}

.powered-by-logo {
    width: 28px;
    height: 28px;
    object-fit: contain;
    transition: transform 0.3s ease;
    filter: brightness(0.8);
}

.powered-by-link:hover .powered-by-logo {
    transform: scale(1.05);
    filter: brightness(1);
}

.powered-by-text {
    color: var(--muted);
    font-size: 0.625rem;
    font-weight: 400;
    text-align: center;
    transition: color 0.3s ease;
    opacity: 0.8;
}

.powered-by-link:hover .powered-by-text {
    color: var(--accent);
}

.footer-social {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    align-items: center;
    justify-self: end;
}

.follow-us-title {
    color: #A8B8A8;
    font-size: 0.625rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    opacity: 0.9;
    margin-bottom: 0.25rem;
}

.social-links-container {
    display: flex;
    gap: 1rem;
    align-items: center;
}

.social-link {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 2.5rem;
    height: 2.5rem;
    border-radius: 50%;
    background: rgba(16, 185, 129, 0.1);
    border: 1px solid var(--border);
    color: var(--muted);
    transition: all 0.3s ease;
    text-decoration: none;
}

.social-link:hover {
    background: rgba(16, 185, 129, 0.2);
    border-color: var(--accent);
    color: var(--accent);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
}

.social-icon {
    width: 1.25rem;
    height: 1.25rem;
    transition: transform 0.3s ease;
}

.social-link:hover .social-icon {
    transform: scale(1.1);
}

/* Footer Legal Section */
.footer-legal {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
    padding-top: 1rem;
    border-top: 1px solid rgba(45, 72, 45, 0.3);
    margin-top: 1rem;
}

.footer-legal p {
    color: #C8D8C8;
    font-size: 0.875rem;
    margin: 0;
    opacity: 0.9;
}

.legal-links {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.legal-link {
    color: #A8B8A8;
    font-size: 0.75rem;
    text-decoration: none;
    transition: color 0.3s ease;
    opacity: 0.8;
}

.legal-link:hover {
    color: #FF6A00;
    opacity: 1;
}

.legal-separator {
    color: #A8B8A8;
    font-size: 0.75rem;
    opacity: 0.5;
}

/* Mobile Footer Responsive */
@media (max-width: 768px) {
    .footer {
        padding: 1.5rem 0;
        margin-top: 2rem;
    }
    
    .footer-content {
        gap: 1.5rem;
    }
    
    .footer-main {
        display: grid;
        grid-template-columns: 1fr;
        grid-template-rows: auto auto auto;
        gap: 1.5rem;
        text-align: center;
    }
    
    .footer-copyright {
        grid-column: 1;
        grid-row: 1;
        align-items: center;
        justify-self: center;
    }
    
    .footer-powered-by {
        grid-column: 1;
        grid-row: 2;
        max-width: 100%;
        justify-self: center;
    }
    
    .powered-by-label {
        font-size: 0.5rem;
        margin-bottom: 0.5rem;
        opacity: 0.9;
    }
    
    .powered-by-logos {
        gap: 0.75rem;
        justify-content: center;
        flex-wrap: wrap;
    }
    
    .powered-by-link {
        min-width: 65px;
        padding: 0.5rem 0.75rem;
        background: rgba(16, 185, 129, 0.02);
        border: 1px solid rgba(16, 185, 129, 0.05);
    }
    
    .powered-by-logo {
        width: 24px;
        height: 24px;
    }
    
    .powered-by-text {
        font-size: 0.5rem;
        opacity: 0.7;
    }
    
    .footer-social {
        grid-column: 1;
        grid-row: 3;
        gap: 0.75rem;
        justify-self: center;
        align-items: center;
    }
    
    .follow-us-title {
        font-size: 0.5rem;
        margin-bottom: 0.25rem;
    }
    
    .social-links-container {
        gap: 0.75rem;
        flex-wrap: wrap;
        justify-content: center;
    }
    
    .social-link {
        width: 2.25rem;
        height: 2.25rem;
    }
    
    .social-icon {
        width: 1.125rem;
        height: 1.125rem;
    }
    
    .footer-legal {
        padding-top: 0.75rem;
        margin-top: 0.75rem;
        gap: 0.5rem;
    }
    
    .footer-legal p {
        font-size: 0.75rem;
        color: #C8D8C8;
        opacity: 0.9;
    }
    
    .legal-links {
        gap: 0.5rem;
    }
    
    .legal-link {
        font-size: 0.6875rem;
    }
    
    .legal-separator {
        font-size: 0.6875rem;
    }
}

@media (max-width: 480px) {
    .footer {
        padding: 1rem 0;
    }
    
    .footer-content {
        gap: 1rem;
    }
    
    .footer-main {
        gap: 1rem;
    }
    
    .footer-copyright {
        align-items: center;
        text-align: center;
        justify-self: center;
    }
    
    .footer-copyright p {
        font-size: 0.625rem;
    }
    
    .powered-by-label {
        font-size: 0.4375rem;
        margin-bottom: 0.375rem;
        opacity: 0.9;
    }
    
    .powered-by-logos {
        gap: 0.5rem;
        flex-wrap: wrap;
        justify-content: center;
    }
    
    .powered-by-link {
        min-width: 55px;
        padding: 0.375rem 0.5rem;
        background: rgba(16, 185, 129, 0.015);
        border: 1px solid rgba(16, 185, 129, 0.03);
    }
    
    .powered-by-logo {
        width: 20px;
        height: 20px;
    }
    
    .powered-by-text {
        font-size: 0.4375rem;
        opacity: 0.6;
    }
    
    .footer-social {
        justify-self: center;
        gap: 0.5rem;
    }
    
    .follow-us-title {
        font-size: 0.4375rem;
        margin-bottom: 0.125rem;
    }
    
    .social-links-container {
        gap: 0.5rem;
        flex-wrap: wrap;
        justify-content: center;
    }
    
    .social-link {
        width: 2rem;
        height: 2rem;
    }
    
    .social-icon {
        width: 1rem;
        height: 1rem;
    }
    
    .footer-legal {
        padding-top: 0.5rem;
        margin-top: 0.5rem;
        gap: 0.375rem;
    }
    
    .footer-legal p {
        font-size: 0.6875rem;
        color: #C8D8C8;
        opacity: 0.9;
    }
    
    .legal-links {
        gap: 0.375rem;
    }
    
    .legal-link {
        font-size: 0.625rem;
    }
    
    .legal-separator {
        font-size: 0.625rem;
    }
}

/* --- wFB bridge page (mobile-first) --- */
.wfb-page {
    -webkit-tap-highlight-color: transparent;
}

.wfb-header-safe {
    padding-top: env(safe-area-inset-top, 0);
}

/* Header brand: dark favicons read poorly on green bar — lift + edge definition */
.wfb-header-logo-wrap {
    flex-shrink: 0;
}

.wfb-header-logo {
    display: block;
    filter: brightness(1.2) contrast(1.1) drop-shadow(0 0 1px rgba(255, 255, 255, 0.25));
}

/* Compact primary CTA in sticky bar: avoid global .btn padding fighting on small screens */
.wfb-header-connect-btn.btn {
    padding-top: 0.5rem;
    padding-bottom: 0.5rem;
    padding-left: 0.75rem;
    padding-right: 0.75rem;
    font-weight: 600;
}

@media (min-width: 640px) {
    .wfb-header-connect-btn.btn {
        padding-top: 0.625rem;
        padding-bottom: 0.625rem;
        padding-left: 1rem;
        padding-right: 1rem;
    }
}

.wfb-main-card {
    animation: wfbCardIn 0.35s ease-out;
}

@keyframes wfbCardIn {
    from {
        opacity: 0;
        transform: translateY(8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.wfb-panel-transition {
    transition: opacity 0.2s ease, transform 0.2s ease;
}

.wfb-input-touch {
    min-height: 48px;
    font-size: 1rem;
}

.wfb-segment-btn.wfb-segment-active {
    border-color: #ff6a00 !important;
    background: rgba(22, 46, 22, 0.85) !important;
    color: #e8f0e8 !important;
    box-shadow: 0 0 0 1px rgba(255, 106, 0, 0.35);
}

.wfb-segment-btn.wfb-segment-inactive {
    border-color: transparent !important;
    color: #a8b8a8 !important;
    background: transparent !important;
    box-shadow: none;
}

.wfb-step-dot.wfb-step-dot-active {
    border-color: #ff6a00 !important;
    background: rgba(255, 106, 0, 0.15) !important;
    color: #ff8d3a !important;
}

.wfb-accordion summary::-webkit-details-marker {
    display: none;
}

/* Softer dividers: avoid light “white” hairlines on dark green cards */
.wfb-accordion.glass {
    border-color: rgba(26, 46, 26, 0.85);
}

.wfb-accordion[open] .wfb-accordion-summary {
    border-bottom: 1px solid rgba(0, 0, 0, 0.35);
}

.wfb-accordion-panel {
    border-top: 1px solid rgba(0, 0, 0, 0.28);
    background: linear-gradient(180deg, rgba(0, 0, 0, 0.12) 0%, transparent 12px);
}

.wfb-help-blurb {
    margin-top: 0.5rem;
    padding-top: 1rem;
}

html[dir="rtl"] #wfb-step-indicator {
    flex-direction: row-reverse;
}

/* ========== ZeroBit Gate — mobile density & readability (index.html) ========== */
.zbg-mono-addr {
  font-family: ui-monospace, 'Share Tech Mono', monospace;
  font-size: 0.7rem;
  line-height: 1.35;
  word-break: break-all;
  overflow-wrap: anywhere;
  hyphens: none;
  letter-spacing: -0.02em;
}

@media (min-width: 640px) {
  .zbg-mono-addr {
    font-size: 0.8125rem;
  }
}

/* Buy quote: always label | value (full width). Do not stack column on mobile — it left-aligns value blocks. */
#quote-panel .zbg-quote-rows {
  width: 100%;
}
#quote-panel .zbg-quote-row {
  display: flex;
  width: 100%;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem 1rem;
}
#quote-panel .zbg-quote-value {
  text-align: right;
  min-width: 0;
  flex: 1 1 0%;
}

.payment-balances-container.is-compact {
  max-height: 9.5rem;
  padding: 0.45rem 0.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

#sell-balances:not(:empty) {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

@media (max-width: 639px) {
  main.zbg-main {
    padding-top: 0.75rem;
    padding-bottom: 0.75rem;
  }

  .tab-link.zbg-tab {
    padding-top: 0.4rem;
    padding-bottom: 0.4rem;
    padding-left: 0.5rem;
    padding-right: 0.5rem;
    font-size: 0.7rem;
  }

  .tab-link.zbg-tab span {
    max-width: 7.5rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  #bridge-stats.zbg-stats-tight .zbg-stat {
    padding-top: 0.25rem;
  }

  #bridge-stats.zbg-stats-tight #stats-total-volume-fb {
    display: inline;
    font-size: 0.65rem;
    margin-left: 0.25rem;
    vertical-align: baseline;
  }

  .zbg-pool-metrics .zbg-pool-row {
    padding-top: 0.4rem;
    padding-bottom: 0.4rem;
  }

  .zbg-pool-metrics .zbg-pool-row > span:last-child {
    font-size: 0.8125rem;
    text-align: right;
    max-width: 58%;
  }

  .currency-grid-scroll {
    margin-left: -0.25rem;
    margin-right: -0.25rem;
    padding-bottom: 0.25rem;
  }

  .currency-grid-scroll .currency-grid {
    display: flex !important;
    flex-wrap: nowrap;
    gap: 0.45rem;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    scroll-snap-type: x proximity;
    padding-left: 0.25rem;
    padding-right: 0.5rem;
  }

  .currency-grid-scroll .tile {
    flex: 0 0 auto;
    width: 4.6rem;
    min-width: 4.6rem;
    max-width: 4.6rem;
    min-height: 3.75rem;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 0.2rem;
    padding: 0.4rem 0.25rem;
    scroll-snap-align: start;
  }

  .currency-grid-scroll .tile img {
    width: 1.5rem !important;
    height: 1.5rem !important;
  }

  .currency-grid-scroll .tile > div {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    min-width: 0;
  }

  .currency-grid-scroll .tile > div > .font-medium {
    font-size: 0.65rem;
    line-height: 1.15;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .currency-grid-scroll .tile > div > .text-xs {
    display: none;
  }

  .btn,
  main.zbg-main .btn {
    padding-top: 0.65rem;
    padding-bottom: 0.65rem;
  }

  .zbg-result-panel {
    padding: 0.75rem !important;
    margin-top: 0.75rem !important;
  }

  .np-balance-row {
    padding: 0.35rem 0.45rem !important;
    border-radius: 0.5rem;
  }

  .np-balance-row .font-medium {
    font-size: 0.7rem !important;
  }

  .sell-balance-compact {
    padding: 0.35rem 0.5rem !important;
    margin-bottom: 0.35rem !important;
  }
}


