/* ============================================================================
   MuIdle — Redesign UI (Desktop + Mobile)
   Spójny styl mrocznego MU Online (obsydian + szczotkowane złoto),
   brak nakładania się paneli HUD, wygodna obsługa kciukiem na telefonie.
   ============================================================================ */

:root {
  --ui-bg: rgba(12, 13, 18, 0.92);
  --ui-bg-solid: #111218;
  --ui-card: rgba(22, 20, 18, 0.92);
  --ui-field: rgba(8, 9, 12, 0.88);
  --ui-gold: #d4a657;
  --ui-gold2: #f4d38b;
  --ui-border: rgba(212, 166, 87, 0.28);
  --ui-border-strong: rgba(212, 166, 87, 0.55);
  --ui-shadow: 0 12px 36px rgba(0, 0, 0, 0.72);
  --ui-corners:
    linear-gradient(var(--ui-gold), var(--ui-gold)) left top / 12px 2px no-repeat,
    linear-gradient(var(--ui-gold), var(--ui-gold)) left top / 2px 12px no-repeat,
    linear-gradient(var(--ui-gold), var(--ui-gold)) right top / 12px 2px no-repeat,
    linear-gradient(var(--ui-gold), var(--ui-gold)) right top / 2px 12px no-repeat,
    linear-gradient(var(--ui-gold), var(--ui-gold)) left bottom / 12px 2px no-repeat,
    linear-gradient(var(--ui-gold), var(--ui-gold)) left bottom / 2px 12px no-repeat,
    linear-gradient(var(--ui-gold), var(--ui-gold)) right bottom / 12px 2px no-repeat,
    linear-gradient(var(--ui-gold), var(--ui-gold)) right bottom / 2px 12px no-repeat;
}

