/* Runekin · css/overrides.css — ajustes finais (cauda do style.css original, mantida INTACTA): sobrescrevem regras anteriores por ordem de fonte — carregar por ÚLTIMO.
   Fatia do antigo style.css (linhas 1504–1693); a ORDEM dos <link> em layout.jsx preserva a cascata. */

/* ---- modal close: ✕ chip top-right is the standard ---- */
.rg-x { position: absolute; right: 0; top: 0; width: 38px; height: 38px; display: grid; place-items: center; background: var(--ink); color: #fff; font: 400 18px var(--display); z-index: 5; }
.rg-x:active { background: var(--c3); }
.detail-card .rg-x { right: 0; top: 0; }
.rg-sheet.bottom .rg-x { top: auto; bottom: 0; right: 0; }
.rg-sheet .rg-close { display: none; }
/* battle: PARTY button instead of bench chips */
.bt-party { margin-left: 10px; min-height: 26px; padding: 2px 10px; font-size: 13px; letter-spacing: 1px; --face: #fff; color: var(--ink); --clip: var(--e-chip); }
.bt-party .cnt { background: var(--ink); color: #fff; padding: 0 5px; margin-left: 4px; }
.rg-partymodal .rg-pick-grid { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
.rg-partymodal .rg-pick { display: flex; align-items: center; gap: 8px; padding: 6px 12px 6px 6px; background: #fff; border: 3px solid var(--ink); color: var(--ink); text-align: left; }
.rg-partymodal .rg-pick.active { background: var(--c2); }
.rg-partymodal .rg-pick .rg-unit-art { width: 44px; height: 44px; display: grid; place-items: center; }
.rg-partymodal .rg-pick .rg-unit-art img, .rg-partymodal .rg-pick .rg-unit-art svg { width: 100%; height: 100%; object-fit: contain; }
.rg-partymodal .rg-pick .rg-unit-name { font-size: 18px; line-height: 1; }
.rg-partymodal .rg-pick .rg-unit-hpnum { font: 500 9px var(--mono); color: #777; }
.rg-partymodal .rg-pick .bs-hp { width: 90px; margin-top: 3px; }
.rg-partymodal .rg-pick[disabled] { opacity: .35; }
.rg-partymodal p { margin: 6px 0 0; font-size: 12px; color: var(--muted); }
/* toast inside the stage (rotates with it) */
.rg-toast { position: absolute; left: 50%; bottom: 18px; transform: translateX(-50%); background: var(--ink); color: #fff; padding: 8px 16px; font: 400 14px var(--display); letter-spacing: 1px; text-transform: uppercase; z-index: 60; max-width: 80%; text-align: center; pointer-events: none; clip-path: var(--e-chip); }
/* row 1 of the battle wraps instead of hiding */
.bt-row1 { flex-wrap: wrap; white-space: normal; overflow: visible; row-gap: 2px; }
.bt-sub { row-gap: 2px; }
/* party row wraps (max 6 → 2 rows of 3); cards are drag targets, not scrollers */
.rg-party { flex-wrap: wrap; overflow: visible; row-gap: 8px; align-content: flex-end; padding: 0 0 12px; right: 26px; }
.rg-party .rg-partylbl { align-self: flex-end; }
.rg-pcard { touch-action: none; padding: 4px 8px 4px 4px; }
.rg-pcard .art { width: 32px; height: 32px; }
.rg-pcard .txt b { font-size: 13px; }
.rg-pcard .bs-hp { width: 54px; height: 5px; margin-top: 3px; }
.rg-mapsvg { bottom: 124px; }
.rg-umodal .rg-um-gv .bs-label { padding-right: 44px; }
.rg-pumodal .rg-pick .rg-unit-art, .rg-partymodal .rg-pick .rg-unit-art { flex: none; }
.rg-pumodal .rg-pick, .rg-partymodal .rg-pick { width: auto; min-width: 150px; flex: none; }

/* ---- item chips: icon + count; tap opens the detail modal ---- */
.rg-itemchips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.rg-ichip { position: relative; width: 36px; height: 36px; display: grid; place-items: center; background: #fff; color: var(--ink); border: 2px solid var(--ink); }
.rg-ichip .rg-ic { width: 20px; height: 20px; }
.rg-ichip b { position: absolute; right: -6px; bottom: -6px; background: var(--ink); color: #fff; font: 400 11px var(--display); padding: 0 4px; line-height: 1.3; }
.rg-ichip:not(.can) { opacity: .6; }
.rg-ichip.big { width: 64px; height: 64px; border-width: 3px; }
.rg-ichip.big .rg-ic { width: 34px; height: 34px; }
.rg-ichip.big b { font-size: 15px; padding: 1px 6px; right: -8px; bottom: -8px; }
.rg-itemchips.battle { position: absolute; left: 26px; right: 26px; top: 96px; gap: 14px; }
.rg-itemchips.battle .rg-ichip.can { background: var(--c2); }
.rg-slabbot .rg-slabbtns { margin-top: 12px; }
.rg-itemmodal { padding: 22px 26px; width: min(100%, 520px); }
.rg-itemmodal .rg-item-head { display: flex; align-items: center; gap: 14px; }
.rg-itemmodal .rg-item-head .ico { width: 56px; height: 56px; flex: none; display: grid; place-items: center; background: var(--ink); color: #fff; }
.rg-itemmodal .rg-item-head .ico .rg-ic { width: 30px; height: 30px; }
.rg-itemmodal h2 { margin: 0; font-weight: 400; font-size: 32px; line-height: .95; }
.rg-itemmodal .rg-mono { font: 500 10px var(--mono); letter-spacing: 1px; }
.rg-itemmodal p { margin: 12px 0 0; font-size: 13px; color: var(--ink); }
.rg-itemmodal .rg-btns { display: flex; justify-content: flex-end; margin-top: 16px; min-height: 10px; }

/* ---- map layout: chips top-right, legend bottom-right, bigger trellis ---- */
.rg-mapbtns { top: 16px; right: 26px; display: flex; gap: 6px; }
.rg-mapbtns .bs-btn { min-height: 28px; padding: 3px 10px; font-size: 12px; }
.rg-legend { top: auto; bottom: 14px; right: 26px; max-width: 220px; gap: 2px; }
.rg-legend .bs-label { font-size: 11px; }
.rg-legend div { font-size: 11px; }
.rg-legend p { font-size: 10px; }
.rg-mapsvg { left: 262px; right: 26px; top: 54px; bottom: 100px; }
.rg-partywrap { position: absolute; left: 250px; right: 250px; bottom: 8px; }
.rg-partywrap .rg-partylbl { display: block; writing-mode: horizontal-tb; transform: none; color: var(--ink); font-size: 11px; letter-spacing: 3px; margin: 0 0 4px; }
.rg-partywrap .rg-party { position: static; padding: 0; }

/* ---- battle stacking: content above art, art above VS; art never eats taps ---- */
.rg-bt .bt-vs { z-index: 0; }
.bt-foeart { z-index: 1; pointer-events: none; right: auto; left: 72%; transform: translateX(-50%); bottom: 36px; }
.bt-me, .bt-sum, .bt-grid, .bt-foe, .bt-ticker, .bt-end { z-index: 2; }
.rg-mapsvg { bottom: 112px; }
/* ---- stage breathing room: 24 px from every edge of the landscape stage ---- */
.rg-slabtxt { top: 24px; }
.rg-slabbot { bottom: 24px; }
.rg-mapbtns { top: 22px; right: 28px; }
.rg-legend { bottom: 24px; right: 28px; }
.rg-mapsvg { top: 60px; bottom: 118px; right: 28px; }
.rg-partywrap { left: 250px; right: 236px; bottom: 24px; }
.rg-partywrap .rg-party { padding: 0; }
.rg-bottomrow { bottom: 24px; }
.rg-titlerow { top: 22px; }
.rg-subline { top: 68px; }
.bt-me { top: 16px; }
.bt-grid { bottom: 24px; }
.bt-sum { bottom: 28px; }
.bt-foe { top: 22px; }
.bt-end { bottom: 24px; }
.bt-ticker { bottom: 66px; }
.rg-scene .bs-btn.rg-home { top: 22px; right: 28px; }

/* ---- stage scale + safe area ----
   The 844×390 composition scales (--rg-k, explore/ui.js) to fit the STAGE = viewport minus the
   side safe areas (notch / rounded corners — iOS reports both sides in landscape). Content lives
   inside; the .bg slabs bleed under the insets (below) so the device edge never shows the ink
   ground as a black band. --bl/--br are the insets in reference units. */
#screen-rogue { --rg-k: 1; }
body.rg-land #rogueRoot, body.rg-land #rgLayer {
  position: absolute; top: 0; left: env(safe-area-inset-left, 0px);
  width: calc((100% - env(safe-area-inset-left, 0px) - env(safe-area-inset-right, 0px)) / var(--rg-k));
  height: calc(100% / var(--rg-k));
  transform: scale(var(--rg-k)); transform-origin: top left;
}
/* hidden probe: explore/ui.js reads env() through it (JS cannot read env() directly) */
#rgProbe { position: absolute; left: 0; top: 0; width: 0; height: 0; visibility: hidden; pointer-events: none; padding: env(safe-area-inset-top, 0px) env(safe-area-inset-right, 0px) env(safe-area-inset-bottom, 0px) env(safe-area-inset-left, 0px); }
#rgLayer { pointer-events: none; z-index: 30; }
#rgLayer > * { pointer-events: auto; }
#rgLayer > #rgGvFx, #rgLayer > .rg-toast { pointer-events: none; }
body:not(.rg-land) #rgLayer { position: fixed; inset: 0; transform: none; width: auto; height: auto; }
body:not(.rg-land) #rgLayer:empty { display: none; }
/* bleed: a transparent border the size of the inset, pulled out by a negative margin — the
   background paints under the border and the clip-path follows the border box, so the slab
   reaches the device edge while its geometry stays in reference units. Full-bleed grounds get
   both sides; edge-anchored slabs only their own side. The two battle slabs and the white bar
   share ONE box so their diagonals keep meeting (different boxes = a black seam between them).
   env() is written inline (Safari does not resolve it inside a custom property); the root is
   scaled by --rg-k, so the inset is divided by it to land on the physical edge. */
body.rg-land .rg-scene .bg { margin: 0; box-sizing: content-box; border: 0 solid transparent; }
body.rg-land .rg-scene .bg.ink, body.rg-land .rg-scene .bg.paper, body.rg-land .rg-scene .bg.c2page, body.rg-land .rg-scene .bg.dim,
body.rg-land .rg-scene .bg.hdr, body.rg-land .rg-scene .bg.foot,
body.rg-land .rg-bt .bg.bt-l, body.rg-land .rg-bt .bg.bt-r, body.rg-land .rg-bt .bg.bt-bar, body.rg-land .rg-bt .bg.bt-dots {
  left: 0; right: 0; width: auto;
  margin-left: calc(-1 * env(safe-area-inset-left, 0px) / var(--rg-k)); margin-right: calc(-1 * env(safe-area-inset-right, 0px) / var(--rg-k));
  border-left-width: calc(env(safe-area-inset-left, 0px) / var(--rg-k)); border-right-width: calc(env(safe-area-inset-right, 0px) / var(--rg-k));
}
body.rg-land .rg-scene .bg.slab-l { margin-left: calc(-1 * env(safe-area-inset-left, 0px) / var(--rg-k)); border-left-width: calc(env(safe-area-inset-left, 0px) / var(--rg-k)); }
body.rg-land .rg-scene .bg.paper-r, body.rg-land .rg-scene .bg.slab-r { margin-right: calc(-1 * env(safe-area-inset-right, 0px) / var(--rg-k)); border-right-width: calc(env(safe-area-inset-right, 0px) / var(--rg-k)); }

/* ---- portrait screens on wide viewports: slabs and footers go full-bleed ---- */
@media (min-width: 560px) {
  .app { max-width: 560px; }
  .screen > .bs-slab.hdr, .screen > .nb-stripe, .home-head, .home-stripe, .sc-head, .home-foot::before,
  .nb-foot, .cred-foot-band, .al-foot, .st-foot, .rg-stats > .bs-slab.hdr, .dx-poster {
    left: calc(50% - 50vw); width: 100vw; right: auto; max-width: none; margin-left: 0; margin-right: 0;
  }
  .home-stripe { left: calc(50% - 50vw - 30px); width: calc(100vw + 60px); }
  .nb-stripe { left: calc(50% - 50vw - 30px); width: calc(100vw + 60px); }
  .dx-poster { left: calc(50% - 50vw - 40px); width: calc(100vw + 80px); }
  .nb-legend, .cred-foot, .home-footline { max-width: 560px; }
}
@media (min-width: 560px) { .screen.home { overflow: visible; } }

/* landscape stage headers/footers are measured in reference units: keep the mock ratios there */
.rg-scene .bg.hdr { clip-path: polygon(0 0,100% 0,100% 72%,0 100%); }
.rg-scene .bg.foot { clip-path: polygon(0 40%,100% 0,100% 100%,0 100%); }
.rg-ov > .rg-sheet.bottom { --clip: polygon(0 0,100% 28%,100% 100%,0 100%); }
/* stripes share the same 8° */
.home-stripe, .nb-stripe { transform: rotate(calc(-1 * var(--tilt))); }
/* result / rewards: lines are stickers, not body copy */
.rg-simplev .rg-rewards { display: flex; flex-direction: column; gap: 10px; align-items: flex-start; font-family: var(--display); text-transform: uppercase; font-size: 24px; line-height: 1; color: var(--ink); overflow: visible; }
.rg-simplev .rg-rewards > div { background: #fff; border: 3px solid var(--ink); padding: 10px 16px; max-width: 560px; }
.rg-simplev .rg-rewards > div:nth-child(odd) { transform: rotate(-1deg); }
.rg-simplev .rg-rewards > div:nth-child(even) { transform: rotate(.8deg); }
.rg-simplev .rg-rewards .rg-ic { width: .9em; height: .9em; vertical-align: -.1em; }
.rg-simplev .rg-titlerow h1 { font-size: 40px; }
.rg-btover .rg-rewards { font-family: var(--display); text-transform: uppercase; font-size: 18px; line-height: 1.5; }

/* ---- battle seam: one geometry for both slabs and the white bar ---- */
.rg-bt .bg.bt-l { width: 100%; clip-path: polygon(0 0, 56% 0, 44% 100%, 0 100%); }
.rg-bt .bg.bt-r { width: 100%; clip-path: polygon(56% 0, 100% 0, 100% 100%, 44% 100%); }
.rg-bt .bg.bt-bar { left: 0; top: 0; width: 100%; height: 100%; transform: none; clip-path: polygon(calc(56% - 11px) 0, calc(56% + 11px) 0, calc(44% + 11px) 100%, calc(44% - 11px) 100%); }
.rg-bt .bt-vs { left: 50%; top: 40%; transform: translateX(-50%) rotate(-8deg); }

/* ---- player side: breathing room, narrower summary, stacked actions ---- */
.bt-me { top: 24px; left: 30px; }
.bt-grid { left: 30px; bottom: 28px; }
.bt-sum { left: calc(30px + var(--cell) * 5 + 22px + 14px); right: calc(56% + 14px); bottom: 30px; min-width: 0; }
.bt-sum .title { font-size: 18px; }
.bt-sum .title span { display: block; font-size: 12px; margin-top: 2px; }
.bt-sum .fx { gap: 3px; }
.bt-sum .fx .rg-gv-ichip { font-size: 12px; padding: 1px 6px; }
.bt-actions { grid-template-columns: 1fr; gap: 5px; }
.bt-actions .bs-btn { min-height: 30px; font-size: 13px; }
.bt-actions .bs-btn.play { grid-column: auto; font-size: 18px; padding: 8px 6px; }
.bt-sum:empty { display: none; }

/* ---- foe side: intent sits above END TURN, log is an ink box ---- */
.bt-foe { top: 24px; right: 30px; }
.bt-intentwrap { position: absolute; right: 30px; bottom: 64px; z-index: 2; text-align: right; }
.bt-intent { margin-top: 0; }
.bt-ticker { right: 30px; bottom: 112px; width: 190px; background: var(--ink); color: #fff; border-right: 0; padding: 6px 10px; clip-path: var(--e-chip); font-size: 11px; max-height: 52px; }
.bt-ticker.open { width: 300px; max-height: 240px; border-right: 0; }
.bt-end { right: 30px; bottom: 24px; }
.bt-foeart { left: 66%; bottom: 44px; }

/* ---- disabled controls stay solid and readable ---- */
.bs-btn[disabled] { opacity: 1; --face: var(--paper-dim); color: #8a8a8a; --sh: transparent; }
.bs-btn.line[disabled] { --face: transparent; color: rgba(255,255,255,.55); border-color: rgba(255,255,255,.4); }
.rg-scene .bs-btn.line[disabled] { color: inherit; opacity: .45; }
.bt-actions .bs-btn.play[disabled] { --face: var(--paper-dim); color: #8a8a8a; transform: rotate(-2deg); }
.bt-end .bs-btn[disabled] { --face: var(--paper-dim); color: #8a8a8a; }

/* ---- home footer band: clears the safe area without a yellow strip ---- */
body[data-screen="home"] .app { padding-bottom: 0; }
.home-foot { height: calc(110px + env(safe-area-inset-bottom)); padding-top: 50px; }
/* foe art: centred in the red panel (horizontally on the panel's axis, vertically between header and controls) */
.bt-foeart { left: 71%; top: 55%; bottom: auto; transform: translate(-50%, -50%); }
/* HP: the lost part reveals the slab behind (no second "bar" to misread) */
.bs-hp, .bs-hp.big, .bs-hp.on-ink, .bt-foe .bs-hp.big { background: transparent; }
.rg-pcard .bs-hp, .rg-ucard .bs-hp, .rg-um-main .bs-hp, .rg-partymodal .bs-hp, .rg-pumodal .bs-hp { background: transparent; }
/* foe side: low HP in ink, never the slab's own --c3 */
.bt-foe .bs-hp.big > i.low, .bs-hp.on-ink > i.low { background: var(--ink); }
/* centring lives in the `translate` property so transform animations (shake) don't displace the art */
.bt-foeart { transform: none; translate: -50% -50%; }

/* ---- intenção do inimigo: logo abaixo da barra/stats do foe, atrás da arte do Runekin ---- */
.bt-foe { z-index: auto; }
.bt-foe > * { position: relative; z-index: 3; }
.bt-foe > .bt-intentwrap { position: relative; z-index: 0; right: auto; bottom: auto; margin-top: 8px; text-align: right; }
/* …em COLUNA encostada à direita: rótulo em cima, um efeito por linha (não briga com a arte na horizontal) */
.bt-intent { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; background: none; padding: 0; transform: none; clip-path: none; }
.bt-intent .lbl { background: var(--ink); color: #fff; padding: 3px 8px; font-size: 13px; letter-spacing: 2px; line-height: 1.2; clip-path: var(--e-btn-b); transform: rotate(2deg); margin-bottom: 2px; }
.bt-intent .rg-gv-ichip { font-size: 15px; padding: 2px 8px; border: 2px solid var(--ink); }
.bt-intent .none { background: var(--ink); padding: 3px 8px; }

/* ---- Arena: sair da batalha (✕ à esquerda de END TURN; pede confirmação) ---- */
.bt-end .bs-btn.quit { --face: transparent; color: #fff; border: 3px solid #fff; min-height: 32px; padding: 4px 10px; margin-right: 6px; }
.bt-end .bs-btn.quit::before, .bt-end .bs-btn.quit::after { clip-path: none; }

/* ---- mapa: composição sem colisões (o palco agora escala nos dois sentidos; o que sobra é a referência 844×390) ----
   · o papel começa DEBAIXO do slab: o canto cortado do papel (--e-paper) e a diagonal do slab
     deixavam uma cunha de tinta preta entre os dois ("divisor preto" no celular) */
.rg-scene .bg.paper-r { left: 176px; }
body.rg-narrow .rg-scene .bg.paper-r { left: 150px; }
/*   · legenda em linha no alto à direita (embaixo dos botões), a equipe ganha a largura toda */
.rg-mapv .rg-legend { top: 58px; bottom: auto; right: 28px; max-width: 420px; display: flex; flex-wrap: wrap; justify-content: flex-end; align-items: center; gap: 2px 10px; }
.rg-mapv .rg-legend .bs-label { font-size: 10px; letter-spacing: 2px; margin-right: 2px; }
.rg-mapv .rg-legend div { font-size: 10px; }
.rg-mapv .rg-legend p { flex-basis: 100%; }
.rg-mapv .rg-mapsvg { top: 96px; bottom: 112px; }
.rg-mapv .rg-partywrap { right: 28px; }
.rg-mapv.rg-party2 .rg-mapsvg { bottom: 172px; }
/*   · itens do slab: chips menores, 5 por linha, e o bloco de baixo nunca invade o título */
.rg-mapv .rg-slabbot { max-height: calc(100% - 218px); overflow: hidden; display: flex; flex-direction: column; justify-content: flex-end; }
.rg-mapv .rg-slabbot .rg-itemchips { gap: 6px 8px; margin-top: 6px; padding-bottom: 6px; }
.rg-mapv .rg-slabbot .rg-ichip { width: 30px; height: 30px; }
.rg-mapv .rg-slabbot .rg-ichip .rg-ic { width: 17px; height: 17px; }
.rg-mapv .rg-slabbot .rg-ichip b { font-size: 10px; right: -5px; bottom: -5px; }
.rg-mapv .rg-slabbot .rg-slabbtns { margin-top: 8px; }
.rg-mapv .rg-slabtxt p { max-height: 3.2em; overflow: hidden; }

/* ---- theme-edge.js: durante a amostragem da cor da borda, slabs decorativos (pointer-events:none) contam ---- */
html.edge-sampling * { pointer-events: auto !important; }
