/* 🎲 d20 Arena · Mesa P5 reaction window. Colours come from the game's theme variables, with Day and Night fallbacks.
   Nothing here depends on colour alone: the deadline is a number, the bar is decoration (aria-hidden). */
.mesa-rx {
  --rx-bg: var(--panel, #1a1632); --rx-ink: var(--text, #f1edff); --rx-dim: var(--dim, #a6a0cc); --rx-line: var(--border, #383063);
  --rx-ok: #3fae6a; --rx-warn: #e8412c; --rx-bar: #e6c23a; --rx-focus: var(--focus-ring, #f1edff);
  color: var(--rx-ink); font: inherit; max-width: 560px; margin: 0 auto;
}
:root[data-theme="day"] .mesa-rx {
  --rx-bg: var(--panel, #fcf0c6); --rx-ink: var(--text, #2a1f00); --rx-dim: var(--dim, #6b5a1f); --rx-line: var(--border, #b99a52);
  --rx-ok: #2e8a52; --rx-warn: #b3261e; --rx-bar: #b58f00;
}
.mesa-rx-box, .mesa-rx-policy { display: grid; gap: 10px; background: var(--rx-bg); border: 2px solid var(--rx-line); border-radius: 10px; padding: 14px; margin: 0; min-width: 0; }
.mesa-rx-title { margin: 0; font-size: 1.15rem; }
.mesa-rx p, .mesa-rx ul { margin: 0; }
.mesa-rx-sub, .mesa-rx-note { color: var(--rx-dim); }
.mesa-rx-timer { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.mesa-rx-clock { font-variant-numeric: tabular-nums; font-size: 1.1rem; }
.mesa-rx-bar { flex: 1 1 120px; height: 8px; border-radius: 4px; border: 1px solid var(--rx-line); overflow: hidden; }
.mesa-rx-bar-fill { height: 100%; width: 100%; background: var(--rx-bar); }
.mesa-rx-list { list-style: none; padding: 0; display: grid; gap: 10px; }
.mesa-rx-card { display: grid; gap: 6px; border: 1px solid var(--rx-line); border-radius: 8px; padding: 10px; }
.mesa-rx-trigger { font-style: italic; }
.mesa-rx-group { border: 1px solid var(--rx-line); border-radius: 6px; padding: 6px 8px; margin: 0; min-width: 0; }
.mesa-rx-choice { display: flex; align-items: center; gap: 8px; min-height: 44px; cursor: pointer; }
.mesa-rx-choice input { width: 22px; height: 22px; flex: none; }
.mesa-rx-choice input:focus-visible { outline: 3px solid var(--rx-focus); outline-offset: 2px; }
.mesa-rx-done { color: var(--rx-ok); font-weight: 700; }
.mesa-rx .mesa-warn, .mesa-rx .mesa-error { color: var(--rx-warn); font-weight: 700; }
.mesa-rx-log { border-left: 3px solid var(--rx-line); padding-left: 8px; color: var(--rx-dim); }
.mesa-rx .mesa-row { display: flex; flex-wrap: wrap; gap: 8px; }
.mesa-rx .mesa-btn { min-height: 44px; min-width: 44px; padding: 8px 14px; border-radius: 8px; border: 1px solid var(--rx-line); background: var(--panel-2, #241f45); color: var(--rx-ink); font: inherit; cursor: pointer; touch-action: manipulation; }
:root[data-theme="day"] .mesa-rx .mesa-btn { background: var(--panel-2, #efd78d); }
.mesa-rx .mesa-btn:focus-visible { outline: 3px solid var(--rx-focus); outline-offset: 2px; }
.mesa-rx .mesa-btn:disabled { opacity: 0.5; cursor: not-allowed; }
.mesa-rx-use { border-color: var(--rx-ok); } .mesa-rx-skip { border-color: var(--rx-dim); }
@media (prefers-reduced-motion: no-preference) { .mesa-rx-bar-fill { transition: width 0.9s linear; } }
/* ---- the choice before the fight: four cards (30/11/2026) ---- */
.mesa-rx.mesa-rx-escolha { max-width: none; margin: 0; }
.mesa-rx .mesa-rx-policy { grid-template-columns: repeat(4, minmax(0, 1fr)); align-items: stretch; }
.mesa-rx .mesa-rx-policy .mesa-rx-lead, .mesa-rx .mesa-rx-policy .mesa-rx-none-warn { grid-column: 1 / -1; }
.mesa-rx .mesa-rx-policy .mesa-rx-choice { position: relative; flex-direction: column; align-items: flex-start; justify-content: flex-start; gap: 4px; min-width: 0; min-height: 112px; padding: 12px; border: 2px solid var(--rx-line); border-radius: 12px; background: var(--panel-2, var(--rx-bg)); }
.mesa-rx .mesa-rx-policy .mesa-rx-choice input { position: absolute; opacity: 0; }
.mesa-rx .mesa-rx-policy .mesa-rx-choice:focus-within { outline: 3px solid var(--rx-focus); outline-offset: 2px; }
.mesa-rx .mesa-rx-policy .mesa-rx-choice.on { border-color: var(--bone); background: var(--bone); color: var(--ui-ink-3); }
.mesa-rx .mesa-rx-policy .mesa-rx-choice.on .mesa-rx-note { color: var(--ui-ink-3); }
/* Day paints the wizard's labels in the page ink: on the chosen card the name and the seal keep the card's own (01/12/2026) */
.mesa-rx .mesa-rx-policy .mesa-rx-choice.on strong, .mesa-rx .mesa-rx-policy .mesa-rx-choice.on .mesa-rx-selo { color: var(--ui-ink-3); }
.mesa-rx-icone { font-size: 1.5rem; line-height: 1.1; }
.mesa-rx-texto { display: grid; gap: 2px; min-width: 0; overflow-wrap: anywhere; }
.mesa-rx-selo { position: absolute; top: 8px; right: 8px; border: 1px solid currentColor; border-radius: 999px; padding: 0 8px; font-size: 0.68rem; font-weight: 800; }
@media (max-width: 760px) { .mesa-rx .mesa-rx-policy { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

.mesa-rx-gatilho { font-weight: 800; font-variant-numeric: tabular-nums; }
.mesa-rx .mesa-row .mesa-btn.mesa-rx-guardar { flex: 1 1 100%; border-color: var(--bone); background: var(--bone); color: var(--ui-ink-3); font-weight: 800; }
.mesa-rx .mesa-row .mesa-rx-guardar-nota { flex: 1 1 100%; margin: 0; text-align: center; }
.mesa-rx .mesa-rx-policy:has(> .mesa-rx-choice:nth-of-type(5)) { grid-template-columns: repeat(5, minmax(0, 1fr)); }
@media (max-width: 760px) {
  .mesa-rx .mesa-rx-policy:has(> .mesa-rx-choice:nth-of-type(5)) { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .mesa-jogo.reagindo .mesa-jogo-rx { position: fixed; left: 6px; right: 6px; bottom: 72px; z-index: 55; max-height: 60vh; overflow-y: auto; }
  /* the window of the next Reaction is fixed at the bottom and would cover the notice: on a phone the notice rides at the top of the screen, above it all, and still closes by touch */
  .mesa-jogo.reagindo .mesa-rx-esgotado { position: fixed; top: 6px; left: 6px; right: 6px; z-index: 70; box-sizing: border-box; width: auto; margin: 0; min-height: 48px; background: var(--panel-2, #241f45); }
}

/* the time ran out: a notice that stays; the whole of it closes it */
.mesa-rx-esgotado { display: block; width: 100%; margin: 6px 0; border: 2px solid var(--bone); font-weight: 800; text-align: center; }
.mesa-rx .mesa-rx-reage { font-weight: 800; }

/* where the Arena's fight screen has a fixed height (app.css: from 1100 px wide and 600 px tall) the Reaction window and the notice of the time
   float at the right, over the log: in the flow they squeezed the map and the two rosters, and at 1100 px the map all but vanished (the owner,
   02/12/2026). Narrower or shorter the page scrolls and they stay in the flow. The line with "Leave the fight" goes to the left while the
   window is open, so that the window never covers it */
@media (min-width: 1100px) and (min-height: 600px) {
  .mesa-jogo.reagindo .mesa-jogo-rx { position: fixed; right: 12px; bottom: 12px; width: min(420px, 40vw); max-height: calc(100vh - 150px); overflow-y: auto; z-index: 55; }
  .mesa-jogo .mesa-rx-esgotado { position: fixed; right: 12px; top: 72px; width: min(420px, 40vw); margin: 0; z-index: 60; }
  .mesa-jogo.reagindo .mesa-jogo-topo { grid-column: 1; justify-content: flex-start; }
}

/* on a phone the open Reaction window covers the line of the fight: "Leave the fight" goes to the top, above everything, and the notice of the
   time gives it room (the owner, 02/12/2026) */
@media (max-width: 760px) {
  .mesa-jogo.reagindo .mesa-jogo-sair { position: fixed; top: 6px; right: 6px; z-index: 75; max-width: 46vw; }
  .mesa-jogo.reagindo .mesa-rx-esgotado { right: calc(46vw + 12px); }
}
