/* ASCII Idle — Dark Theme */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --bg: #0a0a0a;
    --text: #cccccc;
    --sidebar: #111111;
    --sidebar-border: #333333;
    --stat-base: #ffffff;
    --stat-bonus: #44ff44;
    --hp-bar: #ff4444;
    --mana-bar: #4444ff;
    --xp-bar: #ffaa00;
    --highlight: #ffff44;
    --button: #333333;
    --button-hover: #555555;
    --button-text: #cccccc;
    --gold: #ffcc00;
}

html, body {
    width: 100%;
    height: 100%;
    overflow: hidden;
    background: var(--bg);
    color: var(--text);
    font-family: 'Courier New', Courier, monospace;
    font-size: 14px;
}

#app {
    display: flex;
    width: 100%;
    height: 100%;
}

/* Game canvas — full screen */
#game-container {
    flex: 1;
    position: relative;
    overflow: hidden;
}

#game-canvas {
    display: block;
    width: 100%;
    height: 100%;
}

/* ─── Custom tooltip ────────────────────────────────────────────────────────── */

#tooltip {
    display: none;
    position: fixed;
    z-index: 9999;
    background: rgba(10, 10, 10, 0.95);
    border: 1px solid #444;
    color: #ccc;
    font-family: 'Courier New', Courier, monospace;
    font-size: 11px;
    line-height: 1.5;
    padding: 5px 8px;
    pointer-events: none;
    max-width: 260px;
    white-space: pre-wrap;
}

/* ─── Corner overlays ──────────────────────────────────────────────────────── */

#net-status {
    position: absolute;
    top: 8px;
    left: 8px;
    z-index: 20;
    font-size: 11px;
    padding: 4px 8px;
    border-radius: 3px;
    background: rgba(0, 0, 0, 0.6);
    color: #888;
    pointer-events: none;
}

#target-panel {
    position: absolute;
    top: 12px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 20;
    min-width: 220px;
    background: rgba(10, 10, 10, 0.88);
    border: 1px solid #333;
    padding: 8px 12px;
    pointer-events: none;
}

#loot-panel {
    position: absolute;
    bottom: 40px;
    left: 12px;
    z-index: 20;
    min-width: 200px;
    background: rgba(10, 10, 10, 0.88);
    border: 1px solid #333;
    padding: 8px 12px;
    display: none;
}

/* ─── Bottom HUD ───────────────────────────────────────────────────────────── */

#hud {
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: min(540px, 68%);
    padding: 8px 10px;
    background: rgba(10, 10, 10, 0.85);
    border: 1px solid #2a2a2a;
    border-bottom: none;
    border-radius: 6px 6px 0 0;
    z-index: 20;
}

/* Ability cooldown row */
#hud-abilities {
    display: flex;
    align-items: flex-end;
    gap: 6px;
    margin-bottom: 5px;
}

#hud-ability-slots {
    display: flex;
    gap: 4px;
    flex: 1;
}

.hud-ab-slot {
    flex: 1;
    background: #0d0d0d;
    border: 1px solid #2a2a2a;
    padding: 4px 5px 6px;
    min-height: 36px;
    display: flex;
    flex-direction: column;
    gap: 2px;
    position: relative;
    overflow: hidden;
}

.hud-ab-slot.on-cooldown .hud-ab-name {
    color: #444;
}

.hud-ab-key {
    font-size: 9px;
    color: #555;
    line-height: 1;
}

.hud-ab-name {
    font-size: 10px;
    color: #888;
    line-height: 1.2;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    transition: color 0.1s;
}

.hud-ab-cd {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: #1a1a1a;
}

.hud-ab-cd-fill {
    height: 100%;
    background: #ff8844;
    width: 0%;
    transition: width 0.1s;
}

#hud-quickslots {
    display: flex;
    gap: 4px;
}

.hud-qs {
    width: 36px;
    height: 36px;
    background: #0d0d0d;
    border: 1px dashed #2a2a2a;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #2a2a2a;
    font-size: 18px;
}

/* HP/XP bars */
#hud-hp {
    position: relative;
    height: 16px;
    background: #1a1a1a;
    border: 1px solid #2a2a2a;
    margin-bottom: 3px;
    overflow: hidden;
}

#hud-xp {
    position: relative;
    height: 10px;
    background: #1a1a1a;
    border: 1px solid #2a2a2a;
    overflow: hidden;
}

