/* ================= Brand tokens ================= */
:root {
  /* Brand colors */
  --dx-cyan: #1FDDFE;
  --dx-emerald: #10B981;
  --dx-gold: #F4B73E;

  /* Surfaces (dark) */
  --bg1: #0b2f53;
  /* deep teal */
  --bg2: #0a2240;
  /* navy */
  --bg3: #0b0b10;
  /* charcoal */
  --bg-elev: rgba(255, 255, 255, .06);
  --surface: rgba(255, 255, 255, .03);

  /* Text & lines (dark) */
  --text: #ffffff;
  --text-dim: rgba(255, 255, 255, .65);
  --line: rgba(255, 255, 255, .12);

  /* Glass panels gradient stops */
  --panel-top: rgba(255, 255, 255, .06);
  --panel-bot: rgba(255, 255, 255, .03);

  /* Legacy compatibility */
  --bg: var(--bg3);
  --primary: var(--dx-emerald);
  --accent: var(--dx-gold);

  --radius-lg: 16px;
  --radius-md: 12px;
  --radius-sm: 8px;

  --shadow-1: 0 10px 30px rgba(0, 0, 0, .30);
  --shadow-2: 0 20px 50px rgba(0, 0, 0, .45);

  /* Light mode shadows - stronger for better depth */
  --shadow-1-light: 0 4px 12px rgba(0, 0, 0, .15);
  --shadow-2-light: 0 8px 24px rgba(0, 0, 0, .2);

  --card-hover: transform .3s cubic-bezier(0.4, 0, 0.2, 1), box-shadow .3s cubic-bezier(0.4, 0, 0.2, 1), opacity .3s cubic-bezier(0.4, 0, 0.2, 1), border-color .3s ease;
}

/* Light mode tokens */
html.light {
  --text: #000000;
  /* Pure black for maximum contrast */
  --text-dim: rgba(0, 0, 0, .8);
  /* Increased from .62 to .8 for better readability */
  --line: rgba(0, 0, 0, .2);
  /* Increased from .12 to .2 for stronger borders */

  /* Solid white panels for maximum text contrast */
  --panel-top: #ffffff;
  --panel-bot: #ffffff;
}

* {
  box-sizing: border-box;
}

html,
body {
  color: var(--text);
  margin: 0;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif, "Apple Color Emoji", "Segoe UI Emoji";
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ===== Focus States for Accessibility ===== */
/* Visible focus indicators for keyboard navigation */
*:focus {
  outline: 2px solid var(--dx-cyan);
  outline-offset: 2px;
}

/* Remove outline for mouse clicks (only show for keyboard) */
*:focus:not(:focus-visible) {
  outline: none;
}

/* Enhanced focus for keyboard users */
*:focus-visible {
  outline: 2px solid var(--dx-cyan);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

/* Button focus states */
button:focus-visible,
.btn-primary:focus-visible,
.btn-secondary:focus-visible,
.wallet-pill:focus-visible {
  outline: 2px solid var(--dx-cyan);
  outline-offset: 2px;
  box-shadow: 0 0 0 4px rgba(31, 221, 254, 0.2);
}

/* Link focus states */
a:focus-visible {
  outline: 2px solid var(--dx-cyan);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

/* Input focus states */
input:focus-visible,
textarea:focus-visible,
select:focus-visible {
  outline: 2px solid var(--dx-cyan);
  outline-offset: 2px;
  border-color: var(--dx-cyan);
}

/* Skip to Content Link (for screen readers) */
.skip-to-content {
  position: absolute;
  top: -100px;
  left: 0;
  background: var(--dx-cyan);
  color: var(--bg3);
  padding: 12px 24px;
  text-decoration: none;
  z-index: 10000;
  border-radius: 0 0 var(--radius-md) 0;
  font-weight: 600;
  transition: top 0.2s ease;
}

.skip-to-content:focus {
  top: 0;
}

/* ===== Smooth Transitions & Micro-interactions ===== */
/* Button Hover Effects */
.btn-primary,
.btn-secondary,
button[class*="btn"] {
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
}

.btn-primary:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
}

.btn-primary:active:not(:disabled) {
  transform: translateY(0);
}

.btn-secondary:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(255, 255, 255, 0.1);
}

/* Video Card Hover */
.video-card {
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.video-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-2);
  border-color: var(--dx-emerald);
}

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

.loading-spinner {
  display: inline-block;
  width: 16px;
  height: 16px;
  border: 2px solid var(--line);
  border-top-color: var(--dx-emerald);
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

/* Pulse Animation for Active States */
@keyframes pulse {

  0%,
  100% {
    opacity: 1;
  }

  50% {
    opacity: 0.6;
  }
}

.pulse {
  animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

/* Fade In Animation */
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.fade-in {
  animation: fadeIn 0.3s ease-out;
}

/* Stagger Animation for Lists */
.video-list .video-card {
  animation: fadeIn 0.4s ease-out backwards;
}

.video-list .video-card:nth-child(1) {
  animation-delay: 0.05s;
}

.video-list .video-card:nth-child(2) {
  animation-delay: 0.1s;
}

.video-list .video-card:nth-child(3) {
  animation-delay: 0.15s;
}

.video-list .video-card:nth-child(4) {
  animation-delay: 0.2s;
}

.video-list .video-card:nth-child(5) {
  animation-delay: 0.25s;
}

.video-list .video-card:nth-child(6) {
  animation-delay: 0.3s;
}

.video-list .video-card:nth-child(n+7) {
  animation-delay: 0.35s;
}

/* ===== Standard Scrollbar Styling (Cross-Platform Consistency) ===== */
/* Ensures consistent page width across all platforms by standardizing scrollbar width */
html {
  /* Reserve space for scrollbar to prevent layout shift */
  scrollbar-gutter: stable;
}

/* Webkit browsers (Chrome, Safari, Edge) */
::-webkit-scrollbar {
  width: 12px;
  height: 12px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.2);
  border-radius: 6px;
  border: 2px solid transparent;
  background-clip: padding-box;
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.3);
  background-clip: padding-box;
}

html.light ::-webkit-scrollbar-thumb {
  background: rgba(0, 0, 0, 0.2);
  background-clip: padding-box;
}

html.light ::-webkit-scrollbar-thumb:hover {
  background: rgba(0, 0, 0, 0.3);
  background-clip: padding-box;
}

/* Firefox */
* {
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.2) transparent;
}

html.light * {
  scrollbar-color: rgba(0, 0, 0, 0.2) transparent;
}

/* Explicit color-scheme control - prevents browser from forcing light mode */
html {
  color-scheme: dark light;
}

html:not(.light) {
  color-scheme: dark;
}

html.light {
  color-scheme: light;
}

/* Backgrounds */
/* Default: Dark mode (works for all browsers including Brave) */
/* This is the base default that applies when no class is present */
/* Force dark mode even when browser/device forces light mode */
body {
  background: radial-gradient(ellipse at 50% -10%,
      var(--bg1),
      var(--bg2) 35%,
      var(--bg3) 100%) fixed !important;
  color: var(--text) !important;
}

/* Explicit dark mode enforcement - override browser-forced light mode */
/* Higher specificity ensures dark mode works even when browser forces light mode */
html:not(.light) body {
  background: radial-gradient(ellipse at 50% -10%,
      var(--bg1),
      var(--bg2) 35%,
      var(--bg3) 100%) fixed !important;
  color: var(--text) !important;
}

/* Light mode override (explicit class takes precedence via higher specificity) */
html.light body {
  background: radial-gradient(ellipse at top, #fafafa 0%, #f5f5f5 60%, #f0f0f0 100%) fixed !important;
  color: var(--text) !important;
}

/* Top Header - Logo, Hamburger, and Wallet */
.top-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 56px;
  background: rgba(15, 15, 22, 0.6);
  backdrop-filter: blur(16px) saturate(180%);
  -webkit-backdrop-filter: blur(16px) saturate(180%);
  border-bottom: 1px solid rgba(255, 255, 255, .1);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  gap: 12px;
  z-index: 200;
  box-shadow: 0 1px 0 rgba(255, 255, 255, .05), 0 4px 12px rgba(0, 0, 0, .1);
  transition: background 0.3s ease, border-color 0.3s ease, box-shadow 0.3s ease;
}

html.light .top-header {
  background: rgba(255, 255, 255, 0.85);
  border-bottom: 1px solid rgba(0, 0, 0, .1);
  box-shadow: 0 1px 0 rgba(0, 0, 0, .05), 0 4px 12px rgba(0, 0, 0, .08);
}

.top-header-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.top-header-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

/* Token Balance Pill */
.token-balance-pill {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 7px 16px;
  border-radius: 24px;
  border: 1.5px solid var(--dx-gold);
  background: linear-gradient(135deg, rgba(244, 183, 62, 0.12) 0%, rgba(244, 183, 62, 0.08) 100%);
  backdrop-filter: blur(8px);
  color: var(--dx-gold);
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(244, 183, 62, 0.15);
}

.token-balance-pill::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(circle, rgba(244, 183, 62, 0.2) 0%, transparent 70%);
  opacity: 0;
  transition: opacity 0.3s ease;
}

.token-balance-pill:hover {
  background: linear-gradient(135deg, rgba(244, 183, 62, 0.18) 0%, rgba(244, 183, 62, 0.12) 100%);
  border-color: var(--dx-gold);
  transform: translateY(-2px) scale(1.02);
  box-shadow:
    0 6px 20px rgba(244, 183, 62, 0.3),
    0 0 0 1px rgba(244, 183, 62, 0.2);
}

.token-balance-pill:hover::before {
  opacity: 1;
}

.token-balance-pill.loading {
  opacity: 0.7;
  cursor: wait;
}

.token-balance-pill.loading:hover {
  transform: none;
  box-shadow: none;
}

.token-balance-logo {
  height: 1em;
  /* Match text height */
  width: auto;
  object-fit: contain;
  flex-shrink: 0;
  opacity: 0.9;
}

.token-balance-label {
  opacity: 0.9;
  font-size: 12px;
}

.token-balance-value {
  font-family: 'Courier New', monospace;
  font-weight: 700;
  font-size: 14px;
  white-space: nowrap;
  min-width: fit-content;
  font-variant-numeric: tabular-nums;
  /* Better number alignment */
  letter-spacing: 0.02em;
  position: relative;
  z-index: 1;
}

/* Light mode token balance pill */
html.light .token-balance-pill {
  background: rgba(244, 183, 62, 0.08);
  border-color: var(--dx-gold);
  color: #d97706;
}

html.light .token-balance-pill:hover {
  background: rgba(244, 183, 62, 0.12);
  box-shadow: 0 4px 12px rgba(244, 183, 62, 0.15);
}

/* Mobile: Show wallet pill in header, hide token balance pill */
@media (max-width: 768px) {
  .top-header-right .token-balance-pill {
    display: none !important;
  }

  /* Wallet pill stays visible in header on mobile */
  .top-header-right .wallet-pill-container {
    display: block !important;
  }
}

/* Wallet Selection Modal */
.wallet-modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.wallet-modal-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(4px);
}

.wallet-modal-content {
  position: relative;
  background: linear-gradient(180deg, var(--panel-top), var(--panel-bot));
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-2);
  width: 100%;
  max-width: 400px;
  max-height: 90vh;
  overflow: hidden;
  display: flex;
  z-index: 10002;
  /* Above dropdown (10001) */
  flex-direction: column;
  backdrop-filter: blur(8px);
}

/* Dark mode: ensure solid background for readability - must override transparent panel vars */
html:not(.light) .wallet-modal-content,
html:not(.light) #walletModal .wallet-modal-content {
  background: linear-gradient(180deg, #1a1a2e 0%, #16213e 50%, #0f172a 100%) !important;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
  opacity: 1 !important;
}

.wallet-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px;
  border-bottom: 1px solid var(--line);
}

.wallet-modal-title {
  margin: 0;
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
  line-height: 1.4;
}

.wallet-modal-close {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  padding: 0;
  border: none;
  background: transparent;
  color: var(--text-dim);
  cursor: pointer;
  border-radius: 6px;
  transition: all 0.2s ease;
  flex-shrink: 0;
}

.wallet-modal-close:hover {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text);
}

.wallet-modal-close svg {
  width: 20px;
  height: 20px;
}

.wallet-modal-body {
  padding: 12px;
  overflow-y: auto;
  flex: 1;
  min-height: 0;
}

.wallet-option {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px;
  margin-bottom: 8px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all 0.2s ease;
  gap: 12px;
}

.wallet-option:hover {
  background: rgba(255, 255, 255, 0.06);
  border-color: var(--dx-emerald);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.15);
}

.wallet-option:active {
  transform: translateY(0);
}

.wallet-option-left {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1;
}

.wallet-option-logo {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  flex-shrink: 0;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.05);
}

.wallet-option-logo-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  border-radius: 10px;
}

.wallet-option-logo-emoji {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
}

.wallet-option-info {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.wallet-option-name {
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
  margin: 0;
}

.wallet-option-status {
  font-size: 12px;
  color: var(--text-dim);
  margin: 0;
}

.wallet-option-badge {
  padding: 4px 10px;
  background: rgba(16, 185, 129, 0.15);
  color: var(--dx-emerald);
  border-radius: 12px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  flex-shrink: 0;
}

.wallet-option.unavailable {
  opacity: 0.5;
  cursor: not-allowed;
}

.wallet-option.unavailable:hover {
  transform: none;
  border-color: var(--line);
  box-shadow: none;
}

.wallet-modal-footer {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 16px 24px;
  border-top: 1px solid var(--line);
  color: var(--text-dim);
  font-size: 14px;
  cursor: pointer;
  transition: color 0.2s ease;
}

.wallet-modal-footer:hover {
  color: var(--text);
}

.wallet-modal-footer svg {
  width: 16px;
  height: 16px;
  transition: transform 0.2s ease;
}

.wallet-modal-footer:hover svg {
  transform: translateY(2px);
}

/* Light mode wallet modal */
html.light .wallet-modal-content {
  background: #ffffff !important;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.25);
}

html.light .wallet-option {
  background: rgba(0, 0, 0, 0.02);
  border-color: rgba(0, 0, 0, 0.08);
}

html.light .wallet-option:hover {
  background: rgba(0, 0, 0, 0.04);
  border-color: rgba(16, 185, 129, 0.3);
}

html.light .wallet-modal-close:hover {
  background: rgba(0, 0, 0, 0.06);
}

/* Beta Acknowledgment Modal */
.beta-modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 10001;
  /* Higher than wallet modal */
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.beta-modal-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.85);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.beta-modal-content {
  position: relative;
  background: linear-gradient(180deg, var(--panel-top), var(--panel-bot));
  border: 2px solid var(--dx-gold);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-2), 0 0 40px rgba(244, 183, 62, 0.2);
  width: 100%;
  max-width: 600px;
  max-height: 90vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  backdrop-filter: blur(12px);
  animation: betaModalSlideIn 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Dark mode: ensure solid background for readability - must override transparent panel vars */
html:not(.light) .beta-modal-content,
html:not(.light) #betaModal .beta-modal-content {
  background: linear-gradient(180deg, #1a1a2e 0%, #16213e 50%, #0f172a 100%) !important;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
  opacity: 1 !important;
}

@keyframes betaModalSlideIn {
  from {
    opacity: 0;
    transform: translateY(-20px) scale(0.95);
  }

  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.beta-modal-header {
  padding: 24px;
  border-bottom: 1px solid var(--line);
  background: rgba(244, 183, 62, 0.1);
}

.beta-modal-title {
  margin: 0;
  font-size: 24px;
  font-weight: 700;
  color: var(--dx-gold);
  line-height: 1.4;
  text-align: center;
}

.beta-modal-body {
  padding: 24px;
  overflow-y: auto;
  flex: 1;
  min-height: 0;
}

.beta-warning-box {
  background: rgba(244, 183, 62, 0.15);
  border: 1px solid rgba(244, 183, 62, 0.3);
  border-radius: var(--radius-md);
  padding: 16px;
  margin-bottom: 24px;
}

.beta-warning-text {
  margin: 0 0 8px 0;
  font-size: 18px;
  font-weight: 600;
  color: var(--dx-gold);
}

.beta-warning-subtext {
  margin: 0;
  font-size: 14px;
  color: var(--text-dim);
  line-height: 1.5;
}

.beta-risks-list {
  margin-bottom: 24px;
}

.beta-risks-title {
  margin: 0 0 12px 0;
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
}

.beta-risks-items {
  margin: 0;
  padding-left: 20px;
  list-style: disc;
  color: var(--text-dim);
  line-height: 1.8;
}

.beta-risks-items li {
  margin-bottom: 8px;
}

.beta-risks-items li strong {
  color: var(--text);
  font-weight: 600;
}

.beta-checkbox-container {
  margin-top: 24px;
  padding: 16px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
}

.beta-checkbox-label {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  cursor: pointer;
  user-select: none;
}

.beta-checkbox {
  margin-top: 4px;
  width: 20px;
  height: 20px;
  cursor: pointer;
  flex-shrink: 0;
  accent-color: var(--dx-emerald);
}

.beta-checkbox-text {
  flex: 1;
  font-size: 14px;
  line-height: 1.6;
  color: var(--text);
}

.beta-modal-footer {
  display: flex;
  gap: 12px;
  padding: 20px 24px;
  border-top: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.02);
}

.beta-btn {
  flex: 1;
  padding: 12px 24px;
  border-radius: var(--radius-md);
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  border: 1px solid var(--line);
}

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

.beta-btn-decline {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-dim);
  border-color: var(--line);
}

.beta-btn-decline:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text);
  border-color: var(--text-dim);
}

.beta-btn-accept {
  background: var(--dx-emerald);
  color: white;
  border-color: var(--dx-emerald);
}

.beta-btn-accept:hover:not(:disabled) {
  background: #0ea472;
  border-color: #0ea472;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
}

.beta-btn-accept:active:not(:disabled) {
  transform: translateY(0);
}

/* Light mode beta modal */
html.light .beta-modal-content {
  background: #ffffff !important;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.25), 0 0 40px rgba(244, 183, 62, 0.15);
}

html.light .beta-modal-header {
  background: rgba(244, 183, 62, 0.08);
}

html.light .beta-warning-box {
  background: rgba(244, 183, 62, 0.1);
  border-color: rgba(244, 183, 62, 0.25);
}

html.light .beta-checkbox-container {
  background: rgba(0, 0, 0, 0.02);
  border-color: rgba(0, 0, 0, 0.08);
}

html.light .beta-btn-decline {
  background: rgba(0, 0, 0, 0.04);
  border-color: rgba(0, 0, 0, 0.1);
}

html.light .beta-btn-decline:hover:not(:disabled) {
  background: rgba(0, 0, 0, 0.08);
}

/* Mobile responsive */
@media (max-width: 640px) {
  .beta-modal {
    padding: 20px 20px 80px 20px;
    /* Extra bottom padding to avoid browser nav */
    align-items: flex-start;
    /* Align to top instead of center */
    overflow-y: auto;
  }

  .beta-modal-content {
    max-width: 100%;
    margin: 0;
    border-radius: 12px;
    max-height: calc(100vh - 100px);
    /* Leave space for browser nav */
    margin-bottom: 20px;
    /* Additional spacing from bottom */
  }

  .beta-modal-title {
    font-size: 20px;
  }

  .beta-modal-body {
    padding: 20px;
    max-height: calc(100vh - 280px);
    /* Account for header + footer + spacing */
    overflow-y: auto;
  }

  .beta-modal-footer {
    flex-direction: column;
    padding: 16px 20px 20px 20px;
    /* Extra bottom padding */
    gap: 12px;
    position: sticky;
    bottom: 0;
    background: linear-gradient(180deg, var(--panel-top), var(--panel-bot));
    border-top: 1px solid var(--line);
  }

  .beta-btn {
    width: 100%;
    padding: 14px 24px;
    /* Slightly larger touch target */
  }
}

