/* souboj */
.battle { background: radial-gradient(ellipse at center, #241a30, #0b0a10); border: 2px solid #4a2a2a; padding: 10px; }
.side { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin: 6px 0; }
.fighter { width: 118px; background: #0e0c14cc; border: 2px solid var(--line); padding: 4px; text-align: center; cursor: pointer; font-size: 11px; }
.fighter.target { border-color: var(--gold); box-shadow: 0 0 10px #e8c06066; }
.fighter.dead { opacity: .35; filter: grayscale(1); }
.fighter.me { border-color: var(--cyan); }
.fighter img { width: 72px; height: 72px; display: block; margin: 0 auto; }
.fighter.boss { width: 260px; }
.fighter.boss img { width: 168px; height: 168px; }
.fighter .fx { color: var(--cyan); font-size: 10px; min-height: 13px; }
.vs { text-align: center; color: var(--bad); font-weight: bold; letter-spacing: 4px; }
.skills { display: flex; flex-wrap: wrap; gap: 5px; margin: 8px 0; justify-content: center; }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 6px; }
.item { display: flex; gap: 8px; background: var(--panel2); border: 1px solid var(--line); padding: 5px; }
.item img { width: 48px; height: 48px; background: #0a090e; border: 1px solid #000; flex: none; }
.item .acts { margin-top: 3px; display: flex; gap: 4px; flex-wrap: wrap; }
.mats { display: flex; flex-wrap: wrap; gap: 6px; }
.mat { display: flex; align-items: center; gap: 4px; background: var(--panel2); border: 1px solid var(--line); padding: 2px 6px; }
.mat img { width: 24px; height: 24px; }
table { width: 100%; border-collapse: collapse; }
td, th { padding: 3px 6px; border-bottom: 1px solid var(--line); text-align: left; }
th { color: var(--gold); }
.player { display: flex; align-items: center; gap: 6px; padding: 3px 0; border-bottom: 1px dotted var(--line); }
.player img { width: 32px; height: 32px; }
.player .grow { flex: 1; }
.enc-box { background: var(--panel2); border: 1px solid var(--line); padding: 5px; margin: 4px 0; }
.enc-box.boss { border-color: #ff9a2f; }
.enc-box.pvp { border-color: var(--bad); }
#map-wrap { position: relative; width: 100%; aspect-ratio: 16 / 9; background: #0a090e; border: 2px solid var(--line); }
#map-wrap svg { position: absolute; inset: 0; width: 100%; height: 100%; }
.mapnode { position: absolute; transform: translate(-50%, -50%); text-align: center; font-size: 11px; cursor: pointer; width: 110px; }
.mapnode .dot { width: 16px; height: 16px; margin: 0 auto 2px; border: 2px solid #000; background: #6a6a8a; }
.mapnode.here .dot { background: var(--gold); box-shadow: 0 0 10px var(--gold); }
.mapnode.safe .dot { border-color: var(--good); } .mapnode.pvp .dot { border-color: var(--bad); }
#toast { position: fixed; top: 54px; left: 50%; transform: translateX(-50%); z-index: 99; display: flex; flex-direction: column; gap: 4px; pointer-events: none; }
#toast div { background: #2a1414; border: 2px solid var(--bad); padding: 6px 14px; box-shadow: 0 4px 0 #000; }
#toast div.ok { background: #142a18; border-color: var(--good); }
@media (max-width: 1100px) { .layout { grid-template-columns: 1fr; height: auto; } #right { height: 600px; } }

/* RD-08: bounded combat content; the shared hero/chat shell remains in place. */
body:not([data-mobile='true']) #center:has(> #tab-loc:not(.hidden) > .battle),
body[data-mobile='true'][data-mp='game'] #center:has(> #tab-loc:not(.hidden) > .battle) { display: flex; flex-direction: column; overflow: hidden; min-height: 0; }
#tab-loc:has(> .battle) { flex: 1 1 0; min-height: 0; overflow: hidden; padding: 0; }
#tab-loc > .battle { height: 100%; min-height: 0; min-width: 0; box-sizing: border-box; overflow: hidden; position: relative; container-type: inline-size; display: flex; flex-direction: column; gap: 5px; padding: 6px; border: 1px solid #b18b4b; background: linear-gradient(135deg,#0c1923f2,#080e16f5),url('../assets/ui/foundation-stone.png') center/cover; color: #f0e5ce; font-family: Georgia,'Times New Roman',serif; font-size: 15px; }
.battle *, .battle *::before, .battle *::after { box-sizing: border-box; }
.battle :is(h2,h3,p) { margin: 0; padding: 0; border: 0; letter-spacing: 0; }
.battle h2 { font: 600 20px/1.2 Georgia,serif; color: #f8e5b7; }
.battle h3 { font: 600 17px/1.2 Georgia,serif; color: #f8e5b7; }
.battle .btn, .battle input, .battle select { font: inherit; min-height: 44px; min-width: 0; border: 1px solid #b18b4b; border-radius: 0; }
.battle .btn { padding: 4px 7px; color: #f5eacf; white-space: normal; overflow-wrap: anywhere; background: linear-gradient(#29303a,#10151b 45%,#131d25); box-shadow: inset 0 0 0 2px #10151c; }
.battle .btn.primary, .battle .btn[aria-pressed='true'] { background: linear-gradient(#ba863d,#69441d 45%,#452f18); border-color: #f0c678; }
.battle .btn:disabled, .battle .btn[aria-disabled='true'] { opacity: .58; cursor: not-allowed; }
.battle :is(button,input,select,[tabindex]):focus-visible { outline: 2px solid #73e4ec; outline-offset: -2px; }
.battle .btn > small, .battle .btn > span { display: block; }
.battle .sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.battle-heading { display: flex; align-items: center; gap: 6px; flex: 0 0 44px; min-height: 0; }
.battle-heading h2 { flex: 1; min-width: 0; max-height: 44px; overflow: auto; overflow-wrap: anywhere; }
.battle-heading select { flex: 0 1 150px; width: 150px; background: #101b24; color: inherit; padding: 5px; }
.battle-status { flex: 0 0 auto; min-height: 0; }
.battle-status-fighters { display: grid; grid-template-columns: 1fr 1fr; gap: 5px; }
.battle-fighter { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; min-width: 0; padding: 5px; border: 1px solid #a4844a; background: #0c1720; }
.battle-fighter.dead { filter: saturate(.5); }
.battle-fighter-copy { flex: 1; min-width: 0; }
.battle-fighter-copy strong { display: block; overflow-wrap: anywhere; line-height: 1.15; }
.battle-fighter-copy small { display: block; color: #c4b99f; font-size: 11px; }
.battle-fighter-copy .battle-affinities { max-height: 2.4em; overflow: auto; color: #b4e6c1; }
.battle-fighter-copy em { color: #ffb190; font-size: 11px; }
.battle-fighter .bar { height: 16px; margin: 2px 0 0; }
.battle-fighter .bar span { font: 11px/14px Georgia,serif; }
.battle .battle-portrait { width: 58px; height: 64px; flex: 0 0 58px; overflow: hidden; border: 1px solid #d3b46d; border-radius: 50%; background: #09151e; }
.battle .battle-portrait img { width: 100%; height: 100%; object-fit: contain; display: block; }
.battle .battle-portrait img.px { image-rendering: pixelated; }
.battle-effects { flex-basis: 100%; font-size: 11px; color: #79d7db; overflow-wrap: anywhere; }
.battle-target { display: grid; grid-template-columns: minmax(0,1fr) 44px; gap: 3px; min-width: 0; }
.battle-target-controls { display: flex; flex-direction: column; gap: 0; }
.battle-target-controls .btn { flex: 1; font: 24px/1 Georgia,serif; padding: 0; }
.battle-threat { position: relative; margin-top: 3px; min-height: 38px; padding: 4px 6px 7px; background: #2b171b; border: 1px solid #c2573e; overflow: hidden; text-align: center; }
.battle-threat strong, .battle-threat span { display: block; overflow-wrap: anywhere; font-size: 13px; line-height: 1.1; }
.battle-threat span { color: #e9d5b4; font-size: 11px; }
.battle-threat > i { position: absolute; left: 0; bottom: 0; height: 4px; background: #5fe6ef; box-shadow: 0 0 5px #8cefff; }
.battle-counter { padding: 2px 5px !important; color: #ffdb63; text-align: center; font-size: 12px; background: #0c3741; border: 1px solid #55b9c4 !important; }
.battle-main { flex: 1 1 0; min-height: 0; min-width: 0; overflow: hidden; }
.battle-browser { height: 100%; min-height: 0; display: grid; grid-template-columns: minmax(0,1fr) minmax(0,.85fr); gap: 5px; }
.battle-results { min-height: 0; display: grid; grid-template-rows: 44px 44px minmax(0,1fr) 44px; gap: 3px; }
.battle-search-row { display: flex; gap: 3px; min-width: 0; }
.battle-search-row input { width: 0; flex: 1 1 0; margin: 0; padding: 5px 7px; background: #07151e; color: #fff0d3; }
.battle-search-row > .btn { flex: 0 0 44px; font-size: 24px; }
.battle-search-row select { display: none; width: 100px; background: #10212a; color: inherit; }
.battle-filters { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); gap: 3px; }
.battle-filters .btn { padding: 3px 2px; font-size: 13px; }
.battle-skill-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); grid-template-rows: repeat(2,minmax(0,1fr)); min-height: 0; gap: 4px; }
.battle-skill { display: grid; grid-template-columns: minmax(0,1fr) 44px; border: 1px solid #957943; background: #101b23; min-height: 0; min-width: 0; }
.battle-skill > .btn:first-child { padding: 5px 3px; border: 0; min-height: 44px; position: relative; display: grid; align-content: center; justify-items: center; gap: 2px; }
.battle-skill > .btn:first-child strong { font-size: 15px; line-height: 1.1; }
.battle-skill > .btn:first-child small { font-size: 11px; }
.battle-skill .battle-info { padding: 0; font-size: 22px; border-width: 0 0 0 1px; }
.battle-skill.good { border-color: #85cf8b; }
.battle-skill.counter { box-shadow: inset 0 0 7px #edcb4c; }
.battle-skill-empty { border: 1px solid #41484a; background: #09121a88; }
.battle kbd { font: 11px/1.1 Georgia,serif; padding: 2px 3px; color: #ffe4a4; border: 1px solid #b59355; }
.battle-skill kbd { position: absolute; left: 3px; top: 3px; }
.battle-skill-art { width: 36px; height: 30px; display: block; background-image: url('../assets/ui/public-skills.png'); background-size: 200% 200%; }
.battle-skill-art.plasma { background-position: 0 0; }.battle-skill-art.drone { background-position: 100% 0; }.battle-skill-art.nano { background-position: 0 100%; }
.battle-element { font-size: 24px; line-height: 30px; }
.battle-results-footer { display: flex; align-items: center; justify-content: space-between; gap: 4px; min-width: 0; font-size: 12px; }
.battle-pager { display: flex; align-items: center; gap: 4px; flex: 0 0 auto; }
.battle-pager .btn { width: 44px; padding: 0; font-size: 24px; }
.battle-pager output { min-width: 34px; text-align: center; font-size: 12px; }
.battle-detail { min-height: 0; display: flex; flex-direction: column; gap: 3px; border: 1px solid #bd9657; padding: 5px; background: #0d1821; }
.battle-detail-copy { flex: 1; min-height: 0; overflow: auto; overflow-wrap: anywhere; overscroll-behavior: contain; }
.battle-detail-copy p { margin-top: 6px; font-size: 13px; }
.battle-detail-copy .battle-skill-art { width: 52px; height: 44px; float: left; margin: 0 6px 4px 0; }
.battle-detail-back { flex: 0 0 auto; font-size: 13px !important; }
.battle-detail > .btn:last-child { flex: 0 0 44px; }
.battle-reason { color: #efcb6e; }
.battle-detail-hint { display: grid; place-items: center; border: 1px solid #7c693f; padding: 15px; color: #cbbf9d; text-align: center; }
.battle-empty { grid-column: 1/-1; grid-row: 1/-1; align-self: center; text-align: center; padding: 10px !important; }
.battle-urgent { flex: 0 0 auto; display: grid; grid-template-columns: 1fr; gap: 3px; }
.battle-defenses, .battle-consumables { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 3px; }
.battle-urgent .btn { display: flex; align-items: center; justify-content: center; gap: 4px; min-height: 44px; padding: 3px; font-size: 14px; line-height: 1.05; }
.battle-urgent .btn small { font-size: 11px; }
.battle-roster, .battle-items-view { height: 100%; display: flex; flex-direction: column; gap: 4px; min-height: 0; }
.battle-roster > .battle-pager, .battle-items-view > .battle-pager { justify-content: center; }
.battle-roster-grid { flex: 1; display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); grid-template-rows: repeat(2,minmax(0,1fr)); gap: 4px; min-height: 0; }
.battle-roster-grid > section { min-height: 0; min-width: 0; display: flex; flex-direction: column; gap: 2px; border: 1px solid #9f814a; padding: 4px; }
.battle-roster-grid > section > .btn { flex: 0 0 44px; }
.battle-roster .battle-fighter { border: 0; padding: 0; }
.battle-roster .battle-fighter .battle-portrait { width: 40px; height: 44px; flex-basis: 40px; }
.battle-roster-description, .battle-item-description { flex: 1; min-height: 0; overflow: auto; overflow-wrap: anywhere; font-size: 12px; }
.battle .battle-log { height: 100%; min-height: 0; max-height: none; overflow: auto; white-space: normal; overflow-wrap: anywhere; padding: 8px; border: 1px solid #ae8d51; background: #09141c; font: 14px/1.5 Georgia,serif; }
.battle-fighter.shake { animation: shake .3s; }.battle-fighter.glow { animation: glow .5s; }
.battle-ended .battle-result-title { text-align: center; flex: 0 0 auto; }
.battle-result-title p { font-size: 16px; overflow-wrap: anywhere; }
.battle-final-state > h3 { font-size: 14px; margin-bottom: 3px; }
.battle-final-state > div { display: grid; grid-template-columns: 1fr 1fr; gap: 5px; }
.battle-result-tabs { display: flex; gap: 3px; flex: 0 0 44px; }
.battle-result-tabs .btn { flex: 1; }
.battle-result-logs { flex: 1; min-height: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.battle-result-logs > section { display: flex; flex-direction: column; gap: 3px; min-height: 0; min-width: 0; }
.battle-result-logs h3 { font-size: 16px; }
.battle-result-logs .battle-log { flex: 1 1 0; }
.battle-result-logs.is-roster { display: flex; }
.battle-result-logs.is-roster > .battle-roster { flex: 1; min-width: 0; }
.battle-roster .battle-effects { max-height: 2.4em; overflow: auto; }
.battle-ended > footer { flex: 0 0 44px; display: flex; justify-content: center; }
.battle-ended > footer .btn { width: min(340px,100%); }
.battle-capture-locale { font-size: 11px; }
@container (max-width: 650px) {
  .battle-heading h2 { font-size: 16px; }
  .battle-browser { grid-template-columns: minmax(0,1fr); }
  .battle-detail-hint { display: none; }
  .battle-browser.has-detail { grid-template-rows: 44px minmax(0,1fr); }
  .battle-browser.has-detail .battle-results { display: contents; }
  .battle-browser.has-detail .battle-filters, .battle-browser.has-detail .battle-skill-grid, .battle-browser.has-detail .battle-results-footer { display: none; }
  .battle-browser.has-detail .battle-detail { grid-row: 2; }
  .battle .battle-portrait { width: 36px; height: 44px; flex-basis: 36px; }
  .battle-fighter { gap: 3px; padding: 3px; }
  .battle-fighter-copy strong { font-size: 12px; }
  .battle-fighter .bar { height: 13px; }
  .battle-fighter .bar span { font-size: 10px; line-height: 11px; }
  .battle-status-fighters { gap: 3px; }
  .battle-target { grid-template-columns: minmax(0,1fr) 44px; }
  .battle .battle-skill .battle-skill-art, .battle .battle-skill .battle-element { display: none; }
  .battle-detail-copy .battle-skill-art { display: block; }
  .battle-skill > .btn:first-child { padding-left: 13px; }
  .battle-urgent kbd { display: none; }
  .battle-result-tabs { display: flex; gap: 3px; }
  .battle-result-tabs .btn { flex: 1; }
  .battle-result-logs { display: flex; }
  .battle-result-logs > section { display: none; flex: 1; }
  .battle-result-logs > section.selected { display: flex; }
}
/* Small phones use the same four skills; compact chrome frees space for44px actions. */
@media (max-height: 700px) {
  body[data-mobile='true'] #tab-loc > .battle { padding: 2px; gap: 2px; }
  body[data-mobile='true'] .battle-filters { display: none; }
  body[data-mobile='true'] .battle-search-row select { display: block; }
  body[data-mobile='true'] .battle-results { grid-template-rows: 44px minmax(0,1fr); gap: 2px; }
  body[data-mobile='true'] .battle-results-footer { position: absolute; top: 2px; right: 2px; height: 44px; z-index: 2; }
  body[data-mobile='true'] .battle-results-footer > output { display: none; }
  body[data-mobile='true'] .battle-active .battle-heading { padding-right: 142px; }
  body[data-mobile='true'] .battle-active .battle-heading h2 { display: none; }
  body[data-mobile='true'] .battle-heading select { width: 100%; flex: 1; }
  body[data-mobile='true'] .battle .battle-portrait { display: none; }
  body[data-mobile='true'] .battle-status-fighters .battle-fighter-copy small { display: none; }
  body[data-mobile='true'] .battle-status-fighters .battle-fighter-copy strong { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  body[data-mobile='true'] .battle-target { grid-template-columns: minmax(0,1fr) 88px; }
  body[data-mobile='true'] .battle-target-controls { flex-direction: row; }
  body[data-mobile='true'] .battle-target-controls .btn { width: 44px; }
  body[data-mobile='true'] .battle-threat { min-height: 32px; margin-top: 1px; padding: 2px 3px 5px; }
  body[data-mobile='true'] .battle-threat strong { font-size: 11px; }
  body[data-mobile='true'] .battle-threat span { font-size: 10px; }
  body[data-mobile='true'] .battle-counter { font-size: 10px; line-height: 12px; padding: 0 2px !important; }
  body[data-mobile='true'] .battle-urgent, body[data-mobile='true'] .battle-defenses, body[data-mobile='true'] .battle-consumables { gap: 0; }
  body[data-mobile='true'] .battle-skill .battle-skill-art, body[data-mobile='true'] .battle-skill .battle-element { display: none; }
  body[data-mobile='true'] .battle-skill > .btn:first-child strong { font-size: 12px; }
  body[data-mobile='true'] .battle-skill > .btn:first-child small { font-size: 10px; }
  body[data-mobile='true'] .battle-skill-grid { gap: 2px; }
  body[data-mobile='true'] .battle-roster-grid { grid-template-columns: 1fr; grid-template-rows: minmax(0,1fr); }
}
/* Phone landscape keeps status left, four skills centrally, urgent actions right. */
@media (min-width: 600px) and (max-height: 450px) {
  body[data-mobile='true'] #tab-loc > .battle-active { --battle-left: 210px; --battle-right: 180px; display: grid; grid-template-columns: var(--battle-left) minmax(0,1fr) var(--battle-right); grid-template-rows: 44px minmax(0,1fr); gap: 3px; }
  body[data-mobile='true'] .battle-active .battle-heading { grid-column: 2; grid-row: 1; min-width: 0; padding-right: 142px; }
  body[data-mobile='true'] .battle-active .battle-status { grid-column: 1; grid-row: 1 / 3; min-height: 0; }
  body[data-mobile='true'] .battle-status-fighters { grid-template-columns: 1fr; gap: 2px; }
  body[data-mobile='true'] .battle-active .battle-main { grid-column: 2; grid-row: 2; }
  body[data-mobile='true'] .battle-active .battle-urgent { grid-column: 3; grid-row: 1 / 3; grid-template-columns: 1fr 1fr; align-content: center; }
  body[data-mobile='true'] .battle-defenses, body[data-mobile='true'] .battle-consumables { grid-template-columns: 1fr; grid-template-rows: repeat(3,minmax(44px,1fr)); }
  body[data-mobile='true'] .battle-results-footer { right: calc(var(--battle-right) + 5px); }
  body[data-mobile='true'] .battle-browser { grid-template-columns: minmax(0,1fr); }
  body[data-mobile='true'] .battle-detail-hint { display: none; }
  body[data-mobile='true'] .battle-browser.has-detail { grid-template-rows: 44px minmax(0,1fr); }
  body[data-mobile='true'] .battle-browser.has-detail .battle-results { display: contents; }
  body[data-mobile='true'] .battle-browser.has-detail .battle-skill-grid, body[data-mobile='true'] .battle-browser.has-detail .battle-results-footer { display: none; }
  body[data-mobile='true'] .battle-detail { padding: 2px; gap: 0; position: relative; }
  body[data-mobile='true'] .battle-detail-back { position: absolute; right: 0; top: -44px; width: 110px; }
  body[data-mobile='true'] .battle-browser.has-detail .battle-search-row { padding-right: 110px; }
  body[data-mobile='true'] .battle-browser.has-detail .battle-search-row select { display: none; }
  body[data-mobile='true'] .battle-roster-grid { grid-template-columns: 1fr; grid-template-rows: minmax(0,1fr); }
  body[data-mobile='true'] #tab-loc > .battle-ended { display: grid; grid-template-columns: 210px minmax(0,1fr); grid-template-rows: 44px minmax(0,1fr) 44px; }
  body[data-mobile='true'] .battle-ended .battle-result-title { grid-column: 1; grid-row: 1; }
  body[data-mobile='true'] .battle-result-title h2 { font-size: 16px; }
  body[data-mobile='true'] .battle-result-title p { font-size: 12px; }
  body[data-mobile='true'] .battle-final-state { grid-column: 1; grid-row: 2 / 4; }
  body[data-mobile='true'] .battle-final-state > div { grid-template-columns: 1fr; }
  body[data-mobile='true'] .battle-result-tabs { display: flex; grid-column: 2; grid-row: 1; }
  body[data-mobile='true'] .battle-result-logs { display: flex; grid-column: 2; grid-row: 2; }
  body[data-mobile='true'] .battle-result-logs > section { display: none; flex: 1; }
  body[data-mobile='true'] .battle-result-logs > section.selected { display: flex; }
  body[data-mobile='true'] .battle-result-logs h3 { display: none; }
  body[data-mobile='true'] .battle-ended > footer { grid-column: 2; grid-row: 3; }
}
@media (prefers-reduced-motion: reduce) { .battle *, .battle *::before, .battle *::after { animation: none !important; transition: none !important; } }
/* Průběh boje je vidět stále vedle schopností (místo prázdného panelu detailu). */
.battle-side-log { min-height: 0; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.battle-side-log > h3 { font-size: 14px; margin: 0; color: #e8d6a8; }
.battle .battle-side-log > .battle-log { flex: 1 1 0; height: auto; padding: 6px; font-size: 13px; line-height: 1.4; }
/* S jednou či dvěma schopnostmi karty nevyplňují celou výšku a nezůstávají prázdná políčka. */
.battle-skill-grid.few { grid-template-rows: minmax(0, 150px); align-content: start; }
/* Slabiny a odolnosti na konci boje celé, bez vnitřního posuvníku. */
.battle-final-state .battle-affinities { max-height: none; overflow: visible; }
@container (max-width: 650px) {
  .battle-side-log { display: none; }
  .battle-ended { overflow-y: auto; }
  .battle-ended .battle-result-logs { flex: 1 0 170px; }
  .battle-ended > footer { position: sticky; bottom: 0; z-index: 2; padding-top: 4px; background: #0b1620; }
}
@media (min-width: 600px) and (max-height: 450px) { body[data-mobile='true'] .battle-side-log { display: none; } }
