/* ==========================================================================
   YouthGames Radar — Design System & Layout Stylesheet
   Crafted for Youth Leaders & Camp Directors
   High-Impact, Tactile, Modern Engineering (Linear / Raycast Style)
   ========================================================================== */

/* --------------------------------------------------------------------------
   0. Typography Import
   -------------------------------------------------------------------------- */
@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:ital,wght@0,300..800;1,300..800&family=JetBrains+Mono:wght@400;500;600&display=swap');

/* --------------------------------------------------------------------------
   1. CSS Variables & Design Tokens (Elevation, Palettes, Tactile Curves)
   -------------------------------------------------------------------------- */
:root {
  /* Dark Mode (Default) — Deep Obsidian Base & Refined Surface Hierarchy */
  --surface-base: #090a0f;
  --surface-card: #11131a;
  --surface-elevated: #161922;
  --surface-overlay: #1c202d;
  --surface-popover: #212638;
  --surface-hover: #191d29;
  --surface-active: #222634;

  --bg-primary: var(--surface-base);
  --bg-secondary: var(--surface-card);
  --bg-tertiary: var(--surface-elevated);
  --bg-muted: var(--surface-elevated);
  --card-bg: var(--surface-card);
  --input-bg: #0c0e14;

  /* Hairline Translucent Borders & Bevels */
  --border-subtle: rgba(255, 255, 255, 0.08);
  --border-medium: rgba(255, 255, 255, 0.14);
  --border-strong: rgba(255, 255, 255, 0.22);
  --border-color: var(--border-subtle);
  --border-focus: var(--accent-color);
  --border-radius-bevel: inset 0 1px 0 0 rgba(255, 255, 255, 0.06);

  /* Typography Colors */
  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  --text-foreground: #f8fafc;

  /* Primary Accent: Ocean Blue (Default Professional) */
  --accent-color: #0284c7;
  --accent-hover: #0369a1;
  --accent-active: #075985;
  --accent-rgb: 2, 132, 199;
  --accent-subtle: rgba(2, 132, 199, 0.12);
  --accent-subtle-hover: rgba(2, 132, 199, 0.18);
  --accent-glow: 0 0 24px rgba(2, 132, 199, 0.28);
  --accent-text: #38bdf8;
  --accent-text-hover: #7dd3fc;
  --nav-hover-bg: rgba(255, 255, 255, 0.04);
  --nav-active-bg: rgba(2, 132, 199, 0.10);

  /* Semantic Status */
  --color-success: #10b981;
  --color-success-bg: rgba(16, 185, 129, 0.12);
  --color-warning: #f59e0b;
  --color-warning-bg: rgba(245, 158, 11, 0.12);
  --color-danger: #ef4444;
  --color-danger-bg: rgba(239, 68, 68, 0.12);
  --color-info: #6366f1;
  --color-info-bg: rgba(99, 102, 241, 0.12);

  /* Freshness Semaphore Colors */
  --color-fresh-green: #10b981;
  --color-fresh-yellow: #f59e0b;
  --color-fresh-red: #ef4444;
  --color-fresh-white: #cbd5e1;

  /* Radii */
  --radius-xs: 4px;
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --radius-xl: 18px;
  --radius-full: 9999px;

  /* Layered Shadows (Ambient + Directional) */
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.35), 0 0 0 1px var(--border-subtle);
  --shadow-md: 0 4px 12px -2px rgba(0, 0, 0, 0.5), 0 2px 4px -2px rgba(0, 0, 0, 0.3);
  --shadow-lg: 0 12px 32px -4px rgba(0, 0, 0, 0.65), 0 4px 12px -2px rgba(0, 0, 0, 0.4);
  --shadow-modal: 0 24px 48px -8px rgba(0, 0, 0, 0.8), 0 0 0 1px var(--border-medium);
  --shadow-glow: var(--accent-glow);

  /* Tactile Curves */
  --ease-tactile: cubic-bezier(0.16, 1, 0.3, 1);
  --transition-fast: 0.15s cubic-bezier(0.16, 1, 0.3, 1);
  --transition-normal: 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

[data-theme="light"] {
  /* Light Mode — Crisp Zinc/Sand Base & Layered Ambient Shadows */
  --surface-base: #f8fafc;
  --surface-card: #ffffff;
  --surface-elevated: #f1f4f9;
  --surface-overlay: #ffffff;
  --surface-popover: #ffffff;
  --surface-hover: #eef2f6;
  --surface-active: #e2e8f0;

  --bg-primary: var(--surface-base);
  --bg-secondary: var(--surface-card);
  --bg-tertiary: var(--surface-elevated);
  --bg-muted: var(--surface-elevated);
  --card-bg: var(--surface-card);
  --input-bg: #ffffff;

  --border-subtle: rgba(15, 23, 42, 0.08);
  --border-medium: rgba(15, 23, 42, 0.14);
  --border-strong: rgba(15, 23, 42, 0.22);
  --border-color: var(--border-subtle);
  --border-focus: var(--accent-color);
  --border-radius-bevel: inset 0 1px 0 0 rgba(255, 255, 255, 0.9);

  --text-primary: #090a0f;
  --text-secondary: #475569;
  --text-muted: #8391a3;
  --text-foreground: #090a0f;

  --accent-color: #0369a1;
  --accent-hover: #075985;
  --accent-active: #0c4a6e;
  --accent-rgb: 3, 105, 161;
  --accent-subtle: rgba(3, 105, 161, 0.10);
  --accent-subtle-hover: rgba(3, 105, 161, 0.16);
  --accent-glow: 0 0 20px rgba(3, 105, 161, 0.20);
  --accent-text: #0284c7;
  --accent-text-hover: #0369a1;
  --nav-hover-bg: rgba(0, 0, 0, 0.04);
  --nav-active-bg: rgba(3, 105, 161, 0.08);

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05), 0 0 0 1px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 14px -2px rgba(0, 0, 0, 0.08), 0 2px 4px -2px rgba(0, 0, 0, 0.04);
  --shadow-lg: 0 12px 30px -4px rgba(0, 0, 0, 0.12), 0 4px 8px -2px rgba(0, 0, 0, 0.06);
  --shadow-modal: 0 24px 48px -8px rgba(0, 0, 0, 0.18), 0 0 0 1px rgba(0, 0, 0, 0.08);
}

/* ==========================================================================
   Dynamic Accent Palettes (Indigo, Ocean Blue, Emerald, Violet)
   ========================================================================== */

/* 1. Indigo */
[data-accent="indigo"] {
  --accent-color: #4f46e5;
  --accent-hover: #4338ca;
  --accent-active: #3730a3;
  --accent-rgb: 79, 70, 229;
  --accent-subtle: rgba(79, 70, 229, 0.12);
  --accent-subtle-hover: rgba(79, 70, 229, 0.18);
  --accent-glow: 0 0 24px rgba(79, 70, 229, 0.28);
  --accent-text: #818cf8;
  --accent-text-hover: #a5b4fc;
  --nav-active-bg: rgba(79, 70, 229, 0.10);
}

[data-theme="light"][data-accent="indigo"],
[data-theme="light"] [data-accent="indigo"] {
  --accent-color: #4338ca;
  --accent-hover: #3730a3;
  --accent-active: #312e81;
  --accent-rgb: 67, 56, 202;
  --accent-subtle: rgba(67, 56, 202, 0.10);
  --accent-subtle-hover: rgba(67, 56, 202, 0.16);
  --accent-glow: 0 0 20px rgba(67, 56, 202, 0.20);
  --accent-text: #4338ca;
  --accent-text-hover: #3730a3;
  --nav-active-bg: rgba(67, 56, 202, 0.08);
}

/* 2. Ocean Blue (Default) */
[data-accent="ocean"] {
  --accent-color: #0284c7;
  --accent-hover: #0369a1;
  --accent-active: #075985;
  --accent-rgb: 2, 132, 199;
  --accent-subtle: rgba(2, 132, 199, 0.12);
  --accent-subtle-hover: rgba(2, 132, 199, 0.18);
  --accent-glow: 0 0 24px rgba(2, 132, 199, 0.28);
  --accent-text: #38bdf8;
  --accent-text-hover: #7dd3fc;
  --nav-active-bg: rgba(2, 132, 199, 0.10);
}

[data-theme="light"][data-accent="ocean"],
[data-theme="light"] [data-accent="ocean"] {
  --accent-color: #0369a1;
  --accent-hover: #075985;
  --accent-active: #0c4a6e;
  --accent-rgb: 3, 105, 161;
  --accent-subtle: rgba(3, 105, 161, 0.10);
  --accent-subtle-hover: rgba(3, 105, 161, 0.16);
  --accent-glow: 0 0 20px rgba(3, 105, 161, 0.20);
  --accent-text: #0284c7;
  --accent-text-hover: #0369a1;
  --nav-active-bg: rgba(3, 105, 161, 0.08);
}

/* 3. Emerald */
[data-accent="emerald"] {
  --accent-color: #059669;
  --accent-hover: #047857;
  --accent-active: #065f46;
  --accent-rgb: 5, 150, 105;
  --accent-subtle: rgba(5, 150, 105, 0.12);
  --accent-subtle-hover: rgba(5, 150, 105, 0.18);
  --accent-glow: 0 0 24px rgba(5, 150, 105, 0.28);
  --accent-text: #34d399;
  --accent-text-hover: #6ee7b7;
  --nav-active-bg: rgba(5, 150, 105, 0.10);
}