html.light .wallet-option-badge {
  background: rgba(16, 185, 129, 0.12);
  color: #059669;
}

.top-header .toggle-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: none;
  background: transparent;
  color: #a1a1aa;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  font-size: 18px;
  flex-shrink: 0;
  padding: 0;
}

.top-header .toggle-btn:hover {
  background: rgba(255, 255, 255, .08);
  color: #e4e4e7;
}

.top-header .toggle-btn:active {
  background: rgba(255, 255, 255, .12);
}

.top-header .brand {
  display: flex;
  align-items: center;
}

.top-header .brand-logo {
  height: 24px;
}

html.light .top-header {
  background: transparent;
  border-bottom: 1px solid rgba(0, 0, 0, .08);
  backdrop-filter: blur(8px);
}

html.light .top-header .toggle-btn {
  color: #52525b;
}

html.light .top-header .toggle-btn:hover {
  background: rgba(0, 0, 0, .06);
  color: #18181b;
}

/* Wallet Pill - Top Header */
.wallet-pill-container {
  position: relative;
}

.wallet-pill {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 18px;
  border-radius: 24px;
  border: 1.5px solid var(--dx-emerald);
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.12) 0%, rgba(16, 185, 129, 0.08) 100%);
  backdrop-filter: blur(8px);
  color: var(--dx-emerald);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  white-space: nowrap;
  position: relative;
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(16, 185, 129, 0.15);
}

.wallet-pill::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(circle, rgba(16, 185, 129, 0.2) 0%, transparent 70%);
  opacity: 0;
  transition: opacity 0.3s ease;
}

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

.wallet-pill:hover {
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.2) 0%, rgba(16, 185, 129, 0.12) 100%);
  border-color: var(--dx-emerald);
  transform: translateY(-2px) scale(1.02);
  box-shadow:
    0 6px 20px rgba(16, 185, 129, 0.3),
    0 0 0 1px rgba(16, 185, 129, 0.2);
}

.wallet-pill:hover::before {
  opacity: 1;
}

.wallet-pill:active {
  transform: translateY(0);
}

.wallet-pill.connected {
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.18) 0%, rgba(16, 185, 129, 0.12) 100%);
  border-color: var(--dx-emerald);
  box-shadow:
    0 2px 8px rgba(16, 185, 129, 0.2),
    0 0 0 1px rgba(16, 185, 129, 0.15);
}

.wallet-pill.connected::before {
  opacity: 0.5;
  /* Subtle glow when connected */
}

.wallet-pill.loading {
  opacity: 0.7;
  cursor: not-allowed;
  pointer-events: none;
}

.wallet-pill.loading:hover {
  transform: none;
  box-shadow: none;
}

.wallet-pill:disabled {
  opacity: 0.7;
  cursor: not-allowed;
}

.wallet-pill-text {
  display: inline-block;
}

.wallet-pill-address {
  display: inline-block;
  font-family: 'Courier New', monospace;
  font-size: 13px;
}

.wallet-pill-arrow {
  display: inline-block;
  font-size: 10px;
  margin-left: 4px;
  transition: transform 0.2s ease;
}

.wallet-pill-container.active .wallet-pill-arrow {
  transform: rotate(180deg);
}

/* Wallet Dropdown */
.wallet-dropdown {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  min-width: 280px;
  background: linear-gradient(180deg, rgba(26, 29, 41, .98) 0%, rgba(21, 24, 33, .98) 100%);
  backdrop-filter: blur(16px) saturate(180%);
  -webkit-backdrop-filter: blur(16px) saturate(180%);
  border: 1px solid rgba(255, 255, 255, .1);
  border-radius: var(--radius-md);
  box-shadow:
    var(--shadow-2),
    0 0 0 1px rgba(255, 255, 255, .05);
  padding: 14px;
  z-index: 10001;
  /* Above modal overlay (10000) but below modal content */
  animation: dropdownFadeIn 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  transform-origin: top right;
}

@keyframes dropdownFadeIn {
  from {
    opacity: 0;
    transform: translateY(-8px) scale(0.95);
  }

  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.wallet-dropdown-header {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 8px;
}

.wallet-dropdown-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  color: var(--text-dim);
  letter-spacing: 0.5px;
}

.wallet-dropdown-address-container {
  display: flex;
  align-items: center;
  gap: 8px;
}

.wallet-dropdown-address {
  font-family: 'Courier New', monospace;
  font-size: 13px;
  color: var(--text);
  word-break: break-all;
  flex: 1;
}

.wallet-copy-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, .1);
  background: rgba(255, 255, 255, 0.08);
  backdrop-filter: blur(4px);
  color: var(--text-dim);
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  flex-shrink: 0;
  position: relative;
  overflow: hidden;
}

.wallet-copy-btn::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(circle, rgba(16, 185, 129, 0.2) 0%, transparent 70%);
  opacity: 0;
  transition: opacity 0.3s ease;
}

.wallet-copy-btn:hover {
  background: rgba(16, 185, 129, 0.15);
  border-color: rgba(16, 185, 129, 0.3);
  color: var(--dx-emerald);
  transform: scale(1.1) rotate(5deg);
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.2);
}

.wallet-copy-btn:hover::before {
  opacity: 1;
}

.wallet-copy-btn:active {
  transform: scale(0.95);
}

.wallet-copy-btn.copied {
  background: rgba(16, 185, 129, 0.2);
  color: var(--dx-emerald);
}

.wallet-copy-btn svg {
  width: 14px;
  height: 14px;
}

/* Light mode copy button */
html.light .wallet-copy-btn {
  background: rgba(0, 0, 0, 0.04);
  color: #52525b;
}

html.light .wallet-copy-btn:hover {
  background: rgba(0, 0, 0, 0.08);
  color: #059669;
}

html.light .wallet-copy-btn.copied {
  background: rgba(16, 185, 129, 0.15);
  color: #059669;
}

.wallet-dropdown-item {
  width: 100%;
  padding: 12px 14px;
  border: none;
  background: transparent;
  color: var(--text);
  font-size: 14px;
  font-weight: 500;
  text-align: left;
  display: flex;
  align-items: baseline;
  gap: 10px;
  text-decoration: none;
  cursor: pointer;
  border-radius: var(--radius-sm);
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
}

.wallet-dropdown-item::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, rgba(16, 185, 129, 0.1) 0%, rgba(31, 221, 253, 0.08) 100%);
  opacity: 0;
  transition: opacity 0.3s ease;
}

.wallet-dropdown-item:hover {
  background: rgba(255, 255, 255, 0.1);
  color: var(--dx-emerald);
  transform: translateX(4px);
  box-shadow: -2px 0 8px rgba(16, 185, 129, 0.15);
}

.wallet-dropdown-item:hover::before {
  opacity: 1;
}

.wallet-dropdown-item-icon {
  font-size: 18px;
  line-height: 1;
  flex-shrink: 0;
  display: inline-flex;
  align-items: flex-end;
  justify-content: center;
  width: 20px;
  height: auto;
  margin: 0;
  padding: 0;
  padding-bottom: 0.1em;
  /* Slight adjustment to align with text baseline */
}

.wallet-dropdown-item>span:not(.wallet-dropdown-item-icon) {
  display: inline-block;
  line-height: 1.4;
  margin: 0;
  padding: 0;
}

.wallet-dropdown-item:active {
  background: rgba(255, 255, 255, 0.12);
}

/* Light mode wallet pill */
html.light .wallet-pill {
  background: rgba(16, 185, 129, 0.08);
  border-color: var(--dx-emerald);
  color: #059669;
}

html.light .wallet-pill:hover {
  background: rgba(16, 185, 129, 0.12);
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.15);
}

html.light .wallet-pill.connected {
  background: rgba(16, 185, 129, 0.12);
}

html.light .wallet-dropdown {
  background: #ffffff;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
  backdrop-filter: none;
}

html.light .wallet-dropdown-item:hover {
  background: rgba(0, 0, 0, 0.04);
  color: #059669;
}

/* ===== Network Toggle in Wallet Dropdown ===== */
.wallet-network-toggle {
  padding: 12px 0;
  border-bottom: 1px solid rgba(255, 255, 255, .12);
  margin-bottom: 8px;
}

.wallet-network-toggle-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.wallet-network-toggle-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  color: rgba(255, 255, 255, .65);
  letter-spacing: 0.5px;
}

.wallet-network-warning {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 10px;
  color: #fbbf24;
  font-weight: 500;
}

.wallet-network-warning svg {
  width: 12px;
  height: 12px;
  flex-shrink: 0;
}

.wallet-network-toggle-buttons {
  display: flex;
  gap: 6px;
}

.wallet-network-btn {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  border: 1px solid rgba(255, 255, 255, .1);
  background: rgba(255, 255, 255, 0.05);
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
  position: relative;
}

.wallet-network-btn:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, .15);
}

.wallet-network-btn.active {
  background: rgba(31, 221, 254, 0.15);
  border-color: rgba(31, 221, 254, 0.4);
  color: #1FDDFE;
}

.wallet-network-btn-label {
  font-size: 13px;
  font-weight: 500;
  color: inherit;
}

.wallet-network-btn-indicator {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: rgba(255, 255, 255, .3);
  transition: all 0.2s ease;
}

.wallet-network-btn.active .wallet-network-btn-indicator {
  background: #1FDDFE;
  box-shadow: 0 0 8px rgba(31, 221, 254, 0.5);
}

/* Light mode network toggle */
html.light .wallet-network-toggle {
  border-bottom-color: rgba(0, 0, 0, .12);
}

html.light .wallet-network-toggle-label {
  color: rgba(0, 0, 0, .65);
}

html.light .wallet-network-btn {
  background: rgba(0, 0, 0, 0.03);
  border-color: rgba(0, 0, 0, .1);
  color: rgba(0, 0, 0, .8);
}

html.light .wallet-network-btn:hover {
  background: rgba(0, 0, 0, 0.05);
  border-color: rgba(0, 0, 0, .15);
}

html.light .wallet-network-btn.active {
  background: rgba(31, 221, 254, 0.1);
  border-color: rgba(31, 221, 254, 0.3);
  color: #0ea5e9;
}

html.light .wallet-network-warning {
  color: #f59e0b;
}

/* Network Instructions Panel */
.wallet-network-instructions {
  margin-top: 12px;
  padding: 12px;
  background: rgba(251, 191, 36, 0.1);
  border: 1px solid rgba(251, 191, 36, 0.3);
  border-radius: 8px;
  animation: slideDown 0.3s ease;
}

@keyframes slideDown {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.wallet-network-instructions-content {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.wallet-network-instructions-title {
  font-size: 12px;
  font-weight: 600;
  color: #fbbf24;
  margin: 0;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.wallet-network-instructions-steps {
  margin: 0;
  padding-left: 18px;
  font-size: 11px;
  color: rgba(255, 255, 255, 0.9);
  line-height: 1.6;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.wallet-network-instructions-steps li {
  margin: 0;
}

.wallet-network-instructions-steps strong {
  color: #fbbf24;
  font-weight: 600;
}

.wallet-network-instructions-close {
  align-self: flex-end;
  padding: 6px 12px;
  font-size: 11px;
  font-weight: 500;
  color: #fbbf24;
  background: rgba(251, 191, 36, 0.15);
  border: 1px solid rgba(251, 191, 36, 0.3);
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s ease;
  margin-top: 4px;
}

.wallet-network-instructions-close:hover {
  background: rgba(251, 191, 36, 0.25);
  border-color: rgba(251, 191, 36, 0.5);
  transform: translateY(-1px);
}

/* Light mode instructions */
html.light .wallet-network-instructions {
  background: rgba(251, 191, 36, 0.08);
  border-color: rgba(251, 191, 36, 0.2);
}

html.light .wallet-network-instructions-title {
  color: #f59e0b;
}

html.light .wallet-network-instructions-steps {
  color: rgba(0, 0, 0, 0.8);
}

html.light .wallet-network-instructions-steps strong {
  color: #f59e0b;
}

html.light .wallet-network-instructions-close {
  color: #f59e0b;
  background: rgba(251, 191, 36, 0.1);
  border-color: rgba(251, 191, 36, 0.2);
}

html.light .wallet-network-instructions-close:hover {
  background: rgba(251, 191, 36, 0.15);
  border-color: rgba(251, 191, 36, 0.3);
}

/* Hide wallet pill on mobile (can be shown later if needed) */
@media (max-width: 768px) {
  .wallet-pill-container {
    display: none;
  }
}

/* Hide top header hamburger on mobile when bottom nav is active */
@media (max-width: 768px) {
  .top-header .toggle-btn {
    display: none;
  }
}

a {
  color: var(--dx-gold) !important;
  text-decoration: none;
  transition: color 0.2s ease-in-out !important;
}

a:hover {
  color: var(--dx-emerald) !important;
}

html.light a {
  color: var(--dx-gold) !important;
}

html.light a:hover {
  color: var(--dx-emerald) !important;
}

img {
  max-width: 100%;
  display: block;
}

/* ================= Capped container ================= */
.container {
  width: min(99vw, 1320px);
  margin-inline: auto;
}

/* ================= Left Sidebar Navigation ================= */
.sidebar {
  width: 90px;
  background: linear-gradient(180deg, rgba(26, 29, 41, .95) 0%, rgba(21, 24, 33, .98) 100%);
  backdrop-filter: blur(12px);
  border-right: 1px solid rgba(255, 255, 255, .1);
  border-left: none;
  border-top: none;
  border-bottom: none;
  padding: 0;
  display: flex;
  flex-direction: column;
  position: fixed;
  height: calc(100vh - 56px);
  max-height: calc(100vh - 56px);
  z-index: 100;
  top: 56px;
  left: 0;
  border-radius: 0 16px 16px 0;
  transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1), border-radius 0.3s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0.3s ease;
  overflow: hidden;
  box-shadow:
    2px 0 16px rgba(0, 0, 0, .2),
    0 0 0 1px rgba(255, 255, 255, .05);
}

.sidebar:hover {
  box-shadow:
    4px 0 24px rgba(0, 0, 0, .3),
    0 0 0 1px rgba(255, 255, 255, .08);
}

.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  align-items: center;
  min-height: 0;
  max-height: calc(100vh - 60px);
}

.sidebar.collapsed {
  width: 60px;
  border-radius: 0 12px 12px 0;
}

.sidebar.collapsed .sidebar-nav {
  padding: 8px;
}

.sidebar.collapsed .nav-item-text {
  opacity: 0;
  height: 0;
  overflow: hidden;
  transition: opacity 0.2s ease, height 0.2s ease;
  font-size: 0;
}


.sidebar.collapsed .nav-item {
  justify-content: center;
  padding: 2px;
  aspect-ratio: 1;
  max-width: 56px;
  max-height: 56px;
}

.sidebar.collapsed .nav-item-icon {
  margin: 0;
}

.sidebar.collapsed .nav-divider {
  margin: 12px 0;
}

.toggle-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: none;
  background: transparent;
  color: #a1a1aa;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  font-size: 18px;
  flex-shrink: 0;
  padding: 0;
  position: relative;
  overflow: hidden;
}

.toggle-btn::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(circle, rgba(16, 185, 129, .2) 0%, transparent 70%);
  opacity: 0;
  transition: opacity 0.3s ease;
}

.toggle-btn:hover {
  background: rgba(255, 255, 255, .1);
  color: #ffffff;
  transform: scale(1.1) rotate(90deg);
  box-shadow: 0 4px 12px rgba(0, 0, 0, .2);
}

.toggle-btn:hover::before {
  opacity: 1;
}

.toggle-btn:active {
  background: rgba(255, 255, 255, .15);
  transform: scale(0.95) rotate(90deg);
}

.sidebar.collapsed .toggle-btn {
  margin: 0;
}

/* Nav Item styles moved to components/nav-item.css - imported in index.html */

.nav-divider {
  height: 1px;
  background: rgba(255, 255, 255, .06);
  margin: 12px 0;
  transition: margin 0.2s ease;
}

.nav-spacer {
  flex: 1;
  min-height: 0;
}

.nav-item-wallet {
  flex-shrink: 0;
  position: relative;
}

.nav-item-wallet.connected {
  background: rgba(16, 185, 129, .15);
  color: #10b981;
  border-color: rgba(16, 185, 129, .3);
}

.nav-item-wallet.connected:hover {
  background: rgba(16, 185, 129, .2);
}

.nav-item-address {
  display: block;
  font-size: 9px;
  opacity: 0.7;
  margin-top: 2px;
  word-break: break-all;
  line-height: 1.2;
}

.sidebar.collapsed .nav-item-wallet {
  flex-shrink: 0;
}

.sidebar.collapsed .nav-item-address {
  display: none;
}

.nav-item-theme {
  margin-top: auto;
  flex-shrink: 0;
}

.sidebar.collapsed .nav-item-theme {
  margin-top: auto;
  flex-shrink: 0;
}

