/* =====================================================================================================
   MuIdle — telefon trzymany pionowo (html.portrait, ustawiane w main.js). Układ jak w grach idle na telefon
   (np. M2Clicker): nagłówek postaci (PŻ / PE + 4 kulki doświadczenia) · scena walki na cały ekran ·
   pływający pasek skrótów · belka czatu · dolne menu z 7 zakładkami · menu boczne (☰).
   Okna = pełne ekrany między nagłówkiem a dolnym menu, karty z ciemnego brązu ze złotymi narożnikami.
   ===================================================================================================== */
html.portrait {
  --m-bg: #0c0c0a; --m-screen: #11110e; --m-card: #1b1915; --m-pop: #191713; --m-field: #0e0e0c; --m-field2: #080807;
  --m-line: #463b2e; --m-line2: #584733; --m-sec: #30291f;
  --m-gold: #d1a35f; --m-gold2: #ecc78a; --m-gold3: #f0d39b; --m-parch: #eadcbb; --m-sub: #b5a68c; --m-mute: #a09581; --m-red: #e08b77;
  --m-hp: #b34b3b; --m-mp: #4b87a5; --m-exp: #b69448;
  --m-serif: "Palatino Linotype", "Book Antiqua", Palatino, Georgia, serif;
  --m-sans: "Trebuchet MS", "Segoe UI", system-ui, sans-serif;
  --m-mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --m-top: calc(88px + env(safe-area-inset-top)); --m-nav: calc(58px + env(safe-area-inset-bottom)); --m-chat: 42px;
  /* złote narożniki (lewy górny i prawy dolny) — tło karty */
  --m-corners: linear-gradient(var(--m-gold), var(--m-gold)) left top / 14px 2px no-repeat, linear-gradient(var(--m-gold), var(--m-gold)) left top / 2px 14px no-repeat,
    linear-gradient(var(--m-gold), var(--m-gold)) right bottom / 14px 2px no-repeat, linear-gradient(var(--m-gold), var(--m-gold)) right bottom / 2px 14px no-repeat;
}
html.portrait, html.portrait body { background: var(--m-bg); }
html.portrait body { font: 14px var(--m-sans); color: var(--m-parch); }
html.portrait .rotate-hint, html.portrait .dock, html.portrait .topbar, html.portrait .mon-plate, html.portrait .zone-header .map-badge,
html.portrait .battle-col .expedition, html.portrait .msgbox, html.portrait .muhud .hb, html.portrait .muhud .mubt, html.portrait .muhud .activeskill,
html.portrait .muhud .orb, html.portrait .muhud .expbar, html.portrait .win .tabs { display: none !important; }