.hud-bar-fill {
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    width: 0%;
    transition: width 0.1s;
}

.hud-bar-fill.hp-bar  { background: var(--hp-bar); }
.hud-bar-fill.xp-bar  { background: var(--xp-bar); }

.hud-bar-label {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 10px;
    color: rgba(255, 255, 255, 0.85);
    text-shadow: 0 0 4px rgba(0, 0, 0, 1);
    white-space: nowrap;
    pointer-events: none;
    line-height: 1;
}

/* ─── Nav hex buttons ──────────────────────────────────────────────────────── */

#hud-nav {
    position: absolute;
    bottom: 8px;
    right: 8px;
    display: flex;
    gap: 6px;
    z-index: 25;
}

.hex-btn {
    width: 44px;
    height: 44px;
    clip-path: polygon(25% 0%, 75% 0%, 100% 50%, 75% 100%, 25% 100%, 0% 50%);
    background: #1c1c1c;
    border: none;
    color: #666;
    cursor: pointer;
    font-family: 'Courier New', Courier, monospace;
    font-size: 13px;
    font-weight: bold;
    transition: background 0.15s, color 0.15s;
    outline: none;
}

.hex-btn:hover {
    background: #2e2e2e;
    color: #ccc;
}

.hex-btn.active {
    background: #222210;
    color: var(--highlight);
}

/* ─── Pop-out windows ──────────────────────────────────────────────────────── */

.game-window {
    display: none;
    position: fixed;
    right: 12px;
    bottom: 64px;
    width: 280px;
    max-height: 72vh;
    overflow-y: auto;
    background: #111;
    border: 1px solid #2e2e2e;
    border-radius: 5px;
    z-index: 50;
}

.game-window.open {
    display: block;
}

.game-window-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 12px;
    background: #0d0d0d;
    border-bottom: 1px solid #222;
    position: sticky;
    top: 0;
    z-index: 1;
}

.game-window-title {
    font-size: 11px;
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--highlight);
}

.game-window-close {
    background: none;
    border: none;
    color: #444;
    cursor: pointer;
    font-family: inherit;
    font-size: 12px;
    padding: 0;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.1s;
}

.game-window-close:hover {
    color: #fff;
}

/* Panel inner padding inside windows */
#stats-panel,
#equipment-panel,
#inventory-panel,
#abilities-panel,
#quests-panel {
    padding: 8px 12px;
}

/* ─── Panel shared styles ──────────────────────────────────────────────────── */

