/* ─── DESIGN TOKENS ──────────────────────────────────────────── */
:root {
  /* Tema oscuro por defecto (dark mode) */
  --bg-body:       #0b1220;
  --bg-panel:      #111827;
  --bg-card:       #1f2937;
  --bg-elevated:   #27344a;
  --bg-accent:     #334155;
  --bg-hover:      #2b3a55;
  --border:        #3b4a63;
  --border-subtle: #1f2937;
  
  /* Texto */
  --text-primary:  #f8fafc;
  --text-secondary:#cbd5e1;
  --text-muted:    #94a3b8;
  
  /* Colores de Acento - Azul/Menta */
  --primary:       #38bdf8;
  --primary-light: #7dd3fc;
  --primary-glow:  rgba(56, 189, 248, 0.3);
  --primary-hover: #0ea5e9;
  --primary-dim:   rgba(56, 189, 248, 0.15);
  --accent-mint:   #5eead4;
  --accent-cyan:   #22d3ee;
  
  /* Estados Soft */
  --success:       #86efac;
  --success-dim:   rgba(134, 239, 172, 0.15);
  --danger:        #fda4af;
  --danger-dim:    rgba(253, 164, 175, 0.15);
  --warning:       #fde047;
  --gold:          #fcd34d;
  
  /* Radios más redondeados para Soft UI */
  --radius-sm:     12px;
  --radius-md:     16px;
  --radius-lg:     24px;
  --radius-xl:     32px;
  
  /* Sombras suaves tipo Soft UI */
  --shadow-sm:     0 2px 8px rgba(0, 0, 0, 0.2);
  --shadow-md:     0 4px 20px rgba(0, 0, 0, 0.3);
  --shadow-lg:     0 8px 32px rgba(0, 0, 0, 0.4);
  --shadow-soft:   0 8px 32px rgba(0, 0, 0, 0.25);
  
  --transition:    0.3s cubic-bezier(0.4, 0, 0.2, 1);
  --font:          'Inter', system-ui, sans-serif;
  
  /* Responsive breakpoints */
  --mobile-max:    768px;
  --tablet-max:    1024px;
  --desktop-min:   1025px;
}

/* Tema claro Soft UI - Se aplica con .light class */
html.light,
body.light {
  /* Soft UI Azul/Menta - Colores Base */
  --bg-body:       #f0f9ff;
  --bg-panel:      #ffffff;
  --bg-card:       #f8fafc;
  --bg-elevated:   #f1f5f9;
  --bg-accent:     #e2e8f0;
  --bg-hover:      #e0f2fe;
  --border:        #e2e8f0;
  --border-subtle: #f1f5f9;
  
  /* Texto */
  --text-primary:  #1e293b;
  --text-secondary:#64748b;
  --text-muted:    #94a3b8;
  
  /* Colores de Acento - Azul/Menta */
  --primary:       #0ea5e9;
  --primary-light: #7dd3fc;
  --primary-glow:  rgba(14, 165, 233, 0.25);
  --primary-hover: #38bdf8;
  --primary-dim:   rgba(14, 165, 233, 0.12);
  --accent-mint:   #5eead4;
  --accent-cyan:   #22d3ee;
  
  /* Estados Soft */
  --success:       #86efac;
  --success-dim:   rgba(134, 239, 172, 0.15);
  --danger:        #fda4af;
  --danger-dim:    rgba(253, 164, 175, 0.15);
  --warning:       #fde047;
  --gold:          #fcd34d;
  
  /* Sombras suaves tipo Soft UI */
  --shadow-sm:     0 2px 8px rgba(14, 165, 233, 0.08);
  --shadow-md:     0 4px 20px rgba(14, 165, 233, 0.12);
  --shadow-lg:     0 8px 32px rgba(14, 165, 233, 0.16);
  --shadow-soft:   0 8px 32px rgba(0, 0, 0, 0.06);
}

/* ─── RESET ──────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

/* ─── LUCIDE ICONS ──────────────────────────────────────────── */
[data-lucide], svg.lucide {
  width: 16px;
  height: 16px;
  stroke-width: 2;
  flex-shrink: 0;
}

body {
  font-family: var(--font);
  background: var(--bg-body);
  color: var(--text-primary);
  height: 100vh;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ─── ACCESSIBILITY ─────────────────────────────────────────── */
.skip-link {
  position: absolute;
  left: -999px;
  top: 12px;
  background: var(--bg-panel);
  border: 1px solid var(--border);
  color: var(--text-primary);
  padding: 8px 12px;
  border-radius: 999px;
  z-index: 10001;
  text-decoration: none;
  box-shadow: var(--shadow-sm);
}
.skip-link:focus {
  left: 12px;
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

.noscript-banner {
  margin: 12px;
  padding: 10px 12px;
  border-radius: var(--radius-md);
  border: 1px solid rgba(253, 224, 71, 0.35);
  background: rgba(253, 224, 71, 0.14);
  color: var(--text-primary);
  font-size: 0.85rem;
  font-weight: 600;
  box-shadow: var(--shadow-sm);
}

/* Avoid theme/layout transition flashes on first load */
html:not(.theme-ready) *,
html:not(.theme-ready) *::before,
html:not(.theme-ready) *::after {
  transition: none !important;
}

/* ─── SCROLLBARS ─────────────────────────────────────────────── */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { 
  background: var(--border); 
  border-radius: 4px;
  transition: background var(--transition);
}
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* Firefox scrollbar */
* {
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}

/* ─── TOAST ──────────────────────────────────────────────────── */
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(80px);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  color: var(--text-primary);
  padding: 12px 24px;
  border-radius: var(--radius-xl);
  font-size: 0.875rem;
  font-weight: 500;
  z-index: 10000;
  opacity: 0;
  transition: opacity 0.35s cubic-bezier(.4,0,.2,1), transform 0.35s cubic-bezier(.4,0,.2,1);
  white-space: nowrap;
  box-shadow: var(--shadow-lg);
  backdrop-filter: blur(10px);
  max-width: 90vw;
  text-align: center;
  will-change: transform, opacity;
}
.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}
.toast.success { 
  border-color: var(--success); 
  color: var(--success);
  background: var(--success-dim);
}
.toast.error { 
  border-color: var(--danger);  
  color: var(--danger);
  background: var(--danger-dim);
}

/* ─── TOPBAR ─────────────────────────────────────────────────── */
.topbar {
  background: var(--bg-panel);
  border-bottom: none;
  box-shadow: var(--shadow-soft);
  padding: 0 24px;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  flex-shrink: 0;
  z-index: 100;
  transition: height 0.3s cubic-bezier(0.4, 0, 0.2, 1),
              padding 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Hamburger button - hidden by default, shown on mobile */
.hamburger-btn {
  display: none;
  width: 40px;
  height: 40px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  cursor: pointer;
  align-items: center;
  justify-content: center;
  transition: background var(--transition), color var(--transition), border-color var(--transition), transform var(--transition);
  padding: 0;
  flex-shrink: 0;
}

.hamburger-btn:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
  border-color: var(--primary);
}

.hamburger-btn [data-lucide] {
  width: 20px;
  height: 20px;
}

/* Search toggle button - hidden by default, shown on mobile */
.search-toggle-btn {
  display: none;
  width: 40px;
  height: 40px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  cursor: pointer;
  align-items: center;
  justify-content: center;
  transition: background var(--transition), color var(--transition), border-color var(--transition), transform var(--transition);
  padding: 0;
  flex-shrink: 0;
}

.search-toggle-btn:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
  border-color: var(--primary);
}

.search-toggle-btn [data-lucide] {
  width: 20px;
  height: 20px;
}