@keyframes uiPop {
  from { opacity: 0; transform: translateY(6px) scale(0.985); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

/* ---------- liczby zawsze wyrównane ---------- */
.lvl, .stat-row .v, .derived, .money-val, .bag-count, .ch-lvl, .pf-hp, .ms-hero b, .ms-row b {
  font-variant-numeric: tabular-nums;
}

/* ---------- ujednolicone okna (Desktop) ---------- */
html:not(.portrait) .panel.win.open,
html:not(.portrait) .so,
html:not(.portrait) .ms,
html:not(.portrait) .modal-box {
  background: var(--ui-corners), var(--ui-bg) !important;
  border: 1px solid var(--ui-border) !important;
  border-radius: 6px !important;
  box-shadow: var(--ui-shadow), inset 0 1px 0 rgba(255, 232, 175, 0.08) !important;
  animation: uiPop 0.16s ease-out;
}

html:not(.portrait) .panel.win .panel-title {
  font-family: Cinzel, Georgia, serif;
  color: var(--ui-gold2);
  letter-spacing: 0.6px;
  border-bottom: 1px solid rgba(212, 166, 87, 0.18);
  padding-bottom: 6px;
  margin-bottom: 10px;
}

html:not(.portrait) .win .tabs {
  background: rgba(8, 9, 13, 0.72);
  border: 1px solid rgba(212, 166, 87, 0.18);
  border-radius: 5px;
  padding: 3px;
  gap: 3px;
}
html:not(.portrait) .win .tabs button {
  border-radius: 4px;
  border: 1px solid transparent;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}
html:not(.portrait) .win .tabs button.active {
  background: linear-gradient(180deg, rgba(212, 166, 87, 0.24), rgba(130, 88, 28, 0.28));
  border-color: var(--ui-border-strong);
  color: var(--ui-gold2);
}

/* ---------- przyciski: spójny styl MU ---------- */
.btn {
  border-radius: 4px;
  border: 1px solid rgba(212, 166, 87, 0.28);
  background: linear-gradient(180deg, #27221b, #191612);
  color: #efe2c6;
  transition: filter 0.15s, border-color 0.15s, transform 0.08s;
}
.btn:hover:not(:disabled) {
  border-color: var(--ui-gold);
  filter: brightness(1.12);
}
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn.gold {
  background: linear-gradient(180deg, #8b6029, #543414);
  border-color: #c99648;
  color: #fff0c8;
  box-shadow: 0 2px 10px rgba(212, 166, 87, 0.22);
}
.btn.red {
  background: linear-gradient(180deg, #5c221a, #36130e);
  border-color: #9e4032;
  color: #ffd0c6;
}

/* ---------- statystyki: +1, +10, +100, Max ---------- */
.stat-row {
  gap: 4px;
  padding: 4px 0;
}
.stat-row button {
  min-width: 26px;
  height: 26px;
  padding: 0 5px;
  font-size: 11px;
  font-weight: 700;
  border-radius: 3px;
  border: 1px solid rgba(212, 166, 87, 0.3);
  background: #231e17;
  color: var(--ui-gold2);
  cursor: pointer;
}
.stat-row button:hover:not(:disabled) {
  border-color: var(--ui-gold2);
  background: #362c1f;
}
.stat-row button.x100 { min-width: 38px; }
.stat-row button.xmax { min-width: 34px; color: #ffe9a8; border-color: rgba(212, 166, 87, 0.5); }
.stat-row button:disabled { opacity: 0.35; cursor: default; }

/* ---------- HUD Desktop: strefy bez kolizji ---------- */
html:not(.portrait) .zone-header {
  top: 10px !important;
  background: rgba(12, 13, 18, 0.84);
  border: 1px solid var(--ui-border);
  border-radius: 999px;
  padding: 4px 10px;
  box-shadow: 0 6px 22px rgba(0, 0, 0, 0.6);
}
html:not(.portrait) .spot-pill {
  border-radius: 999px;
  border: 1px solid transparent;
  transition: background 0.15s, border-color 0.15s;
}
html:not(.portrait) .spot-pill.active {
  background: linear-gradient(180deg, rgba(212, 166, 87, 0.28), rgba(120, 82, 26, 0.36));
  border-color: var(--ui-gold);
  color: var(--ui-gold2);
}

html:not(.portrait) .desk-quick {
  top: 10px !important;
  right: 12px !important;
  gap: 6px;
}
html:not(.portrait) .desk-quick button {
  background: rgba(14, 15, 20, 0.88);
  border: 1px solid var(--ui-border);
  border-radius: 6px;
  color: #efe2c6;
  font-weight: 600;
  padding: 6px 11px;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.5);
  transition: border-color 0.15s, background 0.15s;
}
html:not(.portrait) .desk-quick button:hover {
  border-color: var(--ui-gold);
  background: rgba(34, 28, 20, 0.94);
  color: var(--ui-gold2);
}

/* Wydarzenia (Zamek Krwi + Złota Inwazja) równo pod szybkim paskiem */
html:not(.portrait) #bcPill {
  top: 52px;
  right: 12px;
  border-radius: 6px;
}
html:not(.portrait) .inv-pill {
  top: 98px;
  right: 12px;
  border-radius: 6px;
}

/* Party + Buffy po lewej stronie */
html:not(.portrait) .party-frame {
  top: 64px;
  left: 12px;
}
html:not(.portrait) .party-frame .pf-head,
html:not(.portrait) .party-frame .pf-m {
  background: rgba(14, 15, 20, 0.86);
  border: 1px solid var(--ui-border);
  border-radius: 5px;
}

/* Scalony Czat + System (ukryj osobny .msgbox gdy czat jest aktywny na desktopie) */
html:not(.portrait) body:has(#netChat) .msgbox { display: none !important; }
html:not(.portrait) .net-chat {
  background: rgba(11, 12, 17, 0.88);
  border: 1px solid var(--ui-border);
  border-radius: 7px;
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.65);
  overflow: hidden;
}
html:not(.portrait) .net-chat .nc-head {
  background: rgba(20, 18, 15, 0.92);
  border-bottom: 1px solid rgba(212, 166, 87, 0.2);
}
html:not(.portrait) .net-chat .nc-head button.on {
  color: var(--ui-gold2);
  box-shadow: inset 0 -2px 0 var(--ui-gold);
}
.net-chat .nc-msg.nc-sys { color: #d8ccb4; font-size: 12px; }
.net-chat .nc-msg.nc-sys time { color: #8c8270; margin-right: 5px; }

/* Jakość przedmiotów i autentyczny MU glow (+7 / +9 / +11 / +13..+15 / Excellent) na PNG w ekwipunku */
.slot { position: relative; overflow: hidden; }
.slot .it-img {
  position: absolute; inset: 3px;
  background-position: center; background-repeat: no-repeat; background-size: contain;
  pointer-events: none; z-index: 0;
}
.slot > .upg, .slot > .req, .slot > .stack-count { z-index: 2; }

.slot.q-exc { box-shadow: inset 0 0 0 1px rgba(61, 255, 139, 0.6), inset 0 0 14px rgba(40, 210, 110, 0.28); }
.slot.q-high { box-shadow: inset 0 0 0 1px rgba(244, 211, 139, 0.6), inset 0 0 12px rgba(212, 166, 87, 0.24); }
.slot.q-opt { box-shadow: inset 0 0 0 1px rgba(127, 178, 255, 0.45); }
.slot.selected { outline: 2px solid var(--ui-gold2); outline-offset: -2px; z-index: 2; }

/* Konturowy blask + poświata tła + animowany połysk chromu MU maskowany do kształtu PNG */
.slot.upg-7 .it-img {
  filter: brightness(1.18) saturate(1.3) drop-shadow(0 0 4px rgba(255, 200, 85, 0.85)) drop-shadow(0 0 8px rgba(255, 165, 35, 0.45));
}
.slot.upg-9 .it-img {
  filter: brightness(1.3) saturate(1.48) drop-shadow(0 0 5px rgba(255, 215, 80, 1)) drop-shadow(0 0 11px rgba(255, 165, 25, 0.8));
}
.slot.upg-11 .it-img {
  filter: brightness(1.38) saturate(1.55) drop-shadow(0 0 6px rgba(255, 230, 110, 1)) drop-shadow(0 0 14px rgba(255, 175, 30, 0.9));
}
.slot.upg-13 .it-img {
  filter: brightness(1.48) saturate(1.6) drop-shadow(0 0 6px rgba(255, 248, 185, 1)) drop-shadow(0 0 16px rgba(255, 195, 45, 0.95));
}
.slot.is-exc .it-img {
  filter: brightness(1.24) saturate(1.42) drop-shadow(0 0 5px rgba(70, 255, 150, 0.95)) drop-shadow(0 0 11px rgba(30, 215, 115, 0.7));
}
.slot.is-exc.upg-9 .it-img,
.slot.is-exc.upg-11 .it-img {
  filter: brightness(1.36) saturate(1.55) drop-shadow(0 0 5px rgba(120, 255, 180, 1)) drop-shadow(0 0 14px rgba(255, 210, 75, 0.88));
}
.slot.is-exc.upg-13 .it-img {
  filter: brightness(1.48) saturate(1.65) drop-shadow(0 0 6px rgba(185, 255, 225, 1)) drop-shadow(0 0 16px rgba(255, 220, 90, 0.98));
}
/* Pulsująca aura świecenia wokół przedmiotu w slocie (+7..+15 / Excellent) */
@keyframes muAuraPulse {
  0%, 100% { opacity: 0.55; }
  50% { opacity: 0.95; }
}
.slot.upg-7::after, .slot.upg-9::after, .slot.upg-11::after, .slot.upg-13::after, .slot.is-exc::after {
  content: ""; position: absolute; inset: 0; pointer-events: none; z-index: 0;
  animation: muAuraPulse 2.2s ease-in-out infinite;
}
.slot.upg-7::after { background: radial-gradient(circle at 50% 50%, rgba(255, 195, 75, 0.25), transparent 72%); }
.slot.upg-9::after { background: radial-gradient(circle at 50% 50%, rgba(255, 210, 80, 0.38), rgba(255, 155, 20, 0.12) 55%, transparent 78%); }
.slot.upg-11::after { background: radial-gradient(circle at 50% 50%, rgba(255, 225, 100, 0.45), rgba(255, 165, 25, 0.16) 58%, transparent 80%); }
.slot.upg-13::after { background: radial-gradient(circle at 50% 50%, rgba(255, 245, 175, 0.55), rgba(255, 185, 40, 0.22) 58%, transparent 82%); }
.slot.is-exc::after { background: radial-gradient(circle at 50% 50%, rgba(65, 255, 150, 0.38), rgba(25, 190, 110, 0.12) 58%, transparent 78%); }
.slot.is-exc.upg-9::after, .slot.is-exc.upg-11::after, .slot.is-exc.upg-13::after {
  background: radial-gradient(circle at 50% 50%, rgba(155, 255, 195, 0.48), rgba(255, 210, 80, 0.2) 58%, transparent 82%);
}

/* Przesuwająca się fala metalicznego połysku (Chrome) WYŁĄCZNIE po pikselach PNG przedmiotu */
@keyframes muChromeSweep {
  0%   { background-position: -140% 0; }
  55%  { background-position: 240% 0; }
  100% { background-position: 240% 0; }
}
.slot.upg-7 .it-img::before,
.slot.upg-9 .it-img::before,
.slot.upg-11 .it-img::before,
.slot.upg-13 .it-img::before,
.slot.is-exc .it-img::before {
  content: "";
  position: absolute; inset: 0; pointer-events: none;
  -webkit-mask-image: var(--it-url);
  mask-image: var(--it-url);
  -webkit-mask-size: contain; mask-size: contain;
  -webkit-mask-position: center; mask-position: center;
  -webkit-mask-repeat: no-repeat; mask-repeat: no-repeat;
  background-size: 240% 100%;
  background-repeat: no-repeat;
  mix-blend-mode: screen;
  animation: muChromeSweep 2.8s cubic-bezier(0.4, 0, 0.2, 1) infinite;
}
.slot.upg-7 .it-img::before {
  background-image: linear-gradient(118deg, transparent 36%, rgba(255, 215, 130, 0.45) 50%, transparent 64%);
  animation-duration: 3.4s;
}
.slot.upg-9 .it-img::before {
  background-image: linear-gradient(118deg, transparent 32%, rgba(255, 220, 115, 0.72) 48%, rgba(255, 252, 220, 0.85) 51%, transparent 66%);
  animation-duration: 2.7s;
}
.slot.upg-11 .it-img::before {
  background-image: linear-gradient(118deg, transparent 28%, rgba(255, 200, 70, 0.75) 45%, rgba(255, 255, 235, 0.95) 51%, rgba(255, 200, 70, 0.6) 57%, transparent 70%);
  animation-duration: 2.3s;
}
.slot.upg-13 .it-img::before {
  background-image: linear-gradient(118deg, transparent 24%, rgba(255, 215, 95, 0.82) 42%, rgba(255, 255, 255, 1) 50%, rgba(255, 215, 95, 0.75) 58%, transparent 74%);
  animation-duration: 1.95s;
}
.slot.is-exc .it-img::before {
  background-image: linear-gradient(118deg, transparent 30%, rgba(60, 255, 160, 0.7) 46%, rgba(190, 255, 235, 0.92) 51%, rgba(60, 220, 255, 0.55) 58%, transparent 70%);
  animation-duration: 2.4s;
}
.slot.is-exc.upg-13 .it-img::before {
  background-image: linear-gradient(118deg, transparent 24%, rgba(80, 255, 175, 0.85) 42%, rgba(255, 255, 235, 1) 50%, rgba(255, 220, 105, 0.85) 58%, transparent 74%);
  animation-duration: 1.85s;
}

/* Unoszące się iskierki MU na +9..+15 i Excellent */
@keyframes muSparkRise {
  0%   { transform: translateY(8px) scale(0.3); opacity: 0; }
  25%  { opacity: 0.95; }
  80%  { opacity: 0.6; }
  100% { transform: translateY(-28px) scale(1.05); opacity: 0; }
}
.slot .mu-sp {
  position: absolute;
  left: var(--x, 50%);
  bottom: 18%;
  width: 3px; height: 3px;
  border-radius: 50%;
  background: #fff4c2;
  box-shadow: 0 0 6px 1px rgba(255, 210, 85, 0.95);
  pointer-events: none;
  z-index: 1;
  opacity: 0;
  animation: muSparkRise var(--t, 2s) ease-out var(--d, 0s) infinite;
}
.slot .mu-sp.exc {
  background: #c8ffe4;
  box-shadow: 0 0 6px 1px rgba(68, 255, 154, 0.95);
}

/* Domyślnie ukryj mobilny pasek pod-zakładek w plecaku (tylko portrait) */
.mob-inv-tabs { display: none; }

/* ============================================================================
   MOBILE PORTRAIT REDESIGN (html.portrait)
   ============================================================================ */
html.portrait {
  --m-top: calc(78px + env(safe-area-inset-top));
  --m-nav: calc(60px + env(safe-area-inset-bottom));
}

html.portrait #mtop {
  background: linear-gradient(180deg, #191610, #0d0c09);
  border-bottom: 1px solid rgba(212, 166, 87, 0.32);
}
html.portrait .mt-row { height: 48px; gap: 8px; }
html.portrait .mt-face { width: 36px; height: 36px; border-radius: 6px; }
html.portrait .mt-who b { font-size: 16px; }
html.portrait .mt-vit { height: 26px; }
html.portrait .mt-bar { height: 10px; border-radius: 999px; }
html.portrait .mt-bar em { font-size: 8.5px; line-height: 10px; }

/* 5 dużych zakładek na dole (zamiast 7 ściśniętych) */
html.portrait #mnav {
  grid-template-columns: repeat(5, 1fr) !important;
  background: linear-gradient(180deg, #181510, #0b0a08);
  border-top: 1px solid rgba(212, 166, 87, 0.34);
  box-shadow: 0 -6px 20px rgba(0, 0, 0, 0.7);
}
html.portrait #mnav button {
  font-size: 11.5px;
  font-weight: 600;
  gap: 2px;
}
html.portrait #mnav button img {
  width: 26px;
  height: 26px;
}

/* Mobilne pod-zakładki w Plecaku (Plecak | Wyposażenie | Kocioł | Skrzynia) */
html.portrait .mob-inv-tabs {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
  margin-bottom: 10px;
}
html.portrait .mob-inv-tabs button {
  min-height: 38px;
  border-radius: 6px;
  border: 1px solid var(--m-line);
  background: var(--m-card);
  color: var(--m-sub);
  font: 700 12.5px var(--m-sans);
}
html.portrait .mob-inv-tabs button.on {
  background: linear-gradient(180deg, #5e3e1b, #36230f);
  border-color: var(--m-gold);
  color: var(--m-gold3);
  box-shadow: 0 2px 10px rgba(209, 163, 95, 0.25);
}

/* Jednoekranowy plecak na mobile: duża siatka 8×8 na całą szerokość (z zachowaniem karty #itemDetail) */
html.portrait #tab-inv .inv-dual-layout[data-mview="bag"] .equip-win { padding: 0 !important; border: none !important; background: none !important; margin: 0 !important; }
html.portrait #tab-inv .inv-dual-layout[data-mview="bag"] .equip-win > .inv-subwin-title,
html.portrait #tab-inv .inv-dual-layout[data-mview="bag"] .equip-win > .equip-grid { display: none; }
html.portrait #tab-inv .inv-dual-layout[data-mview="equip"] .bag-win { display: none; }
html.portrait #tab-inv .inv-dual-layout[data-mview="equip"] .equip-win .equip-grid { max-width: 300px; }

/* Przyciski statystyk na mobile */
html.portrait .stat-row button { width: auto; min-width: 34px; height: 34px; padding: 0 7px; font-size: 12px; }
html.portrait .stat-row button.x100 { min-width: 44px; }
html.portrait .stat-row button.xmax { min-width: 40px; }

/* Dolna karta akcji przedmiotu (Bottom Sheet) */
html.portrait #itemDetail:has(.it-actions) {
  left: 6px;
  right: 6px;
  bottom: calc(var(--m-nav) + 6px);
  border-radius: 12px !important;
  border: 1px solid rgba(212, 166, 87, 0.5) !important;
  background: rgba(16, 15, 13, 0.96) !important;
  box-shadow: 0 -12px 40px rgba(0, 0, 0, 0.88);
}
html.portrait #itemDetail .it-actions .btn {
  min-height: 44px;
  border-radius: 6px;
  touch-action: manipulation;
}
.btn, .stat-row button, #mnav button, .mob-inv-tabs button, .inv-grid .slot, .equip-grid .slot { touch-action: manipulation; }
/* Drag palcem tylko w układzie poziomym; w pionowym (mobile) działa czysty 1-tap + Przesuń */
html.touch:not(.portrait) .inv-grid .slot,
html.touch:not(.portrait) .equip-grid .slot,
html.touch:not(.portrait) .vault-grid .slot,
html.touch:not(.portrait) .chaos-grid .slot {
  touch-action: none;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
}
/* Pasek trybu „Przesuń” i przyciski szybkiego ulepszania klejnotami w karcie przedmiotu */
.move-banner {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 7px 10px; margin: 6px 0; border-radius: 6px;
  background: rgba(212, 166, 87, 0.16); border: 1px solid rgba(212, 166, 87, 0.55);
  color: #f6e7c4; font-size: 12px;
}
.move-banner b { color: #ffd36b; }
.it-upgs:empty { display: none; }
.it-upgs {
  display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; padding-top: 8px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}
.it-jbtn {
  display: inline-flex; align-items: center; gap: 6px; flex: 1 1 auto; justify-content: center;
  background: linear-gradient(180deg, rgba(212, 166, 87, 0.2), rgba(74, 52, 20, 0.4)) !important;
  border: 1px solid rgba(212, 166, 87, 0.45) !important; color: #ffe7a8 !important; font-weight: 600;
}
.it-jbtn img { width: 16px; height: 16px; object-fit: contain; }

/* Wyraźna siatka zrzutu W×H (zielony = pasuje, czerwony = kolizja / brak miejsca) */
.inv-grid.is-moving .inv-cell {
  box-shadow: inset 0 0 0 1px rgba(212, 166, 87, 0.28);
}
.inv-grid.is-moving .inv-cell.drop-ok {
  background-color: rgba(74, 222, 128, 0.1) !important;
  box-shadow: inset 0 0 0 1px rgba(74, 222, 128, 0.35) !important;
}
.inv-cell.fp-ok {
  background-color: rgba(52, 211, 153, 0.34) !important;
  box-shadow: inset 0 0 0 2px #5dff9e, inset 0 0 14px rgba(52, 211, 153, 0.45) !important;
  z-index: 3;
}
.inv-cell.fp-bad {
  background-color: rgba(239, 68, 68, 0.34) !important;
  box-shadow: inset 0 0 0 2px #ff6b6b, inset 0 0 14px rgba(239, 68, 68, 0.45) !important;
  z-index: 3;
}

/* Ekran wstępnego ładowania modeli ekwipunku (#bootLoad) */
.boot-load {
  position: fixed; inset: 0; z-index: 120;
  display: grid; place-items: center;
  background: radial-gradient(560px 320px at 50% 42%, rgba(214, 168, 90, 0.14), #07080d 72%);
  transition: opacity .24s ease;
}
.boot-load.out { opacity: 0; pointer-events: none; }
.boot-load[hidden] { display: none; }
.bl-card {
  width: min(340px, 88vw); padding: 26px 24px; text-align: center;
  background: linear-gradient(180deg, #161822, #0d0e15);
  border: 1px solid rgba(214, 168, 90, 0.42); border-radius: 12px;
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.85), inset 0 1px 0 rgba(255, 240, 200, 0.14);
}
.bl-logo { font: 700 28px/1.1 Cinzel, Georgia, serif; text-transform: uppercase; letter-spacing: 3px; color: #f4e6c8; }
.bl-logo span { color: #ffd36b; }
.bl-sub { margin: 8px 0 16px; font-size: 12.5px; color: #a79e8d; }
.bl-bar { height: 8px; border-radius: 999px; background: #08090e; border: 1px solid rgba(255, 255, 255, 0.08); overflow: hidden; }
.bl-bar i { display: block; height: 100%; width: 8%; background: linear-gradient(90deg, #a77832, #f4d38b); transition: width .16s ease; }
.bl-cnt { margin-top: 10px; font-size: 11.5px; color: #8c8475; font-variant-numeric: tabular-nums; }

/* Pigułki wydarzeń na mobile: bez kolizji ze spotem */
html.portrait #bcPill { top: calc(var(--m-top) + 52px); right: 8px; border-radius: 8px; }
html.portrait .inv-pill { top: calc(var(--m-top) + 98px); right: 8px; border-radius: 8px; }

/* Przywróć „Wybór postaci” w menu bocznym (☰) na telefonie po odchudzeniu dolnego paska do 5 zakładek */
html.portrait .gamemenu #mCharSelect { display: flex !important; order: 2; }
html.portrait .gamemenu #mCharSelect::before { background-image: url(../assets/ui/class_mg.png); }
html.portrait .gamemenu #mSkills::before { background-image: url(../assets/ui/ch_5.png); }

/* Widoczne buffy (własne + od drużyny + Item Shop) na PC i mobile */
.buffs > div { position: relative; border: 1px solid rgba(212, 166, 87, 0.7); box-shadow: 0 2px 10px rgba(0, 0, 0, 0.65), 0 0 8px rgba(212, 166, 87, 0.25); }
.buffs > div.pbuff { border-color: #67e8ff !important; box-shadow: 0 2px 10px rgba(0, 0, 0, 0.7), 0 0 10px rgba(103, 232, 255, 0.45) !important; }
.buffs > div.sbuff { border-color: #ffd36b !important; box-shadow: 0 2px 10px rgba(0, 0, 0, 0.7), 0 0 12px rgba(255, 211, 107, 0.55) !important; }
.buffs > div .pb-tag, .buffs > div .sb-tag { position: absolute; top: -5px; right: -5px; font-style: normal; font-size: 9px; line-height: 13px; width: 14px; height: 14px; text-align: center; border-radius: 50%; pointer-events: none; }
.buffs > div .pb-tag { background: #0d1d26; border: 1px solid #67e8ff; color: #b8f5ff; }
.buffs > div .sb-tag { background: #2a1d06; border: 1px solid #ffd36b; color: #ffe99e; }

/* Sklep Specjalny (Item Shop) — mroczne złoto i wykuty metal w stylu MU */
.so.ishop {
  width: min(820px, calc(100vw - 20px)); max-height: min(86vh, 760px);
  background: radial-gradient(600px 220px at 50% 0%, rgba(214, 168, 90, 0.11), transparent 70%), #101116 !important;
  border: 1px solid rgba(214, 168, 90, 0.36) !important; border-radius: 10px !important;
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.85), inset 0 1px 0 rgba(255, 232, 175, 0.14) !important;
}
.so.ishop header { padding: 14px 18px; border-bottom: 1px solid rgba(255, 255, 255, 0.08); }
.ishop-hdr h3 { margin: 0; font: 700 18px/1.2 Cinzel, Georgia, serif; color: #f4d38b; letter-spacing: 0.4px; }
.ishop-hdr small { display: block; font-size: 12px; color: #9a9180; margin-top: 2px; }

.ishop-wallet {
  display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 8px;
  margin-bottom: 12px;
}
.iw-item {
  display: flex; align-items: center; gap: 9px; padding: 8px 10px;
  background: #0a0b0f; border: 1px solid rgba(255, 255, 255, 0.07); border-radius: 7px;
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.6);
}
.iw-item img { width: 22px; height: 22px; object-fit: contain; flex: none; }
.iw-item small { display: block; font-size: 10.5px; color: #8c8475; text-transform: uppercase; letter-spacing: 0.5px; }
.iw-item b { display: block; font-size: 14px; font-weight: 700; color: #f2cf88; font-variant-numeric: tabular-nums; }

.ishop-tabs {
  display: inline-flex; gap: 4px; padding: 3px; margin-bottom: 14px;
  background: #0a0b0f; border: 1px solid rgba(255, 255, 255, 0.08); border-radius: 8px;
}
.ishop-tabs button {
  border: 1px solid transparent; background: transparent; color: #9c9486;
  padding: 6px 13px; border-radius: 6px; font: 600 12.5px/1 Inter, sans-serif; cursor: pointer;
  transition: background .15s, color .15s, border-color .15s;
}
.ishop-tabs button:hover { color: #ece6d9; }
.ishop-tabs button.on { background: rgba(214, 168, 90, 0.16); color: #f4d38b; border-color: rgba(214, 168, 90, 0.38); }

.ishop-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 12px; }
.ishop-card {
  display: flex; flex-direction: column; gap: 10px; padding: 14px;
  background: linear-gradient(180deg, #171922, #12131a);
  border: 1px solid rgba(255, 255, 255, 0.08); border-radius: 9px;
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.04);
  transition: border-color .15s, transform .12s;
}
.ishop-card:hover { border-color: rgba(214, 168, 90, 0.36); transform: translateY(-1px); }
.ishop-card.on { border-color: rgba(214, 168, 90, 0.62); background: linear-gradient(180deg, #1d1a14, #12131a); }

.ishop-head { display: flex; align-items: center; gap: 11px; }
.ishop-icon {
  width: 42px; height: 42px; flex: none; border-radius: 8px; display: grid; place-items: center;
  background: radial-gradient(circle at 50% 35%, rgba(214, 168, 90, 0.18), #090a0e 75%);
  border: 1px solid rgba(214, 168, 90, 0.35);
}
.ishop-icon img { width: 28px; height: 28px; object-fit: contain; }
.ishop-title { min-width: 0; }
.ishop-title b { display: block; font: 600 13.5px/1.25 Inter, sans-serif; color: #f3ead8; }
.ic-badge {
  display: inline-block; margin-top: 4px; padding: 2px 7px; border-radius: 999px;
  font-size: 10.5px; font-weight: 600; background: rgba(255, 255, 255, 0.06); color: #a89f8e;
}
.ic-badge.live { background: rgba(88, 201, 138, 0.16); color: #7ee2aa; border: 1px solid rgba(88, 201, 138, 0.35); }
.ic-badge.item { background: rgba(214, 168, 90, 0.14); color: #f2cf88; }

.ishop-desc { margin: 0; font-size: 12px; color: #9c9484; line-height: 1.45; flex: 1; }
.ishop-foot { display: grid; gap: 9px; padding-top: 9px; border-top: 1px solid rgba(255, 255, 255, 0.06); }
.ishop-costs { display: flex; flex-wrap: wrap; gap: 5px; }
.ic-pill {
  display: inline-flex; align-items: center; gap: 4px; padding: 3px 7px; border-radius: 5px;
  font-size: 11.5px; font-weight: 600; background: #0a0b0f; border: 1px solid rgba(255, 255, 255, 0.07);
}
.ic-pill img { width: 14px; height: 14px; object-fit: contain; }
.ic-pill.ok { color: #84dfa9; border-color: rgba(88, 201, 138, 0.25); }
.ic-pill.no { color: #e88b82; border-color: rgba(229, 107, 95, 0.22); }
.ishop-foot .btn { width: 100%; height: 34px; font-weight: 600; }

@media (max-width: 640px) {
  .ishop-wallet { grid-template-columns: repeat(3, 1fr); }
  .ishop-grid { grid-template-columns: 1fr; }
}
html.portrait .gamemenu #mItemShop { order: 1; }
html.portrait .gamemenu #mItemShop::before { background-image: url(../assets/ui/ch_7.png); }

/* ============================================================================
   FULL IN-GAME UI REFACTOR — Dark-Fantasy Forged Obsidian & Brushed Gold
   Spójny system wizualny dla całej gry: Topbar, Ekran postaci, Okna, Siatki,
   Sklep NPC, Mapa, Targ, Społeczność, Kocioł, Skrzynia, Tooltips, Czat, Mobile.
   ============================================================================ */

/* ---- Scrollbary dopasowane do obsydianu ---- */
* { scrollbar-width: thin; scrollbar-color: rgba(212, 166, 87, 0.35) #0a0b10; accent-color: #d6a85a; }
::-webkit-scrollbar { width: 7px; height: 7px; }
::-webkit-scrollbar-track { background: #0a0b10; }
::-webkit-scrollbar-thumb { background: rgba(212, 166, 87, 0.3); border-radius: 999px; }
::-webkit-scrollbar-thumb:hover { background: rgba(212, 166, 87, 0.55); }

/* ---- Ekran Logowania (.net-login) ---- */
.net-login {
  background:
    radial-gradient(640px 380px at 50% 35%, rgba(214, 168, 90, 0.14), transparent 70%),
    radial-gradient(900px 520px at 50% 100%, rgba(120, 42, 24, 0.16), transparent 72%),
    #07080c !important;
}
.nl-box {
  width: min(390px, 92vw) !important;
  padding: 28px 26px 24px !important;
  gap: 12px !important;
  background:
    linear-gradient(180deg, rgba(22, 24, 34, 0.96), rgba(12, 13, 19, 0.98)) !important;
  border: 1px solid rgba(214, 168, 90, 0.38) !important;
  border-radius: 12px !important;
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.85), inset 0 1px 0 rgba(255, 240, 200, 0.14) !important;
}
.nl-logo {
  font: 700 30px/1.1 Cinzel, Georgia, serif !important;
  text-transform: uppercase;
  letter-spacing: 3px;
  color: #f4e6c8 !important;
}
.nl-sub {
  margin: -4px 0 6px !important;
  font-size: 11px !important;
  letter-spacing: 2px !important;
  color: #9e9585 !important;
}
.nl-tabs {
  padding: 3px;
  background: #090a0f;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  gap: 4px !important;
}
.nl-tabs button {
  border: 1px solid transparent !important;
  border-radius: 6px !important;
  background: transparent !important;
  color: #9c9485 !important;
  padding: 8px 10px !important;
  font-weight: 600 !important;
}
.nl-tabs button.on {
  background: rgba(214, 168, 90, 0.16) !important;
  border-color: rgba(214, 168, 90, 0.42) !important;
  color: #f4d38b !important;
}
.nl-box input {
  padding: 11px 13px !important;
  background: #090a0f !important;
  border: 1px solid rgba(255, 255, 255, 0.12) !important;
  border-radius: 7px !important;
  color: #f3ead8 !important;
  font-size: 14px !important;
}
.nl-box input::placeholder { color: #756e62 !important; }
.nl-box input:focus { border-color: #d6a85a !important; box-shadow: 0 0 0 3px rgba(214, 168, 90, 0.16) !important; }
.nl-box .btn {
  margin-top: 2px;
  height: 42px;
  padding: 0 16px !important;
  border-radius: 7px !important;
  background: linear-gradient(180deg, #be8f43, #8c6123) !important;
  border: 1px solid #ecc479 !important;
  color: #fff8e8 !important;
  font-weight: 700 !important;
  letter-spacing: 0.3px;
  box-shadow: 0 6px 20px rgba(214, 168, 90, 0.25), inset 0 1px 0 rgba(255, 245, 215, 0.35);
}

/* ---- Hierarchia Z-index (koniec nakładania Złotej Inwazji i Czatu na okna!) ---- */
#bcPill, .inv-pill { z-index: 12 !important; }
@media (hover: hover) and (pointer: fine) {
  html:not(.portrait) body:has(#winSide.open) #bcPill,
  html:not(.portrait) body:has(#winSide.open) .inv-pill,
  html:not(.portrait) body:has(#gameMenu:not([hidden])) #bcPill,
  html:not(.portrait) body:has(#gameMenu:not([hidden])) .inv-pill,
  html:not(.portrait) body:has(.so-wrap:not([hidden])) #bcPill,
  html:not(.portrait) body:has(.so-wrap:not([hidden])) .inv-pill {
    display: none !important;
  }
}
html:not(.portrait) .panel.win.open { z-index: 45 !important; }
html:not(.portrait) .gamemenu { z-index: 80 !important; }
.so-wrap, .modal { z-index: 95 !important; }

/* ---- Topbar Spoty bez kolizji z szybkim paskiem (Desktop) ---- */
html:not(.portrait) .zone-header {
  top: 10px !important;
  left: 12px !important;
  transform: none !important;
  border-radius: 8px !important;
  padding: 5px 10px !important;
  flex-direction: row !important;
  align-items: center !important;
  gap: 8px !important;
  max-width: calc(100vw - 415px) !important;
  background: rgba(11, 12, 18, 0.9) !important;
}
html:not(.portrait) .party-frame {
  top: 56px !important;
  width: 248px !important;
  max-width: 248px !important;
}
html:not(.portrait) .party-frame .pf-head {
  flex-wrap: wrap !important;
  gap: 2px 6px !important;
}
html:not(.portrait) .party-frame .pf-head small {
  font-size: 10.5px !important;
  line-height: 1.25 !important;
}
html:not(.portrait) body:has(#winChar.open) .zone-header {
  left: 326px !important;
  max-width: calc(100vw - 730px) !important;
}
/* Desktop #winChar: czysta siatka 2-rzędowa atrybutów — Max nigdy nie wychodzi poza ramkę */
html:not(.portrait) #winChar.open {
  width: 310px !important;
}
html:not(.portrait) #winChar .stat-row {
  display: grid !important;
  grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
  align-items: center !important;
  gap: 5px !important;
  padding: 7px 2px !important;
}
html:not(.portrait) #winChar .stat-row > :first-child {
  grid-column: 1 / 4 !important;
  min-width: 0 !important;
}
html:not(.portrait) #winChar .stat-row .v {
  grid-column: 4 / 5 !important;
  justify-self: end !important;
  font-weight: 700 !important;
}
html:not(.portrait) #winChar .stat-row button,
html:not(.portrait) #winChar .stat-row button.x10,
html:not(.portrait) #winChar .stat-row button.x100,
html:not(.portrait) #winChar .stat-row button.xmax {
  width: 100% !important;
  min-width: 0 !important;
  height: 26px !important;
  border-radius: 5px !important;
}
/* Desktop MU HUD: smukła pigułka AUTO czysto NAD miksturami Q/W (nie zasłania slotów E/R) */
html:not(.portrait) .muhud .autopot {
  left: 6px !important;
  top: -23px !important;
  width: 62px !important;
  height: 20px !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 4px !important;
  padding: 0 6px !important;
  background: linear-gradient(180deg, #1d1a14, #100e0a) !important;
  border: 1px solid rgba(214, 168, 90, 0.5) !important;
  border-radius: 5px 5px 0 0 !important;
  border-bottom: none !important;
  color: #f4d38b !important;
  font-size: 9.5px !important;
  font-weight: 700 !important;
  letter-spacing: 0.4px;
  text-transform: uppercase;
  box-shadow: 0 -2px 8px rgba(0, 0, 0, 0.65);
}
html:not(.portrait) .net-chat {
  bottom: calc(51px * var(--hud, 1.3) + 34px) !important;
}
/* Desktop buffy i pieczęcie (EXP ×2, Drop ×2, party buffy) — wyśrodkowane u góry pod paskiem strefy, zero kolizji z Drużyną i prawymi pigułkami */
html:not(.portrait) .hero-plate .buffs {
  position: fixed !important;
  top: 58px !important;
  left: 50% !important;
  transform: translateX(-50%) !important;
  z-index: 30 !important;
  margin: 0 !important;
  gap: 6px !important;
  flex-wrap: wrap !important;
  justify-content: center !important;
  max-width: calc(100vw - 560px) !important;
  pointer-events: auto !important;
}
html:not(.portrait) .hero-plate .buffs > div {
  width: 34px !important;
  height: 34px !important;
  border-radius: 6px !important;
  background: rgba(11, 13, 20, 0.88) !important;
}
html:not(.portrait) .hero-plate .buffs > div span {
  font-size: 10px !important;
  padding: 1px 4px !important;
}
html:not(.portrait) .zone-header .map-badge {
  position: static !important;
  transform: none !important;
  margin: 0 !important;
  flex: none !important;
  padding: 3px 8px !important;
  border-radius: 5px !important;
  background: rgba(212, 166, 87, 0.14) !important;
  border: 1px solid rgba(212, 166, 87, 0.35) !important;
  font-size: 11px !important;
  white-space: nowrap !important;
}
html:not(.portrait) .zone-header .spot-bar {
  position: static !important;
  transform: none !important;
  display: flex !important;
  flex-wrap: nowrap !important;
  overflow-x: auto !important;
  gap: 4px !important;
  scrollbar-width: none;
}
html:not(.portrait) .zone-header .spot-bar::-webkit-scrollbar { display: none; }
html:not(.portrait) .spot-pill {
  white-space: nowrap !important;
  flex: none !important;
  padding: 3px 8px !important;
  font-size: 11px !important;
  border-radius: 5px !important;
}

/* ---- Okna boczne: szerokość, zakładki bez ucinania, ostry przycisk × ---- */
html:not(.portrait) #winSide.open {
  width: min(560px, calc(100vw - 24px)) !important;
}
html:not(.portrait) #winSide.open:has(#tab-inv:not([hidden])),
html:not(.portrait) #winSide.open:has(#tab-vault:not([hidden])),
html:not(.portrait) #winSide.open:has(#tab-chaos:not([hidden])) {
  width: min(760px, calc(100vw - 24px)) !important;
}
html:not(.portrait) .win-close {
  position: absolute !important;
  top: 8px !important;
  right: 8px !important;
  float: none !important;
  margin: 0 !important;
  width: 28px !important;
  height: 28px !important;
  border-radius: 6px !important;
  border: 1px solid rgba(212, 166, 87, 0.38) !important;
  background: #141620 !important;
  color: #f4d38b !important;
  font: 700 18px/1 Inter, sans-serif !important;
  display: grid !important;
  place-items: center !important;
  cursor: pointer !important;
  z-index: 6 !important;
}
html:not(.portrait) .win-close:hover {
  background: rgba(212, 166, 87, 0.2) !important;
  border-color: #f4d38b !important;
}
html:not(.portrait) #winSide .tabs {
  margin-right: 36px !important;
}
html:not(.portrait) .win .tabs button {
  padding: 5px 2px !important;
  font-size: 10.5px !important;
  min-width: 0 !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
  white-space: nowrap !important;
}

/* ---- Umiejętności (.skill-row): brak zgniatania ikon i wylewania slotu 10 ---- */
.skill-row {
  flex-wrap: wrap !important;
  gap: 8px !important;
  padding: 10px !important;
  background: linear-gradient(180deg, rgba(22, 24, 33, 0.94), rgba(14, 15, 22, 0.96)) !important;
  border: 1px solid rgba(255, 255, 255, 0.08) !important;
  border-radius: 8px !important;
}
.skill-row img {
  flex: none !important;
  width: 40px !important;
  height: 40px !important;
  border: 1px solid rgba(212, 166, 87, 0.32);
  border-radius: 7px !important;
}
.skill-row .info {
  flex: 1 1 160px !important;
  min-width: 0 !important;
}
.skill-row .slots {
  width: 100% !important;
  display: grid !important;
  grid-template-columns: repeat(10, minmax(0, 1fr)) !important;
  gap: 4px !important;
  margin-top: 2px;
}
.skill-row .slots button {
  width: 100% !important;
  height: 26px !important;
  border-radius: 5px !important;
  background: #0c0e14 !important;
  border: 1px solid rgba(255, 255, 255, 0.1) !important;
  color: #b8b0a0 !important;
}
.skill-row .slots button.on {
  background: rgba(212, 166, 87, 0.22) !important;
  border-color: #d6a85a !important;
  color: #f4d38b !important;
}

/* ---- Menu Gry (#gameMenu) na Desktopie: 2-kolumnowa siatka zamiast uciętej kolumny ---- */
html:not(.portrait) .gamemenu {
  display: grid !important;
  grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  width: 340px !important;
  max-height: calc(100vh - 115px) !important;
  overflow-y: auto !important;
  padding: 10px !important;
  gap: 6px !important;
}
html:not(.portrait) .gamemenu[hidden] { display: none !important; }
html:not(.portrait) .gamemenu button {
  padding: 8px 10px !important;
  font-size: 12.5px !important;
  text-align: left !important;
  white-space: nowrap !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
}
html:not(.portrait) .gamemenu #mReset,
html:not(.portrait) .gamemenu #mLogout {
  background: rgba(229, 107, 95, 0.1) !important;
  border-color: rgba(229, 107, 95, 0.34) !important;
  color: #ffb6ae !important;
}
html:not(.portrait) .gamemenu #mLogout {
  grid-column: 1 / -1;
  text-align: center !important;
}
html:not(.portrait) .gamemenu #mReset:hover,
html:not(.portrait) .gamemenu #mLogout:hover {
  background: rgba(229, 107, 95, 0.22) !important;
  border-color: #e56b5f !important;
  color: #fff !important;
}

/* ---- Spójne pola tekstowe i selecty w całej grze ---- */
input[type="text"], input[type="number"], input[type="password"], select, textarea {
  background: #0a0b10;
  color: #efe5cf;
  border: 1px solid rgba(212, 166, 87, 0.24);
  border-radius: 6px;
  font-family: Inter, system-ui, sans-serif;
  transition: border-color .15s, box-shadow .15s;
}
input[type="text"]:focus, input[type="number"]:focus, input[type="password"]:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--ui-gold);
  box-shadow: 0 0 0 3px rgba(212, 166, 87, 0.14);
}

/* ---- Topbar (Desktop) ---- */
html:not(.portrait) .topbar {
  background: linear-gradient(180deg, rgba(17, 18, 25, 0.96), rgba(10, 11, 16, 0.96));
  border-bottom: 1px solid rgba(212, 166, 87, 0.26);
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.55);
}
html:not(.portrait) .topbar .logo {
  font-family: Cinzel, Georgia, serif;
  letter-spacing: 0.8px;
  text-shadow: 0 2px 10px rgba(212, 166, 87, 0.25);
}
html:not(.portrait) .topbar .icon-btn {
  display: inline-grid; place-items: center;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(212, 166, 87, 0.22);
  border-radius: 6px;
  color: #e4d8bf;
  transition: border-color .15s, background .15s, color .15s;
}
html:not(.portrait) .topbar .icon-btn:hover {
  border-color: var(--ui-gold);
  background: rgba(212, 166, 87, 0.14);
  color: var(--ui-gold2);
}

/* ---- Ekran wyboru i tworzenia postaci (#createScreen) ---- */
.create .cs-panel {
  background: linear-gradient(180deg, rgba(16, 17, 24, 0.92), rgba(10, 11, 16, 0.95)) !important;
  border: 1px solid rgba(212, 166, 87, 0.3) !important;
  border-radius: 10px !important;
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.72), inset 0 1px 0 rgba(255, 232, 175, 0.08) !important;
}
.create .cs-title, .create .cs-logo {
  font-family: Cinzel, Georgia, serif;
  letter-spacing: 0.6px;
}
.create .cs-card, .create .cs-slot {
  background: rgba(9, 10, 15, 0.82);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  transition: border-color .15s, background .15s, transform .12s;
}
.create .cs-card:hover, .create .cs-slot:hover {
  border-color: rgba(212, 166, 87, 0.45);
  background: rgba(24, 21, 17, 0.9);
}
.create .cs-card.active, .create .cs-slot.active {
  border-color: var(--ui-gold2);
  background: linear-gradient(180deg, rgba(212, 166, 87, 0.16), rgba(18, 16, 13, 0.94));
  box-shadow: 0 0 18px rgba(212, 166, 87, 0.22);
}

/* ---- Okno Postaci (#winChar) ---- */
#winChar .char-head {
  background: linear-gradient(180deg, rgba(24, 22, 19, 0.9), rgba(12, 13, 18, 0.92));
  border: 1px solid rgba(212, 166, 87, 0.22);
  border-radius: 8px;
  padding: 10px 12px;
}
#winChar .stats {
  background: rgba(9, 10, 15, 0.65);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 8px;
  padding: 10px 12px;
}
#winChar .stats-head {
  font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.7px; color: #b7ad9c;
  padding-bottom: 6px; margin-bottom: 4px; border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}
#winChar .stat-row {
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  padding: 5px 2px;
}
#winChar .stat-row:last-child { border-bottom: none; }
#winChar .derived {
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px;
}
#winChar .derived > div, #winChar .derived .d-row {
  background: rgba(9, 10, 15, 0.72);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 6px;
  padding: 6px 9px;
}
#btnRebirth {
  margin-top: 8px;
  background: linear-gradient(180deg, #b58439, #7c521b) !important;
  border: 1px solid #f0cb7f !important;
  color: #fff6dc !important;
  font-family: Cinzel, Georgia, serif;
  font-weight: 700;
  letter-spacing: 0.5px;
  box-shadow: 0 6px 20px rgba(212, 166, 87, 0.3), inset 0 1px 0 rgba(255, 245, 215, 0.35);
}

/* ---- Ekwipunek, Plecak, Skrzynia, Kocioł ---- */
.inv-subwin {
  background: rgba(10, 11, 16, 0.82);
  border: 1px solid rgba(212, 166, 87, 0.22);
  border-radius: 8px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.03);
}
.inv-subwin-title {
  font-family: Cinzel, Georgia, serif;
  font-size: 12.5px;
  letter-spacing: 0.5px;
  color: var(--ui-gold2);
  border-bottom: 1px solid rgba(212, 166, 87, 0.16);
  padding: 6px 8px;
  flex-wrap: wrap;
  gap: 6px;
  box-sizing: border-box;
  overflow: hidden;
}
html:not(.portrait) .bag-win .inv-subwin-title .inv-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  width: 100%;
}
html:not(.portrait) .bag-win .inv-subwin-title .inv-actions .btn {
  flex: 1 1 auto;
  padding: 4px 6px;
  font-size: 10.5px;
  line-height: 1.2;
  white-space: nowrap;
  text-align: center;
  min-width: 0;
}
.bag-grid, .vault-grid, .chaos-grid {
  background: #07080c;
  border: 1px solid rgba(212, 166, 87, 0.24);
  border-radius: 6px;
  box-shadow: inset 0 2px 10px rgba(0, 0, 0, 0.85);
}
.slot {
  background-color: rgba(15, 16, 22, 0.9);
  border-color: rgba(255, 255, 255, 0.07);
  transition: border-color .12s, background-color .12s;
}
.slot:hover {
  border-color: rgba(212, 166, 87, 0.55);
  background-color: rgba(28, 25, 20, 0.92);
}
#itemDetail {
  background: rgba(10, 11, 16, 0.88);
  border: 1px solid rgba(212, 166, 87, 0.24);
  border-radius: 8px;
}

/* ---- Karty: Skille, Sklep NPC, Mapy, Targ, Dziennik ---- */
.skill-card, .shop-item, .map-card, .mkt-card, .mkt-row, .chaos-recipe {
  background: linear-gradient(180deg, rgba(22, 24, 32, 0.92), rgba(14, 15, 21, 0.95));
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  transition: border-color .15s, transform .12s, background .15s;
}
.skill-card:hover, .shop-item:hover, .map-card:hover, .mkt-card:hover {
  border-color: rgba(212, 166, 87, 0.38);
}
.map-card.current, .skill-card.active {
  border-color: var(--ui-gold);
  background: linear-gradient(180deg, rgba(212, 166, 87, 0.14), rgba(15, 16, 22, 0.96));
}

/* ---- Tooltips (MU Item Tooltip) ---- */
.tooltip, #tooltip {
  background: linear-gradient(180deg, rgba(12, 13, 19, 0.97), rgba(7, 8, 12, 0.98)) !important;
  border: 1px solid rgba(212, 166, 87, 0.48) !important;
  border-radius: 8px !important;
  box-shadow: 0 16px 42px rgba(0, 0, 0, 0.85), inset 0 1px 0 rgba(255, 232, 175, 0.14) !important;
  padding: 10px 13px !important;
}

/* ---- Menu Gry (#gameMenu) ---- */
.gamemenu {
  background: linear-gradient(180deg, rgba(16, 17, 24, 0.96), rgba(10, 11, 16, 0.98)) !important;
  border: 1px solid rgba(212, 166, 87, 0.38) !important;
  border-radius: 10px !important;
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.82) !important;
  padding: 8px !important;
  gap: 5px !important;
}
.gamemenu button {
  border-radius: 6px !important;
  border: 1px solid rgba(255, 255, 255, 0.06) !important;
  background: rgba(255, 255, 255, 0.03) !important;
  color: #efe4cc !important;
  font-weight: 600 !important;
  transition: border-color .14s, background .14s, color .14s;
}
.gamemenu button:hover {
  border-color: rgba(212, 166, 87, 0.45) !important;
  background: rgba(212, 166, 87, 0.14) !important;
  color: var(--ui-gold2) !important;
}

/* ---- Społeczność, Zamek Krwi, Handel (.so) ---- */
.so header {
  background: linear-gradient(180deg, rgba(24, 22, 18, 0.95), rgba(14, 15, 21, 0.95));
  border-bottom: 1px solid rgba(212, 166, 87, 0.24);
}
.so header h3 {
  font-family: Cinzel, Georgia, serif;
  color: var(--ui-gold2);
  letter-spacing: 0.4px;
}
.so .so-tabs button {
  border-radius: 6px;
  font-weight: 600;
  transition: background .14s, color .14s, border-color .14s;
}
.so .so-tabs button.on {
  background: rgba(212, 166, 87, 0.18);
  border-color: rgba(212, 166, 87, 0.45);
  color: var(--ui-gold2);
}

/* ---- Pigułki wydarzeń (#bcPill, #invPill) — kompaktowe, nie zasłaniają areny ---- */
#bcPill, #invPill {
  display: inline-flex; align-items: center; gap: 4px;
  min-height: 26px !important;
  padding: 3px 9px !important;
  font-size: 11px !important;
  line-height: 1.2 !important;
  font-weight: 600; letter-spacing: 0.15px;
  border-radius: 5px !important;
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.5) !important;
  opacity: 0.9;
  transition: opacity .14s, filter .14s;
}
#bcPill:hover, #invPill:hover { opacity: 1; filter: brightness(1.12); }
#invPill { background: rgba(24, 18, 8, 0.85) !important; border-color: rgba(217, 164, 65, 0.65) !important; }
#invPill svg { width: 12px; height: 12px; margin-right: 2px !important; }
html:not(.portrait) #bcPill { top: 48px !important; right: 12px !important; }
html:not(.portrait) .inv-pill { top: 80px !important; right: 12px !important; }
html.portrait #bcPill { top: calc(var(--m-top) + 46px) !important; right: 8px !important; min-height: 24px !important; padding: 2px 8px !important; font-size: 10.5px !important; }
html.portrait .inv-pill { top: calc(var(--m-top) + 74px) !important; right: 8px !important; min-height: 24px !important; padding: 2px 8px !important; font-size: 10.5px !important; }
html.portrait.mwin-open #bcPill,
html.portrait.mwin-open .inv-pill,
html.portrait.mchat-open #bcPill,
html.portrait.mchat-open .inv-pill,
html.portrait.social-open #bcPill,
html.portrait.social-open .inv-pill,
html.portrait.trade-open #bcPill,
html.portrait.trade-open .inv-pill {
  display: none !important;
}

/* ---- Mobile Portrait Polish ---- */
html.portrait .panel.win.open {
  background: linear-gradient(180deg, #111219, #0a0b10) !important;
}
html.portrait #mnav button.on {
  color: var(--ui-gold2);
  box-shadow: inset 0 2px 0 var(--ui-gold);
  background: linear-gradient(180deg, rgba(212, 166, 87, 0.14), transparent);
}
html.portrait .so {
  background: #0e1017 !important;
  border: 1px solid rgba(212, 166, 87, 0.34) !important;
  border-radius: 12px !important;
}
/* Globalny pasek pod-zakładek (Plecak | Wyposażenie | Kocioł | Skrzynia) na mobile */
html.portrait #tab-inv .mob-inv-tabs { display: none !important; }
html.portrait #mobInvBar { display: none; }
html.portrait #winSide:has(#tab-inv:not([hidden]), #tab-chaos:not([hidden]), #tab-vault:not([hidden])) #mobInvBar {
  display: grid;
  margin-top: 4px;
}
/* Postać (mobile): przycisk × nie nakłada się na Max, a opisy atrybutów mają pełną szerokość */
html.portrait #winChar .win-close {
  position: absolute !important;
  top: 10px !important;
  right: 10px !important;
  float: none !important;
}
html.portrait #winChar .stat-row {
  display: grid !important;
  grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
  align-items: center !important;
  gap: 6px !important;
  padding: 10px 6px !important;
}
html.portrait #winChar .stat-row > :first-child {
  grid-column: 1 / 4 !important;
  min-width: 0 !important;
}
html.portrait #winChar .stat-row .v {
  grid-column: 4 / 5 !important;
  justify-self: end !important;
  font-size: 16px !important;
  font-weight: 700 !important;
  margin: 0 !important;
}
html.portrait #winChar .stat-row button,
html.portrait #winChar .stat-row button.x10,
html.portrait #winChar .stat-row button.x100,
html.portrait #winChar .stat-row button.xmax {
  width: 100% !important;
  min-width: 0 !important;
  height: 36px !important;
  border-radius: 9px !important;
}
/* Czytelne etykiety buffów nad areną */
html.portrait .buffs {
  background: rgba(10, 11, 16, 0.72);
  border-radius: 7px;
  padding: 2px 5px;
}
html.portrait .buffs:empty { display: none; }
/* Menu ☰ na mobile: kompaktowa 2-kolumnowa siatka mieszcząca się bez scrollowania pod dolny pasek */
html.portrait .gamemenu {
  display: grid !important;
  grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  width: calc(100vw - 16px) !important;
  left: 8px !important;
  right: 8px !important;
  gap: 6px !important;
  padding: 10px !important;
  max-height: calc(100vh - var(--m-top) - var(--m-nav) - 16px) !important;
  overflow-y: auto !important;
}
html.portrait .gamemenu[hidden] { display: none !important; }
html.portrait .gamemenu button {
  padding: 9px 10px !important;
  font-size: 12.5px !important;
  min-height: 40px !important;
}
html.portrait .gamemenu #mReset,
html.portrait .gamemenu #mLogout {
  background: rgba(229, 107, 95, 0.12) !important;
  border-color: rgba(229, 107, 95, 0.35) !important;
  color: #ffb6ae !important;
}

/* ============================================================================
   APPLE-INSPIRED DARK-FANTASY MU MOBILE REVOLUTION (html.portrait)
   Floating iOS HUD + Floating Dock + Spring Sheets + Real MU Game Assets
   (Zero backdrop-filter blur -> 60fps on iPhone!)
   ============================================================================ */
@keyframes iosSheetUp {
  from { opacity: 0; transform: translateY(22px); }
  to   { opacity: 1; transform: translateY(0); }
}

html.portrait {
  --m-top: calc(92px + env(safe-area-inset-top));
  --m-nav: calc(74px + env(safe-area-inset-bottom));
}

/* ---- 1. Floating iOS Hero HUD Card (#mtop) ---- */
html.portrait #mtop {
  position: fixed !important;
  top: calc(6px + env(safe-area-inset-top)) !important;
  left: 8px !important;
  right: 8px !important;
  height: auto !important;
  padding: 8px 10px 7px !important;
  border-radius: 18px !important;
  background: linear-gradient(180deg, rgba(24, 26, 36, 0.94), rgba(12, 13, 19, 0.96)) !important;
  border: 1px solid rgba(214, 168, 90, 0.34) !important;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.65), inset 0 1px 0 rgba(255, 238, 196, 0.14) !important;
}
html.portrait .mt-row {
  height: auto !important;
  padding: 0 !important;
  gap: 9px !important;
  align-items: center !important;
}
html.portrait .mt-menu {
  width: 36px !important; height: 36px !important; margin: 0 !important;
  border-radius: 11px !important;
  background: rgba(255, 255, 255, 0.05) !important;
  border: 1px solid rgba(255, 255, 255, 0.08) !important;
  color: #f0e3c6 !important;
  display: grid !important; place-items: center !important;
  transition: transform .1s, background .14s;
}
html.portrait .mt-menu:active { transform: scale(0.93); background: rgba(214, 168, 90, 0.18) !important; }
html.portrait .mt-face {
  width: 38px !important; height: 38px !important;
  border-radius: 12px !important;
  border: 1.5px solid #d6a85a !important;
  box-shadow: 0 0 12px rgba(214, 168, 90, 0.28) !important;
  background: #090a0f;
}
html.portrait .mt-who b {
  font-family: Inter, -apple-system, sans-serif !important;
  font-size: 14.5px !important; font-weight: 700 !important;
  letter-spacing: -0.2px; color: #f6eedc !important;
}
html.portrait .mt-who small {
  font-size: 11px !important; color: #9c9484 !important;
}
html.portrait .mt-cur {
  gap: 5px !important;
}
html.portrait .mt-cur > div {
  padding: 3px 8px 3px 5px !important;
  border-radius: 999px !important;
  background: rgba(7, 8, 13, 0.85) !important;
  border: 1px solid rgba(255, 255, 255, 0.08) !important;
  gap: 4px !important;
}
html.portrait .mt-cur img { width: 15px !important; height: 15px !important; }
html.portrait .mt-cur b { font-size: 11.5px !important; color: #f4d38b !important; }

html.portrait .mt-vit {
  height: auto !important;
  margin-top: 7px !important;
  padding-top: 6px !important;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  gap: 6px !important;
}
html.portrait .mt-vit > span { font-size: 10px !important; font-weight: 700; color: #8c8475 !important; letter-spacing: 0.4px; }
html.portrait .mt-bar {
  height: 13px !important;
  border-radius: 999px !important;
  background: #07080d !important;
  border: 1px solid rgba(255, 255, 255, 0.08) !important;
  overflow: hidden;
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.8);
}
html.portrait .mt-bar.hp i {
  background: linear-gradient(180deg, #ef5350, #a71d1a) !important;
  box-shadow: inset 0 1px 0 rgba(255, 210, 210, 0.4);
}
html.portrait .mt-bar.mp i {
  background: linear-gradient(180deg, #4299ff, #1746a2) !important;
  box-shadow: inset 0 1px 0 rgba(210, 232, 255, 0.4);
}
html.portrait .mt-bar em {
  font-size: 9.5px !important; line-height: 13px !important; font-weight: 700 !important;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.9);
}

/* ---- 2. Floating Apple-Style Bottom Dock (#mnav) ---- */
html.portrait #mnav {
  left: 10px !important;
  right: 10px !important;
  bottom: calc(8px + env(safe-area-inset-bottom)) !important;
  height: 60px !important;
  padding: 4px 5px !important;
  border-radius: 22px !important;
  background: linear-gradient(180deg, rgba(23, 25, 34, 0.96), rgba(11, 12, 18, 0.98)) !important;
  border: 1px solid rgba(214, 168, 90, 0.34) !important;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.82), inset 0 1px 0 rgba(255, 240, 200, 0.14) !important;
  gap: 3px;
}
html.portrait #mnav button {
  border-radius: 16px !important;
  padding: 4px 2px !important;
  gap: 2px !important;
  transition: transform .12s, background .16s, color .16s;
}
html.portrait #mnav button:active { transform: scale(0.92); }
html.portrait #mnav button img {
  width: 26px !important; height: 26px !important;
  object-fit: contain;
  border-radius: 7px;
  transition: transform .16s;
}
html.portrait #mnav button.on {
  background: linear-gradient(180deg, rgba(214, 168, 90, 0.24), rgba(214, 168, 90, 0.06)) !important;
  box-shadow: inset 0 1px 0 rgba(255, 232, 175, 0.28), 0 2px 10px rgba(214, 168, 90, 0.15) !important;
  color: #f6d992 !important;
}
html.portrait #mnav button.on::before { display: none !important; }
html.portrait #mnav button.on img { transform: translateY(-1px) scale(1.06); }
html.portrait #mnav button span { font-size: 10.5px !important; font-weight: 600 !important; }