[data-theme="light"][data-accent="emerald"],
[data-theme="light"] [data-accent="emerald"] {
  --accent-color: #047857;
  --accent-hover: #065f46;
  --accent-active: #064e3b;
  --accent-rgb: 4, 120, 87;
  --accent-subtle: rgba(4, 120, 87, 0.10);
  --accent-subtle-hover: rgba(4, 120, 87, 0.16);
  --accent-glow: 0 0 20px rgba(4, 120, 87, 0.20);
  --accent-text: #047857;
  --accent-text-hover: #065f46;
  --nav-active-bg: rgba(4, 120, 87, 0.08);
}

/* 4. Imperial Violet */
[data-accent="violet"] {
  --accent-color: #7c3aed;
  --accent-hover: #6d28d9;
  --accent-active: #5b21b6;
  --accent-rgb: 124, 58, 237;
  --accent-subtle: rgba(124, 58, 237, 0.12);
  --accent-subtle-hover: rgba(124, 58, 237, 0.18);
  --accent-glow: 0 0 24px rgba(124, 58, 237, 0.28);
  --accent-text: #a78bfa;
  --accent-text-hover: #c4b5fd;
  --nav-active-bg: rgba(124, 58, 237, 0.10);
}

[data-theme="light"][data-accent="violet"],
[data-theme="light"] [data-accent="violet"] {
  --accent-color: #6d28d9;
  --accent-hover: #5b21b6;
  --accent-active: #4c1d95;
  --accent-rgb: 109, 40, 217;
  --accent-subtle: rgba(109, 40, 217, 0.10);
  --accent-subtle-hover: rgba(109, 40, 217, 0.16);
  --accent-glow: 0 0 20px rgba(109, 40, 217, 0.20);
  --accent-text: #6d28d9;
  --accent-text-hover: #5b21b6;
  --nav-active-bg: rgba(109, 40, 217, 0.08);
}

/* --------------------------------------------------------------------------
   2. Base Reset & High-Readability Typography
   -------------------------------------------------------------------------- */
*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  min-height: 100vh;
  overflow-x: hidden;
}

body {
  font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 13.5px;
  line-height: 1.5;
  background-color: var(--bg-primary);
  color: var(--text-primary);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-feature-settings: "cv02", "cv03", "cv04", "cv11", "tnum";
}

h1,
h2,
h3,
h4,
h5,
h6 {
  margin-top: 0;
  margin-bottom: 0.5rem;
  color: var(--text-primary);
  line-height: 1.25;
  letter-spacing: -0.025em;
  font-weight: 700;
}

p {
  margin-top: 0;
  margin-bottom: 0.75rem;
}

a {
  color: var(--accent-text);
  text-decoration: none;
  transition: color var(--transition-fast);
}

a:hover {
  color: var(--accent-text-hover);
  text-decoration: underline;
}

/* Tabular Numbers for Metrics, Durations & Counters */
.tabular-nums,
[data-tabular="true"],
.metric-number,
.stat-value,
.badge-numeric,
.duration-chip {
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum";
}

code,
kbd,
pre,
samp {
  font-family: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 0.85em;
}

kbd,
.kbd-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 2px 6px;
  background: var(--surface-elevated);
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-xs);
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.25);
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--text-secondary);
}

/* --------------------------------------------------------------------------
   3. SVG Iconography Core System (Monolinear, Optically Centered)
   -------------------------------------------------------------------------- */
.icon {
  display: inline-block;
  width: 1.15em;
  height: 1.15em;
  vertical-align: -0.2em;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.75;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex-shrink: 0;
  transition: transform var(--transition-fast), stroke var(--transition-fast);
}

.icon-xs {
  width: 14px;
  height: 14px;
  stroke-width: 1.75;
}

.icon-sm {
  width: 16px;
  height: 16px;
  stroke-width: 1.75;
}

.icon-md {
  width: 18px;
  height: 18px;
  stroke-width: 1.75;
}

.icon-lg {
  width: 22px;
  height: 22px;
  stroke-width: 1.75;
}

.icon-xl {
  width: 28px;
  height: 28px;
  stroke-width: 1.5;
}

.star-icon {
  width: 1em;
  height: 1em;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.75;
}

.star-icon.filled {
  fill: currentColor;
}

/* --------------------------------------------------------------------------
   4. Application Shell Layout (Sidebar, Header, Main)
   -------------------------------------------------------------------------- */
.app-container {
  display: flex;
  min-height: 100vh;
  position: relative;
  background-color: var(--bg-primary);
}

/* Sidebar */
.sidebar {
  width: 256px;
  background-color: var(--surface-card);
  border-right: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  transition: transform var(--transition-normal);
  z-index: 40;
  box-shadow: var(--shadow-sm);
}

.sidebar-header {
  height: 64px;
  padding: 0 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border-subtle);
  background-color: var(--surface-card);
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--text-primary);
}

.sidebar-brand-mark {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  background: var(--accent-color);
  /* background: linear-gradient(135deg, var(--accent-color), #d97706); */
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ffffff;
  box-shadow: 0 2px 8px rgba(var(--accent-rgb), 0.35);
}

.sidebar-brand-title {
  font-size: 0.95rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--text-primary);
  line-height: 1.1;
}

.sidebar-version-badge {
  font-size: 0.65rem;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: var(--radius-full);
  background: var(--surface-elevated);
  border: 1px solid var(--border-medium);
  color: var(--text-secondary);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.sidebar-nav {
  padding: 14px 10px;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 3px;
  overflow-y: auto;
}

.sidebar-section-label {
  padding: 10px 10px 4px 10px;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.nav-item {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-weight: 600;
  font-size: 0.85rem;
  transition: all var(--transition-fast);
  text-decoration: none;
  user-select: none;
}

.nav-item:hover {
  background-color: var(--nav-hover-bg);
  color: var(--text-primary);
  text-decoration: none;
  transform: translateX(2px);
}

.nav-item.active {
  background-color: var(--nav-active-bg);
  color: var(--accent-text);
  font-weight: 700;
}

.nav-item.active::before {
  content: "";
  position: absolute;
  left: 0;
  top: 6px;
  bottom: 6px;
  width: 3px;
  background-color: var(--accent-color);
  border-radius: 0 2px 2px 0;
  box-shadow: 0 0 8px rgba(var(--accent-rgb), 0.6);
}

.nav-item .icon {
  width: 17px;
  height: 17px;
  opacity: 0.85;
}

.nav-item.active .icon {
  opacity: 1;
  color: var(--accent-text);
}

/* Tactical Quick Action Card (Rescate Lúdico) */
.sidebar-footer {
  padding: 12px;
  border-top: 1px solid var(--border-subtle);
  background-color: var(--surface-card);
}

.quick-action-card {
  display: block;
  width: 100%;
  text-align: left;
  background: linear-gradient(135deg, rgba(var(--accent-rgb), 0.08), rgba(var(--accent-rgb), 0.03));
  border: 1px solid rgba(var(--accent-rgb), 0.25);
  border-radius: var(--radius-md);
  padding: 10px 12px;
  cursor: pointer;
  box-shadow: var(--border-radius-bevel), 0 2px 8px rgba(0, 0, 0, 0.2);
  transition: all var(--transition-fast);
  color: var(--text-primary);
}

.quick-action-card:hover {
  border-color: var(--accent-color);
  background: linear-gradient(135deg, rgba(var(--accent-rgb), 0.14), rgba(var(--accent-rgb), 0.06));
  box-shadow: var(--border-radius-bevel), var(--accent-glow);
  transform: translateY(-1px);
}

.quick-action-card:active {
  transform: scale(0.98);
}

.quick-action-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 2px;
}

.quick-action-title {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--accent-text);
}

.quick-action-subtitle {
  font-size: 0.72rem;
  color: var(--text-secondary);
  font-weight: 500;
}

/* Main Area & Sticky Header */
.main-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  background-color: var(--bg-primary);
}

.top-bar {
  height: 64px;
  background-color: var(--surface-card);
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  position: sticky;
  top: 0;
  z-index: 30;
  backdrop-filter: blur(8px);
}

.top-bar-title-group {
  display: flex;
  align-items: center;
  gap: 12px;
}

.top-bar-title {
  margin: 0;
  font-size: 1.1rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.top-bar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.content-body {
  padding: 24px;
  flex: 1;
  max-width: 1600px;
  width: 100%;
  margin: 0 auto;
}

/* Mobile responsive hamburger and drawer */
.mobile-menu-btn {
  display: none;
  background: var(--surface-elevated);
  border: 1px solid var(--border-medium);
  color: var(--text-primary);
  padding: 6px 9px;
  border-radius: var(--radius-sm);
  cursor: pointer;
}

@media (max-width: 900px) {
  .mobile-menu-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }

  .sidebar {
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    transform: translateX(-100%);
    box-shadow: var(--shadow-modal);
  }

  .sidebar.open {
    transform: translateX(0);
  }

  .sidebar-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    z-index: 35;
    backdrop-filter: blur(4px);
  }

  .content-body {
    padding: 16px;
  }
}