.logo { 
  display: flex; 
  align-items: center; 
  gap: 12px; 
  flex-shrink: 0;
  transition: gap 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
.logo-icon {
  width: 42px; height: 42px;
  background: linear-gradient(135deg, #0ea5e9, #5eead4);
  border-radius: var(--radius-md);
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 4px 15px rgba(14, 165, 233, 0.35);
  color: white;
}
.logo-icon [data-lucide] { width: 20px; height: 20px; }
.logo-text { 
  display: flex; 
  flex-direction: column; 
  line-height: 1.1;
  transition: opacity 0.3s cubic-bezier(0.4, 0, 0.2, 1),
              transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
.logo-name { font-weight: 800; font-size: 1.1rem; letter-spacing: -.3px; }
.logo-sub  { font-size: 0.7rem; color: var(--primary); font-weight: 600; text-transform: uppercase; letter-spacing: .5px; }

/* Global search bar */
.topbar-center { 
  flex: 1; 
  max-width: 520px; 
  position: relative;
  transition: opacity 0.3s cubic-bezier(0.4, 0, 0.2, 1),
              max-width 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
.search-bar-wrap {
  display: flex;
  align-items: center;
  background: var(--bg-elevated);
  border: 2px solid transparent;
  border-radius: 9999px;
  padding: 0 18px;
  gap: 10px;
  transition: border-color var(--transition), box-shadow var(--transition), background var(--transition);
}
.search-bar-wrap:focus-within {
  border-color: var(--primary);
  box-shadow: 0 0 0 4px var(--primary-dim);
  background: var(--bg-panel);
}
.search-icon { font-size: 0.9rem; color: var(--text-muted); }
.search-icon-svg { 
  color: var(--text-muted); 
  width: 16px; 
  height: 16px; 
  flex-shrink: 0;
  transition: color var(--transition);
}
.search-bar-wrap:focus-within .search-icon-svg {
  color: var(--primary);
}
.clear-search-btn [data-lucide] { width: 14px; height: 14px; }
.global-search {
  flex: 1;
  background: none;
  border: none;
  outline: none;
  color: var(--text-primary);
  font-size: 0.9rem;
  padding: 11px 0;
  font-family: var(--font);
}
.global-search::placeholder { color: var(--text-muted); }
.clear-search-btn {
  background: none; border: none; color: var(--text-muted);
  cursor: pointer; font-size: 0.75rem; padding: 5px;
  border-radius: 4px; transition: color var(--transition), background var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
}
.clear-search-btn:hover { 
  color: var(--text-primary); 
  background: var(--bg-hover);
}

/* Header actions */
.header-actions { 
  display: flex; 
  align-items: center; 
  gap: 10px; 
  flex-shrink: 0;
  transition: gap 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
.stat-chip {
  display: flex; flex-direction: column; align-items: center;
  background: linear-gradient(135deg, rgba(14, 165, 233, 0.1), rgba(94, 234, 212, 0.1));
  border: 1px solid rgba(14, 165, 233, 0.2);
  border-radius: 9999px;
  padding: 8px 18px;
  cursor: default;
  transition: padding 0.3s cubic-bezier(0.4, 0, 0.2, 1), box-shadow var(--transition);
  box-shadow: var(--shadow-sm);
}
.stat-num   { font-size: 1.1rem; font-weight: 700; color: var(--primary); line-height: 1; }
.stat-label { font-size: 0.65rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: .4px; }

.btn-icon {
  width: 42px; height: 42px;
  color: var(--text-secondary);
  background: var(--bg-panel);
  border: none;
  border-radius: 9999px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1rem;
  cursor: pointer;
  transition: background var(--transition), 
              color var(--transition), 
              transform var(--transition),
              box-shadow var(--transition),
              width 0.3s cubic-bezier(0.4, 0, 0.2, 1),
              height 0.3s cubic-bezier(0.4, 0, 0.2, 1),
              min-width 0.3s cubic-bezier(0.4, 0, 0.2, 1),
              min-height 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}
.btn-icon [data-lucide] {
  width: 18px;
  height: 18px;
}
.btn-icon::before {
  content: '';
  position: absolute;
  inset: 0;
  background: var(--primary);
  opacity: 0;
  transition: opacity var(--transition);
}
.btn-icon:hover::before {
  opacity: 0.1;
}
.btn-icon:hover { 
  background: var(--bg-hover); 
  transform: translateY(-1px);
  border-color: var(--primary);
  color: var(--text-primary);
}
.btn-icon:active {
  transform: translateY(0);
}
.btn-icon.danger:hover { 
  background: var(--danger-dim); 
  border-color: var(--danger);
  color: var(--danger);
}
.btn-icon.danger:hover::before {
  background: var(--danger);
}

.theme-toggle {
  width: 42px; height: 42px;
  background: var(--bg-panel);
  border: none;
  border-radius: 9999px;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  transition: var(--transition),
              width 0.3s cubic-bezier(0.4, 0, 0.2, 1),
              height 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  color: var(--text-secondary);
  box-shadow: var(--shadow-sm);
}
.theme-toggle [data-lucide] {
  width: 18px;
  height: 18px;
}
.theme-toggle:hover { background: var(--bg-hover); color: var(--text-primary); }
.lang-toggle {
  min-width: 42px;
  height: 42px;
  padding: 0 12px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--bg-panel);
  color: var(--text-secondary);
  font-weight: 700;
  font-size: 0.8rem;
  letter-spacing: 0.4px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
  box-shadow: var(--shadow-sm);
}
.lang-toggle:hover {
  color: var(--text-primary);
  background: var(--bg-hover);
  box-shadow: var(--shadow-md);
}

/* ─── LAYOUT ─────────────────────────────────────────────────── */
.layout { 
  display: flex; 
  flex: 1; 
  height: calc(100vh - 64px); 
  height: calc(100dvh - 64px);
  min-height: 0;
  overflow: hidden;
  transition: flex-direction 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ─── SIDEBAR ────────────────────────────────────────────────── */
.sidebar {
  width: 320px;
  min-width: 320px;
  background: var(--bg-panel);
  border-right: none;
  box-shadow: var(--shadow-soft);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1),
              min-width 0.3s cubic-bezier(0.4, 0, 0.2, 1),
              transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  z-index: 50;
}

.sidebar-header {
  padding: 18px 16px 12px;
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.sidebar-title-row {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text-primary);
  min-width: 0;
}
.sidebar-icon { width: 16px; height: 16px; color: var(--text-muted); }
.sidebar-header h3 { font-size: 0.95rem; font-weight: 700; letter-spacing: -0.2px; }
.sidebar-count {
  font-size: 0.78rem;
  color: var(--text-muted);
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  padding: 4px 10px;
  border-radius: 999px;
  white-space: nowrap;
}

.sidebar-tools {
  padding: 10px 14px;
  border-bottom: 1px solid var(--border-subtle);
  background: var(--bg-card);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}


.sidebar-section {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border-subtle);
  background: var(--bg-card);
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.sidebar-section label {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-primary);
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.sidebar-section .hint-text {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-weight: 500;
}

/* Flag Style Selector */
.flag-style-selector {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border-subtle);
  background: var(--bg-card);
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.flag-style-selector label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
}
.flag-style-selector label [data-lucide] {
  width: 16px;
  height: 16px;
  color: var(--primary);
}
.flag-style-select {
  width: 100%;
  background: var(--bg-elevated);
  border: 2px solid var(--border);
  color: var(--text-primary);
  border-radius: var(--radius-md);
  padding: 10px 12px;
  font-size: 0.9rem;
  font-family: var(--font);
  font-weight: 600;
  outline: none;
  cursor: pointer;
  transition: var(--transition);
}
.flag-style-select:hover {
  border-color: var(--primary);
  background: var(--bg-hover);
}
.flag-style-select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-dim);
}

/* Filters */
.filters {
  padding: 12px 14px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  border-bottom: 1px solid var(--border-subtle);
  background: var(--bg-card);
}
.filter-btn {
  background: var(--bg-panel);
  border: none;
  color: var(--text-secondary);
  padding: 8px 10px;
  border-radius: 9999px;
  font-size: 0.78rem;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
  font-family: var(--font);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  box-shadow: var(--shadow-sm);
  width: 100%;
}
.filter-btn [data-lucide] { width: 14px; height: 14px; }
.filter-btn:hover { 
  background: var(--bg-hover); 
  color: var(--text-primary);
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}
.filter-btn.active {
  background: linear-gradient(135deg, var(--primary), var(--accent-mint));
  color: white;
  border: none;
  box-shadow: 0 4px 15px rgba(14, 165, 233, 0.35);
}

/* Sort bar */
.sort-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border-subtle);
  background: var(--bg-card);
}
.sort-icon { width: 13px; height: 13px; color: var(--text-muted); flex-shrink: 0; }
.sort-select {
  flex: 1;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  color: var(--text-primary);
  border-radius: var(--radius-md);
  padding: 10px 12px;
  font-size: 0.85rem;
  font-weight: 600;
  font-family: var(--font);
  outline: none;
  cursor: pointer;
}
.sort-select:hover {
  border-color: var(--primary);
  background: var(--bg-hover);
}
.sort-select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-dim);
}

/* Library list */
.library-list {
  flex: 1;
  overflow-y: auto;
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

/* Item cards */
.item-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: var(--transition);
  user-select: none;
  box-shadow: 0 1px 6px rgba(0, 0, 0, 0.12);
}

/* Platforms mode: stronger contrast only in dark mode */
html.platforms-mode:not(.light) .library-list .item-card,
body.platforms-mode:not(.light) .library-list .item-card {
  background: #111827;
  border-color: #1f2937;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.35);
}
html.platforms-mode:not(.light) .library-list .item-card:hover,
body.platforms-mode:not(.light) .library-list .item-card:hover {
  background: #0f172a;
  border-color: #334155;
}
html.platforms-mode:not(.light) .library-list .item-name,
body.platforms-mode:not(.light) .library-list .item-name {
  color: #e5e7eb;
}
html.platforms-mode:not(.light) .library-list .item-tag,
body.platforms-mode:not(.light) .library-list .item-tag {
  color: #94a3b8;
}
html.platforms-mode:not(.light) .library-list .item-card.selected,
body.platforms-mode:not(.light) .library-list .item-card.selected {
  background: #0b1220;
  border-color: #38bdf8;
  box-shadow: 0 0 0 2px rgba(56, 189, 248, 0.35), 0 8px 22px rgba(0, 0, 0, 0.4);
}
.item-card:hover:not(.selected):not(.roster-item) {
  background: var(--bg-panel);
  border-color: var(--primary-dim);
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}
.item-card.selected {
  opacity: 0.7;
  cursor: not-allowed;
  box-shadow: 0 0 0 2px var(--primary-dim);
}
.item-card.roster-item {
  background: var(--bg-panel);
  box-shadow: var(--shadow-sm);
  cursor: default;
}
.item-card.roster-item:hover { 
  background: var(--bg-panel); 
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}
.item-card.roster-item.active-preview {
  box-shadow: 0 0 0 2px var(--primary), var(--shadow-md);
  background: var(--bg-panel);
}

.flag-img {
  width: 32px;
  height: 22px;
  object-fit: cover;
  border-radius: 4px;
  box-shadow: var(--shadow-sm);
  flex-shrink: 0;
}

.flag-img.square-style {
  width: 22px;
  height: 22px;
  border-radius: 6px;
  object-fit: cover;
  background: var(--bg-accent);
}

.platform-logo {
  object-fit: contain;
  box-sizing: border-box;
  padding: 3px;
  width: 32px;
  height: 32px;
  border-radius: 6px;
}

.roster-item .platform-logo {
  width: 22px;
  height: 22px;
  padding: 2px;
  border-radius: 4px;
}

.library-list.grid-view .platform-logo {
  width: 44px;
  height: 44px;
  padding: 4px;
  border-radius: 8px;
}
.item-name {
  flex: 1;
  font-size: 0.9rem;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.item-tag {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-family: 'Courier New', monospace;
  flex-shrink: 0;
}
.slot-num {
  font-weight: 700;
  font-size: 0.8rem;
  min-width: 22px;
  text-align: center;
  color: var(--primary);
  flex-shrink: 0;
}
.slot-del {
  background: none; border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 0.85rem;
  padding: 3px 5px;
  border-radius: var(--radius-sm);
  transition: var(--transition);
  flex-shrink: 0;
}
.slot-del:hover { color: var(--danger); background: var(--danger-dim); }

/* Sidebar header right */
.sidebar-header-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Mode toggle */
.mode-toggle {
  display: flex;
  gap: 2px;
  background: var(--bg-accent);
  border-radius: var(--radius-sm);
  padding: 2px;
}
.mode-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  padding: 4px 8px;
  border-radius: 4px;
  cursor: pointer;
  transition: var(--transition);
  font-size: 0.75rem;
  display: flex;
  align-items: center;
  gap: 4px;
}
.mode-btn [data-lucide] { width: 12px; height: 12px; }
.mode-btn:hover { color: var(--text-primary); background: var(--bg-hover); }
.mode-btn.active { background: var(--primary); color: white; }

