/* ==========================================================================
   INTERNODE ARCADE HUB - GAMES DIRECTORY & BROWSER
   Scalable High-Density Flex System, Dual Mode (Strip vs Flex Grid)
   ========================================================================== */

/* Browser Toolbar (Search, Filter Chips, View Toggle) */
.browser-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.5rem;
  padding: 0.85rem 1.25rem;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
}

.toolbar-search-wrap {
  position: relative;
  flex: 1;
  min-width: 240px;
  max-width: 420px;
}

.search-icon {
  position: absolute;
  left: 0.85rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  pointer-events: none;
  font-size: 0.875rem;
}

.toolbar-search-input {
  width: 100%;
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 0.5rem 2.25rem 0.5rem 2.25rem;
  color: var(--text-primary);
  font-size: 0.8125rem;
  transition: border-color var(--transition-fast);
}

.toolbar-search-input:focus {
  border-color: var(--accent-orange);
  outline: none;
}

.search-clear-btn {
  position: absolute;
  right: 0.5rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  padding: 0.2rem 0.4rem;
  font-size: 0.75rem;
  border-radius: var(--radius-sm);
  display: none;
}
.search-clear-btn.visible { display: block; }
.search-clear-btn:hover { color: var(--text-primary); }

/* Category Tags */
.filter-tags-scroll {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  overflow-x: auto;
  scrollbar-width: none;
}
.filter-tags-scroll::-webkit-scrollbar { display: none; }

.filter-chip {
  padding: 0.35rem 0.65rem;
  border-radius: var(--radius-sm);
  font-size: 0.75rem;
  font-weight: 600;
  font-family: var(--font-mono);
  color: var(--text-secondary);
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  transition: var(--transition-fast);
  white-space: nowrap;
}

.filter-chip:hover {
  background: var(--bg-surface-hover);
  color: var(--text-primary);
  border-color: var(--border-medium);
}

.filter-chip.active {
  background: var(--accent-orange-dim);
  border-color: var(--accent-orange-border);
  color: var(--accent-orange);
}

/* View Mode Toggles */
.view-mode-group {
  display: inline-flex;
  align-items: center;
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 2px;
  gap: 2px;
}

.view-btn {
  padding: 0.35rem 0.65rem;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-size: 0.8125rem;
  display: flex;
  align-items: center;
  gap: 0.3rem;
  transition: var(--transition-fast);
}

.view-btn:hover {
  color: var(--text-primary);
}

.view-btn.active {
  background: var(--bg-surface);
  color: var(--accent-orange);
  font-weight: 600;
}

/* Catalog Stats Bar */
.catalog-status-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1rem;
  font-size: 0.75rem;
  color: var(--text-muted);
  font-family: var(--font-mono);
}

