/* =========================================================
   My Apps — Design system
   Palette neutre, typographie soignée, ombres très légères.
   ========================================================= */

:root {
  /* Typographie */
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica,
    Arial, sans-serif;

  /* Rayons & espacement */
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 18px;
  --radius-full: 999px;
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 24px;
  --space-6: 32px;
  --space-7: 48px;
  --space-8: 64px;
  --space-9: 96px;

  /* Transitions */
  --ease: cubic-bezier(0.4, 0, 0.2, 1);
  --dur-fast: 150ms;
  --dur-base: 200ms;
  --dur-slow: 250ms;

  /* Palette claire */
  --bg: #fafafa;
  --bg-elevated: #ffffff;
  --bg-subtle: #f2f2f3;
  --bg-header: #fafafa;
  --border: rgba(15, 15, 15, 0.08);
  --border-strong: rgba(15, 15, 15, 0.14);
  --text-primary: #16161a;
  --text-secondary: #63636c;
  --text-tertiary: #94949c;
  --accent: #16161a;
  --accent-contrast: #ffffff;
  --brand: #2563eb;
  --brand-soft: rgba(37, 99, 235, 0.1);
  --danger: #dc2626;
  --success: #16a34a;
  --status-popular: #ea580c;
  --shadow-xs: 0 1px 2px rgba(15, 15, 15, 0.04);
  --shadow-sm: 0 2px 8px rgba(15, 15, 15, 0.05);
  --shadow-md: 0 8px 24px rgba(15, 15, 15, 0.08);
  --shadow-lg: 0 16px 48px rgba(15, 15, 15, 0.12);
  --overlay: rgba(15, 15, 16, 0.45);
  --focus-ring: #2563eb;
}

:root[data-theme="dark"] {
  --bg: #121214;
  --bg-elevated: #1a1a1d;
  --bg-subtle: #202023;
  --bg-header: #121214;
  --border: rgba(255, 255, 255, 0.08);
  --border-strong: rgba(255, 255, 255, 0.14);
  --text-primary: #f2f2f3;
  --text-secondary: #a3a3ab;
  --text-tertiary: #95959c;
  --accent: #f2f2f3;
  --accent-contrast: #16161a;
  --brand: #5b8def;
  --brand-soft: rgba(91, 141, 239, 0.16);
  --danger: #f87171;
  --success: #4ade80;
  --status-popular: #fb923c;
  --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.3);
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.32);
  --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 20px 56px rgba(0, 0, 0, 0.55);
  --overlay: rgba(0, 0, 0, 0.6);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]):not([data-theme="dark"]) {
    --bg: #121214;
    --bg-elevated: #1a1a1d;
    --bg-subtle: #202023;
    --bg-header: #121214;
    --border: rgba(255, 255, 255, 0.08);
    --border-strong: rgba(255, 255, 255, 0.14);
    --text-primary: #f2f2f3;
    --text-secondary: #a3a3ab;
    --text-tertiary: #95959c;
    --accent: #f2f2f3;
    --accent-contrast: #16161a;
    --brand: #5b8def;
    --brand-soft: rgba(91, 141, 239, 0.16);
    --danger: #f87171;
    --success: #4ade80;
    --status-popular: #fb923c;
    --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.3);
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.32);
    --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 20px 56px rgba(0, 0, 0, 0.55);
    --overlay: rgba(0, 0, 0, 0.6);
  }
}

/* ---------- Reset ---------- */
* {
  box-sizing: border-box;
}

html,
body {
  padding: 0;
  margin: 0;
}

body {
  background: var(--bg);
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  transition: background-color var(--dur-base) var(--ease), color var(--dur-base) var(--ease);
}

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

button {
  font-family: inherit;
  cursor: pointer;
}

a {
  color: inherit;
  text-decoration: none;
}

ul {
  margin: 0;
  padding: 0;
  list-style: none;
}

h1,
h2,
h3,
p {
  margin: 0;
}

:focus-visible {
  outline: 2px solid var(--focus-ring);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

.container {
  width: 100%;
  max-width: 1180px;
  margin: 0 auto;
  padding: 0 var(--space-5);
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

/* ---------- Header ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 40;
  background: var(--bg-header);
  border-bottom: 1px solid var(--border);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
  gap: var(--space-4);
}

.brand {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  min-width: 0;
}

.brand-mark {
  width: 32px;
  height: 32px;
  object-fit: contain;
  flex-shrink: 0;
}

/* brightness(0) ramène n'importe quelle couleur source à du noir (sans
   toucher l'alpha), puis invert(1) le bascule en blanc : ça marche quelle
   que soit la teinte d'origine du logo, contrairement à un simple invert(1). */
:root[data-theme="dark"] .brand-mark {
  filter: brightness(0) invert(1);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]):not([data-theme="dark"]) .brand-mark {
    filter: brightness(0) invert(1);
  }
}