/* Main content margin for sidebar */
.main-content {
  margin-left: calc(90px + 16px);
  margin-top: 56px;
  transition: margin-left 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.sidebar.collapsed~.main-content {
  margin-left: calc(60px + 16px);
}

/* All sections need to account for sidebar */
.footer {
  margin-left: calc(90px + 16px);
  transition: margin-left 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.sidebar.collapsed~.footer {
  margin-left: calc(60px + 16px);
}

/* Adjust catbar-wrap width for collapsed sidebar */
.sidebar.collapsed~.catbar-wrap {
  width: calc(100vw - 60px - 32px - 16px);
  /* Account for collapsed sidebar (60px), gutters (32px), and spacing (16px) */
  margin-left: calc(60px + 16px);
}

/* Adjust sort-wrap width for collapsed sidebar */
.sidebar.collapsed~.sort-wrap {
  width: calc(100vw - 60px - 32px - 16px);
  /* Account for collapsed sidebar (60px), gutters (32px), and spacing (16px) */
}

/* Adjust rail wrapper width for collapsed sidebar */
.sidebar.collapsed~.main-content .rail .rail-wrapper {
  width: calc(100vw - 60px - 32px - 16px);
  /* Account for collapsed sidebar (60px), gutters (32px), and spacing (16px) */
}

/* Grid stage uses left positioning trick, adjust it for sidebar */
.grid-stage {
  margin-left: calc(90px + 16px);
  transition: margin-left 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.sidebar.collapsed~.grid-stage {
  margin-left: calc(60px + 16px);
}

/* Hide old top nav on desktop */
@media (min-width: 769px) {
  .nav {
    display: none;
  }
}

/* Light mode styles for sidebar */
html.light .sidebar {
  background: linear-gradient(180deg, #f8f9fa, #fafafa);
  border-right: 1px solid rgba(0, 0, 0, .08);
}

html.light .toggle-btn {
  color: #52525b;
}

html.light .toggle-btn:hover {
  background: rgba(0, 0, 0, .06);
  color: #18181b;
}

html.light .nav-item {
  color: #52525b;
  background: rgba(0, 0, 0, .02);
  border-color: rgba(0, 0, 0, .08);
}

html.light .nav-item:hover {
  background: rgba(0, 0, 0, .06);
  color: #18181b;
  border-color: rgba(0, 0, 0, .12);
}

html.light .nav-item.active {
  background: linear-gradient(180deg, #f8f9fa, #fafafa);
  color: #18181b;
  border-color: rgba(0, 0, 0, .12);
  box-shadow:
    0 4px 12px rgba(0, 0, 0, .15),
    0 0 0 1px rgba(0, 0, 0, .08);
}

html.light .nav-item-wallet.connected {
  background: rgba(16, 185, 129, .12);
  color: #059669;
  border-color: rgba(16, 185, 129, .25);
}

html.light .nav-item-wallet.connected:hover {
  background: rgba(16, 185, 129, .18);
}

html.light .nav-divider {
  background: rgba(0, 0, 0, .06);
}

/* Tablet responsiveness - collapse sidebar automatically on medium screens */
@media (max-width: 1024px) and (min-width: 769px) {
  .sidebar {
    width: 60px;
  }

  .sidebar .sidebar-nav {
    padding: 12px 8px;
  }

  .sidebar .nav-item-text {
    opacity: 0;
    height: 0;
    overflow: hidden;
    font-size: 0;
  }

  .sidebar .sidebar-header .brand-logo {
    opacity: 0;
    width: 0;
    overflow: hidden;
  }

  .sidebar .nav-item {
    justify-content: center;
    padding: 12px 8px;
  }

  .main-content {
    margin-left: calc(60px + 16px) !important;
    width: calc(100% - 60px - 16px) !important;
    max-width: calc(100% - 60px - 16px) !important;
    box-sizing: border-box !important;
    overflow-x: hidden !important;
  }

  /* Ensure hero and live-theater sections are contained within main-content */
  .main-content .hero,
  .main-content .live-theater {
    width: 100% !important;
    max-width: 100% !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
    padding-left: 0 !important;
    padding-right: 0 !important;
    box-sizing: border-box !important;
  }

  /* Apply full-bleed grid fix for tablet (same as desktop but with 60px sidebar) */
  .grid-stage {
    --gutter: 16px;
    --sidebar-width: 60px;
    /* Collapsed sidebar width on tablet */
    position: relative !important;
    left: 50% !important;
    right: 50% !important;
    margin-left: calc(-50vw + var(--gutter) + var(--sidebar-width) + 8px) !important;
    margin-right: calc(-50vw + var(--gutter)) !important;
    width: calc(100vw - var(--gutter) * 2 - var(--sidebar-width) - 16px) !important;
    max-width: none !important;
  }

  .footer {
    margin-left: calc(60px + 16px) !important;
  }

  .catbar-wrap {
    width: calc(100vw - 60px - 32px - 16px) !important;
    /* Account for collapsed sidebar, gutters, and spacing on tablet */
    margin-left: calc(60px + 16px) !important;
  }

  .sort-wrap {
    width: calc(100vw - 60px - 32px - 16px) !important;
    /* Account for collapsed sidebar, gutters, and spacing on tablet */
  }

  /* Watch page layout adjustments for tablet - overridden by watch.html inline styles */
}

/* Mobile: Hide desktop sidebar, show independent mobile nav */
@media (max-width: 768px) {

  /* Hide desktop sidebar completely */
  .sidebar {
    display: none !important;
  }

  /* Main content - no sidebar margin on mobile */
  .main-content {
    margin-left: 0 !important;
    margin-top: 56px !important;
    padding-bottom: calc(10px + env(safe-area-inset-bottom)) !important;
  }

  /* Hide navigation arrows on mobile - use drag to scroll */
  .catbar-nav,
  .rail-nav {
    display: none !important;
  }

  /* Reset all section margins on mobile */
  .grid-stage,
  .footer {
    margin-left: 0 !important;
    margin-right: 0 !important;
    left: auto !important;
    /* Reset complex positioning */
    right: auto !important;
    width: 100% !important;
    /* Full width on mobile */
    max-width: 100% !important;
    position: relative !important;
    /* Reset any absolute positioning */
  }

  .catbar-wrap {
    width: 100% !important;
    /* Full width on mobile */
    max-width: 100% !important;
    margin-left: 0 !important;
  }

  .sort-wrap {
    width: 100% !important;
    /* Full width on mobile */
    max-width: 100% !important;
    margin: 0 !important;
  }
}

/* Search bar wrapper (above categories) */
.search-wrap {
  width: 100%;
  max-width: 600px;
  margin: 24px auto;
  padding: 0 16px;
  display: flex;
  justify-content: center;
}

@media (max-width: 768px) {
  .search-wrap {
    margin: 16px auto;
    padding: 0 16px;
  }
}

/* Sort controls wrapper (below categories) */
.sort-wrap {
  width: calc(100vw - 90px - 32px - 16px);
  /* Account for sidebar (90px), gutters (32px), and spacing (16px) */
  max-width: 1880px;
  /* Match grid-stage max-width */
  margin: 0 auto;
  /* Center the section */
  padding: 16px;
  display: flex;
  justify-content: flex-end;
  transition: width 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.sort-container {
  display: flex;
  align-items: center;
  gap: 12px;
  position: relative;
}

.sort-container::after {
  content: '▼';
  position: absolute;
  right: 14px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 10px;
  color: var(--text-dim);
  pointer-events: none;
  transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  z-index: 2;
  /* Above the select but below dropdown */
}

.sort-container .input {
  min-width: 160px;
  padding-right: 40px;
  /* Increased to prevent text overlap with arrow */
  padding-left: 12px;
  /* Ensure consistent left padding */
  cursor: pointer;
  position: relative;
  z-index: 1;
  /* Ensure select is above container but below arrow */
  transition: box-shadow 0.25s cubic-bezier(0.4, 0, 0.2, 1), border-color 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  /* Removed transform from transition to prevent text overlap on first open */
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  background-image: none;
  /* Remove background arrow - using ::after instead */
  line-height: 40px;
  /* Match height for vertical centering */
  vertical-align: middle;
}

.sort-container .input:hover {
  border-color: rgba(255, 255, 255, .2);
  box-shadow:
    var(--shadow-2),
    0 0 0 1px rgba(255, 255, 255, .05);
  transform: translateY(-1px);
}

.sort-container .input:focus,
.sort-container .input:active {
  transform: none;
  /* Prevent transform on focus/active to avoid text overlap */
}

html.light .sort-container .input:hover {
  border-color: rgba(0, 0, 0, .15);
  box-shadow:
    0 4px 12px rgba(0, 0, 0, .08),
    0 0 0 1px rgba(0, 0, 0, .05);
}

.sort-container .input:focus {
  border-color: var(--dx-emerald);
  box-shadow:
    var(--shadow-2),
    0 0 0 3px rgba(16, 185, 129, .15);
  outline: none;
}

.sort-container:has(.input:focus)::after {
  transform: translateY(-50%);
  /* Keep arrow pointing down when open */
  color: var(--dx-emerald);
}

.search-container {
  position: relative;
  width: 100%;
  max-width: 600px;
}

.search-container::before {
  content: '🔍';
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 16px;
  opacity: 0.6;
  pointer-events: none;
  transition: opacity 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  z-index: 1;
}

.search-container:has(.input#search:focus)::before {
  opacity: 1;
  color: var(--dx-emerald);
}

.search-wrap .input#search {
  width: 100%;
  padding-right: 44px;
  /* Space for clear button */
  padding-left: 44px;
  /* Space for search icon */
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  will-change: transform, box-shadow, border-color;
  font-size: 16px !important;
  /* Prevent iOS Safari auto-zoom (must be >= 16px) */
}

.search-wrap .input#search:focus {
  border-color: var(--dx-emerald);
  box-shadow:
    var(--shadow-2),
    0 0 0 3px rgba(16, 185, 129, .15);
  transform: translateY(-1px);
}

.search-wrap .input#search:hover:not(:focus) {
  border-color: rgba(255, 255, 255, .2);
  box-shadow:
    var(--shadow-2),
    0 0 0 1px rgba(255, 255, 255, .05);
}

html.light .search-wrap .input#search:hover:not(:focus) {
  border-color: rgba(0, 0, 0, .15);
  box-shadow:
    0 4px 12px rgba(0, 0, 0, .08),
    0 0 0 1px rgba(0, 0, 0, .05);
}

.search-clear {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  color: var(--text-dim);
  cursor: pointer;
  border-radius: 50%;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  opacity: 0.7;
}

.search-clear:hover {
  background: rgba(255, 255, 255, .08);
  color: var(--text);
  opacity: 1;
  transform: translateY(-50%) scale(1.1) rotate(90deg);
}

html.light .search-clear:hover {
  background: rgba(0, 0, 0, .06);
}

.search-suggestions {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  right: 0;
  background: linear-gradient(180deg, var(--panel-top), var(--panel-bot));
  backdrop-filter: blur(12px) saturate(180%);
  -webkit-backdrop-filter: blur(12px) saturate(180%);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  box-shadow:
    var(--shadow-2),
    0 0 0 1px rgba(255, 255, 255, .05);
  z-index: 100;
  max-height: 320px;
  overflow-y: auto;
  margin-top: 4px;
  animation: dropdownFadeIn 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  overflow-x: hidden;
}

.suggestion-item {
  padding: 14px 18px;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  color: var(--text);
  font-size: 14px;
  font-weight: 500;
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
}

.suggestion-item::before {
  content: '🔍';
  font-size: 14px;
  opacity: 0.5;
  transition: opacity 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.suggestion-item:hover,
.suggestion-item:focus {
  background: linear-gradient(90deg, rgba(16, 185, 129, .08), rgba(16, 185, 129, .04));
  color: var(--text);
  outline: none;
  transform: translateX(4px);
  padding-left: 22px;
}

.suggestion-item:hover::before,
.suggestion-item:focus::before {
  opacity: 1;
  color: var(--dx-emerald);
}

.suggestion-item:first-child {
  border-radius: var(--radius-md) var(--radius-md) 0 0;
}

.suggestion-item:last-child {
  border-radius: 0 0 var(--radius-md) var(--radius-md);
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
}

.brand-logo {
  height: 32px;
  width: auto;
  display: block;
  transition: opacity 0.2s ease;
}

.brand:hover .brand-logo {
  opacity: 0.85;
}

.brand .dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--dx-emerald);
  box-shadow: 0 0 16px var(--dx-emerald);
}

.brand-text {
  white-space: nowrap;
}

.input {
  height: 40px;
  padding: 0 12px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: linear-gradient(180deg, var(--panel-top), var(--panel-bot));
  backdrop-filter: blur(8px);
  color: var(--text);
  font-size: 16px;
  /* Prevent iOS Safari auto-zoom on focus (must be >= 16px) */
}

/* Ensure input text is readable in light mode */
html.light .input {
  color: #000000 !important;
  /* Pure black for maximum contrast in light mode */
  background: #ffffff !important;
  /* Pure white background */
}

html.light .input::placeholder {
  color: rgba(0, 0, 0, 0.5) !important;
  /* Darker placeholder for readability */
}

/* Fix inputs inside modals - more specific selectors to override modal-specific styles */
html.light .modal input,
html.light .modal-content input,
html.light .modal-body input,
html.light .modal-card input,
html.light [class*="modal"] input,
html.light [class*="Modal"] input,
html.light [id*="modal"] input,
html.light [id*="Modal"] input {
  color: #000000 !important;
  background: #ffffff !important;
  border-color: rgba(0, 0, 0, 0.2) !important;
}

html.light .modal input::placeholder,
html.light .modal-content input::placeholder,
html.light .modal-body input::placeholder,
html.light .modal-card input::placeholder,
html.light [class*="modal"] input::placeholder {
  color: rgba(0, 0, 0, 0.5) !important;
}

/* Fix modal backgrounds - ensure they use the blue gradient in dark mode */
.modal,
.modal-content,
.modal-card,
[class*="modal"]:not(.wallet-modal):not(.beta-modal):not(.help-modal):not(.whop-modal),
[id*="modal"]:not(#walletModal):not(#betaModal):not(#helpModal):not(#whopLinkModal):not(#whopVerifyModal) {
  background: transparent;
}

.modal-content,
.modal-card,
[class*="modal-content"]:not(.wallet-modal-content):not(.beta-modal-content):not(.help-modal-content):not(.whop-modal-content),
[class*="modal-card"]:not(.wallet-modal-content):not(.beta-modal-content):not(.help-modal-content):not(.whop-modal-content),
[id*="modal"]>div:first-child {
  background: linear-gradient(180deg, var(--panel-top), var(--panel-bot)) !important;
  backdrop-filter: blur(8px);
}

html:not(.light) .modal-content,
html:not(.light) .modal-card,
html:not(.light) [class*="modal-content"]:not(.wallet-modal-content):not(.beta-modal-content):not(.help-modal-content):not(.whop-modal-content),
html:not(.light) [class*="modal-card"]:not(.wallet-modal-content):not(.beta-modal-content):not(.help-modal-content):not(.whop-modal-content) {
  background: linear-gradient(180deg, rgba(255, 255, 255, .06), rgba(255, 255, 255, .03)) !important;
}

html.light .modal-content,
html.light .modal-card,
html.light [class*="modal-content"]:not(.wallet-modal-content):not(.beta-modal-content):not(.help-modal-content):not(.whop-modal-content),
html.light [class*="modal-card"]:not(.wallet-modal-content):not(.beta-modal-content):not(.help-modal-content):not(.whop-modal-content) {
  background: #ffffff !important;
}

/* Subscribe Modal Styles */
.modal-card {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 10000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(4px);
}

.modal-content {
  position: relative;
  z-index: 10001;
  max-width: 500px;
  width: 100%;
  border-radius: var(--radius-lg);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-2);
  padding: 0;
  overflow: hidden;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px;
  border-bottom: 1px solid var(--line);
}

.modal-header h2 {
  margin: 0;
  font-size: 20px;
  font-weight: 700;
  color: var(--text);
}

.modal-close {
  background: none;
  border: none;
  color: var(--text-dim);
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
  padding: 0;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  transition: all 0.2s ease;
}

.modal-close:hover {
  background: var(--surface);
  color: var(--text);
}

.modal-body {
  padding: 24px;
}

/* Select dropdown styling - arrow handled by .sort-container::after */
select.input {
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  background-image: none;
  /* Remove - using ::after pseudo-element instead */
  padding-right: 40px;
  /* Match .sort-container .input padding */
  cursor: pointer;
}

select.input option {
  background: var(--bg3);
  color: var(--text);
  padding: 8px;
}

html.light select.input option {
  background: #fafafa;
  color: var(--text);
}


.btn {
  height: 40px;
  padding: 0 12px;
  border-radius: 999px;
  background: linear-gradient(180deg, var(--panel-top), var(--panel-bot));
  backdrop-filter: blur(8px);
  border: 1px solid var(--line);
  color: var(--text);
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  transition: transform .15s ease;
}

@media (max-width: 768px) {
  .btn {
    min-height: 44px;
    /* Minimum touch target size */
    padding: 0 16px;
    /* More padding for easier tapping */
  }
}

.btn-primary {
  color: #061a12;
  background: linear-gradient(180deg, #58e5b9 0%, var(--dx-emerald) 100%);
  border: 1px solid rgba(0, 0, 0, .22);
  box-shadow:
    0 0 0 1px rgba(16, 185, 129, .28),
    0 12px 24px rgba(16, 185, 129, .20),
    0 40px 80px rgba(16, 185, 129, .10);
  font-weight: 600;
}

.btn-primary:hover {
  transform: translateY(-1px);
}

.btn-ghost {
  background: transparent;
  color: inherit;
  border-color: var(--line);
}

.btn-ghost:hover {
  background: rgba(255, 255, 255, .05);
}

html.light .btn-ghost:hover {
  background: rgba(0, 0, 0, .05);
}

.btn:hover {
  filter: brightness(1.05);
}

.theme-icon {
  display: block;
}


/* ================= Category rail ================= */
.catbar-wrap {
  position: sticky;
  top: 56px;
  /* Below header */
  z-index: 40;
  background: linear-gradient(180deg, rgba(6, 8, 12, .4) 0%, rgba(6, 8, 12, 0) 100%);
  backdrop-filter: blur(12px) saturate(180%);
  -webkit-backdrop-filter: blur(12px) saturate(180%);
  border-bottom: 1px solid rgba(255, 255, 255, .05);
  margin: 0 0 24px;
  padding: 16px 0;
  width: calc(100vw - 90px - 32px - 16px);
  /* Account for sidebar (90px), gutters (32px), and spacing (16px) */
  max-width: 1880px;
  /* Match grid-stage max-width */
  margin-left: calc(90px + 16px);
  /* Account for sidebar and spacing */
  margin-right: auto;
  transition: margin-left 0.25s cubic-bezier(0.4, 0, 0.2, 1), width 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

html.light .catbar-wrap {
  background: linear-gradient(180deg, rgba(255, 255, 255, .6) 0%, rgba(255, 255, 255, 0) 100%);
  border-bottom: 1px solid rgba(0, 0, 0, .08);
}

.catbar {
  width: 100%;
  /* Full width of catbar-wrap */
  max-width: none;
  margin-inline: auto;
  display: flex;
  gap: 10px;
  overflow-x: auto;
  overflow-y: visible;
  white-space: nowrap;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  padding: 4px 48px;
  /* Extra padding for arrows and vertical space for hover */
  mask-image: linear-gradient(to right, transparent 0, #000 48px, #000 calc(100% - 48px), transparent 100%);
  cursor: grab;
  scroll-behavior: smooth;
  scroll-snap-type: x proximity;
  touch-action: pan-x;
  /* Enable horizontal drag scrolling */
}

@media (max-width: 768px) {
  .catbar {
    gap: 8px;
    /* Tighter gap on mobile */
    padding: 4px 16px;
    /* Less padding on mobile for more content visible */
    mask-image: linear-gradient(to right, transparent 0, #000 16px, #000 calc(100% - 16px), transparent 100%);
  }
}

.catbar:active {
  cursor: grabbing;
}

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

.catbar-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, .15);
  background: linear-gradient(180deg, rgba(15, 18, 26, .9), rgba(10, 13, 20, .95));
  backdrop-filter: blur(12px) saturate(180%);
  -webkit-backdrop-filter: blur(12px) saturate(180%);
  color: var(--text);
  font-weight: 900;
  font-size: 20px;
  line-height: 1;
  display: none;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 50;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow:
    0 4px 12px rgba(0, 0, 0, .4),
    0 0 0 1px rgba(255, 255, 255, .05);
  will-change: transform, box-shadow;
}

html.light .catbar-nav {
  background: linear-gradient(180deg, rgba(255, 255, 255, .95), rgba(250, 250, 250, .98));
  border: 1px solid rgba(0, 0, 0, .1);
  box-shadow:
    0 4px 12px rgba(0, 0, 0, .1),
    0 0 0 1px rgba(0, 0, 0, .05);
}

.catbar-nav:hover {
  background: linear-gradient(180deg, rgba(20, 23, 30, .95), rgba(15, 18, 26, 1));
  transform: translateY(-50%) scale(1.12);
  box-shadow:
    0 6px 16px rgba(0, 0, 0, .5),
    0 0 0 1px rgba(255, 255, 255, .1),
    0 0 20px rgba(16, 185, 129, .15);
}

html.light .catbar-nav:hover {
  background: linear-gradient(180deg, rgba(255, 255, 255, 1), rgba(250, 250, 250, 1));
  box-shadow:
    0 6px 16px rgba(0, 0, 0, .15),
    0 0 0 1px rgba(0, 0, 0, .1),
    0 0 20px rgba(16, 185, 129, .1);
}

.catbar-nav:active {
  transform: translateY(-50%) scale(1.05);
}

.catbar-nav.left {
  left: 12px;
}

.catbar-nav.right {
  right: 12px;
}

.pill {
  flex: 0 0 auto;
  padding: 10px 18px;
  border-radius: 999px;
  background: linear-gradient(180deg, var(--panel-top), var(--panel-bot));
  border: 1px solid var(--line);
  color: var(--text-dim);
  font-weight: 700;
  cursor: pointer;
  pointer-events: auto !important;
  position: relative;
  z-index: 20;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  min-height: 40px;
  /* Ensure consistent height */
  outline: none;
  touch-action: pan-x pan-y;
  /* Allow both horizontal and vertical scrolling */
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  box-shadow: 0 2px 8px rgba(0, 0, 0, .15);
  scroll-snap-align: start;
  will-change: transform, box-shadow, background;
}

@media (max-width: 768px) {
  .pill {
    padding: 12px 16px;
    /* Larger touch target on mobile */
    min-height: 44px;
    /* Minimum touch target size (44x44px) */
    font-size: 13px;
    /* Slightly smaller text for better fit */
    touch-action: pan-x;
    /* Allow horizontal scrolling for drag on mobile */
  }
}

.pill::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 999px;
  background: radial-gradient(circle at center, rgba(16, 185, 129, .1) 0%, transparent 70%);
  opacity: 0;
  transition: opacity 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  pointer-events: none;
}

.pill:focus-visible {
  outline: 2px solid var(--dx-emerald);
  outline-offset: 2px;
  box-shadow:
    var(--shadow-1),
    0 0 0 4px rgba(16, 185, 129, .2);
}

.pill-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  opacity: 0.75;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  font-size: 15px;
  line-height: 1;
  width: 18px;
  text-align: center;
  transform: scale(1);
}