.catalog-status-left,
.catalog-status-right {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.catalog-drag-hint {
  color: var(--text-muted);
  font-size: 0.6875rem;
  opacity: 0.8;
}

.btn-reset-order {
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  color: var(--text-muted);
  padding: 0.2rem 0.55rem;
  border-radius: var(--radius-sm);
  font-size: 0.6875rem;
  font-family: var(--font-mono);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  transition: var(--transition-fast);
}

.btn-reset-order:hover {
  color: var(--accent-orange);
  border-color: var(--accent-orange-border);
  background: var(--accent-orange-dim);
}

/* ==========================================================================
   DRAG AND DROP CATALOG REORDERING
   Tactile handles, ghosting, and directional drop target highlights
   ========================================================================== */

.draggable-game-item {
  cursor: grab;
  position: relative;
  transition: transform var(--transition-fast), opacity var(--transition-fast), border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.draggable-game-item:active {
  cursor: grabbing;
}

.game-drag-handle {
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  cursor: grab;
  padding: 0.25rem 0.4rem;
  border-radius: 3px;
  user-select: none;
  flex-shrink: 0;
  transition: color var(--transition-fast), background var(--transition-fast);
}

.game-drag-handle:focus-visible {
  outline: 2px solid var(--accent-orange);
  outline-offset: 2px;
}

.game-drag-handle:hover {
  color: var(--accent-orange);
  background: var(--accent-orange-dim);
}

.game-drag-handle:active {
  cursor: grabbing;
}

.grip-dots {
  font-size: 1.15rem;
  line-height: 1;
  letter-spacing: -2px;
  opacity: 0.6;
  transition: opacity var(--transition-fast);
}

.game-drag-handle:hover .grip-dots {
  opacity: 1;
}

.tile-drag-handle {
  margin-right: -0.25rem;
}

/* Dragging active state */
.draggable-game-item.dragging {
  opacity: 0.4;
  border-style: dashed !important;
  border-color: var(--accent-orange) !important;
  transform: scale(0.985);
  box-shadow: 0 0 15px var(--accent-orange-dim);
}

/* Drop targets in Strip View (Vertical List) */
.games-dense-list .draggable-game-item.drag-over-before {
  border-top: 2px solid var(--accent-orange) !important;
  box-shadow: 0 -4px 10px rgba(255, 107, 0, 0.25);
  transform: translateY(2px);
}

.games-dense-list .draggable-game-item.drag-over-after {
  border-bottom: 2px solid var(--accent-orange) !important;
  box-shadow: 0 4px 10px rgba(255, 107, 0, 0.25);
  transform: translateY(-2px);
}

/* Drop targets in Grid View */
.games-flex-grid .draggable-game-item.drag-over-before {
  border-left: 2px solid var(--accent-orange) !important;
  box-shadow: -4px 0 10px rgba(255, 107, 0, 0.25);
  transform: translateX(2px);
}

.games-flex-grid .draggable-game-item.drag-over-after {
  border-right: 2px solid var(--accent-orange) !important;
  box-shadow: 4px 0 10px rgba(255, 107, 0, 0.25);
  transform: translateX(-2px);
}


/* ==========================================================================
   VIEW MODE A: DENSE LIST STRIP (High Efficiency, Scalable)
   ========================================================================== */
.games-dense-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.game-strip-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 0.65rem 1rem;
  transition: border-color var(--transition-fast), background var(--transition-fast);
  gap: 1rem;
}

.game-strip-row:hover {
  background: var(--bg-surface-elevated);
  border-color: var(--border-medium);
}

.game-strip-left {
  display: flex;
  align-items: center;
  gap: 1rem;
  min-width: 0;
  flex: 1;
}

.strip-icon {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-sm);
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  object-fit: cover;
  flex-shrink: 0;
}

.strip-info {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.strip-headline {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  white-space: nowrap;
}

.strip-title {
  font-size: 0.9375rem;
  font-weight: 700;
  color: var(--text-primary);
}

.strip-version {
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  color: var(--accent-orange);
  background: var(--accent-orange-dim);
  padding: 0.1rem 0.35rem;
  border-radius: 3px;
}

.strip-desc {
  font-size: 0.75rem;
  color: var(--text-secondary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 580px;
}

.game-strip-mid {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  flex-wrap: wrap;
}

.tech-chip {
  font-family: var(--font-mono);
  font-size: 0.625rem;
  padding: 0.2rem 0.45rem;
  border-radius: 3px;
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
}

.tech-chip.highlight {
  border-color: var(--accent-orange-border);
  color: var(--accent-orange);
}

.game-strip-right {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-shrink: 0;
}

.btn-play-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.45rem 1rem;
  background: var(--accent-orange);
  color: var(--accent-orange-solid-text);
  font-weight: 700;
  font-size: 0.8125rem;
  border-radius: var(--radius-sm);
  transition: background var(--transition-fast), transform var(--transition-fast);
  white-space: nowrap;
}

.btn-play-action:hover {
  background: var(--accent-orange-hover);
  transform: translateY(-1px);
}

/* ==========================================================================
   VIEW MODE B: MODERN GLASS FLEX TILES (Responsive, Clean)
   ========================================================================== */
.games-flex-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1.25rem;
}

.game-glass-tile {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  transition: border-color var(--transition-fast), background var(--transition-fast), transform var(--transition-fast);
  position: relative;
}

.game-glass-tile:hover {
  background: var(--bg-surface-elevated);
  border-color: var(--accent-orange-border);
  transform: translateY(-2px);
}

.tile-header {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  margin-bottom: 0.75rem;
}

.tile-icon {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-sm);
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  object-fit: cover;
}

.tile-title-group {
  display: flex;
  flex-direction: column;
}

.tile-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-primary);
}

.tile-version {
  font-size: 0.6875rem;
  font-family: var(--font-mono);
  color: var(--accent-orange);
}

.tile-body {
  font-size: 0.8125rem;
  color: var(--text-secondary);
  line-height: 1.45;
  margin-bottom: 1rem;
  flex: 1;
}