.brand-text {
  display: flex;
  flex-direction: column;
  line-height: 1.2;
  min-width: 0;
}

.brand-name {
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.01em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.brand-sub {
  font-size: 11.5px;
  color: var(--text-tertiary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  height: 36px;
  min-width: 36px;
  padding: 0 var(--space-3);
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--text-primary);
  font-size: 13px;
  font-weight: 500;
  transition: transform var(--dur-fast) var(--ease), border-color var(--dur-fast) var(--ease),
    background-color var(--dur-fast) var(--ease);
}

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

.icon-btn:active {
  transform: scale(0.96);
}

.icon-btn svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

.search-trigger {
  padding-right: var(--space-2);
}

.kbd {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 1px 6px;
  border-radius: 5px;
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  font-size: 11px;
  color: var(--text-tertiary);
  font-family: inherit;
}

.theme-toggle {
  position: relative;
}

.theme-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-md);
  padding: var(--space-2);
  min-width: 148px;
  display: none;
  flex-direction: column;
  gap: 2px;
  z-index: 50;
}

.theme-menu.open {
  display: flex;
  animation: pop-in var(--dur-base) var(--ease);
}

.theme-menu button {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  width: 100%;
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-sm);
  border: none;
  background: transparent;
  color: var(--text-primary);
  font-size: 13px;
  text-align: left;
}

.theme-menu button svg {
  width: 15px;
  height: 15px;
  flex-shrink: 0;
}

.theme-menu button:hover {
  background: var(--bg-subtle);
}

.theme-menu button[aria-checked="true"] {
  color: var(--brand);
  font-weight: 600;
}

/* ---------- Hero ---------- */
.hero {
  padding: var(--space-7) 0 var(--space-6);
  text-align: center;
}

.hero h1 {
  font-size: clamp(24px, 2.6vw, 30px);
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.2;
  color: var(--text-primary);
}

.hero p {
  margin-top: var(--space-2);
  font-size: 14.5px;
  color: var(--text-secondary);
  max-width: 480px;
  margin-inline: auto;
}

.hero-stats {
  margin-top: var(--space-4);
  display: inline-flex;
  align-items: center;
  gap: var(--space-3);
  font-size: 13px;
  color: var(--text-tertiary);
  padding: var(--space-2) var(--space-4);
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  background: var(--bg-elevated);
}

.hero-stats strong {
  color: var(--text-primary);
  font-weight: 600;
}

.hero-stats .dot {
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: var(--text-tertiary);
}

/* ---------- Sections ---------- */
.section {
  padding: var(--space-7) 0;
}

.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--space-4);
  margin-bottom: var(--space-5);
}

.section-head h2 {
  font-size: 22px;
  font-weight: 650;
  letter-spacing: -0.015em;
}

.section-head .section-sub {
  color: var(--text-tertiary);
  font-size: 13px;
}

.section[hidden] {
  display: none;
}

/* ---------- Featured ---------- */
.featured-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: var(--space-4);
}

.featured-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
  padding: var(--space-6);
  border-radius: var(--radius-lg);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  transition: transform var(--dur-base) var(--ease), box-shadow var(--dur-base) var(--ease),
    border-color var(--dur-base) var(--ease);
  cursor: pointer;
  text-align: left;
}

.featured-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-lg);
  border-color: var(--border-strong);
}

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

.featured-card .app-icon {
  width: 52px;
  height: 52px;
  font-size: 26px;
  border-radius: var(--radius-md);
}

.status-pill {
  font-size: 11px;
  font-weight: 600;
  padding: 3px 9px;
  border-radius: var(--radius-full);
  text-transform: uppercase;
  letter-spacing: 0.03em;
  background: var(--brand-soft);
  color: var(--brand);
}

.status-pill[data-status="popular"] {
  background: rgba(234, 88, 12, 0.12);
  color: var(--status-popular);
}

.status-pill[data-status="updated"] {
  background: rgba(22, 163, 74, 0.12);
  color: var(--success);
}

.featured-card h3 {
  font-size: 19px;
  font-weight: 650;
  letter-spacing: -0.01em;
}

.featured-card .app-desc {
  color: var(--text-secondary);
  font-size: 14px;
}

.card-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: auto;
  gap: var(--space-3);
}

.badge-row {
  display: flex;
  gap: var(--space-2);
  flex-wrap: wrap;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.02em;
  padding: 3px 8px;
  border-radius: var(--radius-full);
  border: 1px solid var(--border-strong);
  color: var(--text-secondary);
  background: var(--bg-subtle);
}