/* View toggle */
.view-toggle {
  display: flex;
  gap: 2px;
  background: var(--bg-accent);
  border-radius: var(--radius-sm);
  padding: 2px;
}
.view-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  padding: 4px 6px;
  border-radius: 4px;
  cursor: pointer;
  transition: var(--transition);
  font-size: 0.75rem;
}
.view-btn [data-lucide] { width: 12px; height: 12px; }
.view-btn:hover { color: var(--text-primary); background: var(--bg-hover); }
.view-btn.active { background: var(--primary); color: white; }

/* Sidebar footer */
.sidebar-footer {
  padding: 10px 12px;
  border-top: 1px solid var(--border);
}
.btn-sm-primary {
  width: 100%;
  background: var(--primary-dim);
  color: var(--primary);
  border: 1px solid var(--primary);
  border-radius: var(--radius-md);
  padding: 8px;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  font-family: var(--font);
  display: flex; align-items: center; justify-content: center; gap: 6px;
}
.btn-sm-primary [data-lucide] { width: 14px; height: 14px; }
.btn-sm-primary:hover { background: var(--primary); color: white; }

/* ─── WORKSPACE ──────────────────────────────────────────────── */
.workspace {
  flex: 1;
  padding: 24px;
  overflow-y: auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 20px;
  background: var(--bg-body);
  transition: padding 0.3s cubic-bezier(0.4, 0, 0.2, 1),
              gap 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.workspace-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
  transition: flex-direction 0.3s cubic-bezier(0.4, 0, 0.2, 1),
              align-items 0.3s cubic-bezier(0.4, 0, 0.2, 1),
              gap 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
.workspace-title {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 1.4rem;
  font-weight: 700;
  letter-spacing: -.2px;
  transition: font-size 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
.title-badge {
  width: 44px; height: 44px;
  background: linear-gradient(135deg, #0ea5e9, #5eead4);
  border-radius: var(--radius-md);
  display: flex; align-items: center; justify-content: center;
  color: white;
  box-shadow: 0 4px 15px rgba(14, 165, 233, 0.35);
}
.title-badge [data-lucide] { width: 20px; height: 20px; }
.workspace-actions,
.roster-actions { 
  display: flex; 
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
  transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1),
              gap 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.btn-outline {
  background: var(--bg-panel);
  border: 1px solid var(--border);
  color: var(--text-primary);
  border-radius: 9999px;
  padding: 10px 18px;
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition),
              padding 0.3s cubic-bezier(0.4, 0, 0.2, 1),
              font-size 0.3s cubic-bezier(0.4, 0, 0.2, 1),
              flex 0.3s cubic-bezier(0.4, 0, 0.2, 1),
              min-width 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  font-family: var(--font);
  display: inline-flex; align-items: center; gap: 7px;
  text-decoration: none;
  box-shadow: 0 1px 6px rgba(0, 0, 0, 0.12);
}
.btn-outline [data-lucide] { width: 15px; height: 15px; }
.btn-outline:hover { 
  background: var(--bg-hover); 
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}
.btn-outline.danger:hover { 
  background: var(--danger-dim); 
  color: var(--danger); 
  border-color: var(--danger);
  box-shadow: 0 4px 12px rgba(253, 164, 175, 0.3);
}
.btn-outline:disabled { opacity: 0.4; cursor: not-allowed; }

.btn-outline-sm {
  background: var(--bg-panel);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  border-radius: 9999px;
  padding: 8px 14px;
  font-size: 0.8rem;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition),
              padding 0.3s cubic-bezier(0.4, 0, 0.2, 1),
              font-size 0.3s cubic-bezier(0.4, 0, 0.2, 1),
              flex 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  font-family: var(--font);
  display: inline-flex; align-items: center; gap: 6px;
  box-shadow: 0 1px 6px rgba(0, 0, 0, 0.12);
}
.btn-outline-sm [data-lucide] { width: 14px; height: 14px; }
.btn-outline-sm:hover { 
  background: var(--bg-hover); 
  color: var(--text-primary); 
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}
.btn-outline-sm.danger:hover { 
  background: var(--danger-dim); 
  color: var(--danger); 
  box-shadow: 0 4px 12px rgba(253, 164, 175, 0.3);
}

/* ─── CARDS ──────────────────────────────────────────────────── */
.workspace-content {
  display: flex;
  gap: 18px;
  flex: 0 0 auto;
  align-items: stretch;
  min-height: 0;
  transition: flex-direction 0.3s cubic-bezier(0.4, 0, 0.2, 1),
              gap 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.preview-card, .roster-card {
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-height: 0;
  box-shadow: var(--shadow-sm);
  transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1),
              max-height 0.3s cubic-bezier(0.4, 0, 0.2, 1),
              order 0.3s cubic-bezier(0.4, 0, 0.2, 1),
              box-shadow var(--transition);
}
.preview-card:hover, .roster-card:hover {
  box-shadow: var(--shadow-md);
}
.preview-card { 
  width: 420px; 
  flex-shrink: 0; 
}
.roster-card  { 
  flex: 1; 
}

/* ─── PREVIEW CARD ───────────────────────────────────────────── */
.preview-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 20px;
  border-bottom: 1px solid var(--border-subtle);
  background: var(--bg-panel);
}
.card-label-row { display: flex; align-items: center; gap: 10px; }
.card-icon { width: 18px; height: 18px; color: var(--primary); }
.card-label { font-size: 0.9rem; font-weight: 600; color: var(--text-primary); }
.preview-nav { display: flex; align-items: center; gap: 8px; }
.nav-btn {
  width: 36px; height: 36px;
  background: var(--bg-panel);
  border: none;
  border-radius: 9999px;
  color: var(--text-secondary);
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: var(--transition),
              min-width 0.3s cubic-bezier(0.4, 0, 0.2, 1),
              min-height 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: var(--shadow-sm);
}
.nav-btn [data-lucide] { width: 16px; height: 16px; }
.nav-btn:hover { 
  background: var(--bg-hover); 
  color: var(--text-primary); 
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}
.preview-idx { font-size: 0.8rem; color: var(--text-muted); min-width: 35px; text-align: center; }

.canvas-mount {
  background: var(--bg-panel);
  aspect-ratio: 1;
  position: relative;
  overflow: hidden;
  width: 100%;
  border-radius: var(--radius-md);
  margin: 0 20px 20px;
  width: calc(100% - 40px);
  box-shadow: inset 0 2px 8px rgba(0,0,0,0.3);
  transition: border-radius 0.3s ease;
}
.canvas-mount canvas {
  display: block;
  width: 100%;
  height: 100%;
  position: absolute;
  inset: 0;
  transition: filter 0.3s ease, border-radius 0.3s ease;
}

.canvas-placeholder {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  background: var(--bg-body);
  color: var(--text-muted);
  transition: opacity 0.3s;
}
.canvas-placeholder.hidden { display: none; }
.ph-icon-svg { width: 40px; height: 40px; opacity: 0.25; }
.ph-text  { font-size: 0.8rem; text-align: center; line-height: 1.6; opacity: 0.6; }

.preview-country-name {
  text-align: center;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-secondary);
  padding: 8px 16px;
  border-bottom: 1px solid var(--border-subtle);
  background: var(--bg-card);
  min-height: 34px;
}

/* Controls */
.controls-form {
  padding: 16px 16px 24px;
  margin-top: 12px;
  flex: 0 0 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 14px;
  overflow: visible;
  transition: max-height 0.3s cubic-bezier(0.4, 0, 0.2, 1),
              padding 0.3s cubic-bezier(0.4, 0, 0.2, 1),
              gap 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
.form-section-title {
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .8px;
  color: var(--text-muted);
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border-subtle);
  display: flex; align-items: center; gap: 8px;
}
.form-section-title [data-lucide] { width: 15px; height: 15px; }

/* Group long forms into collapsible sections */
.accordion {
  border: 1px solid var(--border-subtle);
  background: var(--bg-card);
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: 0 1px 8px rgba(0, 0, 0, 0.1);
}
.accordion-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 12px;
  cursor: pointer;
  user-select: none;
  list-style: none;
  color: var(--text-primary);
  background: linear-gradient(180deg, var(--bg-card), var(--bg-elevated));
}
.accordion-summary:hover {
  background: var(--bg-hover);
}
.accordion-summary:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}
.accordion-summary::-webkit-details-marker { display: none; }
.accordion-label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: .2px;
}
.accordion-label [data-lucide],
.accordion-label svg.lucide {
  width: 16px;
  height: 16px;
  color: var(--primary);
}
.accordion-chevron {
  width: 16px;
  height: 16px;
  color: var(--text-muted);
  transition: transform var(--transition), color var(--transition);
  flex-shrink: 0;
}
.accordion[open] .accordion-chevron {
  transform: rotate(180deg);
  color: var(--text-secondary);
}
.accordion-body {
  padding: 12px 12px 14px;
  border-top: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.control-row { display: flex; flex-direction: column; gap: 8px; }
.control-row label { font-size: 0.85rem; font-weight: 600; color: var(--text-secondary); display: flex; align-items: center; justify-content: space-between; }
.control-row-inline { flex-direction: row; align-items: center; justify-content: space-between; }
.control-row-inline label { font-size: 0.85rem; color: var(--text-secondary); }

.val-badge {
  background: var(--primary-dim);
  color: var(--primary);
  font-size: 0.75rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 999px;
}

/* Inputs Soft UI */
.control-row input[type=number],
.control-row select {
  width: 100%;
  padding: 12px 14px;
  border-radius: var(--radius-md);
  border: 2px solid transparent;
  background: var(--bg-elevated);
  color: var(--text-primary);
  font-size: 0.9rem;
  font-family: var(--font);
  outline: none;
  transition: var(--transition);
}
.control-row input[type=number]:focus,
.control-row select:focus {
  border-color: var(--primary);
  background: var(--bg-panel);
  box-shadow: 0 0 0 4px var(--primary-dim);
}

/* Slider Soft UI */
.slider {
  width: 100%;
  height: 8px;
  border-radius: 999px;
  background: var(--bg-accent);
  outline: none;
  cursor: pointer;
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  accent-color: var(--primary);
  transition: height 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
.slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 24px; height: 24px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--accent-mint));
  cursor: pointer;
  box-shadow: 0 2px 10px rgba(14, 165, 233, 0.4);
  transition: transform var(--transition),
              width 0.3s cubic-bezier(0.4, 0, 0.2, 1),
              height 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
.slider::-webkit-slider-thumb:hover { transform: scale(1.15); }