/* ---- 3. Floating Chat Capsule (#mchat) ---- */
html.portrait #mchat {
  left: 10px !important; right: 10px !important;
  bottom: calc(var(--m-nav) + 6px) !important;
  height: 38px !important;
  border-radius: 14px !important;
  background: rgba(15, 17, 24, 0.92) !important;
  border: 1px solid rgba(214, 168, 90, 0.24) !important;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.55) !important;
  padding: 0 12px !important;
}
html.portrait #mchat .mc-ico { display: inline-flex; color: #d6a85a !important; }
html.portrait #mchat .mc-on {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 2px 8px !important; border-left: none !important;
  border-radius: 999px; background: rgba(88, 201, 138, 0.12);
  color: #7ee2aa !important; font-size: 11px !important; font-weight: 700;
}
html.portrait #mchat .mc-dot {
  width: 6px; height: 6px; border-radius: 50%; background: #58c98a;
  box-shadow: 0 0 6px #58c98a; display: inline-block;
}
html.portrait #mchat .mc-up { display: inline-flex; color: #8c8475 !important; }

/* ---- 4. Combat Skill & Potion Capsule (.muhud on Arena) — matematycznie dopasowane bez ucinania ---- */
html.portrait .muhud {
  left: 10px !important;
  right: 10px !important;
  bottom: calc(var(--m-nav) + 50px) !important;
  transform: none !important;
  width: auto !important;
  max-width: none !important;
  margin: 0 !important;
  padding: 6px 8px !important;
  gap: 5px !important;
  box-sizing: border-box !important;
  border-radius: 18px !important;
  background: linear-gradient(180deg, rgba(20, 22, 31, 0.94), rgba(11, 12, 18, 0.97)) !important;
  border: 1px solid rgba(214, 168, 90, 0.3) !important;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.72), inset 0 1px 0 rgba(255, 240, 200, 0.1) !important;
}
html.portrait .muhud .skillbar {
  flex: 1 1 0 !important;
  min-width: 0 !important;
  overflow-x: auto !important;
  -webkit-overflow-scrolling: touch !important;
  touch-action: pan-x !important;
  scrollbar-width: none;
  gap: 5px !important;
  padding: 2px 0 !important;
}
html.portrait .muhud .skillbar::-webkit-scrollbar { display: none; }
html.portrait .muhud .skill {
  flex: 0 0 38px !important;
  width: 38px !important;
  height: 38px !important;
  border-radius: 11px !important;
  border: 1.5px solid rgba(214, 168, 90, 0.42) !important;
  box-shadow: none !important;
  overflow: hidden !important;
  touch-action: pan-x !important;
}
html.portrait .muhud .skill.active-skill {
  border-color: #f4d38b !important;
  box-shadow: 0 0 10px rgba(244, 211, 139, 0.45) !important;
}
html.portrait .muhud .skill .swap { display: none !important; }
html.portrait .muhud .pot {
  flex: none !important;
  width: 40px !important;
  height: 40px !important;
  padding: 3px !important;
  clip-path: none !important;
  box-shadow: none !important;
  border-radius: 11px !important;
  border: 1.5px solid rgba(255, 255, 255, 0.14) !important;
  background: #0b0c12 !important;
}
html.portrait .muhud .pot img {
  width: 24px !important; height: 24px !important;
  margin: 0 auto !important; display: block !important; opacity: 0.95 !important;
}
html.portrait .muhud .pot b {
  position: absolute !important; top: auto !important; bottom: 1px !important; left: 0 !important; right: 0 !important;
  display: block !important; text-align: center !important;
  font: 700 9.5px/1 Inter, -apple-system, sans-serif !important;
  color: #fff !important; text-shadow: 0 1px 2px #000, 0 0 3px #000 !important;
}
html.portrait .muhud .autopot {
  flex: none !important;
  width: 40px !important;
  height: 40px !important;
  border-radius: 11px !important;
  border: 1.5px solid rgba(255, 255, 255, 0.14) !important;
  background: #0b0c12 !important;
  font: 700 9.5px/1 Inter, -apple-system, sans-serif !important;
}
html.portrait .muhud .autopot:has(input:checked) {
  border-color: #d6a85a !important;
  background: rgba(214, 168, 90, 0.18) !important;
  color: #f6d992 !important;
}
html.portrait .muhud .ms-btn {
  flex: none !important;
  width: 42px !important;
  height: 40px !important;
  border-radius: 11px !important;
  background: #0b0c12 !important;
  border: 1.5px solid rgba(214, 168, 90, 0.34) !important;
  padding: 3px 2px !important;
  gap: 1px !important;
}
html.portrait .muhud .ms-btn img { width: 18px !important; height: 18px !important; object-fit: contain; }
html.portrait .muhud .ms-btn small { font-size: 8.5px !important; }