/* --------------------------------------------------------------------------
   5. Buttons & Tactile Microinteractions
   -------------------------------------------------------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 7px 14px;
  border-radius: var(--radius-sm);
  font-size: 0.825rem;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all var(--transition-fast);
  text-decoration: none;
  line-height: 1.25;
  user-select: none;
  white-space: nowrap;
  box-shadow: var(--shadow-sm);
}

.btn:hover {
  text-decoration: none;
  transform: translateY(-1px);
}

.btn:active {
  transform: scale(0.98);
}

.btn:focus-visible {
  outline: none;
  box-shadow: 0 0 0 2px var(--bg-primary), 0 0 0 4px var(--accent-color);
}

.btn-primary {
  background: var(--accent-color);
  color: #ffffff;
  border-color: rgba(255, 255, 255, 0.15);
  box-shadow: var(--shadow-sm), inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

.btn-primary:hover {
  background: var(--accent-hover);
  color: #ffffff;
  box-shadow: var(--shadow-md), var(--accent-glow);
}

.btn-secondary {
  background-color: var(--surface-elevated);
  color: var(--text-primary);
  border-color: var(--border-medium);
  box-shadow: var(--border-radius-bevel), var(--shadow-sm);
}

.btn-secondary:hover {
  background-color: var(--surface-hover);
  border-color: var(--border-strong);
  color: var(--text-primary);
}

.btn-outline {
  background-color: transparent;
  border-color: var(--border-medium);
  color: var(--text-primary);
}

.btn-outline:hover {
  background-color: var(--surface-hover);
  border-color: var(--border-strong);
  color: var(--text-primary);
}

.btn-outline-primary {
  background-color: transparent;
  border-color: var(--accent-color);
  color: var(--accent-text);
}

.btn-outline-primary:hover {
  background-color: var(--accent-subtle);
  color: var(--accent-text-hover);
}

.btn-success {
  background-color: var(--color-success);
  color: #ffffff;
  border-color: rgba(255, 255, 255, 0.15);
}

.btn-success:hover {
  filter: brightness(1.08);
  color: #ffffff;
}

.btn-danger {
  background-color: var(--color-danger);
  color: #ffffff;
  border-color: rgba(255, 255, 255, 0.15);
}

.btn-danger:hover {
  filter: brightness(1.08);
  color: #ffffff;
}

.btn-warning {
  background-color: var(--color-warning);
  color: #ffffff;
  border-color: rgba(255, 255, 255, 0.15);
}

.btn-warning:hover {
  filter: brightness(1.08);
  color: #ffffff;
}

.btn-emergency {
  background: linear-gradient(135deg, #f97316, #ef4444);
  color: #ffffff;
  font-weight: 700;
  border-color: rgba(255, 255, 255, 0.2);
  box-shadow: 0 2px 12px rgba(239, 68, 68, 0.35), var(--border-radius-bevel);
}

.btn-emergency:hover {
  filter: brightness(1.1);
  box-shadow: 0 4px 18px rgba(239, 68, 68, 0.5), var(--border-radius-bevel);
  color: #ffffff;
}

.btn-ghost {
  background-color: transparent;
  border-color: transparent;
  color: var(--text-secondary);
  box-shadow: none;
}

.btn-ghost:hover {
  background-color: var(--surface-hover);
  color: var(--text-primary);
  box-shadow: none;
}

.btn-sm {
  padding: 5px 11px;
  font-size: 0.78rem;
}

.btn-xs {
  padding: 3px 8px;
  font-size: 0.72rem;
  border-radius: var(--radius-xs);
}

.btn-2xs {
  padding: 2px 6px;
  font-size: 0.68rem;
  border-radius: var(--radius-xs);
}

.btn-close {
  background: transparent;
  border: none;
  font-size: 1.1rem;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 4px 6px;
  line-height: 1;
  border-radius: var(--radius-xs);
  transition: all var(--transition-fast);
}

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

/* Segmented Control / Button Group */
.btn-group {
  display: inline-flex;
  border-radius: var(--radius-sm);
  background-color: var(--surface-card);
  border: 1px solid var(--border-medium);
  padding: 2px;
  gap: 2px;
}

.btn-group .btn {
  border-radius: var(--radius-xs);
  border: none;
  box-shadow: none;
  padding: 4px 10px;
  font-size: 0.78rem;
}

.btn-group .btn.active,
.btn-group .btn-primary {
  background-color: var(--surface-elevated);
  color: var(--accent-text);
  font-weight: 700;
  box-shadow: var(--shadow-sm);
}

/* --------------------------------------------------------------------------
   6. Cards & Surface Elevation System
   -------------------------------------------------------------------------- */
.card {
  background-color: var(--surface-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  box-shadow: var(--border-radius-bevel), var(--shadow-sm);
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast), transform var(--transition-fast);
}

.card-elevated {
  background-color: var(--surface-elevated);
  border-color: var(--border-medium);
}

.game-card {
  background-color: var(--surface-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  box-shadow: var(--border-radius-bevel), var(--shadow-sm);
  transition: all var(--transition-fast);
  position: relative;
  overflow: hidden;
}

.game-card::after {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, rgba(var(--accent-rgb), 0.3), transparent);
  opacity: 0;
  transition: opacity var(--transition-fast);
}

.game-card:hover {
  border-color: var(--border-strong);
  box-shadow: var(--border-radius-bevel), var(--shadow-md);
  transform: translateY(-2px);
}

.game-card:hover::after {
  opacity: 1;
}

.game-quick-card {
  background-color: var(--surface-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  box-shadow: var(--border-radius-bevel), var(--shadow-sm);
  transition: all var(--transition-fast);
}

.game-quick-card:hover {
  border-color: var(--accent-color);
  box-shadow: var(--shadow-md);
}

/* Media Discovery Cards Grid & Responsive Layout */
.cards-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 18px;
  width: 100%;
}

@media (min-width: 640px) {
  .cards-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (min-width: 1024px) {
  .cards-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (min-width: 1440px) {
  .cards-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

.media-card {
  background-color: var(--surface-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: transform var(--transition-fast), border-color var(--transition-fast), box-shadow var(--transition-fast);
  box-shadow: var(--shadow-sm);
  min-width: 0;
}

.media-card:hover {
  transform: translateY(-2px);
  border-color: var(--accent-color);
  box-shadow: var(--shadow-md);
}

.media-card .card-media {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  background-color: #0b0d13;
  overflow: hidden;
}

.media-card .card-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform var(--transition-base);
}

.media-card:hover .card-media img {
  transform: scale(1.03);
}

.media-card .card-content {
  padding: 14px;
  display: flex;
  flex-direction: column;
  flex: 1;
}

.media-card .card-title {
  font-size: 0.925rem;
  font-weight: 600;
  line-height: 1.35;
  color: var(--text-primary);
  margin: 0 0 8px 0;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-overflow: ellipsis;
  min-height: 2.5em;
}

.media-card .card-title:hover {
  color: var(--accent-text-hover);
}

/* Top Bar Accent Palette Switcher */
.accent-switcher {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 4px 8px;
  background-color: var(--surface-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: 9999px;
  box-shadow: var(--shadow-sm);
}

.accent-switcher-label {
  font-size: 0.72rem;
  color: var(--text-muted);
  font-weight: 600;
  margin-right: 2px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  display: none;
}

@media (min-width: 768px) {
  .accent-switcher-label {
    display: inline;
  }
}

.accent-dot {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 2px solid transparent;
  cursor: pointer;
  padding: 0;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  position: relative;
}

.accent-dot:hover {
  transform: scale(1.22);
}

.accent-dot.active {
  box-shadow: 0 0 0 2px var(--surface-card), 0 0 10px currentColor;
  transform: scale(1.15);
}

.accent-dot[data-accent-choice="indigo"] {
  background-color: #4f46e5;
  color: #4f46e5;
}

.accent-dot[data-accent-choice="ocean"] {
  background-color: #0284c7;
  color: #0284c7;
}

.accent-dot[data-accent-choice="emerald"] {
  background-color: #059669;
  color: #059669;
}

.accent-dot[data-accent-choice="violet"] {
  background-color: #7c3aed;
  color: #7c3aed;
}

/* --------------------------------------------------------------------------
   7. Form Inputs & Selects
   -------------------------------------------------------------------------- */
.form-group {
  display: flex;
  flex-direction: column;
}

.form-label {
  display: block;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  margin-bottom: 5px;
  color: var(--text-secondary);
}

.form-input,
.form-select,
.form-control {
  width: 100%;
  padding: 7px 11px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-medium);
  background-color: var(--input-bg);
  color: var(--text-primary);
  font-size: 0.825rem;
  font-family: inherit;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.15);
}

.form-input::placeholder,
.form-control::placeholder {
  color: var(--text-muted);
}

.form-input:focus,
.form-select:focus,
.form-control:focus {
  outline: none;
  border-color: var(--accent-color);
  box-shadow: 0 0 0 2px var(--bg-primary), 0 0 0 4px rgba(var(--accent-rgb), 0.3);
}

/* Search input with integrated icon container */
.search-input-wrap {
  position: relative;
  width: 100%;
}

.search-input-wrap .search-icon {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  pointer-events: none;
}

.search-input-wrap .form-input {
  padding-left: 34px;
}

/* --------------------------------------------------------------------------
   8. Badges, Chips & Semaphores
   -------------------------------------------------------------------------- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 7px;
  border-radius: var(--radius-full);
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  background-color: var(--surface-elevated);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  line-height: 1.2;
}

.badge-primary {
  background-color: var(--accent-subtle);
  border-color: rgba(var(--accent-rgb), 0.25);
  color: var(--accent-text);
}

.badge-secondary {
  background-color: var(--surface-elevated);
  border-color: var(--border-subtle);
  color: var(--text-secondary);
}

.badge-success {
  background-color: var(--color-success-bg);
  border-color: rgba(16, 185, 129, 0.25);
  color: var(--color-success);
}

.badge-danger {
  background-color: var(--color-danger-bg);
  border-color: rgba(239, 68, 68, 0.25);
  color: var(--color-danger);
}

.badge-warning {
  background-color: var(--color-warning-bg);
  border-color: rgba(245, 158, 11, 0.25);
  color: var(--color-warning);
}

.badge-info {
  background-color: var(--color-info-bg);
  border-color: rgba(99, 102, 241, 0.25);
  color: var(--color-info);
}

.badge-ghost {
  background-color: transparent;
  border: 1px solid var(--border-subtle);
  color: var(--text-muted);
}

.badge-outline {
  background-color: transparent;
  border: 1px solid var(--border-medium);
  color: var(--text-secondary);
}

.badge-sm {
  padding: 2px 6px;
  font-size: 0.72rem;
}

.badge-xs {
  padding: 1.5px 5px;
  font-size: 0.68rem;
}

.badge-2xs {
  padding: 1px 4px;
  font-size: 0.63rem;
}

.badge-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border-radius: var(--radius-full);
  font-size: 0.73rem;
  font-weight: 600;
  background-color: var(--surface-elevated);
  color: var(--text-secondary);
  border: 1px solid var(--border-subtle);
  cursor: pointer;
  transition: all var(--transition-fast);
  text-decoration: none;
  user-select: none;
}

.badge-chip:hover {
  border-color: var(--accent-color);
  color: var(--text-primary);
  text-decoration: none;
  background-color: var(--surface-hover);
}

.badge-chip.active {
  background-color: var(--accent-subtle);
  border-color: var(--accent-color);
  color: var(--accent-text);
  font-weight: 700;
}

/* Semaphore & Freshness Indicator with Luminescent Glow */
.semaphore-indicator,
.freshness-indicator {
  display: inline-block;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  flex-shrink: 0;
  position: relative;
}

.semaphore-green,
.freshness-green {
  background-color: var(--color-fresh-green);
  box-shadow: 0 0 10px rgba(16, 185, 129, 0.75);
}

.semaphore-yellow,
.freshness-yellow {
  background-color: var(--color-fresh-yellow);
  box-shadow: 0 0 10px rgba(245, 158, 11, 0.75);
}

.semaphore-red,
.freshness-red {
  background-color: var(--color-fresh-red);
  box-shadow: 0 0 10px rgba(239, 68, 68, 0.75);
}

.semaphore-white,
.freshness-white {
  background-color: var(--color-fresh-white);
  border: 1px solid rgba(255, 255, 255, 0.4);
  box-shadow: 0 0 6px rgba(203, 213, 225, 0.5);
}

/* Subtle breathing glow animation */
@keyframes pulse-glow {

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

  50% {
    opacity: 0.4;
    transform: scale(0.92);
  }
}

.pulse-glow {
  animation: pulse-glow 2.5s ease-in-out infinite;
}

/* --------------------------------------------------------------------------
   9. Dashboard Component Classes
   -------------------------------------------------------------------------- */
.dashboard-container {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.welcome-banner {
  background: radial-gradient(circle at 10% 20%, rgba(var(--accent-rgb), 0.12) 0%, rgba(99, 102, 241, 0.05) 50%, transparent 100%), var(--surface-card);
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-lg);
  padding: 24px 28px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 20px;
  box-shadow: var(--border-radius-bevel), var(--shadow-sm);
}

.welcome-banner-title {
  margin: 0 0 6px 0;
  font-size: 1.35rem;
  font-weight: 800;
  letter-spacing: -0.025em;
  color: var(--text-primary);
}

.welcome-banner-text {
  margin: 0;
  color: var(--text-secondary);
  font-size: 0.875rem;
  max-width: 620px;
  line-height: 1.5;
}

.welcome-banner-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

/* Metrics Grid & Cards */
.metrics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
}

.metric-card {
  padding: 20px;
  background-color: var(--surface-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  box-shadow: var(--border-radius-bevel), var(--shadow-sm);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  transition: all var(--transition-fast);
}

.metric-card:hover {
  border-color: var(--border-strong);
  box-shadow: var(--border-radius-bevel), var(--shadow-md);
  transform: translateY(-2px);
}

.metric-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
}

.metric-label {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--text-secondary);
}