.pill-text {
  white-space: nowrap;
  font-weight: 700;
  font-size: 14px;
  letter-spacing: -0.01em;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.pill-count {
  background: rgba(255, 255, 255, .08);
  padding: 3px 8px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 700;
  opacity: 0.7;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  border: 1px solid rgba(255, 255, 255, .05);
  min-width: 20px;
  text-align: center;
  font-variant-numeric: tabular-nums;
}

.pill.is-active {
  color: #061a12;
  background: linear-gradient(135deg, #58e5b9 0%, var(--dx-emerald) 50%, #10b981 100%);
  border-color: transparent;
  font-weight: 800;
  box-shadow:
    0 0 0 1px rgba(16, 185, 129, .2),
    0 2px 8px rgba(16, 185, 129, .15);
  padding: 10px 20px;
  transform: translateY(-1px) scale(1.02);
}

.pill.is-active::before {
  opacity: 1;
  background: radial-gradient(circle at center, rgba(255, 255, 255, .2) 0%, transparent 70%);
}

.pill.is-active .pill-icon {
  opacity: 1;
  transform: scale(1.1);
}

.pill.is-active .pill-text {
  font-weight: 800;
  letter-spacing: -0.02em;
}

.pill.is-active .pill-count {
  background: rgba(6, 26, 18, .25);
  border-color: rgba(6, 26, 18, .2);
  opacity: 1;
  color: #061a12;
  font-weight: 800;
}

.pill:hover:not(.is-active) {
  background: linear-gradient(180deg, rgba(255, 255, 255, .05), rgba(255, 255, 255, .02));
  border-color: rgba(255, 255, 255, .2);
  transform: translateY(-1px);
  box-shadow:
    0 2px 8px rgba(0, 0, 0, .2),
    0 0 0 1px rgba(255, 255, 255, .1),
    0 0 12px rgba(16, 185, 129, .08);
}

.pill:hover:not(.is-active)::before {
  opacity: 1;
}

.pill:hover:not(.is-active) .pill-icon {
  opacity: 1;
  transform: scale(1.03);
}

.pill:hover:not(.is-active) .pill-count {
  opacity: 0.9;
  background: rgba(255, 255, 255, .12);
  border-color: rgba(255, 255, 255, .1);
}

html.light .pill:hover:not(.is-active) {
  background: linear-gradient(180deg, rgba(0, 0, 0, .03), rgba(0, 0, 0, .01));
  border-color: rgba(0, 0, 0, .15);
  box-shadow:
    0 4px 12px rgba(0, 0, 0, .08),
    0 0 0 1px rgba(0, 0, 0, .08),
    0 0 16px rgba(16, 185, 129, .08);
}

html.light .pill:hover:not(.is-active) .pill-count {
  background: rgba(0, 0, 0, .06);
  border-color: rgba(0, 0, 0, .08);
}

.pill:active {
  transform: scale(0.98) translateY(0);
  transition: transform 0.1s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ================= Live Theater ================= */
.live-theater {
  position: relative;
  margin: 24px 0;
}

.live-badge {
  position: absolute;
  top: 16px;
  left: 16px;
  background: #ef4444;
  color: white;
  padding: 6px 12px;
  border-radius: 6px;
  font-weight: 700;
  font-size: 12px;
  letter-spacing: 0.5px;
  z-index: 10;
  box-shadow: 0 2px 8px rgba(239, 68, 68, 0.4);
  animation: pulse 2s infinite;
}

.live-ended-badge {
  display: inline-block;
  background: rgba(156, 163, 175, 0.2);
  color: var(--text-dim);
  padding: 2px 8px;
  border-radius: 4px;
  font-weight: 600;
  font-size: 10px;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  margin-left: 6px;
  border: 1px solid var(--line);
}

/* Live badge is now inside .media, ensure proper positioning */
.live-theater .feature .media {
  position: relative;
}

@keyframes pulse {

  0%,
  100% {
    opacity: 1;
  }

  50% {
    opacity: 0.8;
  }
}

.live-theater .feature {
  position: relative;
  border-radius: var(--radius-lg);
  overflow: hidden;
  background: linear-gradient(180deg, var(--panel-top), var(--panel-bot));
  backdrop-filter: blur(8px);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-2);
}

.live-theater .feature .media {
  aspect-ratio: 2.15/1;
  overflow: hidden;
  background: #0e1118;
  position: relative;
}

.live-theater .feature .media img {
  width: 122%;
  height: 100%;
  object-fit: cover;
  object-position: 40% 50%;
  filter: saturate(1.02);
  transition: transform .6s ease, filter .6s ease;
}

.live-theater .feature:hover .media img {
  transform: scale(1.05);
  filter: brightness(1.1);
}

/* Live embed preview styling */
.live-theater .feature .media #live-embed-container {
  width: 100%;
  height: 100%;
  position: absolute;
  top: 0;
  left: 0;
  z-index: 1;
}

.live-theater .feature .media #live-embed {
  width: 100%;
  height: 100%;
  border: 0;
  pointer-events: none;
  /* Allow clicks to pass through to overlay button by default */
  z-index: 1;
  /* Behind overlay by default */
  transition: z-index 0.2s ease;
}

/* Enable interaction when hovering over media area */
.live-theater .feature .media:hover #live-embed {
  pointer-events: auto;
  z-index: 5;
  /* Above overlay on hover so embed is interactive */
}

.live-theater .feature .overlay {
  position: absolute;
  inset: auto 0 0 0;
  padding: 16px;
  background: linear-gradient(180deg, rgba(0, 0, 0, 0) 0%, rgba(6, 8, 12, .86) 100%);
  z-index: 4;
  /* Above embed by default, but below when embed is hovered */
  pointer-events: auto;
  /* Overlay is always clickable */
  transition: opacity 0.2s ease, z-index 0.2s ease;
}

/* When hovering media, make overlay less intrusive and lower z-index so embed can be clicked */
.live-theater .feature .media:hover~.overlay,
.live-theater .feature:hover .overlay {
  opacity: 0.7;
  /* Slightly fade overlay on hover to show embed is interactive */
  z-index: 2;
  /* Lower z-index on hover so embed controls are accessible */
  pointer-events: none;
  /* Disable overlay clicks when hovering media (embed is interactive) */
}

/* Re-enable overlay clicks when not hovering media */
.live-theater .feature .overlay:hover {
  pointer-events: auto;
  /* Re-enable when directly hovering overlay */
  z-index: 4;
  /* Bring back to front when hovering overlay directly */
  opacity: 1;
  /* Full opacity when hovering overlay */
}

.live-theater .feature .overlay .ttl {
  font-size: 20px;
  font-weight: 800;
  line-height: 1.4;
  /* Added for better readability */
  margin: 0 0 6px;
  color: #ffffff;
  /* Always white for live streams */
}

.live-theater .feature .overlay .meta {
  color: rgba(255, 255, 255, .8);
  /* Always white/light for live streams */
  font-size: 13px;
  font-weight: 500;
  /* Added for better visibility */
}

/* Center CTA button absolutely in the middle of the screen */
.live-theater .feature #live-link {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 10;
  pointer-events: auto;
}

/* ================= Hero (capped) ================= */
.hero {
  margin: 24px 0;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  overflow-x: hidden;
}

/* Hide hero section by default - only show when explicitly enabled */
.hero[hidden],
.hero:not([data-loaded]) {
  display: none !important;
}

/* Hide hero section by default - only show when content is loaded */
.hero:not([data-loaded]) {
  display: none !important;
}

.hero .feature {
  position: relative;
  border-radius: var(--radius-lg);
  overflow: hidden;
  background: linear-gradient(180deg, var(--panel-top), var(--panel-bot));
  backdrop-filter: blur(8px);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-2);
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}

.hero .feature .media {
  aspect-ratio: 2.15/1;
  overflow: hidden;
  background: #0e1118;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}

/* Hide empty hero elements to prevent ghost shells */
.hero .feature .media img:not([src]),
.hero .feature .media img[src=""],
.hero .feature .overlay .ttl:empty,
.hero .feature .overlay .meta:empty {
  display: none;
}

.hero .feature .media img {
  width: 122%;
  height: 100%;
  object-fit: cover;
  object-position: 40% 50%;
  filter: saturate(1.02);
  transition: transform .6s ease, filter .6s ease;
  max-width: none;
}

/* Optimize thumbnail loading - prevent layout shift and improve performance */
.card-thumb {
  /* Use content-visibility for better rendering performance */
  content-visibility: auto;
  contain-intrinsic-size: 300px 169px;
  /* Approximate aspect ratio 16:9 */
  /* Ensure smooth loading */
  image-rendering: -webkit-optimize-contrast;
  image-rendering: crisp-edges;
}

/* Eager-loaded thumbnails should be fully visible immediately */
.card-thumb[loading="eager"] {
  content-visibility: visible;
}

/* Ensure thumbnails have proper aspect ratio to prevent layout shift */
.card .thumb-wrap {
  aspect-ratio: 16 / 9;
  overflow: hidden;
}

/* Infinite Scroll Loading Spinner */
#loadingSpinner {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 24px;
  width: 100%;
}

#loadingSpinner .spinner {
  width: 24px;
  height: 24px;
  border: 3px solid var(--line);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spinner-rotate 0.8s linear infinite;
}

#loadingSpinner .loading-text {
  color: var(--text-dim);
  font-size: 14px;
  font-weight: 500;
}

/* Scroll sentinel - invisible element for intersection observer */
#scroll-sentinel {
  height: 1px;
  width: 100%;
  pointer-events: none;
  visibility: hidden;
}

.hero .feature:hover .media img {
  transform: scale(1.05);
  filter: brightness(1.1);
}

.hero .feature .overlay {
  position: absolute;
  inset: auto 0 0 0;
  padding: 16px;
  background: linear-gradient(180deg, rgba(0, 0, 0, 0) 0%, rgba(6, 8, 12, .86) 100%);
}

.hero .feature .overlay .ttl {
  font-size: 20px;
  font-weight: 800;
  line-height: 1.4;
  /* Added for better readability */
  margin: 0 0 6px;
}

.hero .feature .overlay .meta {
  color: var(--text-dim);
  font-size: 13px;
  font-weight: 500;
  /* Added for better visibility */
}

/* Desktop: Make hero and live theater smaller and centered */
@media (min-width: 769px) {

  .live-theater .feature,
  .hero .feature {
    max-width: 800px;
    margin: 0 auto;
    width: 100%;
    box-sizing: border-box;
  }
}

/* Tablet constraints for hero (iPad Air: 820px width) */
@media (max-width: 1024px) and (min-width: 769px) {
  .hero {
    width: 100% !important;
    max-width: 100% !important;
    padding: 0 16px !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
    box-sizing: border-box !important;
    overflow-x: hidden !important;
  }

  .hero .feature {
    width: 100% !important;
    max-width: 100% !important;
    margin: 0 auto !important;
    box-sizing: border-box !important;
    overflow: hidden !important;
  }

  .hero .feature .media {
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
    overflow: hidden !important;
  }

  .hero .feature .media img {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    object-fit: cover !important;
    object-position: center !important;
    box-sizing: border-box !important;
  }

  /* Ensure live-theater also respects constraints */
  .live-theater {
    width: 100% !important;
    max-width: 100% !important;
    padding: 0 16px !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
    box-sizing: border-box !important;
    overflow-x: hidden !important;
  }

  .live-theater .feature {
    width: 100% !important;
    max-width: 100% !important;
    margin: 0 auto !important;
    box-sizing: border-box !important;
    overflow: hidden !important;
  }

  .live-theater .feature .media {
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
    overflow: hidden !important;
  }

  .live-theater .feature .media #live-embed {
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
  }
}

.hero .picks {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.hero .pick {
  display: grid;
  grid-template-columns: 1fr;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  overflow: hidden;
  background: linear-gradient(180deg, var(--panel-top), var(--panel-bot));
  backdrop-filter: blur(8px);
  box-shadow: var(--shadow-1);
  transition: transform .3s ease;
}

.hero .pick:hover {
  transform: translateY(-3px);
}

.hero .pick .thumb {
  aspect-ratio: 2/1;
  background: #0e1118;
  overflow: hidden;
}

.hero .pick .thumb img {
  width: 120%;
  height: 100%;
  object-fit: cover;
  object-position: 45% 50%;
  transition: transform .5s ease, filter .5s ease;
}

.hero .pick:hover .thumb img {
  transform: scale(1.05);
  filter: brightness(1.1);
}

.hero .pick .body {
  padding: 10px 12px 14px;
}

.hero .pick .body .t {
  font-weight: 700;
  font-size: 14px;
  line-height: 1.5;
  /* Increased for better readability */
  margin: 0 0 4px;
}

.hero .pick .body .m {
  color: var(--text-dim);
  font-size: 12px;
  font-weight: 500;
  /* Added for better visibility */
}

/* ================= Continue Watching ================= */
.rail {
  margin: 10px 0 16px;
  overflow-x: hidden;
  /* prevent arrows from extending beyond viewport */
}

.rail .rail-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 8px 0 12px;
  padding: 0 16px;
  /* Match main content padding */
}

.rail .rail-wrapper {
  position: relative;
  width: calc(100vw - 90px - 32px - 16px);
  /* Account for sidebar (90px), gutters (32px), and spacing (16px) */
  max-width: 1880px;
  /* Match grid-stage max-width */
  margin: 0 auto;
  /* Center the section */
  overflow: hidden;
  /* clip arrows that might extend */
  box-sizing: border-box;
}

/* Tablet constraints for rail wrapper */
@media (max-width: 1024px) and (min-width: 769px) {
  .rail .rail-wrapper {
    width: calc(100vw - 60px - 32px - 16px) !important;
    /* Account for collapsed sidebar (60px) */
    max-width: 100% !important;
    box-sizing: border-box !important;
    overflow-x: hidden !important;
  }

  .rail .row {
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    overflow-x: auto;
    overflow-y: hidden;
  }

  .rail .row .mini-wrapper {
    min-width: 180px;
    /* Slightly smaller on tablets */
    max-width: 200px;
    flex-shrink: 0;
  }
}

.rail .row {
  display: flex;
  gap: 12px;
  overflow-x: auto;
  overflow-y: hidden;
  padding: 0 40px;
  /* Extra padding for arrows - match category bar */
  padding-bottom: 4px;
  scroll-snap-type: x mandatory;
  scrollbar-width: none;
  /* Firefox */
  -ms-overflow-style: none;
  /* IE/Edge */
  -webkit-overflow-scrolling: touch;
  scroll-behavior: smooth;
  cursor: grab;
  mask-image: linear-gradient(to right, transparent 0, #000 40px, #000 calc(100% - 40px), transparent 100%);
}

.rail .row:active {
  cursor: grabbing;
}

.rail .row::-webkit-scrollbar {
  display: none;
}

/* Chrome/Safari */
.rail-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, .15);
  background: linear-gradient(180deg, rgba(15, 18, 26, .9), rgba(10, 13, 20, .95));
  backdrop-filter: blur(12px) saturate(180%);
  -webkit-backdrop-filter: blur(12px) saturate(180%);
  color: var(--text);
  display: none;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 50;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow:
    0 4px 12px rgba(0, 0, 0, .4),
    0 0 0 1px rgba(255, 255, 255, .05);
  will-change: transform, box-shadow;
}

.rail-nav:hover {
  background: linear-gradient(180deg, rgba(20, 23, 30, .95), rgba(15, 18, 26, 1));
  transform: translateY(-50%) scale(1.12);
  box-shadow:
    0 6px 16px rgba(0, 0, 0, .5),
    0 0 0 1px rgba(255, 255, 255, .1),
    0 0 20px rgba(16, 185, 129, .15);
}

html.light .rail-nav {
  background: linear-gradient(180deg, rgba(255, 255, 255, .95), rgba(250, 250, 250, .98));
  border: 1px solid rgba(0, 0, 0, .1);
  box-shadow:
    0 4px 12px rgba(0, 0, 0, .1),
    0 0 0 1px rgba(0, 0, 0, .05);
}

html.light .rail-nav:hover {
  background: linear-gradient(180deg, rgba(255, 255, 255, 1), rgba(250, 250, 250, 1));
  box-shadow:
    0 6px 16px rgba(0, 0, 0, .15),
    0 0 0 1px rgba(0, 0, 0, .1),
    0 0 20px rgba(16, 185, 129, .1);
}

.rail-nav:active {
  transform: translateY(-50%) scale(1.05);
}

.rail-nav.left {
  left: 8px;
}

.rail-nav.right {
  right: 8px;
}