/* ---- 5. iOS Sheet Full-Screen Windows (.win.open, .so) ---- */
html.portrait .win.open,
html.portrait .panel.side.win.wide-inv.open,
html.portrait .panel.side.win.open,
html.portrait .panel.char.win.open {
  top: calc(var(--m-top) + 4px) !important;
  bottom: calc(var(--m-nav) + 6px) !important;
  left: 6px !important;
  right: 6px !important;
  max-height: none !important;
  overflow-y: auto !important;
  overflow-x: hidden !important;
  -webkit-overflow-scrolling: touch !important;
  overscroll-behavior: contain !important;
  touch-action: pan-y !important;
  border-radius: 22px !important;
  border: 1px solid rgba(214, 168, 90, 0.32) !important;
  background: linear-gradient(180deg, #13151e, #0b0c11) !important;
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.88), inset 0 1px 0 rgba(255, 240, 200, 0.12) !important;
  padding: 18px 12px 24px !important;
  scrollbar-width: none !important;
  animation: iosSheetUp 0.22s cubic-bezier(0.22, 1, 0.36, 1);
}
html.portrait .win.open::-webkit-scrollbar { display: none !important; }
html.portrait .win.open::before {
  content: "";
  display: block;
  width: 38px; height: 4px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.18);
  margin: -8px auto 10px;
}
html.portrait .win-close {
  width: 32px !important; height: 32px !important;
  border-radius: 50% !important;
  background: rgba(255, 255, 255, 0.08) !important;
  border: 1px solid rgba(255, 255, 255, 0.12) !important;
  color: #efe4cc !important;
  font-size: 18px !important;
  display: grid !important; place-items: center !important;
}