.metric-icon-box {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid transparent;
}

.metric-icon-box.tonal-indigo {
  background: rgba(99, 102, 241, 0.12);
  color: #818cf8;
  border-color: rgba(99, 102, 241, 0.2);
}

.metric-icon-box.tonal-amber {
  background: rgba(245, 158, 11, 0.12);
  color: #fbbf24;
  border-color: rgba(245, 158, 11, 0.2);
}

.metric-icon-box.tonal-emerald {
  background: rgba(16, 185, 129, 0.12);
  color: #34d399;
  border-color: rgba(16, 185, 129, 0.2);
}

.metric-icon-box.tonal-tangerine {
  background: var(--accent-subtle);
  color: var(--accent-text);
  border-color: rgba(var(--accent-rgb), 0.25);
}

.metric-number {
  font-size: 2.25rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  margin: 10px 0 4px 0;
  color: var(--text-primary);
  line-height: 1.1;
}

.metric-desc {
  font-size: 0.78rem;
  color: var(--text-muted);
}

.metric-link {
  margin-top: 14px;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--accent-text);
  text-decoration: none;
  transition: gap var(--transition-fast), color var(--transition-fast);
}

.metric-link:hover {
  text-decoration: none;
  color: var(--accent-text-hover);
  gap: 8px;
}

/* Freshness & Rotation Section */
.freshness-card {
  background-color: var(--surface-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: var(--border-radius-bevel), var(--shadow-sm);
}

.freshness-card-title {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 16px 0;
  font-size: 1.05rem;
  font-weight: 700;
}

.freshness-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 16px;
}

.freshness-item {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 14px 16px;
  background-color: var(--surface-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  transition: all var(--transition-fast);
}

.freshness-item:hover {
  border-color: var(--border-medium);
  transform: translateY(-1px);
}

.freshness-item-header {
  display: flex;
  align-items: center;
  gap: 10px;
}

.freshness-stat {
  font-size: 1.35rem;
  font-weight: 800;
  color: var(--text-primary);
  line-height: 1.2;
}

.freshness-label {
  font-size: 0.75rem;
  color: var(--text-secondary);
  font-weight: 500;
}

/* 4px Proportional Progress Bar */
.freshness-progress-track {
  width: 100%;
  height: 4px;
  background-color: rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-full);
  overflow: hidden;
  margin-top: 10px;
}

[data-theme="light"] .freshness-progress-track {
  background-color: rgba(0, 0, 0, 0.08);
}

.freshness-progress-fill {
  height: 100%;
  border-radius: var(--radius-full);
  transition: width 0.6s var(--ease-tactile);
}

.fill-green {
  background-color: var(--color-fresh-green);
  box-shadow: 0 0 8px rgba(16, 185, 129, 0.6);
}

.fill-white {
  background-color: var(--color-fresh-white);
  box-shadow: 0 0 6px rgba(203, 213, 225, 0.4);
}

.fill-amber {
  background-color: var(--color-warning);
  box-shadow: 0 0 8px rgba(245, 158, 11, 0.6);
}

/* --------------------------------------------------------------------------
   10. Games List Catalog & Filters
   -------------------------------------------------------------------------- */
.catalog-header {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-bottom: 24px;
}

@media (min-width: 768px) {
  .catalog-header {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
  }
}

.catalog-title-group {
  display: flex;
  flex-direction: column;
  width: 33%;
}

@media (max-width: 768px) {
  .catalog-title-group {
    width: 100%;
  }
}

.catalog-title {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 1.4rem;
  font-weight: 800;
  margin: 0;
}

.catalog-subtitle {
  font-size: 0.8rem;
  color: var(--text-secondary);
  margin-top: 4px;
  margin-bottom: 0;
}

.catalog-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

/* Catalog Filter Panel */
.catalog-filter-card {
  padding: 16px 20px;
  margin-bottom: 24px;
  background-color: var(--surface-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  box-shadow: var(--border-radius-bevel), var(--shadow-sm);
}

.filter-row-primary {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
  align-items: center;
}

@media (min-width: 768px) {
  .filter-row-primary {
    grid-template-columns: 5fr 3fr 2fr 2fr;
  }
}

.filter-row-advanced {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--border-subtle);
}

@media (min-width: 768px) {
  .filter-row-advanced {
    grid-template-columns: repeat(4, 1fr);
  }
}

.filter-pills-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--border-subtle);
  font-size: 0.75rem;
}

/* Game Card Details */
.game-card-inner {
  padding: 16px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  height: 100%;
}

.game-card-meta-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  margin-bottom: 8px;
}

.game-card-title {
  font-size: 1rem;
  font-weight: 700;
  line-height: 1.3;
  margin-bottom: 6px;
  color: var(--text-primary);
}

.game-card-title a {
  color: var(--text-primary);
  text-decoration: none;
}

.game-card-title a:hover {
  color: var(--accent-text-hover);
}

.game-card-summary {
  font-size: 0.78rem;
  color: var(--text-secondary);
  line-height: 1.45;
  margin-bottom: 12px;
  cursor: pointer;
}

.game-card-footer {
  padding-top: 12px;
  border-top: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.game-spec-chips {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.75rem;
  color: var(--text-secondary);
}

.game-spec-item {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.game-actions-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}

/* Rating Button Pill */
.rating-pill-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: rgba(245, 158, 11, 0.12);
  border: 1px solid rgba(245, 158, 11, 0.25);
  color: #fbbf24;
  padding: 2px 7px;
  border-radius: var(--radius-xs);
  cursor: pointer;
  font-size: 0.75rem;
  font-weight: 700;
  transition: all var(--transition-fast);
}

.rating-pill-btn:hover {
  background: rgba(245, 158, 11, 0.2);
  border-color: #fbbf24;
  transform: translateY(-1px);
}

/* --------------------------------------------------------------------------
   11. Modals & Dialogs (Backdrop Blur, Pop Animation)
   -------------------------------------------------------------------------- */
@keyframes modal-enter {
  0% {
    opacity: 0;
    transform: scale(0.96) translateY(8px);
  }

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

.modal-overlay {
  position: fixed;
  inset: 0;
  background-color: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(8px) brightness(0.6);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal-dialog,
dialog.modal-dialog {
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-lg);
  background-color: var(--surface-overlay);
  color: var(--text-primary);
  max-width: 650px;
  width: 92%;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-modal), var(--border-radius-bevel);
  position: relative;
  animation: modal-enter 0.18s var(--ease-tactile);
}