/* Arrows are now shown on all screen sizes when content overflows (controlled by JS) */
.rail .row .mini-wrapper {
  position: relative;
  min-width: 196px;
  /* 280px * 0.7 = 196px (30% smaller) */
  max-width: 224px;
  /* 320px * 0.7 = 224px (30% smaller) */
  scroll-snap-align: start;
  /* No shadow or transform on wrapper - let the card handle it */
  opacity: 0;
  transform: translateY(12px) scale(0.98);
  animation: cardFadeIn 0.4s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

.rail .row .mini-wrapper:nth-child(1) {
  animation-delay: 0.05s;
}

.rail .row .mini-wrapper:nth-child(2) {
  animation-delay: 0.1s;
}

.rail .row .mini-wrapper:nth-child(3) {
  animation-delay: 0.15s;
}

.rail .row .mini-wrapper:nth-child(4) {
  animation-delay: 0.2s;
}

.rail .row .mini-wrapper:nth-child(5) {
  animation-delay: 0.25s;
}

.rail .row .mini-wrapper:nth-child(6) {
  animation-delay: 0.3s;
}

.rail .row .mini-wrapper:nth-child(7) {
  animation-delay: 0.35s;
}

.rail .row .mini-wrapper:nth-child(8) {
  animation-delay: 0.4s;
}

@keyframes cardFadeIn {
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.rail .row .mini {
  width: 100%;
  border-radius: var(--radius-lg);
  /* Match grid cards - 16px for consistency */
  overflow: hidden;
  /* Full enclosing */
  background: linear-gradient(180deg, var(--panel-top), var(--panel-bot));
  backdrop-filter: blur(8px);
  transition: var(--card-hover);
  box-shadow: var(--shadow-1);
  /* Match grid cards - creates bottom shading */
  will-change: transform, box-shadow;
}

.rail .row .mini:hover {
  transform: translateY(-4px) scale(1.02);
  /* Enhanced hover lift */
  box-shadow:
    var(--shadow-2),
    0 0 24px rgba(16, 185, 129, .15);
  /* Emerald glow on hover */
}

/* Light mode: stronger shadows for resume cards */
html.light .rail .row .mini {
  box-shadow: var(--shadow-1-light);
}

html.light .rail .row .mini:hover {
  box-shadow: var(--shadow-2-light);
}

.rail .row .mini .thumb {
  aspect-ratio: 16/9;
  background: #0e1118;
  position: relative;
  overflow: hidden;
  /* Full enclosing */
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  /* Rounded top corners only */
}

.rail .row .mini .thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1), filter 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  will-change: transform, filter;
}

.rail .row .mini:hover .thumb img {
  transform: scale(1.08);
  /* Enhanced zoom */
  filter: brightness(1.05) saturate(1.1);
  /* Subtle brightness and saturation boost */
}

.rail .row .mini .body {
  padding: 12px 12px 14px;
  /* Match grid card body padding */
  display: flex;
  flex-direction: column;
  gap: 6px;
  overflow: hidden;
  /* Full enclosing */
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
  /* Rounded bottom corners to complete frame */
  background: linear-gradient(180deg, var(--panel-top), var(--panel-bot));
  /* Blue shading on title/time/view area */
}

.rail .row .mini .ttl {
  font-weight: 700;
  font-size: 12px;
  /* Slightly larger for better readability */
  line-height: 1.5;
  /* Increased from 1.3 for better readability */
  color: var(--text);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  min-height: 2.6em;
}

.rail .row .mini .desc {
  color: var(--text-dim);
  font-size: 11px;
  font-weight: 400;
  line-height: 1.4;
  margin-top: 4px;
  margin-bottom: 4px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 100%;
}

.rail .row .mini .m {
  color: var(--text-dim);
  font-size: 10px;
  /* Slightly larger for better readability */
  font-weight: 500;
  /* Increased from default for better visibility */
  display: flex;
  align-items: center;
  gap: 4px;
}

.rail .row .mini .progress {
  margin-top: 4px;
  /* 6px * 0.7 = 4.2px ≈ 4px */
  height: 4px;
  /* 6px * 0.7 = 4.2px ≈ 4px */
  background: rgba(255, 255, 255, .1);
  border-radius: 2px;
  /* 3px * 0.7 = 2.1px ≈ 2px */
  overflow: hidden;
  position: relative;
}

html.light .rail .row .mini .progress {
  background: rgba(0, 0, 0, .1);
}

.rail .row .mini .progress i {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--dx-emerald) 0%, #58e5b9 50%, #10b981 100%);
  border-radius: 2px;
  transition: width 0.3s ease, box-shadow 0.3s ease;
  box-shadow:
    0 0 8px rgba(16, 185, 129, .4),
    0 0 16px rgba(16, 185, 129, .2);
  position: relative;
}

.rail .row .mini:hover .progress {
  height: 5px;
  /* Slightly thicker on hover */
}

.rail .row .mini:hover .progress i {
  box-shadow:
    0 0 12px rgba(16, 185, 129, .6),
    0 0 24px rgba(16, 185, 129, .3);
}

.rail .row .mini .progress-text {
  position: absolute;
  right: 0;
  top: 6px;
  /* 8px * 0.7 = 5.6px ≈ 6px */
  font-size: 7px;
  /* 10px * 0.7 = 7px */
  color: var(--text-dim);
  font-weight: 600;
  opacity: 0;
  transition: opacity 0.2s ease;
}

.rail .row .mini-wrapper:hover .progress-text {
  opacity: 1;
}

.rail .row .mini .thumb-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, .4);
  /* Match grid card play overlay */
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.2s ease;
  pointer-events: none;
  z-index: 3;
  /* Match grid card z-index */
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  /* Match thumb border-radius */
}

.rail .row .mini-wrapper:hover .thumb-overlay {
  opacity: 1;
}

.rail .row .mini .thumb-overlay span {
  filter: drop-shadow(0 2px 8px rgba(0, 0, 0, .5));
  transform: scale(0.9);
  transition: transform 0.2s ease;
  display: inline-block;
}

.rail .row .mini-wrapper:hover .thumb-overlay span {
  transform: scale(1);
}

.resume-dismiss {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: linear-gradient(180deg, rgba(0, 0, 0, .85), rgba(0, 0, 0, .75));
  backdrop-filter: blur(8px) saturate(180%);
  -webkit-backdrop-filter: blur(8px) saturate(180%);
  border: 1px solid rgba(255, 255, 255, .2);
  color: #ffffff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
  opacity: 0;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  padding: 0;
  box-shadow:
    0 2px 8px rgba(0, 0, 0, .4),
    0 0 0 1px rgba(255, 255, 255, .05);
  will-change: transform, opacity, background;
}

.mini-wrapper:hover .resume-dismiss {
  opacity: 1;
}

.resume-dismiss:hover {
  background: linear-gradient(180deg, rgba(220, 38, 38, .95), rgba(185, 28, 28, .9));
  transform: scale(1.15) rotate(90deg);
  box-shadow:
    0 4px 12px rgba(220, 38, 38, .5),
    0 0 0 1px rgba(255, 255, 255, .1),
    0 0 16px rgba(220, 38, 38, .3);
  border-color: rgba(255, 255, 255, .3);
}

.resume-dismiss:active {
  transform: scale(1.05) rotate(90deg);
}

html.light .resume-dismiss {
  background: #ffffff;
  /* Pure white for maximum contrast */
  border: none;
  /* Hide border to remove weird shading */
  color: #000000;
  /* Pure black for maximum contrast */
}

html.light .resume-dismiss:hover {
  background: rgba(220, 38, 38, .9);
  color: #ffffff;
}

/* Always show dismiss button on mobile (no hover support) */
@media (max-width: 768px) {
  .resume-dismiss {
    opacity: 1 !important;
  }
}

/* ================= Grid stage (wide to screen edges) ================= */
.grid-stage {
  width: clamp(1200px, 99vw, 2000px);
  /* expand very wide */
  margin: 0 auto;
  padding: 12px 16px 32px;
  /* Better gutters for breathing room */
  box-sizing: border-box;
  overflow-x: hidden;
}

/* Tablet constraints for grid-stage */
@media (max-width: 1024px) and (min-width: 769px) {
  .grid-stage {
    width: 100%;
    max-width: 100%;
    padding: 12px 16px 32px;
    box-sizing: border-box;
    overflow-x: hidden;
  }
}

/* Responsive grid — stretch columns, cap at 4 */
.grid {
  display: grid;
  gap: 16px;
  /* Tighter spacing on mobile for better use of space */
  grid-template-columns: 1fr;
  /* phones */
  align-items: start;
  /* Align cards to top for consistent grid */
  padding: 0 16px;
  /* Add horizontal padding on mobile */
}

@media (min-width: 720px) {
  .grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 22px;
    /* Slightly more space on tablets */
    padding: 0;
    /* Remove padding on larger screens */
  }
}

@media (min-width: 1040px) {
  .grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 24px;
    /* More space on desktop */
  }
}

@media (min-width: 1320px) {
  .grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 24px;
    /* Consistent spacing on large screens */
  }
}

.card {
  grid-column: auto;
  width: 100%;
  max-width: 100%;
  background: linear-gradient(180deg, var(--panel-top), var(--panel-bot));
  backdrop-filter: blur(8px);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-1);
  transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1),
    box-shadow 0.4s cubic-bezier(0.34, 1.56, 0.64, 1),
    border-color 0.3s ease,
    opacity 0.3s ease;
  position: relative;
  will-change: transform, box-shadow;
  cursor: pointer;
}

.card:hover {
  transform: translateY(-6px) scale(1.02);
  box-shadow:
    var(--shadow-2),
    0 0 0 1px rgba(16, 185, 129, .12),
    0 0 32px rgba(16, 185, 129, .18),
    0 8px 24px rgba(0, 0, 0, .3);
  border-color: rgba(16, 185, 129, .3);
}

.card:active {
  transform: translateY(-2px) scale(1.01);
  transition: transform 0.1s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Light mode: stronger shadows and pure white backgrounds for better text contrast */
html.light .card {
  box-shadow: var(--shadow-1-light);
}

html.light .card:hover {
  box-shadow: var(--shadow-2-light);
}

.card-link {
  display: block;
  text-decoration: none;
  color: inherit;
}

.thumb-wrap {
  position: relative;
  aspect-ratio: 16/9;
  background: #0e1118;
  overflow: hidden;
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  transition: border-radius 0.3s ease;
}

.card:hover .thumb-wrap {
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}

/* Live stream embed container */
.card-live-embed {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 2;
  background: transparent;
  display: block;
}

.card-live-embed iframe {
  width: 100%;
  height: 100%;
  border: 0;
  position: absolute;
  top: 0;
  left: 0;
  background: transparent;
  display: block;
}

/* Live indicator for mobile live stream cards */
.card-live-indicator {
  position: absolute;
  top: 8px;
  left: 8px;
  z-index: 2;
  background: rgba(220, 38, 38, 0.9);
  color: #fff;
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 4px;
  pointer-events: none;
  backdrop-filter: blur(4px);
}

.card-live-indicator .live-dot {
  display: inline-block;
  animation: pulse-live 2s ease-in-out infinite;
  font-size: 8px;
}

@keyframes pulse-live {

  0%,
  100% {
    opacity: 1;
    transform: scale(1);
  }

  50% {
    opacity: 0.6;
    transform: scale(1.2);
  }
}

.thumb-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.6s cubic-bezier(0.34, 1.56, 0.64, 1),
    opacity 0.4s ease,
    filter 0.4s ease;
  will-change: transform;
  display: block;
}

.card:hover .thumb-wrap img {
  transform: scale(1.1);
  filter: brightness(1.08) saturate(1.15);
}

/* Loading placeholder for thumbnails */
.thumb-wrap::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg,
      rgba(255, 255, 255, 0.03) 0%,
      rgba(255, 255, 255, 0.08) 50%,
      rgba(255, 255, 255, 0.03) 100%);
  background-size: 200% 100%;
  animation: shimmer 2s ease-in-out infinite;
  opacity: 0;
  transition: opacity 0.3s ease;
  z-index: 1;
}

.thumb-wrap img[loading="lazy"]+ ::before,
.thumb-wrap:not(:has(img[src]))::before {
  opacity: 1;
}

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

  100% {
    background-position: 200% 0;
  }
}

.video-preview {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 1;
  background: #0e1118;
}

/* Play button overlay */
.play-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(180deg,
      rgba(0, 0, 0, 0) 0%,
      rgba(0, 0, 0, .2) 40%,
      rgba(0, 0, 0, .4) 70%,
      rgba(0, 0, 0, .6) 100%);
  opacity: 0;
  transition: opacity 0.4s cubic-bezier(0.34, 1.56, 0.64, 1),
    background 0.4s ease;
  pointer-events: none;
  z-index: 3;
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}

.card:hover .play-overlay {
  opacity: 1;
  background: linear-gradient(180deg,
      rgba(0, 0, 0, 0) 0%,
      rgba(0, 0, 0, .3) 40%,
      rgba(0, 0, 0, .5) 70%,
      rgba(0, 0, 0, .7) 100%);
}

.play-overlay span {
  filter: drop-shadow(0 4px 12px rgba(0, 0, 0, .6));
  transform: scale(0.85) translateY(4px);
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  display: inline-block;
  opacity: 0.9;
}

.card:hover .play-overlay span {
  transform: scale(1.1) translateY(0);
  opacity: 1;
}

.duration {
  position: absolute;
  right: 10px;
  /* Slightly more inset */
  bottom: 10px;
  /* Slightly more inset */
  background: rgba(0, 0, 0, .88);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, .15);
  padding: 5px 9px;
  /* Slightly more padding */
  border-radius: 8px;
  /* Slightly more rounded */
  font-weight: 700;
  font-size: 12px;
  color: #ffffff;
  line-height: 1.2;
  z-index: 3;
  box-shadow:
    0 2px 8px rgba(0, 0, 0, .4),
    0 0 0 1px rgba(0, 0, 0, .2);
  letter-spacing: 0.3px;
  font-variant-numeric: tabular-nums;
  /* Better number alignment */
  transition: all 0.2s ease;
}

.card:hover .duration {
  background: rgba(0, 0, 0, .92);
  transform: scale(1.05);
  box-shadow:
    0 4px 12px rgba(0, 0, 0, .5),
    0 0 0 1px rgba(0, 0, 0, .3);
}

html.light .duration {
  background: #ffffff !important;
  /* Pure white for maximum contrast */
  border-color: rgba(0, 0, 0, .2) !important;
  color: #000000 !important;
  /* Pure black for maximum contrast */
  box-shadow: 0 2px 8px rgba(0, 0, 0, .15) !important;
  font-weight: 700;
}

html.light .card:hover .duration {
  background: #ffffff !important;
  color: #000000 !important;
  box-shadow: 0 4px 12px rgba(0, 0, 0, .2) !important;
}

.progress {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 3px;
  background: rgba(255, 255, 255, .08);
  z-index: 3;
  overflow: hidden;
}

.progress>i {
  display: block;
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--dx-gold) 0%, #fbbf24 100%);
  transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 0 8px rgba(244, 183, 62, 0.5);
  position: relative;
}

.progress>i::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg,
      transparent 0%,
      rgba(255, 255, 255, .3) 50%,
      transparent 100%);
  animation: progress-shine 2s ease-in-out infinite;
}

@keyframes progress-shine {
  0% {
    transform: translateX(-100%);
  }

  100% {
    transform: translateX(200%);
  }
}

.card:hover .progress {
  height: 4px;
}

.card:hover .progress>i {
  box-shadow: 0 0 12px rgba(244, 183, 62, 0.7);
}

/* Watch later/save button */
.card-save {
  position: absolute !important;
  top: 8px !important;
  right: 8px !important;
  bottom: auto !important;
  left: auto !important;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, .75);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, .2);
  border-radius: 50%;
  color: #ffffff;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.3s cubic-bezier(0.4, 0, 0.2, 1), transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1), background 0.2s ease, box-shadow 0.2s ease;
  z-index: 4;
  padding: 0;
  box-shadow: 0 2px 8px rgba(0, 0, 0, .3);
}

html.light .card-save {
  background: #ffffff;
  /* Pure white for maximum contrast */
  border-color: rgba(0, 0, 0, .2);
  color: #000000;
  /* Pure black for maximum contrast */
  box-shadow: 0 2px 8px rgba(0, 0, 0, .15);
}

.card:hover .card-save {
  opacity: 1;
}

/* Always show bookmark button on mobile (no hover support) */
@media (max-width: 768px) {
  .card-save {
    opacity: 1 !important;
  }
}

.card-save:hover {
  background: rgba(0, 0, 0, .9);
  transform: scale(1.15);
  box-shadow: 0 4px 16px rgba(0, 0, 0, .4), 0 0 0 2px rgba(16, 185, 129, .3);
}

html.light .card-save:hover {
  background: #ffffff;
  box-shadow: 0 4px 16px rgba(0, 0, 0, .2), 0 0 0 2px rgba(16, 185, 129, .2);
}

.card-save:active {
  transform: scale(0.9);
}

.card-save svg {
  width: 18px;
  height: 18px;
  transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.card-save:hover svg {
  transform: scale(1.1);
}

/* Dismiss resume button (shown only in Resume category) */
.card-dismiss-resume {
  position: absolute;
  top: 8px;
  left: 8px;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, .7);
  backdrop-filter: blur(4px);
  border: 1px solid rgba(255, 255, 255, .15);
  border-radius: 50%;
  color: #ffffff;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.2s ease, transform 0.2s ease, background 0.2s ease;
  z-index: 5;
  padding: 0;
}

html.light .card-dismiss-resume {
  background: #ffffff;
  /* Pure white for maximum contrast */
  border-color: rgba(0, 0, 0, .2);
  color: #000000;
  /* Pure black for maximum contrast */
  box-shadow: 0 2px 8px rgba(0, 0, 0, .15);
}

.card:hover .card-dismiss-resume {
  opacity: 1;
}

.card-dismiss-resume:hover {
  background: rgba(220, 38, 38, .9);
  transform: scale(1.1);
  color: #ffffff;
}

html.light .card-dismiss-resume:hover {
  background: rgba(220, 38, 38, .9);
  color: #ffffff;
  box-shadow: 0 4px 12px rgba(220, 38, 38, .3);
}

.card-dismiss-resume:active {
  transform: scale(0.95);
}

.card-dismiss-resume svg {
  width: 16px;
  height: 16px;
}

/* Always show dismiss button on mobile (no hover support) */
@media (max-width: 768px) {
  .card-dismiss-resume {
    opacity: 1 !important;
  }
}

.card-body {
  padding: 14px 14px 16px;
  /* Increased padding for better spacing */
  display: flex;
  flex-direction: column;
  gap: 8px;
  /* Spacing between elements */
}

.title {
  font-size: 15.5px;
  /* Slightly larger for better readability */
  font-weight: 700;
  line-height: 1.4;
  /* Tighter line height for titles */
  margin: 0;
  /* Remove margin, use gap instead */
  color: var(--text);
  letter-spacing: -0.01em;
  /* Slight negative letter spacing for modern look */
  display: -webkit-box;
  -webkit-line-clamp: 2;
  /* Allow 2 lines for titles */
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-overflow: ellipsis;
  min-height: 2.8em;
  /* Consistent height for 2-line titles */
}

.card-body .desc {
  color: var(--text-dim);
  font-size: 12.5px;
  /* Slightly larger */
  font-weight: 400;
  line-height: 1.5;
  /* Better line height for descriptions */
  margin: -4px 0 0 0;
  /* Negative margin-top to bring closer to title */
  display: -webkit-box;
  -webkit-line-clamp: 2;
  /* Allow 2 lines for descriptions */
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-overflow: ellipsis;
  min-height: 2.25em;
  /* Consistent height for 2-line descriptions */
}

.meta {
  color: var(--text-dim);
  font-size: 12.5px;
  /* Slightly smaller for hierarchy */
  font-weight: 500;
  display: flex;
  gap: 8px;
  /* Tighter gap between meta items */
  align-items: center;
  flex-wrap: wrap;
  margin-top: 2px;
  /* Small top margin for separation */
  line-height: 1.3;
}

.meta span {
  display: inline-flex;
  align-items: center;
  white-space: nowrap;
}

.card-date {
  color: var(--text-dim);
  font-weight: 500;
  opacity: 0.85;
  /* Slightly dimmed for hierarchy */
}

/* ================= Loading States & Progress Indicators ================= */

