/* ==========================================================================
   RAILBAN SUITE EXTENSIONS: SOUNDBOARD, EQUALIZER DSP, CARD STUDIO, COIN FLICK
   ========================================================================== */

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

/* Touch targets optimization for Lighthouse 100% compliance */
.footer-links {
  display: flex !important;
  flex-wrap: wrap !important;
  justify-content: center !important;
  align-items: center !important;
  gap: 16px 24px !important;
  margin: 0 auto !important;
}

.footer-links a {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  min-height: 48px !important;
  min-width: 48px !important;
  padding: 12px 20px !important;
  margin: 6px !important;
  touch-action: manipulation !important;
}

.footer-easter-egg {
  min-height: 48px !important;
  min-width: 48px !important;
  padding: 10px 18px !important;
  margin: 6px !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 8px !important;
  touch-action: manipulation !important;
}

/* ----------------------------------------------------
   1. SOUNDBOARD STYLES
   ---------------------------------------------------- */
.soundboard-header-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin-bottom: 24px;
}

.soundboard-controls-wrap {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 14px;
}

.sb-server-select {
  background: rgba(15, 23, 42, 0.75);
  border: 1px solid rgba(0, 242, 254, 0.25);
  color: #fff;
  padding: 8px 16px;
  border-radius: 30px;
  font-size: 0.88rem;
  font-weight: 600;
  outline: none;
  cursor: pointer;
  backdrop-filter: blur(8px);
}

.sb-server-select:focus {
  border-color: var(--primary, #00f2fe);
  box-shadow: 0 0 15px rgba(0, 242, 254, 0.3);
}

.sb-search-wrap {
  position: relative;
  min-width: 240px;
}

.sb-search-wrap input {
  width: 100%;
  background: rgba(15, 23, 42, 0.75);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: #fff;
  padding: 8px 16px 8px 36px;
  border-radius: 30px;
  font-size: 0.88rem;
  outline: none;
  transition: all 0.2s ease;
}

.sb-search-wrap input:focus {
  border-color: var(--primary, #00f2fe);
  box-shadow: 0 0 15px rgba(0, 242, 254, 0.25);
}

.sb-search-wrap i {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: 0.85rem;
}

.sb-filter-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 24px;
}

.sb-filter-chip {
  padding: 6px 16px;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--text-muted);
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.sb-filter-chip:hover,
.sb-filter-chip.active {
  background: rgba(0, 242, 254, 0.15);
  border-color: var(--primary, #00f2fe);
  color: #fff;
  box-shadow: 0 0 12px rgba(0, 242, 254, 0.2);
}

.soundboard-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 16px;
  margin-bottom: 40px;
}

.sound-pad {
  padding: 18px;
  border-radius: 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  position: relative;
  transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1), border-color 0.2s ease, box-shadow 0.2s ease;
}

.sound-pad:hover {
  transform: translateY(-3px);
  border-color: var(--accent-pad, var(--primary));
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35), 0 0 18px var(--accent-pad, rgba(0, 242, 254, 0.2));
}

.sound-pad.playing {
  animation: padPulse 0.35s ease-out;
}

@keyframes padPulse {
  0% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.055); opacity: 0.92; }
  100% { transform: scale(1); opacity: 1; }
}

.sound-pad-badge {
  position: absolute;
  top: 10px;
  right: 10px;
  font-size: 0.65rem;
  font-weight: 800;
  padding: 2px 7px;
  border-radius: 10px;
  letter-spacing: 0.5px;
}

.sound-pad-icon {
  width: 58px;
  height: 58px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  margin-bottom: 12px;
  cursor: pointer;
  transition: transform 0.2s ease, background 0.2s ease;
}

.sound-pad:hover .sound-pad-icon {
  transform: scale(1.1);
  background: rgba(255, 255, 255, 0.1);
}

.sound-pad-title {
  font-size: 0.95rem;
  font-weight: 700;
  color: #fff;
  margin-bottom: 14px;
}

.sound-pad-actions {
  display: flex;
  gap: 8px;
  width: 100%;
}

.sound-pad-actions .btn {
  flex: 1;
  padding: 6px 10px;
  font-size: 0.78rem;
  border-radius: 20px;
  justify-content: center;
}

/* ----------------------------------------------------
   2. 10-BAND EQUALIZER & DSP STYLES
   ---------------------------------------------------- */