#emergency-modal,
#category-management-modal {
  max-width: 1250px;
}

dialog.modal-dialog {
  padding: 0;
  position: fixed;
  inset: 0;
  margin: auto;
}

dialog.modal-dialog::backdrop {
  background-color: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(8px) brightness(0.6);
}

.modal-header-clean {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-subtle);
  background-color: var(--surface-elevated);
}

.modal-header-title {
  margin: 0;
  font-size: 1.1rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text-primary);
}

.modal-body-clean {
  padding: 20px;
}

/* Rating Interactive Stars in Modal */
.rating-stars-interactive {
  display: inline-flex;
  gap: 8px;
  font-size: 2rem;
  cursor: pointer;
  user-select: none;
}

.rating-star-btn {
  background: transparent;
  border: none;
  padding: 2px;
  cursor: pointer;
  color: var(--text-muted);
  transition: transform 0.1s var(--ease-tactile), color 0.1s ease;
}

.rating-star-btn:hover {
  transform: scale(1.2);
}

.rating-star-btn.active {
  color: #f59e0b;
}

/* --------------------------------------------------------------------------
   12. Toasts & Notifications
   -------------------------------------------------------------------------- */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.toast-card {
  background-color: var(--surface-elevated);
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-md);
  padding: 12px 18px;
  box-shadow: var(--shadow-lg), var(--border-radius-bevel);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-width: 320px;
  max-width: 480px;
  animation: modal-enter 0.2s var(--ease-tactile);
}

.toast-card.toast-success {
  border-left: 3px solid var(--color-success);
}

.toast-card.toast-info {
  border-left: 3px solid var(--color-info);
}

.toast-card.toast-warning {
  border-left: 3px solid var(--color-warning);
}

.toast-body {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.85rem;
  color: var(--text-primary);
  font-weight: 500;
}

.action-toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 100000;
  padding: 12px 20px;
  border-radius: var(--radius-md);
  background-color: var(--surface-overlay);
  border: 1px solid var(--color-success);
  color: var(--text-primary);
  font-weight: 600;
  font-size: 0.875rem;
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: center;
  gap: 10px;
}

/* --------------------------------------------------------------------------
   13. Tables
   -------------------------------------------------------------------------- */
.table-container {
  width: 100%;
  overflow-x: auto;
  border-radius: var(--radius-md);
  background-color: var(--surface-card);
  border: 1px solid var(--border-subtle);
  box-shadow: var(--shadow-sm);
}

table.table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 0.825rem;
}

table.table th {
  padding: 10px 14px;
  background-color: var(--surface-elevated);
  font-weight: 700;
  font-size: 0.72rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-secondary);
  border-bottom: 1px solid var(--border-medium);
  white-space: nowrap;
}

table.table td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--border-subtle);
  color: var(--text-secondary);
}

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

table.table tr:hover td {
  background-color: var(--surface-hover);
}

/* --------------------------------------------------------------------------
   14. General Utility Classes
   -------------------------------------------------------------------------- */
.flex {
  display: flex;
}

.inline-flex {
  display: inline-flex;
}

.inline-block {
  display: inline-block;
}

.block {
  display: block;
}

.hidden {
  display: none !important;
}

.flex-col {
  flex-direction: column;
}

.flex-row {
  flex-direction: row;
}

.flex-wrap {
  flex-wrap: wrap;
}

.flex-1 {
  flex: 1 1 0%;
}

.shrink-0 {
  flex-shrink: 0;
}

.items-center {
  align-items: center;
}

.items-start {
  align-items: flex-start;
}

.items-end {
  align-items: flex-end;
}

.justify-between {
  justify-content: space-between;
}

.justify-center {
  justify-content: center;
}

.justify-end {
  justify-content: flex-end;
}

/* Grid */
.grid {
  display: grid;
}

.grid-cols-1 {
  grid-template-columns: repeat(1, minmax(0, 1fr));
}