/* Input with hints */
.input-with-hint { display: flex; flex-direction: column; gap: 8px; }
.preset-btns { display: flex; gap: 6px; }
.preset-btn {
  flex: 1;
  background: var(--bg-panel);
  border: none;
  color: var(--text-secondary);
  border-radius: var(--radius-sm);
  padding: 8px 4px;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  font-family: var(--font);
  box-shadow: var(--shadow-sm);
}
.preset-btn:hover { 
  background: var(--bg-hover); 
  color: var(--primary); 
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}
.preset-btn.active { 
  background: linear-gradient(135deg, var(--primary), var(--accent-mint)); 
  color: white; 
  box-shadow: 0 4px 12px rgba(14, 165, 233, 0.35);
}

/* Color row */
.color-row { display: flex; align-items: center; gap: 12px; }
.color-row input[type=color] {
  width: 44px; height: 36px;
  border-radius: var(--radius-sm);
  border: 2px solid var(--border);
  background: none;
  cursor: pointer;
  padding: 0;
}
.color-labels { font-size: 0.75rem; color: var(--text-muted); }

/* Position grid */
.position-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  aspect-ratio: 3/1;
  transition: gap 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
.pos-btn {
  background: var(--bg-panel);
  border: none;
  color: var(--text-secondary);
  border-radius: var(--radius-sm);
  font-size: 1rem;
  cursor: pointer;
  transition: var(--transition),
              min-width 0.3s cubic-bezier(0.4, 0, 0.2, 1),
              min-height 0.3s cubic-bezier(0.4, 0, 0.2, 1),
              padding 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  padding: 10px;
  display: flex; align-items: center; justify-content: center;
  box-shadow: var(--shadow-sm);
}
.pos-btn:hover { 
  background: var(--bg-hover); 
  color: var(--text-primary); 
  box-shadow: var(--shadow-md);
}
.pos-btn.selected { 
  background: linear-gradient(135deg, var(--primary), var(--accent-mint)); 
  color: white; 
  box-shadow: 0 4px 12px rgba(14, 165, 233, 0.35);
}

/* Toggle switch Soft UI */
.toggle-switch { 
  position: relative; 
  display: inline-block; 
  width: 52px; 
  height: 30px; 
  flex-shrink: 0;
  transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1),
              height 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
.toggle-switch input { opacity: 0; width: 0; height: 0; }
.toggle-slider {
  position: absolute; inset: 0;
  background: var(--bg-accent);
  border-radius: 999px;
  cursor: pointer;
  transition: var(--transition);
  border: none;
  box-shadow: inset 0 2px 4px rgba(0,0,0,0.1);
}
.toggle-slider::before {
  content: '';
  position: absolute;
  width: 22px; height: 22px;
  left: 4px; top: 50%;
  transform: translateY(-50%);
  background: white;
  border-radius: 50%;
  transition: var(--transition);
  box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}
.toggle-switch input:checked + .toggle-slider { 
  background: linear-gradient(135deg, var(--primary), var(--accent-mint)); 
}
.toggle-switch input:checked + .toggle-slider::before { 
  transform: translateX(22px) translateY(-50%); 
}
.toggle-switch-tight {
  margin-left: 4px;
}

/* ─── ROSTER CARD ────────────────────────────────────────────── */
.roster-header {
  padding: 18px 22px;
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
  flex-shrink: 0;
  flex-wrap: wrap;
  transition: flex-direction 0.3s cubic-bezier(0.4, 0, 0.2, 1),
              align-items 0.3s cubic-bezier(0.4, 0, 0.2, 1),
              gap 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
.roster-title-group { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.roster-icon { width: 16px; height: 16px; color: var(--text-muted); flex-shrink: 0; }
.roster-title { font-size: 0.95rem; font-weight: 700; }
.roster-badge {
  background: linear-gradient(135deg, var(--primary-dim), rgba(94, 234, 212, 0.1));
  color: var(--primary);
  border: 1px solid rgba(14, 165, 233, 0.2);
  font-size: 0.75rem;
  font-weight: 700;
  padding: 2px 10px;
  border-radius: 999px;
  min-width: 26px;
  text-align: center;
}


.roster-list {
  flex: 1;
  overflow-y: auto;
  min-height: 0;
  -webkit-overflow-scrolling: touch;
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.empty-roster {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  color: var(--text-muted);
  padding: 40px;
  text-align: center;
}
.empty-roster .empty-icon { font-size: 3rem; opacity: 0.3; }
.empty-roster .empty-title { font-size: 0.9rem; font-weight: 600; }
.empty-roster .empty-sub { font-size: 0.8rem; opacity: 0.7; }

/* ─── EXPORT FOOTER ─────────────────────────────────────────── */
.export-footer {
  padding: 20px 24px;
  border-top: 1px solid var(--border-subtle);
  background: var(--bg-card);
  display: flex;
  flex-direction: column;
  gap: 16px;
  transition: padding 0.3s cubic-bezier(0.4, 0, 0.2, 1),
              gap 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
.export-options { 
  display: flex; 
  gap: 24px; 
  flex-wrap: wrap;
  transition: flex-direction 0.3s cubic-bezier(0.4, 0, 0.2, 1),
              gap 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
.option-check { display: flex; align-items: center; gap: 9px; font-size: 0.85rem; }
.option-check input[type=checkbox] { accent-color: var(--primary); width: 16px; height: 16px; cursor: pointer; }
.option-check code {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  padding: 1px 6px;
  border-radius: 3px;
  font-size: 0.8rem;
}

.export-buttons { 
  display: flex; 
  gap: 10px;
  transition: flex-direction 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.btn-primary {
  flex: 1;
  background: linear-gradient(135deg, var(--primary), var(--accent-mint));
  color: white;
  padding: 14px 24px;
  border: none;
  border-radius: 9999px;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  font-family: var(--font);
  box-shadow: 0 4px 15px rgba(14, 165, 233, 0.35);
}
.btn-primary [data-lucide] { width: 18px; height: 18px; }
.btn-primary:not(:disabled):hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 20px var(--primary-glow);
  filter: brightness(1.1);
}
.btn-primary:disabled { opacity: 0.45; cursor: not-allowed; box-shadow: none; }

.btn-secondary {
  background: var(--bg-panel);
  color: var(--text-primary);
  border: 1px solid var(--border);
  padding: 14px 18px;
  border-radius: 9999px;
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
  font-family: var(--font);
  display: inline-flex; align-items: center; gap: 9px;
  box-shadow: 0 1px 6px rgba(0, 0, 0, 0.12);
}
.btn-secondary [data-lucide] { width: 17px; height: 17px; }
.btn-secondary:not(:disabled):hover { background: var(--bg-hover); }
.btn-secondary:disabled { opacity: 0.4; cursor: not-allowed; }

.btn-icon-left { font-size: 1rem; }

/* Progress */
.progress-wrap { display: flex; flex-direction: column; gap: 8px; }
.progress-wrap.hidden { display: none; }
.progress-header { display: flex; justify-content: space-between; font-size: 0.85rem; color: var(--text-secondary); }
#progressPercent { color: var(--primary); font-weight: 700; }
.progress-bar {
  width: 100%; height: 8px;
  background: var(--bg-elevated);
  border-radius: 4px;
  overflow: hidden;
}
#progressFill {
  width: 0%;
  height: 100%;
  background: linear-gradient(90deg, var(--primary), var(--accent-mint));
  transition: width 0.3s ease;
  border-radius: 4px;
}

/* ─── MODAL ──────────────────────────────────────────────────── */
.modal { position: fixed; inset: 0; z-index: 1000; display: flex; align-items: center; justify-content: center; }
.modal.hidden { display: none; }
.modal-backdrop {
  position: absolute; inset: 0;
  background: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(12px);
}
.confirm-modal .modal-backdrop {
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(6px);
}
.modal-content {
  position: relative;
  background: var(--bg-panel);
  border: none;
  border-radius: var(--radius-xl);
  width: min(90vw, 900px);
  max-height: 80vh;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-lg), 0 25px 50px -12px rgba(14, 165, 233, 0.15);
  animation: modalIn 0.3s cubic-bezier(.4,0,.2,1);
  will-change: transform, opacity;
}
@keyframes modalIn { from { opacity:0; transform: scale(.95) translateY(10px); } to { opacity:1; transform: none; } }
.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 22px;
  border-bottom: 1px solid var(--border);
}
.modal-header h3 { font-size: 1.1rem; font-weight: 700; }
.modal-close {
  width: 38px; height: 38px;
  background: var(--bg-panel);
  border: none;
  border-radius: 9999px;
  color: var(--text-secondary);
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: var(--transition);
  box-shadow: var(--shadow-sm);
}
.modal-close [data-lucide] { width: 16px; height: 16px; }
.modal-close:hover { 
  background: var(--danger-dim); 
  color: var(--danger); 
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}
.modal-title-row { display: flex; align-items: center; gap: 10px; }
.modal-title-row [data-lucide] { width: 18px; height: 18px; color: var(--text-muted); }
.modal-body { flex: 1; overflow-y: auto; padding: 22px; }
.modal-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  margin-top: 18px;
}
.confirm-modal .modal-content {
  width: min(92vw, 520px);
  border-radius: 18px;
  background: var(--bg-panel);
  border: 1px solid rgba(255, 255, 255, 0.06);
}
.confirm-header {
  padding: 14px 18px;
}
.confirm-header h3 {
  font-size: 0.95rem;
  font-weight: 600;
  letter-spacing: 0.2px;
}
.confirm-body {
  padding: 16px 18px 18px;
}
.confirm-message {
  color: var(--text-primary);
  font-size: 0.92rem;
  line-height: 1.45;
}
.confirm-actions {
  justify-content: flex-end;
  gap: 10px;
}
.confirm-actions .btn-primary,
.confirm-actions .btn-outline {
  border-radius: 999px;
  padding: 8px 18px;
}
.share-desc {
  color: var(--text-secondary);
  font-size: 0.88rem;
  margin-bottom: 12px;
}
.share-meta {
  color: var(--text-muted);
  font-size: 0.78rem;
  margin: -6px 0 14px;
}
.share-link-row {
  display: flex;
  gap: 8px;
  align-items: center;
}
.share-link-input {
  flex: 1;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  color: var(--text-primary);
  border-radius: var(--radius-md);
  padding: 10px 12px;
  font-size: 0.8rem;
  font-family: var(--font);
  outline: none;
}
.share-link-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-dim);
}
.share-actions {
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
}
.share-actions-right {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.share-modal .btn-outline,
.share-modal .btn-secondary {
  border-radius: 999px;
}
.help-body {
  display: flex;
  flex-direction: column;
  gap: 18px;
}
.help-section h4 {
  margin: 0 0 6px;
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-primary);
}
.help-section p {
  margin: 0;
  color: var(--text-secondary);
  font-size: 0.9rem;
  line-height: 1.5;
}
.help-list {
  margin: 0;
  padding-left: 18px;
  color: var(--text-secondary);
  font-size: 0.9rem;
  line-height: 1.5;
  display: grid;
  gap: 6px;
}
.help-credit {
  margin-top: 8px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  border-radius: 999px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  color: var(--text-primary);
  font-weight: 600;
  font-size: 0.85rem;
}
.help-credit-link {
  color: var(--primary);
  text-decoration: none;
  font-weight: 700;
}
.help-credit-link:hover {
  text-decoration: underline;
}
.modal-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 12px;
}
.modal-item {
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  background: var(--bg-card);
  border: none;
  border-radius: var(--radius-md);
  padding: 12px;
  text-align: center;
  transition: var(--transition);
  box-shadow: var(--shadow-sm);
}
.modal-item:hover { 
  background: var(--bg-panel); 
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}
.modal-item img { width: 60px; height: 42px; object-fit: cover; border-radius: 4px; box-shadow: var(--shadow-sm); }
.modal-item img.square-style {
  width: 48px;
  height: 48px;
  border-radius: 10px;
  background: var(--bg-accent);
  object-fit: cover;
}
.modal-item img.platform-logo {
  object-fit: contain;
  box-sizing: border-box;
  padding: 6px;
  width: 60px;
  height: 60px;
  border-radius: 10px;
}
.modal-item .modal-num { font-weight: 800; color: var(--primary); font-size: 1.1rem; }
.modal-item .modal-name { font-size: 0.8rem; color: var(--text-secondary); }