/* Loading Spinner */
.loading-spinner {
  display: inline-block;
  width: 16px;
  height: 16px;
  border: 2px solid var(--line);
  border-top-color: var(--dx-emerald);
  border-radius: 50%;
  animation: spinner-rotate 0.8s linear infinite;
  flex-shrink: 0;
}

@keyframes spinner-rotate {
  to {
    transform: rotate(360deg);
  }
}

/* Grid actions container */
.grid-actions {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  padding: 16px 0;
  min-height: 60px;
  position: relative;
}

/* Infinite scroll loading spinner */
#loadingSpinner {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 24px;
  width: 100%;
  min-height: 60px;
  visibility: visible;
  opacity: 1;
  transition: opacity 0.3s ease;
  position: relative;
  z-index: 1;
}

/* Hide spinner when hidden attribute is set */
#loadingSpinner[hidden] {
  display: none !important;
}

#loadingSpinner .spinner {
  width: 24px;
  height: 24px;
  border: 3px solid var(--line);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spinner-rotate 0.8s linear infinite;
  flex-shrink: 0;
}

#loadingSpinner .loading-text {
  color: var(--text-dim);
  font-size: 14px;
  font-weight: 500;
}

/* Scroll sentinel - invisible element for intersection observer */
#scroll-sentinel {
  height: 1px;
  width: 100%;
  pointer-events: none;
  visibility: hidden;
  position: relative;
}

.loading-spinner-sm {
  width: 12px;
  height: 12px;
  border-width: 1.5px;
}

.loading-spinner-lg {
  width: 24px;
  height: 24px;
  border-width: 3px;
}

/* Button Loading States */
.btn.loading {
  position: relative;
  color: transparent !important;
  pointer-events: none;
  cursor: wait;
}

.btn.loading::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 16px;
  height: 16px;
  border: 2px solid transparent;
  border-top-color: currentColor;
  border-right-color: currentColor;
  border-radius: 50%;
  animation: spinner-rotate 0.8s linear infinite;
}

.btn-primary.loading::after {
  border-top-color: #ffffff;
  border-right-color: #ffffff;
}

.btn-ghost.loading::after {
  border-top-color: var(--text);
  border-right-color: var(--text);
}

/* Search Loading State */
.search-container.loading::after {
  content: '';
  position: absolute;
  right: 40px;
  top: 50%;
  transform: translateY(-50%);
  width: 16px;
  height: 16px;
  border: 2px solid var(--line);
  border-top-color: var(--dx-emerald);
  border-radius: 50%;
  animation: spinner-rotate 0.8s linear infinite;
  z-index: 2;
}

/* Video Player Loading State */
.player-embed.loading {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 400px;
}

.player-embed.loading::before {
  content: '';
  width: 48px;
  height: 48px;
  border: 4px solid var(--line);
  border-top-color: var(--dx-emerald);
  border-radius: 50%;
  animation: spinner-rotate 0.8s linear infinite;
}

/* Progress Bar */
.progress-bar {
  width: 100%;
  height: 4px;
  background: var(--surface);
  border-radius: 2px;
  overflow: hidden;
  position: relative;
}

.progress-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--dx-emerald), var(--dx-cyan));
  border-radius: 2px;
  transition: width 0.3s ease;
  position: relative;
  overflow: hidden;
}

.progress-bar-fill::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  bottom: 0;
  right: 0;
  background: linear-gradient(90deg,
      transparent,
      rgba(255, 255, 255, .3),
      transparent);
  animation: progress-shimmer 1.5s ease-in-out infinite;
}

@keyframes progress-shimmer {
  0% {
    transform: translateX(-100%);
  }

  100% {
    transform: translateX(100%);
  }
}

/* Loading skeleton */
.skeleton {
  pointer-events: none;
}

.skeleton-shimmer {
  background: linear-gradient(90deg,
      var(--surface) 0%,
      rgba(255, 255, 255, .08) 25%,
      rgba(16, 185, 129, .1) 50%,
      rgba(255, 255, 255, .08) 75%,
      var(--surface) 100%);
  background-size: 200% 100%;
  animation: shimmer 1.8s ease-in-out infinite;
}

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

  100% {
    background-position: -200% 0;
  }
}

.skeleton .thumb-wrap {
  background: var(--surface);
  position: relative;
  overflow: hidden;
}

.skeleton .thumb-wrap::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg,
      transparent 0%,
      rgba(255, 255, 255, .1) 50%,
      transparent 100%);
  animation: skeleton-sweep 2s ease-in-out infinite;
}

@keyframes skeleton-sweep {
  0% {
    transform: translateX(-100%) skewX(-15deg);
  }

  100% {
    transform: translateX(200%) skewX(-15deg);
  }
}

.grid-actions {
  display: flex;
  justify-content: center;
  padding-top: 12px;
}

/* skeletons & enter animation */
.skeleton {
  position: relative;
  overflow: hidden;
  background: #0f1420;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
}

html.light .skeleton {
  background: #f5f5f5;
  border-color: rgba(0, 0, 0, .1);
}

.skeleton::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg,
      rgba(255, 255, 255, 0) 0%,
      rgba(255, 255, 255, .12) 50%,
      rgba(255, 255, 255, 0) 100%);
  transform: translateX(-100%);
  animation: shine 1.5s cubic-bezier(0.4, 0, 0.2, 1) infinite;
}

@keyframes shine {
  0% {
    transform: translateX(-100%) skewX(-10deg);
  }

  100% {
    transform: translateX(200%) skewX(-10deg);
  }
}

.card {
  opacity: 0;
  transform: translateY(12px) scale(0.98);
  transition: opacity .5s cubic-bezier(0.4, 0, 0.2, 1), transform .5s cubic-bezier(0.4, 0, 0.2, 1);
}

.card.is-in {
  opacity: 1;
  transform: translateY(0) scale(1);
}

/* Footer */
.footer {
  margin-top: 8px;
  padding: 32px 0;
  border-top: 1px solid var(--line);
  color: var(--text-dim);
  font-size: 13px;
}

/* ================= Mobile Bottom Nav ================= */
/* ================= MOBILE NAVIGATION - Independent from desktop sidebar ================= */
.mobile-nav {
  display: none;
  /* Hidden on desktop */
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 100;
  padding: 12px 16px;
  padding-bottom: calc(12px + env(safe-area-inset-bottom));
  background: linear-gradient(180deg, rgba(26, 29, 41, .95) 0%, rgba(21, 24, 33, .98) 100%);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border-top: 1px solid rgba(255, 255, 255, .1);
  border-left: none;
  border-right: none;
  border-bottom: none;
  border-radius: 20px 20px 0 0;
  box-shadow:
    0 -4px 24px rgba(0, 0, 0, .4),
    inset 0 1px 0 rgba(255, 255, 255, .05);
  transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1),
    box-shadow 0.3s ease,
    opacity 0.3s ease;
  transform: translateY(0);
  opacity: 1;
}

/* Hide mobile nav when scrolled down (optional enhancement) */
.mobile-nav.hidden {
  transform: translateY(100%);
  opacity: 0;
  pointer-events: none;
}

.mobile-nav:active {
  transform: translateY(2px);
  box-shadow:
    0 -2px 16px rgba(0, 0, 0, .3),
    0 0 0 1px rgba(255, 255, 255, .05);
}

/* Smooth slide-in animation on mount */
@keyframes slideUpNav {
  from {
    transform: translateY(100%);
    opacity: 0;
  }

  to {
    transform: translateY(0);
    opacity: 1;
  }
}

.mobile-nav {
  animation: slideUpNav 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* Mobile nav items - base styles */
.mobile-nav-item {
  display: flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  color: var(--text);
  transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  position: relative;
  -webkit-tap-highlight-color: transparent;
  border: 1px solid var(--line);
  backdrop-filter: blur(10px) saturate(150%);
  -webkit-backdrop-filter: blur(10px) saturate(150%);
  overflow: hidden;
  transform: scale(1);
}

.mobile-nav-item::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(circle, rgba(16, 185, 129, .15) 0%, transparent 70%);
  opacity: 0;
  transition: opacity 0.3s ease;
  z-index: 0;
}

.mobile-nav-item>* {
  position: relative;
  z-index: 1;
}

/* Trade button - SQUARE */
.mobile-nav-trade {
  width: 44px;
  height: 44px;
  min-width: 44px;
  max-width: 44px;
  padding: 0;
  border-radius: 10px;
  background: linear-gradient(180deg, rgba(16, 185, 129, .12), rgba(16, 185, 129, .06));
  border-color: rgba(16, 185, 129, .25);
  color: var(--dx-emerald);
  margin-right: 4px;
}

/* Home/Diamond button - SQUARE */
.mobile-nav-home {
  width: 58px;
  height: 58px;
  min-width: 58px;
  max-width: 58px;
  border-radius: 10px;
  background: linear-gradient(180deg, var(--panel-top), var(--panel-bot));
  border: 1px solid var(--line);
  box-shadow: 0 4px 12px rgba(0, 0, 0, .2);
  margin: 0 4px;
  flex-shrink: 0;
  z-index: 2;
  padding: 0;
}

/* Dashboard button - SQUARE (matches stream nav item) */
.mobile-nav-dashboard {
  width: 44px;
  height: 44px;
  min-width: 44px;
  max-width: 44px;
  padding: 0;
  border-radius: 10px;
  background: linear-gradient(180deg, rgba(244, 183, 62, .18), rgba(244, 183, 62, .1));
  border-color: rgba(244, 183, 62, .35);
  color: var(--dx-gold);
  margin-left: 4px;
}

/* Help button - SQUARE (Hidden for now, will be used later) */
.mobile-nav-help {
  display: none !important;
  /* Hidden until needed */
  width: 44px;
  height: 44px;
  min-width: 44px;
  max-width: 44px;
  padding: 0;
  border-radius: 10px;
  background: linear-gradient(180deg, var(--panel-top), var(--panel-bot));
  border: 1px solid var(--line);
  margin-left: 4px;
  flex-shrink: 0;
}

/* Theme button - SQUARE with moon emoji */
.mobile-nav-theme {
  width: 44px;
  height: 44px;
  min-width: 44px;
  max-width: 44px;
  border-radius: 10px;
  background: linear-gradient(180deg, var(--panel-top), var(--panel-bot));
  border: 1px solid var(--line);
  margin-left: auto;
  flex-shrink: 0;
  padding: 0;
}

/* Mobile nav icons */
.mobile-nav-icon {
  font-size: 22px;
  line-height: 1;
  display: block;
}

.mobile-nav-trade .mobile-nav-icon {
  font-size: 22px;
}

.mobile-nav-home .mobile-nav-icon {
  font-size: 28px;
}

.mobile-nav-dashboard .mobile-nav-icon {
  font-size: 22px;
}

.mobile-nav-help .mobile-nav-icon {
  font-size: 22px;
}

.mobile-nav-theme .mobile-nav-icon {
  font-size: 22px;
}

/* Diamond tooltip */
.diamond-tooltip {
  position: absolute;
  bottom: calc(100% + 12px);
  left: 50%;
  transform: translateX(-50%);
  z-index: 1000;
  display: none;
  pointer-events: none;
}

.diamond-tooltip.show {
  display: block;
  pointer-events: auto;
  animation: tooltipFadeIn 0.3s ease-out;
}

@keyframes tooltipFadeIn {
  from {
    opacity: 0;
    transform: translateX(-50%) translateY(4px);
  }

  to {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
  }
}

.tooltip-content {
  background: linear-gradient(180deg, var(--panel-top), var(--panel-bot));
  backdrop-filter: blur(12px);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 12px 16px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, .4);
  min-width: 200px;
  max-width: 260px;
}

.tooltip-text {
  margin: 0 0 10px 0;
  font-size: 13px;
  line-height: 1.4;
  color: var(--text);
}

.tooltip-close {
  width: 100%;
  padding: 6px 12px;
  background: var(--dx-emerald);
  color: white;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.tooltip-close:hover {
  background: var(--dx-emerald);
  filter: brightness(1.1);
  transform: translateY(-1px);
}

.tooltip-close:active {
  transform: translateY(0);
}

.tooltip-arrow {
  position: absolute;
  bottom: -6px;
  left: 50%;
  transform: translateX(-50%);
  width: 0;
  height: 0;
  border-left: 6px solid transparent;
  border-right: 6px solid transparent;
  border-top: 6px solid var(--line);
}

.tooltip-arrow::after {
  content: '';
  position: absolute;
  bottom: 1px;
  left: 50%;
  transform: translateX(-50%);
  width: 0;
  height: 0;
  border-left: 5px solid transparent;
  border-right: 5px solid transparent;
  border-top: 5px solid var(--panel-bot);
}

html.light .tooltip-content {
  background: linear-gradient(180deg, rgba(250, 250, 250, .98), rgba(250, 250, 250, .95));
  box-shadow: 0 4px 16px rgba(0, 0, 0, .12);
}

html.light .tooltip-arrow {
  border-top-color: rgba(0, 0, 0, .12);
}

html.light .tooltip-arrow::after {
  border-top-color: rgba(250, 250, 250, .95);
}

/* ================= General Tooltip System ================= */
/* Reusable tooltip for any element */
[data-tooltip] {
  position: relative;
  cursor: pointer;
}

[data-tooltip]::before,
[data-tooltip]::after {
  position: absolute;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
  z-index: 1000;
}

[data-tooltip]::before {
  content: attr(data-tooltip);
  background: linear-gradient(180deg, var(--panel-top), var(--panel-bot));
  backdrop-filter: blur(12px);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  font-size: 12px;
  line-height: 1.4;
  color: var(--text);
  white-space: nowrap;
  box-shadow: 0 4px 12px rgba(0, 0, 0, .3);
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%) translateY(4px);
}

[data-tooltip]::after {
  content: '';
  width: 0;
  height: 0;
  border-left: 5px solid transparent;
  border-right: 5px solid transparent;
  border-top: 5px solid var(--line);
  bottom: calc(100% + 3px);
  left: 50%;
  transform: translateX(-50%) translateY(4px);
}

[data-tooltip]:hover::before,
[data-tooltip]:hover::after,
[data-tooltip]:focus::before,
[data-tooltip]:focus::after {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

html.light [data-tooltip]::before {
  background: linear-gradient(180deg, rgba(250, 250, 250, .98), rgba(250, 250, 250, .95));
  box-shadow: 0 4px 12px rgba(0, 0, 0, .15);
}

html.light [data-tooltip]::after {
  border-top-color: rgba(0, 0, 0, .12);
}

/* Tooltip positioning variants */
[data-tooltip-position="top"]::before {
  bottom: calc(100% + 8px);
  top: auto;
}

[data-tooltip-position="top"]::after {
  bottom: calc(100% + 3px);
  top: auto;
}

[data-tooltip-position="bottom"]::before {
  top: calc(100% + 8px);
  bottom: auto;
  transform: translateX(-50%) translateY(-4px);
}

[data-tooltip-position="bottom"]::after {
  top: calc(100% + 3px);
  bottom: auto;
  border-top: none;
  border-bottom: 5px solid var(--line);
  transform: translateX(-50%) translateY(-4px);
}

[data-tooltip-position="bottom"]:hover::before,
[data-tooltip-position="bottom"]:hover::after {
  transform: translateX(-50%) translateY(0);
}

[data-tooltip-position="left"]::before {
  right: calc(100% + 8px);
  left: auto;
  bottom: 50%;
  transform: translateY(50%) translateX(4px);
}

[data-tooltip-position="left"]::after {
  right: calc(100% + 3px);
  left: auto;
  bottom: 50%;
  border-top: 5px solid transparent;
  border-bottom: 5px solid transparent;
  border-right: 5px solid var(--line);
  border-left: none;
  transform: translateY(50%) translateX(4px);
}

[data-tooltip-position="left"]:hover::before,
[data-tooltip-position="left"]:hover::after {
  transform: translateY(50%) translateX(0);
}

[data-tooltip-position="right"]::before {
  left: calc(100% + 8px);
  right: auto;
  bottom: 50%;
  transform: translateY(50%) translateX(-4px);
}

[data-tooltip-position="right"]::after {
  left: calc(100% + 3px);
  right: auto;
  bottom: 50%;
  border-top: 5px solid transparent;
  border-bottom: 5px solid transparent;
  border-left: 5px solid var(--line);
  border-right: none;
  transform: translateY(50%) translateX(-4px);
}

[data-tooltip-position="right"]:hover::before,
[data-tooltip-position="right"]:hover::after {
  transform: translateY(50%) translateX(0);
}

/* ================= Help Modal / Keyboard Shortcuts ================= */
.help-modal {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000;
  padding: 20px;
}

.help-modal-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(4px);
}

.help-modal-content {
  position: relative;
  background: linear-gradient(180deg, var(--panel-top), var(--panel-bot));
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-2);
  width: 100%;
  max-width: 500px;
  max-height: 90vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  animation: modalFadeIn 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

