/* ============================================================
   SITE.CSS — Styles propres au site (réutilise les tokens de layout.css)
   ============================================================ */

   body { padding-top: var(--header-height); }
   .titlebar-brand {
     margin-left: 20px;
     font: 700 14px/1 var(--font-display);
     letter-spacing: 0.18em;
     color: var(--text-main);
   }
   .main { min-height: 0; }
   #page-container { overflow-y: auto; overflow-x: hidden; }
   #page-container > .home-page { height: auto; min-height: 100%; }
   .nav-btn { font: inherit; text-align: left; }
   .nav-icon { color: #fff; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
   
   /* ---------- Barre du haut : recherche + ajout ---------- */
   .topbar {
     display: flex; gap: var(--space-md); align-items: center;
     position: sticky; top: 0; z-index: 30;
     padding: 0 0 var(--space-md);
     background: var(--bg-dark);
   }
   .search-box { position: relative; flex: 1; max-width: 560px; }
   .search-box svg { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); width: 16px; height: 16px; stroke: var(--text-soft); fill: none; stroke-width: 2; stroke-linecap: round; }
   .search-input {
     width: 100%; height: 40px; padding: 0 14px 0 38px;
     background: var(--bg-card); color: var(--text-main);
     border: 1px solid var(--border-deep); border-radius: var(--radius-lg);
     font: 500 14px/1 var(--font-body); outline: none;
     transition: border-color var(--t-fast), box-shadow var(--t-fast);
   }
   .search-input::placeholder { color: var(--text-soft); }
   .search-input:focus { border-color: var(--accent); box-shadow: var(--shadow-glow-sm); }
   
   .btn {
     display: inline-flex; align-items: center; justify-content: center; gap: 6px;
     height: 40px; padding: 0 16px;
     background: var(--accent); color: #fff;
     font: 700 11px/1 var(--font-body); letter-spacing: 0.08em; text-transform: uppercase;
     border-radius: var(--radius-md); cursor: pointer; text-decoration: none; white-space: nowrap;
     box-shadow: 0 4px 16px rgba(0, 127, 255, 0.35);
     transition: background .15s ease, transform .15s ease, box-shadow .15s ease;
   }
   .btn:hover { background: #1a8fff; transform: translateY(-1px); }
   .btn:active { background: #0060cc; transform: translateY(0); }
   .btn.ghost { background: transparent; border: 1px solid var(--border-deep); box-shadow: none; color: var(--text-body); }
   .btn.ghost:hover { border-color: var(--accent); color: #fff; background: rgba(0,127,255,.12); }
   .btn.sm { height: 32px; padding: 0 12px; font-size: 10px; }
   .btn:disabled { opacity: .5; cursor: not-allowed; transform: none; }
   
   /* ---------- Page ---------- */
   .page-title-row { display: flex; align-items: center; gap: var(--space-lg); margin-bottom: 24px; flex-wrap: wrap; }
   .page-title-row .cover-mini { width: 56px; height: 84px; border-radius: var(--radius-sm); object-fit: cover; box-shadow: var(--shadow-card-lg); }
   .page-title-row h1 { font: 600 24px/28px var(--font-body); text-transform: uppercase; margin: 0; }
   .page-title-row .sub { color: var(--text-soft); font-size: var(--text-md); }
   .back-link { color: var(--accent); background: none; font: 600 12px var(--font-body); letter-spacing: .06em; text-transform: uppercase; cursor: pointer; margin-bottom: 14px; align-self: flex-start; }
   .back-link:hover { color: #1a8fff; }
   
   .home-section .section-header .spacer { flex: 1; }
   .link-btn { color: var(--accent); background: none; font: 600 12px var(--font-body); letter-spacing: .06em; text-transform: uppercase; cursor: pointer; }
   .link-btn:hover { color: #1a8fff; }
   .hero-text { color: var(--text-soft); font-size: var(--text-lg); line-height: 1.5; max-width: 640px; margin-bottom: var(--space-md); }
   
   /* ---------- Carrousels (scroll natif) ---------- */
   .scroller {
     display: flex; gap: 15px; overflow-x: auto; scroll-snap-type: x proximity;
     padding: 20px; height: 100%; align-items: center; scrollbar-width: none;
   }
   .scroller::-webkit-scrollbar { display: none; }
   .scroller > * { flex: 0 0 auto; scroll-snap-align: start; }
   .carousel-container.auto-h { height: auto; min-height: 120px; }
   .carousel-container.profiles-h { height: 232px; }
   .carousel-container.games-h { height: 288px; }
   .carousel-container { position: relative; }
   .empty { color: var(--text-soft); padding: 28px; text-align: center; width: 100%; font-size: var(--text-md); }
   
   /* ---------- Jaquettes ---------- */
   .game-item { cursor: pointer; background: none; text-align: left; display: block; }
   .game-item .game-wrapper { width: 171px; height: 257px; }
   .game-label { margin-top: 8px; font: 600 var(--text-md)/1.3 var(--font-body); max-width: 171px; }
   .game-count { color: var(--text-soft); font-size: var(--text-sm); margin-top: 2px; }
   .count-badge {
     position: absolute; top: 8px; right: 8px; z-index: 2;
     padding: 3px 8px; border-radius: 999px;
     background: rgba(11, 14, 20, .8); backdrop-filter: blur(4px);
     font: 700 10px/1 var(--font-body); letter-spacing: .06em; color: #fff;
   }
   .games-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(171px, 1fr)); gap: 24px 20px; }
   .games-grid .game-wrapper { width: 100%; height: auto; aspect-ratio: 171 / 257; }
   .games-grid .game-label { max-width: none; }
   .game-item .game-overlay { font: 700 11px var(--font-body); letter-spacing: .08em; text-transform: uppercase; color: #fff; }
   .game-item:focus-visible .game-wrapper { border-color: var(--accent); }
   
   /* ---------- Cartes de profil ---------- */
   .pcard {
     width: 272px; background: var(--bg-hover); border: 1px solid var(--border-medium);
     border-radius: var(--radius-lg); padding: 14px; display: flex; flex-direction: column; gap: 10px;
     text-align: left; cursor: pointer; color: inherit; font: inherit;
     transition: border-color var(--t-fast), transform var(--t-fast), box-shadow var(--t-fast);
   }
   .pcard:hover, .pcard:focus-visible { border-color: var(--accent); transform: translateY(-2px); box-shadow: var(--shadow-accent-sm); outline: none; }
   .pcard-top { display: flex; gap: 12px; align-items: flex-start; }
   .pcard-top img { width: 44px; height: 66px; object-fit: cover; border-radius: var(--radius-sm); flex-shrink: 0; }
   .pcard-name { font: 600 var(--text-lg)/1.25 var(--font-body); overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; word-break: break-word; }
   .pcard-game { color: var(--accent); font: 600 var(--text-sm)/1.2 var(--font-body); margin-top: 4px; }
   .pcard-desc { color: var(--text-soft); font-size: var(--text-base); line-height: 1.4; min-height: 2.8em; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; word-break: break-word; }
   .pcard-foot { display: flex; align-items: center; justify-content: space-between; color: var(--text-soft); font-size: var(--text-sm); gap: 8px; }
   .pcard-foot .dl { display: inline-flex; align-items: center; gap: 4px; color: var(--text-body); font-weight: 600; }
   .dl svg, .btn svg { width: 14px; height: 14px; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
   .profiles-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(272px, 1fr)); gap: 16px; }
   .profiles-grid .pcard { width: 100%; }
   .rank { color: var(--accent-cyan); font-weight: 700; }
   
   /* ---------- Tags / filtres ---------- */
   .chips { display: flex; flex-wrap: wrap; gap: 6px; }
   .chip {
     padding: 4px 10px; border-radius: 999px; background: rgba(0,127,255,.12);
     border: 1px solid rgba(0,127,255,.3); color: #9cc9ff;
     font: 600 11px/1.2 var(--font-body); cursor: default; white-space: nowrap;
   }
   button.chip { cursor: pointer; transition: background .15s, border-color .15s, color .15s; }
   button.chip:hover { border-color: var(--accent); color: #fff; }
   button.chip.on { background: var(--accent); border-color: var(--accent); color: #fff; }
   .filters { display: flex; flex-wrap: wrap; gap: var(--space-md); align-items: center; margin-bottom: 20px; }
   .filters .chips { flex: 1; min-width: 200px; }
   .select {
     height: 36px; padding: 0 10px; background: var(--bg-card); color: var(--text-main);
     border: 1px solid var(--border-deep); border-radius: var(--radius-md); font: 500 13px var(--font-body); outline: none;
   }
   .select:focus { border-color: var(--accent); }
   
   /* ---------- Modales ---------- */
   .modal-backdrop {
     position: fixed; inset: 0; z-index: 10100; background: rgba(0,0,0,.65);
     display: flex; align-items: center; justify-content: center; padding: 16px;
   }
   .modal {
     width: min(640px, 100%); max-height: calc(100dvh - 32px); overflow-y: auto;
     background: var(--bg-info); border: 1px solid var(--border-deep); border-radius: var(--radius-2xl);
     box-shadow: var(--shadow-modal); animation: pop .18s cubic-bezier(.2,1.4,.4,1);
   }
   @keyframes pop { from { opacity: 0; transform: scale(.94) translateY(-6px); } }
   .modal-head { display: flex; align-items: center; justify-content: space-between; padding: 16px 20px; border-bottom: 1px solid var(--border-deep); }
   .modal-head h2 { margin: 0; font: 700 13px/1 var(--font-body); letter-spacing: .12em; text-transform: uppercase; }
   .modal-close { font-size: 20px; line-height: 1; color: #fff; padding: 4px 8px; }
   .modal-close:hover { color: var(--accent); }
   .modal-body { padding: 20px; display: flex; flex-direction: column; gap: 14px; }
   .modal-foot { padding: 14px 20px; border-top: 1px solid var(--border-deep); display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap; }
   .meta { display: flex; flex-wrap: wrap; gap: 6px 16px; color: var(--text-light); font-size: var(--text-base); }
   .meta b { color: #fff; }
   .desc { color: var(--text-body); line-height: 1.5; white-space: pre-wrap; word-break: break-word; }
   .kv { width: 100%; border-collapse: collapse; font-size: var(--text-base); }
   .kv th, .kv td { padding: 6px 10px; text-align: left; border-bottom: 1px solid var(--border-deep); }
   .kv th { color: var(--text-light); font-weight: 600; }
   .kv td { font-family: var(--font-display); font-weight: 600; }
   .sub-title { font: 700 11px/1 var(--font-body); letter-spacing: .1em; text-transform: uppercase; color: var(--text-light); margin-top: 4px; }
   
   .field { display: flex; flex-direction: column; gap: 6px; }
   .field label { font: 600 12px var(--font-body); color: var(--text-light); }
   .field input[type="text"] {
     height: 38px; padding: 0 12px; background: var(--bg-card); color: #fff;
     border: 1px solid var(--border-deep); border-radius: var(--radius-md); font: 500 14px var(--font-body); outline: none;
   }
   .field input[type="text"]:focus { border-color: var(--accent); }
   .file-drop {
     border: 1px dashed var(--border-deep); border-radius: var(--radius-lg); padding: 18px; text-align: center;
     color: var(--text-light); cursor: pointer; background: rgba(0,0,0,.15); transition: border-color .15s, background .15s;
   }
   .file-drop:hover, .file-drop.drag { border-color: var(--accent); background: rgba(0,127,255,.1); }
   .file-drop input { display: none; }
   .hint { color: var(--text-light); font-size: var(--text-sm); line-height: 1.5; }
   .hint a, .hint button { color: #9cc9ff; text-decoration: underline; background: none; font: inherit; cursor: pointer; }
   .errors { background: rgba(255,59,48,.15); border: 1px solid rgba(255,59,48,.5); border-radius: var(--radius-md); padding: 10px 14px; font-size: var(--text-base); color: #ffb4ae; }
   .errors ul { margin: 6px 0 0 18px; }
   .preview { background: rgba(87,209,71,.12); border: 1px solid rgba(87,209,71,.4); border-radius: var(--radius-md); padding: 10px 14px; font-size: var(--text-base); }
   
   /* ---------- Toast ---------- */
   #toast {
     position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 20px); z-index: 10200;
     background: var(--bg-card); border: 1px solid var(--accent); border-radius: var(--radius-lg);
     padding: 12px 18px; font: 600 14px var(--font-body); opacity: 0; pointer-events: none;
     transition: opacity .2s, transform .2s; max-width: calc(100vw - 32px);
   }
   #toast.show { opacity: 1; transform: translate(-50%, 0); }
   
   /* ---------- Mobile ---------- */
   @media (hover: none) and (pointer: coarse) {
     .home-page { padding-bottom: 28px; }
     .topbar { padding-top: 4px; }
     .btn .btn-label { display: none; }
     .btn { padding: 0 12px; }
     .carousel-container.games-h { height: 236px; }
     .game-item .game-wrapper { width: 130px; height: 194px; }
     .game-label { max-width: 130px; }
     .games-grid { grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 18px 12px; }
     .games-grid .game-wrapper { height: auto; width: 100%; }
     .modal-backdrop { align-items: flex-end; padding: 0; }
     .modal { border-radius: var(--radius-2xl) var(--radius-2xl) 0 0; max-height: 92dvh; }
     #toast { bottom: 84px; }
   }
   .home-section.tight { padding-top: 16px; }
   
   /* ============================================================
      SÉLECTEUR DE TAGS (modale d'ajout)
      ============================================================ */
   .tp-box {
     display: flex; flex-wrap: wrap; align-items: center; gap: 6px;
     min-height: 42px; padding: 6px 8px; cursor: text;
     background: var(--bg-card); border: 1px solid var(--border-deep); border-radius: var(--radius-md);
     transition: border-color var(--t-fast), box-shadow var(--t-fast);
   }
   .tp-box:focus-within { border-color: var(--accent); box-shadow: var(--shadow-glow-sm); }
   .tp-chips { display: contents; }
   .tp-chip {
     display: inline-flex; align-items: center; gap: 4px; padding: 4px 6px 4px 10px; border-radius: 999px;
     background: rgba(0,127,255,.18); border: 1px solid rgba(0,127,255,.45); color: #cfe4ff;
     font: 600 12px/1.2 var(--font-body);
   }
   .tp-chip button { width: 18px; height: 18px; border-radius: 50%; font-size: 14px; line-height: 1; color: #9cc9ff; transition: background .15s, color .15s; }
   .tp-chip button:hover { background: rgba(255,255,255,.18); color: #fff; }
   .field input[type="text"].tp-input {
     flex: 1; min-width: 140px; height: 28px; padding: 0 4px; border: none; background: transparent; border-radius: 0; box-shadow: none;
   }
   .tp-input:disabled { display: none; }
   .tp-list { display: none; margin-top: 6px; max-height: 196px; overflow-y: auto; background: var(--bg-card); border: 1px solid var(--border-deep); border-radius: var(--radius-md); box-shadow: var(--shadow-dropdown); }
   .tp-list.open { display: block; }
   .tp-opt { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 9px 12px; cursor: pointer; font: 600 13px var(--font-body); }
   .tp-opt + .tp-opt { border-top: 1px solid rgba(255,255,255,.05); }
   .tp-opt:hover, .tp-opt.on { background: rgba(0,127,255,.18); }
   .tp-n { color: var(--text-soft); font-weight: 500; font-size: 11px; white-space: nowrap; }
   .tp-opt.new { color: #9cc9ff; justify-content: flex-start; }
   .tp-opt.new b { color: #fff; }
   .tp-plus { display: inline-grid; place-items: center; width: 20px; height: 20px; border-radius: 50%; background: var(--accent); color: #fff; font-weight: 700; flex-shrink: 0; }
   
   /* ============================================================
      MODALE PROFIL
      ============================================================ */
   .modal.modal-profile { width: min(780px, 100%); }
   .modal-foot .spacer { flex: 1; }
   .btn.ghost.danger { color: #ff8a82; }
   .btn.ghost.danger:hover { border-color: #ff3b30; background: rgba(255,59,48,.14); color: #fff; }
   
   .pf-hero { display: flex; gap: 18px; align-items: stretch; padding: 16px; border-radius: var(--radius-xl); background: linear-gradient(135deg, rgba(0,127,255,.16), rgba(15,23,38,.6)); border: 1px solid var(--border-deep); }
   .pf-cover { width: 96px; height: 144px; flex-shrink: 0; object-fit: cover; border-radius: var(--radius-md); box-shadow: var(--shadow-card-lg); }
   .pf-hero-body { display: flex; flex-direction: column; justify-content: center; gap: 6px; min-width: 0; flex: 1; }
   .pf-game { font: 700 11px/1 var(--font-body); letter-spacing: .14em; text-transform: uppercase; color: var(--accent-cyan); }
   .pf-by { color: var(--text-light); font-size: var(--text-md); }
   .pf-by b { color: #fff; }
   .pf-stats { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
   .pf-stat { display: flex; flex-direction: column; gap: 2px; min-width: 104px; padding: 8px 12px; border-radius: var(--radius-lg); background: rgba(0,0,0,.28); border: 1px solid rgba(255,255,255,.07); }
   .pf-stat b { font: 700 18px/1.1 var(--font-display); color: #fff; }
   .pf-stat span { font: 600 10px/1.2 var(--font-body); letter-spacing: .08em; text-transform: uppercase; color: var(--text-soft); }
   
   .pf-desc { margin: 0; padding: 12px 16px; color: var(--text-body); line-height: 1.55; white-space: pre-wrap; word-break: break-word; background: rgba(0,0,0,.2); border-left: 3px solid var(--accent); border-radius: 0 var(--radius-md) var(--radius-md) 0; }
   
   .pf-section { display: flex; flex-direction: column; gap: 10px; }
   .pf-section-head { display: flex; align-items: baseline; justify-content: space-between; padding-bottom: 6px; border-bottom: 1px solid var(--border-deep); }
   .pf-section-head span { font: 700 12px/1 var(--font-body); letter-spacing: .12em; text-transform: uppercase; color: #fff; }
   .pf-section-head em { font-style: normal; font-size: var(--text-sm); color: var(--text-soft); }
   .fx-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 10px; }
   .fx { display: flex; flex-direction: column; gap: 8px; padding: 10px 12px; border-radius: var(--radius-lg); background: rgba(0,0,0,.22); border: 1px solid rgba(255,255,255,.07); }
   .fx.off { opacity: .5; }
   .fx-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
   .fx-name { font: 600 13px/1.2 var(--font-body); color: #fff; }
   .fx-state { padding: 2px 7px; border-radius: 999px; font: 700 9px/1.4 var(--font-body); letter-spacing: .08em; background: var(--status-ready); color: #0E151D; }
   .fx.off .fx-state { background: var(--status-off-bg); color: var(--status-off-text); }
   .fx-meter { display: grid; grid-template-columns: 62px 1fr 38px; align-items: center; gap: 8px; font-size: var(--text-sm); }
   .fx-label { color: var(--text-soft); }
   .fx-val { text-align: right; color: var(--text-body); font: 600 11px var(--font-display); }
   .fx-track { height: 6px; border-radius: 999px; background: var(--bg-input); overflow: hidden; }
   .fx-track i { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, #0a5fc4, var(--accent)); }
   .fx-track i.over { background: linear-gradient(90deg, var(--accent), var(--accent-cyan)); }
   
   @media (max-width: 560px) {
     .pf-hero { flex-direction: column; align-items: center; text-align: center; }
     .pf-stats { justify-content: center; }
   }