/* ─── CANVAS CONTROLS ────────────────────────────────────────── */
.canvas-controls {
  position: absolute;
  top: 8px; right: 8px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  opacity: 0;
  transition: opacity var(--transition);
  z-index: 5;
}
.canvas-mount:hover .canvas-controls { opacity: 1; }
.canvas-btn {
  width: 32px; height: 32px;
  background: rgba(0,0,0,.55);
  border: 1px solid rgba(255,255,255,.15);
  border-radius: var(--radius-sm);
  color: #fff;
  font-size: 0.85rem;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: background var(--transition);
  backdrop-filter: blur(4px);
}
.canvas-btn:hover { background: rgba(47,129,247,.7); border-color: var(--primary); }
.canvas-btn:disabled { opacity: 0.4; cursor: not-allowed; }

/* ─── CANVAS COPY BUTTON (legacy) ────────────────────────────── */
.canvas-copy-btn {
  position: absolute;
  top: 8px; right: 8px;
  width: 32px; height: 32px;
  background: rgba(0,0,0,.55);
  border: 1px solid rgba(255,255,255,.15);
  border-radius: var(--radius-sm);
  color: #fff;
  font-size: 0.85rem;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  opacity: 0;
  transition: opacity var(--transition), background var(--transition);
  z-index: 5;
  backdrop-filter: blur(4px);
}
.canvas-mount:hover .canvas-copy-btn { opacity: 1; }
.canvas-copy-btn:hover { background: rgba(47,129,247,.7); border-color: var(--primary); }

/* ─── SHAPE BUTTONS ─────────────────────────────────────────── */
.shape-btns { display: flex; gap: 6px; }
.shape-btn {
  flex: 1;
  background: var(--bg-panel);
  border: none;
  color: var(--text-secondary);
  border-radius: var(--radius-sm);
  padding: 8px 4px;
  font-size: 1rem;
  cursor: pointer;
  transition: var(--transition);
  font-family: var(--font);
  box-shadow: var(--shadow-sm);
}
.shape-btn:hover { 
  background: var(--bg-hover); 
  color: var(--text-primary); 
  box-shadow: var(--shadow-md);
}
.shape-btn.selected { 
  background: linear-gradient(135deg, var(--primary), var(--accent-mint)); 
  color: white; 
  box-shadow: 0 4px 12px rgba(14, 165, 233, 0.35);
}

/* ─── HINT TEXT ─────────────────────────────────────────────── */
.hint-text {
  font-size: 0.68rem;
  color: var(--text-muted);
  font-weight: 400;
}

/* ─── DRAG HINT ─────────────────────────────────────────────── */
.drag-hint {
  font-size: 0.68rem;
  color: var(--text-muted);
  background: var(--bg-accent);
  padding: 2px 8px;
  border-radius: 999px;
  margin-left: 4px;
}
.drag-hint .drag-icon,
.drag-hint svg.lucide.drag-icon {
  width: 11px;
  height: 11px;
  margin-right: 4px;
  vertical-align: -2px;
}

/* ─── DRAG & DROP ───────────────────────────────────────────── */
.item-card.roster-item[draggable="true"] { cursor: grab; }
.item-card.roster-item[draggable="true"]:active { cursor: grabbing; }
.item-card.roster-item.drag-over {
  border-color: var(--primary);
  background: var(--primary-dim);
  transform: scale(1.01);
}
.item-card.roster-item.dragging {
  opacity: 0.35;
  transform: scale(0.97);
}
.drag-handle {
  color: var(--text-muted);
  font-size: 0.85rem;
  cursor: grab;
  padding: 0 4px;
  flex-shrink: 0;
  user-select: none;
}

/* ─── SHORTCUTS MODAL ───────────────────────────────────────── */
.modal-sm .modal-content,
.modal-sm { max-width: 480px; }
.modal-sm.modal .modal-content { width: min(90vw, 480px); }
.shortcuts-grid {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.shortcut-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  font-size: 0.82rem;
}
.shortcut-item span { color: var(--text-secondary); }
kbd {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 2px 7px;
  font-size: 0.75rem;
  font-family: monospace;
  color: var(--text-primary);
  box-shadow: 0 1px 0 var(--border);
}

/* ─── NUMBER START ──────────────────────────────────────────── */
.control-row input[type=number] {
  width: 100%;
  padding: 8px 10px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--text-primary);
  font-size: 0.83rem;
  font-family: var(--font);
  outline: none;
  transition: border-color var(--transition), box-shadow var(--transition);
  -moz-appearance: textfield;
}
.control-row input[type=number]::-webkit-outer-spin-button,
.control-row input[type=number]::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

/* ─── SEARCH DROPDOWN ────────────────────────────────────────── */
.search-dropdown {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  max-height: 320px;
  overflow-y: auto;
  z-index: 200;
}
.search-dropdown.hidden { display: none; }
.search-dropdown-list {
  display: flex;
  flex-direction: column;
}
.search-dropdown-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  cursor: pointer;
  transition: var(--transition);
  border-bottom: 1px solid var(--border-subtle);
}
.search-dropdown-item:last-child { border-bottom: none; }
.search-dropdown-item:hover,
.search-dropdown-item.active {
  background: var(--bg-hover);
}
.search-dropdown-item .dd-flag {
  width: 32px;
  height: 22px;
  object-fit: cover;
  border-radius: 3px;
  flex-shrink: 0;
}
.search-dropdown-item .dd-flag.platform-logo {
  object-fit: contain;
  box-sizing: border-box;
  padding: 2px;
  width: 32px;
  height: 32px;
  border-radius: 6px;
}
.search-dropdown-item .dd-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.search-dropdown-item .dd-name {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-primary);
}
.search-dropdown-item .dd-meta {
  display: flex;
  gap: 8px;
  font-size: 0.7rem;
  color: var(--text-muted);
}
.search-dropdown-item .dd-iso {
  font-family: 'Courier New', monospace;
  font-weight: 600;
}
.search-dropdown-item .dd-added {
  font-size: 0.7rem;
  color: var(--success);
  background: var(--success-dim);
  padding: 2px 8px;
  border-radius: 999px;
  flex-shrink: 0;
}
.search-dropdown-empty {
  padding: 20px;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.82rem;
}
.search-result-count {
  background: var(--primary-dim);
  color: var(--primary);
  font-size: 0.7rem;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 999px;
  min-width: 18px;
  text-align: center;
}

/* ─── CUSTOM TEXT INPUT ──────────────────────────────────────── */
.custom-text-input {
  width: 100%;
  padding: 8px 10px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--text-primary);
  font-size: 0.83rem;
  font-family: var(--font);
  outline: none;
  transition: border-color var(--transition), box-shadow var(--transition);
}
.custom-text-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-dim);
}

/* ─── RESET BUTTON ───────────────────────────────────────────── */
.reset-btn {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  border-radius: var(--radius-sm);
  padding: 3px 8px;
  font-size: 0.7rem;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
  font-family: var(--font);
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-left: auto;
}
.reset-btn [data-lucide] { width: 11px; height: 11px; }
.reset-btn:hover { background: var(--bg-hover); color: var(--text-primary); }