.equalizer-modal-wrap {
  position: fixed;
  inset: 0;
  background: rgba(5, 5, 12, 0.85);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  z-index: 99999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.equalizer-card {
  width: 100%;
  max-width: 820px;
  background: var(--glass-bg-elevated, rgba(13, 18, 30, 0.74));
  border: 1px solid rgba(255, 255, 255, 0.10);
  border-radius: 24px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.16), 0 20px 50px rgba(0, 0, 0, 0.52);
  padding: 28px;
  position: relative;
  max-height: 90vh;
  overflow-y: auto;
}

.eq-curve-box {
  width: 100%;
  height: 120px;
  border-radius: 12px;
  background: rgba(5, 7, 15, 0.8);
  border: 1px solid rgba(255, 255, 255, 0.08);
  margin-bottom: 24px;
  position: relative;
  overflow: hidden;
}

.eq-curve-canvas {
  width: 100%;
  height: 100%;
  display: block;
}

.eq-sliders-container {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 8px;
  margin-bottom: 24px;
  padding: 0 8px;
}

.eq-slider-col {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  flex: 1;
}

.eq-db-badge {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--primary, #00f2fe);
  font-family: monospace;
}

.eq-track-wrapper {
  height: 160px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.eq-vertical-slider {
  -webkit-appearance: slider-vertical;
  writing-mode: bt-lr;
  width: 16px;
  height: 150px;
  cursor: pointer;
  accent-color: var(--primary, #00f2fe);
}

.eq-freq-label {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text-muted);
}

.eq-preset-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 24px;
}

.eq-preset-chip {
  padding: 6px 14px;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--text-muted);
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.eq-preset-chip:hover,
.eq-preset-chip.active {
  background: rgba(0, 242, 254, 0.15);
  border-color: var(--primary, #00f2fe);
  color: #fff;
  box-shadow: 0 0 12px rgba(0, 242, 254, 0.25);
}

.eq-actions-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  padding-top: 20px;
}

/* ----------------------------------------------------
   3. RANK CARD STUDIO STYLES (Modern, Clean & Responsive)
   ---------------------------------------------------- */
.card-designer-container,
.card-designer-layout {
  display: flex;
  flex-direction: column;
  gap: 24px;
  max-width: 1040px;
  margin: 0 auto 50px;
  background: rgba(10, 14, 26, 0.78) !important;
  border: 1px solid rgba(0, 242, 254, 0.22) !important;
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.55), 0 0 32px rgba(0, 242, 254, 0.08) !important;
  border-radius: 24px !important;
  padding: 30px !important;
}

.card-canvas-preview-wrap,
.rc-canvas-wrap {
  width: 100%;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  background: radial-gradient(circle at 50% 30%, rgba(13, 27, 62, 0.5) 0%, rgba(5, 7, 15, 0.92) 100%);
  border-radius: 20px;
  padding: 24px 20px;
  border: 1px solid rgba(0, 242, 254, 0.25);
  box-shadow: 0 14px 44px rgba(0, 0, 0, 0.6), inset 0 0 28px rgba(0, 242, 254, 0.06);
  position: relative;
}

.rank-card-canvas {
  width: 100%;
  max-width: 800px;
  height: auto;
  aspect-ratio: 800 / 250;
  border-radius: 16px;
  box-shadow: 0 14px 40px rgba(0, 0, 0, 0.75), 0 0 24px rgba(0, 242, 254, 0.22);
  display: block;
}

.card-controls-grid,
.rc-controls-grid {
  display: grid !important;
  grid-template-columns: repeat(2, 1fr) !important;
  gap: 20px !important;
  width: 100% !important;
}

@media (max-width: 860px) {
  .card-controls-grid,
  .rc-controls-grid {
    grid-template-columns: 1fr !important;
    gap: 16px !important;
  }
}

.card-control-group,
.rc-control-group {
  display: flex;
  flex-direction: column;
  gap: 12px;
  background: rgba(15, 23, 42, 0.65) !important;
  border: 1px solid rgba(255, 255, 255, 0.1) !important;
  border-radius: 18px !important;
  padding: 20px 22px !important;
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
  transition: border-color 0.25s ease, box-shadow 0.25s ease;
}

.card-control-group:hover,
.rc-control-group:hover {
  border-color: rgba(0, 242, 254, 0.35) !important;
  box-shadow: 0 8px 30px rgba(0, 242, 254, 0.08);
}

.card-ctrl-label,
.rc-control-group label {
  font-size: 0.9rem !important;
  font-weight: 700 !important;
  color: #f1f5f9 !important;
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
}