.grid-cols-2 {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.grid-cols-3 {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.grid-cols-4 {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.grid-cols-12 {
  grid-template-columns: repeat(12, minmax(0, 1fr));
}

@media (min-width: 640px) {
  .sm\:flex-row {
    flex-direction: row;
  }
}

@media (min-width: 768px) {
  .md\:grid-cols-2 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .md\:grid-cols-3 {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .md\:grid-cols-4 {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .md\:grid-cols-12 {
    grid-template-columns: repeat(12, minmax(0, 1fr));
  }

  .md\:col-span-2 {
    grid-column: span 2 / span 12;
  }

  .md\:col-span-3 {
    grid-column: span 3 / span 12;
  }

  .md\:col-span-4 {
    grid-column: span 4 / span 12;
  }

  .md\:col-span-5 {
    grid-column: span 5 / span 12;
  }

  .md\:col-span-6 {
    grid-column: span 6 / span 12;
  }

  .md\:col-span-7 {
    grid-column: span 7 / span 12;
  }

  .md\:col-span-8 {
    grid-column: span 8 / span 12;
  }

  .md\:col-span-12 {
    grid-column: span 12 / span 12;
  }

  .md\:flex-row {
    flex-direction: row;
  }

  .md\:items-center {
    align-items: center;
  }

  .md\:items-start {
    align-items: flex-start;
  }
}

@media (min-width: 1024px) {
  .lg\:grid-cols-3 {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .lg\:grid-cols-12 {
    grid-template-columns: repeat(12, minmax(0, 1fr));
  }

  .lg\:col-span-5 {
    grid-column: span 5 / span 12;
  }

  .lg\:col-span-7 {
    grid-column: span 7 / span 12;
  }
}

@media (min-width: 1280px) {
  .xl\:grid-cols-4 {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

/* Gaps */
.gap-1 {
  gap: 0.25rem;
}

.gap-1\.5 {
  gap: 0.375rem;
}

.gap-2 {
  gap: 0.5rem;
}

.gap-3 {
  gap: 0.75rem;
}

.gap-4 {
  gap: 1rem;
}

.gap-5 {
  gap: 1.25rem;
}

.gap-6 {
  gap: 1.5rem;
}

/* Spacing */
.p-1 {
  padding: 0.25rem;
}

.p-2 {
  padding: 0.5rem;
}

.p-3 {
  padding: 0.75rem;
}

.p-4 {
  padding: 1rem;
}

.p-5 {
  padding: 1.25rem;
}

.p-6 {
  padding: 1.5rem;
}

.p-12 {
  padding: 3rem;
}

.px-1 {
  padding-left: 0.25rem;
  padding-right: 0.25rem;
}

.px-2 {
  padding-left: 0.5rem;
  padding-right: 0.5rem;
}

.px-3 {
  padding-left: 0.75rem;
  padding-right: 0.75rem;
}

.px-4 {
  padding-left: 1rem;
  padding-right: 1rem;
}

.px-6 {
  padding-left: 1.5rem;
  padding-right: 1.5rem;
}

.py-1 {
  padding-top: 0.25rem;
  padding-bottom: 0.25rem;
}

.py-2 {
  padding-top: 0.5rem;
  padding-bottom: 0.5rem;
}

.py-3 {
  padding-top: 0.75rem;
  padding-bottom: 0.75rem;
}

.py-6 {
  padding-top: 1.5rem;
  padding-bottom: 1.5rem;
}

.py-10 {
  padding-top: 2.5rem;
  padding-bottom: 2.5rem;
}

.py-12 {
  padding-top: 3rem;
  padding-bottom: 3rem;
}

.pt-1 {
  padding-top: 0.25rem;
}

.pt-2 {
  padding-top: 0.5rem;
}

.pt-3 {
  padding-top: 0.75rem;
}

.pt-4 {
  padding-top: 1rem;
}

.pb-2 {
  padding-bottom: 0.5rem;
}

.pb-3 {
  padding-bottom: 0.75rem;
}

.pb-4 {
  padding-bottom: 1rem;
}

.pl-8 {
  padding-left: 2rem;
}

.m-0 {
  margin: 0;
}

.mt-1 {
  margin-top: 0.25rem;
}

.mt-2 {
  margin-top: 0.5rem;
}

.mt-3 {
  margin-top: 0.75rem;
}

.mt-4 {
  margin-top: 1rem;
}

.mt-6 {
  margin-top: 1.5rem;
}

.mb-1 {
  margin-bottom: 0.25rem;
}

.mb-2 {
  margin-bottom: 0.5rem;
}

.mb-3 {
  margin-bottom: 0.75rem;
}

.mb-4 {
  margin-bottom: 1rem;
}

.mb-6 {
  margin-bottom: 1.5rem;
}

.ml-1 {
  margin-left: 0.25rem;
}

.ml-2 {
  margin-left: 0.5rem;
}

.ml-auto {
  margin-left: auto;
}

.mr-auto {
  margin-right: auto;
}

.my-3 {
  margin-top: 0.75rem;
  margin-bottom: 0.75rem;
}

.space-y-1> :not([hidden])~ :not([hidden]) {
  margin-top: 0.25rem;
}

.space-y-2> :not([hidden])~ :not([hidden]) {
  margin-top: 0.5rem;
}

.space-y-3> :not([hidden])~ :not([hidden]) {
  margin-top: 0.75rem;
}

.space-y-4> :not([hidden])~ :not([hidden]) {
  margin-top: 1rem;
}

/* Sizing */
.w-full {
  width: 100%;
}

.w-8 {
  width: 2rem;
}

.h-full {
  height: 100%;
}

.min-h-32 {
  min-height: 8rem;
}

.max-h-32 {
  max-height: 8rem;
}

.aspect-video {
  aspect-ratio: 16 / 9;
}

/* Text Utilities */
.text-2xs {
  font-size: 0.68rem;
  line-height: 1rem;
}

.text-xs {
  font-size: 0.75rem;
  line-height: 1.1rem;
}

.text-sm {
  font-size: 0.825rem;
  line-height: 1.25rem;
}

.text-base {
  font-size: 0.95rem;
  line-height: 1.5rem;
}

.text-lg {
  font-size: 1.125rem;
  line-height: 1.75rem;
}

.text-xl {
  font-size: 1.25rem;
  line-height: 1.75rem;
}

.text-2xl {
  font-size: 1.5rem;
  line-height: 2rem;
}

.font-normal {
  font-weight: 400;
}

.font-medium {
  font-weight: 500;
}

.font-semibold {
  font-weight: 600;
}

.font-bold {
  font-weight: 700;
}

.font-black {
  font-weight: 800;
}

.text-center {
  text-align: center;
}

.text-right {
  text-align: right;
}

.whitespace-nowrap {
  white-space: nowrap;
}

.truncate {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.line-clamp-1 {
  display: -webkit-box;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.line-clamp-2 {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.line-clamp-3 {
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.line-clamp-5 {
  display: -webkit-box;
  -webkit-line-clamp: 5;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Colors & Backgrounds */
.text-foreground {
  color: var(--text-primary);
}

.text-primary {
  color: var(--accent-text);
}

.text-secondary {
  color: var(--text-secondary);
}

.text-muted {
  color: var(--text-muted);
}

.text-danger {
  color: var(--color-danger);
}

.text-warning {
  color: var(--color-warning);
}

.text-success {
  color: var(--color-success);
}

.text-info {
  color: var(--color-info);
}

.bg-base {
  background-color: var(--surface-base);
}

.bg-card {
  background-color: var(--surface-card);
}

.bg-secondary {
  background-color: var(--surface-card);
}

.bg-muted {
  background-color: var(--surface-elevated);
}

.bg-muted\/20 {
  background-color: rgba(255, 255, 255, 0.03);
}

.bg-muted\/30 {
  background-color: rgba(255, 255, 255, 0.05);
}

.bg-muted\/40 {
  background-color: rgba(255, 255, 255, 0.07);
}

[data-theme="light"] .bg-muted\/20 {
  background-color: rgba(0, 0, 0, 0.02);
}

[data-theme="light"] .bg-muted\/30 {
  background-color: rgba(0, 0, 0, 0.04);
}

[data-theme="light"] .bg-muted\/40 {
  background-color: rgba(0, 0, 0, 0.06);
}

/* Borders & Rounding */
.border {
  border: 1px solid var(--border-subtle);
}

.border-2 {
  border: 2px solid var(--border-subtle);
}

.border-b {
  border-bottom: 1px solid var(--border-subtle);
}

.border-t {
  border-top: 1px solid var(--border-subtle);
}

.border-primary {
  border-color: var(--accent-color);
}

.border-primary\/30 {
  border-color: rgba(var(--accent-rgb), 0.3);
}

.rounded {
  border-radius: var(--radius-sm);
}

.rounded-sm {
  border-radius: var(--radius-xs);
}

.rounded-md {
  border-radius: var(--radius-md);
}

.rounded-lg {
  border-radius: var(--radius-lg);
}

.rounded-full {
  border-radius: var(--radius-full);
}

/* Position & Overflow */
.relative {
  position: relative;
}

.absolute {
  position: absolute;
}

.fixed {
  position: fixed;
}

.overflow-hidden {
  overflow: hidden;
}

.overflow-x-auto {
  overflow-x: auto;
}

.overflow-y-auto {
  overflow-y: auto;
}

.cursor-pointer {
  cursor: pointer;
}

.cursor-grab {
  cursor: grab;
}

.transition {
  transition: all var(--transition-fast);
}

.shadow-sm {
  box-shadow: var(--shadow-sm);
}

.shadow-md {
  box-shadow: var(--shadow-md);
}

.shadow-lg {
  box-shadow: var(--shadow-lg);
}

.hover\:shadow-md:hover {
  box-shadow: var(--shadow-md);
}

.hover\:shadow-lg:hover {
  box-shadow: var(--shadow-lg);
}

.hover\:underline:hover {
  text-decoration: underline;
}

.hover\:border-primary:hover {
  border-color: var(--accent-color);
}

/* Spinners */
.spinner-sm {
  display: inline-block;
  width: 16px;
  height: 16px;
  border: 2px solid var(--border-medium);
  border-top-color: var(--accent-color);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  vertical-align: middle;
}

@keyframes spin {
  100% {
    transform: rotate(360deg);
  }
}

/* Modal Detail Sheet Layout Helpers */
.modal-stat-box {
  background-color: var(--surface-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 10px;
  text-align: center;
  transition: all var(--transition-fast);
}

.modal-stat-box:hover {
  border-color: var(--border-medium);
  background-color: var(--surface-hover);
}

.modal-section-box {
  background-color: var(--surface-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 16px;
}

.modal-info-box {
  background-color: var(--surface-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 14px;
}

.danger-zone-box {
  margin-top: 24px;
  padding: 16px;
  border: 1px dashed rgba(239, 68, 68, 0.4);
  border-radius: var(--radius-md);
  background: rgba(239, 68, 68, 0.05);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

[x-cloak] {
  display: none !important;
}


/* --------------------------------------------------------------------------
   Markdown & Prose Formatting (Fichas de Juegos, Reglas y Mecánicas)
   -------------------------------------------------------------------------- */
.markdown-content,
.prose {
  color: var(--text-foreground);
  font-size: 0.925rem;
  line-height: 1.65;
  word-break: break-word;
}

.markdown-content>*:first-child,
.prose>*:first-child {
  margin-top: 0 !important;
}

.markdown-content>*:last-child,
.prose>*:last-child {
  margin-bottom: 0 !important;
}

.markdown-content p,
.prose p {
  margin-top: 0;
  margin-bottom: 0.75rem;
  line-height: 1.65;
}

.markdown-content h1,
.markdown-content h2,
.markdown-content h3,
.markdown-content h4,
.markdown-content h5,
.markdown-content h6,
.prose h1,
.prose h2,
.prose h3,
.prose h4,
.prose h5,
.prose h6 {
  color: var(--text-primary);
  font-weight: 800;
  line-height: 1.3;
  margin-top: 1.25rem;
  margin-bottom: 0.5rem;
  letter-spacing: -0.015em;
}

.markdown-content h1,
.prose h1 {
  font-size: 1.35rem;
}

.markdown-content h2,
.prose h2 {
  font-size: 1.18rem;
  padding-bottom: 0.25rem;
  border-bottom: 1px solid var(--border-subtle);
}

.markdown-content h3,
.prose h3 {
  font-size: 1.05rem;
  color: var(--accent-text);
}

.markdown-content h4,
.prose h4 {
  font-size: 0.95rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-primary);
  font-weight: 700;
}

.markdown-content h5,
.markdown-content h6,
.prose h5,
.prose h6 {
  font-size: 0.875rem;
  color: var(--text-muted);
}

.markdown-content strong,
.prose strong {
  font-weight: 700;
  color: var(--text-primary);
}

.markdown-content em,
.prose em {
  font-style: italic;
  color: var(--text-secondary);
}

.markdown-content a,
.prose a {
  color: var(--accent-text);
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-color: var(--accent-subtle);
  transition: all var(--transition-fast);
}

.markdown-content a:hover,
.prose a:hover {
  color: var(--accent-text-hover);
  text-decoration-color: var(--accent-color);
}

.markdown-content ul,
.markdown-content ol,
.prose ul,
.prose ol {
  margin-top: 0.4rem;
  margin-bottom: 0.75rem;
  padding-left: 1.4rem;
}

.markdown-content ul,
.prose ul {
  list-style-type: disc;
}

.markdown-content ol,
.prose ol {
  list-style-type: decimal;
}

.markdown-content li,
.prose li {
  margin-bottom: 0.35rem;
  line-height: 1.6;
  color: var(--text-foreground);
}

.markdown-content ul>li::marker,
.prose ul>li::marker {
  color: var(--accent-text);
}

.markdown-content ol>li::marker,
.prose ol>li::marker {
  color: var(--accent-text);
  font-weight: 700;
}

.markdown-content ul ul,
.markdown-content ol ol,
.markdown-content ul ol,
.markdown-content ol ul,
.prose ul ul,
.prose ol ol,
.prose ul ol,
.prose ol ul {
  margin-top: 0.25rem;
  margin-bottom: 0.25rem;
  padding-left: 1.25rem;
}

.markdown-content blockquote,
.prose blockquote {
  margin: 0.75rem 0;
  padding: 0.65rem 1rem;
  background: var(--accent-subtle);
  border-left: 3px solid var(--accent-color);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  color: var(--text-secondary);
  font-size: 0.875rem;
  line-height: 1.6;
}

.markdown-content blockquote p,
.prose blockquote p {
  margin-bottom: 0.35rem;
}

.markdown-content blockquote p:last-child,
.prose blockquote p:last-child {
  margin-bottom: 0;
}

.markdown-content hr,
.prose hr {
  border: 0;
  height: 1px;
  background: var(--border-medium);
  margin: 1.25rem 0;
}

.markdown-content table,
.prose table {
  width: 100%;
  border-collapse: collapse;
  margin: 0.75rem 0;
  font-size: 0.85rem;
}

.markdown-content th,
.markdown-content td,
.prose th,
.prose td {
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--border-subtle);
  text-align: left;
}

.markdown-content th,
.prose th {
  background: var(--surface-elevated);
  font-weight: 700;
  color: var(--text-primary);
}

.markdown-content tr:nth-child(even) td,
.prose tr:nth-child(even) td {
  background: rgba(255, 255, 255, 0.02);
}

.markdown-content code,
.prose code {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.825em;
  padding: 0.15em 0.35em;
  border-radius: var(--radius-xs);
  background: var(--surface-elevated);
  border: 1px solid var(--border-subtle);
  color: var(--accent-text);
}

.markdown-content pre,
.prose pre {
  margin: 0.75rem 0;
  padding: 0.75rem 1rem;
  border-radius: var(--radius-md);
  background: var(--surface-elevated);
  border: 1px solid var(--border-subtle);
  overflow-x: auto;
}

.markdown-content pre code,
.prose pre code {
  padding: 0;
  background: transparent;
  border: 0;
}

/* Modal Compact Modifier */
.markdown-content.text-xs,
.prose.text-xs {
  font-size: 0.8rem;
  line-height: 1.55;
}

.markdown-content.text-xs h1,
.prose.text-xs h1 {
  font-size: 1.15rem;
}

.markdown-content.text-xs h2,
.prose.text-xs h2 {
  font-size: 1.05rem;
}

.markdown-content.text-xs h3,
.prose.text-xs h3 {
  font-size: 0.95rem;
}

.markdown-content.text-xs h4,
.prose.text-xs h4 {
  font-size: 0.85rem;
}

.markdown-content.text-xs blockquote,
.prose.text-xs blockquote {
  padding: 0.5rem 0.75rem;
  font-size: 0.775rem;
}

/* ==========================================================================
   Category Sidebar & Subcategory Navigation System
   ========================================================================== */
.catalog-with-sidebar-layout {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 1.5rem;
  align-items: start;
  transition: all var(--transition-normal);
}

.catalog-with-sidebar-layout.sidebar-collapsed {
  grid-template-columns: 1fr;
}

@media (max-width: 1024px) {
  .catalog-with-sidebar-layout {
    grid-template-columns: 1fr;
    gap: 1rem;
  }
}

.catalog-category-sidebar {
  background: var(--surface-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 1rem;
  position: sticky;
  top: 1.5rem;
  max-height: calc(100vh - 3rem);
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-sm);
  transition: opacity var(--transition-fast), transform var(--transition-fast);
}

.catalog-category-sidebar[style*="display: none"] {
  display: none !important;
}

.category-sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 0.75rem;
  margin-bottom: 0.75rem;
  border-bottom: 1px solid var(--border-subtle);
}

.category-tree-nav {
  overflow-y: auto;
  padding-right: 0.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.category-tree-nav::-webkit-scrollbar {
  width: 4px;
}

.category-tree-nav::-webkit-scrollbar-thumb {
  background: var(--border-medium);
  border-radius: 4px;
}

.category-nav-link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.45rem 0.65rem;
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 0.825rem;
  font-weight: 600;
  text-decoration: none;
  transition: all var(--transition-fast);
}

.category-nav-link:hover {
  background: var(--nav-hover-bg);
  color: var(--accent-text);
}

.category-nav-link.active {
  background: var(--nav-active-bg);
  color: var(--accent-text);
  border-left: 3px solid var(--accent-color);
}

.category-nav-badge {
  font-size: 0.7rem;
  padding: 0.15rem 0.45rem;
  border-radius: var(--radius-full);
  background: var(--surface-elevated);
  color: var(--text-muted);
  font-weight: 600;
}

.category-tree-list {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  margin-top: 0.35rem;
}

.category-tree-node {
  display: flex;
  flex-direction: column;
}

.category-node-row {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  border-radius: var(--radius-sm);
  transition: background var(--transition-fast);
}

.category-node-row:hover {
  background: var(--nav-hover-bg);
}

.category-node-row.active {
  background: var(--nav-active-bg);
}

.category-collapse-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 0.35rem 0.25rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-xs);
  transition: color var(--transition-fast);
}

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

.category-collapse-spacer {
  width: 1.25rem;
  display: inline-block;
}

.category-node-link {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.4rem 0.45rem 0.4rem 0.1rem;
  color: var(--text-primary);
  text-decoration: none;
  font-size: 0.8rem;
  font-weight: 500;
  min-width: 0;
}

.category-node-row.active .category-node-link {
  color: var(--accent-text);
  font-weight: 600;
}

.category-name-text {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.category-count-badge {
  font-size: 0.675rem;
  padding: 0.1rem 0.4rem;
  border-radius: var(--radius-full);
  background: var(--surface-elevated);
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
  margin-left: 0.5rem;
  flex-shrink: 0;
}

.category-children-list {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  margin-left: 1.4rem;
  padding-left: 0.4rem;
  border-left: 1px dashed var(--border-medium);
  margin-top: 0.15rem;
  margin-bottom: 0.25rem;
}

.category-sub-link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.3rem 0.5rem;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 0.775rem;
  transition: all var(--transition-fast);
}

.category-sub-link:hover {
  background: var(--nav-hover-bg);
  color: var(--text-primary);
}

.category-sub-link.active {
  background: var(--nav-active-bg);
  color: var(--accent-text);
  font-weight: 600;
}

.category-sub-bullet {
  color: var(--text-muted);
  font-size: 0.75rem;
  margin-right: 0.35rem;
}

.category-sub-text {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.category-sub-badge {
  font-size: 0.65rem;
  padding: 0.05rem 0.35rem;
  border-radius: var(--radius-full);
  background: var(--surface-base);
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
  margin-left: 0.35rem;
  flex-shrink: 0;
}

/* Category Management Modal Styling */
.category-manage-tree {
  max-height: 400px;
  overflow-y: auto;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 0.75rem;
  background: var(--surface-base);
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.category-manage-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.45rem 0.65rem;
  border-radius: var(--radius-sm);
  background: var(--surface-card);
  border: 1px solid var(--border-subtle);
}

.category-manage-subitem {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.35rem 0.55rem;
  border-radius: var(--radius-sm);
  background: var(--surface-elevated);
  border: 1px solid var(--border-subtle);
  margin-left: 1.5rem;
}

.freshness-hint-badge {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.45rem 0.75rem;
  border-radius: var(--radius-sm);
  background: rgba(var(--accent-rgb), 0.08);
  border-left: 3px solid var(--accent-color);
  font-size: 0.775rem;
  color: var(--text-secondary);
}

/* ==========================================================================
   20. Mobile Usability & Comprehensive Touch Adaptation (PWA / Mobile Web)
   ========================================================================== */

/* --------------------------------------------------------------------------
   20.1 Mobile Bottom Navigation Bar (Tab Bar)
   -------------------------------------------------------------------------- */
.mobile-bottom-nav {
  display: none;
}

@media (max-width: 900px) {
  body {
    padding-bottom: calc(64px + env(safe-area-inset-bottom, 0px)) !important;
  }

  .mobile-bottom-nav {
    display: flex;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: calc(56px + env(safe-area-inset-bottom, 0px));
    padding-bottom: env(safe-area-inset-bottom, 0px);
    background: var(--surface-card);
    border-top: 1px solid var(--border-medium);
    box-shadow: 0 -4px 16px rgba(0, 0, 0, 0.25);
    z-index: 45;
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    align-items: stretch;
    justify-content: space-around;
  }

  .bottom-nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    flex: 1;
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.68rem;
    font-weight: 600;
    gap: 3px;
    transition: all var(--transition-fast);
    padding: 4px 2px;
    min-width: 0;
    -webkit-tap-highlight-color: transparent;
  }

  .bottom-nav-item:hover,
  .bottom-nav-item:focus {
    color: var(--text-primary);
    text-decoration: none;
  }

  .bottom-nav-item.active {
    color: var(--accent-text);
  }

  .bottom-nav-item.active .icon {
    stroke-width: 2.4px;
    transform: translateY(-1px);
    filter: drop-shadow(0 0 6px rgba(var(--accent-rgb), 0.5));
  }

  .bottom-nav-item span {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
  }

  /* Center Emergency Button in Bottom Bar */
  .bottom-nav-emergency {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    flex: 1;
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 0 4px;
    color: var(--text-secondary);
    font-size: 0.68rem;
    font-weight: 700;
    gap: 2px;
    position: relative;
    top: -10px;
    -webkit-tap-highlight-color: transparent;
  }

  .bottom-nav-emergency-bubble {
    width: 44px;
    height: 44px;
    border-radius: var(--radius-full);
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 14px rgba(239, 68, 68, 0.45);
    border: 2px solid var(--surface-card);
    transition: transform 0.15s ease;
  }

  .bottom-nav-emergency:active .bottom-nav-emergency-bubble {
    transform: scale(0.92);
  }

  .bottom-nav-emergency span {
    color: #ef4444;
  }
}

/* --------------------------------------------------------------------------
   20.2 Sidebar Header & Mobile Drawer Improvements
   -------------------------------------------------------------------------- */
.sidebar-header-right {
  display: flex;
  align-items: center;
  gap: 6px;
}

.mobile-sidebar-close-btn {
  display: none;
  background: var(--surface-elevated);
  border: 1px solid var(--border-medium);
  color: var(--text-secondary);
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 0;
  transition: all var(--transition-fast);
}

.mobile-sidebar-close-btn:hover {
  color: var(--text-primary);
  border-color: var(--border-strong);
}

.sidebar-accent-section {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 12px;
  padding: 10px;
  background: var(--surface-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
}

.sidebar-accent-label {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
}

@media (max-width: 900px) {
  .mobile-sidebar-close-btn {
    display: inline-flex;
  }

  .sidebar {
    z-index: 60 !important;
    width: 290px;
    max-width: 85vw;
    transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1) !important;
  }

  .sidebar-backdrop {
    z-index: 55 !important;
  }
}

/* --------------------------------------------------------------------------
   20.3 Top Bar Mobile Responsive Behavior
   -------------------------------------------------------------------------- */
@media (max-width: 768px) {
  .top-bar {
    height: 56px;
    padding: 0 12px;
  }

  .top-bar-title-group {
    gap: 8px;
    min-width: 0;
  }

  .top-bar-title {
    font-size: 0.95rem;
    font-weight: 700;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 170px;
  }

  .top-bar-actions {
    gap: 6px;
  }

  .accent-switcher {
    display: none;
  }

  .user-pill {
    padding: 4px 6px !important;
  }

  .user-pill span {
    display: none !important;
  }

  .desktop-only {
    display: none !important;
  }
}

@media (max-width: 480px) {
  .top-bar-title {
    max-width: 120px;
  }
}

/* --------------------------------------------------------------------------
   20.4 iOS Auto-Zoom Prevention & Touch Form Ergonomics
   -------------------------------------------------------------------------- */
@media (max-width: 768px) {
  input[type="text"],
  input[type="search"],
  input[type="number"],
  input[type="email"],
  input[type="password"],
  input[type="url"],
  select,
  textarea,
  .form-input,
  .form-select,
  .form-control {
    font-size: 16px !important; /* Prevents unwanted iOS Safari viewport zoom */
    min-height: 42px;
    border-radius: var(--radius-md);
  }

  .btn {
    min-height: 38px;
    padding: 8px 14px;
    -webkit-tap-highlight-color: transparent;
  }

  .btn-sm {
    min-height: 36px;
    padding: 6px 12px;
  }

  .btn-xs {
    min-height: 32px;
    padding: 4px 10px;
  }

  /* Star rating buttons touch area */
  .rating-star-btn,
  .rate-star {
    min-width: 36px;
    min-height: 36px;
    padding: 4px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }
}

/* --------------------------------------------------------------------------
   20.5 Tabs & Horizontal Nav Bar with Visible Micro-Scrollbar
   -------------------------------------------------------------------------- */
.tabs-nav,
.overflow-x-auto,
.table-responsive,
.table-container,
.horizontal-scroll,
.discover-status-scroll,
#game-modal-tabs {
  scrollbar-width: thin;
  scrollbar-color: var(--accent-color) rgba(var(--accent-rgb), 0.12);
  -webkit-overflow-scrolling: touch;
}

.tabs-nav::-webkit-scrollbar,
.overflow-x-auto::-webkit-scrollbar,
.table-responsive::-webkit-scrollbar,
.table-container::-webkit-scrollbar,
.horizontal-scroll::-webkit-scrollbar,
.discover-status-scroll::-webkit-scrollbar,
#game-modal-tabs::-webkit-scrollbar,
table.table::-webkit-scrollbar,
table.data-table::-webkit-scrollbar {
  height: 5px !important;
  width: 5px !important;
  display: block !important;
}

.tabs-nav::-webkit-scrollbar-track,
.overflow-x-auto::-webkit-scrollbar-track,
.table-responsive::-webkit-scrollbar-track,
.table-container::-webkit-scrollbar-track,
.horizontal-scroll::-webkit-scrollbar-track,
.discover-status-scroll::-webkit-scrollbar-track,
#game-modal-tabs::-webkit-scrollbar-track,
table.table::-webkit-scrollbar-track,
table.data-table::-webkit-scrollbar-track {
  background: rgba(var(--accent-rgb), 0.08);
  border-radius: var(--radius-full);
  margin: 0 4px;
}

.tabs-nav::-webkit-scrollbar-thumb,
.overflow-x-auto::-webkit-scrollbar-thumb,
.table-responsive::-webkit-scrollbar-thumb,
.table-container::-webkit-scrollbar-thumb,
.horizontal-scroll::-webkit-scrollbar-thumb,
.discover-status-scroll::-webkit-scrollbar-thumb,
#game-modal-tabs::-webkit-scrollbar-thumb,
table.table::-webkit-scrollbar-thumb,
table.data-table::-webkit-scrollbar-thumb {
  background: var(--accent-color);
  border-radius: var(--radius-full);
  opacity: 0.8;
}

.tabs-nav::-webkit-scrollbar-thumb:hover,
.overflow-x-auto::-webkit-scrollbar-thumb:hover,
.table-responsive::-webkit-scrollbar-thumb:hover,
.table-container::-webkit-scrollbar-thumb:hover,
.horizontal-scroll::-webkit-scrollbar-thumb:hover,
.discover-status-scroll::-webkit-scrollbar-thumb:hover,
#game-modal-tabs::-webkit-scrollbar-thumb:hover,
table.table::-webkit-scrollbar-thumb:hover,
table.data-table::-webkit-scrollbar-thumb:hover {
  background: var(--accent-hover);
}

.tabs-nav {
  display: flex;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  gap: 8px;
  border-bottom: 1px solid var(--border-subtle);
  padding-bottom: 8px;
  margin-bottom: 18px;
}

.tab-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-secondary);
  font-size: 0.825rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: all var(--transition-fast);
  -webkit-tap-highlight-color: transparent;
}

.tab-btn:hover {
  color: var(--text-primary);
  background: var(--surface-hover);
}

.tab-btn.active {
  color: var(--accent-text);
  background: rgba(var(--accent-rgb), 0.12);
  border-color: rgba(var(--accent-rgb), 0.35);
  font-weight: 700;
}

/* --------------------------------------------------------------------------
   20.6 Modals as Native Bottom Sheets on Mobile
   -------------------------------------------------------------------------- */
@media (max-width: 640px) {
  .modal-overlay {
    padding: 0 !important;
    align-items: flex-end !important;
    justify-content: center !important;
  }

  .modal-dialog,
  dialog.modal-dialog {
    width: 100% !important;
    max-width: 100% !important;
    max-height: 90vh !important;
    border-bottom-left-radius: 0 !important;
    border-bottom-right-radius: 0 !important;
    border-top-left-radius: 20px !important;
    border-top-right-radius: 20px !important;
    border-bottom: none !important;
    border-left: none !important;
    border-right: none !important;
    margin: 0 !important;
    inset: auto 0 0 0 !important;
    box-shadow: 0 -8px 30px rgba(0, 0, 0, 0.45) !important;
    animation: sheet-enter 0.22s cubic-bezier(0.16, 1, 0.3, 1) !important;
  }

  /* Native Drag Bar Handle at Top of Bottom Sheet */
  .modal-dialog::before,
  dialog.modal-dialog::before {
    content: "";
    display: block;
    width: 38px;
    height: 4px;
    background: var(--border-medium);
    border-radius: var(--radius-full);
    margin: 8px auto 4px auto;
  }

  .modal-header-clean {
    padding: 12px 16px !important;
  }

  .modal-body-clean {
    padding: 14px 16px !important;
    max-height: calc(90vh - 70px);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }

  .btn-close {
    min-width: 40px !important;
    min-height: 40px !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
  }
}

@keyframes sheet-enter {
  from {
    transform: translateY(100%);
  }
  to {
    transform: translateY(0);
  }
}

/* --------------------------------------------------------------------------
   20.7 Table & Container Overflow Protections
   -------------------------------------------------------------------------- */
.table-responsive,
.overflow-x-auto {
  display: block;
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

@media (max-width: 768px) {
  table.table,
  table.data-table {
    display: block;
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    white-space: nowrap;
  }

  table.table th,
  table.table td {
    padding: 8px 10px;
    font-size: 0.78rem;
  }
}

/* --------------------------------------------------------------------------
   20.8 Action Toast Mobile Float
   -------------------------------------------------------------------------- */
@media (max-width: 900px) {
  #action-toast-slot {
    bottom: calc(66px + env(safe-area-inset-bottom, 0px)) !important;
    right: 12px !important;
    left: 12px !important;
    max-width: calc(100vw - 24px) !important;
  }
}

/* --------------------------------------------------------------------------
   20.9 Page-Specific Layout Fine-Tuning
   -------------------------------------------------------------------------- */
@media (max-width: 768px) {
  .welcome-banner {
    padding: 16px !important;
    flex-direction: column;
    align-items: stretch;
    gap: 14px;
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
    overflow: hidden !important;
  }

  .welcome-banner-title {
    font-size: 1.15rem !important;
    word-break: break-word;
  }

  .welcome-banner-text {
    font-size: 0.825rem !important;
    word-break: break-word;
    line-height: 1.45;
  }

  .welcome-banner-actions {
    display: flex;
    flex-direction: column;
    gap: 8px;
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
  }

  .welcome-banner-actions .btn {
    width: 100% !important;
    min-width: 0 !important;
    max-width: 100% !important;
    justify-content: center;
    white-space: normal !important;
    text-align: center;
    padding: 10px 14px !important;
    font-size: 0.85rem;
    box-sizing: border-box !important;
    overflow: hidden;
  }
}

@media (min-width: 520px) and (max-width: 768px) {
  .welcome-banner-actions {
    display: grid !important;
    grid-template-columns: 1fr 1fr !important;
    gap: 8px;
  }
}

@media (max-width: 768px) {

  .catalog-category-sidebar {
    position: static !important;
    max-height: 380px !important;
    overflow-y: auto !important;
    margin-bottom: 12px !important;
  }

  .catalog-actions {
    width: 100%;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
  }

  .catalog-actions > * {
    flex: 1 1 auto;
    justify-content: center;
  }

  .curation-actions-bar .grid-cols-3 {
    gap: 6px !important;
  }

  .curation-actions-bar button {
    padding: 10px 4px !important;
  }

  .planner-sidebar-list,
  .collections-sidebar-list {
    max-height: 220px !important;
  }

  .discover-filter-row-1 {
    flex-wrap: wrap !important;
    gap: 10px !important;
  }

  .discover-filter-actions {
    width: 100% !important;
    justify-content: space-between !important;
    margin-left: 0 !important;
  }
}