/* ─── PRESETS ROW ────────────────────────────────────────────── */
.presets-row {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.preset-chip {
  background: var(--bg-panel);
  border: none;
  color: var(--text-secondary);
  border-radius: 9999px;
  padding: 8px 14px;
  font-size: 0.75rem;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
  font-family: var(--font);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  box-shadow: var(--shadow-sm);
}
.preset-chip [data-lucide] { width: 13px; height: 13px; }
.preset-chip:hover { 
  background: var(--bg-hover); 
  color: var(--primary); 
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}
.preset-chip.active { 
  background: linear-gradient(135deg, var(--primary), var(--accent-mint)); 
  color: white; 
  box-shadow: 0 4px 15px rgba(14, 165, 233, 0.35);
}

/* ─── SEARCH DROPDOWN ───────────────────────────────────────── */
.topbar-center { position: relative; }
.search-result-count {
  font-size: 0.68rem;
  color: var(--text-muted);
  flex-shrink: 0;
  font-weight: 600;
  min-width: 20px;
  text-align: center;
}
.search-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  margin-top: 6px;
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg), 0 0 40px rgba(0,0,0,.3);
  z-index: 500;
  overflow: hidden;
  backdrop-filter: blur(16px);
  animation: dropdownIn 0.2s ease;
}
.search-dropdown.hidden { display: none; }
@keyframes dropdownIn {
  from { opacity: 0; transform: translateY(-8px) scale(0.98); }
  to   { opacity: 1; transform: none; }
}
.search-dropdown-list {
  max-height: 340px;
  overflow-y: auto;
  padding: 6px;
}
.search-dropdown-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: var(--transition);
}
.search-dropdown-item:hover,
.search-dropdown-item.active {
  background: var(--primary-dim);
}
.search-dropdown-item.active {
  border-left: 3px solid var(--primary);
}
.search-dropdown-item .dd-flag {
  width: 36px;
  height: 24px;
  object-fit: cover;
  border-radius: 4px;
  box-shadow: var(--shadow-sm);
  flex-shrink: 0;
}
.search-dropdown-item .dd-flag.square-style {
  width: 22px;
  height: 22px;
  border-radius: 6px;
  background: var(--bg-accent);
  object-fit: cover;
}
.search-dropdown-item .dd-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 1px;
}
.search-dropdown-item .dd-name {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-primary);
}
.search-dropdown-item .dd-meta {
  font-size: 0.7rem;
  color: var(--text-muted);
  display: flex;
  gap: 8px;
}
.search-dropdown-item .dd-iso {
  font-family: 'Courier New', monospace;
  color: var(--primary);
  font-weight: 700;
}
.search-dropdown-item .dd-continent {
  color: var(--text-muted);
}
.search-dropdown-item .dd-added {
  font-size: 0.68rem;
  color: var(--success);
  font-weight: 600;
  flex-shrink: 0;
  padding: 2px 8px;
  background: var(--success-dim);
  border-radius: 999px;
}
.search-dropdown-empty {
  padding: 20px;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.82rem;
}

/* ─── SIDEBAR HEADER RIGHT ──────────────────────────────────── */
.sidebar-header-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* ─── VIEW TOGGLE ───────────────────────────────────────────── */
.mode-toggle {
  display: flex;
  background: var(--bg-accent);
  border-radius: var(--radius-sm);
  overflow: hidden;
  border: 1px solid var(--border);
}
.mode-btn {
  height: 30px;
  min-width: 92px;
  padding: 0 10px;
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.2px;
  text-transform: none;
}
.mode-btn:hover { color: var(--text-primary); background: var(--bg-hover); }
.mode-btn.active { color: var(--primary); background: var(--primary-dim); }

.view-toggle {
  display: flex;
  background: var(--bg-accent);
  border-radius: var(--radius-sm);
  overflow: hidden;
  border: 1px solid var(--border);
}
.view-btn {
  width: 32px; height: 30px;
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
}
.view-btn [data-lucide] { width: 15px; height: 15px; }
.view-btn:hover { color: var(--text-primary); background: var(--bg-hover); }
.view-btn.active { color: var(--primary); background: var(--primary-dim); }

/* ─── LIBRARY GRID VIEW ─────────────────────────────────────── */
.library-list.grid-view {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 6px;
}
.library-list.grid-view .item-card {
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 10px 6px;
  gap: 6px;
}
.library-list.grid-view .flag-img {
  width: 48px;
  height: 32px;
  border-radius: 4px;
}
.library-list.grid-view .flag-img.square-style {
  width: 40px;
  height: 40px;
  border-radius: 10px;
}
.library-list.grid-view .item-name {
  font-size: 0.72rem;
  white-space: normal;
  line-height: 1.2;
}
.library-list.grid-view .item-tag {
  font-size: 0.62rem;
}

/* ─── PRESETS ROW ───────────────────────────────────────────── */
.presets-row {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 6px;
}
.preset-chip {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 9px 14px;
  background: var(--bg-elevated);
  border: 2px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  font-family: var(--font);
  position: relative;
  overflow: hidden;
}
.preset-chip::before {
  content: '';
  position: absolute;
  inset: 0;
  opacity: 0;
  transition: opacity 0.25s ease;
}
.preset-chip [data-lucide] { 
  width: 14px; 
  height: 14px;
  transition: transform 0.25s ease;
}
.preset-chip:hover {
  border-color: var(--primary);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}
.preset-chip:hover [data-lucide] {
  transform: scale(1.1);
}
.preset-chip.active {
  color: white;
  border-width: 2px;
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(0,0,0,0.4);
}

/* Gaming - Purple/Neon */
.preset-chip[data-preset="gaming"] { 
  border-left: 4px solid #a371f7;
}
.preset-chip[data-preset="gaming"]:hover {
  background: rgba(163, 113, 247, 0.15);
  color: #a371f7;
  border-color: #a371f7;
}
.preset-chip[data-preset="gaming"].active {
  background: linear-gradient(135deg, #a371f7, #8b5cf6);
  border-color: #a371f7;
}

/* Esports Pro - Gold/Trophy */
.preset-chip[data-preset="esports"] { 
  border-left: 4px solid #f59e0b;
}
.preset-chip[data-preset="esports"]:hover {
  background: rgba(245, 158, 11, 0.15);
  color: #f59e0b;
  border-color: #f59e0b;
}
.preset-chip[data-preset="esports"].active {
  background: linear-gradient(135deg, #f59e0b, #d97706);
  border-color: #f59e0b;
}

/* Sport - Green */
.preset-chip[data-preset="sport"] { 
  border-left: 4px solid #3fb950;
}
.preset-chip[data-preset="sport"]:hover {
  background: rgba(63, 185, 80, 0.15);
  color: #3fb950;
  border-color: #3fb950;
}
.preset-chip[data-preset="sport"].active {
  background: linear-gradient(135deg, #3fb950, #2ea043);
  border-color: #3fb950;
}

/* Clean - Blue */
.preset-chip[data-preset="clean"] { 
  border-left: 4px solid #2f81f7;
}
.preset-chip[data-preset="clean"]:hover {
  background: rgba(47, 129, 247, 0.15);
  color: #2f81f7;
  border-color: #2f81f7;
}
.preset-chip[data-preset="clean"].active {
  background: linear-gradient(135deg, #2f81f7, #1e6dd5);
  border-color: #2f81f7;
}

/* Retro - Gold/Yellow */
.preset-chip[data-preset="retro"] { 
  border-left: 4px solid #f0c040;
}
.preset-chip[data-preset="retro"]:hover {
  background: rgba(240, 192, 64, 0.15);
  color: #f0c040;
  border-color: #f0c040;
}
.preset-chip[data-preset="retro"].active {
  background: linear-gradient(135deg, #f0c040, #d4a72c);
  border-color: #f0c040;
}

/* ─── CUSTOM TEXT INPUT ─────────────────────────────────────── */
.custom-text-input {
  width: 100%;
  padding: 8px 12px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--text-primary);
  font-size: 0.85rem;
  font-weight: 600;
  font-family: var(--font);
  outline: none;
  text-transform: uppercase;
  letter-spacing: 1px;
  transition: border-color var(--transition), box-shadow var(--transition);
}
.custom-text-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-dim);
}
.custom-text-input::placeholder {
  text-transform: none;
  font-weight: 400;
  letter-spacing: 0;
  color: var(--text-muted);
}

/* ─── RESET BUTTON ──────────────────────────────────────────── */
.reset-btn {
  margin-left: auto;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 0.65rem;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 999px;
  cursor: pointer;
  transition: var(--transition);
  font-family: var(--font);
  display: inline-flex;
  align-items: center;
  gap: 4px;
  text-transform: uppercase;
  letter-spacing: .5px;
}
.reset-btn [data-lucide] { width: 11px; height: 11px; }
.reset-btn:hover {
  background: var(--danger-dim);
  color: var(--danger);
  border-color: var(--danger);
}

/* ─── ROSTER ITEM ANIMATIONS ────────────────────────────────── */
@keyframes itemSlideIn {
  from { opacity: 0; transform: translateX(-10px); }
  to   { opacity: 1; transform: none; }
}
.item-card.roster-item {
  animation: itemSlideIn 0.25s ease;
}
@keyframes itemPulse {
  0%   { box-shadow: 0 0 0 0 var(--primary-glow); }
  70%  { box-shadow: 0 0 0 6px transparent; }
  100% { box-shadow: 0 0 0 0 transparent; }
}
.item-card.roster-item.just-added {
  animation: itemSlideIn 0.25s ease, itemPulse 0.6s ease;
}

/* ─── LIBRARY ITEM HOVER TOOLTIP ────────────────────────────── */
.item-card[data-tooltip]:hover::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: calc(100% + 6px);
  left: 50%;
  transform: translateX(-50%);
  background: var(--bg-panel);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  font-size: 0.7rem;
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  white-space: nowrap;
  z-index: 50;
  box-shadow: var(--shadow-md);
  pointer-events: none;
  animation: tooltipIn 0.15s ease;
}
@keyframes tooltipIn {
  from { opacity: 0; transform: translateX(-50%) translateY(4px); }
  to   { opacity: 1; transform: translateX(-50%); }
}
.item-card { position: relative; }

/* ─── ACCESSIBILITY IMPROVEMENTS ────────────────────────────── */
/* Focus visible styles */
*:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

button:focus-visible,
.btn-icon:focus-visible,
.btn-outline:focus-visible,
.btn-primary:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

/* Skip to main content link (for screen readers) */
.skip-to-main {
  position: absolute;
  top: -40px;
  left: 0;
  background: var(--primary);
  color: white;
  padding: 8px 16px;
  text-decoration: none;
  z-index: 10000;
  border-radius: 0 0 var(--radius-md) 0;
}
.skip-to-main:focus {
  top: 0;
}

/* Disabled button states */
button:disabled,
.btn-icon:disabled,
.btn-outline:disabled,
.btn-primary:disabled {
  cursor: not-allowed;
  opacity: 0.5;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
  :root {
    --border: #ffffff;
    --text-primary: #ffffff;
  }
  
  html.light,
  body.light {
    --border: #000000;
    --text-primary: #000000;
  }
}

/* ─── ACCESSIBILITY: REDUCED MOTION ──────────────────────────── */
/* Respect user preference for reduced motion (WCAG 2.1 Level AAA) */
/* Requirement 14.5: Reduce or disable animations when user prefers reduced motion */
@media (prefers-reduced-motion: reduce) {
  /* Disable page load animation */
  body {
    animation: none;
  }
  
  /* Reduce all animations and transitions to minimal duration */
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
  
  /* Disable transform animations on hover */
  .btn-icon:hover,
  .item-card:hover:not(.selected):not(.roster-item) {
    transform: none;
  }
  
  /* Disable slider thumb scale */
  .slider::-webkit-slider-thumb:hover,
  .slider:active::-webkit-slider-thumb {
    transform: none;
  }
  
  .slider::-moz-range-thumb:hover,
  .slider:active::-moz-range-thumb {
    transform: none;
  }
  
  /* Disable toast slide-in animation */
  .toast {
    transform: translateX(-50%) translateY(0);
  }
  
  .toast.show {
    transform: translateX(-50%) translateY(0);
  }
}

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

/* Keyboard navigation improvements */
.item-card:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
  transform: translateX(3px);
}

