/* Louis TCG — confort au pouce (téléphone portrait ≤ 760 px et téléphone en paysage).
   Chargé APRÈS tcg.css : uniquement des media queries, rien ne change sur ordinateur ni sur tablette ≥ 761 px de large.
   Même charte (verre violet) : on ne fait qu'agrandir les cibles, les textes et réorganiser pour le petit écran. */

@keyframes tc-feuille { from { transform: translateY(48px); opacity: .3; } }
@media (max-width: 760px) and (prefers-reduced-motion: reduce) { .tc-couche > .tc-boite { animation: none !important; } }

/* ===================== Téléphone (portrait) ===================== */
@media (max-width: 760px) {
  /* --- en-tête : sous la languette de la barre de musique (22 px en haut au centre) --- */
  #tc-haut { margin-top: calc(26px + env(safe-area-inset-top, 0px)); height: 52px; padding: 0 6px; gap: 6px; }
  #tc-vue {
    height: calc(100vh - 78px - env(safe-area-inset-top, 0px));
    height: calc(100dvh - 78px - env(safe-area-inset-top, 0px));
    padding: 14px 12px calc(110px + env(safe-area-inset-bottom, 0px));
    overscroll-behavior: contain;
  }
  #tc-haut .tc-btn { min-width: 44px; min-height: 44px; padding: 0 11px; font-size: 17px; }
  .tc-profil { min-width: 44px; min-height: 44px; padding: 2px; justify-content: center; }
  .tc-profil .tc-tete { width: 38px; height: 38px; }
  .tc-solde { min-height: 40px; align-items: center; }
  #tc-logo { padding: 8px 0; font-size: 21px; flex: 0 1 auto; min-width: 0; }
  #tc-haut > * { flex-shrink: 0; }
  #tc-haut > #tc-logo, #tc-haut > .tc-espace { flex-shrink: 1; }
  /* sur les écrans secondaires, « ← » suffit : le lobby reste dans le menu « Plus » */
  #tc-haut:has(#tc-retour:not([hidden])) #tc-lobby { display: none; }

  /* --- barre d'onglets du bas : 6 onglets (le 6e « Plus » ouvre le menu des autres écrans) --- */
  #tc-nav { width: min(calc(100vw - 16px), 480px); padding: 5px; gap: 2px; }
  #tc-nav button { min-height: 54px; justify-content: center; font-size: 12px; padding: 4px 1px; min-width: 0; }
  #tc-nav button span { font-size: 22px; }
  body:has(.tc-chat:not([hidden])) #tc-nav { display: none; }

  /* --- cibles ≥ 44 px, textes ≥ 14 px --- */
  .tc-btn { min-height: 44px; }
  .tc-btn.petit { font-size: 14px; min-height: 44px; padding: 8px 13px; border-radius: 13px; }
  .tc-chip { font-size: 14px; min-height: 44px; padding: 8px 14px; }
  .tc-x { min-width: 44px; min-height: 44px; font-size: 20px; display: inline-flex; align-items: center; justify-content: center; }
  .tc-lien { font-size: 14px; min-height: 44px; padding: 10px 6px; }
  .tc-input, #tc-vue input, #tc-couches input, #tc-couches textarea, #tc-couches select, .tc-chat input { font-size: 16px; min-height: 44px; }
  .tc-note, .tc-tuile small, .tc-serie-info p, .tc-bienvenue-bloc span, .tc-route-entr span, .tc-taux { font-size: 14px; }
  .tc-sous { font-size: 15px; line-height: 1.4; }
  .tc-panneau h2 { font-size: 14px; }
  .tc-panneau h2 .droite { font-size: 13px; }
  .tc-titre { font-size: 26px; }
  .tc-tpill, .tc-spill, .tc-gpuce { font-size: 14px; }
  .tc-serie-prog, .tc-prog, .tc-joueur .etat, .tc-alerte, .tc-dk-actif, .tc-table th { font-size: 14px; }
  .tc-info small, .tc-compte small { font-size: 13px; }
  button.tc-mini { min-height: 44px; }
  .tc-qui.lien { padding-block: 6px; }
  button kbd { display: none; } /* raccourcis clavier inutiles au doigt */
  .tc-carte { -webkit-touch-callout: none; }

  /* --- toasts au-dessus de la barre d'onglets --- */
  #tc-toasts { left: 8px; right: 8px; bottom: calc(84px + env(safe-area-inset-bottom, 0px)); align-items: stretch; }
  .tc-toast { max-width: none; font-size: 14px; }
  .tc-toast .tc-btn { min-height: 40px; }
  .tc-bouchon { top: auto; right: auto; left: 8px; bottom: calc(80px + env(safe-area-inset-bottom, 0px)); font-size: 10px; opacity: .65; }

  /* --- couches : feuilles du bas, plein largeur, ✕ toujours visible, défilement interne --- */
  .tc-couche:not(.tc-ouverture):not(.tc-combat) { align-items: flex-end; }
  .tc-couche > .tc-boite {
    width: 100% !important; max-width: none; margin: 0;
    max-height: calc(100vh - 10px - env(safe-area-inset-top, 0px));
    max-height: calc(100dvh - 10px - env(safe-area-inset-top, 0px));
    border-radius: 24px 24px 0 0; border-bottom: 0;
    padding: 12px 14px calc(20px + env(safe-area-inset-bottom, 0px));
    overflow-y: auto; overflow-x: hidden; overscroll-behavior: contain; -webkit-overflow-scrolling: touch;
    animation: tc-feuille .24s cubic-bezier(.2, .9, .3, 1);
  }
  .tc-couche > .tc-boite > .tc-x {
    position: sticky; top: 0; right: auto; float: none; display: flex; margin: 0 0 -44px auto; z-index: 6;
    background: rgba(48, 34, 92, .92); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  }
  .tc-couche > .tc-boite > h2 { padding: 6px 50px 0; font-size: 21px; }
  .tc-couche > .tc-boite > .tc-boutons:last-child { position: sticky; bottom: 0; z-index: 4; margin: 14px -14px calc(-20px - env(safe-area-inset-bottom, 0px)); padding: 12px 14px calc(14px + env(safe-area-inset-bottom, 0px)); background: linear-gradient(180deg, rgba(26, 17, 52, 0), rgba(26, 17, 52, .96) 30%); }
  .tc-couche > .tc-boite > .tc-boutons:last-child > .tc-btn { flex: 1 1 auto; }
  .tc-couche:has(.tc-det-nav) > .tc-boite { padding-bottom: calc(78px + env(safe-area-inset-bottom, 0px)); }
  .tc-det-nav { bottom: calc(12px + env(safe-area-inset-bottom, 0px)); width: 56px; height: 50px; }
  .tc-detail .droite { width: 100%; }
  .tc-couche > .tc-boite > .tc-detail .gauche { padding-top: 34px; }
  .tc-action { flex-wrap: wrap; }
  .tc-action .tc-btn { min-width: 0; flex: 1 1 140px; }
  .tc-action span { font-size: 14px; flex-basis: 100%; }

  /* --- menu « Plus » --- */
  .tc-menu-liste { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 8px; }
  .tc-menu-item { position: relative; display: flex; flex-direction: column; align-items: flex-start; gap: 6px; min-height: 84px; padding: 12px 14px; border-radius: 18px; text-align: left; color: #fff;
    background: var(--verre-fort); border: 1px solid var(--verre-bord); box-shadow: inset 0 1px 0 rgba(255, 255, 255, .1); }
  .tc-menu-item .ico { font-size: 26px; line-height: 1; }
  .tc-menu-item b { font: 800 15px var(--titre); }
  .tc-menu-item.on { border-color: rgba(243, 207, 107, .8); box-shadow: 0 0 0 1px rgba(243, 207, 107, .4); }
  .tc-menu-item .pastille { position: absolute; right: 10px; top: 10px; min-width: 22px; padding: 2px 7px; border-radius: 999px; background: #f2bd4c; color: #2a1a05; font: 900 13px var(--titre); text-align: center; }
  .tc-menu-item.large { grid-column: 1 / -1; min-height: 56px; flex-direction: row; align-items: center; }

  /* --- accueil --- */
  .tc-tuiles { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .tc-tuile { padding: 14px; }
  .tc-tuile.grosse b { font-size: 21px; }
  .tc-bonus { flex-wrap: wrap; }
  .tc-bonus .tc-btn { flex: 1 1 100%; }

  /* --- boosters --- */
  .tc-series { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .tc-serie-btns .tc-btn { white-space: normal; }
  .tc-forcer { gap: 6px; }

  /* --- classeur --- */
  .tc-coll-barre { gap: 8px; }
  .tc-coll-barre .tc-vue-coll { margin-left: 0; }
  .tc-filtres h2.tc-repli { min-height: 44px; display: flex; align-items: center; margin: -6px 0 -6px; }
  .tc-filtres:not(.replie) h2.tc-repli { margin-bottom: 8px; }
  .tc-filtres .tc-ligne { gap: 6px; }
  .tc-coll-prog.replie > :not(h2):not(.tc-compteurs) { display: none; }
  .tc-coll-prog h2.tc-repli { cursor: pointer; min-height: 40px; display: flex; align-items: center; margin-top: -6px; }
  .tc-coll-prog h2.tc-repli::after { content: "▾"; margin-left: 6px; order: 1; }
  .tc-coll-prog.replie h2.tc-repli::after { content: "▸"; }
  .tc-coll-prog h2.tc-repli .droite { order: 2; }
  .tc-coll-prog.replie .tc-compteurs { margin-bottom: 0; }
  .tc-coll-aside { gap: 10px; }
  .tc-up { min-width: 38px; height: 38px; font-size: 18px; line-height: 34px; top: -8px; right: -8px; }
  .tc-up::before { content: ""; position: absolute; inset: -6px; }
  .tc-compteurs { font-size: 14px; }
  .tc-livre { padding: 6px 0 64px; }
  .tc-fleche { top: auto; bottom: 0; transform: none; width: 64px; height: 52px; }
  .tc-fleche.g { left: calc(50% - 72px); } .tc-fleche.d { right: calc(50% - 72px); }

  /* --- decks : éditeur au doigt --- */
  .tc-slots { gap: 10px; flex-wrap: nowrap; justify-content: center; }
  .tc-slot { flex: 1 1 0; min-width: 0; }
  .tc-slot .vide { width: 100%; height: auto; aspect-ratio: 1 / 1.3968; font-size: 14px; padding: 6px; }
  .tc-slot .tc-note { font-size: 12px; text-align: center; }
  .tc-dk-retirer { width: 34px; height: 34px; right: -6px; top: -10px; font-size: 16px; }
  .tc-dk-retirer::before { content: ""; position: absolute; inset: -6px; }
  #tc-vue .tc-grille.tc-grille-deck { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px 10px; justify-items: center; }
  .tc-page:has(> .tc-grille-deck) { display: flex; flex-direction: column; }
  .tc-page:has(> .tc-grille-deck) > * { flex: none; }
  .tc-page:has(> .tc-grille-deck) > .tc-btn:first-child { align-self: flex-start; }
  .tc-page > .tc-dk-ana { order: 10; }
  .tc-page > .tc-dk-barre { order: 9; position: sticky; bottom: calc(80px + env(safe-area-inset-bottom, 0px)); z-index: 5; margin: 12px -6px 0; padding: 10px 8px; border-radius: 20px;
    background: rgba(30, 20, 60, .82); border: 1px solid var(--verre-bord); backdrop-filter: var(--flou); -webkit-backdrop-filter: var(--flou); flex-wrap: nowrap; }
  .tc-page > .tc-dk-barre .tc-btn { flex: 1 1 0; min-width: 0; white-space: normal; font-size: 14px; line-height: 1.15; padding: 6px 8px; border-radius: 14px; }
  .tc-page > .tc-dk-barre { padding: 6px; }
  .tc-page > .tc-grille-deck { order: 8; }
  .tc-page:has(> .tc-grille-deck) > .tc-ligne { order: 7; }
  .tc-dk-choix { max-height: none; }
  .tc-dk-ligne { min-height: 56px; }
  .tc-decks { grid-template-columns: 1fr; }

  /* --- la Route : nœuds touchables, étiquettes lisibles --- */
  .tc-noeud .lab b { font-size: 13px; }
  .tc-noeud .lab small { font-size: 11px; }
  .tc-route-sep b { font-size: 14px; }
  .tc-route-entr .tc-btn { flex: 1 1 100%; }
  /* aperçu d'étape : 3 cartes côte à côte, bouton Combattre collé en bas de la feuille */
  .tc-apercu .tc-ap-equipe { gap: 8px; flex-wrap: nowrap; }
  .tc-apercu .tc-ap-tete { padding-right: 40px; }
  .tc-apercu .tc-ap-tete .tc-tete { width: 64px !important; height: 64px !important; flex: none; }
  .tc-apercu .tc-ap-tete h2 { font-size: 20px; }
  .tc-apercu .tc-ap-ligne { font-size: 14px; }
  .tc-apercu > .tc-boutons .tc-btn { width: 100%; }

  /* --- combat (portrait) : la scène en haut, actions toujours visibles en bas --- */
  .tc-cb-atk { min-height: 58px; padding: 7px 9px; }
  .tc-cb-atk .l1 { gap: 5px; }
  .tc-cb-atk .nm { font-size: 14px; }
  .tc-cb-atk .tc-pips i { width: 12px; height: 12px; }
  .tc-cb-atk .l2 { flex-wrap: wrap; gap: 0 8px; padding-right: 0; font-size: 12.5px; line-height: 1.3; }
  .tc-cb-atk .l2 span { white-space: nowrap; }
  .tc-cb-atk .raison { font-size: 12px; }
  .tc-cb-autres { gap: 6px; }
  .tc-cb-autres .tc-btn, .tc-cb-autres .tc-chip { min-height: 44px; flex: 1 1 auto; }
  .tc-cb-reserve button { min-height: 56px; flex: 1 1 100%; }
  .tc-cb-reserve small { font-size: 13px; }
  .tc-cb-attente { font-size: 15px; }
  /* journal : on le touche pour le déplier (plus de bouton flottant par-dessus « Vitesse ») */
  .tc-combat .tc-cb-jbtn { display: none; }
  /* panneau en colonne : le journal déplié pousse (le panneau défile) au lieu de recouvrir les actions */
  .tc-combat .tc-cb-bas { display: flex; flex-direction: column; gap: 10px; padding-bottom: calc(12px + env(safe-area-inset-bottom, 0px)); }
  .tc-combat .tc-cb-actions, .tc-combat .tc-cb-journal { flex: none; }
  .tc-combat .tc-cb-journal { font-size: 13px; cursor: pointer; }
  .tc-combat .tc-cb-journal::before { content: "📜 ▾"; float: right; position: sticky; top: 0; margin: 0 0 2px 8px; padding: 2px 8px; border-radius: 8px; background: rgba(42, 16, 80, .95); border: 1px solid rgba(190, 130, 255, .6); font-size: 12px; line-height: 1.4; }
  .tc-combat .tc-cb-journal.ouvert::before { content: "📜 ▴"; }
  .tc-cb-fin .tc-boite { max-height: calc(100dvh - 24px); overflow-y: auto; }
  .tc-cb-fin h2 { font-size: 34px; }

  /* --- PvP, échanges, communauté --- */
  .tc-joueur .nm { flex: 1 1 100%; }
  .tc-joueur .tc-btn { flex: 1 1 auto; }
  .tc-joueur .tc-btn[title] { flex: 0 0 52px; }
  .tc-panneau { padding: 14px; }
  .tc-ech-liste { max-height: 40vh; }
  .tc-ech-item .moins { width: 32px; height: 32px; left: -8px; top: -8px; font-size: 16px; }
  .tc-ech-item .moins::before { content: ""; position: absolute; inset: -6px; }
  .tc-table td, .tc-table th { padding: 8px 6px; }

  /* --- chat du lobby : feuille du bas plein largeur, au-dessus du clavier --- */
  .tc-chat { left: 0; right: 0; bottom: 0; width: auto; z-index: 19; border-radius: 22px 22px 0 0;
    height: min(560px, calc(100vh - 90px)); height: min(560px, calc(100dvh - 90px)); padding-bottom: env(safe-area-inset-bottom, 0px); }
  body:has(.tc-chat:not([hidden])) .tc-chat-btn { display: none; }
  .tc-chat-haut { min-height: 56px; }
  .tc-chat-haut .tc-x { min-width: 44px; min-height: 44px; }
  .tc-chat-haut .tc-lien { margin: 0; min-height: 44px; display: inline-flex; align-items: center; }
  .tc-chat-etat { font-size: 12px; }
  .tc-chat-nom { font-size: 13px; }
  .tc-chat-saisie .tc-btn { min-height: 44px; }
  .tc-reac { font-size: 14px; min-height: 30px; padding: 2px 9px; }
  .tc-reac-plus { font-size: 14px; min-height: 30px; min-width: 36px; }
  .tc-reac-menu button { font-size: 22px; min-width: 40px; min-height: 40px; }

  /* --- ouverture de boosters (opening.js) : boutons au pouce --- */
  .tco .tco-passer { min-height: 44px; padding: 10px 18px; font-size: 14px; opacity: .9; bottom: 66px; }
  .tco .tco-aide { font-size: 14px; }
  .tco .tco-btn { min-height: 48px; }
  .tc-ouverture .aide { font-size: 14px; }
  .tc-ouverture .aide button { min-height: 44px; }
}

/* Petits téléphones : séries en fiche horizontale (paquet à gauche, infos à droite) */
@media (max-width: 480px) {
  .tc-series { grid-template-columns: 1fr; gap: 12px; }
  .tc-serie-choix { display: grid; grid-template-columns: 108px minmax(0, 1fr); column-gap: 12px; row-gap: 8px; align-items: start; }
  .tc-serie-choix > .tc-paquet-serie { grid-row: 1 / span 3; aspect-ratio: 3 / 4.2; }
  .tc-serie-choix > .tc-serie-btns { grid-column: 1 / -1; }
  .tc-paquet-serie .bas { left: 8px; right: 8px; bottom: 8px; }
  .tc-paquet-serie .bas .nom { font-size: 13px; }
  .tc-paquet-serie .bas .secrete { display: none; }
  .tc-paquet-serie .marque { left: 8px; top: 18px; font-size: 10px; padding: 2px 7px; }
  .tc-serie-info p { margin: 0 0 6px; }
  .tc-serie-choix .tc-qte-choix .tc-chip { flex: 1 1 0; min-width: 44px; padding: 8px 6px; }
}

/* Écran tactile : pas de survol, l'appui montre l'effet brillant (classe .survol posée au doigt par tcg.js) */
@media (hover: none) {
  .tc-carte.survol { transition: transform .15s; }
}

/* ===================== Téléphone en paysage ===================== */
@media (orientation: landscape) and (max-height: 500px) and (max-width: 1000px) {
  :root { --haut: 56px; }
  #tc-haut { margin: 4px 10px 0; height: 50px; border-radius: 16px; }
  #tc-vue { height: calc(100vh - 56px); height: calc(100dvh - 56px); padding: 12px max(14px, env(safe-area-inset-right, 0px)) 24px max(14px, env(safe-area-inset-left, 0px)); }
  #tc-haut .tc-btn { min-height: 42px; }
  .tc-btn.petit, .tc-chip { min-height: 40px; font-size: 14px; }
  .tc-couche > .tc-boite { max-height: calc(100dvh - 12px); overflow-y: auto; overscroll-behavior: contain; }
  .tc-couche > .tc-boite > .tc-x { position: sticky; top: 0; right: auto; display: flex; align-items: center; justify-content: center; margin: 0 0 -44px auto; min-width: 44px; min-height: 44px; z-index: 6; background: rgba(48, 34, 92, .92); }

  /* combat côte à côte : la scène à gauche, les actions à droite sur toute la hauteur */
  .tc-couche.tc-combat { flex-direction: row; }
  .tc-combat .tc-cb-scene { flex: 1 1 auto; min-height: 0; height: 100%; min-width: 0; }
  .tc-combat .tc-cb-bas {
    flex: 0 0 min(44vw, 400px); height: 100%; max-height: none; display: flex; flex-direction: column; gap: 8px;
    padding: 8px max(10px, env(safe-area-inset-right, 0px)) 8px 10px; border-top: 0; border-left: 1px solid var(--verre-bord); overflow: hidden;
  }
  .tc-combat .tc-cb-actions { flex: 1 1 auto; height: auto; min-height: 0; max-height: none; overflow-y: auto; overscroll-behavior: contain; }
  .tc-combat .tc-cb-journal { flex: 0 0 auto; height: 3.7em; max-height: 3.7em; min-height: 0; font-size: 12.5px; align-self: stretch; transition: height .25s, max-height .25s; }
  .tc-combat .tc-cb-journal.ouvert { height: 45vh; max-height: 45vh; }
  .tc-combat .tc-cb-jbtn { display: none; }
  .tc-combat .tc-cb-journal { cursor: pointer; }
  .tc-combat .tc-cb-journal::before { content: "📜 ▾"; float: right; position: sticky; top: 0; margin: 0 0 2px 8px; padding: 1px 7px; border-radius: 8px; background: rgba(42, 16, 80, .95); border: 1px solid rgba(190, 130, 255, .6); font-size: 11px; line-height: 1.4; }
  .tc-combat .tc-cb-journal.ouvert::before { content: "📜 ▴"; }
  .tc-cb-atks { grid-template-columns: 1fr 1fr; gap: 6px; }
  .tc-cb-atk { min-height: 52px; padding: 6px 8px; }
  .tc-cb-atk .nm { font-size: 14px; }
  .tc-cb-atk .l2 { flex-wrap: wrap; gap: 0 8px; padding-right: 0; font-size: 12px; }
  .tc-cb-atk .l2 span { white-space: nowrap; }
  .tc-cb-atk kbd, .tc-cb-autres kbd { display: none; }
  .tc-cb-autres { gap: 6px; }
  .tc-cb-autres .tc-btn, .tc-cb-autres .tc-chip { min-height: 42px; flex: 1 1 auto; }
  .tc-cb-reserve button { min-height: 48px; flex: 1 1 100%; }
  .tc-cote { width: min(250px, 30vw); }
  .tc-zone { gap: 10px; }
  .tc-cb-plaque { padding: 5px 8px; }
  .tc-cb-plaque .nm { font-size: 13px; }
  .tc-zone .tc-cb-plaque .dresseur { display: none; }
  .tc-mini { width: 30px; height: 40px; }
  .tc-cb-fin .tc-boite { max-height: calc(100dvh - 16px); overflow-y: auto; }
  .tc-cb-fin h2 { font-size: 30px; }
}

/* Paquet du Booster Légendaire : le titre déborde du petit paquet sur téléphone */
@media (max-width: 760px) {
  .tc-boss-paquet b { font-size: 17px; line-height: 1.1; overflow-wrap: anywhere; }
}

/* ===================== DA 2026-12 (téléphone) : surcharge finale ===================== */
@media (max-width: 760px) {
  /* en-tête plein largeur ; la languette de la barre de musique se loge dans sa marge haute */
  #tc-haut {
    margin: 0; height: calc(78px + env(safe-area-inset-top, 0px)); padding: calc(26px + env(safe-area-inset-top, 0px)) 8px 0; gap: 6px;
    border-radius: 0; border: 0; border-bottom: 1px solid var(--da-ligne);
  }
  #tc-logo { flex: 0 1 auto; min-width: 0; height: 52px; margin: 0 -10px 0 -9px; padding: 0; }
  #tc-logo img { height: 52px; max-width: 100%; object-fit: contain; }
  #tc-retour:not([hidden]) { display: inline-flex !important; }
  #tc-haut #tc-lobby, #tc-haut #tc-retour { width: 44px; height: 44px; min-width: 44px; padding: 0; justify-content: center; font-size: 18px; }
  #tc-lobby .ico { font-size: 22px; }
  .tc-solde { height: 40px; padding: 0 10px; }
  .tc-profil { height: 44px; padding: 2px; border-radius: 13px; }
  .tc-profil .tc-tete { width: 38px; height: 38px; }

  /* barre d'onglets du bas (la même <nav> que l'en-tête sur ordinateur) */
  #tc-nav {
    display: flex; position: fixed; left: 50%; bottom: calc(10px + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%); z-index: 18;
    width: min(calc(100vw - 16px), 480px); margin: 0; padding: 5px; gap: 2px; justify-content: space-between; border-radius: 20px;
    background: rgba(37, 22, 66, .98); border: 1px solid var(--da-ligne-forte); box-shadow: 0 10px 30px rgba(5, 2, 15, .55);
    backdrop-filter: none; -webkit-backdrop-filter: none;
  }
  #tc-nav button {
    flex: 1 1 0; min-width: 0; min-height: 54px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
    padding: 4px 1px; border: 0; border-radius: 15px; background: none; color: var(--da-texte-doux); font: 800 11.5px var(--police);
  }
  #tc-nav button .ico { font-size: 22px; line-height: 0; }
  #tc-nav button .lib { font-size: 11.5px; line-height: 1.1; white-space: nowrap; }
  #tc-nav button.on { color: #fff; background: var(--da-violet); }
  #tc-nav button.on .ico { color: var(--da-or); }

  /* accueil : bannière empilée, raccourcis en liste groupée */
  .tc-accueil, .tc-acc-principal, .tc-acc-cote { gap: 14px; }
  .tc-hero { grid-template-columns: minmax(0, 1fr); grid-template-areas: "txt" "stats"; gap: 14px; padding: 20px 18px 16px; border-radius: 20px;
    background: radial-gradient(300px 220px at 100% 0%, rgba(113, 56, 200, .5), transparent 72%), linear-gradient(135deg, #2e1b54, #221340 70%); }
  .tc-hero-cartes { display: none; }
  .tc-hero h2 { font-size: 24px; }
  .tc-hero-p { font-size: 14.5px; margin-bottom: 16px; }
  .tc-hero-act .tc-btn { flex: 1 1 100%; min-height: 52px; }
  .tc-hero-stats { gap: 6px; padding-top: 14px; }
  .tc-hero-stats div { padding: 5px 10px; }
  .tc-raccourcis { grid-template-columns: minmax(0, 1fr); gap: 0; background: var(--da-surface); border: 1px solid var(--da-ligne); border-radius: var(--da-rayon); overflow: hidden; box-shadow: var(--da-ombre); }
  .tc-raccourci { min-height: 64px; padding: 12px 14px; border: 0; border-radius: 0; background: none; }
  .tc-raccourci + .tc-raccourci { border-top: 1px solid var(--da-ligne); }
  .tc-raccourci small { font-size: 13px; white-space: nowrap; }
  .tc-raccourci .chev { display: block; }
  .tc-info-inutile img { width: 64px; height: 56px; }
  .tc-panneau { padding: 16px; }
  .tc-journal-tout { min-height: 44px; }
  /* PvP : nom et statut du joueur sur toute la largeur, boutons en dessous (le statut s'écrasait mot par mot) */
  .tc-joueur .tc-qui.nm { flex: 1 1 100%; }

  /* menu « Plus » en feuille du bas : lignes icône + libellé */
  .tc-menu-item { flex-direction: row; align-items: center; min-height: 64px; padding: 10px 12px; background: var(--da-surface-2); border: 1px solid var(--da-ligne); box-shadow: none; }
  .tc-menu-item .ico { font-size: 20px; }
  .tc-menu-item b { font-size: 14.5px; }
  .tc-couche > .tc-boite > .tc-x { background: var(--da-surface-2); backdrop-filter: none; -webkit-backdrop-filter: none; }
  .tc-page > .tc-dk-barre { background: rgba(37, 22, 66, .97); backdrop-filter: none; -webkit-backdrop-filter: none; }
}
@media (max-width: 380px) {
  #tc-logo img { height: 44px; }
  .tc-solde { padding: 0 8px; }
}
/* petit téléphone en paysage : en-tête bas (la languette de musique tombe dans son espace vide central) */
@media (orientation: landscape) and (max-height: 500px) and (max-width: 760px) {
  #tc-haut { height: 56px; padding: 0 max(10px, env(safe-area-inset-right, 0px)) 0 max(10px, env(safe-area-inset-left, 0px)); }
  #tc-logo img { height: 46px; }
}
/* téléphone en paysage (assez large pour l'en-tête d'ordinateur) : navigation en icônes seules */
@media (orientation: landscape) and (max-height: 500px) and (min-width: 761px) {
  #tc-haut { margin: 0; height: 56px; border-radius: 0; }
  #tc-logo img { height: 44px; }
  #tc-nav button { flex-direction: row; height: 44px; min-width: 46px; padding: 0 10px; }
  #tc-nav button .lib { display: none; }
}

/* ===================== Combat sur téléphone (2026-12) : tout tient dans l'écran =====================
   Portrait (≤ 760 px) et paysage (≤ 500 px de haut). Rien ne change sur ordinateur / tablette.
   - La scène prend la hauteur restante (container-type: size) ; la taille des cartes se calcule en CSS (cqw/cqh)
     et remplace celle choisie par tcg.js (--w de la carte, même principe que .tc-poche).
   - Le panneau des commandes est à la taille de son contenu : jamais de défilement interne.
   - La barre de musique se replie en pastille dans le coin bas-droit, au bout de la ligne du journal. */
@media (max-width: 760px) and (orientation: portrait), (orientation: landscape) and (max-height: 500px) and (max-width: 1000px) {
  .tc-couche.tc-combat { overflow: hidden; }
  .tc-couche.tc-combat .tc-cb-scene { flex: 1 1 auto; min-height: 0; min-width: 0; container-type: size; }
  .tc-couche.tc-combat .tc-carte-combat .tc-carte { --w: var(--cw) !important; }
  .tc-couche.tc-combat .tc-zone { max-width: none; gap: 8px; }
  .tc-couche.tc-combat .tc-cote { width: auto; min-width: 0; gap: 6px; }
  .tc-couche.tc-combat .tc-cb-plaque { padding: 6px 9px; border-radius: 14px; }
  .tc-couche.tc-combat .tc-cb-plaque .nm { font-size: 14px; }
  .tc-couche.tc-combat .tc-cb-plaque .l1 .tc-type-ico { flex: none; }
  .tc-couche.tc-combat .tc-pvbar { height: 16px; margin: 4px 0 4px; }
  .tc-couche.tc-combat .tc-pvbar span { top: 0; font-size: 12px; line-height: 16px; }
  .tc-couche.tc-combat .tc-energie { flex-wrap: wrap; row-gap: 3px; }
  .tc-couche.tc-combat .tc-energie i { width: 13px; height: 13px; }
  .tc-couche.tc-combat .tc-energie .stt { flex-wrap: wrap; justify-content: flex-end; }
  /* réserve : vraies miniatures (le .tc-mini de la vitrine publique les étirait en bandeaux rognés) */
  .tc-couche.tc-combat .tc-reserve { gap: 6px; flex-wrap: wrap; }
  .tc-couche.tc-combat .tc-reserve .tc-mini {
    display: block; flex: none; width: var(--mw, 36px); height: calc(var(--mw, 36px) * 1.36); padding: 0; gap: 0;
    border-radius: 7px; border: 2px solid var(--tc); background: #1a0b30; font: inherit; cursor: default;
  }
  .tc-couche.tc-combat .tc-reserve .tc-mini.inconnu { display: flex; align-items: center; justify-content: center; border-color: #f5c542; font: 900 18px var(--titre); }
  .tc-couche.tc-combat .tc-reserve .tc-mini i { height: 5px; }
  .tc-couche.tc-combat .tc-reserve .tc-mini .ph { bottom: 5px; }

  /* panneau des commandes : hauteur = contenu, en colonne, sans défilement */
  .tc-couche.tc-combat .tc-cb-bas { display: flex; flex-direction: column; align-items: stretch; gap: 6px; height: auto; max-height: none; overflow: hidden; }
  .tc-couche.tc-combat .tc-cb-actions { flex: none; height: auto; max-height: none; min-height: 0; overflow: visible; gap: 6px; }
  .tc-couche.tc-combat .tc-cb-atks { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; }
  .tc-couche.tc-combat .tc-cb-atk { min-height: 48px; padding: 5px 9px; gap: 2px; justify-content: center; }
  .tc-couche.tc-combat .tc-cb-atk .l1 { gap: 5px; }
  .tc-couche.tc-combat .tc-cb-atk .nm { font-size: 14px; line-height: 1.2; }
  .tc-couche.tc-combat .tc-cb-atk .tc-pips i { width: 11px; height: 11px; }
  .tc-couche.tc-combat .tc-cb-atk .l2 { flex-wrap: wrap; gap: 0 7px; padding-right: 0; font-size: 12px; line-height: 1.25; white-space: nowrap; overflow: hidden; }
  .tc-couche.tc-combat .tc-cb-atk .l2 .eff { overflow: hidden; text-overflow: ellipsis; min-width: 0; max-width: 100%; }
  /* attaque indisponible : la raison (« Pas assez d'énergie ») remplace la ligne type / puissance */
  .tc-couche.tc-combat .tc-cb-atk:has(.raison) .l2 { display: none; }
  .tc-couche.tc-combat .tc-cb-atk .raison { font-size: 12px; line-height: 1.25; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
  .tc-couche.tc-combat .tc-cb-atk kbd, .tc-couche.tc-combat .tc-cb-autres kbd { display: none; }
  .tc-couche.tc-combat .tc-cb-autres { display: flex; flex-wrap: nowrap; gap: 6px; }
  .tc-couche.tc-combat .tc-cb-autres > * {
    flex: 1 1 0; min-width: 0; min-height: 44px; height: 44px; padding: 0 4px; justify-content: center; font-size: 13px;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis; border-radius: 13px;
  }
  .tc-couche.tc-combat .tc-cb-actions > .tc-note { font-size: 13px; line-height: 1.3; margin: 0; }
  .tc-couche.tc-combat .tc-cb-actions > .tc-note .tc-note-crans { display: block; font-size: 12px; opacity: .8; }
  .tc-couche.tc-combat .tc-cb-reserve { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; }
  .tc-couche.tc-combat .tc-cb-reserve button { min-height: 52px; min-width: 0; padding: 4px 8px; gap: 7px; }
  .tc-couche.tc-combat .tc-cb-reserve button > span { min-width: 0; }
  .tc-couche.tc-combat .tc-cb-reserve b { display: block; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .tc-couche.tc-combat .tc-cb-reserve small { font-size: 11.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .tc-couche.tc-combat .tc-cb-reserve .tc-tete { width: 30px; height: 30px; flex: none; }
  .tc-couche.tc-combat .tc-cb-actions > .tc-btn.sec.petit { min-height: 44px; width: 100%; }
  .tc-couche.tc-combat .tc-cb-attente { padding: 8px; font-size: 14px; }

  /* journal : une ligne (cible de 44 px), le toucher le déplie ; la pastille musique se loge à sa droite */
  .tc-couche.tc-combat .tc-cb-journal {
    flex: none; align-self: stretch; height: 44px; max-height: 44px; min-height: 44px; margin-right: 52px; padding: 0 10px;
    font-size: 13px; line-height: 44px; overflow: hidden; cursor: pointer; transition: none;
  }
  /* replié : une entrée = une ligne de 44 px, le journal (défilé en bas par tcg.js) montre exactement la dernière */
  .tc-couche.tc-combat .tc-cb-journal p { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; padding-right: 58px; }
  .tc-couche.tc-combat .tc-cb-journal p.tour { margin-top: 0; }
  .tc-couche.tc-combat .tc-cb-journal::before { position: sticky; top: 11px; float: right; z-index: 1; margin: 11px 0 -33px 8px; padding: 0 7px; font-size: 12px; line-height: 20px; }
  /* déplié : il monte par-dessus les commandes (fond opaque) au lieu de pousser la scène ; on le retouche pour le replier */
  .tc-couche.tc-combat .tc-cb-bas:has(.tc-cb-journal.ouvert) { padding-bottom: calc(58px + env(safe-area-inset-bottom, 0px)); }
  .tc-couche.tc-combat .tc-cb-journal.ouvert {
    position: absolute; z-index: 6; left: 10px; right: calc(10px + env(safe-area-inset-right, 0px)); bottom: calc(8px + env(safe-area-inset-bottom, 0px)); margin: 0 52px 0 0;
    height: min(60dvh, 280px, calc(100% - 16px)); max-height: none; overflow-y: auto; overscroll-behavior: contain; padding: 8px 10px; line-height: 1.45;
    background: #1f1340; border: 1px solid var(--verre-bord, rgba(190, 130, 255, .4)); box-shadow: 0 -10px 30px rgba(5, 2, 15, .6);
  }
  .tc-couche.tc-combat .tc-cb-journal.ouvert p { white-space: normal; padding-right: 0; }
  .tc-couche.tc-combat .tc-cb-journal.ouvert p.tour { margin-top: 4px; }
  .tc-couche.tc-combat .tc-cb-journal.ouvert::before { top: 0; margin: 0 0 2px 8px; }
  .tc-couche.tc-combat .tc-cb-jbtn { display: none; }

  /* barre de musique pendant le combat : pastille de 44 px dans le coin bas-droit (rien n'y est dessous que la fin
     du journal) ; dépliée (toucher ou changement de piste), elle reste sur la ligne du journal. Masquée sous les
     fenêtres ouvertes par-dessus le combat (guide des types, confirmation), à sa place normale sur l'écran de fin. */
  body:has(.tc-couche.tc-combat):not(:has(.tc-cb-fin)) .la-barre {
    top: auto !important; bottom: calc(8px + env(safe-area-inset-bottom, 0px)); left: auto; right: calc(10px + env(safe-area-inset-right, 0px));
    transform: none; height: 44px; max-width: calc(100vw - 20px); border-radius: 14px; border-top: 1px solid rgba(245, 197, 66, .45);
  }
  body:has(.tc-couche.tc-combat):not(:has(.tc-cb-fin)) .la-barre.la-pilule {
    top: auto !important; width: 44px; min-width: 44px; height: 44px; padding: 0; justify-content: center;
    border-radius: 14px; border-top: 1px solid rgba(245, 197, 66, .45); opacity: .85;
  }
  body:has(.tc-couche.tc-combat):not(:has(.tc-cb-fin)) .la-barre.la-pilule::after { inset: 0; bottom: 0; }
  body:has(.tc-couche.tc-combat):not(:has(.tc-cb-fin)) .la-barre.la-pilule .la-ico { font-size: 17px; }
  body:has(.tc-couche.tc-combat):has(.tc-couche:not(.tc-combat)) .la-barre { display: none !important; }
  /* fenêtres ouvertes par-dessus le combat : l'aura des cartes rares (canvas #tc-fx, au-dessus des couches) passait
     par-dessus la fenêtre ; boutons au pouce aussi en paysage */
  body:has(.tc-couche.tc-combat):has(.tc-couche:not(.tc-combat)) #tc-fx { visibility: hidden; }
  body:has(.tc-couche.tc-combat) .tc-couche:not(.tc-combat) .tc-btn { min-height: 44px; }

  /* écran de fin */
  .tc-couche.tc-combat .tc-cb-fin { padding: 12px max(12px, env(safe-area-inset-right, 0px)) calc(12px + env(safe-area-inset-bottom, 0px)) max(12px, env(safe-area-inset-left, 0px)); }
  .tc-couche.tc-combat .tc-cb-fin .tc-boite { width: min(100%, 460px); max-height: 100%; overflow-y: auto; overscroll-behavior: contain; padding: 16px; }
  .tc-couche.tc-combat .tc-cb-fin .tc-boutons { flex-wrap: wrap; gap: 8px; justify-content: center; }
  .tc-couche.tc-combat .tc-cb-fin .tc-boutons .tc-btn { flex: 1 1 130px; min-height: 48px; }
  .tc-couche.tc-combat .tc-cb-fin .tc-red img { max-height: 22dvh; width: auto; }
}

/* --- portrait : l'adversaire en haut, moi en bas, les deux cartes aussi grandes que la hauteur le permet --- */
@media (max-width: 760px) and (orientation: portrait) {
  .tc-couche.tc-combat .tc-cb-scene { display: flex; flex-direction: column; justify-content: space-around; gap: 10px; padding: 8px 10px; }
  .tc-couche.tc-combat .tc-zone {
    --cw: clamp(84px, min(46cqw, (100cqh - 34px) / 2.8), 240px); --mw: clamp(30px, 10cqw, 42px);
    position: relative; inset: auto; flex: none; width: 100%;
  }
  .tc-couche.tc-combat .tc-cote { flex: 1 1 0; }
  .tc-couche.tc-combat .tc-zone.moi .tc-cote { justify-content: flex-end; }
  .tc-couche.tc-combat .tc-cb-meteo { top: 50%; transform: translate(-50%, -50%); font-size: 12px; }
  .tc-couche.tc-combat .tc-cb-chrono { left: auto; right: 10px; top: 50%; transform: translateY(-50%); font-size: 17px; padding: 4px 10px; }
  .tc-couche.tc-combat .tc-cb-bas { padding: 8px 10px calc(8px + env(safe-area-inset-bottom, 0px)); }
  /* hauteur mini = attaques + boutons : la scène (et donc les cartes) ne saute pas pendant les animations du tour */
  .tc-couche.tc-combat .tc-cb-actions { min-height: 152px; }
  .tc-couche.tc-combat .tc-cb-fin h2 { font-size: 30px; }
}
@media (max-width: 380px) and (orientation: portrait) {
  .tc-couche.tc-combat .tc-cb-autres > * { font-size: 12px; padding: 0 2px; }
  .tc-couche.tc-combat .tc-cb-plaque .nm { font-size: 13px; }
}

/* --- paysage : la scène à gauche (cartes en diagonale), les commandes à droite sur toute la hauteur --- */
@media (orientation: landscape) and (max-height: 500px) and (max-width: 1000px) {
  .tc-couche.tc-combat .tc-zone {
    --cw: clamp(80px, min((100cqh - 150px) / 1.4, 100cqw - 196px), 230px); --mw: clamp(28px, 8cqh, 38px);
  }
  .tc-couche.tc-combat .tc-zone.moi { left: 8px; right: 8px; bottom: 8px; }
  .tc-couche.tc-combat .tc-zone.adv { left: 8px; right: 8px; top: 8px; }
  .tc-couche.tc-combat .tc-cote { flex: 0 1 300px; }
  .tc-couche.tc-combat .tc-cb-bas { padding: 8px max(10px, env(safe-area-inset-right, 0px)) calc(8px + env(safe-area-inset-bottom, 0px)) 10px; justify-content: flex-start; }
  .tc-couche.tc-combat .tc-cb-actions { flex: 1 1 auto; justify-content: flex-start; }
  .tc-couche.tc-combat .tc-cb-autres { flex-wrap: wrap; }
  .tc-couche.tc-combat .tc-cb-autres > * { flex: 1 1 calc(50% - 3px); }
  .tc-couche.tc-combat .tc-cb-journal { margin-top: auto; }
  body:has(.tc-couche.tc-combat):not(:has(.tc-cb-fin)) .la-barre { max-width: calc(min(44vw, 400px) - 20px); }
  .tc-couche.tc-combat .tc-cb-fin h2 { font-size: 26px; margin: 0 0 4px; }
  .tc-couche.tc-combat .tc-cb-fin .tc-boite { width: min(100%, 560px); padding: 12px 16px; }
  .tc-couche.tc-combat .tc-cb-fin .tc-red img { max-height: 18dvh; }
}
