/* =========================================
   GŁÓWNY KONTENER I STRUKTURA
   ========================================= */
.rpg-clicker-container {
    display: grid;
    grid-template-columns: 1.5fr 1fr;
    gap: 20px;
    padding: 20px;
    max-width: 1000px;
    margin: 20px auto;
    background: #1a1a1a;
    color: #eee;
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.5);
    box-sizing: border-box;
}

@media (max-width: 900px) {
    .rpg-clicker-container { grid-template-columns: 1fr; padding: 15px; }
    .upgrades-grid { grid-template-columns: repeat(2, 1fr) !important; }
    .monster-btn { font-size: 5rem !important; }
}

@media (max-width: 500px) {
    .upgrades-grid { grid-template-columns: 1fr !important; }
    .tactics-row { flex-direction: column; gap: 10px; }
}

.left-column {
    display: flex;
    flex-direction: column;
    width: 100%;
}

/* Niestandardowe suwaki z motywem dark */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: #111; border-radius: 4px; }
::-webkit-scrollbar-thumb { background: #444; border-radius: 4px; border: 1px solid #222; }
::-webkit-scrollbar-thumb:hover { background: #f1c40f; }

/* =========================================
   EFEKTY SZKŁA (GLASSMORPHISM) I TEKST
   ========================================= */
.glass-panel {
    background: rgba(26, 26, 26, 0.75);
    backdrop-filter: blur(4px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    margin-bottom: 10px;
}
.glass-badge {
    background: rgba(0, 0, 0, 0.6);
    padding: 4px 8px;
    border-radius: 4px;
    border: 1px solid #333;
}
.gold-text { margin: 0; color: #f1c40f; text-shadow: 1px 1px 2px #000; }

/* =========================================
   LEWA KOLUMNA: ARENA ADVENTURE
   ========================================= */
.arena-section {
    background: #222;
    padding: 0;
    border-radius: 10px;
    border: 1px solid #333;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: relative;
}

.arena-content {
    position: relative;
    z-index: 1;
    padding: 20px;
    display: flex;
    flex-direction: column;
    height: 100%;
}

.tactics-panel { padding: 12px; }
.tactics-row { display: flex; justify-content: space-between; align-items: center; }

.strategy-group label { font-size: 0.7rem; color: #888; margin-right: 8px; font-weight: bold; }
.strategy-select { background: #111; color: #fff; border: 1px solid #e74c3c; padding: 6px 12px; border-radius: 4px; cursor: pointer; font-size: 0.9rem; }

.btn-stats {
    background: #3498db;
    border: none;
    color: white;
    padding: 6px 15px;
    border-radius: 4px;
    font-weight: bold;
    cursor: pointer;
    transition: 0.2s;
}
.btn-stats:hover { background: #2980b9; }

.player-status-box { text-align: center; padding: 10px; margin-bottom: 10px; }
.status-header { font-size: 0.8rem; color: #aaa; letter-spacing: 1px; margin-bottom: 8px; font-weight: bold; }
.regen-stats { margin-top: 8px; font-size: 0.9rem; display: flex; justify-content: center; gap: 20px; color: #2ecc71; }

.hp-bar-wrapper {
    width: 100%;
    height: 24px;
    background: #111;
    border-radius: 12px;
    overflow: hidden;
    position: relative;
    border: 1px solid #000;
}
.hp-fill { height: 100%; width: 100%; transition: width 0.1s linear; }
.player-hp .hp-fill { background: #2ecc71; }
.enemy-hp .hp-fill { background: #e74c3c; }

#hp-text, #player-hp-text {
    position: absolute; top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    font-size: 11px; font-weight: bold; text-shadow: 1px 1px 2px #000;
}

.combat-stats-row { display: flex; justify-content: space-between; padding: 0 10px; margin: 10px 0 5px 0; font-size: 0.85rem; color: #fff; }

/* NAWIGACJA MAPY */
.location-navigator { display: flex; flex-direction: column; padding: 10px; gap: 8px; margin-bottom: 10px; }
.nav-row { display: flex; justify-content: space-between; align-items: center; }
.nav-divider { height: 1px; background: rgba(255,255,255,0.1); margin: 2px 0; }
.nav-info { text-align: center; flex-grow: 1; }
.nav-info h3, .nav-info h4 { margin: 0; }
.nav-info h4 { color: #2ecc71; font-size: 1.1rem; }
.nav-btn { width: 34px; height: 34px; border-radius: 50%; background: #333; border: 1px solid #555; color: white; cursor: pointer; }
.nav-btn:hover:not(:disabled) { background: #e74c3c; border-color: red; }
.nav-btn:disabled { opacity: 0.2; cursor: not-allowed; }

/* FONTANNA */
.fountain-controls {
    display: flex; flex-direction: column; align-items: center;
    padding: 10px; margin: 10px 0;
    border-color: #3498db;
    background: rgba(52, 152, 219, 0.15);
}
.fountain-label { color: #3498db; font-weight: bold; margin-bottom: 8px; font-size: 0.9rem; }
.fountain-actions { display: flex; gap: 15px; align-items: center; }
.btn-skip { background: #e67e22; border: none; color: white; padding: 6px 12px; border-radius: 4px; cursor: pointer; font-weight: bold; }
.btn-skip:hover { background: #d35400; }
.auto-skip-box { display: flex; align-items: center; gap: 5px; color: #ccc; font-size: 0.8rem; }

.monster-zone { height: 200px; display: flex; align-items: center; justify-content: center; margin: 10px 0; }
.monster-btn { font-size: 7rem; background: none; border: none; cursor: pointer; transition: transform 0.05s; user-select: none; }
.monster-btn:active { transform: scale(0.92); }

.combat-log-container {
    background: rgba(0, 0, 0, 0.85); border-radius: 6px; padding: 10px; margin-top: 15px;
    border: 1px solid #333; height: 90px; overflow-y: auto; overflow-x: hidden; display: flex; flex-direction: column;
}
.combat-log { font-family: 'Courier New', monospace; font-size: 0.8rem; color: #0f0; line-height: 1.4; white-space: pre-wrap; padding-bottom: 5px; }

/* =========================================
   KAMIENIOŁOM (MINIGRA)
   ========================================= */
.hidden-mode { display: none !important; }

.quarry-container {
    width: 100%; height: 500px; position: relative;
    display: flex; flex-direction: column; justify-content: space-between;
    padding: 20px; box-sizing: border-box;
}
.quarry-header { text-align: center; padding: 10px; z-index: 10; margin-bottom: 10px; }
.quarry-status { font-weight: bold; color: #2ecc71; margin-top: 5px; }

.quarry-game-area {
    flex-grow: 1; position: relative; overflow: hidden;
    background: radial-gradient(circle at center, #2a2a2a 0%, #000 90%);
    border: 1px solid #333; border-radius: 8px; margin: 10px 0;
}

.q-entity { position: absolute; display: flex; align-items: center; justify-content: center; font-size: 3rem; transition: transform 0.1s; }
.q-hero { left: 50%; top: 50%; transform: translate(-50%, -50%); z-index: 5; font-size: 4rem; }
.q-rock { left: 50%; top: 40%; transform: translate(-50%, -50%); z-index: 4; font-size: 8rem; opacity: 0.4; pointer-events: none; }
.q-enemy { top: 50%; transform: translate(-50%, -50%); z-index: 6; font-size: 2.5rem; }

.q-hero.mining { animation: mineActionEmoji 0.15s; }
.q-hero.attack-left { transform: translate(-50%, -50%) scaleX(-1); animation: attackActionLeftEmoji 0.15s; }
.q-hero.attack-right { transform: translate(-50%, -50%) scaleX(1); animation: attackActionRightEmoji 0.15s; }
.q-hero.frozen { filter: grayscale(1) drop-shadow(0 0 10px blue); opacity: 0.7; }

@keyframes mineActionEmoji { 0% { top: 50%; } 50% { top: 45%; } 100% { top: 50%; } }
@keyframes attackActionLeftEmoji { 0% { margin-left: 0; } 50% { margin-left: -40px; } 100% { margin-left: 0; } }
@keyframes attackActionRightEmoji { 0% { margin-left: 0; } 50% { margin-left: 40px; } 100% { margin-left: 0; } }

.quarry-stats { display: flex; justify-content: space-around; padding: 10px; font-weight: bold; margin-top: 10px; }


/* =========================================
   PRAWA SEKJA & SKLEP
   ========================================= */
.resource-panel { display: flex; gap: 8px; margin-bottom: 15px; }
.res-item { flex: 1; background: #2a2a2a; padding: 10px; border-radius: 6px; text-align: center; border: 1px solid #444; font-weight: bold; color: #f1c40f; font-size: 0.9rem; }

.upgrades-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.upgrade-tile {
    background: #252525; border: 1px solid #444; border-radius: 8px;
    display: flex; flex-direction: column; overflow: hidden; cursor: pointer; transition: 0.2s;
}
.upgrade-tile:hover:not(.disabled) { border-color: #f1c40f; background: #333; transform: translateY(-2px); }
.upgrade-tile.disabled { opacity: 0.3; cursor: not-allowed; filter: grayscale(1); }

.tile-content { padding: 10px; text-align: center; flex-grow: 1; pointer-events: none; }
.tile-icon { font-size: 1.4rem; margin-bottom: 5px; }
.tile-name { font-weight: bold; color: #f1c40f; font-size: 0.85rem; }
.tile-desc { font-size: 0.7rem; color: #888; }
.tile-cost { font-size: 0.8rem; margin-top: 5px; color: #fff; }

.auto-buy-bar {
    background: rgba(255,255,255,0.07); padding: 5px 0;
    display: flex; justify-content: center; align-items: center; gap: 8px;
    border-top: 1px solid #333; width: 100%; cursor: default;
}
.auto-buy-bar label { font-size: 0.65rem; font-weight: bold; color: #aaa; cursor: pointer; }
.auto-buy-bar input { cursor: pointer; width: 13px; height: 13px; margin: 0; }

/* =========================================
   QUICK SLOTS (PASEK SZYBKIEGO DOSTĘPU)
   ========================================= */
.quick-slots-panel { padding: 10px; display: flex; flex-direction: column; align-items: center; }
.qs-item { 
    background: #252525; border: 1px solid #444; border-radius: 6px; 
    display: flex; flex-direction: column; align-items: center; overflow: hidden; 
}
.quick-slot { 
    width: 45px !important; height: 45px !important; 
    background: transparent; border: none; 
    display: flex; align-items: center; justify-content: center; 
    font-size: 1.4rem !important; position: relative; cursor: pointer; margin: 5px;
}
.quick-slot.filled { background: #2a1a1a; }
.qs-controls { 
    width: 100%; background: rgba(255,255,255,0.07); border-top: 1px solid #333; 
    text-align: center; padding: 4px 0; display: flex; justify-content: center; 
    align-items: center; gap: 3px; 
}
.qs-controls input[type="checkbox"] { margin: 0; width: 12px; height: 12px; cursor: pointer; }
.qs-controls label { font-size: 0.6rem; color: #aaa; font-weight: bold; cursor: pointer; }
.quick-slots-container { display: flex; justify-content: center; gap: 10px; margin-top: 5px; }

/* =========================================
   WYBÓR TRYBU GRY I FOOTER
   ========================================= */
.mode-selector-bar { text-align: center; background: #222; padding: 10px; border-radius: 8px; border: 1px solid #444; margin-bottom: 20px; }
.mode-select { background: #111; color: #f1c40f; border: 1px solid #555; padding: 8px; font-size: 1rem; cursor: pointer; border-radius: 4px; width: 80%; }

.footer-actions { margin-top: 20px; text-align: right; }
.btn-reset { background: #c0392b; color: white; border: none; padding: 8px 12px; border-radius: 4px; cursor: pointer; font-size: 0.8rem; font-weight: bold; }
.btn-reset:hover { background: #e74c3c; }

/* =========================================
   MODALE (OGÓLNE)
   ========================================= */
.hidden { display: none !important; }
.modal-overlay { 
    position: fixed; inset: 0; background: rgba(0,0,0,0.85); 
    display: flex; align-items: center; justify-content: center; 
    z-index: 1000; backdrop-filter: blur(4px); 
}
.modal-content {
    background: #1a1a1a; border: 2px solid #f1c40f; border-radius: 12px;
    padding: 30px; max-width: 400px; width: 95%; box-shadow: 0 0 40px rgba(241, 196, 15, 0.3);
    text-align: center; box-sizing: border-box; position: relative;
    max-height: 95vh; display: flex; flex-direction: column; overflow: hidden;
}
.choice-modal-content h2 { color: #f1c40f; margin-bottom: 10px; font-size: 1.2rem; }
.modal-desc { color: #ccc; margin-bottom: 25px; font-size: 0.9rem; }
.choice-actions { display: flex; flex-direction: column; gap: 12px; }
.btn-choice { padding: 12px; border-radius: 6px; border: none; font-weight: bold; cursor: pointer; font-size: 1rem; transition: 0.2s; }
.btn-choice.next { background: #2ecc71; color: #000; }
.btn-choice.next:hover { background: #27ae60; transform: scale(1.02); }
.btn-choice.stay { background: #333; color: #fff; border: 1px solid #444; }
.btn-choice.stay:hover { background: #444; }

/* =========================================
   MODAL BOHATERA (EKWIPUNEK, ZAKŁADKI)
   ========================================= */
.equip-modal-content { max-width: 680px; width: 95%; padding: 20px; }
.modal-header { display: flex; justify-content: space-between; align-items: flex-end; border-bottom: 1px solid #444; padding-bottom: 1px; margin-bottom: 15px; flex-shrink: 0; }

.modal-tabs { display: flex; gap: 5px; flex-wrap: wrap; }
.tab-btn { background: #222; border: 1px solid #444; border-bottom: none; color: #aaa; padding: 10px 15px; border-radius: 8px 8px 0 0; cursor: pointer; font-weight: bold; transition: 0.2s; }
.tab-btn.active { background: #1a1a1a; color: #f1c40f; border-color: #f1c40f; margin-bottom: -1px; padding-bottom: 11px; }

.tab-content { display: none; background: #1a1a1a; padding: 15px; border: 1px solid #444; border-radius: 0 8px 8px 8px; margin-top: -1px; overflow-y: auto; overflow-x: hidden; flex-grow: 1; }
.tab-content.active { display: block; border-color: #f1c40f; }

.btn-close { background: none; border: none; color: #aaa; font-size: 1.5rem; cursor: pointer; line-height: 1; padding: 0 5px; margin-bottom: 5px; }
.btn-close:hover { color: #e74c3c; }

.equipment-layout { display: flex; gap: 20px; }
@media(max-width: 600px) { .equipment-layout { flex-direction: column; } }

.paperdoll-section { flex: 1.2; background: #222; padding: 15px; border-radius: 8px; border: 1px inset #333; display: flex; flex-direction: column; align-items: center; justify-content: space-between; }
.bag-section { flex: 1; }
.section-title { font-size: 0.8rem; font-weight: bold; color: #f1c40f; margin-bottom: 10px; letter-spacing: 1px; text-transform: uppercase; }

/* PAPERDOLL GRID (Układ 5x5) */
.paperdoll-grid { 
    display: grid; 
    grid-template-columns: 50px 50px 60px 50px 50px; 
    grid-template-rows: 50px 50px 50px 50px 50px; 
    gap: 8px; align-items: center; justify-content: center; 
    margin-bottom: 20px; position: relative; width: 100%;
}
.equip-slot[data-slot="helmet"] { grid-column: 3; grid-row: 1; justify-self: center; }
.equip-slot[data-slot="amulet"] { grid-column: 3; grid-row: 2; justify-self: center; }
.equip-slot[data-slot="mainHand"] { grid-column: 1; grid-row: 3; }
.equip-slot[data-slot="ring1"]    { grid-column: 2; grid-row: 3; }
.equip-slot[data-slot="armor"]    { grid-column: 3; grid-row: 3; justify-self: center; }
.equip-slot[data-slot="ring2"]    { grid-column: 4; grid-row: 3; }
.equip-slot[data-slot="offHand"]  { grid-column: 5; grid-row: 3; }
.equip-slot[data-slot="card"] { grid-column: 3; grid-row: 4; justify-self: center; }
.equip-slot[data-slot="gloves"] { grid-column: 2; grid-row: 5; justify-self: center; }
.equip-slot[data-slot="boots"]  { grid-column: 4; grid-row: 5; justify-self: center; }

.character-silhouette { 
    grid-column: 2 / 5; grid-row: 1 / 6; display: flex; align-items: center; justify-content: center; 
    font-size: 14rem; opacity: 0.05; pointer-events: none; z-index: 0;
}

/* =========================================
   WYGLĄD SLOTÓW (EKWIPUNEK, PLECAK)
   ========================================= */
.equip-slot, .inventory-slot { 
    width: 50px; height: 50px; background: #111; border: 1px dashed #555; 
    border-radius: 6px; display: flex; align-items: center; justify-content: center; 
    font-size: 1.8rem; position: relative; cursor: pointer; z-index: 1; 
}
.equip-slot.filled, .inventory-slot.filled { border-style: solid; border-color: #f1c40f; background: #2a2a2a; }
.equip-slot:hover, .inventory-slot:hover { border-color: #fff; background: #333; }
.stack-counter { 
    position: absolute; bottom: 2px; right: 4px; font-size: 0.65rem; 
    background: rgba(0,0,0,0.85); padding: 1px 4px; border-radius: 4px; 
    color: #fff; font-weight: bold; border: 1px solid #444; 
}

/* TOOLTIPY (CSS OVERLAY) */
.equip-slot::after, .inventory-slot::after {
    content: attr(data-slot-name); position: absolute; bottom: 110%; left: 50%; transform: translateX(-50%);
    background: rgba(0,0,0,0.95); border: 1px solid #f1c40f; color: #fff; padding: 6px 10px; font-size: 0.75rem;
    border-radius: 4px; white-space: nowrap; opacity: 0; pointer-events: none; transition: 0.2s; z-index: 100;
}
.equip-slot.filled::after, .inventory-slot.filled::after { content: attr(data-item-name); }

/* Ukrycie tooltipów dla całkowicie pustych slotów bez atrybutów */
.equip-slot:not([data-item-name]):not([data-slot-name]):after, 
.inventory-slot:not([data-item-name]):not([data-slot-name]):after { display: none; }

.equip-slot:hover::after, .inventory-slot:hover::after { opacity: 1; }
.empty-icon { opacity: 0.2; font-size: 1.5rem; filter: grayscale(1); pointer-events: none; }

.artifact-stats-summary { font-size: 0.8rem; color: #aaa; text-align: center; background: #111; padding: 8px; border-radius: 6px; width: 100%; border: 1px solid #333; margin-top: 10px; }
.bag-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }

/* =========================================
   ZAKŁADKA STATYSTYK
   ========================================= */
.stats-table { width: 100%; border-collapse: collapse; text-align: left; font-size: 0.9rem; color: #ccc; }
.stats-table td { padding: 8px 10px; }
.stats-table td:nth-child(2) { text-align: right; color: #f1c40f; font-weight: bold; }
.stats-hr { border: 0; border-top: 1px solid #444; margin: 5px 0; }

/* =========================================
   ZAKŁADKI KLAWISZOLOGII I USTAWIEŃ
   ========================================= */
.kb-tab-btn {
    display: block; width: 100%; text-align: left; background: transparent; 
    border: none; color: #aaa; padding: 10px; cursor: pointer;
    border-radius: 4px; margin-bottom: 5px; font-weight: bold; transition: 0.2s;
}
.kb-tab-btn:hover { background: rgba(255,255,255,0.05); color: #fff; }
.kb-tab-btn.active { background: #333; color: #f1c40f; }
.kb-pane { display: block; }

.setting-row { display: flex; align-items: center; gap: 10px; color: #eee; margin-bottom: 10px; }
.setting-row input { width: 16px; height: 16px; cursor: pointer; }

.keybinds-grid { display: flex; flex-direction: column; gap: 10px; width: 100%; }
.kb-row { display: flex; justify-content: space-between; align-items: center; background: #222; padding: 8px; border-radius: 6px; border: 1px solid #444; }
.kb-btn { background: #111; color: #f1c40f; border: 1px solid #555; padding: 5px 15px; border-radius: 4px; cursor: pointer; font-weight: bold; min-width: 60px; }
.kb-btn:hover { background: #333; border-color: #f1c40f; }

/* =========================================
   ZAKŁADKA BESTIARIUSZA
   ========================================= */
.bestiary-icon-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(65px, 1fr)); gap: 10px; margin-top: 15px; }
.bestiary-icon-card { background: #222; border: 1px solid #444; border-radius: 8px; font-size: 2.2rem; display: flex; align-items: center; justify-content: center; height: 65px; cursor: pointer; transition: 0.2s; position: relative; }
.bestiary-icon-card:hover:not(.locked) { border-color: #f1c40f; transform: translateY(-3px); background: #333; }
.bestiary-icon-card.locked { filter: brightness(0.1) grayscale(1); cursor: not-allowed; }
.b-kill-badge { position: absolute; bottom: -5px; right: -5px; background: #000; color: #fff; font-size: 0.6rem; padding: 2px 5px; border-radius: 4px; border: 1px solid #444; }

.bestiary-card { background: #222; border: 1px solid #444; border-radius: 8px; padding: 12px; display: flex; flex-direction: column; gap: 8px; text-align: left; }
.bestiary-header { display: flex; align-items: center; gap: 10px; border-bottom: 1px solid #333; padding-bottom: 8px; }
.b-icon { font-size: 2.5rem; background: #111; padding: 5px 10px; border-radius: 6px; border: 1px solid #444; }
.b-title { font-size: 1.1rem; color: #f1c40f; font-weight: bold; margin:0;}
.b-kills { font-size: 0.8rem; color: #aaa; margin:0;}
.b-level-input { width: 50px; background: #111; color: #f1c40f; border: 1px solid #555; padding: 2px 5px; border-radius: 4px; text-align: center; font-weight: bold; margin-left: 5px;}
.b-section { background: #1a1a1a; padding: 10px; border-radius: 6px; font-size: 0.85rem; color: #ccc; border: 1px dashed #333;}
.b-section-title { font-size: 0.75rem; color: #888; text-transform: uppercase; margin-bottom: 6px; font-weight: bold; }
.b-locked { color: #555; font-style: italic; text-align: center; padding: 5px 0; }
.b-stat-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.b-stat { color: #eee; }
.b-stat span { color: #f1c40f; font-weight: bold; }

/* =========================================
   PARALAKSA (TŁA LOKALIZACJI)
   ========================================= */
.parallax-container { position: absolute; inset: 0; z-index: 0; overflow: hidden; background-color: var(--sky-color); transition: background-color 1.5s ease; }
.parallax-layer { position: absolute; bottom: 0; left: 0; width: 200%; height: 100%; background-repeat: repeat-x; background-position: bottom left; }
.layer-back  { animation: scrollBg 60s linear infinite; opacity: 0.6; }
.layer-mid   { animation: scrollBg 30s linear infinite; opacity: 0.8; }
.layer-front { animation: scrollBg 15s linear infinite; }
@keyframes scrollBg { 0% { transform: translateX(0); } 100% { transform: translateX(-50%); } }

.loc-1 { --sky-color: #87CEEB; --layer-b: radial-gradient(circle at 50% 100%, #5cb85c 40%, transparent 41%); --layer-m: radial-gradient(circle at 50% 100%, #4cae4c 50%, transparent 51%); --layer-f: linear-gradient(transparent 85%, #3e8f3e 85%); }
.loc-1 .layer-back { background-image: var(--layer-b); background-size: 400px 70%; }
.loc-1 .layer-mid { background-image: var(--layer-m); background-size: 250px 40%; }
.loc-1 .layer-front { background-image: var(--layer-f); background-size: 100px 100%; }

.loc-2 { --sky-color: #2c3e50; --layer-b: linear-gradient(135deg, transparent 40%, #1e5128 40%, #1e5128 60%, transparent 60%); --layer-m: linear-gradient(45deg, transparent 40%, #194320 40%, #194320 60%, transparent 60%); --layer-f: linear-gradient(transparent 85%, #3b2a1a 85%); }
.loc-2 .layer-back { background-image: var(--layer-b); background-size: 200px 80%; }
.loc-2 .layer-mid { background-image: var(--layer-m); background-size: 150px 60%; }
.loc-2 .layer-front { background-image: var(--layer-f); background-size: 100px 100%; }

.loc-3 { --sky-color: #9b59b6; --layer-b: linear-gradient(to bottom right, transparent 49%, #bdc3c7 50%); --layer-m: linear-gradient(to bottom left, transparent 49%, #ecf0f1 50%); --layer-f: linear-gradient(transparent 85%, #fff 85%); }
.loc-3 .layer-back { background-image: var(--layer-b); background-size: 300px 80%; }
.loc-3 .layer-mid { background-image: var(--layer-m); background-size: 200px 50%; }
.loc-3 .layer-front { background-image: var(--layer-f); background-size: 100px 100%; }

.loc-4, .loc-5 { --sky-color: #111; --layer-b: radial-gradient(circle, #fff 10%, transparent 11%); --layer-m: radial-gradient(circle, #f1c40f 5%, transparent 6%); --layer-f: linear-gradient(transparent 85%, #e74c3c 85%); }
.loc-4 .layer-back, .loc-5 .layer-back { background-image: var(--layer-b); background-size: 300px 300px; }
.loc-4 .layer-mid, .loc-5 .layer-mid { background-image: var(--layer-m); background-size: 150px 150px; }
.loc-4 .layer-front, .loc-5 .layer-front { background-image: var(--layer-f); background-size: 100px 100%; }

/* =========================================
   TEST GROUND (SVG MODULAR RIG 2.5D)
   ========================================= */
.test-stage { position: relative; width: 100%; min-height: 500px; flex-grow: 1; display: block; overflow: hidden; background: radial-gradient(circle at center, #1b2028 0%, #0d1116 100%); cursor: crosshair; }

.char-rig { position: absolute; width: 60px; height: 100px; transform: translate(-50%, -100%); z-index: 10; }
.char-rig.dir-w, .char-rig.dir-sw, .char-rig.dir-nw { transform: translate(-50%, -100%) scaleX(-1); }

.shadow { position: absolute; width: 40px; height: 15px; background: rgba(0, 0, 0, 0.6); border-radius: 50%; bottom: 0; left: 50%; transform: translate(-50%, 50%); z-index: -1; filter: blur(2px); }

.rig-body { position: absolute; inset: 0; }
.bone { position: absolute; width: 40px; left: 50%; transform: translateX(-50%); display: flex; justify-content: center; }
.bone svg { width: 100%; height: 100%; overflow: visible; }

/* CENTRA OBROTU (PIVOT) */
.head  { top: 0px; height: 40px; transform-origin: center bottom; }
.torso { top: 40px; height: 40px; transform-origin: center top; }
.leg-l { top: 80px; height: 50px; margin-left: -10px; transform-origin: center 5px; }
.leg-r { top: 80px; height: 50px; margin-left: 10px; transform-origin: center 5px; }

/* RAMIONA DWUSEGMENTOWE */
.arm-l.upper, .arm-r.upper { top: 40px; height: 25px; transform-origin: center 5px; }
.arm-l.upper { margin-left: -15px; }
.arm-r.upper { margin-left: 15px; }

.lower { position: absolute; top: 25px; width: 40px; height: 25px; left: 50%; transform: translateX(-50%); transform-origin: center 0px; display: flex; justify-content: center; z-index: 1; }
.lower svg { width: 100%; height: 100%; overflow: visible; }

/* ================== EKWIPUNEK ================== */
.item-helmet { position: absolute; width: 36px; height: 30px; top: -14px; left: 50%; transform: translateX(-50%); z-index: 2; pointer-events: none; }
/* PIVOT BRONI na 50% 80% (w miejscu gdzie chwyta prawa ręka) */
.item-weapon { position: absolute; width: 75px; height: 75px; bottom: -30px; left: 50%; transform-origin: 50% 80%; transform: translate(-50%, 0) rotate(15deg); z-index: -1; pointer-events: none; }

/* ================== KIERUNKI (Z-INDEX) ================== */
.dir-s .head { z-index: 5; } .dir-s .arm-l.upper, .dir-s .arm-r.upper { z-index: 4; } .dir-s .torso { z-index: 3; } .dir-s .leg-l, .dir-s .leg-r { z-index: 2; }
.dir-n .torso { z-index: 5; } .dir-n .head { z-index: 4; } .dir-n .leg-l, .dir-n .leg-r { z-index: 3; } .dir-n .arm-l.upper, .dir-n .arm-r.upper { z-index: 2; }
.dir-e .head { z-index: 5; } .dir-e .arm-r.upper { z-index: 6; } .dir-e .torso { z-index: 4; } .dir-e .leg-r { z-index: 5; } .dir-e .arm-l.upper { z-index: 2; } .dir-e .leg-l { z-index: 1; }
.dir-w .head { z-index: 5; } .dir-w .arm-l.upper { z-index: 6; } .dir-w .torso { z-index: 4; } .dir-w .leg-l { z-index: 5; } .dir-w .arm-r.upper { z-index: 2; } .dir-w .leg-r { z-index: 1; }

.dir-se .head, .dir-sw .head { z-index: 5; } .dir-se .arm-r.upper, .dir-sw .arm-l.upper { z-index: 6; } .dir-se .torso, .dir-sw .torso { z-index: 4; } .dir-se .leg-r, .dir-sw .leg-l { z-index: 5; } .dir-se .arm-l.upper, .dir-sw .arm-r.upper { z-index: 2; } .dir-se .leg-l, .dir-sw .leg-r { z-index: 1; }
.dir-ne .head, .dir-nw .head { z-index: 3; } .dir-ne .torso, .dir-nw .torso { z-index: 5; } .dir-ne .arm-r.upper, .dir-nw .arm-l.upper { z-index: 4; } .dir-ne .leg-r, .dir-nw .leg-l { z-index: 6; } .dir-ne .arm-l.upper, .dir-nw .arm-r.upper { z-index: 1; } .dir-ne .leg-l, .dir-nw .leg-r { z-index: 2; }

/* ================== CHWYT DWURĘCZNY (IDLE & WALK) ================== */
/* Ustawienie tak, by obie dłonie nachodziły na oś broni */
.dir-s.grip-two-handed .arm-r.upper, .dir-se.grip-two-handed .arm-r.upper, .dir-sw.grip-two-handed .arm-r.upper { transform: translateX(-50%) rotate(25deg); }
.dir-s.grip-two-handed .arm-r .lower, .dir-se.grip-two-handed .arm-r .lower, .dir-sw.grip-two-handed .arm-r .lower { transform: translateX(-50%) rotate(-55deg); }
.dir-s.grip-two-handed .arm-l.upper, .dir-se.grip-two-handed .arm-l.upper, .dir-sw.grip-two-handed .arm-l.upper { transform: translateX(-50%) rotate(-25deg); }
.dir-s.grip-two-handed .arm-l .lower, .dir-se.grip-two-handed .arm-l .lower, .dir-sw.grip-two-handed .arm-l .lower { transform: translateX(-50%) rotate(55deg); }
.dir-s.grip-two-handed .item-weapon, .dir-se.grip-two-handed .item-weapon, .dir-sw.grip-two-handed .item-weapon { transform: translate(-50%, 0) rotate(-35deg); }

.dir-e.grip-two-handed .arm-r.upper, .dir-w.grip-two-handed .arm-r.upper { transform: translateX(-50%) rotate(0deg); }
.dir-e.grip-two-handed .arm-r .lower, .dir-w.grip-two-handed .arm-r .lower { transform: translateX(-50%) rotate(-40deg); }
.dir-e.grip-two-handed .arm-l.upper, .dir-w.grip-two-handed .arm-l.upper { transform: translateX(-50%) rotate(20deg); }
.dir-e.grip-two-handed .arm-l .lower, .dir-w.grip-two-handed .arm-l .lower { transform: translateX(-50%) rotate(-40deg); }
.dir-e.grip-two-handed .item-weapon, .dir-w.grip-two-handed .item-weapon { transform: translate(-50%, 0) rotate(15deg); }

.dir-n.grip-two-handed .arm-r.upper, .dir-ne.grip-two-handed .arm-r.upper, .dir-nw.grip-two-handed .arm-r.upper { transform: translateX(-50%) rotate(-25deg); }
.dir-n.grip-two-handed .arm-r .lower, .dir-ne.grip-two-handed .arm-r .lower, .dir-nw.grip-two-handed .arm-r .lower { transform: translateX(-50%) rotate(55deg); }
.dir-n.grip-two-handed .arm-l.upper, .dir-ne.grip-two-handed .arm-l.upper, .dir-nw.grip-two-handed .arm-l.upper { transform: translateX(-50%) rotate(25deg); }
.dir-n.grip-two-handed .arm-l .lower, .dir-ne.grip-two-handed .arm-l .lower, .dir-nw.grip-two-handed .arm-l .lower { transform: translateX(-50%) rotate(-55deg); }
.dir-n.grip-two-handed .item-weapon, .dir-ne.grip-two-handed .item-weapon, .dir-nw.grip-two-handed .item-weapon { transform: translate(-50%, 0) rotate(35deg); }

/* W chodzie animacja tylko podskakuje w całości, by nie rozbijać misternie złożonego chwytu oburęcznego */
.state-walk.grip-two-handed .arm-l.upper, .state-walk.grip-two-handed .arm-r.upper { animation: walk-bounce 0.4s infinite alternate ease-in-out !important; }

/* ================== BAZOWE ANIMACJE ================== */
.state-idle:not(.grip-two-handed) .rig-body { animation: rig-breathe 2s infinite ease-in-out alternate; }
.state-idle:not(.grip-two-handed) .head { animation: rig-head-bob 2s infinite ease-in-out alternate; animation-delay: 0.2s; }
.state-idle:not(.grip-two-handed) .arm-l.upper { transform: translateX(-50%) rotate(5deg); }
.state-idle:not(.grip-two-handed) .arm-r.upper { transform: translateX(-50%) rotate(-5deg); }
.state-idle:not(.grip-two-handed) .lower { transform: translateX(-50%) rotate(-10deg); }

.state-walk .rig-body { animation: walk-bounce 0.4s infinite alternate ease-in-out; }
.state-walk .head, .state-walk .torso { transform: translateX(-50%) rotate(5deg); }
.state-walk .leg-l { animation: walk-limb 0.4s infinite alternate ease-in-out; }
.state-walk .leg-r { animation: walk-limb 0.4s infinite alternate-reverse ease-in-out; }

.state-walk:not(.grip-two-handed) .arm-l.upper { animation: walk-upper-l 0.4s infinite alternate-reverse ease-in-out; }
.state-walk:not(.grip-two-handed) .arm-r.upper { animation: walk-upper-r 0.4s infinite alternate ease-in-out; }
.state-walk:not(.grip-two-handed) .lower { animation: walk-lower 0.4s infinite alternate ease-in-out; }

@keyframes rig-breathe { 0% { transform: scaleY(1); } 100% { transform: scaleY(1.02) translateY(-2px); } }
@keyframes rig-head-bob { 0% { transform: translateX(-50%) rotate(0deg); } 100% { transform: translateX(-50%) rotate(3deg); } }
@keyframes walk-bounce { 0% { transform: translateY(0px); } 100% { transform: translateY(-5px); } }
@keyframes walk-limb { 0% { transform: translateX(-50%) rotate(30deg); } 100% { transform: translateX(-50%) rotate(-30deg); } }
@keyframes walk-upper-l { 0% { transform: translateX(-50%) rotate(25deg); } 100% { transform: translateX(-50%) rotate(-25deg); } }
@keyframes walk-upper-r { 0% { transform: translateX(-50%) rotate(25deg); } 100% { transform: translateX(-50%) rotate(-25deg); } }
@keyframes walk-lower { 0% { transform: translateX(-50%) rotate(-5deg); } 100% { transform: translateX(-50%) rotate(-20deg); } }

/* ================== ANIMACJA ATAKU: KILOF (OBURĄCZ) ================== */
/* 
   Animacja składa się z 3 faz: 
   0% Start 
   35% - Pełny zamach do tyłu nad głową 
   65% - Potężne uderzenie (tu zsynchronizowany jest Hitbox)
   100% - Powrót
*/

/* 1. FRONT (Południe) */
.dir-s.state-attack-pickaxe .torso, .dir-se.state-attack-pickaxe .torso, .dir-sw.state-attack-pickaxe .torso { animation: p-torso-s 0.5s cubic-bezier(0.2, 0, 0.2, 1) forwards; }
.dir-s.state-attack-pickaxe .arm-r.upper, .dir-se.state-attack-pickaxe .arm-r.upper, .dir-sw.state-attack-pickaxe .arm-r.upper { animation: p-up-r-s 0.5s cubic-bezier(0.2, 0, 0.2, 1) forwards; z-index: 10; }
.dir-s.state-attack-pickaxe .arm-r .lower, .dir-se.state-attack-pickaxe .arm-r .lower, .dir-sw.state-attack-pickaxe .arm-r .lower { animation: p-low-r-s 0.5s cubic-bezier(0.2, 0, 0.2, 1) forwards; }
.dir-s.state-attack-pickaxe .arm-l.upper, .dir-se.state-attack-pickaxe .arm-l.upper, .dir-sw.state-attack-pickaxe .arm-l.upper { animation: p-up-l-s 0.5s cubic-bezier(0.2, 0, 0.2, 1) forwards; z-index: 10; }
.dir-s.state-attack-pickaxe .arm-l .lower, .dir-se.state-attack-pickaxe .arm-l .lower, .dir-sw.state-attack-pickaxe .arm-l .lower { animation: p-low-l-s 0.5s cubic-bezier(0.2, 0, 0.2, 1) forwards; }
.dir-s.state-attack-pickaxe .item-weapon, .dir-se.state-attack-pickaxe .item-weapon, .dir-sw.state-attack-pickaxe .item-weapon { animation: p-wep-s 0.5s cubic-bezier(0.2, 0, 0.2, 1) forwards; }

@keyframes p-torso-s { 0% { transform: translateX(-50%) rotate(0deg); } 35% { transform: translateX(-50%) rotate(-15deg); } 65% { transform: translateX(-50%) rotate(25deg); } 100% { transform: translateX(-50%) rotate(0deg); } }
@keyframes p-up-r-s { 0% { transform: translateX(-50%) rotate(25deg); } 35% { transform: translateX(-50%) rotate(-160deg); } 65% { transform: translateX(-50%) rotate(50deg); } 100% { transform: translateX(-50%) rotate(25deg); } }
@keyframes p-low-r-s { 0% { transform: translateX(-50%) rotate(-55deg); } 35% { transform: translateX(-50%) rotate(-60deg); } 65% { transform: translateX(-50%) rotate(10deg); } 100% { transform: translateX(-50%) rotate(-55deg); } }
@keyframes p-up-l-s { 0% { transform: translateX(-50%) rotate(-25deg); } 35% { transform: translateX(-50%) rotate(-130deg); } 65% { transform: translateX(-50%) rotate(30deg); } 100% { transform: translateX(-50%) rotate(-25deg); } }
@keyframes p-low-l-s { 0% { transform: translateX(-50%) rotate(55deg); } 35% { transform: translateX(-50%) rotate(-70deg); } 65% { transform: translateX(-50%) rotate(10deg); } 100% { transform: translateX(-50%) rotate(55deg); } }
@keyframes p-wep-s { 0% { transform: translate(-50%, 0) rotate(-35deg); } 35% { transform: translate(-50%, 0) rotate(110deg); } 65% { transform: translate(-50%, 0) rotate(-70deg); } 100% { transform: translate(-50%, 0) rotate(-35deg); } }

/* 2. BOK (Wschód/Zachód) */
.dir-e.state-attack-pickaxe .torso, .dir-w.state-attack-pickaxe .torso { animation: p-torso-e 0.5s cubic-bezier(0.2, 0, 0.2, 1) forwards; }
.dir-e.state-attack-pickaxe .arm-r.upper, .dir-w.state-attack-pickaxe .arm-r.upper { animation: p-up-r-e 0.5s cubic-bezier(0.2, 0, 0.2, 1) forwards; }
.dir-e.state-attack-pickaxe .arm-r .lower, .dir-w.state-attack-pickaxe .arm-r .lower { animation: p-low-r-e 0.5s cubic-bezier(0.2, 0, 0.2, 1) forwards; }
.dir-e.state-attack-pickaxe .arm-l.upper, .dir-w.state-attack-pickaxe .arm-l.upper { animation: p-up-l-e 0.5s cubic-bezier(0.2, 0, 0.2, 1) forwards; }
.dir-e.state-attack-pickaxe .arm-l .lower, .dir-w.state-attack-pickaxe .arm-l .lower { animation: p-low-l-e 0.5s cubic-bezier(0.2, 0, 0.2, 1) forwards; }
.dir-e.state-attack-pickaxe .item-weapon, .dir-w.state-attack-pickaxe .item-weapon { animation: p-wep-e 0.5s cubic-bezier(0.2, 0, 0.2, 1) forwards; }

@keyframes p-torso-e { 0% { transform: translateX(-50%) rotate(0deg); } 35% { transform: translateX(-50%) rotate(-20deg); } 65% { transform: translateX(-50%) rotate(30deg); } 100% { transform: translateX(-50%) rotate(0deg); } }
@keyframes p-up-r-e { 0% { transform: translateX(-50%) rotate(0deg); } 35% { transform: translateX(-50%) rotate(-170deg); } 65% { transform: translateX(-50%) rotate(60deg); } 100% { transform: translateX(-50%) rotate(0deg); } }
@keyframes p-low-r-e { 0% { transform: translateX(-50%) rotate(-40deg); } 35% { transform: translateX(-50%) rotate(-80deg); } 65% { transform: translateX(-50%) rotate(10deg); } 100% { transform: translateX(-50%) rotate(-40deg); } }
@keyframes p-up-l-e { 0% { transform: translateX(-50%) rotate(20deg); } 35% { transform: translateX(-50%) rotate(-150deg); } 65% { transform: translateX(-50%) rotate(80deg); } 100% { transform: translateX(-50%) rotate(20deg); } }
@keyframes p-low-l-e { 0% { transform: translateX(-50%) rotate(-40deg); } 35% { transform: translateX(-50%) rotate(-80deg); } 65% { transform: translateX(-50%) rotate(10deg); } 100% { transform: translateX(-50%) rotate(-40deg); } }
@keyframes p-wep-e { 0% { transform: translate(-50%, 0) rotate(15deg); } 35% { transform: translate(-50%, 0) rotate(100deg); } 65% { transform: translate(-50%, 0) rotate(-60deg); } 100% { transform: translate(-50%, 0) rotate(15deg); } }

/* 3. TYŁ (Północ) */
.dir-n.state-attack-pickaxe .torso, .dir-nw.state-attack-pickaxe .torso, .dir-ne.state-attack-pickaxe .torso { animation: p-torso-n 0.5s cubic-bezier(0.2, 0, 0.2, 1) forwards; }
.dir-n.state-attack-pickaxe .arm-r.upper, .dir-nw.state-attack-pickaxe .arm-r.upper, .dir-ne.state-attack-pickaxe .arm-r.upper { animation: p-up-r-n 0.5s cubic-bezier(0.2, 0, 0.2, 1) forwards; z-index: 10;}
.dir-n.state-attack-pickaxe .arm-r .lower, .dir-nw.state-attack-pickaxe .arm-r .lower, .dir-ne.state-attack-pickaxe .arm-r .lower { animation: p-low-r-n 0.5s cubic-bezier(0.2, 0, 0.2, 1) forwards; }
.dir-n.state-attack-pickaxe .arm-l.upper, .dir-nw.state-attack-pickaxe .arm-l.upper, .dir-ne.state-attack-pickaxe .arm-l.upper { animation: p-up-l-n 0.5s cubic-bezier(0.2, 0, 0.2, 1) forwards; z-index: 10;}
.dir-n.state-attack-pickaxe .arm-l .lower, .dir-nw.state-attack-pickaxe .arm-l .lower, .dir-ne.state-attack-pickaxe .arm-l .lower { animation: p-low-l-n 0.5s cubic-bezier(0.2, 0, 0.2, 1) forwards; }
.dir-n.state-attack-pickaxe .item-weapon, .dir-nw.state-attack-pickaxe .item-weapon, .dir-ne.state-attack-pickaxe .item-weapon { animation: p-wep-n 0.5s cubic-bezier(0.2, 0, 0.2, 1) forwards; }

@keyframes p-torso-n { 0% { transform: translateX(-50%) rotate(0deg); } 35% { transform: translateX(-50%) rotate(15deg); } 65% { transform: translateX(-50%) rotate(-25deg); } 100% { transform: translateX(-50%) rotate(0deg); } }
@keyframes p-up-r-n { 0% { transform: translateX(-50%) rotate(-25deg); } 35% { transform: translateX(-50%) rotate(160deg); } 65% { transform: translateX(-50%) rotate(-50deg); } 100% { transform: translateX(-50%) rotate(-25deg); } }
@keyframes p-low-r-n { 0% { transform: translateX(-50%) rotate(55deg); } 35% { transform: translateX(-50%) rotate(60deg); } 65% { transform: translateX(-50%) rotate(-10deg); } 100% { transform: translateX(-50%) rotate(55deg); } }
@keyframes p-up-l-n { 0% { transform: translateX(-50%) rotate(25deg); } 35% { transform: translateX(-50%) rotate(130deg); } 65% { transform: translateX(-50%) rotate(-30deg); } 100% { transform: translateX(-50%) rotate(25deg); } }
@keyframes p-low-l-n { 0% { transform: translateX(-50%) rotate(-55deg); } 35% { transform: translateX(-50%) rotate(70deg); } 65% { transform: translateX(-50%) rotate(-10deg); } 100% { transform: translateX(-50%) rotate(-55deg); } }
@keyframes p-wep-n { 0% { transform: translate(-50%, 0) rotate(35deg); } 35% { transform: translate(-50%, 0) rotate(-110deg); } 65% { transform: translate(-50%, 0) rotate(70deg); } 100% { transform: translate(-50%, 0) rotate(35deg); } }

/* ================== ATAK BEZ BRONI ================== */
.state-attack-unarmed .arm-r.upper { animation: attack-swing-unarmed 0.4s cubic-bezier(0.2, 0, 0.2, 1) forwards; }
.state-attack-unarmed .arm-r .lower { transform: translateX(-50%) rotate(-20deg); }

@keyframes attack-swing-unarmed { 0% { transform: translateX(-50%) rotate(0deg); } 50% { transform: translateX(-50%) rotate(-90deg); } 100% { transform: translateX(-50%) rotate(0deg); } }

/* ================== HITBOX ================== */
.test-hitbox { position: absolute; width: 65px; height: 65px; background: radial-gradient(circle, rgba(255,0,0,0.6) 0%, rgba(255,0,0,0) 70%); border: 2px solid rgba(255, 0, 0, 0.5); transform: translate(-50%, -50%); border-radius: 50%; pointer-events: none; z-index: 100; animation: hitbox-fade 0.175s forwards; }
@keyframes hitbox-fade { 0% { opacity: 1; transform: translate(-50%, -50%) scale(0.5); } 100% { opacity: 0; transform: translate(-50%, -50%) scale(1.3); } }

/* TRYN EDYCJJI W ANIMATORZE - Nadpisuje defaultowe animacje CSS */
.edit-mode .bone {
    animation: none !important;
    transition: none !important;
}