/* ReyaMon Showdown – Play & Teams (portal/js/play.js) */

/* Dauerhafter Client-Container (außerhalb von #view, damit die Verbindung bestehen bleibt) */
#rm-client-host { position: fixed; left: 0; right: 0; bottom: 0; top: 120px; z-index: 5; display: block;
  visibility: hidden; pointer-events: none; background: var(--bg); border-top: 1px solid var(--line); }
#rm-client-host.visible { visibility: visible; pointer-events: auto; }
#rm-client-host iframe { width: 100%; height: 100%; border: 0; display: block; background: var(--bg); }
body.logged-out #rm-client-host { visibility: hidden; }
.play-frame-slot { height: 1px; }

.play-wrap { max-width: 1300px; margin: 0 auto; }
main.wide .play-wrap { padding: 0 16px; }
.play-subtabs { margin-top: 8px; }
.play-subtabs .p-gametab { color: var(--accent); }
.play-status { font-size: .85rem; color: var(--muted); margin: -6px 0 14px; display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.p-dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; }
.p-dot.on { background: var(--good); }
.p-dot.off { background: var(--muted); animation: pulse-text 1s infinite; }
.p-on { color: var(--good); }

.p-player { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.p-player:last-child { border-bottom: 0; }
.p-incoming { border-top-color: #e0245e; }
.p-incoming h3 { margin: 0; }
.p-actions select { min-width: 160px; }
.p-team-icons { min-height: 34px; margin: 8px 0; display: flex; flex-wrap: wrap; gap: 2px; }
.p-team-icons span { display: inline-block; }
.p-team-random, .p-team-none { padding: 8px 10px; border-radius: 6px; background: var(--bg); border: 1px dashed var(--line); font-size: .9rem; }
.notice-box { border-left: 4px solid #e0a400; }
form .form-grid select.p-format, form .form-grid select.p-team { width: 100%; }
.frame-head.row-between { gap: 12px; }

/* Herausforderung: Hinweis auf jeder Seite (Play.renderAlert) */
#p-alert { position: fixed; right: 18px; bottom: 18px; z-index: 60; display: flex; flex-direction: column; gap: 10px; max-width: min(360px, calc(100vw - 36px)); }
.p-alert-card { position: relative; background: var(--panel); color: var(--ink); border: 1px solid var(--line); border-top: 4px solid #e0245e;
  border-radius: var(--radius); box-shadow: 0 10px 30px rgba(0,0,0,.25); padding: 12px 14px; display: flex; flex-direction: column; gap: 10px;
  animation: p-alert-in .35s ease-out, p-alert-pulse 1.6s ease-in-out .4s 3; }
.p-alert-card .who-inline { align-items: center; padding-right: 18px; }
.p-alert-card .row { flex-wrap: wrap; gap: 8px; }
.p-alert-x { position: absolute; top: 6px; right: 8px; border: 0; background: none; color: var(--muted); cursor: pointer; font-size: .9rem; }
@keyframes p-alert-in { from { transform: translateY(20px); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes p-alert-pulse { 50% { box-shadow: 0 10px 30px rgba(0,0,0,.25), 0 0 0 6px rgba(224,36,94,.25); } }
.topbar a[data-tab="play"] .count-pill { background: #fff; color: var(--accent); margin-left: 2px; }
.p-chal:empty { display: none; }
/* Kampfraum: Forfeit / Leave rechts in der Statuszeile */
.p-roombar { margin-left: auto; display: inline-flex; gap: 6px; }
.p-roombar .btn { padding: 3px 10px; font-size: .8rem; }
/* Kampfraum: Statuszeile über die volle Breite (Client darunter ist auch randlos) → Forfeit/Leave ganz rechts */
.play-wrap.is-room { max-width: none; }
.play-wrap.is-room .play-status { padding: 0 6px; }
/* Kampfraum: Leiste über dem Spielfeld mit fester Höhe – sonst rutscht das Spielfeld beim Kampfstart
   (neue Reiter/Knöpfe) und die Bühne skaliert mehrfach neu („Wackeln“) */
.play-wrap.is-room .play-status { flex-wrap: nowrap; height: 32px; margin: 0 0 6px; overflow-x: auto; overflow-y: hidden; white-space: nowrap; scrollbar-width: thin; }
.play-wrap.is-room .p-roombar { flex: none; }
.subnav .subtabs { overflow-x: auto; scrollbar-width: none; }
.subnav .subtabs::-webkit-scrollbar { display: none; }
/* offene Kampf-/Serienräume als Reiter mit ✕ (auch beendete Spiele einer Serie) */
.p-roomtab { display: inline-flex; align-items: center; }
.p-tabx { border: 0; background: none; color: var(--muted); cursor: pointer; padding: 2px 6px; margin-left: -4px; font-size: .8rem; border-radius: 4px; }
.p-tabx:hover { color: var(--accent); background: rgba(214, 60, 60, .12); }
/* Format-Suche über der Format-Auswahl */
.p-fmt-pick { display: flex; flex-direction: column; gap: 6px; }
.p-fmt-pick .p-fmt-label { font-size: .85rem; color: var(--muted); }
.p-fmt-search { width: 100%; }
.p-fmt-search.p-fmt-none { border-color: var(--accent); }

/* Team-Sheets im Kampf (Play.toggleSheets) – Seitenleiste rechts über dem Log */
.p-sheets { position: fixed; right: 0; top: calc(var(--topbar-h, 56px) + 90px); bottom: 0; width: min(600px, 46vw); z-index: 40;
  background: var(--panel); color: var(--ink); border-left: 1px solid var(--line); box-shadow: -8px 0 24px rgba(0,0,0,.25);
  overflow-y: auto; padding: 10px 14px 18px; }
.p-sheets .ts-head { position: sticky; top: -10px; background: var(--panel); padding: 6px 0; z-index: 1; }
.p-sheets .ts-head h2 { margin: 0; font-size: 1.05rem; }
.ts-side h3 { font-size: .95rem; margin: 12px 0 8px; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.ts-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 10px; }
.ts-mon { border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; background: var(--bg); display: flex; flex-direction: column; gap: 6px; font-size: .82rem; }
.ts-top { display: flex; gap: 8px; align-items: center; }
.ts-top img { width: 56px; height: 56px; object-fit: contain; image-rendering: pixelated; }
.ts-top .type { font-size: .65rem; }
.ts-info { display: grid; grid-template-columns: 1fr 1fr; gap: 2px 10px; }
.ts-info b[title], .ts-move[title] { cursor: help; }
.ts-moves { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; }
.ts-move { border: 1px solid var(--line); border-radius: 6px; padding: 3px 6px; background: var(--panel); line-height: 1.25; }
.ts-move b { display: block; font-size: .8rem; }
.ts-move small { color: var(--muted); font-size: .68rem; }
.ts-move small .type { font-size: .6rem; padding: 0 4px; }
.ts-stats { display: grid; gap: 1px; }
.ts-stat { display: grid; grid-template-columns: 30px 1fr 30px 64px; gap: 6px; align-items: center; font-size: .74rem; }
.ts-stat span:first-child { color: var(--muted); }
.ts-bar { height: 6px; background: var(--line); border-radius: 3px; overflow: hidden; }
.ts-bar i { display: block; height: 100%; border-radius: 3px; }
.ts-stat b { text-align: right; }
.ts-stat em { font-style: normal; text-align: right; color: var(--ink); font-variant-numeric: tabular-nums; }
@media (max-width: 900px) { .p-sheets { width: 100vw; } }

/* Format-Suche: Trefferliste unter dem Suchfeld */
.p-fmt-pick { position: relative; }
.p-fmt-results { position: absolute; left: 0; right: 0; z-index: 30; margin-top: 2px; max-height: 320px; overflow-y: auto; background: var(--panel); border: 1px solid var(--accent); border-radius: 10px; box-shadow: 0 10px 28px rgba(0,0,0,.35); padding: 4px; }
.p-fmt-count { font-size: .78rem; color: var(--muted); padding: 4px 8px 6px; }
.p-fmt-group { font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); padding: 6px 8px 2px; }
.p-fmt-opt { display: block; width: 100%; text-align: left; background: none; border: 0; color: var(--ink); padding: 6px 12px; border-radius: 6px; cursor: pointer; font: inherit; }
.p-fmt-opt:hover, .p-fmt-opt.on { background: var(--accent); color: #fff; }