.badge-category {
  border-color: transparent;
  background: var(--bg-subtle);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 9px 16px;
  border-radius: var(--radius-md);
  font-size: 13.5px;
  font-weight: 600;
  border: 1px solid transparent;
  transition: transform var(--dur-fast) var(--ease), opacity var(--dur-fast) var(--ease),
    background-color var(--dur-fast) var(--ease);
  white-space: nowrap;
}

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

.btn svg {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
}

.btn-primary {
  background: var(--accent);
  color: var(--accent-contrast);
}

.btn-primary:hover {
  opacity: 0.88;
}

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

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

.btn-sm {
  padding: 6px 12px;
  font-size: 12.5px;
}

.btn-block {
  width: 100%;
}

/* ---------- Toolbar (filters + search) ---------- */
.toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  margin-bottom: var(--space-5);
}

.filter-group {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}

.pill {
  padding: 7px 14px;
  border-radius: var(--radius-full);
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 500;
  transition: background-color var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease),
    border-color var(--dur-fast) var(--ease), transform var(--dur-fast) var(--ease);
}

.pill:hover {
  border-color: var(--border-strong);
}

.pill:active {
  transform: scale(0.96);
}

.pill[aria-pressed="true"] {
  background: var(--accent);
  color: var(--accent-contrast);
  border-color: var(--accent);
}

.category-group {
  margin-top: var(--space-3);
}

.category-group .pill {
  font-size: 12.5px;
  padding: 6px 12px;
  color: var(--text-tertiary);
}

.category-group .pill[aria-pressed="true"] {
  background: var(--brand-soft);
  color: var(--brand);
  border-color: transparent;
}

.result-count {
  font-size: 13px;
  color: var(--text-tertiary);
  white-space: nowrap;
}

.toolbar-right {
  display: flex;
  align-items: center;
  gap: var(--space-4);
}

.view-toggle {
  display: flex;
  gap: 2px;
  padding: 3px;
  border-radius: var(--radius-md);
  background: var(--bg-subtle);
}

.view-toggle .icon-btn {
  border: none;
  background: transparent;
  height: 32px;
  min-width: 32px;
  padding: 0 7px;
}

.view-toggle .icon-btn[aria-pressed="true"] {
  background: var(--bg-elevated);
  box-shadow: var(--shadow-xs);
  color: var(--text-primary);
}

.sort-control select {
  appearance: none;
  -webkit-appearance: none;
  padding: 7px 30px 7px 14px;
  border-radius: var(--radius-full);
  border: 1px solid var(--border);
  background: var(--bg-elevated) url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="%2394949c" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><polyline points="6 9 12 15 18 9"></polyline></svg>')
    no-repeat right 10px center;
  background-size: 14px;
  color: var(--text-secondary);
  font-size: 13px;
  font-family: inherit;
  font-weight: 500;
  cursor: pointer;
  transition: border-color var(--dur-fast) var(--ease);
}

.sort-control select:hover {
  border-color: var(--border-strong);
}

/* ---------- Partage (QR + copie de lien) ---------- */
.share-row {
  display: flex;
  align-items: center;
  gap: var(--space-4);
}

.qr-code {
  width: 88px;
  height: 88px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: #fff;
  padding: 6px;
  flex-shrink: 0;
}

.share-actions {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  flex-grow: 1;
}

.share-actions .btn {
  justify-content: flex-start;
}

.share-actions .btn svg {
  width: 14px;
  height: 14px;
}

/* ---------- Catalog grid ---------- */
.catalog-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-4);
}

@media (min-width: 1000px) {
  .catalog-grid {
    grid-template-columns: repeat(4, 1fr);
  }
}

/* ---------- Vue liste compacte ---------- */
.catalog-grid.list-view {
  display: flex;
  flex-direction: column;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--bg-elevated);
  box-shadow: var(--shadow-xs);
  overflow: hidden;
}

.app-list-item {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: 10px var(--space-4);
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  text-align: left;
  background: transparent;
  transition: background-color var(--dur-fast) var(--ease);
  opacity: 0;
  animation: card-in var(--dur-slow) var(--ease) forwards;
}

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

.app-list-item:hover {
  background: var(--bg-subtle);
}

.app-list-item .app-icon {
  width: 32px;
  height: 32px;
  font-size: 15px;
  flex-shrink: 0;
}

.app-list-item .list-item-main {
  flex-grow: 1;
  min-width: 0;
  display: flex;
  align-items: baseline;
  gap: var(--space-3);
}

.app-list-item h3 {
  font-size: 14px;
  font-weight: 650;
  letter-spacing: -0.01em;
  flex-shrink: 0;
}