.panel-title {
    font-weight: bold;
    color: var(--highlight);
    margin-bottom: 4px;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* Stats panel */
.stat-section {
    margin-bottom: 6px;
}

.stat-header {
    font-weight: bold;
    color: var(--stat-base);
    font-size: 14px;
    margin-bottom: 4px;
}

.stat-bar {
    display: flex;
    align-items: center;
    gap: 4px;
    margin-bottom: 2px;
    font-size: 11px;
}

.bar-label {
    width: 24px;
    color: var(--text);
}

.bar-track {
    flex: 1;
    height: 10px;
    background: #222;
    border: 1px solid #444;
    position: relative;
}

.bar-fill {
    height: 100%;
    transition: width 0.1s;
}

.bar-fill.hp-bar        { background: var(--hp-bar); }
.bar-fill.xp-bar        { background: var(--xp-bar); }
.bar-fill.enemy-hp-bar  { background: #ff8800; }

.bar-value {
    font-size: 10px;
    min-width: 80px;
    text-align: right;
    color: #999;
}

.stat-line {
    font-size: 12px;
    color: var(--text);
    margin: 2px 0;
}

.stat-val {
    color: var(--stat-base);
    font-weight: bold;
}

.gold-val {
    color: var(--gold);
}

.stat-alloc {
    margin-top: 4px;
}

.stat-row {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 3px;
    font-size: 12px;
}

.stat-name {
    width: 32px;
    color: var(--text);
    font-weight: bold;
}

.stat-base {
    color: var(--stat-base);
    min-width: 36px;
    text-align: right;
}

.stat-bonus {
    color: var(--stat-bonus);
    font-size: 11px;
}

.btn-alloc {
    background: var(--button);
    color: var(--button-text);
    border: 1px solid #555;
    width: 22px;
    height: 22px;
    cursor: pointer;
    font-family: inherit;
    font-size: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

.btn-alloc:hover {
    background: var(--button-hover);
}

.btn-respec {
    color: #ff6666;
}

/* Target section inside target-panel overlay */
.target-section {
    padding-top: 0;
}

.target-header {
    font-size: 12px;
    color: #aaa;
    margin-bottom: 4px;
}

/* Equipment panel */
.equip-slot {
    display: flex;
    align-items: center;
    gap: 4px;
    margin-bottom: 2px;
    font-size: 12px;
}

.equip-label {
    width: 70px;
    color: #888;
}

.equip-item {
    flex: 1;
    cursor: help;
}

.equip-empty {
    flex: 1;
    color: #444;
    font-style: italic;
}

.btn-unequip {
    background: none;
    border: 1px solid #555;
    color: #ff6666;
    width: 18px;
    height: 18px;
    cursor: pointer;
    font-family: inherit;
    font-size: 11px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-unequip:hover {
    background: #331111;
}

/* Inventory panel */
#inventory-window {
    width: 296px;
}

.inv-grid {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 4px;
    padding: 4px 0;
}

.inv-slot {
    width: 40px;
    height: 40px;
    position: relative;
    border: 1px solid #2a2a2a;
    border-radius: 3px;
    background: #0d0d0d;
    box-sizing: border-box;
}

.inv-slot-empty {
    background: #0d0d0d;
}

.inv-slot-filled {
    cursor: grab;
    background: #111;
}

.inv-slot-filled:hover {
    background: #1a1a1a;
}

.inv-slot-filled.dragging {
    opacity: 0.4;
}

.inv-slot-filled.drag-over {
    border-color: var(--highlight) !important;
    background: #1a1a00;
}

.inv-slot-icon {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 28px;
    height: 28px;
    pointer-events: none;
}

.inv-slot-qty {
    position: absolute;
    bottom: 1px;
    right: 3px;
    font-size: 9px;
    color: #ccc;
    line-height: 1;
    text-shadow: 0 0 3px #000, 0 0 3px #000;
    pointer-events: none;
}

.inv-slot-drop {
    display: none;
    position: absolute;
    top: 1px;
    right: 1px;
    background: rgba(0, 0, 0, 0.75);
    border: none;
    color: #ff8844;
    width: 13px;
    height: 13px;
    font-size: 8px;
    cursor: pointer;
    border-radius: 2px;
    padding: 0;
    line-height: 13px;
    text-align: center;
    font-family: inherit;
}

.inv-slot-filled:hover .inv-slot-drop {
    display: block;
}

.inv-slot-drop:hover {
    background: rgba(80, 20, 0, 0.9);
    color: #ffaa44;
}

.inv-slot-upgrade {
    position: absolute;
    bottom: 2px;
    left: 2px;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #44ff88;
    box-shadow: 0 0 4px #44ff88;
    pointer-events: none;
}

.inv-slot-upgrade.inv-slot-upgrade-ambiguous {
    background: #888;
    box-shadow: none;
}

/* Abilities panel */
#abilities-window {
    width: 700px !important;
}

#abilities-panel {
    min-height: 20px;
}

.ability-section-label {
    font-size: 10px;
    color: #4dc8b0;
    text-transform: uppercase;
    letter-spacing: 2px;
    margin: 0 0 8px 0;
}

/* Active slots */
.active-slots-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
    margin-bottom: 16px;
}

.active-slot-card {
    border: 1px solid #2a2a3a;
    border-radius: 8px;
    background: #0d0d0d;
    min-height: 96px;
    padding: 10px 8px;
    position: relative;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    gap: 4px;
    transition: border-color 0.1s, background 0.1s;
}

.active-slot-card:hover {
    border-color: #444;
    background: #111;
}

.active-slot-card.ability-cooldown {
    opacity: 0.6;
}

.active-slot-number {
    font-size: 11px;
    color: #444;
    font-weight: bold;
    line-height: 1;
}

.active-slot-filled .active-slot-number {
    color: #666;
}

.active-slot-name {
    font-size: 11px;
    font-weight: bold;
    line-height: 1.2;
}

.active-slot-desc {
    font-size: 10px;
    color: #555;
    line-height: 1.3;
    flex: 1;
}

.active-slot-cd {
    font-size: 10px;
    color: #ff8844;
    line-height: 1;
    min-height: 12px;
}

/* Passive slots */
.passive-slots-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
}