/* ---- 6. Apple Segmented Control (#mobInvBar) & 1-Row Inventory Toolbar ---- */
html.portrait #mobInvBar {
  padding: 3px !important;
  gap: 3px !important;
  border-radius: 13px !important;
  background: #08090e !important;
  border: 1px solid rgba(255, 255, 255, 0.08) !important;
  margin-bottom: 12px !important;
}
html.portrait #mobInvBar button {
  min-height: 36px !important;
  border-radius: 10px !important;
  border: 1px solid transparent !important;
  background: transparent !important;
  color: #968e7e !important;
  font: 600 12px/1 Inter, -apple-system, sans-serif !important;
  transition: all .15s;
}
html.portrait #mobInvBar button.on {
  background: linear-gradient(180deg, rgba(214, 168, 90, 0.26), rgba(140, 96, 32, 0.28)) !important;
  border-color: rgba(214, 168, 90, 0.48) !important;
  color: #fae09c !important;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4) !important;
}

/* Grouped iOS Inset Cards */
html.portrait .inv-subwin,
html.portrait .chaos-panel,
html.portrait .vault-detail-panel,
html.portrait .evo-box,
html.portrait .skill-row,
html.portrait .map-card,
html.portrait .char-head,
html.portrait .stats,
html.portrait .derived,
html.portrait #tab-market .mk-row {
  background: linear-gradient(180deg, #181a24, #11131b) !important;
  border: 1px solid rgba(255, 255, 255, 0.08) !important;
  border-radius: 16px !important;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04) !important;
}
html.portrait .inv-actions {
  display: grid !important;
  grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  gap: 6px !important;
}
html.portrait .inv-actions .btn {
  padding: 6px 8px !important;
  font-size: 12px !important;
  min-height: 36px !important;
  border-radius: 10px !important;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
html.portrait .inv-pages {
  padding: 3px; border-radius: 11px; background: #08090e; border: 1px solid rgba(255, 255, 255, 0.07);
}
html.portrait .inv-pages button {
  min-height: 34px !important; border-radius: 8px !important; border: none !important;
  background: transparent !important; font-family: Cinzel, serif !important;
}
html.portrait .inv-pages button.on,
html.portrait .inv-pages button.active {
  background: rgba(214, 168, 90, 0.2) !important;
  color: #f6d992 !important;
  box-shadow: inset 0 0 0 1px rgba(214, 168, 90, 0.45) !important;
}
html.portrait .inv-grid {
  border-radius: 12px !important;
  overflow: hidden;
  border: 1px solid rgba(214, 168, 90, 0.25) !important;
}
/* Gwarantowana wysokość komórek siatki na iOS Safari (szczególnie #shopGrid z 14-18 wierszami) */
.shop-grid .inv-cell { aspect-ratio: 1; min-height: 28px; }
.shop-grid .slot .it-img { inset: 2px; }

/* iOS Modal Bottom Sheet for Item Actions (#itemDetail) */
html.portrait #itemDetail:has(.it-actions) {
  left: 8px !important; right: 8px !important;
  bottom: calc(var(--m-nav) + 8px) !important;
  border-radius: 22px !important;
  padding: 16px 15px 14px !important;
  background: linear-gradient(180deg, #191b26, #0f1017) !important;
  border: 1px solid rgba(214, 168, 90, 0.45) !important;
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.9) !important;
  animation: iosSheetUp 0.2s cubic-bezier(0.22, 1, 0.36, 1);
}
html.portrait #itemDetail:has(.it-actions)::before {
  content: ""; display: block; width: 36px; height: 4px; border-radius: 999px;
  background: rgba(255, 255, 255, 0.2); margin: -6px auto 12px;
}
html.portrait #itemDetail .it-actions .btn {
  border-radius: 12px !important; min-height: 42px !important; font-weight: 600 !important;
}