.app-list-item .app-desc {
  font-size: 12.5px;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}

.app-list-item .badge-row {
  flex-shrink: 0;
  display: none;
}

.app-list-item .favorite-btn {
  flex-shrink: 0;
  width: 32px;
  height: 32px;
}

.app-list-item .link-open {
  flex-shrink: 0;
  font-size: 12.5px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.app-list-item .link-open svg {
  width: 13px;
  height: 13px;
}

@media (min-width: 640px) {
  .app-list-item .badge-row {
    display: flex;
  }
  .app-list-item .list-item-main {
    flex-direction: column;
    align-items: flex-start;
    gap: 1px;
  }
}

@media (min-width: 900px) {
  .app-list-item .list-item-main {
    flex-direction: row;
    align-items: baseline;
    gap: var(--space-3);
  }
}

.app-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  padding: var(--space-5);
  border-radius: var(--radius-lg);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-xs);
  text-align: left;
  cursor: pointer;
  transition: transform var(--dur-base) var(--ease), box-shadow var(--dur-base) var(--ease),
    border-color var(--dur-base) var(--ease);
  opacity: 0;
  transform: translateY(8px);
  animation: card-in var(--dur-slow) var(--ease) forwards;
}

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

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

.app-icon {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-md);
  display: grid;
  place-items: center;
  font-size: 20px;
  flex-shrink: 0;
  overflow: hidden;
  background: var(--icon-bg, var(--bg-subtle));
}

.app-icon-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.favorite-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: none;
  background: transparent;
  color: var(--text-tertiary);
  transition: color var(--dur-fast) var(--ease), transform var(--dur-fast) var(--ease);
}

.favorite-btn svg {
  width: 18px;
  height: 18px;
}

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

.favorite-btn:active {
  transform: scale(1.15);
}

.favorite-btn[aria-pressed="true"] {
  color: var(--danger);
}

.favorite-btn[aria-pressed="true"] svg {
  fill: var(--danger);
}

/* Le rouge ne signale un retrait qu'au survol d'un favori déjà actif ;
   sur un cœur pas encore favori, ce serait le mauvais signal (on ajoute,
   on ne supprime pas). */
.favorite-btn[aria-pressed="true"]:hover {
  color: var(--danger);
  opacity: 0.8;
}

.app-card h3 {
  font-size: 15.5px;
  font-weight: 650;
  letter-spacing: -0.01em;
}

.app-card .app-desc {
  color: var(--text-secondary);
  font-size: 13px;
  flex-grow: 1;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.app-card .card-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: var(--space-1);
}

.card-foot .link-open {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.card-foot .link-open svg {
  width: 13px;
  height: 13px;
  transition: transform var(--dur-fast) var(--ease);
}

.app-card:hover .link-open svg {
  transform: translateX(2px);
}

.empty-state {
  grid-column: 1 / -1;
  text-align: center;
  padding: var(--space-8) var(--space-4);
  color: var(--text-tertiary);
}

.empty-state .empty-icon {
  width: 32px;
  height: 32px;
  margin: 0 auto var(--space-3);
}

/* Skeleton loading */
@keyframes card-in {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes pop-in {
  from {
    opacity: 0;
    transform: translateY(-4px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* ---------- Modal (fiche détaillée) ---------- */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: var(--overlay);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-4);
  z-index: 100;
  opacity: 0;
  visibility: hidden;
  transition: opacity var(--dur-base) var(--ease);
}

.modal-overlay.open {
  opacity: 1;
  visibility: visible;
}

.modal {
  width: 100%;
  max-width: 560px;
  max-height: min(88vh, 720px);
  overflow-y: auto;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: var(--space-6);
  transform: translateY(12px) scale(0.98);
  transition: transform var(--dur-base) var(--ease);
}

.modal-overlay.open .modal {
  transform: translateY(0) scale(1);
}

.modal-close {
  position: absolute;
  top: var(--space-4);
  right: var(--space-4);
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  display: grid;
  place-items: center;
  color: var(--text-secondary);
}

.modal-close:hover {
  background: var(--bg-subtle);
}

.modal-header {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  padding-right: var(--space-6);
}

.modal-header .app-icon {
  width: 64px;
  height: 64px;
  font-size: 30px;
  border-radius: var(--radius-md);
}

.modal-header h2 {
  font-size: 21px;
  font-weight: 650;
  letter-spacing: -0.015em;
}

.modal-meta {
  margin-top: 4px;
  display: flex;
  gap: var(--space-2);
  flex-wrap: wrap;
  align-items: center;
}

.modal-body {
  margin-top: var(--space-5);
  display: flex;
  flex-direction: column;
  gap: var(--space-5);
}

.modal-body .app-desc-full {
  color: var(--text-secondary);
  font-size: 14px;
  line-height: 1.65;
}

.modal-section h3 {
  font-size: 12px;
  font-weight: 650;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-tertiary);
  margin-bottom: var(--space-3);
}

/* ---------- Paramètres (toggles) ---------- */
.settings-list {
  margin-top: var(--space-5);
  display: flex;
  flex-direction: column;
}

.settings-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  padding: var(--space-3) 0;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
}

.settings-row:last-child {
  border-bottom: none;
}

.settings-row-title {
  display: block;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text-primary);
}