/* Dark mode: ensure solid blue gradient background - fully opaque */
html:not(.light) .help-modal-content {
  background: linear-gradient(180deg, #1a1a2e 0%, #16213e 50%, #0f172a 100%) !important;
  background-color: #1a1a2e !important;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
  opacity: 1 !important;
  mix-blend-mode: normal !important;
  isolation: isolate !important;
}
  display: flex;
  flex-direction: column;
  animation: modalFadeIn 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes modalFadeIn {
  from {
    opacity: 0;
    transform: scale(0.95) translateY(20px);
  }

  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

.help-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px;
  border-bottom: 1px solid var(--line);
}

.help-modal-header h2 {
  margin: 0;
  font-size: 20px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.01em;
}

.help-modal-close {
  width: 32px;
  height: 32px;
  border: none;
  background: transparent;
  color: var(--text-dim);
  font-size: 20px;
  cursor: pointer;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

.help-modal-close:hover {
  background: rgba(255, 255, 255, .05);
  color: var(--text);
}

.help-modal-body {
  padding: 24px;
  overflow-y: auto;
  flex: 1;
}

.shortcut-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
}

.shortcut-item:last-child {
  border-bottom: none;
}

.shortcut-keys {
  display: flex;
  gap: 4px;
  align-items: center;
}

.shortcut-keys kbd {
  background: linear-gradient(180deg, var(--panel-top), var(--panel-bot));
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 4px 8px;
  font-family: 'Courier New', monospace;
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
  box-shadow: 0 2px 4px rgba(0, 0, 0, .2);
  min-width: 24px;
  text-align: center;
}

.shortcut-desc {
  color: var(--text-dim);
  font-size: 14px;
  margin-left: 16px;
  flex: 1;
}

html.light .shortcut-keys kbd {
  background: #ffffff;
  border-color: rgba(0, 0, 0, .15);
  box-shadow: 0 1px 3px rgba(0, 0, 0, .1);
}

/* Help Modal - Large variant */
.help-modal-large .help-modal-content {
  max-width: 700px;
}

/* Light mode help modal */
html.light .help-modal-content {
  background: #ffffff;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.25);
}

/* Help Modal Tabs */
.help-modal-tabs {
  display: flex;
  gap: 4px;
  padding: 0 24px;
  border-bottom: 1px solid var(--line);
  overflow-x: auto;
  scrollbar-width: none;
}

.help-modal-tabs::-webkit-scrollbar {
  display: none;
}

.help-tab {
  background: none;
  border: none;
  padding: 12px 16px;
  color: var(--text-dim);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.help-tab:hover {
  color: var(--text);
  background: rgba(255, 255, 255, .03);
}

.help-tab.active {
  color: var(--text);
  border-bottom-color: var(--dx-emerald);
}

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

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

.help-tab-content h3 {
  margin: 0 0 16px 0;
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
}

.help-tab-content>p {
  margin: 0 0 24px 0;
  color: var(--text-dim);
  line-height: 1.6;
}

.help-section {
  margin-bottom: 24px;
  padding-bottom: 24px;
  border-bottom: 1px solid var(--line);
}

.help-section:last-child {
  border-bottom: none;
  margin-bottom: 0;
  padding-bottom: 0;
}

.help-section h4 {
  margin: 0 0 8px 0;
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
}

.help-section p {
  margin: 0;
  color: var(--text-dim);
  line-height: 1.6;
  font-size: 14px;
}

.help-section kbd {
  background: linear-gradient(180deg, var(--panel-top), var(--panel-bot));
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 2px 6px;
  font-family: 'Courier New', monospace;
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
}

/* FAQ Accordion */
.faq-item {
  margin-bottom: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  overflow: hidden;
  transition: border-color 0.2s ease;
}

.faq-item:hover {
  border-color: rgba(255, 255, 255, .2);
}

.faq-question {
  width: 100%;
  background: none;
  border: none;
  padding: 16px;
  text-align: left;
  color: var(--text);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  transition: background 0.2s ease;
}

.faq-question:hover {
  background: rgba(255, 255, 255, .03);
}

.faq-question svg {
  flex-shrink: 0;
  transition: transform 0.3s ease;
  color: var(--text-dim);
}

.faq-question[aria-expanded="true"] svg {
  transform: rotate(180deg);
}

.faq-answer {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease;
  background: rgba(0, 0, 0, .1);
}

.faq-answer p {
  margin: 0;
  padding: 16px;
  color: var(--text-dim);
  line-height: 1.6;
  font-size: 14px;
}

.faq-answer kbd {
  background: linear-gradient(180deg, var(--panel-top), var(--panel-bot));
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 2px 6px;
  font-family: 'Courier New', monospace;
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
}

html.light .faq-answer {
  background: rgba(0, 0, 0, .02);
}

html.light .help-section kbd,
html.light .faq-answer kbd {
  background: #ffffff;
  border-color: rgba(0, 0, 0, .15);
  box-shadow: 0 1px 3px rgba(0, 0, 0, .1);
}

/* ================= Empty States ================= */
.empty-state {
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 80px 20px;
  text-align: center;
  grid-column: 1 / -1;
  animation: fadeInUp 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

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

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.empty-state-icon {
  font-size: 64px;
  margin-bottom: 20px;
  opacity: 0.6;
  filter: grayscale(0.3);
  transition: transform 0.3s ease, opacity 0.3s ease;
  animation: float 3s ease-in-out infinite;
}

@keyframes float {

  0%,
  100% {
    transform: translateY(0);
  }

  50% {
    transform: translateY(-10px);
  }
}

.empty-state-title {
  font-size: 20px;
  font-weight: 700;
  color: var(--text);
  margin: 0 0 12px 0;
  letter-spacing: -0.01em;
}

.empty-state-message {
  font-size: 14px;
  color: var(--text-dim);
  margin: 0 0 24px 0;
  max-width: 400px;
  line-height: 1.6;
}

.empty-state .btn {
  margin-top: 8px;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.empty-state .btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(16, 185, 129, .2);
}

html.light .empty-state-icon {
  opacity: 0.5;
}

/* ================= Feature Discovery / Tips ================= */
.tip-highlight {
  position: relative;
  animation: tipPulse 2s ease-in-out infinite;
  outline: 2px solid var(--dx-emerald);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

@keyframes tipPulse {

  0%,
  100% {
    outline-color: var(--dx-emerald);
    box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.4);
  }

  50% {
    outline-color: var(--dx-cyan);
    box-shadow: 0 0 0 4px rgba(16, 185, 129, 0.2);
  }
}

.tip-notification {
  position: fixed;
  bottom: 80px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  z-index: 10000;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease, transform 0.3s ease;
}

.tip-notification.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
  pointer-events: auto;
}

.tip-notification-content {
  background: linear-gradient(180deg, var(--panel-top), var(--panel-bot));
  backdrop-filter: blur(16px);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 12px 16px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, .4);
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 280px;
  max-width: 400px;
}

.tip-notification-text {
  flex: 1;
  font-size: 13px;
  color: var(--text);
  line-height: 1.4;
}

.tip-notification-close {
  width: 20px;
  height: 20px;
  border: none;
  background: transparent;
  color: var(--text-dim);
  font-size: 16px;
  cursor: pointer;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  flex-shrink: 0;
}

.tip-notification-close:hover {
  background: rgba(255, 255, 255, .05);
  color: var(--text);
}

html.light .tip-notification-content {
  background: linear-gradient(180deg, rgba(250, 250, 250, .98), rgba(250, 250, 250, .95));
  box-shadow: 0 4px 16px rgba(0, 0, 0, .15);
}

html.light .tip-highlight {
  outline-color: var(--dx-emerald);
}

html.light .tip-notification-close:hover {
  background: rgba(0, 0, 0, .05);
}

/* Mobile: Adjust tip notification position */
@media (max-width: 768px) {
  .tip-notification {
    bottom: 100px;
    left: 16px;
    right: 16px;
    transform: translateY(20px);
  }

  .tip-notification.show {
    transform: translateY(0);
  }

  .tip-notification-content {
    min-width: auto;
    width: 100%;
  }
}

/* ================= Onboarding Tour ================= */
.onboarding-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  pointer-events: auto;
}

.onboarding-highlight {
  position: absolute;
  background: rgba(16, 185, 129, 0.2);
  border: 3px solid var(--dx-emerald);
  box-shadow:
    0 0 0 9999px rgba(0, 0, 0, 0.7),
    0 0 24px rgba(16, 185, 129, 0.5),
    inset 0 0 24px rgba(16, 185, 129, 0.3);
  pointer-events: none;
  z-index: 1;
  animation: onboardingPulse 2s ease-in-out infinite;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes onboardingPulse {

  0%,
  100% {
    box-shadow:
      0 0 0 9999px rgba(0, 0, 0, 0.7),
      0 0 24px rgba(16, 185, 129, 0.5),
      inset 0 0 24px rgba(16, 185, 129, 0.3);
    border-color: var(--dx-emerald);
  }

  50% {
    box-shadow:
      0 0 0 9999px rgba(0, 0, 0, 0.7),
      0 0 32px rgba(31, 221, 253, 0.6),
      inset 0 0 32px rgba(31, 221, 253, 0.4);
    border-color: var(--dx-cyan);
  }
}

.onboarding-tooltip {
  position: fixed;
  z-index: 10000;
  pointer-events: auto;
  animation: onboardingTooltipFadeIn 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes onboardingTooltipFadeIn {
  from {
    opacity: 0;
    transform: scale(0.95) translateY(10px);
  }

  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

.onboarding-tooltip-content {
  background: linear-gradient(180deg, var(--panel-top), var(--panel-bot));
  backdrop-filter: blur(16px);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 20px 24px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, .5);
  min-width: 320px;
  max-width: 400px;
}

.onboarding-tooltip-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.onboarding-tooltip-title {
  margin: 0;
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.01em;
  flex: 1;
}

.onboarding-tooltip-step {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-dim);
  background: rgba(16, 185, 129, 0.1);
  padding: 4px 10px;
  border-radius: 12px;
  margin-left: 12px;
}

.onboarding-tooltip-text {
  margin: 0 0 20px 0;
  font-size: 14px;
  line-height: 1.6;
  color: var(--text-dim);
}

.onboarding-tooltip-actions {
  display: flex;
  gap: 12px;
  justify-content: center;
  /* Center the buttons */
  align-items: center;
}

.onboarding-tooltip-actions .btn {
  min-width: 80px;
}

.onboarding-tooltip-arrow {
  position: absolute;
  width: 0;
  height: 0;
  pointer-events: none;
}

.onboarding-tooltip-arrow.arrow-top {
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%);
  border-left: 8px solid transparent;
  border-right: 8px solid transparent;
  border-bottom: 8px solid var(--line);
  margin-bottom: -1px;
}

.onboarding-tooltip-arrow.arrow-top::after {
  content: '';
  position: absolute;
  bottom: 1px;
  left: 50%;
  transform: translateX(-50%);
  border-left: 7px solid transparent;
  border-right: 7px solid transparent;
  border-bottom: 7px solid var(--panel-bot);
}

.onboarding-tooltip-arrow.arrow-bottom {
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  border-left: 8px solid transparent;
  border-right: 8px solid transparent;
  border-top: 8px solid var(--line);
  margin-top: -1px;
}

.onboarding-tooltip-arrow.arrow-bottom::after {
  content: '';
  position: absolute;
  top: 1px;
  left: 50%;
  transform: translateX(-50%);
  border-left: 7px solid transparent;
  border-right: 7px solid transparent;
  border-top: 7px solid var(--panel-bot);
}

.onboarding-tooltip-arrow.arrow-left {
  right: 100%;
  top: 50%;
  transform: translateY(-50%);
  border-top: 8px solid transparent;
  border-bottom: 8px solid transparent;
  border-right: 8px solid var(--line);
  margin-right: -1px;
}

.onboarding-tooltip-arrow.arrow-left::after {
  content: '';
  position: absolute;
  right: 1px;
  top: 50%;
  transform: translateY(-50%);
  border-top: 7px solid transparent;
  border-bottom: 7px solid transparent;
  border-right: 7px solid var(--panel-bot);
}

.onboarding-tooltip-arrow.arrow-right {
  left: 100%;
  top: 50%;
  transform: translateY(-50%);
  border-top: 8px solid transparent;
  border-bottom: 8px solid transparent;
  border-left: 8px solid var(--line);
  margin-left: -1px;
}

.onboarding-tooltip-arrow.arrow-right::after {
  content: '';
  position: absolute;
  left: 1px;
  top: 50%;
  transform: translateY(-50%);
  border-top: 7px solid transparent;
  border-bottom: 7px solid transparent;
  border-left: 7px solid var(--panel-bot);
}

html.light .onboarding-highlight {
  background: rgba(16, 185, 129, 0.15);
  box-shadow:
    0 0 0 9999px rgba(0, 0, 0, 0.5),
    0 0 24px rgba(16, 185, 129, 0.4),
    inset 0 0 24px rgba(16, 185, 129, 0.2);
}

html.light .onboarding-tooltip-content {
  background: linear-gradient(180deg, rgba(250, 250, 250, .98), rgba(250, 250, 250, .95));
  box-shadow: 0 8px 32px rgba(0, 0, 0, .2);
}

html.light .onboarding-tooltip-arrow.arrow-top {
  border-bottom-color: rgba(0, 0, 0, .12);
}

html.light .onboarding-tooltip-arrow.arrow-top::after {
  border-bottom-color: rgba(250, 250, 250, .95);
}

html.light .onboarding-tooltip-arrow.arrow-bottom {
  border-top-color: rgba(0, 0, 0, .12);
}

html.light .onboarding-tooltip-arrow.arrow-bottom::after {
  border-top-color: rgba(250, 250, 250, .95);
}

html.light .onboarding-tooltip-arrow.arrow-left {
  border-right-color: rgba(0, 0, 0, .12);
}

html.light .onboarding-tooltip-arrow.arrow-left::after {
  border-right-color: rgba(250, 250, 250, .95);
}

html.light .onboarding-tooltip-arrow.arrow-right {
  border-left-color: rgba(0, 0, 0, .12);
}

html.light .onboarding-tooltip-arrow.arrow-right::after {
  border-left-color: rgba(250, 250, 250, .95);
}

/* Mobile: Hide desktop onboarding, show mobile version */
@media (max-width: 768px) {

  /* Hide desktop onboarding overlay */
  .onboarding-overlay {
    display: none !important;
  }

  /* Mobile onboarding modal styles */
  .mobile-onboarding-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 10000;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(8px);
    align-items: center;
    justify-content: center;
    padding: 20px;
  }

  .mobile-onboarding-modal.active {
    display: flex;
  }

  .mobile-onboarding-content {
    background: linear-gradient(180deg, var(--panel-top), var(--panel-bot));
    border: 1px solid var(--line);
    border-radius: 16px;
    padding: 24px;
    max-width: 400px;
    width: 100%;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
  }

  .mobile-onboarding-title {
    font-size: 20px;
    font-weight: 700;
    margin: 0 0 16px 0;
    color: var(--text);
    text-align: center;
  }

  .mobile-onboarding-text {
    font-size: 14px;
    line-height: 1.6;
    color: var(--text-dim);
    margin: 0 0 20px 0;
  }

  .mobile-onboarding-actions {
    display: flex;
    gap: 12px;
    justify-content: center;
  }

  .mobile-onboarding-actions .btn {
    min-width: 100px;
  }
}

/* Wallet Install Modal (Mobile) */
.wallet-install-modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 10002;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.wallet-install-modal.active {
  display: flex;
  opacity: 1;
}

.wallet-install-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.85);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.wallet-install-content {
  position: relative;
  background: linear-gradient(180deg, var(--panel-top), var(--panel-bot));
  border: 1px solid var(--line);
  border-radius: 16px;
  max-width: 400px;
  width: 100%;
  max-height: 80vh;
  overflow: hidden;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
  transform: scale(0.95);
  transition: transform 0.3s ease;
}

.wallet-install-modal.active .wallet-install-content {
  transform: scale(1);
}

.wallet-install-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px;
  border-bottom: 1px solid var(--line);
}

.wallet-install-header h3 {
  margin: 0;
  font-size: 20px;
  font-weight: 700;
  color: var(--text);
}

.wallet-install-close {
  width: 32px;
  height: 32px;
  border: none;
  background: transparent;
  color: var(--text-dim);
  font-size: 20px;
  cursor: pointer;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

.wallet-install-close:hover {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text);
}

.wallet-install-body {
  padding: 24px;
  max-height: calc(80vh - 80px);
  overflow-y: auto;
}

.wallet-install-body p {
  margin: 0 0 20px 0;
  font-size: 14px;
  line-height: 1.6;
  color: var(--text-dim);
}

.wallet-install-options {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 20px;
}

.wallet-install-option {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--line);
  border-radius: 12px;
  text-decoration: none;
  color: var(--text);
  transition: all 0.2s ease;
}

.wallet-install-option:hover {
  background: rgba(255, 255, 255, 0.06);
  border-color: var(--dx-emerald);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.2);
}

.wallet-install-name {
  font-weight: 600;
  font-size: 16px;
}

.wallet-install-arrow {
  color: var(--dx-emerald);
  font-size: 18px;
  font-weight: 700;
}

.wallet-install-hint {
  font-size: 12px;
  color: var(--text-dim);
  text-align: center;
  margin: 0;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

/* Light mode wallet install modal */
html.light .wallet-install-content {
  background: #ffffff;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.25);
}

html.light .wallet-install-option {
  background: rgba(0, 0, 0, 0.02);
  border-color: rgba(0, 0, 0, 0.08);
}

html.light .wallet-install-option:hover {
  background: rgba(0, 0, 0, 0.04);
  border-color: var(--dx-emerald);
}

html.light .wallet-install-close:hover {
  background: rgba(0, 0, 0, 0.08);
}

/* Mobile responsive wallet install modal */
@media (max-width: 640px) {
  .wallet-install-modal {
    padding: 20px 20px 80px 20px;
    /* Extra bottom padding to avoid browser nav */
    align-items: flex-start;
    /* Align to top instead of center */
    overflow-y: auto;
  }

  .wallet-install-content {
    max-width: 100%;
    margin: 0;
    max-height: calc(100vh - 100px);
    /* Leave space for browser nav */
  }
}

/* Mobile nav hover/active states */
.mobile-nav-item:hover {
  filter: brightness(1.15);
  transform: translateY(-2px) scale(1.05);
  box-shadow: 0 4px 12px rgba(0, 0, 0, .3), 0 0 0 1px rgba(16, 185, 129, .2);
  border-color: rgba(16, 185, 129, .3);
}

.mobile-nav-item:hover::before {
  opacity: 1;
}

.mobile-nav-item.active {
  background: linear-gradient(135deg, rgba(16, 185, 129, .2) 0%, rgba(31, 221, 253, .15) 100%);
  border-color: rgba(16, 185, 129, .4);
  box-shadow:
    0 4px 16px rgba(16, 185, 129, .25),
    0 0 0 1px rgba(16, 185, 129, .2),
    inset 0 1px 0 rgba(255, 255, 255, .1);
  transform: scale(1.05);
}

.mobile-nav-item.active::before {
  opacity: 1;
}

.mobile-nav-item:active {
  transform: scale(0.92);
  transition: transform 0.1s cubic-bezier(0.4, 0, 0.2, 1);
}

.mobile-nav-home:hover {
  transform: scale(1.08);
  box-shadow: 0 6px 20px rgba(0, 0, 0, .4);
}

.mobile-nav-home:active {
  transform: scale(0.92);
  transition: transform 0.1s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Active state for home button */
.mobile-nav-home.active {
  background: linear-gradient(180deg, var(--panel-top), var(--panel-bot));
  box-shadow: 0 4px 12px rgba(0, 0, 0, .2);
}

/* Light mode compatibility */
html.light .mobile-nav {
  background: linear-gradient(180deg, rgba(248, 249, 250, .98) 0%, rgba(255, 255, 255, 1) 100%);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border-top: 1px solid rgba(0, 0, 0, .12);
  border-left: none;
  border-right: none;
  border-bottom: none;
  box-shadow:
    0 -4px 24px rgba(0, 0, 0, .15),
    inset 0 1px 0 rgba(255, 255, 255, .8);
}

html.light .mobile-nav-trade {
  background: linear-gradient(180deg, rgba(16, 185, 129, .08), rgba(16, 185, 129, .04));
  border-color: rgba(16, 185, 129, .2);
}

html.light .mobile-nav-dashboard {
  background: linear-gradient(180deg, rgba(244, 183, 62, .12), rgba(244, 183, 62, .06));
  border-color: rgba(244, 183, 62, .25);
}

html.light .mobile-nav-home {
  box-shadow: 0 4px 12px rgba(0, 0, 0, .1);
}

/* Show mobile nav only on mobile */
@media (max-width: 768px) {
  .mobile-nav {
    display: flex !important;
    align-items: center;
    justify-content: center;
    gap: 4px;
    position: fixed !important;
    bottom: 0 !important;
    left: 0 !important;
    right: 0 !important;
    border-radius: 20px 20px 0 0 !important;
    padding-left: 16px;
    padding-right: 16px;
  }

  /* Mobile Nav Token Balance Pill - Standalone, Far Left - Always Visible */
  .mobile-nav-token-balance {
    display: flex !important;
    /* Always visible, shows 0.00 when not connected */
    align-items: center;
    gap: 4px;
    padding: 5px 9px;
    border-radius: 18px;
    border: 1px solid var(--dx-gold);
    background: rgba(244, 183, 62, 0.1);
    color: var(--dx-gold);
    font-size: 10px;
    font-weight: 600;
    white-space: nowrap;
    flex-shrink: 0;
    height: 32px;
    position: absolute;
    left: 8px;
    min-width: fit-content;
  }

  .mobile-nav-token-balance .token-balance-value {
    font-family: 'Courier New', monospace;
    font-weight: 700;
    font-size: 11px;
    line-height: 1;
  }

  .mobile-nav-token-balance .token-balance-logo {
    height: 0.9em;
    width: auto;
    object-fit: contain;
    flex-shrink: 0;
    opacity: 0.9;
    display: block;
  }

  html.light .mobile-nav-token-balance {
    background: rgba(244, 183, 62, 0.08);
    border-color: var(--dx-gold);
    color: #d97706;
  }

  .mobile-nav-token-balance.loading {
    opacity: 0.7;
    cursor: wait;
  }

  /* Center the main nav items (Trade, Home, Dashboard) */
  /* Help button is hidden for now */
  .mobile-nav-trade,
  .mobile-nav-home,
  .mobile-nav-dashboard {
    order: 0;
    flex-shrink: 0;
  }

  /* Remove mobile nav wallet - it's now in the top header */

  /* Theme button stays on the right - use absolute positioning */
  .mobile-nav-theme {
    order: 1;
    position: absolute;
    right: 8px;
    margin-left: 0;
  }

  /* Hide Home button in top nav on mobile */
  .nav-right .btn-primary[href*="diamondx.exchange"] {
    display: none;
  }

  /* Hide theme button in top nav on mobile */
  .nav-right #themeBtn {
    display: none;
  }

  /* Add bottom padding to body to prevent content from being hidden behind nav */
  body {
    padding-bottom: calc(76px + env(safe-area-inset-bottom));
  }
}

/* --- MOBILE FIXES: remove hard mins, make hero/grid/nav shrink correctly --- */

/* Let capped areas actually shrink on small screens */
.container {
  width: min(99vw, 1320px);
}


/* Grid stage can also shrink; no 1200px min on phones */
.grid-stage {
  width: min(99vw, 2000px);
  /* was clamp(1200px, 99vw, 2000px) */
  padding: 8px 8px 28px;
  /* keep a tiny gutter */
}

/* Prevent any stray horizontal scrollbars */
html,
body {
  overflow-x: hidden;
}

/* HERO: stack on mobile, reduce image zoom */
@media (max-width: 720px) {
  .hero {
    grid-template-columns: 1fr;
    /* stack feature over picks */
    gap: 12px;
    margin: 16px 0;
  }

  .hero .feature .media {
    aspect-ratio: 16 / 9;
    /* standard on phones */
  }

  .hero .feature .media img {
    width: 100%;
    /* remove extra zoom that caused cropping */
    height: 100%;
    object-fit: cover;
    object-position: center;
  }

  .hero .picks {
    gap: 10px;
  }
}

/* NAV: keep search centered but allow it to shrink */
@media (max-width: 980px) {
  .nav-inner {
    width: calc(100vw - 32px);
    /* maintain grid alignment */
    grid-template-columns: 1fr auto;
    /* logo left, buttons right */
    gap: 12px;
    padding-inline: 16px;
    /* keep same gutter as grid-stage */
  }

  .search-container {
    max-width: 100%;
  }

  .search-wrap .input#search {
    max-width: 100%;
  }

  .catbar {
    width: 100%;
    /* Full width of catbar-wrap */
    padding: 0 16px;
    /* keep same gutter as grid-stage */
  }

  .rail .rail-wrapper {
    width: 100% !important;
    /* Full width on mobile */
    max-width: 100% !important;
    margin: 0 !important;
  }

  .rail .rail-head {
    padding: 0 16px;
  }

  .rail .row {
    padding: 0 16px;
    /* padding on left for content */
  }
}