/* ---- 7. Apple Control-Center Visual Menu Sheet (#gameMenu) ---- */
html.portrait .gamemenu {
  top: calc(var(--m-top) + 6px) !important;
  bottom: auto !important;
  left: 8px !important; right: 8px !important;
  width: auto !important;
  border-radius: 22px !important;
  background: linear-gradient(180deg, #181a24, #0e1017) !important;
  border: 1px solid rgba(214, 168, 90, 0.38) !important;
  box-shadow: 0 20px 54px rgba(0, 0, 0, 0.88), inset 0 1px 0 rgba(255, 240, 200, 0.12) !important;
  padding: 12px !important;
  gap: 7px !important;
  animation: iosSheetUp 0.2s cubic-bezier(0.22, 1, 0.36, 1);
}
html.portrait .gamemenu button {
  border-radius: 13px !important;
  background: rgba(255, 255, 255, 0.04) !important;
  border: 1px solid rgba(255, 255, 255, 0.07) !important;
  padding: 10px 10px !important;
  gap: 9px !important;
  min-height: 46px !important;
  font: 600 13px/1.15 Inter, -apple-system, sans-serif !important;
  color: #f0e6d2 !important;
  transition: transform .1s, background .14s, border-color .14s;
}
html.portrait .gamemenu button:active { transform: scale(0.96); background: rgba(214, 168, 90, 0.16) !important; border-color: rgba(214, 168, 90, 0.45) !important; }
html.portrait .gamemenu button::before { width: 24px !important; height: 24px !important; filter: none !important; opacity: 1 !important; }

/* iPhone / mobile GPU: wyłącz ciężkie podwójne filter: drop-shadow i ciągłe mask-image sweep na dziesiątkach ikon (zachowując żywe kolory i poświatę) */
@media (pointer: coarse) {
  .item-img,
  .it-u7 .item-img, .it-u9 .item-img, .it-u11 .item-img, .it-u13 .item-img,
  .it-exc .item-img, .it-exc.it-u9 .item-img, .it-exc.it-u11 .item-img {
    filter: brightness(1.16) saturate(1.25) !important;
  }
  .it-sweep, .it-sheen::after {
    display: none !important;
    animation: none !important;
  }
}
html.portrait .gamemenu #mItemShop::before { background-image: url(../assets/ui/gift_8.png) !important; }
html.portrait .gamemenu #mStats::before { background-image: url(../assets/ui/ch_6.png) !important; }
html.portrait .gamemenu #mFull, html.portrait .gamemenu #mSound, html.portrait .gamemenu #mMusic { margin-top: 0 !important; border-top: 1px solid rgba(255, 255, 255, 0.07) !important; }
html.portrait .gamemenu #mReset { margin-top: 0 !important; }

/* ---- 8. Społeczność & Sklep Specjalny (iOS Modal Sheet) ---- */
.so-wrap[hidden] { display: none !important; }
html.portrait .so-wrap:not([hidden]):not(.so-card-wrap) {
  display: flex !important;
  flex-direction: column !important;
  overflow: hidden !important;
}
html.portrait .so-wrap:not(.so-card-wrap) .so {
  flex: 1 1 0 !important;
  min-height: 0 !important;
  max-height: 100% !important;
  height: 100% !important;
  overflow: hidden !important;
  display: flex !important;
  flex-direction: column !important;
}
html.portrait .so .so-body,
html.portrait .so .so-msgs,
html.portrait .so-card,
html.portrait .tr-cols {
  overflow-y: auto !important;
  -webkit-overflow-scrolling: touch !important;
  overscroll-behavior: contain;
  touch-action: pan-y !important;
  min-height: 0 !important;
}
html.portrait .so {
  border-radius: 22px !important;
  border: 1px solid rgba(214, 168, 90, 0.38) !important;
  background: linear-gradient(180deg, #151722, #0c0d14) !important;
  animation: iosSheetUp 0.22s cubic-bezier(0.22, 1, 0.36, 1);
}
html.portrait .so .so-x {
  width: 32px; height: 32px; border-radius: 50%;
  background: rgba(255, 255, 255, 0.08); display: grid; place-items: center;
}
html.portrait .so .so-row input { border-radius: 10px !important; }
html.portrait .so .so-row .btn { border-radius: 10px !important; }

/* Dyskretna kropka stanu sieci/zapisu + banner rozłączenia z przyciskiem */
.net-dot {
  position: fixed; top: 8px; right: 8px; z-index: 90;
  width: 10px; height: 10px; padding: 0; border-radius: 50%; border: 1px solid rgba(0, 0, 0, 0.65);
  background: #4cd97b; box-shadow: 0 0 8px rgba(76, 217, 123, 0.7); cursor: pointer;
}
.net-dot.save { background: #f3c969; box-shadow: 0 0 8px rgba(243, 201, 105, 0.8); }
.net-dot.off { background: #ff574d; box-shadow: 0 0 10px rgba(255, 87, 77, 0.9); animation: pulseDot 1.2s ease-in-out infinite; }
@keyframes pulseDot { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.35); } }
html.portrait .net-dot { top: calc(env(safe-area-inset-top, 0px) + 6px); right: 8px; z-index: 55; }
.net-banner { display: flex; align-items: center; justify-content: center; gap: 10px; flex-wrap: wrap; }

/* Klasyczna paleta cyfr obrażeń (Krytyk błękitny, Excellent zielony, Ignore Def cyjan, Combo złote, Odbicie fioletowe) */
.dmg.crit { color: #5fd4ff !important; font-weight: 800; text-shadow: 0 2px 4px #000, 0 0 10px rgba(95, 212, 255, 0.7); }
.dmg.exc { color: #4cff88 !important; font-size: 1.22em !important; font-weight: 900; text-shadow: 0 2px 5px #000, 0 0 14px rgba(76, 255, 136, 0.85); }
.dmg.ignore { color: #38f6ff !important; font-size: 1.26em !important; font-weight: 900; font-style: italic; text-shadow: 0 2px 6px #000, 0 0 16px rgba(56, 246, 255, 0.95); }
.dmg.combo { color: #ffd84d !important; font-size: 1.32em !important; font-weight: 900; text-shadow: 0 2px 6px #000, 0 0 18px rgba(255, 216, 77, 0.95); }
.dmg.reflect { color: #d58aff !important; font-weight: 700; text-shadow: 0 1px 4px #000, 0 0 8px rgba(213, 138, 255, 0.6); }
.dmg.poison { color: #7ae858 !important; font-weight: 700; text-shadow: 0 1px 4px #000; }

/* Animacja kucia w Kotle Chaosu */
.chaos-win.forging .chaos-grid {
  animation: chaosPulse 0.3s ease-in-out infinite alternate;
  box-shadow: 0 0 24px rgba(255, 196, 65, 0.75) !important;
}
.chaos-win.forge-ok .chaos-grid { box-shadow: 0 0 28px rgba(88, 201, 138, 0.9) !important; }
.chaos-win.forge-fail .chaos-grid { box-shadow: 0 0 28px rgba(229, 107, 95, 0.9) !important; }
@keyframes chaosPulse { from { filter: brightness(1); } to { filter: brightness(1.38); } }