.settings-row-desc {
  display: block;
  font-size: 12px;
  color: var(--text-tertiary);
  margin-top: 2px;
}

.toggle-switch {
  position: relative;
  flex-shrink: 0;
  width: 46px;
  height: 28px;
}

.toggle-switch input {
  position: absolute;
  inset: 0;
  opacity: 0;
  margin: 0;
  cursor: pointer;
}

.toggle-track {
  position: absolute;
  inset: 0;
  border-radius: var(--radius-full);
  background: var(--bg-subtle);
  border: 1px solid var(--border-strong);
  transition: background-color var(--dur-fast) var(--ease);
}

.toggle-track::after {
  content: "";
  position: absolute;
  top: 4px;
  left: 4px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--bg-elevated);
  box-shadow: var(--shadow-sm);
  transition: transform var(--dur-fast) var(--ease);
}

.toggle-switch input:checked + .toggle-track {
  background: var(--brand);
  border-color: var(--brand);
}

.toggle-switch input:checked + .toggle-track::after {
  transform: translateX(18px);
}

.toggle-switch input:focus-visible + .toggle-track {
  outline: 2px solid var(--focus-ring);
  outline-offset: 2px;
}

.feature-list li {
  display: flex;
  align-items: flex-start;
  gap: var(--space-2);
  font-size: 13.5px;
  color: var(--text-primary);
  padding: 6px 0;
}

.feature-list li svg {
  width: 15px;
  height: 15px;
  color: var(--success);
  flex-shrink: 0;
  margin-top: 2px;
}

.info-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--space-3);
}

.info-item {
  padding: var(--space-3);
  border-radius: var(--radius-md);
  background: var(--bg-subtle);
}