.passive-slot-card {
    border: 1px solid #2a2a3a;
    border-radius: 8px;
    background: #0d0d14;
    padding: 10px 10px 12px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.passive-slot-label {
    font-size: 11px;
    color: #4dc8b0;
    font-weight: bold;
    line-height: 1;
}

.passive-slot-req {
    font-size: 10px;
    color: #444;
    text-transform: uppercase;
    letter-spacing: 1px;
    line-height: 1.5;
}

.passive-slot-name-text {
    font-size: 11px;
    font-weight: bold;
    line-height: 1.2;
}

.passive-slot-desc-text {
    font-size: 10px;
    color: #555;
    line-height: 1.3;
}

.passive-slot-empty-msg {
    color: #444;
    font-size: 11px;
    grid-column: span 2;
}

/* Loot panel */
.loot-row {
    display: flex;
    align-items: center;
    gap: 4px;
    margin-bottom: 3px;
    font-size: 12px;
}

.loot-icon {
    font-size: 14px;
    width: 16px;
    text-align: center;
}

.loot-name {
    flex: 1;
    color: var(--text);
}

.loot-qty {
    color: #888;
    font-size: 11px;
}

.btn-loot {
    background: var(--button);
    color: var(--button-text);
    border: 1px solid #555;
    padding: 1px 6px;
    cursor: pointer;
    font-family: inherit;
    font-size: 11px;
}

.btn-loot:hover {
    background: var(--button-hover);
}

/* Quests panel */
#quests-panel {
    min-height: 20px;
}

.quest-row {
    display: flex;
    align-items: center;
    gap: 5px;
    margin-bottom: 3px;
    font-size: 12px;
}

.quest-dot {
    width: 12px;
    text-align: center;
    flex-shrink: 0;
}