/* ---------- nagłówek postaci ---------- */
#mtop, #mnav, #mchat, #mdrawerBg { display: none; }
html.portrait #mtop { display: block; position: fixed; inset: 0 0 auto 0; height: var(--m-top); z-index: 40; box-sizing: border-box; padding: env(safe-area-inset-top) 12px 0;
  background: linear-gradient(#17150f, #0e0d0a); border-bottom: 1px solid var(--m-line); box-shadow: 0 4px 14px #000a; }
html.portrait .mt-row { display: flex; align-items: center; gap: 10px; height: 56px; }
html.portrait .mt-menu { flex: none; width: 34px; height: 40px; border: none; background: none; color: var(--m-gold); font: 400 24px/1 var(--m-sans); padding: 0; }
html.portrait .mt-face { flex: none; width: 40px; height: 40px; box-sizing: border-box; padding: 2px; border: 1px solid var(--m-gold); border-radius: 2px; background: #000;
  box-shadow: inset 0 0 0 1px #000, 0 0 0 1px #000; object-fit: cover; }
html.portrait .mt-who { flex: 1; min-width: 0; line-height: 1.15; }
html.portrait .mt-who b { display: block; font: 700 18px var(--m-serif); color: var(--m-parch); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
html.portrait .mt-who small { display: block; font: 12px var(--m-sans); color: var(--m-mute); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
html.portrait .mt-cur { flex: none; display: grid; gap: 2px; justify-items: end; }
html.portrait .mt-cur div { display: flex; align-items: center; gap: 5px; font: 700 13px var(--m-sans); color: var(--m-gold3); }
html.portrait .mt-cur div + div { font-size: 12px; color: var(--m-sub); }
html.portrait .mt-cur img { width: 17px; height: 17px; }
html.portrait .mt-cur small { font-size: 10px; color: var(--m-mute); font-weight: 600; }
html.portrait .mt-vit { display: flex; align-items: center; gap: 6px; height: 28px; font: 700 11px var(--m-sans); color: var(--m-sub); }
html.portrait .mt-vit > span { flex: none; }
html.portrait .mt-bar { position: relative; flex: 1; height: 9px; background: var(--m-field); border: 1px solid var(--m-field2); box-shadow: 0 0 0 1px #2c251c; overflow: hidden; }
html.portrait .mt-bar i { position: absolute; inset: 0 auto 0 0; width: 0; transition: width .2s; }
html.portrait .mt-bar.hp i { background: linear-gradient(#d0604e, var(--m-hp) 55%, #7a2b20); }
html.portrait .mt-bar.mp i { background: linear-gradient(#6aa6c4, var(--m-mp) 55%, #2b5468); }
html.portrait .mt-bar em { position: absolute; inset: 0; font: 700 8px/9px var(--m-sans); font-style: normal; text-align: center; color: #fff; text-shadow: 0 0 2px #000, 0 0 2px #000; }
html.portrait .mt-exp { flex: none; display: flex; gap: 3px; margin-left: 4px; }
html.portrait .mt-exp i { position: relative; width: 13px; height: 13px; border-radius: 50%; background: var(--m-field); box-shadow: 0 0 0 1px #5a4a30, inset 0 1px 3px #000; overflow: hidden; }
html.portrait .mt-exp i::after { content: ''; position: absolute; left: 0; right: 0; bottom: 0; height: var(--f, 0%); background: radial-gradient(circle at 40% 30%, #f6dc95, var(--m-exp) 60%, #7c5e22); }

/* ---------- scena walki na cały ekran ---------- */
html.portrait .layout { top: var(--m-top) !important; bottom: var(--m-nav) !important; }
html.portrait .battle-col .battle { inset: 0 !important; height: auto !important; border: none; }
/* buffy w lewym górnym rogu z czasem m:ss */
html.portrait .hero-plate { top: 8px !important; left: 8px !important; right: auto; width: auto; background: none; border: none; box-shadow: none; padding: 0; }
html.portrait .buffs { gap: 6px; margin: 0; }
html.portrait .buffs div { width: 36px; height: 36px; border: 1px solid #8a6b3a; border-radius: 3px; background: var(--m-field); box-shadow: 0 2px 6px #000a; }
html.portrait .buffs img { border-radius: 2px; }
html.portrait .buffs span { left: 0; right: 0; bottom: -1px; text-align: center; border-radius: 0 0 2px 2px; background: #000c; font: 700 9.5px/13px var(--m-sans); color: #fff; padding: 0; }
html.portrait .party-frame { top: 54px; left: 8px; width: 140px; gap: 4px; font: 600 11.5px var(--m-sans); }
html.portrait .party-frame .pf-head { padding: 3px 8px; font: 700 12px var(--m-serif); background: #15130fe0; border-color: var(--m-line); }
html.portrait .party-frame .pf-head small, html.portrait .party-frame .pf-map, html.portrait .party-frame .pf-add { display: none; }
html.portrait .party-frame .pf-m { padding: 4px 8px; border-radius: 2px; background: #15130fcc; border-color: var(--m-line); }
/* bieżący spot = przycisk w prawym górnym rogu (dotknięcie otwiera Lokacje) */
html.portrait .zone-header { left: auto !important; right: 8px; top: 8px; transform: none !important; max-width: 58vw; align-items: flex-end; }
html.portrait .spot-bar { flex-wrap: nowrap; justify-content: flex-end; }
html.portrait .spot-pill:not(.active) { display: none; }
html.portrait .spot-pill.active { min-height: 38px; padding: 4px 12px; gap: 8px; border-radius: 2px; border: 1px solid var(--m-line); background: #15130fe6; color: var(--m-parch);
  font: 600 13px var(--m-sans); box-shadow: 0 2px 8px #000a; cursor: pointer; max-width: 58vw; }
html.portrait .spot-pill.active::before { content: ''; flex: none; width: 20px; height: 20px; background: url(../assets/ui/ch_2.png) center / contain no-repeat; }
html.portrait .spot-pill.active .sp-name { font: 700 13px var(--m-serif); color: var(--m-parch); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
html.portrait .spot-pill.active .sp-lvl { color: var(--m-gold2); }
html.portrait .travel-overlay, html.portrait .travel-overlay.loading { top: 56px; width: min(300px, 84vw); border-color: var(--m-line); border-radius: 2px; background: #15130fe6; }
/* paski nad potworami: „Poz. 46 Nazwa” */
html.portrait .mobbar { width: 132px; margin: -30px 0 0 -66px; }
html.portrait .mobbar small { display: flex; flex-direction: row-reverse; justify-content: center; gap: 4px; font: 700 11px var(--m-sans); color: #ff7a64; text-shadow: 0 1px 2px #000, 0 0 3px #000; white-space: nowrap; }
html.portrait .mobbar small b { color: #8be38b; font-weight: 700; } html.portrait .mobbar small b::before { content: 'Poz. '; }
html.portrait .mobbar i { height: 6px; border: 1px solid #000; background: #2a0b08d9; }
html.portrait .mobbar u { background: linear-gradient(#e2584a, #9c1f14); }
html.portrait .death-overlay > div { font: 700 30px var(--m-serif); }

/* ---------- pływający pasek skrótów (umiejętności z paska + mikstury) ---------- */
html.portrait .muhud { position: fixed !important; left: 50% !important; right: auto; top: auto !important; bottom: calc(var(--m-nav) + var(--m-chat) + 16px) !important; width: auto !important; height: auto !important;
  max-width: calc(100vw - 16px); transform: translateX(-50%) !important; display: flex; align-items: center; gap: 8px; padding: 0; background: none; border: none; z-index: 8; }
html.portrait .muhud > * { position: relative !important; left: auto !important; top: auto !important; }
html.portrait .muhud .skillbar { display: flex; gap: 8px; min-width: 0; overflow-x: auto; scrollbar-width: none; padding: 6px 2px; }
html.portrait .muhud .skillbar::-webkit-scrollbar { display: none; }
html.portrait .muhud .skill { flex: 0 0 48px; width: 48px; height: 48px; border-radius: 4px; background: var(--m-field); overflow: visible;
  box-shadow: 0 0 0 2px #8a6b3a, 0 0 0 3px #000, 0 4px 10px #000c; }
html.portrait .muhud .skill.empty { display: none; }
html.portrait .muhud .skillbar:not(:has(.skill:not(.empty))) .skill:first-child { display: block; }
html.portrait .muhud .skill.empty::after { content: '+'; position: absolute; inset: 0; display: grid; place-items: center; color: var(--m-mute); font: 400 24px var(--m-sans); }
html.portrait .muhud .skill img, html.portrait .muhud .skill .ico { border-radius: 3px; width: 100% !important; height: 100% !important; }
html.portrait .muhud .skill .key { display: none; }
html.portrait .muhud .skill .swap { opacity: 1; width: 18px; height: 18px; font-size: 10px; line-height: 16px; top: -7px; right: -7px; border-radius: 50%; }
html.portrait .muhud .skill.active-skill { box-shadow: 0 0 0 2px var(--m-gold2), 0 0 0 3px #000, 0 0 16px #ecc78acc; }
html.portrait .muhud .pot { flex: none; width: 48px; height: 48px; padding: 4px; border: none; border-radius: 4px; background: var(--m-field);
  clip-path: polygon(10px 0, calc(100% - 10px) 0, 100% 10px, 100% calc(100% - 10px), calc(100% - 10px) 100%, 10px 100%, 0 calc(100% - 10px), 0 10px);
  box-shadow: inset 0 0 0 2px #4f8c6a; }
html.portrait .muhud .pot img { width: 100%; height: 100%; object-fit: contain; opacity: .55; }
html.portrait .muhud .pot b { position: absolute; inset: 0; display: grid; place-items: center; font: 700 17px var(--m-sans); color: #fff; text-shadow: 0 0 3px #000, 0 0 3px #000; }
html.portrait .muhud .autopot { flex: none; display: grid; place-items: center; width: 40px; height: 30px; border: 1px solid var(--m-line); border-radius: 2px; background: #15130fe0;
  font: 700 10px var(--m-sans); color: var(--m-mute); letter-spacing: .5px; text-transform: uppercase; }
html.portrait .muhud .autopot input { display: none; }
html.portrait .muhud .autopot:has(input:checked) { color: var(--m-gold3); border-color: var(--m-gold); box-shadow: 0 0 8px #d1a35f66; }

/* ---------- belka czatu nad dolnym menu ---------- */
html.portrait #mchat { display: flex; position: fixed; left: 8px; right: 8px; bottom: calc(var(--m-nav) + 8px); height: var(--m-chat); z-index: 9; box-sizing: border-box; align-items: center; gap: 8px;
  padding: 0 12px; border: 1px solid var(--m-line); border-radius: 10px; background: #15130fe8; box-shadow: 0 4px 14px #000a; color: var(--m-parch); font: 13px var(--m-sans); }
html.portrait #mchat .mc-ico { flex: none; color: var(--m-sub); font-size: 15px; }
html.portrait #mchat .mc-txt { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
html.portrait #mchat .mc-txt em { font-style: normal; color: var(--m-gold); } html.portrait #mchat .mc-txt span { color: var(--m-mute); }
html.portrait #mchat .mc-txt b { color: var(--m-gold2); }
html.portrait #mchat .mc-up { flex: none; color: var(--m-sub); font-size: 13px; }
html.portrait #mchat .mc-on { flex: none; padding-left: 10px; border-left: 1px solid var(--m-line); color: var(--m-sub); font-size: 12.5px; }
html.portrait.mchat-open #mchat { display: none; }
/* czat rozwinięty: pełny ekran */
html.portrait .net-chat { display: none; }
html.portrait.mchat-open .net-chat { display: flex !important; position: fixed; left: 0; right: 0; width: auto; top: var(--m-top); bottom: var(--m-nav); z-index: 43; border: none;
  border-top: 1px solid var(--m-line); background: var(--m-screen); font: 14px var(--m-sans); }
html.portrait .net-chat .nc-head { padding: 6px 8px; gap: 4px; border-bottom: 1px solid var(--m-line); }
html.portrait .net-chat .nc-head button { font: 600 13.5px var(--m-sans); padding: 8px 12px; }
html.portrait .net-chat .nc-head button.on { color: var(--m-gold2); box-shadow: inset 0 -2px 0 var(--m-gold); }
html.portrait .net-chat .nc-min { display: none; }
html.portrait .net-chat .nc-close { margin-left: 6px; width: 36px; height: 36px; padding: 0 !important; border: 1px solid var(--m-line) !important; border-radius: 2px; color: var(--m-parch) !important; font-size: 18px !important; }
html.portrait .net-chat .nc-log, html.portrait .net-chat.min .nc-log { display: block; flex: 1; height: auto; min-height: 0; font-size: 14px; line-height: 1.5; padding: 8px 12px; }
html.portrait .net-chat .nc-input, html.portrait .net-chat.min .nc-input { display: block; }
html.portrait .net-chat .nc-input input { font-size: 16px; padding: 12px; background: var(--m-field); border-top: 1px solid var(--m-line); }

/* ---------- dolne menu: 7 zakładek ---------- */
html.portrait #mnav { display: grid; position: fixed; left: 0; right: 0; bottom: 0; height: var(--m-nav); z-index: 45; grid-template-columns: repeat(7, 1fr); box-sizing: border-box;
  padding: 0 0 env(safe-area-inset-bottom); background: linear-gradient(#15130f, #0c0c0a); border-top: 1px solid var(--m-line); }
html.portrait #mnav button { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; min-width: 0; border: none; background: none;
  color: var(--m-mute); font: 11px var(--m-sans); padding: 4px 0 2px; }
html.portrait #mnav button span { max-width: 100%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; padding: 0 2px; }
html.portrait #mnav button img { width: 28px; height: 28px; filter: saturate(.75) brightness(.85); }
html.portrait #mnav button.on { color: var(--m-gold2); background: radial-gradient(ellipse at 50% 0%, #d1a35f33, transparent 70%); }
html.portrait #mnav button.on::before { content: ''; position: absolute; top: -1px; left: 22%; right: 22%; height: 2px; background: var(--m-gold); box-shadow: 0 0 8px var(--m-gold); }
html.portrait #mnav button.on img { filter: drop-shadow(0 0 6px #d1a35f99); }

/* ---------- menu boczne (☰) ---------- */
html.portrait .gamemenu { position: fixed; inset: 0 auto 0 0 !important; width: min(80vw, 320px) !important; max-width: none !important; transform: none !important; z-index: 70;
  display: flex; flex-direction: column; gap: 0; padding: calc(env(safe-area-inset-top) + 64px) 0 calc(env(safe-area-inset-bottom) + 12px); overflow-y: auto; box-sizing: border-box;
  background: var(--m-screen); border: none; border-right: 1px solid var(--m-line); border-radius: 0; box-shadow: 8px 0 30px #000c; animation: mDrawer .2s ease-out; }
html.portrait .gamemenu[hidden] { display: none; }
@keyframes mDrawer { from { transform: translateX(-30px) !important; opacity: .4; } }
html.portrait .gamemenu::before { content: 'Mu Idle'; position: absolute; top: calc(env(safe-area-inset-top) + 16px); left: 16px; font: 700 24px var(--m-serif); color: var(--m-gold);
  text-shadow: 0 0 12px #d1a35f66; }
html.portrait .gamemenu::after { content: '◆  MENU'; order: -1; padding: 6px 16px 8px; font: 700 11px var(--m-sans); letter-spacing: 1.5px; color: var(--m-gold); }
html.portrait .gamemenu button { min-height: 48px; padding: 0 16px; text-align: left; border: none; border-bottom: 1px solid #ffffff0a; border-radius: 0; background: none;
  color: var(--m-parch); font: 15px var(--m-sans); text-shadow: none; }
html.portrait .gamemenu button:active, html.portrait .gamemenu button:hover { background: linear-gradient(90deg, #d1a35f2a, transparent); box-shadow: inset 3px 0 0 var(--m-gold); }
html.portrait .gamemenu #mReset { color: var(--m-red); }
html.portrait #mdrawerBg { display: block; position: fixed; inset: 0; z-index: 69; background: #000a; }
html.portrait #mdrawerBg[hidden] { display: none; }

/* ---------- okna = pełne ekrany ---------- */
html.portrait .win.open, html.portrait .panel.side.win.wide-inv.open, html.portrait .panel.side.win.open, html.portrait .panel.char.win.open {
  position: fixed !important; zoom: 1 !important; left: 0 !important; right: 0 !important; width: auto !important; max-width: none !important;
  top: var(--m-top) !important; bottom: var(--m-nav) !important; max-height: none !important; z-index: 42;
  padding: 14px 12px 20px !important; border-radius: 0; border: none; background: var(--m-screen) !important; box-shadow: none; overflow-y: auto; overscroll-behavior: contain; }
html.portrait .win-close { position: sticky; top: -6px; float: right; width: 36px; height: 36px; margin: -4px -2px 0 8px; z-index: 5; border: 1px solid var(--m-line); border-radius: 2px;
  background: var(--m-card); color: var(--m-parch); font: 400 20px/1 var(--m-sans); }
html.portrait .win .panel-title { text-align: left; font: 700 20px var(--m-serif); color: var(--m-parch); margin: 2px 0 14px; letter-spacing: .3px; }
html.portrait .win .panel-title::before { content: '◆ '; color: var(--m-gold); font-size: 14px; vertical-align: 2px; }
html.portrait .win .btn { min-height: 40px; font: 600 13.5px var(--m-sans); border: 1px solid var(--m-line); border-radius: 2px; background: var(--m-sec); color: var(--m-parch); text-shadow: none; }
html.portrait .win .btn.gold { background: linear-gradient(#79532c, #4a2d17); border-color: #956835; color: var(--m-gold3); box-shadow: 0 0 10px #95683555; }
html.portrait .win .btn.red { background: #3a1a14; border-color: #6e3326; color: var(--m-red); }
html.portrait .win .btn.small { min-height: 34px; padding: 4px 10px; }
html.portrait .win .muted, html.portrait .win small { font-size: 12.5px; color: var(--m-mute); }
html.portrait .win input, html.portrait .win select { background: var(--m-field); border: 1px solid var(--m-line2); color: var(--m-parch); border-radius: 2px; min-height: 36px; font: 14px var(--m-sans); }
/* karty ze złotymi narożnikami */
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: var(--m-corners), var(--m-card) !important; border: 1px solid var(--m-line) !important; border-radius: 2px !important; }
html.portrait .inv-subwin { padding: 10px !important; margin: 0 !important; }
html.portrait .char-head, html.portrait .stats, html.portrait .derived { padding: 10px; margin-bottom: 10px; }
html.portrait .stats-head { font: 700 11px var(--m-sans); letter-spacing: 1.2px; text-transform: uppercase; color: var(--m-gold); }
html.portrait .derived span:nth-child(odd) { color: var(--m-mute); } html.portrait .derived span:nth-child(even) { color: var(--m-parch); }
html.portrait .char-head .ch-name { font: 700 18px var(--m-serif); color: var(--m-parch); }
html.portrait .char-head .ch-lvl { font-family: var(--m-serif); color: var(--m-gold2); }
html.portrait .char-head .ch-xp { background: var(--m-field); border-color: var(--m-field2); }
html.portrait .char-head .ch-xp div { background: linear-gradient(#e3c27a, var(--m-exp)); }
/* ekwipunek */
html.portrait .inv-dual-layout { grid-template-columns: 1fr !important; gap: 10px !important; }
html.portrait .inv-subwin-title { flex-wrap: wrap; gap: 6px; font: 700 15px var(--m-serif); color: var(--m-parch); }
html.portrait .equip-win .equip-grid { max-width: 250px; margin: 0 auto; gap: 5px; padding: 8px;
  background: repeating-linear-gradient(45deg, #ffffff05 0 1px, transparent 1px 12px), repeating-linear-gradient(-45deg, #ffffff05 0 1px, transparent 1px 12px), var(--m-field); border: 1px solid var(--m-line); }
html.portrait .equip-win .item-detail { display: none; }
html.portrait .inv-pages { gap: 6px; }
html.portrait .inv-pages button { min-height: 38px; border-radius: 2px; border: 1px solid var(--m-line); background: var(--m-sec); color: var(--m-sub); font: 700 15px var(--m-serif); }
html.portrait .inv-pages button.on, html.portrait .inv-pages button.active { background: #3a2f20; color: var(--m-gold2); box-shadow: inset 0 2px 0 var(--m-gold); }
html.portrait .inv-grid { background: var(--m-field2); border-color: var(--m-line); }
html.portrait .inv-cell { background: var(--m-field); box-shadow: inset 0 0 0 1px #3b3328; opacity: 1;
  clip-path: polygon(3px 0, calc(100% - 3px) 0, 100% 3px, 100% calc(100% - 3px), calc(100% - 3px) 100%, 3px 100%, 0 calc(100% - 3px), 0 3px); }
html.portrait .vault-grid { max-height: none !important; width: 100%; }
html.portrait .moneybar { background: var(--m-field); border: 1px solid var(--m-line); padding-left: 12px; color: var(--m-gold3); }
/* statystyki */
html.portrait .stat-row { min-height: 44px; border-bottom: 1px solid #ffffff0a; }
html.portrait .stat-row button { width: 36px; height: 36px; font-size: 15px; border: 1px solid var(--m-line); border-radius: 2px; background: var(--m-sec); color: var(--m-gold2); }
html.portrait .stat-row button.x10 { width: 44px; font-size: 12px; }
/* umiejętności */
html.portrait .skill-row { flex-wrap: wrap; padding: 10px; margin-bottom: 8px; }
html.portrait .skill-row .info { flex: 1 1 calc(100% - 60px); font-size: 13px; }
html.portrait .skill-row .slots { flex: 1 1 100%; display: grid !important; grid-template-columns: repeat(10, 1fr); gap: 4px; }
html.portrait .skill-row .slots button { width: auto !important; min-width: 0; min-height: 32px; padding: 0; border-radius: 2px; }
/* mapy */
html.portrait .map-card { margin-bottom: 8px; padding: 10px !important; }
/* targ */
html.portrait #tab-market .mk-views button { min-height: 40px; font-size: 13px; border-radius: 2px; }
html.portrait #tab-market .mk-views button.on { color: var(--m-gold2); border-color: var(--m-gold); background: #3a2f20; }
html.portrait #tab-market .mk-row { padding: 8px; margin-bottom: 6px; }
/* dziennik */
html.portrait #tab-log .log { max-height: none; font: 13px/1.5 var(--m-sans); }
html.portrait #tab-log .log div { border-bottom: 1px solid #ffffff08; padding: 4px 2px; }

/* ---------- karta przedmiotu (dotknięcie w plecaku / na postaci) ---------- */
html.portrait #itemDetail:has(.it-actions) { display: block !important; position: fixed; left: 8px; right: 8px; bottom: calc(var(--m-nav) + 8px); max-height: 56vh; overflow-y: auto; z-index: 50;
  padding: 14px; border-radius: 2px; background: var(--m-corners), var(--m-pop); border: 1px solid var(--m-line); box-shadow: 0 -10px 40px #000e; animation: mCard .18s ease-out; }
@keyframes mCard { from { transform: translateY(16px); opacity: .5; } }
html.portrait #itemDetail .it-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
html.portrait #itemDetail .it-actions .btn { flex: 1 1 30%; min-height: 42px; font-size: 13.5px; }
#mjewel { display: none; }
html.portrait.mjewel #itemDetail { display: none !important; }
html.portrait.mjewel #mjewel { display: flex; position: fixed; left: 8px; right: 8px; bottom: calc(var(--m-nav) + 8px); z-index: 50; align-items: center; gap: 10px; padding: 10px 12px;
  border-radius: 2px; background: #1a1508f2; border: 1px solid var(--m-gold); color: var(--m-parch); font: 600 13px var(--m-sans); box-shadow: 0 -8px 30px #000c; }
html.portrait.mjewel #mjewel span { flex: 1; } html.portrait.mjewel #mjewel b { color: var(--m-gold2); }

/* ---------- dymki i okna modalne ---------- */
html.portrait .tooltip { max-width: calc(100vw - 24px); background: var(--m-pop); border-color: var(--m-line); border-radius: 2px; }
html.portrait .modal-box { background: var(--m-corners), var(--m-pop); border: 1px solid var(--m-line); border-radius: 2px; }
html.portrait .modal-box h2 { font-family: var(--m-serif); color: var(--m-parch); }

/* ---------- ekran wyboru / tworzenia postaci ---------- */
html.portrait body.creating #mtop, html.portrait body.creating .muhud, html.portrait body.creating #mnav, html.portrait body.creating #mchat { display: none !important; }
html.portrait body.creating .layout { top: 0 !important; bottom: 0 !important; }
html.portrait body.creating .battle-col .battle { top: calc(64px + 30vh) !important; bottom: auto !important; height: 31vh !important; border-top: 1px solid var(--m-line); border-bottom: 1px solid var(--m-line); }
html.portrait .cs-logo { top: 12px !important; font: 700 26px var(--m-serif) !important; color: var(--m-gold) !important; }
html.portrait .cs-panel { background: var(--m-corners), var(--m-card); border: 1px solid var(--m-line); border-radius: 2px; }
html.portrait body.creating .cs-left { left: 10px; right: 10px; width: auto; top: 58px !important; bottom: auto !important; max-height: 28vh !important; overflow-y: auto; transform: none !important; }
html.portrait .cs-title { font-family: var(--m-serif); }
html.portrait .cs-right { display: block; position: absolute; left: 10px; right: 10px; width: auto; top: calc(64px + 61vh + 6px); bottom: auto; transform: none !important;
  max-height: calc(100vh - (64px + 61vh) - 150px); overflow-y: auto; padding: 8px 10px; }
html.portrait .cs-right .cs-hint, html.portrait .cs-right .cs-class p { display: none; }
html.portrait .cs-right .cs-class img { width: 40px; height: 40px; }
html.portrait .cs-right .cs-class b { font: 700 16px var(--m-serif); }
html.portrait .cs-right .cs-stats { grid-template-columns: repeat(4, 1fr); gap: 4px; margin-top: 6px; padding-top: 6px; font-size: 12px; }
html.portrait .cs-right .cs-stats div { flex-direction: column; align-items: center; gap: 1px; }
html.portrait .cs-right .cs-stats span { font-size: 11px; }
html.portrait .cs-bottom { left: 10px; right: 10px; transform: none; bottom: calc(14px + env(safe-area-inset-bottom)); flex-wrap: wrap; justify-content: center; background: none; border: none; }
html.portrait .cs-bottom input { width: 100%; background: var(--m-field); border-color: var(--m-line2); }

/* poza układem pionowym nic z tego nie widać */
html:not(.portrait) #mtop, html:not(.portrait) #mnav, html:not(.portrait) #mchat, html:not(.portrait) #mdrawerBg { display: none !important; }
@media (prefers-reduced-motion: reduce) { html.portrait #itemDetail, html.portrait .gamemenu { animation: none; } }

/* =========================== poprawki użyteczności (telefon pionowo) =========================== */
/* nic nie wychodzi poza szerokość ekranu */
html.portrait .win.open { overflow-x: hidden; }
html.portrait .inv-dual-layout, html.portrait .inv-dual-layout > *, html.portrait .inv-subwin, html.portrait .inv-grid, html.portrait .inv-pages { min-width: 0 !important; max-width: 100% !important; box-sizing: border-box; }
html.portrait .inv-subwin { width: auto !important; }
html.portrait .inv-grid { width: 100% !important; height: auto !important; }
html.portrait .inv-grid .inv-cell, html.portrait .inv-grid .slot { min-width: 0 !important; }
html.portrait .inv-actions { display: flex !important; flex-wrap: wrap !important; gap: 6px !important; width: 100% !important; }
html.portrait .inv-actions .btn { flex: 1 1 auto; min-width: 0; padding: 6px 8px !important; }
html.portrait .inv-pages { display: grid !important; grid-template-columns: repeat(4, 1fr) !important; width: 100% !important; }
html.portrait .inv-pages button { min-width: 0; }
/* okno otwarte: bez belki czatu (nie zasłania przycisków na dole okna) */
html.portrait.mwin-open #mchat { display: none; }
html.portrait .win.open { padding-bottom: 28px !important; }
/* paski życia i many w nagłówku: grubsze, czytelne liczby */
html.portrait .mt-vit { height: 30px; font-size: 12px; }
html.portrait .mt-bar { height: 15px; border-radius: 2px; }
html.portrait .mt-bar em { font: 700 10.5px/15px var(--m-sans); }
/* dolne menu: pełne podpisy */
html.portrait #mnav button { font: 600 10.5px var(--m-sans) !important; gap: 2px; padding: 0; }
html.portrait #mnav button span { overflow: visible; text-overflow: clip; letter-spacing: -.1px; }
html.portrait #mnav button img { width: 30px; height: 30px; }
/* drużyna na polu walki: mniejsza, nie zasłania potworów */
html.portrait .party-frame { width: 124px; opacity: .92; }
/* umiejętności: sloty tylko dla umiejętności, które da się przypisać */
html.portrait .skill-row:has(.slots button:disabled:first-child) .slots { display: none !important; }
html.portrait .skill-row .slots { grid-template-columns: repeat(5, 1fr) !important; }
html.portrait .skill-row .slots button { min-height: 38px !important; font: 700 14px var(--m-sans); }
/* pasek umiejętności: przyciski w rzędzie (na komputerze są ustawiane absolutnie) */
html.portrait .muhud .skill { position: relative !important; left: auto !important; top: auto !important; }
html.portrait .muhud .skill .ico { position: absolute; inset: 0; background-repeat: no-repeat; }
/* ---- czat na telefonie: najnowsze przy polu pisania, przycisk Wyślij, nieprzeczytane ---- */
html.portrait.mchat-open .net-chat { flex-direction: column; }
html.portrait .net-chat .nc-log { display: flex !important; flex-direction: column; overflow-y: auto; }
html.portrait .net-chat .nc-log > :first-child { margin-top: auto; }
html.portrait .net-chat .nc-msg { padding: 5px 0; border-bottom: 1px solid #ffffff08; word-wrap: break-word; }
html.portrait .net-chat .nc-msg time { font-size: 12px; color: var(--m-mute); }
html.portrait .net-chat .nc-input, html.portrait .net-chat.min .nc-input { display: flex !important; gap: 8px; padding: 8px 10px calc(8px + env(safe-area-inset-bottom, 0px)); background: var(--m-screen); border-top: 1px solid var(--m-line); }
html.portrait .net-chat .nc-input input { border: 1px solid var(--m-line2) !important; border-radius: 22px; padding: 10px 16px; min-height: 44px; box-sizing: border-box; }
html.portrait .net-chat .nc-send { min-width: 76px; min-height: 44px; border: 1px solid #956835; border-radius: 22px; background: linear-gradient(#79532c, #4a2d17); color: var(--m-gold3); font: 700 14px var(--m-sans); }
html.portrait .net-chat .nc-head button { min-height: 44px; }
html.portrait .net-chat .nc-online { font-size: 13px; }
html.portrait #mchat .mc-badge { flex: none; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px; background: #c0392b; color: #fff; font: 700 12px/20px var(--m-sans); text-align: center; box-sizing: border-box; }

/* ---- dotykowe cele ≥ 44 px i tekst ≥ 11 px ---- */
html.portrait .mt-menu { width: 44px; height: 44px; margin-left: -6px; }
html.portrait .win-close { width: 44px !important; height: 44px !important; }
html.portrait .win .btn.small { min-height: 42px !important; }
html.portrait .muhud .autopot { width: 48px; height: 48px; font-size: 11px; }
html.portrait .party-frame .pf-x { min-width: 32px; min-height: 32px; font-size: 16px; display: inline-grid; place-items: center; }
html.portrait .party-frame .pf-m { min-height: 40px; box-sizing: border-box; }
html.portrait .party-frame small, html.portrait .spot-pill .sp-lvl, html.portrait .mt-cur small { font-size: 11px !important; }
html.portrait .mt-bar em { font-size: 11px !important; }
html.portrait #mnav button { font-size: 11px !important; }
html.portrait .muhud .skill .swap { width: 22px; height: 22px; font-size: 12px; line-height: 20px; top: -9px; right: -9px; }
/* ---- menu boczne: bez powtórzeń z dolnego menu, ikony, grupy, niebezpieczne akcje osobno ---- */
html.portrait .gamemenu { z-index: 72 !important; }
html.portrait #mdrawerBg { z-index: 71; }
html.portrait .gamemenu [data-win="maps"], html.portrait .gamemenu [data-win="log"], html.portrait .gamemenu #mCharSelect { display: none !important; }
html.portrait .gamemenu button { display: flex; align-items: center; gap: 12px; }
html.portrait .gamemenu button::before { content: ''; flex: none; width: 26px; height: 26px; background: center / contain no-repeat; opacity: .9; }
html.portrait .gamemenu #findBtn::before { background-image: url(../assets/ui/npc_eye.png); }
html.portrait .gamemenu [data-win="shop"]::before { background-image: url(../assets/ui/npc_potion.png); }
html.portrait .gamemenu [data-win="vault"]::before { background-image: url(../assets/ui/npc_chest.png); }
html.portrait .gamemenu [data-win="chaos"]::before { background-image: url(../assets/ui/npc_cauldron.png); }
html.portrait .gamemenu [data-win="market"]::before { background-image: url(../assets/ui/npc_moneybag.png); }
html.portrait .gamemenu #mLoot::before { background-image: url(../assets/ui/npc_gear.png); }
html.portrait .gamemenu #mFull::before, html.portrait .gamemenu #mSound::before, html.portrait .gamemenu #mMusic::before { width: 0; }
html.portrait .gamemenu #mFull { order: 20; margin-top: 14px; border-top: 1px solid var(--m-line); }
html.portrait .gamemenu #mSound { order: 21; } html.portrait .gamemenu #mMusic { order: 22; }
html.portrait .gamemenu #mReset, html.portrait .gamemenu [onclick="Net.logout()"] { order: 30; font-size: 14px; color: var(--m-sub); }
html.portrait .gamemenu #mReset { margin-top: auto; border-top: 1px solid var(--m-line); color: var(--m-red); }
html.portrait .gamemenu #mReset::before, html.portrait .gamemenu [onclick="Net.logout()"]::before { width: 0; }
html.portrait:has(.gamemenu:not([hidden])) #mchat { display: none; }
html.portrait .gamemenu { top: var(--m-top) !important; bottom: var(--m-nav) !important; padding: 8px 0 12px !important; }
html.portrait .gamemenu::before, html.portrait .gamemenu::after { display: none !important; }
html.portrait .gamemenu button::before { filter: brightness(2.1) sepia(.5) saturate(1.4); }
html.portrait .gamemenu [href*="admin"], html.portrait .gamemenu #mAdmin { order: 19; }
html.portrait .gamemenu #adminBtn { order: 19; } html.portrait .gamemenu #adminBtn::before { background-image: url(../assets/ui/npc_flag.png); }
/* karta przedmiotu: reszta ekranu przyciemniona (karta wyraźnie na wierzchu) */
html.portrait #itemDetail:has(.it-actions) { box-shadow: 0 -10px 36px #000e; }
html.portrait .stat-row button { width: 44px !important; height: 44px !important; } html.portrait .stat-row button.x10 { width: 52px !important; }
html.portrait .net-chat .nc-close { width: 44px !important; height: 44px !important; }
html.portrait .slot .req { font-size: 11px !important; }
/* ---- wyniki sesji ---- */
.ms-btn { display: none; }
html.portrait .ms-btn { display: flex; align-items: center; gap: 6px; position: absolute; right: 8px; top: 54px; z-index: 6; min-height: 40px; padding: 0 14px; border: 1px solid var(--m-line); border-radius: 2px;
  background: #15130fe6; color: var(--m-parch); font: 600 13px var(--m-sans); box-shadow: 0 2px 8px #000a; }
html.portrait.mwin-open .ms-btn { display: none; }
.ms-wrap { position: fixed; inset: 0; z-index: 120; display: grid; align-items: end; background: #000a; }
.ms-wrap[hidden] { display: none; }
.ms { margin: 0 auto; width: min(100%, 460px); box-sizing: border-box; max-height: 86vh; overflow-y: auto; padding: 16px 16px calc(16px + env(safe-area-inset-bottom, 0px));
  background: #17150f; border-top: 1px solid #6b5330; color: #eadcbb; font: 14px "Trebuchet MS", system-ui, sans-serif; animation: msUp .2s ease-out; }
@keyframes msUp { from { transform: translateY(24px); opacity: .6; } }
@media (prefers-reduced-motion: reduce) { .ms { animation: none; } }
.ms header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.ms h3 { margin: 0; font: 700 20px "Palatino Linotype", Georgia, serif; color: #ecc78a; }
.ms-x { width: 44px; height: 44px; border: 1px solid #463b2e; background: #1b1915; color: #eadcbb; font-size: 20px; border-radius: 2px; }
.ms-hero { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 10px; }
.ms-hero > div { padding: 12px; background: #0e0e0c; border: 1px solid #463b2e; }
.ms-hero small { display: block; color: #a09581; font-size: 12px; } .ms-hero b { display: block; margin-top: 2px; font: 700 22px Georgia, serif; color: #f0d39b; font-variant-numeric: tabular-nums; }
.ms-row { display: grid; grid-template-columns: 1fr auto; align-items: baseline; gap: 2px 10px; padding: 10px 2px; border-bottom: 1px solid #ffffff0d; }
.ms-row b { font-variant-numeric: tabular-nums; color: #eadcbb; } .ms-row small { grid-column: 1 / -1; color: #a09581; font-size: 12px; }
.ms footer { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 14px; } .ms footer .btn { min-height: 44px; }
/* skrzynia: wybór miejsca dotknięciem */
html.portrait .vault-move-hint { margin: 6px 0; padding: 8px 10px; border: 1px solid var(--m-gold); background: #2a2114; color: var(--m-gold3); font-size: 13px; }

/* Dziennik wraca do menu ☰ (w dolnym menu jest Społeczność) */
html.portrait .gamemenu [data-win="log"] { display: flex !important; }
html.portrait .gamemenu [data-win="log"]::before { background-image: url(../assets/ui/npc_scroll.png); }
html.portrait .gamemenu #mSocial::before { background-image: url(../assets/ui/npc_flag.png); }
html.portrait #mnav button .so-badge-nav { position: absolute; top: 4px; right: calc(50% - 22px); }
html.portrait.social-open #mchat, html.portrait.social-open .ms-btn { display: none; }
/* społeczność między nagłówkiem a dolnym menu, przyciski jak w innych oknach */
html.portrait .so-wrap:not(.so-card-wrap) { top: var(--m-top); bottom: var(--m-nav); z-index: 42; background: var(--m-screen); }
html.portrait .so-wrap:not(.so-card-wrap) .so { padding-top: 12px; padding-bottom: 12px; background: var(--m-screen); box-shadow: none; animation: none; }
.so .btn { min-height: 40px; padding: 0 14px; font: 600 13.5px "Trebuchet MS", system-ui, sans-serif; border: 1px solid #463b2e; border-radius: 2px; background: #30291f; color: #eadcbb; text-shadow: none; box-shadow: none; }
.so .btn.gold { background: linear-gradient(#79532c, #4a2d17); border-color: #956835; color: #f0d39b; }
.so .btn.red { background: #3a1a14; border-color: #6e3326; color: #e08b77; }
.so .btn:disabled { opacity: .6; }

/* Wyniki w dolnym pasku akcji (jak AUTO) */
html.portrait .muhud .ms-btn { position: relative !important; inset: auto !important; display: grid; place-items: center; gap: 0; flex: none; width: 48px; height: 48px; min-height: 0; padding: 0;
  border: 1px solid var(--m-line); border-radius: 2px; background: #15130fe0; box-shadow: none; font-size: 18px; line-height: 1; }
html.portrait .muhud .ms-btn small { font: 700 9.5px var(--m-sans); color: var(--m-sub); letter-spacing: .2px; }
html.portrait .desk-quick { display: none; }
html.portrait #mchat .mc-txt time { margin-right: 6px; color: var(--m-mute); }
/* dolny pasek zawsze klikalny: nad nakładką menu, a nakładka kończy się nad paskiem */
html.portrait #mnav { z-index: 75 !important; }
html.portrait #mdrawerBg { bottom: var(--m-nav) !important; }
/* menu ☰ krótsze: Społeczność jest w dolnym pasku (Gracze), Wyniki pod przyciskiem obok AUTO */
html.portrait .gamemenu #mSocial, html.portrait .gamemenu .gm-hide { display: none !important; }
html.portrait .gamemenu button { min-height: 46px !important; }
html.portrait .gamemenu #mStats::before { background-image: url(../assets/ui/ch_7.png); }
/* Kupiec na telefonie: mikstury — opis na całą szerokość, przyciski ilości w drugim rzędzie */
html.portrait #tab-shop .shop-row { flex-wrap: wrap; }
html.portrait #tab-shop .shop-row > .info { flex: 1 1 calc(100% - 60px); min-width: 0; }
html.portrait #tab-shop .shop-row > .btn { flex: 1 1 22%; min-height: 44px; }