.info-item .info-label {
  font-size: 11px;
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.info-item .info-value {
  font-size: 13.5px;
  font-weight: 600;
  margin-top: 2px;
}

.modal-actions {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.store-badge {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-size: 12.5px;
  color: var(--text-tertiary);
}

.store-badge svg {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
}

/* ---------- Search overlay (command palette) ---------- */
.search-overlay {
  position: fixed;
  inset: 0;
  background: var(--overlay);
  z-index: 100;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: var(--space-4);
  padding-top: min(14vh, 120px);
  opacity: 0;
  visibility: hidden;
  transition: opacity var(--dur-base) var(--ease);
}

.search-overlay.open {
  opacity: 1;
  visibility: visible;
}

.search-panel {
  width: 100%;
  max-width: 560px;
  max-height: 70vh;
  display: flex;
  flex-direction: column;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  transform: translateY(-8px) scale(0.98);
  transition: transform var(--dur-base) var(--ease);
}

.search-overlay.open .search-panel {
  transform: translateY(0) scale(1);
}

.search-input-row {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-4) var(--space-5);
  border-bottom: 1px solid var(--border);
}

.search-input-row svg {
  width: 18px;
  height: 18px;
  color: var(--text-tertiary);
  flex-shrink: 0;
}

.search-input-row input {
  flex-grow: 1;
  border: none;
  outline: none;
  background: transparent;
  color: var(--text-primary);
  font-size: 16px;
  font-family: inherit;
}

.search-input-row input::placeholder {
  color: var(--text-tertiary);
}

.search-results {
  overflow-y: auto;
  padding: var(--space-2);
}

.search-result {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  width: 100%;
  padding: var(--space-3);
  border-radius: var(--radius-md);
  background: transparent;
  border: none;
  text-align: left;
  color: var(--text-primary);
}

.search-result:hover,
.search-result.active {
  background: var(--bg-subtle);
}

.search-result .app-icon {
  width: 34px;
  height: 34px;
  font-size: 17px;
  border-radius: var(--radius-sm);
}

.search-result .sr-text {
  min-width: 0;
  flex-grow: 1;
}

.search-result .sr-name {
  font-size: 13.5px;
  font-weight: 600;
}

.search-result .sr-desc {
  font-size: 12px;
  color: var(--text-tertiary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.search-empty {
  padding: var(--space-7) var(--space-5);
  text-align: center;
  color: var(--text-tertiary);
  font-size: 13.5px;
}

.search-hint {
  padding: var(--space-3) var(--space-5);
  border-top: 1px solid var(--border);
  font-size: 11.5px;
  color: var(--text-tertiary);
  display: flex;
  gap: var(--space-4);
}

/* ---------- Toast ---------- */
.toast-region {
  position: fixed;
  bottom: var(--space-5);
  left: 50%;
  transform: translateX(-50%);
  z-index: 200;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-2);
}

.toast {
  background: var(--accent);
  color: var(--accent-contrast);
  padding: 10px 18px;
  border-radius: var(--radius-full);
  font-size: 13px;
  font-weight: 500;
  box-shadow: var(--shadow-md);
  opacity: 0;
  transform: translateY(8px);
  animation: toast-in var(--dur-base) var(--ease) forwards,
    toast-out var(--dur-base) var(--ease) forwards 1.9s;
}

@keyframes toast-in {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes toast-out {
  to {
    opacity: 0;
    transform: translateY(-4px);
  }
}

/* ---------- Footer ---------- */
.site-footer {
  border-top: 1px solid var(--border);
  padding: var(--space-6) 0;
  margin-top: var(--space-6);
}

.footer-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  flex-wrap: wrap;
}

.footer-brand {
  font-size: 13px;
  color: var(--text-tertiary);
}

.footer-brand strong {
  color: var(--text-primary);
  font-weight: 600;
}

.footer-links {
  display: flex;
  gap: var(--space-4);
  font-size: 13px;
  color: var(--text-tertiary);
}

.footer-links a:hover {
  color: var(--text-primary);
}

.footer-stats {
  font-size: 12px;
  color: var(--text-tertiary);
  margin-top: var(--space-3);
}

.version-badge {
  display: inline-flex;
  align-items: center;
  margin-left: var(--space-2);
  padding: 1px 8px;
  border-radius: var(--radius-full);
  border: 1px solid var(--border);
  background: var(--bg-subtle);
  font-size: 11px;
  font-weight: 600;
  color: var(--text-tertiary);
  font-variant-numeric: tabular-nums;
}

.changelog-list li {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: var(--space-2);
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
  font-size: 12.5px;
}

.changelog-list li:last-child {
  border-bottom: none;
}

.changelog-version {
  font-weight: 650;
  font-variant-numeric: tabular-nums;
  color: var(--text-primary);
}

.changelog-type {
  font-size: 10.5px;
  font-weight: 650;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  padding: 2px 7px;
  border-radius: var(--radius-full);
  background: var(--bg-subtle);
  color: var(--text-tertiary);
}

.changelog-type[data-type="major"] {
  background: rgba(220, 38, 38, 0.12);
  color: var(--danger);
}

.changelog-type[data-type="minor"] {
  background: var(--brand-soft);
  color: var(--brand);
}

.changelog-desc {
  color: var(--text-secondary);
  flex-basis: 100%;
}

/* ---------- Vue plan de métro ---------- */
.catalog-grid.metro-view {
  display: block;
}

.metro-map {
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--bg-elevated);
  box-shadow: var(--shadow-xs);
  padding: var(--space-2) var(--space-6);
}

.metro-line {
  --col: min(200px, calc((100% - 180px) / var(--n-max)));
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  padding: var(--space-5) 0 var(--space-6);
}

.metro-line + .metro-line {
  border-top: 1px solid var(--border);
}

.metro-line-head {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  padding-top: calc(var(--label-h) - 18px);
  padding-right: var(--space-5);
}

.metro-roundel {
  flex-shrink: 0;
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--line);
  color: var(--line-ink);
  font-size: 18px;
  font-weight: 800;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}

.metro-line-title {
  min-width: 0;
  padding-top: 7px;
}

.metro-line-title h3 {
  font-size: 15px;
  font-weight: 700;
  line-height: 1.25;
  color: var(--text-primary);
}

.metro-count {
  margin-top: 2px;
  font-size: 12.5px;
  line-height: 1.4;
  color: var(--text-secondary);
}

.metro-stations {
  position: relative;
  display: grid;
  grid-template-columns: repeat(var(--n), var(--col));
  margin: 0;
  padding: 0;
  list-style: none;
}

.metro-stations::before {
  content: "";
  position: absolute;
  top: calc(var(--label-h) - 4px);
  left: calc(var(--col) / 2);
  width: calc(var(--col) * (var(--n) - 1));
  height: 8px;
  border-radius: var(--radius-full);
  background: var(--line);
}

.metro-line.is-single .metro-stations::before {
  left: calc(var(--col) / 2 - 32px);
  width: 64px;
}