.quest-active .quest-dot  { color: #ffcc00; }
.quest-active .quest-name { color: var(--text); }
.quest-done   .quest-dot  { color: #44cc44; }
.quest-done   .quest-name { color: #666; text-decoration: line-through; }

/* Dialogue box */
#dialogue-box {
    display: none;
    position: absolute;
    bottom: 120px;
    left: 50%;
    transform: translateX(-50%);
    min-width: 280px;
    max-width: 480px;
    background: rgba(10, 10, 10, 0.92);
    border: 1px solid #555;
    padding: 10px 14px;
    z-index: 50;
    pointer-events: auto;
}

.dlg-name {
    color: #ffcc88;
    font-size: 12px;
    font-weight: bold;
    margin-bottom: 6px;
}

.dlg-text {
    color: #cccccc;
    font-size: 13px;
    line-height: 1.5;
    margin-bottom: 8px;
}

.dlg-hint {
    color: #666;
    font-size: 11px;
    text-align: right;
}

.dlg-quest-title {
    color: #ffcc00;
    font-size: 12px;
    font-weight: bold;
    margin-top: 6px;
}

.dlg-quest-desc {
    color: #aaa;
    font-size: 11px;
    margin: 3px 0 8px;
    line-height: 1.4;
}

.dlg-buttons {
    display: flex;
    gap: 8px;
    margin-top: 4px;
}

.dlg-btn {
    flex: 1;
    padding: 4px 8px;
    font-family: inherit;
    font-size: 12px;
    cursor: pointer;
    border: 1px solid #555;
    background: var(--button);
    color: var(--button-text);
}

.dlg-btn:hover { background: var(--button-hover); }
.dlg-btn-accept { border-color: #44aa44; color: #88dd88; }
.dlg-btn-refuse { border-color: #aa4444; color: #dd8888; }

/* ── Shop modal ─────────────────────────────────────────────────────────────── */
#shop-modal {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 360px;
    max-height: 72vh;
    overflow-y: auto;
    background: #111;
    border: 1px solid #2e2e2e;
    z-index: 200;
    display: flex;
    flex-direction: column;
    font-family: 'Courier New', Courier, monospace;
}

.shop-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    border-bottom: 1px solid #222;
    background: #0d0d0d;
    flex-shrink: 0;
    position: sticky;
    top: 0;
    z-index: 1;
}

.shop-title {
    font-size: 11px;
    font-weight: bold;
    color: var(--highlight);
    text-transform: uppercase;
    letter-spacing: 1px;
    flex: 1;
}

.shop-gold {
    font-size: 11px;
    color: var(--gold);
}

.shop-close {
    background: none;
    border: none;
    color: #444;
    cursor: pointer;
    font-family: inherit;
    font-size: 12px;
    padding: 0;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.1s;
}
.shop-close:hover { color: #fff; }

.shop-body { padding: 4px 8px; }

.shop-item-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 4px;
    border-bottom: 1px solid #1a1a1a;
}
.shop-item-row:last-child { border-bottom: none; }

.shop-item-icon {
    font-size: 14px;
    width: 16px;
    text-align: center;
    flex-shrink: 0;
}

.shop-item-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.shop-item-name {
    font-size: 12px;
    color: #ccc;
}

.shop-item-stats {
    font-size: 10px;
    color: #666;
    margin-top: 1px;
}

.shop-item-price {
    font-size: 11px;
    color: var(--gold);
    flex-shrink: 0;
    min-width: 32px;
    text-align: right;
}

.shop-btn-buy {
    padding: 3px 8px;
    font-family: inherit;
    font-size: 11px;
    cursor: pointer;
    border: 1px solid #44aa44;
    background: var(--button);
    color: #88dd88;
    flex-shrink: 0;
}
.shop-btn-buy:hover:not(:disabled) { background: var(--button-hover); }
.shop-btn-buy:disabled {
    border-color: #333;
    color: #444;
    cursor: not-allowed;
}

/* Debug panel */
#debug-panel {
    display: none;
    position: fixed;
    bottom: 12px;
    left: 12px;
    z-index: 100;
    background: #1a1a1a;
    border: 1px solid #ff8844;
    border-radius: 4px;
    padding: 10px 12px;
    min-width: 260px;
    font-size: 12px;
    color: #cccccc;
}

.debug-title {
    font-weight: bold;
    color: #ff8844;
    margin-bottom: 8px;
    letter-spacing: 1px;
    font-size: 11px;
    text-transform: uppercase;
    cursor: move;
    user-select: none;
}

.debug-section {
    margin-bottom: 6px;
}

.debug-label {
    font-size: 10px;
    color: #888;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 4px;
}

.debug-row {
    display: flex;
    gap: 6px;
    align-items: center;
}

.debug-input {
    flex: 1;
    background: #0a0a0a;
    border: 1px solid #444;
    color: #ffffff;
    font-family: inherit;
    font-size: 12px;
    padding: 3px 6px;
    border-radius: 3px;
    outline: none;
}

.debug-input:focus {
    border-color: #ff8844;
}

.debug-btn {
    background: #333;
    border: 1px solid #555;
    color: #cccccc;
    font-family: inherit;
    font-size: 11px;
    padding: 3px 8px;
    border-radius: 3px;
    cursor: pointer;
}

.debug-btn:hover {
    background: #ff8844;
    color: #000;
    border-color: #ff8844;
}

.debug-info {
    margin-top: 4px;
    font-size: 11px;
    color: #888;
}

.debug-slider {
    width: 100%;
    margin-top: 4px;
    accent-color: #ff8844;
    cursor: pointer;
}

.debug-toggle {
    display: flex;
    align-items: center;
    font-size: 12px;
    color: #cccccc;
    cursor: pointer;
    user-select: none;
}

.debug-toggle input {
    accent-color: #ff8844;
    cursor: pointer;
}

/* Theme selector */
#theme-selector {
    position: fixed;
    top: 4px;
    right: 8px;
    z-index: 10;
}

#theme-selector select {
    background: var(--button);
    color: var(--button-text);
    border: 1px solid #555;
    font-family: inherit;
    font-size: 11px;
    padding: 2px 4px;
}

/* ═══════════════════════════════════════════════════════════════
   Skill Tree — modal overlay  (st- prefix)
   ═══════════════════════════════════════════════════════════════ */

.st-overlay {
    position: fixed;
    right: 12px;
    bottom: 64px;
    width: 360px;
    max-height: 72vh;
    overflow-y: auto;
    background: #111;
    border: 1px solid #2e2e2e;
    border-radius: 5px;
    z-index: 200;
    display: flex;
    flex-direction: column;
    font-family: 'Courier New', Courier, monospace;
}

.st-modal {
    /* merged into .st-overlay — no separate shell needed */
}

/* ── Header ─────────────────────────────────────────────────── */
.st-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 12px;
    border-bottom: 1px solid #222;
    background: #0d0d0d;
    flex-shrink: 0;
    position: sticky;
    top: 0;
    z-index: 1;
}

