/* « Ma place à l'écran » (téléphone en portrait, client/js/disposition.js) : poignée du chat, live en vignette,
   préréglages et taille du texte du chat. Style Fanzine : encre, aplats rose / bleu / jaune, coins presque droits. */

.chat-grip, .mini-bar, .dispo-btn { display: none; }

/* Taille du texte du chat (tous écrans) */
body.chat-txt-s .chat-log { font-size: 13px; line-height: 1.4; }
body.chat-txt-l .chat-log { font-size: 17px; line-height: 1.45; }

@media (max-width: 900px) and (orientation: portrait) {
  .dispo-btn { display: inline-flex; }
  .dispo-btn::before { content: ''; width: 12px; height: 14px; margin-right: 6px; border: 2px solid currentColor; border-radius: 1px; background: linear-gradient(currentColor, currentColor) 0 4px / 100% 2px no-repeat, linear-gradient(currentColor, currentColor) 0 8px / 100% 2px no-repeat; }

  /* Poignée : barre à glisser en haut du chat (appui simple = replier / déplier) */
  .chat-grip { display: flex; justify-content: center; align-items: center; height: 18px; margin-bottom: -4px; touch-action: none; cursor: ns-resize; flex: none; }
  .chat-grip span { width: 46px; height: 6px; border-radius: 1px; background: var(--ink); box-shadow: 2px 2px 0 var(--pink); }
  .chat-grip.dragging span, .chat-grip:focus-visible span { background: var(--yellow); box-shadow: 2px 2px 0 var(--blue); }
  .chat-grip:focus-visible { outline: none; }
  /* Live visible (live en haut) : le chat ne recouvre plus la salle, il s'empile dessous comme dans le tiroir
     « live + chat » (ordre visuel seulement : l'iframe Twitch n'est pas rechargée). */
  body.cinema-on:not(.live-side):not(.watch) .stage-wrap { display: contents; }
  body.cinema-on:not(.live-side):not(.watch) .cinema { order: 1; flex: none; }
  body.cinema-on:not(.live-side):not(.watch) .stage { order: 2; flex: 1 1 0; min-height: 110px; }
  body.cinema-on:not(.live-side):not(.watch) .chat-panel { order: 3; position: static; height: auto; flex: 0 1 clamp(170px, 30vh, 270px); min-height: 118px; border-radius: 0; box-shadow: none; }
  body.cinema-on:not(.live-side):not(.watch) .chat-panel.collapsed { flex: none; min-height: 0; }
  body.cinema-on .chat-panel.collapsed .chat-rule { display: none; } /* la règle reste dans le fil du chat */
  body.cinema-on:not(.chat-open):not(.watch) .chat-float { display: flex; }

  body.chat-sized .chat-panel:not(.collapsed) { height: calc(var(--chat-h) + var(--kb, 0px)); transition: none; }
  body.chat-sized.cinema-on:not(.watch) .chat-panel:not(.collapsed), body.chat-sized.live-side:not(.watch) .chat-panel:not(.collapsed) { flex: 0 0 var(--chat-h); height: auto; min-height: 0; }
  body.watch .chat-grip { display: none; }

  /* Boutons du lecteur : une seule ligne qui défile, « Ma place à l'écran » en premier */
  .cinema-tools { width: 100%; flex-wrap: nowrap; justify-content: flex-start; overflow-x: auto; scrollbar-width: none; padding: 2px 2px 4px; }
  .cinema-tools .btn { flex: none; min-height: 34px; }
  html[data-theme] .cinema-tools .dispo-btn { background: var(--yellow); color: #14121b; border-color: var(--ink); }

  /* Live en vignette : posé sur la salle, déplaçable par sa barre, toujours au-dessus des boutons de la salle */
  body.live-mini:not(.watch) .cinema:not([hidden]) {
    position: fixed; left: var(--mini-x, 8px); top: var(--mini-y, 120px); z-index: 7; width: min(58vw, 300px);
    padding: 0; gap: 0; border: 2px solid var(--ink); border-radius: 3px; background: var(--page, #14121b);
    box-shadow: 4px 4px 0 var(--pink); overflow: hidden;
  }
  body.live-mini:not(.watch) .cinema-frame { width: 100%; min-width: 0; border: 0; border-radius: 0; box-shadow: none; }
  body.live-mini:not(.watch) .cinema-frame::before, body.live-mini:not(.watch) .cinema-frame::after, body.live-mini:not(.watch) .marquee, body.live-mini:not(.watch) .cinema-tools { display: none; }
  body.live-mini:not(.watch) .player-start .fine { display: none; }
  body.live-mini:not(.watch) .player-start .btn.big { font-size: 14px; min-height: 36px; padding: 0 12px; }
  body.live-mini:not(.watch) .mini-bar { display: flex; align-items: stretch; background: var(--ink); color: var(--page, #14121b); }
  .mini-grab { flex: 1; display: flex; align-items: center; gap: 7px; padding: 0 8px; min-height: 30px; font: 500 11px/1 var(--mono); text-transform: uppercase; letter-spacing: 0.08em; touch-action: none; cursor: grab; user-select: none; }
  .mini-dots { width: 10px; height: 12px; background: radial-gradient(circle, currentColor 1.4px, transparent 1.6px) 0 0 / 5px 4px; }
  body.is-live .mini-grab::after { content: '● en direct'; color: var(--pink); margin-left: auto; }
  .mini-big { flex: none; width: 38px; border: 0; border-left: 2px solid var(--page, #14121b); background: var(--yellow); color: #14121b; font-size: 18px; font-weight: 800; cursor: pointer; }

  /* Carte « Ma place à l'écran » */
  .dispo-card {
    position: fixed; left: 8px; right: 8px; bottom: calc(76px + env(safe-area-inset-bottom)); z-index: 60; max-height: calc(100% - 120px); overflow-y: auto;
    background: var(--paper); color: var(--ink); border: 2px solid var(--ink); border-radius: 4px; box-shadow: 5px 5px 0 var(--pink);
    padding: 12px; display: flex; flex-direction: column; gap: 10px; animation: pop 0.18s ease-out;
  }
  .dispo-head { display: flex; align-items: center; justify-content: space-between; }
  .dispo-head strong { font-family: var(--font-titre); text-transform: uppercase; font-weight: 800; font-size: 18px; letter-spacing: -0.01em; }
  .dispo-x { width: 34px; height: 34px; border: 2px solid var(--ink); border-radius: 3px; background: var(--paper); color: var(--ink); font-size: 20px; line-height: 1; cursor: pointer; }
  .dispo-presets { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 7px; }
  .dispo-preset { display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 6px 3px 7px; border: 2px solid var(--ink); border-radius: 3px; background: var(--paper); color: var(--ink); box-shadow: 2px 2px 0 var(--blue); cursor: pointer; font: inherit; }
  .dispo-preset b { font-size: 12px; line-height: 1.1; text-align: center; }
  .dispo-preset small { font: 500 9.5px/1.15 var(--mono); text-transform: uppercase; color: var(--ink-soft); text-align: center; }
  .dispo-preset[aria-pressed='true'] { background: var(--yellow); color: #14121b; box-shadow: 2px 2px 0 var(--pink); }
  .dispo-preset[aria-pressed='true'] small { color: #46436a; }
  .dispo-schema { position: relative; display: flex; flex-direction: column; gap: 2px; width: 34px; height: 56px; padding: 2px; border: 2px solid currentColor; border-radius: 3px; }
  .dispo-schema i { display: block; min-height: 3px; flex-basis: 0; }
  .sc-live { background: var(--pink); }
  .sc-salle { background: var(--blue); }
  .sc-chat { background: var(--ink-soft); background: repeating-linear-gradient(0deg, var(--ink) 0 2px, transparent 2px 4px); }
  .dispo-preset[aria-pressed='true'] .sc-chat { background: repeating-linear-gradient(0deg, #14121b 0 2px, transparent 2px 4px); }
  .dispo-schema .sc-vignette { position: absolute; left: 4px; top: 4px; width: 15px; height: 9px; background: var(--pink); outline: 1.5px solid currentColor; }
  .dispo-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
  .dispo-lbl { font: 500 11.5px/1.2 var(--mono); text-transform: uppercase; letter-spacing: 0.05em; }
  .dispo-seg { display: flex; border: 2px solid var(--ink); border-radius: 3px; overflow: hidden; }
  .dispo-seg button { min-height: 34px; min-width: 52px; padding: 0 10px; border: 0; background: var(--paper); color: var(--ink); font: 700 13.5px/1 var(--font); cursor: pointer; }
  .dispo-seg button + button { border-left: 2px solid var(--ink); }
  .dispo-seg button[aria-pressed='true'] { background: var(--yellow); color: #14121b; }
  .dispo-tip { margin: 0; font-size: 12.5px; line-height: 1.35; color: var(--ink-soft); }
  .dispo-reset { align-self: flex-start; }
}