.metro-station {
  position: relative;
  padding-top: var(--label-h);
}

.metro-stop {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
  min-height: 64px;
  padding: 0 0 var(--space-2);
  border: none;
  background: none;
  color: var(--text-primary);
  font: inherit;
  cursor: pointer;
}

.metro-dot {
  position: relative;
  z-index: 1;
  width: 18px;
  height: 18px;
  margin-top: -9px;
  border-radius: 50%;
  border: 3.5px solid var(--text-primary);
  background: var(--bg-elevated);
  transition: background-color var(--dur-fast) var(--ease), transform var(--dur-fast) var(--ease);
}

.is-terminus .metro-dot {
  width: 24px;
  height: 24px;
  margin-top: -12px;
  border-width: 4.5px;
}

.metro-text {
  display: contents;
}

.metro-name {
  position: absolute;
  left: calc(50% + 4px);
  bottom: calc(100% - var(--label-h) + 18px);
  width: max-content;
  white-space: nowrap;
  transform: rotate(-35deg);
  transform-origin: 0 100%;
  font-size: 14px;
  font-weight: 500;
  line-height: 1.25;
  text-align: left;
  text-decoration-line: underline;
  text-decoration-color: transparent;
  text-decoration-thickness: 3px;
  text-underline-offset: 4px;
  transition: text-decoration-color var(--dur-fast) var(--ease);
}

.is-terminus .metro-name {
  font-weight: 750;
}

.metro-corresp {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 4px;
  margin-top: var(--space-3);
}

.is-terminus .metro-corresp {
  margin-top: calc(var(--space-3) - 3px);
}

.metro-stop:hover .metro-dot {
  background: var(--text-primary);
}

.metro-stop:hover .metro-name,
.metro-stop:focus-visible .metro-name {
  text-decoration-color: var(--line);
}

.metro-stop:focus-visible {
  outline: none;
}

.metro-stop:focus-visible .metro-dot {
  box-shadow: 0 0 0 3px var(--bg-elevated), 0 0 0 5px var(--focus-ring);
}

/* Le tracé : la ligne se dessine, puis les stations s'allument dans l'ordre. */
.metro-animate .metro-stations::before {
  animation: metro-draw-x 700ms cubic-bezier(0.16, 1, 0.3, 1) both;
  animation-delay: calc(var(--line-i) * 50ms);
}

.metro-animate .metro-dot {
  animation: metro-stop-in 320ms cubic-bezier(0.16, 1, 0.3, 1) both;
  animation-delay: calc(var(--line-i) * 50ms + 120ms + var(--i) * 360ms / var(--n));
}

@keyframes metro-draw-x {
  from {
    clip-path: inset(0 100% 0 0 round 999px);
  }
  to {
    clip-path: inset(0 0 0 0 round 999px);
  }
}

@keyframes metro-draw-y {
  from {
    clip-path: inset(0 0 100% 0 round 999px);
  }
  to {
    clip-path: inset(0 0 0 0 round 999px);
  }
}

@keyframes metro-stop-in {
  from {
    transform: scale(0.2);
    opacity: 0;
  }
  to {
    transform: scale(1);
    opacity: 1;
  }
}

/* Sous 1000px, le plan passe à la verticale, comme sur les écrans des quais :
   avec 7 stations sur une ligne, les colonnes deviendraient trop étroites. */
@media (max-width: 999px) {
  .metro-map {
    padding: var(--space-1) var(--space-4);
  }

  .metro-line {
    grid-template-columns: minmax(0, 1fr);
    padding: var(--space-5) 0;
  }

  .metro-line-head {
    padding: 0;
  }

  .metro-stations {
    display: block;
    margin-top: var(--space-3);
  }

  .metro-stations::before,
  .metro-line.is-single .metro-stations::before {
    top: 26px;
    bottom: 26px;
    left: 14px;
    width: 8px;
    height: auto;
  }

  .metro-line.is-single .metro-stations::before {
    top: 6px;
    bottom: 6px;
  }

  .metro-station {
    padding-top: 0;
  }

  .metro-stop {
    flex-direction: row;
    align-items: center;
    gap: var(--space-3);
    min-height: 52px;
    padding: var(--space-2) 0;
    text-align: left;
  }

  .metro-dot,
  .is-terminus .metro-dot {
    margin: 0;
    flex-shrink: 0;
  }

  .metro-dot {
    margin-left: 9px;
    margin-right: 3px;
  }

  .is-terminus .metro-dot {
    margin-left: 6px;
  }

  .metro-text {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 4px var(--space-2);
    min-width: 0;
    padding-left: var(--space-1);
  }

  .metro-name {
    position: static;
    width: auto;
    max-width: none;
    transform: none;
    font-size: 15px;
  }

  .metro-corresp,
  .is-terminus .metro-corresp {
    margin-top: 0;
  }

  .metro-animate .metro-stations::before {
    animation-name: metro-draw-y;
  }
}