.card-ctrl-label i {
  color: var(--primary, #00f2fe);
}

.designer-select,
.card-control-group select,
.rc-control-group select {
  width: 100%;
  background: rgba(8, 12, 24, 0.85) !important;
  border: 1px solid rgba(0, 242, 254, 0.25) !important;
  color: #fff !important;
  padding: 10px 14px !important;
  border-radius: 12px !important;
  font-size: 0.88rem !important;
  font-weight: 600 !important;
  outline: none;
  cursor: pointer;
  transition: all 0.2s ease;
}

.designer-select:focus,
.card-control-group select:focus,
.rc-control-group select:focus {
  border-color: var(--primary, #00f2fe) !important;
  box-shadow: 0 0 14px rgba(0, 242, 254, 0.35) !important;
}

.designer-input,
.card-control-group input[type="text"],
.card-control-group input[type="url"],
.rc-control-group input[type="text"] {
  width: 100%;
  background: rgba(8, 12, 24, 0.85) !important;
  border: 1px solid rgba(255, 255, 255, 0.14) !important;
  color: #fff !important;
  padding: 10px 14px !important;
  border-radius: 12px !important;
  font-size: 0.88rem !important;
  font-weight: 500;
  outline: none;
  transition: all 0.2s ease;
}

.designer-input:focus,
.card-control-group input[type="text"]:focus,
.card-control-group input[type="url"]:focus,
.rc-control-group input[type="text"]:focus {
  border-color: var(--primary, #00f2fe) !important;
  box-shadow: 0 0 14px rgba(0, 242, 254, 0.35) !important;
}

.card-theme-chips {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.card-theme-chip {
  padding: 6px 14px;
  font-size: 0.8rem;
  font-weight: 700;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: var(--text-muted, #94a3b8);
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.card-theme-chip:hover {
  background: rgba(0, 242, 254, 0.12);
  border-color: rgba(0, 242, 254, 0.35);
  color: #fff;
  transform: translateY(-2px);
}

.card-theme-chip.active {
  background: linear-gradient(135deg, rgba(0, 242, 254, 0.25), rgba(168, 85, 247, 0.25));
  border-color: #00f2fe;
  color: #00f2fe;
  box-shadow: 0 0 16px rgba(0, 242, 254, 0.3);
}

.rc-input-group {
  width: 100%;
}

.rc-btn-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}

.rc-action-btn {
  padding: 8px 14px !important;
  font-size: 0.82rem !important;
  border-radius: 10px !important;
  min-height: 36px !important;
  display: inline-flex !important;
  align-items: center !important;
  gap: 6px !important;
  cursor: pointer !important;
}

.rc-btn-clear {
  border-color: rgba(239, 68, 68, 0.35) !important;
  color: #f87171 !important;
}

.rc-btn-clear:hover {
  background: rgba(239, 68, 68, 0.15) !important;
  border-color: #ef4444 !important;
}

/* Accent Color Controls */
.rc-accent-wrap {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  padding: 4px 0;
}

.rc-color-picker-label {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.7);
  box-shadow: 0 0 12px rgba(0, 242, 254, 0.4);
  cursor: pointer;
  overflow: hidden;
  transition: transform 0.2s ease, border-color 0.2s ease;
  margin: 0;
  padding: 0;
}

.rc-color-picker-label:hover {
  transform: scale(1.15);
  border-color: #fff;
}

.card-color-picker {
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  width: 50px;
  height: 50px;
  border: none;
  padding: 0;
  margin: -7px;
  cursor: pointer;
  background: transparent;
}

.card-color-picker::-webkit-color-swatch-wrapper {
  padding: 0;
}

.card-color-picker::-webkit-color-swatch {
  border: none;
  border-radius: 50%;
}

.card-color-picker::-moz-color-swatch {
  border: none;
  border-radius: 50%;
}

.rc-color-chips {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

.rc-color-chip {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.25);
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.5);
  padding: 0;
}

.rc-color-chip:hover {
  transform: scale(1.22);
  border-color: #fff;
}

.rc-color-chip.active {
  border-color: #fff;
  transform: scale(1.28);
  box-shadow: 0 0 16px currentColor;
}

.rc-hex-badge {
  font-size: 0.78rem;
  font-family: monospace;
  font-weight: 700;
  color: var(--primary, #00f2fe);
  background: rgba(0, 242, 254, 0.12);
  border: 1px solid rgba(0, 242, 254, 0.25);
  padding: 4px 10px;
  border-radius: 8px;
}

.card-action-buttons-row {
  grid-column: 1 / -1 !important;
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  padding-top: 20px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  margin-top: 8px;
}

.card-action-buttons-row .btn {
  min-height: 44px;
  padding: 10px 22px;
  font-size: 0.92rem;
  font-weight: 700;
  border-radius: 30px;
}

/* ----------------------------------------------------
   4. COIN FLICK DEFENDER STYLES
   ---------------------------------------------------- */
.coinflick-view {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.coinflick-canvas {
  width: 100%;
  max-width: 800px;
  height: auto;
  aspect-ratio: 800 / 400;
  background: #05070f;
  border: 1px solid rgba(0, 242, 254, 0.3);
  border-radius: 16px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.6), 0 0 24px rgba(0, 242, 254, 0.15);
  cursor: crosshair;
  display: block;
}

.cf-stats-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  max-width: 800px;
  margin-bottom: 12px;
  font-size: 0.95rem;
  font-weight: 800;
  color: #fff;
}

/* ----------------------------------------------------
   4.1 ARCADE MODAL & TOUCH CONTROLS ISOLATION
   ---------------------------------------------------- */
.game-modal {
  position: fixed !important;
  inset: 0 !important;
  width: 100vw !important;
  height: 100vh !important;
  background: rgba(0, 0, 0, 0.85) !important;
  backdrop-filter: blur(14px) !important;
  -webkit-backdrop-filter: blur(14px) !important;
  z-index: 99999 !important;
  display: flex !important;
  justify-content: center !important;
  align-items: center !important;
  padding: clamp(10px, 3vw, 24px) !important;
  box-sizing: border-box !important;
}

.game-modal.hidden {
  display: none !important;
}

.game-content {
  width: 100% !important;
  max-width: 860px !important;
  max-height: 92vh !important;
  overflow-y: auto !important;
  overflow-x: hidden !important;
  box-sizing: border-box !important;
  position: relative !important;
}

.arcade-view {
  display: none !important;
  width: 100% !important;
}

.arcade-view.active:not(.hidden) {
  display: block !important;
}

.arcade-view.hidden {
  display: none !important;
}

.arcade-view.hidden .mobile-game-touch-controls,
.arcade-view.hidden .qd-share-wrap {
  display: none !important;
}

/* Touch controls: Hidden by default on desktop, visible on touch/mobile devices */
.mobile-game-touch-controls {
  display: none !important;
}

@media (hover: none) and (pointer: coarse), (max-width: 900px) {
  .arcade-view:not(.hidden) .mobile-game-touch-controls {
    display: flex !important;
    align-items: center;
    justify-content: center;
    gap: 8px;
    flex-wrap: wrap;
    margin-top: 10px;
    touch-action: manipulation;
  }
}

/* ----------------------------------------------------
   RESPONSIVE DYNAMIC MARGINS & COMPACT NAVBAR
   ---------------------------------------------------- */
@media screen and (max-width: 768px) {
  #main-nav {
    height: 50px !important;
    min-height: 50px !important;
    padding: 0 clamp(8px, 2.5vw, 16px) !important;
  }
  #main-nav .nav-container {
    height: 50px !important;
    padding: 0 !important;
    gap: 6px !important;
  }
  #main-nav .nav-brand {
    gap: 6px !important;
  }
  #main-nav .nav-brand img {
    width: 28px !important;
    height: 28px !important;
  }
  #main-nav .nav-brand span,
  #main-nav .nav-brand-text {
    font-size: 0.95rem !important;
    letter-spacing: 0.5px !important;
  }
  
  /* Dynamic Fluid Page Margins */
  body, .page-content, .section-spacer, .dashboard-grid, #page-overview, #page-music, #page-soundboard, #page-designer {
    padding-left: clamp(10px, 3.5vw, 20px) !important;
    padding-right: clamp(10px, 3.5vw, 20px) !important;
    box-sizing: border-box !important;
  }
  
  .glass-card, .card {
    padding: clamp(14px, 3vw, 20px) !important;
    border-radius: clamp(12px, 2.5vw, 18px) !important;
  }

  .soundboard-grid {
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)) !important;
    gap: 12px !important;
  }

  .sound-pad {
    padding: 14px 10px !important;
  }

  .sound-pad-icon {
    width: 46px !important;
    height: 46px !important;
    font-size: 1.25rem !important;
  }

  .eq-sliders-container {
    gap: 4px !important;
    padding: 0 !important;
  }

  .eq-vertical-slider {
    width: 14px !important;
    height: 120px !important;
  }
}