@media (max-width: 640px) {
  .brand-logo {
    height: 28px;
  }

  /* slightly smaller on mobile */
  .nav-inner {
    width: calc(100vw - 32px);
    /* maintain grid alignment */
    padding-inline: 16px;
    /* keep same gutter */
  }

  .catbar {
    width: 100%;
    /* Full width of catbar-wrap */
    padding: 0 16px;
    /* keep same gutter */
  }
}


@media (max-width: 720px) {
  .grid {
    grid-template-columns: 1fr;
  }
}

/* ---- FULL-BLEED GRID STAGE (independent of the capped hero/nav) ---- */
.grid-stage {
  /* full-bleed trick: stretch section to viewport edges with a small gutter */
  --gutter: 16px;
  /* tweak to taste */
  --sidebar-width: 90px;
  /* sidebar width when expanded */
  position: relative;
  left: 50%;
  right: 50%;
  margin-left: calc(-50vw + var(--gutter) + var(--sidebar-width) + 8px);
  margin-right: calc(-50vw + var(--gutter));

  width: calc(100vw - var(--gutter) * 2 - var(--sidebar-width) - 16px);
  /* true viewport width minus gutters, sidebar, and spacing */
  max-width: none;
  /* do NOT cap */
  padding: 8px var(--gutter) 28px;
}

.sidebar.collapsed~.grid-stage {
  --sidebar-width: 60px;
  margin-left: calc(-50vw + var(--gutter) + var(--sidebar-width) + 8px);
  width: calc(100vw - var(--gutter) * 2 - var(--sidebar-width) - 16px);
}

/* Keep your responsive columns; this makes cards get LARGER instead of adding more */
@media (min-width: 720px) {
  .grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
  }
}

@media (min-width: 1040px) {
  .grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
  }
}

@media (min-width: 1320px) {
  .grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
  }
}

/* Tablet-specific constraints to prevent overflow */
@media (max-width: 1024px) and (min-width: 769px) {
  .grid {
    grid-template-columns: repeat(auto-fill, minmax(min(280px, calc((100vw - 60px - 64px) / 2)), 1fr));
    gap: 16px;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
  }

  .card {
    min-width: 0;
    width: 100%;
    max-width: 100%;
  }

  .card .thumb-wrap {
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
  }

  .card .thumb-wrap img {
    width: 100%;
    max-width: 100%;
    height: auto;
    box-sizing: border-box;
  }
}

/* Safety: no horizontal scrollbars from rounding */
html,
body {
  overflow-x: hidden;
}

/* Bookmark Toast Notification */
.bookmark-toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  background: linear-gradient(180deg, var(--panel-top), var(--panel-bot));
  backdrop-filter: blur(12px);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px 20px;
  color: var(--text);
  font-size: 14px;
  font-weight: 600;
  box-shadow: 0 8px 24px rgba(0, 0, 0, .3);
  z-index: 1000;
  opacity: 0;
  transition: opacity 0.3s ease, transform 0.3s ease;
  pointer-events: none;
  white-space: nowrap;
}

.bookmark-toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

html.light .bookmark-toast {
  background: rgba(255, 255, 255, .95);
  box-shadow: 0 8px 24px rgba(0, 0, 0, .15);
}

@media (max-width: 768px) {
  .bookmark-toast {
    bottom: 100px;
    /* Above mobile nav */
    font-size: 13px;
    padding: 10px 16px;
  }
}

/* General Toast Notification System */
.wallet-toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  background: linear-gradient(180deg, var(--panel-top), var(--panel-bot));
  backdrop-filter: blur(16px) saturate(180%);
  border: 1.5px solid var(--line);
  border-radius: 14px;
  padding: 14px 20px;
  color: var(--text);
  font-size: 14px;
  font-weight: 500;
  box-shadow:
    0 8px 24px rgba(0, 0, 0, .4),
    0 0 0 1px rgba(255, 255, 255, .05);
  z-index: 10001;
  opacity: 0;
  transition: opacity 0.3s cubic-bezier(0.4, 0, 0.2, 1), transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  pointer-events: none;
  display: flex;
  align-items: center;
  gap: 10px;
  max-width: 90%;
  min-width: 280px;
}

.wallet-toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.wallet-toast.error {
  border-color: rgba(239, 68, 68, .4);
  background: linear-gradient(180deg, rgba(239, 68, 68, .1) 0%, rgba(220, 38, 38, .05) 100%);
  color: #fca5a5;
}

.wallet-toast.error::before {
  content: '⚠️';
  font-size: 18px;
}

.wallet-toast.success {
  border-color: rgba(16, 185, 129, .4);
  background: linear-gradient(180deg, rgba(16, 185, 129, .1) 0%, rgba(5, 150, 105, .05) 100%);
  color: #6ee7b7;
}

.wallet-toast.success::before {
  content: '✅';
  font-size: 18px;
}

.wallet-toast.info {
  border-color: rgba(59, 130, 246, .4);
  background: linear-gradient(180deg, rgba(59, 130, 246, .1) 0%, rgba(37, 99, 235, .05) 100%);
  color: #93c5fd;
}

.wallet-toast.info::before {
  content: 'ℹ️';
  font-size: 18px;
}

.wallet-toast.warning {
  border-color: rgba(244, 183, 62, .4);
  background: linear-gradient(180deg, rgba(244, 183, 62, .1) 0%, rgba(217, 119, 6, .05) 100%);
  color: #fcd34d;
}

.wallet-toast.warning::before {
  content: '⚠️';
  font-size: 18px;
}

html.light .wallet-toast {
  background: rgba(255, 255, 255, .98);
  box-shadow:
    0 8px 24px rgba(0, 0, 0, .15),
    0 0 0 1px rgba(0, 0, 0, .05);
}

html.light .wallet-toast.error {
  border-color: rgba(239, 68, 68, .3);
  background: rgba(254, 242, 242, .95);
  color: #dc2626;
}

html.light .wallet-toast.success {
  border-color: rgba(16, 185, 129, .3);
  background: rgba(236, 253, 245, .95);
  color: #059669;
}

html.light .wallet-toast.info {
  border-color: rgba(59, 130, 246, .3);
  background: rgba(239, 246, 255, .95);
  color: #2563eb;
}

html.light .wallet-toast.warning {
  border-color: rgba(244, 183, 62, .3);
  background: rgba(255, 251, 235, .95);
  color: #d97706;
}

@media (max-width: 768px) {
  .wallet-toast {
    bottom: 100px;
    font-size: 13px;
    padding: 12px 18px;
    min-width: 260px;
    max-width: calc(100% - 32px);
  }
}

/* Transaction Toast Notifications - Stackable, Bottom-Right */
#wallet-transaction-toasts {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 10002;
  pointer-events: none;
  display: flex;
  flex-direction: column-reverse;
  gap: 8px;
  align-items: flex-end;
}

.wallet-transaction-toast {
  position: relative;
  background: linear-gradient(180deg, rgba(26, 29, 41, .95) 0%, rgba(21, 24, 33, .98) 100%);
  backdrop-filter: blur(16px) saturate(180%);
  border: 1.5px solid var(--line);
  border-radius: 14px;
  padding: 16px 20px;
  color: var(--text);
  font-size: 14px;
  font-weight: 500;
  box-shadow:
    0 8px 24px rgba(0, 0, 0, .6),
    0 0 0 1px rgba(255, 255, 255, .08);
  opacity: 0;
  transform: translateX(400px) scale(0.95);
  transition: opacity 0.3s cubic-bezier(0.4, 0, 0.2, 1), transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  pointer-events: auto;
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 280px;
  max-width: 360px;
  cursor: pointer;
}

.wallet-transaction-toast.show {
  opacity: 1;
  transform: translateX(0) scale(1);
}

.wallet-transaction-toast.added {
  border-color: rgba(16, 185, 129, .5);
  background: linear-gradient(135deg, rgba(26, 29, 41, .98) 0%, rgba(21, 24, 33, .98) 100%),
    linear-gradient(135deg, rgba(16, 185, 129, .2) 0%, rgba(5, 150, 105, .12) 100%);
  background-blend-mode: normal, overlay;
  color: #6ee7b7;
}

.wallet-transaction-toast.added::before {
  content: '+';
  font-size: 20px;
  font-weight: 700;
  color: #10b981;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: rgba(16, 185, 129, .2);
  flex-shrink: 0;
}

.wallet-transaction-toast.removed {
  border-color: rgba(59, 130, 246, .5);
  background: linear-gradient(135deg, rgba(26, 29, 41, .98) 0%, rgba(21, 24, 33, .98) 100%),
    linear-gradient(135deg, rgba(59, 130, 246, .2) 0%, rgba(37, 99, 235, .12) 100%);
  background-blend-mode: normal, overlay;
  color: #93c5fd;
}

.wallet-transaction-toast.removed::before {
  content: '−';
  font-size: 20px;
  font-weight: 700;
  color: #3b82f6;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: rgba(59, 130, 246, .2);
  flex-shrink: 0;
}

.wallet-transaction-toast-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.wallet-transaction-toast-title {
  font-weight: 600;
  font-size: 14px;
  line-height: 1.3;
}

.wallet-transaction-toast-amount {
  font-weight: 700;
  font-size: 16px;
  font-family: 'Courier New', monospace;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.02em;
}

.wallet-transaction-toast:hover {
  transform: translateX(-4px) scale(1.02);
  box-shadow:
    0 12px 32px rgba(0, 0, 0, .5),
    0 0 0 1px rgba(255, 255, 255, .1);
}

html.light .wallet-transaction-toast {
  background: rgba(255, 255, 255, .98);
  box-shadow:
    0 8px 24px rgba(0, 0, 0, .15),
    0 0 0 1px rgba(0, 0, 0, .05);
}

html.light .wallet-transaction-toast.added {
  border-color: rgba(16, 185, 129, .4);
  background: rgba(236, 253, 245, .95);
  color: #059669;
}

html.light .wallet-transaction-toast.added::before {
  color: #059669;
  background: rgba(16, 185, 129, .15);
}

html.light .wallet-transaction-toast.removed {
  border-color: rgba(59, 130, 246, .4);
  background: rgba(239, 246, 255, .95);
  color: #2563eb;
}

html.light .wallet-transaction-toast.removed::before {
  color: #2563eb;
  background: rgba(59, 130, 246, .15);
}

@media (max-width: 768px) {
  #wallet-transaction-toasts {
    bottom: 100px;
    right: 16px;
    left: 16px;
    align-items: stretch;
  }

  .wallet-transaction-toast {
    max-width: none;
    min-width: auto;
    transform: translateY(100px) scale(0.95);
    /* Darker background on mobile for better visibility */
    background: linear-gradient(180deg, rgba(15, 18, 26, .98) 0%, rgba(10, 13, 20, .99) 100%);
    box-shadow:
      0 8px 24px rgba(0, 0, 0, .7),
      0 0 0 1px rgba(255, 255, 255, .1);
  }

  .wallet-transaction-toast.added {
    background: linear-gradient(180deg, rgba(15, 18, 26, .98) 0%, rgba(10, 13, 20, .99) 100%),
      linear-gradient(135deg, rgba(16, 185, 129, .25) 0%, rgba(5, 150, 105, .15) 100%);
    background-blend-mode: normal, overlay;
  }

  .wallet-transaction-toast.removed {
    background: linear-gradient(180deg, rgba(15, 18, 26, .98) 0%, rgba(10, 13, 20, .99) 100%),
      linear-gradient(135deg, rgba(59, 130, 246, .25) 0%, rgba(37, 99, 235, .15) 100%);
    background-blend-mode: normal, overlay;
  }

  .wallet-transaction-toast.show {
    transform: translateY(0) scale(1);
  }

  .wallet-transaction-toast:hover {
    transform: translateY(-2px) scale(1.01);
  }
}

/* Continue Watching headline */
.rail-title {
  margin: 0;
  font-size: 20px;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--text);
}

.rail-title-btn {
  background: none;
  border: none;
  color: inherit;
  font: inherit;
  cursor: pointer;
  padding: 4px 0;
  text-align: left;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  border-radius: 6px;
  position: relative;
}

.rail-title-btn::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, rgba(16, 185, 129, .1), transparent);
  opacity: 0;
  transition: opacity 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  border-radius: 6px;
}

.rail-title-btn:hover {
  color: var(--dx-emerald);
  transform: translateX(4px);
}

.rail-title-btn:hover::before {
  opacity: 1;
}

.rail-title-btn:active {
  transform: translateX(2px);
}

.rail-sub {
  margin: 2px 0 0;
  font-size: 12px;
  color: var(--text-dim);
}

.rail-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 8px 0 12px;
  gap: 12px;
}

.rail-titles {
  display: flex;
  flex-direction: column;
}

/* ================= Error States with Recovery Actions ================= */
.error-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 48px 24px;
  min-height: 300px;
}

.error-state-icon {
  width: 64px;
  height: 64px;
  margin: 0 auto 24px;
  color: var(--text-dim);
  opacity: 0.7;
}

.error-state-icon svg {
  width: 100%;
  height: 100%;
}

.error-state h3 {
  font-size: 20px;
  font-weight: 700;
  margin: 0 0 12px 0;
  color: var(--text);
}

.error-state p {
  font-size: 14px;
  line-height: 1.6;
  color: var(--text-dim);
  margin: 0 0 24px 0;
  max-width: 500px;
}

.error-state-actions {
  display: flex;
  flex-direction: column;
  gap: 12px;
  align-items: center;
  width: 100%;
  max-width: 400px;
}

.error-state-actions .btn {
  width: 100%;
  justify-content: center;
}

.error-state-actions.horizontal {
  flex-direction: row;
  flex-wrap: wrap;
}

.error-state-actions.horizontal .btn {
  flex: 1;
  min-width: 120px;
}

.error-state-details {
  margin-top: 16px;
  padding: 12px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  font-size: 12px;
  color: var(--text-dim);
  font-family: 'Courier New', monospace;
  max-width: 100%;
  overflow-x: auto;
  text-align: left;
  display: none;
}

.error-state-details.show {
  display: block;
}

.error-state-toggle-details {
  margin-top: 12px;
  font-size: 12px;
  color: var(--text-dim);
  background: none;
  border: none;
  cursor: pointer;
  text-decoration: underline;
  padding: 4px 8px;
}

.error-state-toggle-details:hover {
  color: var(--text);
}

/* Enhanced player error */
.player-error .error-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}

.player-error .error-state-actions {
  margin-top: 8px;
}

/* Network error state */
.network-error {
  padding: 24px;
  background: linear-gradient(180deg, var(--panel-top), var(--panel-bot));
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  margin: 24px auto;
  max-width: 600px;
}

/* Loading error state */
.loading-error {
  padding: 32px;
  text-align: center;
}

@media (max-width: 768px) {
  .error-state {
    padding: 32px 16px;
    min-height: 250px;
  }

  .error-state-icon {
    width: 48px;
    height: 48px;
    margin-bottom: 16px;
  }

  .error-state h3 {
    font-size: 18px;
  }

  .error-state p {
    font-size: 13px;
  }

  .error-state-actions.horizontal {
    flex-direction: column;
  }

  .error-state-actions.horizontal .btn {
    width: 100%;
  }

  /* ===== Mobile Touch Targets (Minimum 44x44px) ===== */
  /* Ensure all interactive elements meet accessibility standards */
  button,
  .btn-primary,
  .btn-secondary,
  a.button,
  .wallet-pill,
  .wallet-pill-btn {
    min-height: 44px;
    min-width: 44px;
    padding: 12px 20px;
  }

  /* Wallet pill specific */
  .wallet-pill {
    min-height: 44px;
    padding: 10px 16px;
  }

  /* Video cards - ensure entire card is tappable */
  .video-card {
    min-height: 44px;
  }

  /* Sidebar items */
  .nav-item,
  .sidebar-item {
    min-height: 44px;
    padding: 12px 16px;
  }

  /* Close buttons */
  .close-btn,
  .modal-close,
  .wallet-modal-close {
    min-width: 44px;
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
  }

  /* Form inputs - prevent zoom on iOS */
  input[type="text"],
  input[type="email"],
  input[type="password"],
  input[type="number"],
  textarea,
  select {
    min-height: 44px;
    font-size: 16px;
    /* Prevents zoom on iOS when focused */
  }

  /* Toggle buttons */
  .toggle-btn {
    min-width: 44px;
    min-height: 44px;
  }
}