/* ---------- Responsive ---------- */
@media (max-width: 720px) {
  .catalog-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .hero {
    padding: var(--space-6) 0 var(--space-5);
  }
  .brand-sub {
    display: none;
  }
  .search-trigger span,
  .search-trigger .kbd {
    display: none;
  }
  .search-trigger {
    padding-right: 0;
  }
}

@media (max-width: 520px) {
  .container {
    padding-left: var(--space-4);
    padding-right: var(--space-4);
  }
  .section {
    padding-top: var(--space-6);
    padding-bottom: var(--space-6);
  }
  .catalog-grid,
  .featured-grid {
    grid-template-columns: 1fr;
  }
  .toolbar {
    flex-direction: column;
    align-items: stretch;
  }
  .toolbar-right {
    order: 2;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: var(--space-2);
  }
  .info-grid {
    grid-template-columns: 1fr;
  }
  .footer-inner {
    flex-direction: column;
    align-items: flex-start;
  }
  .search-overlay {
    padding-top: var(--space-5);
  }
}

/* ---------- prefers-reduced-motion ---------- */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
  .app-card {
    opacity: 1;
    transform: none;
  }
  .metro-animate .metro-stations::before,
  .metro-animate .metro-dot {
    animation: none !important;
  }
}

/* ---------- Thème caché « GTA 6 » (Leonida, de nuit) ---------- */
/* :is(:root, #gta6) prend la spécificité d'un id : ces valeurs passent
   devant les blocs clair/sombre, y compris celui de prefers-color-scheme. */
:is(:root, #gta6)[data-skin="gta6"] {
  --bg: #170a2c;
  --bg-elevated: #22103d;
  --bg-subtle: #2d1650;
  --bg-header: #170a2c;
  --border: rgba(255, 94, 170, 0.2);
  --border-strong: rgba(255, 94, 170, 0.38);
  --text-primary: #fff4f9;
  --text-secondary: #e9bcd9;
  --text-tertiary: #c094b8;
  --accent: #ff4fa3;
  --accent-contrast: #1a0628;
  --brand: #ff9a4d;
  --brand-soft: rgba(255, 154, 77, 0.16);
  --danger: #ff6b8a;
  --success: #4ff0c4;
  --status-popular: #ffc260;
  --focus-ring: #ffd166;
  --shadow-xs: 0 1px 2px rgba(8, 0, 20, 0.5);
  --shadow-sm: 0 4px 12px rgba(8, 0, 20, 0.45);
  --shadow-md: 0 10px 28px rgba(8, 0, 20, 0.55);
  --shadow-lg: 0 20px 56px rgba(8, 0, 20, 0.65);
  --overlay: rgba(10, 2, 24, 0.72);
  color-scheme: dark;
}

:is(:root, #gta6)[data-skin="gta6"] body {
  background: linear-gradient(180deg, #170a2c 0%, #1b0b34 55%, #2a0d3f 100%) fixed;
}

:is(:root, #gta6)[data-skin="gta6"] ::selection {
  background: #ff4fa3;
  color: #1a0628;
}

:is(:root, #gta6)[data-skin="gta6"] .brand-mark {
  filter: brightness(0) invert(1);
}

:is(:root, #gta6)[data-skin="gta6"] .brand-name {
  color: var(--accent);
  font-weight: 800;
  font-style: italic;
}

/* L'horizon : un coucher de soleil derrière le titre, comme sur la côte de Leonida. */
:is(:root, #gta6)[data-skin="gta6"] .hero {
  background: radial-gradient(48% 42% at 50% 60%, rgba(255, 122, 89, 0.26), rgba(255, 79, 163, 0.12) 55%, transparent 100%);
}

:is(:root, #gta6)[data-skin="gta6"] .hero h1 {
  font-size: clamp(24px, 3.6vw, 44px);
  font-weight: 900;
  font-style: italic;
  text-transform: uppercase;
  letter-spacing: -0.01em;
  line-height: 1.05;
  color: #ff7ab8;
  background: linear-gradient(100deg, #ff4fa3 0%, #ff7a59 45%, #ffd166 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

:is(:root, #gta6)[data-skin="gta6"] .app-card:hover,
:is(:root, #gta6)[data-skin="gta6"] .featured-card:hover {
  border-color: var(--border-strong);
}

/* Six touches rapides sur la marque : pas de zoom ni de sélection de texte. */
.brand {
  touch-action: manipulation;
  -webkit-user-select: none;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}