.pos-btn:focus-visible,
.shape-btn:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
  z-index: 1;
}

/* Modal focus trap */
.modal[aria-modal="true"] {
  isolation: isolate;
}

/* Progress bar accessibility */
.progress-wrap[role="progressbar"] {
  position: relative;
}

/* Undo button disabled state */
.btn-icon:disabled {
  opacity: 0.3;
  cursor: not-allowed;
  transform: none !important;
}

.btn-icon:disabled:hover {
  background: var(--bg-elevated);
  border-color: var(--border);
}

/* Search dropdown keyboard navigation */
.search-dropdown-item:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: -2px;
}

/* Toast accessibility */
.toast[role="status"] {
  pointer-events: none;
}

/* Better contrast for muted text in light mode */
html.light .text-muted,
body.light .text-muted {
  color: #57606a;
}

/* Improved button hover states for accessibility */
.btn-icon:hover:not(:disabled),
.btn-outline:hover:not(:disabled),
.btn-primary:hover:not(:disabled) {
  box-shadow: 0 0 0 3px var(--primary-dim);
}

/* Loading state for images */
img[loading="lazy"] {
  background: var(--bg-elevated);
}

/* Better visual feedback for drag operations */
.item-card.roster-item[draggable="true"]:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

/* Improved color contrast for success/error states */
.toast.success {
  background: var(--success-dim);
  border-color: var(--success);
  color: var(--success);
  font-weight: 600;
}

.toast.error {
  background: var(--danger-dim);
  border-color: var(--danger);
  color: var(--danger);
  font-weight: 600;
}

/* Better visual hierarchy */
.form-section-title {
  position: relative;
  padding-left: 20px;
}

.form-section-title [data-lucide] {
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
}

/* Print styles */
@media print {
  .topbar,
  .sidebar,
  .controls-form,
  .export-footer {
    display: none;
  }
  
  .workspace {
    padding: 0;
  }
  
  .roster-list {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
  }
}

/* ─── CANVAS CONTROLS ────────────────────────────────────────── */
.canvas-controls {
  position: absolute;
  top: 8px;
  right: 8px;
  display: flex;
  gap: 4px;
  z-index: 10;
  opacity: 0;
  transition: opacity var(--transition);
}

.canvas-mount:hover .canvas-controls {
  opacity: 1;
}

.canvas-btn {
  width: 32px;
  height: 32px;
  background: rgba(0, 0, 0, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: var(--radius-sm);
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
  backdrop-filter: blur(8px);
}

.canvas-btn [data-lucide] {
  width: 16px;
  height: 16px;
}

.canvas-btn:hover:not(:disabled) {
  background: rgba(47, 129, 247, 0.8);
  border-color: var(--primary);
  transform: scale(1.05);
}

.canvas-btn:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

.canvas-btn:disabled:hover {
  background: rgba(0, 0, 0, 0.6);
  border-color: rgba(255, 255, 255, 0.15);
  transform: none;
}

/* Canvas zoom effect */
.canvas-mount canvas {
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.canvas-btn:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

/* ─── CANVAS ZOOM INDICATOR ─────────────────────────────────── */
.canvas-mount::after {
  content: attr(data-zoom);
  position: absolute;
  bottom: 8px;
  left: 8px;
  background: rgba(0, 0, 0, 0.6);
  color: white;
  font-size: 0.7rem;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  opacity: 0;
  transition: opacity var(--transition);
  pointer-events: none;
  backdrop-filter: blur(8px);
}

.canvas-mount:hover::after {
  opacity: 1;
}


/* ─── RESPONSIVE MOBILE ──────────────────────────────────────── */
@media (max-width: 768px) {
  /* Topbar mobile */
  .topbar {
    height: 56px;
    padding: 0 12px;
    flex-wrap: nowrap;
  }
  
  /* Show hamburger button on mobile */
  .hamburger-btn {
    display: flex;
    width: 32px;
    height: 32px;
    order: 0;
  }
  
  .logo {
    order: 1;
  }
  
  /* Hide logo text in mobile - only show icon */
  .logo-text {
    display: none;
  }
  
  /* Hide search bar in mobile */
  .topbar-center {
    display: none;
  }

  .canvas-controls {
    opacity: 1;
  }
  
  /* Show search toggle button on mobile */
  .search-toggle-btn {
    display: flex;
    width: 32px;
    height: 32px;
    order: 1.5;
  }
  
  .header-actions {
    order: 2;
    gap: 4px;
  }
  
  .stat-chip {
    padding: 4px 8px;
  }
  
  .stat-num {
    font-size: 0.9rem;
  }
  
  .stat-label {
    font-size: 0.55rem;
  }
  
  .btn-icon {
    min-width: 44px;
    min-height: 44px;
  }
  
  .theme-toggle {
    width: 32px;
    height: 32px;
  }
  
  /* Navigation buttons - 44px minimum touch target */
  .nav-btn {
    min-width: 44px;
    min-height: 44px;
  }
  
  /* Position buttons - 44px minimum touch target */
  .pos-btn {
    min-width: 44px;
    min-height: 44px;
  }
  
  /* Layout mobile - stack vertically */
  .layout {
    flex-direction: column;
    height: calc(100vh - 56px);
    height: calc(100dvh - 56px);
    min-height: 0;
  }
  
  /* Sidebar as drawer - hidden by default */
  /* Optimized for 60fps using transform instead of left */
  .sidebar {
    position: fixed;
    left: 0;
    top: 56px;
    width: 85vw;
    max-width: 320px;
    min-width: 0;
    height: calc(100vh - 56px);
    height: calc(100dvh - 56px);
    z-index: 1000;
    border-right: 1px solid var(--border);
    border-bottom: none;
    transform: translateX(-100%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    will-change: transform;
  }
  
  /* Sidebar open state */
  .sidebar.open {
    transform: translateX(0);
    box-shadow: 2px 0 8px rgba(0, 0, 0, 0.3);
  }
  
  /* Sidebar backdrop */
  /* Optimized for 60fps using opacity */
  .sidebar-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 999;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    will-change: opacity;
  }
  
  .sidebar-backdrop.visible {
    opacity: 1;
    pointer-events: auto;
  }
  
  .sidebar-header {
    flex-wrap: wrap;
  }
  
  .sidebar-header-right {
    width: 100%;
    justify-content: space-between;
    margin-top: 8px;
  }

  .sidebar-tools {
    justify-content: space-between;
  }
  
  .filters {
    overflow-x: auto;
    flex-wrap: nowrap;
    padding: 8px;
    gap: 4px;
  }
  
  .filter-btn {
    white-space: nowrap;
    flex-shrink: 0;
  }
  
  .sidebar-stats {
    display: none;
  }
  
  /* Workspace mobile */
  .workspace {
    padding: 10px;
    gap: 10px;
  }
  
  .workspace-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
  }
  
  .workspace-title {
    font-size: 1rem;
  }
  
  .workspace-actions {
    width: 100%;
    flex-wrap: wrap;
    gap: 6px;
  }
  
  .btn-outline {
    flex: 1;
    min-width: calc(50% - 3px);
    padding: 6px 10px;
    font-size: 0.75rem;
  }
  
  /* Workspace content - stack vertically */
  .workspace-content {
    flex-direction: column;
  }
  
  .preview-card {
    width: 100%;
    order: 2;
  }
  
  .roster-card {
    order: 1;
    max-height: 300px;
  }
  
  .controls-form {
    max-height: none;
    overflow: visible;
    padding: 12px;
    gap: 12px;
  }
  
  /* Optimize control inputs for mobile */
  .control-row input[type=number],
  .control-row select {
    padding: 10px 12px;
    font-size: 0.85rem;
  }
  
  /* Larger touch targets for sliders */
  .slider {
    height: 8px;
  }
  
  .slider::-webkit-slider-thumb {
    width: 24px;
    height: 24px;
  }
  
  .slider::-moz-range-thumb {
    width: 24px;
    height: 24px;
  }
  
  /* Larger toggle switches - 52x32px for better touch */
  .toggle-switch {
    width: 52px;
    height: 32px;
  }
  
  .toggle-slider::before {
    width: 24px;
    height: 24px;
  }
  
  .toggle-switch input:checked + .toggle-slider::before {
    transform: translateX(20px) translateY(-50%);
  }
  
  /* Roster mobile */
  .roster-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }
  
  .roster-actions {
    width: 100%;
  }
  
  .btn-outline-sm {
    flex: 1;
    font-size: 0.7rem;
    padding: 4px 8px;
  }
  
  .drag-hint {
    display: none;
  }
  
  /* Export footer mobile */
  .export-footer {
    padding: 12px;
  }
  
  .export-options {
    flex-direction: column;
    gap: 8px;
  }
  
  .export-buttons {
    flex-direction: column;
  }
  
  .btn-primary,
  .btn-secondary {
    width: 100%;
  }
  
  /* Modal mobile */
  .modal-content {
    width: 95vw;
    max-height: 90vh;
  }
  
  .modal-grid {
    grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
    gap: 8px;
  }
  
  .modal-item img {
    width: 40px;
    height: 28px;
  }
  
  /* Canvas controls mobile */
  .canvas-controls {
    opacity: 1;
  }
  
  .canvas-btn {
    width: 28px;
    height: 28px;
  }
  
  /* Position grid mobile */
  .position-grid {
    gap: 3px;
  }
  
  .pos-btn {
    padding: 4px;
  }
  
  /* Form controls mobile */
  .control-row label {
    font-size: 0.75rem;
  }
  
  .form-section-title {
    font-size: 0.7rem;
  }
  
  .presets-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4px;
  }
  
  .preset-chip {
    font-size: 0.7rem;
    padding: 5px 8px;
  }
}