.st-title {
    font-size: 11px;
    font-weight: bold;
    color: var(--highlight);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.st-close {
    background: none;
    border: none;
    color: #444;
    cursor: pointer;
    font-family: inherit;
    font-size: 12px;
    padding: 0;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.1s;
}
.st-close:hover {
    color: #fff;
}

/* ── Dividers ────────────────────────────────────────────────── */
.st-divider {
    height: 1px;
    background: linear-gradient(90deg, transparent, #2a2a2a 20%, #2a2a2a 80%, transparent);
    flex-shrink: 0;
}
.st-divider-inner {
    margin: 10px 0;
    background: linear-gradient(90deg, transparent, #1e1e1e 20%, #1e1e1e 80%, transparent);
}

/* ── Slots pane ─────────────────────────────────────────────── */
.st-slots-pane {
    display: flex;
    flex-direction: column;
    padding: 10px 12px;
    background: #111;
    border-bottom: 1px solid #222;
    flex-shrink: 0;
    flex-wrap: wrap;
    gap: 14px;
}

.st-slot-group {
    width: 100%;
}

.st-slot-group-label {
    font-size: 9px;
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: #555;
    margin-bottom: 8px;
}

.st-slot-group-label-passive {
    color: #4a4a88;
}

.st-slots-grid {
    display: grid;
    gap: 6px;
}

.st-slots-grid-4 { grid-template-columns: repeat(4, 1fr); }
.st-slots-grid-2 { grid-template-columns: repeat(2, 1fr); }

.st-slot-card {
    position: relative;
    border: 1px solid #2a2a2a;
    border-radius: 5px;
    background: #0d0d0d;
    padding: 7px 8px 7px 8px;
    display: flex;
    flex-direction: column;
    gap: 3px;
    min-height: 48px;
    transition: border-color 0.12s;
}
.st-slot-card.st-slot-filled {
    border-color: #333;
    background: #111;
}
.st-slot-card.st-slot-passive.st-slot-filled {
    border-color: #2a2a44;
    background: #0e0e18;
}

.st-slot-badge {
    font-size: 9px;
    font-weight: bold;
    color: var(--highlight);
    letter-spacing: 0.5px;
    line-height: 1;
}
.st-slot-badge-passive {
    color: #7777bb;
}

.st-slot-label {
    font-size: 11px;
    font-weight: bold;
    color: #444;
    line-height: 1.2;
    word-break: break-word;
}
.st-slot-filled .st-slot-label {
    color: inherit;
}

.st-slot-clear {
    position: absolute;
    top: 4px;
    right: 4px;
    background: none;
    border: none;
    color: #444;
    cursor: pointer;
    font-family: inherit;
    font-size: 10px;
    padding: 0;
    line-height: 1;
    transition: color 0.1s;
}
.st-slot-clear:hover { color: #ff6666; }

/* ── Skills pane ─────────────────────────────────────────────── */
.st-skills-pane {
    overflow-y: auto;
    padding: 10px 12px;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px;
    align-content: start;
}

.st-skills-section-label {
    grid-column: span 2;
    font-size: 9px;
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: #555;
    padding-bottom: 4px;
    margin-top: 4px;
}
.st-skills-section-label:first-child { margin-top: 0; }
.st-skills-section-label-passive {
    color: #4a4a88;
}

.st-divider.st-divider-inner {
    grid-column: span 2;
}

.st-skill-card {
    border: 1px solid #222;
    border-radius: 5px;
    background: #0f0f0f;
    padding: 10px 12px;
    transition: border-color 0.12s, background 0.12s;
}
.st-skill-card:hover {
    border-color: #333;
    background: #141414;
}
.st-skill-card.st-skill-passive {
    border-color: #1a1a2e;
    background: #0c0c16;
}
.st-skill-card.st-skill-passive:hover {
    border-color: #252540;
    background: #0f0f1e;
}
.st-skill-card.st-skill-locked {
    border-color: #1a1a1a;
    background: #080808;
    opacity: 0.7;
    cursor: not-allowed;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 46px;
}
.st-skill-card.st-skill-locked:hover {
    border-color: #222;
    background: #0a0a0a;
}
.st-skill-locked-label {
    font-size: 11px;
    color: #555;
    letter-spacing: 0.05em;
    text-align: center;
}
.st-slot-card.st-slot-locked .st-slot-label {
    color: #444 !important;
    font-style: italic;
}

.st-skill-top {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.st-skill-name {
    font-size: 11px;
    font-weight: bold;
    line-height: 1.2;
}

.st-skill-badges {
    display: flex;
    gap: 4px;
    flex-wrap: wrap;
}

.st-assign-btn {
    background: #1c1c1c;
    border: 1px solid #333;
    border-radius: 3px;
    color: #555;
    cursor: pointer;
    font-family: inherit;
    font-size: 10px;
    font-weight: bold;
    width: 22px;
    height: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.1s, border-color 0.1s, background 0.1s;
}
.st-assign-btn:hover {
    background: #2a2a2a;
    border-color: #555;
    color: #ccc;
}
.st-assign-btn.st-assign-active {
    background: #1a2e1a;
    border-color: #3a7a3a;
    color: var(--stat-bonus);
    box-shadow: 0 0 6px rgba(68, 255, 68, 0.15);
}

/* Scrollbar styling */
::-webkit-scrollbar {
    width: 6px;
}
::-webkit-scrollbar-track {
    background: #111;
}
::-webkit-scrollbar-thumb {
    background: #444;
}
::-webkit-scrollbar-thumb:hover {
    background: #666;
}

/* ─── Map Editor ─────────────────────────────────────────────────────────────── */

#map-editor-palette {
    position: fixed;
    top: 80px;
    left: 20px;
    z-index: 8000;
    display: none;
    flex-direction: column;
    width: 220px;
    max-height: calc(100vh - 100px);
    background: rgba(10, 10, 10, 0.96);
    border: 1px solid #444;
    border-radius: 4px;
    font-family: 'Courier New', Courier, monospace;
    font-size: 12px;
    color: #ccc;
    overflow: hidden;
    box-shadow: 0 4px 20px rgba(0,0,0,0.7);
}

.editor-palette-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 6px 8px;
    background: #1a1a1a;
    border-bottom: 1px solid #333;
    cursor: move;
    user-select: none;
}

.editor-palette-title {
    font-size: 11px;
    font-weight: bold;
    color: #ffff44;
    letter-spacing: 1px;
}

.editor-close-btn {
    background: none;
    border: 1px solid #555;
    color: #aaa;
    cursor: pointer;
    padding: 1px 5px;
    font-size: 11px;
    border-radius: 2px;
}
.editor-close-btn:hover { background: #3a0000; color: #ff6666; border-color: #ff4444; }

.editor-tabs {
    display: flex;
    border-bottom: 1px solid #333;
}

.editor-tab {
    flex: 1;
    background: none;
    border: none;
    border-right: 1px solid #333;
    color: #888;
    cursor: pointer;
    padding: 5px 0;
    font-family: inherit;
    font-size: 11px;
}
.editor-tab:last-child { border-right: none; }
.editor-tab:hover { color: #ccc; background: #1a1a1a; }
.editor-tab.active { color: #ffff44; background: #111; border-bottom: 2px solid #ffff44; }

.editor-tab-content {
    display: none;
    flex-direction: column;
    overflow-y: auto;
    max-height: 260px;
}
.editor-tab-content.active { display: flex; }

.editor-item {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 5px 8px;
    cursor: pointer;
    border-bottom: 1px solid #1e1e1e;
}
.editor-item:hover { background: #1e1e1e; }
.editor-item.selected { background: #222200; outline: 1px solid #ffff44; }

.editor-item-char {
    font-size: 14px;
    font-weight: bold;
    width: 16px;
    text-align: center;
    flex-shrink: 0;
}

.editor-item-name {
    flex: 1;
    font-size: 11px;
    color: #aaa;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.editor-item-swatch {
    width: 10px;
    height: 10px;
    border-radius: 2px;
    flex-shrink: 0;
    opacity: 0.8;
}

.editor-tab-hint {
    padding: 4px 8px;
    font-size: 10px;
    color: #555;
    font-style: italic;
}

.editor-selected-row {
    padding: 5px 8px;
    font-size: 11px;
    color: #777;
    border-top: 1px solid #222;
    border-bottom: 1px solid #222;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.editor-selected-label { color: #ffff44; }

.editor-layer-row,
.editor-opacity-row {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 4px 8px;
    border-top: 1px solid #333;
}
.editor-layer-label {
    font-size: 11px;
    color: #888;
    min-width: 72px;
}
.editor-layer-btns {
    display: flex;
    align-items: center;
    gap: 3px;
    flex-wrap: wrap;
}
.editor-layer-btn {
    background: #222;
    border: 1px solid #444;
    color: #aaa;
    font-size: 11px;
    padding: 2px 6px;
    cursor: pointer;
    border-radius: 2px;
}
.editor-layer-btn.active {
    background: #4466aa;
    border-color: #6688cc;
    color: #fff;
}
.editor-brush-row {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 4px 8px;
    border-top: 1px solid #333;
    flex-wrap: wrap;
}
.editor-brush-btns {
    display: flex;
    gap: 2px;
}
.editor-brush-btn {
    background: #222;
    border: 1px solid #444;
    color: #ccc;
    padding: 2px 6px;
    font-size: 10px;
    cursor: pointer;
    border-radius: 2px;
}
.editor-brush-btn.active {
    background: #4466aa;
    border-color: #6688cc;
    color: #fff;
}
.editor-brush-size {
    width: 48px;
    background: #222;
    border: 1px solid #444;
    color: #ccc;
    padding: 2px 4px;
    font-size: 10px;
    border-radius: 2px;
}
.editor-layer-sep {
    color: #555;
    margin: 0 2px;
}
#editor-layer-opacity {
    width: 80px;
}
#editor-layer-opacity-val {
    font-size: 11px;
    color: #aaa;
    min-width: 30px;
}

.editor-history-row {
    display: flex;
    gap: 4px;
    padding: 5px 6px;
    border-bottom: 1px solid #222;
}

.editor-history-btn {
    flex: 1;
    background: #222;
    border: 1px solid #444;
    color: #aaa;
    cursor: pointer;
    padding: 3px 4px;
    font-family: inherit;
    font-size: 11px;
    border-radius: 2px;
}
.editor-history-btn:hover:not(:disabled) { background: #2a2a2a; color: #ccc; }
.editor-history-btn:disabled { opacity: 0.35; cursor: default; }

.editor-action-row {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 6px 6px;
}

.editor-action-btn {
    background: #1e1e1e;
    border: 1px solid #444;
    color: #aaa;
    cursor: pointer;
    padding: 4px 6px;
    font-family: inherit;
    font-size: 11px;
    border-radius: 2px;
    text-align: left;
}
.editor-action-btn:hover:not(:disabled) { background: #2a2a2a; color: #ccc; }
.editor-action-btn:disabled { opacity: 0.35; cursor: default; }

.editor-export-btn {
    background: #1a2a00;
    border-color: #4a6a00;
    color: #aadd44;
}
.editor-export-btn:hover { background: #243800 !important; color: #ccff66 !important; }

/* ── Editor mode indicator banner ── */

#map-editor-indicator {
    position: absolute;
    top: 6px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 7500;
    background: rgba(10, 10, 10, 0.88);
    border: 1px solid #444;
    border-radius: 3px;
    padding: 4px 12px;
    font-family: 'Courier New', Courier, monospace;
    font-size: 11px;
    color: #ffff44;
    pointer-events: none;
    white-space: nowrap;
}

/* ── Confirmation modal ── */

#map-editor-confirm {
    position: fixed;
    inset: 0;
    z-index: 9500;
    display: none;
    align-items: center;
    justify-content: center;
    background: rgba(0,0,0,0.65);
}

.editor-confirm-box {
    background: #111;
    border: 1px solid #555;
    border-radius: 4px;
    padding: 20px 24px;
    max-width: 340px;
    font-family: 'Courier New', Courier, monospace;
    color: #ccc;
    box-shadow: 0 4px 24px rgba(0,0,0,0.8);
}

.editor-confirm-title {
    font-size: 14px;
    font-weight: bold;
    color: #ffff44;
    margin-bottom: 8px;
}

.editor-confirm-body {
    font-size: 12px;
    color: #aaa;
    line-height: 1.5;
    margin-bottom: 14px;
}

.editor-confirm-body em { color: #88ccff; font-style: normal; }

.editor-confirm-btns {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
}

.editor-confirm-btn {
    background: #222;
    border: 1px solid #555;
    color: #ccc;
    cursor: pointer;
    padding: 5px 14px;
    font-family: inherit;
    font-size: 12px;
    border-radius: 2px;
}
.editor-confirm-btn:hover { background: #2a2a2a; }
.editor-confirm-danger { border-color: #883333; color: #ff8888; }
.editor-confirm-danger:hover { background: #2a0000 !important; }