.tile-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-bottom: 1.25rem;
}

/* Mobile Carousel/Reel Support */
@media (max-width: 768px) {
  .browser-toolbar {
    flex-direction: column;
    align-items: stretch;
    padding: 0.75rem;
  }
  .toolbar-search-wrap {
    max-width: none;
  }
  .game-strip-row {
    flex-direction: column;
    align-items: stretch;
    gap: 0.75rem;
  }
  .game-strip-right {
    justify-content: flex-end;
  }
  .game-strip-mid {
    margin-left: 56px;
  }
}

/* ==========================================================================
   GAMEPAD LAB PRO EXTENSIONS
   Trigger Response Curves, Button Remapper, Fighting Game Combo Stream
   ========================================================================== */

.gamepad-lab-grid {
  display: grid;
  grid-template-columns: 360px 1fr;
  gap: 1.25rem;
  align-items: stretch;
}

@media (max-width: 1024px) {
  .gamepad-lab-grid {
    grid-template-columns: 1fr;
  }
}

.gamepad-col {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  height: 100%;
}

.controller-svg-stage {
  display: flex;
  justify-content: center;
  align-items: center;
  width: 100%;
  padding: 1.25rem 0;
  flex: 1;
}

#gamepad-silhouette-svg {
  width: 100%;
  max-width: 560px;
  height: auto;
  aspect-ratio: 280 / 150;
  display: block;
  filter: drop-shadow(0 6px 20px rgba(0, 0, 0, 0.6));
}

.trigger-curves-deck {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  width: 100%;
}

.trigger-curve-canvas-wrap {
  position: relative;
  width: 100%;
  height: 110px;
  background: #090b0e;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

.trigger-curve-canvas-wrap canvas {
  width: 100%;
  height: 100%;
}

.trigger-meters-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem;
  font-family: var(--font-mono);
  font-size: 0.6875rem;
}

.trigger-meter-card {
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 0.35rem 0.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.trigger-bar-track {
  width: 100%;
  height: 6px;
  background: var(--bg-surface);
  border-radius: 2px;
  overflow: hidden;
}

.trigger-bar-fill {
  height: 100%;
  width: 0%;
  background: var(--accent-orange);
  transition: width 0.05s ease;
}

/* Button Remapper */
.remapper-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
  gap: 0.45rem;
  margin-top: 0.5rem;
}

.remap-slot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 0.35rem 0.6rem;
  font-family: var(--font-mono);
  font-size: 0.6875rem;
}

.remap-action-label {
  color: var(--text-secondary);
  font-weight: 600;
}

.remap-btn-chip {
  background: var(--bg-surface);
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-sm);
  color: var(--accent-orange);
  font-weight: 700;
  padding: 0.15rem 0.45rem;
  cursor: pointer;
  transition: var(--transition-fast);
}

.remap-btn-chip:hover {
  border-color: var(--accent-orange);
  background: var(--accent-orange-dim);
}

.remap-btn-chip.listening {
  background: var(--accent-orange);
  color: #000;
  animation: pulse-border 0.8s infinite alternate;
}

@keyframes pulse-border {
  from { opacity: 0.6; }
  to { opacity: 1.0; }
}

/* Combo / Motion Input Stream */
.combo-history-deck {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  margin-top: 1.25rem;
}

.combo-status-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 0.4rem 0.6rem;
}

.combo-detected-badge {
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  font-weight: 700;
  color: #22c55e;
  background: rgba(34, 197, 94, 0.15);
  border: 1px solid rgba(34, 197, 94, 0.3);
  padding: 0.15rem 0.5rem;
  border-radius: var(--radius-sm);
  min-height: 20px;
  display: flex;
  align-items: center;
}

.combo-feed-stream {
  display: flex;
  gap: 0.4rem;
  overflow-x: auto;
  padding: 0.5rem 0.4rem;
  min-height: 52px;
  align-items: center;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  background: #090b0e;
}

.combo-feed-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.15rem;
  padding: 0.25rem 0.45rem;
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  flex-shrink: 0;
  font-family: var(--font-mono);
  animation: combo-appear 0.12s ease-out;
}

@keyframes combo-appear {
  from { transform: scale(0.8); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

.combo-glyph {
  font-size: 1.1rem;
  line-height: 1;
  color: var(--accent-orange);
}

.combo-delta-frame {
  font-size: 0.5625rem;
  color: var(--text-muted);
}