@media (max-width: 480px) {
  /* Extra small screens */
  .logo-text {
    display: none;
  }
  
  .search-bar-wrap {
    padding: 0 10px;
  }
  
  .global-search {
    font-size: 0.8rem;
  }
  
  .header-actions {
    gap: 2px;
  }
  
  .btn-icon {
    width: 28px;
    height: 28px;
  }
  
  .theme-toggle {
    width: 28px;
    height: 28px;
  }
  
  .workspace-title {
    font-size: 0.9rem;
  }
  
  .title-badge {
    width: 28px;
    height: 28px;
  }
  
  .title-badge [data-lucide] {
    width: 14px;
    height: 14px;
  }
  
  .modal-grid {
    grid-template-columns: repeat(auto-fill, minmax(70px, 1fr));
  }
}

/* Landscape mobile optimization */
@media (max-width: 768px) and (orientation: landscape) {
  .layout {
    flex-direction: row;
  }
  
  .sidebar {
    width: 280px;
    min-width: 280px;
    max-height: none;
    border-right: 1px solid var(--border);
    border-bottom: none;
  }
  
  .workspace-content {
    flex-direction: row;
  }
  
  .preview-card {
    width: 300px;
    order: 1;
  }
  
  .roster-card {
    order: 2;
    max-height: none;
  }
}

/* Touch improvements */
@media (hover: none) and (pointer: coarse) {
  .btn-icon,
  .filter-btn,
  .pos-btn,
  .shape-btn,
  .preset-btn,
  .preset-chip,
  .nav-btn,
  .canvas-btn {
    min-height: 44px;
    min-width: 44px;
  }
  
  .item-card {
    padding: 10px;
  }
  
  .toggle-switch {
    width: 48px;
    height: 28px;
  }
  
  .toggle-slider::before {
    width: 20px;
    height: 20px;
  }
  
  .toggle-switch input:checked + .toggle-slider::before {
    transform: translateX(20px) translateY(-50%);
  }
}

/* ═══════════════════════════════════════════════════════════════
   BASE MEDIA QUERIES - Mobile First Approach
   ═══════════════════════════════════════════════════════════════ */

/* ─── MOBILE (max-width: 768px) ─────────────────────────────── */
@media (max-width: 768px) {
  /* Mobile-specific styles */
  /* Placeholder for future mobile responsive adjustments */
  
  /* Topbar mobile adjustments */
  /* Add mobile topbar customizations here */
  
  /* Sidebar drawer mobile */
  /* Add sidebar drawer behavior here */
  
  /* Workspace mobile layout */
  .workspace {
    padding: 12px;
    flex-direction: column;
  }
  
  .workspace-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }
  
  .workspace-title {
    font-size: 1.1rem;
  }
  
  .workspace-actions {
    width: 100%;
    flex-wrap: wrap;
  }
  
  .workspace-content {
    flex-direction: column;
    gap: 12px;
  }
  
  .preview-card,
  .roster-card {
    width: 100%;
  }
  
  /* Controls and forms mobile */
  /* Add mobile form optimizations here */
  
  /* Touch-friendly controls */
  /* Add touch target size adjustments here */
}

/* ─── TABLET (min-width: 769px and max-width: 1024px) ────────── */
@media (min-width: 769px) and (max-width: 1024px) {
  /* Tablet-specific styles */
  /* Placeholder for future tablet responsive adjustments */
  
  /* Topbar tablet adjustments */
  /* Add tablet topbar customizations here */
  
  /* Sidebar tablet layout */
  /* Add tablet sidebar behavior here */
  
  /* Workspace tablet layout */
  /* Add tablet workspace adjustments here */
  
  /* Controls and forms tablet */
  /* Add tablet form optimizations here */
}

/* ─── DESKTOP (min-width: 1025px) ───────────────────────────── */
@media (min-width: 1025px) {
  /* Desktop-specific styles */
  /* Placeholder for future desktop responsive adjustments */
  
  /* Topbar desktop enhancements */
  /* Add desktop topbar features here */
  
  /* Sidebar desktop layout */
  /* Add desktop sidebar features here */
  
  /* Workspace desktop layout */
  /* Add desktop workspace features here */
  
  /* Advanced desktop features */
  /* Add desktop-only features here */
}

/* ─── TOUCH FEEDBACK OPTIMIZATION ────────────────────────────── */
/* Add :active states with transform for immediate visual feedback on touch */

/* Button elements with scale feedback */
.hamburger-btn:active,
.btn-icon:active,
.theme-toggle:active,
.filter-btn:active,
.mode-btn:active,
.view-btn:active,
.btn-sm-primary:active,
.btn-outline:active,
.btn-outline-sm:active,
.nav-btn:active,
.preset-btn:active,
.pos-btn:active,
.btn-primary:active,
.btn-secondary:active,
.modal-close:active,
.slot-del:active,
.clear-search-btn:active {
  transform: scale(0.95);
}

/* Item cards with subtle scale */
.item-card:active:not(.selected):not(.roster-item) {
  transform: translateX(3px) scale(0.98);
}

.item-card.roster-item:active {
  transform: scale(0.98);
}

/* Toggle switch - no transform to avoid breaking layout */
.toggle-slider:active {
  opacity: 0.9;
}

/* Slider thumb with scale feedback */
.slider:active::-webkit-slider-thumb {
  transform: scale(1.3);
}

.slider:active::-moz-range-thumb {
  transform: scale(1.3);
}

/* Color input with scale */
.color-row input[type=color]:active {
  transform: scale(0.95);
}

/* Select and number inputs with subtle feedback */
.control-row input[type=number]:active,
.control-row select:active,
.sort-select:active {
  transform: scale(0.99);
}

/* Modal items */
.modal-item:active {
  transform: scale(0.95);
}

/* Canvas control buttons */
.shape-btn:active,
.canvas-btn:active,
.canvas-control-btn:active,
.reset-btn:active,
.btn-upload:active,
.btn-clear-logo:active {
  transform: scale(0.95);
}

/* Ensure smooth transitions for all interactive elements */
.hamburger-btn,
.btn-icon,
.theme-toggle,
.filter-btn,
.mode-btn,
.view-btn,
.btn-sm-primary,
.btn-outline,
.btn-outline-sm,
.nav-btn,
.preset-btn,
.pos-btn,
.btn-primary,
.btn-secondary,
.modal-close,
.slot-del,
.clear-search-btn,
.item-card,
.toggle-slider,
.color-row input[type=color],
.control-row input[type=number],
.control-row select,
.sort-select,
.modal-item,
.shape-btn,
.canvas-btn,
.reset-btn,
.btn-upload,
.btn-clear-logo {
  transition: background var(--transition), color var(--transition), border-color var(--transition), transform var(--transition);
}

/* Prevent transform on disabled buttons */
.btn-icon:disabled:active,
.btn-outline:disabled:active,
.btn-outline-sm:disabled:active,
.btn-primary:disabled:active,
.btn-secondary:disabled:active {
  transform: none;
}

/* Mobile-specific touch feedback enhancements */
@media (max-width: 768px) {
  /* Larger scale effect on mobile for better feedback */
  .hamburger-btn:active,
  .btn-icon:active,
  .theme-toggle:active,
  .nav-btn:active {
    transform: scale(0.92);
  }
  
  /* Ensure minimum touch target size with visual feedback */
  .btn-icon:active,
  .nav-btn:active,
  .pos-btn:active,
  .mode-btn:active,
  .view-btn:active,
  .shape-btn:active,
  .canvas-btn:active {
    min-width: 44px;
    min-height: 44px;
  }
}

/* Respect reduced motion preferences - provide alternative feedback */
@media (prefers-reduced-motion: reduce) {
  /* Disable transform animations on active states, use opacity instead */
  .hamburger-btn:active,
  .btn-icon:active,
  .theme-toggle:active,
  .filter-btn:active,
  .mode-btn:active,
  .view-btn:active,
  .btn-sm-primary:active,
  .btn-outline:active,
  .btn-outline-sm:active,
  .nav-btn:active,
  .preset-btn:active,
  .pos-btn:active,
  .btn-primary:active,
  .btn-secondary:active,
  .modal-close:active,
  .slot-del:active,
  .clear-search-btn:active,
  .item-card:active,
  .modal-item:active,
  .shape-btn:active,
  .canvas-btn:active,
  .reset-btn:active,
  .btn-upload:active,
  .btn-clear-logo:active {
    transform: none;
    opacity: 0.8;
  }
  
  /* Disable item card slide animation */
  .item-card:active:not(.selected):not(.roster-item) {
    transform: none;
    opacity: 0.8;
  }
}

/* ─── SEARCH MODAL (MOBILE) ──────────────────────────────────── */
.search-modal {
  position: fixed;
  inset: 0;
  z-index: 2000;
  background: rgba(0, 0, 0, 0.85);
  backdrop-filter: blur(8px);
  display: flex;
  flex-direction: column;
  opacity: 1;
  transition: opacity 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  will-change: opacity;
}

.search-modal.hidden {
  display: none;
  opacity: 0;
}

.search-modal-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px;
  background: var(--bg-panel);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.search-modal-input-wrap {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 0 16px;
  transition: border-color var(--transition), box-shadow var(--transition);
}

.search-modal-input-wrap:focus-within {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-dim);
}

.search-modal-icon {
  color: var(--text-muted);
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  transition: color var(--transition);
}

.search-modal-input-wrap:focus-within .search-modal-icon {
  color: var(--primary);
}

.search-modal-input {
  flex: 1;
  background: none;
  border: none;
  outline: none;
  color: var(--text-primary);
  font-size: 1rem;
  padding: 14px 0;
  font-family: var(--font);
}

.search-modal-input::placeholder {
  color: var(--text-muted);
}

.search-modal-close {
  width: 44px;
  height: 44px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background var(--transition), color var(--transition), border-color var(--transition), transform var(--transition);
  flex-shrink: 0;
}

.search-modal-close:hover {
  background: var(--danger-dim);
  color: var(--danger);
  border-color: var(--danger);
}

.search-modal-close:active {
  transform: scale(0.95);
}

.search-modal-close [data-lucide] {
  width: 20px;
  height: 20px;
}

.search-modal-results {
  flex: 1;
  overflow-y: auto;
  padding: 12px;
  background: var(--bg-body);
}

/* Empty state for search results */
.search-modal-results:empty::before {
  content: 'Escribe para buscar países, códigos ISO o continentes...';
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  color: var(--text-muted);
  font-size: 0.9rem;
  text-align: center;
  padding: 40px 20px;
}

/* Search result items will inherit .item-card styles */
.search-modal-results .item-card {
  margin-bottom: 6px;
}
