﻿/* Fantasy RPG Inventory Styles */
@keyframes magical-glow {
    0%, 100% {
        box-shadow: 
            0 0 30px rgba(212, 175, 55, 0.4),
            0 0 60px rgba(184, 134, 11, 0.3),
            inset 0 0 40px rgba(139, 69, 19, 0.2),
            0 0 20px rgba(138, 43, 226, 0.2);
    }
    50% {
        box-shadow: 
            0 0 50px rgba(212, 175, 55, 0.6),
            0 0 100px rgba(184, 134, 11, 0.4),
            inset 0 0 60px rgba(139, 69, 19, 0.3),
            0 0 30px rgba(138, 43, 226, 0.3);
    }
}

@keyframes mystical-shine {
    0% {
        transform: translateX(-100%) translateY(-100%) rotate(45deg);
        opacity: 0;
    }
    50% {
        opacity: 0.3;
    }
    100% {
        transform: translateX(200%) translateY(200%) rotate(45deg);
        opacity: 0;
    }
}

@keyframes enchant-pulse {
    0%, 100% {
        filter: brightness(1) drop-shadow(0 0 8px rgba(212, 175, 55, 0.6));
    }
    50% {
        filter: brightness(1.15) drop-shadow(0 0 15px rgba(212, 175, 55, 0.9));
    }
}

/* --- Inventory UI: simple retro PSX-style (flat muddy palette, chunky bevels, mono) --- */
/* Mobile-first: screen-width based panel */
#inventory-modal-overlay.mmorpg-inventory-overlay {
    padding: 5vh 4vw;
    box-sizing: border-box;
    justify-content: center !important;
    align-items: stretch !important;
}

#inventory-modal.mmorpg-inventory-modal {
    width: 92vw;
    max-width: 92vw;
    height: 90vh;
    max-height: 90vh;
    min-height: 0;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    margin-top: auto;
    margin-bottom: auto;
    align-self: center;
}

/* PC: same full-height panel, fixed width */
@media (hover: hover) and (pointer: fine) and (min-width: 900px) {
    #inventory-modal-overlay.mmorpg-inventory-overlay {
        padding: 5vh 4vw;
    }

    #inventory-modal.mmorpg-inventory-modal {
        width: 480px;
        max-width: 480px;
        height: 90vh;
        max-height: 90vh;
    }

    #item-detail-modal.mmorpg-inventory-modal {
        width: 280px !important;
        max-width: 280px !important;
    }
}

#inventory-modal .mmorpg-inventory-header {
    flex-shrink: 0;
}

/* Stats only: floating band fixed above the scrollable equipment + items; edge-to-edge with modal panel */
.inventory-modal-pinned-top {
    flex: 0 0 auto;
    position: relative;
    z-index: 5;
    margin: 0 -1.25rem 0.6rem;
    padding: 0.35rem 0 0.65rem;
    background: linear-gradient(
        180deg,
        rgba(26, 24, 34, 0.97) 0%,
        var(--psx-panel) 38%,
        var(--psx-panel) 100%
    );
    border: 2px solid;
    border-color: var(--psx-hi) var(--psx-dark) var(--psx-dark) var(--psx-hi);
    box-shadow:
        0 8px 24px rgba(0, 0, 0, 0.45),
        inset 1px 1px 0 rgba(140, 130, 160, 0.1);
    box-sizing: border-box;
    overflow: visible;
}

/* Equipment + ITEMS: one shared scroll; items panel fills leftover height */
.inventory-modal-items-scroll {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
    scrollbar-width: thin;
    scrollbar-color: var(--psx-lite) var(--psx-deep);
    -webkit-overflow-scrolling: touch;
    display: flex;
    flex-direction: column;
    gap: 0;
    padding-right: 2px;
}

.inventory-modal-items-scroll > .inventory-equipment-section {
    flex: 0 0 auto;
}

.inventory-modal-items-scroll > .inventory-items-section {
    flex: 1 1 auto;
    min-height: 0;
    margin-bottom: 0;
    display: flex;
    flex-direction: column;
}

.inventory-modal-items-scroll > .inventory-items-section .mmorpg-section-header {
    flex-shrink: 0;
}

.inventory-modal-items-scroll > .inventory-items-section #inventory-grid,
.inventory-modal-items-scroll > .inventory-items-section .mmorpg-inventory-grid {
    flex: 1 1 auto;
    min-height: 8rem;
}

.inventory-modal-items-scroll::-webkit-scrollbar {
    width: 10px;
}

.inventory-modal-items-scroll::-webkit-scrollbar-track {
    background: var(--psx-deep);
    border-left: 1px solid var(--psx-dark);
}

.inventory-modal-items-scroll::-webkit-scrollbar-thumb {
    background: var(--psx-lite);
    border: 1px solid;
    border-color: var(--psx-hi) var(--psx-dark) var(--psx-dark) var(--psx-hi);
}

.inventory-modal-items-scroll::-webkit-scrollbar-thumb:hover {
    background: #686480;
}

.mmorpg-inventory-overlay {
    background: rgba(12, 10, 18, 0.92);
    position: relative;
}

/* Static light scanlines, no animation */
.mmorpg-inventory-overlay::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: repeating-linear-gradient(
        180deg,
        rgba(255, 255, 255, 0.02) 0px,
        transparent 1px,
        transparent 3px
    );
    opacity: 0.45;
    pointer-events: none;
    z-index: 1;
}

.mmorpg-inventory-modal {
    --psx-panel: #2c2a38;
    --psx-deep: #1a1822;
    --psx-lite: #5a5668;
    --psx-dark: #0e0c12;
    --psx-text: #d8d0c8;
    --psx-hi: #9890a8;
    background: var(--psx-panel);
    border: solid 2px;
    border-color: var(--psx-hi) var(--psx-dark) var(--psx-dark) var(--psx-hi);
    border-radius: 0;
    position: relative;
    padding: 1rem 1.25rem 1.25rem;
    width: 92vw;
    max-width: 92vw;
    max-height: 88vh;
    overflow-y: auto;
    overflow-x: hidden;
    color: var(--psx-text);
    box-shadow:
        inset 1px 1px 0 rgba(140, 130, 160, 0.12),
        inset -1px -1px 0 rgba(0, 0, 0, 0.45),
        6px 6px 0 rgba(0, 0, 0, 0.55);
    scrollbar-width: thin;
    scrollbar-color: var(--psx-lite) var(--psx-deep);
    font-family: 'Courier New', 'Courier', monospace;
    font-size: 13px;
    z-index: 2;
    image-rendering: pixelated;
}

.mmorpg-inventory-modal::-webkit-scrollbar {
    width: 10px;
}

.mmorpg-inventory-modal::-webkit-scrollbar-track {
    background: var(--psx-deep);
    border-left: 1px solid var(--psx-dark);
}

.mmorpg-inventory-modal::-webkit-scrollbar-thumb {
    background: var(--psx-lite);
    border: 1px solid;
    border-color: var(--psx-hi) var(--psx-dark) var(--psx-dark) var(--psx-hi);
}

.mmorpg-inventory-modal::-webkit-scrollbar-thumb:hover {
    background: #686480;
}

.mmorpg-inventory-modal > * {
    position: relative;
    z-index: 1;
}

.mmorpg-inventory-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid var(--psx-dark);
    box-shadow: 0 1px 0 var(--psx-hi);
}

.mmorpg-inventory-title {
    margin: 0;
    color: #e8d868;
    font-weight: 700;
    font-size: 1.1rem;
    text-shadow: 1px 1px 0 #101018;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    font-family: 'Courier New', 'Courier', monospace;
}

.mmorpg-button {
    background: #3e3c48;
    border: 2px solid;
    border-color: #686580 #28262e #28262e #686580;
    border-radius: 0;
    color: var(--psx-text);
    padding: 6px 12px;
    cursor: pointer;
    font-family: 'Courier New', 'Courier', monospace;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    box-shadow: inset 1px 1px 0 rgba(255, 255, 255, 0.08), inset -1px -1px 0 rgba(0, 0, 0, 0.35);
    transition: none;
    text-shadow: 1px 1px 0 #101018;
}

.mmorpg-button:hover {
    background: #484658;
    color: #fff8e8;
    border-color: #686580 #28262e #28262e #686580;
    box-shadow: inset 1px 1px 0 rgba(255, 255, 255, 0.12), inset -1px -1px 0 rgba(0, 0, 0, 0.3);
}

.mmorpg-button:active {
    background: #2e2c36;
    border-color: #28262e #686580 #686580 #28262e;
    box-shadow: inset 1px 1px 4px rgba(0, 0, 0, 0.5);
}

/* Room strip + stage info (compact modern chip) */
.room-info-display-bar {
    color: rgba(226, 232, 240, 0.92);
    font-size: 12px;
    font-family: 'Inter', system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
    letter-spacing: 0.1px;
    line-height: 1.2;
    background: rgba(15, 23, 42, 0.62);
    border: 1px solid rgba(148, 163, 184, 0.22);
    border-radius: 12px;
    padding: 6px 10px;
    box-shadow: 0 10px 28px rgba(0, 0, 0, 0.28);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    text-shadow: none;
}

#room-info-times-btn {
    display: none;
    align-items: center;
    justify-content: center;
    margin-left: 6px;
    vertical-align: middle;
    min-width: 30px;
    min-height: 30px;
    padding: 0 8px;
    border: 1px solid rgba(148, 163, 184, 0.22);
    border-radius: 10px;
    background: rgba(148, 163, 184, 0.12);
    box-shadow: none;
    color: rgba(226, 232, 240, 0.9);
    font-weight: 700;
    font-size: 13px;
    line-height: 1;
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: 'Inter', system-ui, sans-serif;
}

#room-info-times-btn:hover {
    background: rgba(148, 163, 184, 0.18);
    border-color: rgba(148, 163, 184, 0.3);
}

#level-times-modal-content.level-times-modal-panel {
    max-width: min(560px, 92vw);
    max-height: 82vh;
}

#chat-player-modal-overlay.mmorpg-inventory-overlay {
    justify-content: center;
    align-items: center;
    z-index: 10003;
}

#chat-player-modal.player-profile-modal-panel {
    width: min(420px, 92vw);
    max-height: 85vh;
}

.player-profile-modal-section {
    margin-bottom: 0;
}

.player-profile-username-value {
    color: var(--psx-text, #d8d0c8);
    font-size: 1.05rem;
    font-weight: 700;
    word-break: break-word;
    font-family: 'Courier New', 'Courier', monospace;
    text-shadow: 1px 1px 0 #101018;
    padding: 0.15rem 0;
}

.player-profile-modal-actions {
    margin-top: 0.75rem;
}

.player-profile-modal-actions .mmorpg-button {
    flex: 1 1 auto;
    min-width: 120px;
}

.player-profile-invite-btn {
    background: linear-gradient(180deg, #0faf72 0%, #059669 52%, #047857 100%) !important;
    border-color: #34d399 #064e3b #064e3b #34d399 !important;
    color: #ecfdf5 !important;
}

.player-profile-invite-btn:hover {
    background: linear-gradient(180deg, #16c784 0%, #0d9668 52%, #05825f 100%) !important;
    color: #ffffff !important;
}

.level-times-modal-header {
    margin: 0 0 0.75rem 0;
    padding-bottom: 0.35rem;
    border-bottom: 2px solid var(--psx-dark, #0e0c12);
    box-shadow: 0 1px 0 var(--psx-hi, #9890a8);
}

.level-times-modal-title {
    margin: 0;
    font-size: 1rem;
    color: #e8d868;
    text-shadow: 1px 1px 0 #101018;
}

.level-times-modal-loot-panel {
    margin: 0 0 1rem 0;
    padding: 10px 12px;
    background: #1a1822;
    border: 2px solid;
    border-color: #0e0c12 #5a5668 #5a5668 #0e0c12;
    border-radius: 0;
    box-shadow:
        inset 1px 1px 0 rgba(110, 100, 128, 0.08),
        inset -1px -1px 0 rgba(0, 0, 0, 0.35);
}

.level-times-modal-loot-hint {
    margin: 0 0 0.65rem 0;
    font-size: 0.78rem;
    line-height: 1.45;
    color: #a8a0b8;
}

.level-times-modal-loot-list {
    font-size: 0.82rem;
    color: #d8d0c8;
    max-height: 32vh;
    overflow-y: auto;
}

.stage-info-loot-row {
    margin-bottom: 8px;
    padding: 8px;
    border: 2px solid;
    border-color: #28262e #4a4658 #4a4658 #28262e;
    background: #222028;
    color: #e8d868;
    font-weight: 700;
    text-shadow: 1px 1px 0 #101018;
}

.level-times-modal-leaderboard {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 2px solid #0e0c12;
    box-shadow: inset 0 1px 0 rgba(152, 144, 168, 0.15);
}

.level-times-modal-leaderboard h4 {
    margin: 0 0 0.5rem 0;
}

.level-times-modal-leaderboard-list {
    font-size: 0.85rem;
    color: #d8d0c8;
}

#level-times-modal-content table {
    width: 100%;
    border-collapse: collapse;
    font-family: 'Courier New', 'Courier', monospace;
}

#level-times-modal-content th,
#level-times-modal-content td {
    padding: 6px 8px 6px 0;
    border-bottom: 1px solid #28262e;
}

#level-times-modal-content th {
    color: #a8a0b8;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

#level-times-modal-content .stage-info-lb-rank {
    color: #e8d868;
    font-weight: 700;
    text-shadow: 1px 1px 0 #101018;
}

#level-times-modal-content .stage-info-lb-time {
    color: #fb923c;
    font-weight: 700;
}

.level-times-modal-actions {
    margin-top: 1rem;
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.level-times-modal-start-btn {
    background: linear-gradient(180deg, #0faf72 0%, #059669 52%, #047857 100%) !important;
    border-color: #34d399 #064e3b #064e3b #34d399 !important;
    color: #ecfdf5 !important;
}

.level-times-modal-start-btn:hover {
    background: linear-gradient(180deg, #16c784 0%, #0d9668 52%, #05825f 100%) !important;
    color: #ffffff !important;
}

.mmorpg-inventory-section {
    background: var(--psx-deep);
    border: 2px solid;
    border-color: var(--psx-dark) var(--psx-lite) var(--psx-lite) var(--psx-dark);
    border-radius: 0;
    padding: 0.75rem 0.875rem;
    margin-bottom: 0.875rem;
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
    box-shadow:
        inset 1px 1px 0 rgba(110, 100, 128, 0.08),
        inset -1px -1px 0 rgba(0, 0, 0, 0.35);
    position: relative;
    overflow: visible;
}

#inventory-stats-section {
    position: relative;
    z-index: 1;
    background: var(--psx-deep) !important;
    margin-bottom: 0.875rem;
    margin-left: -1.25rem;
    margin-right: -1.25rem;
    margin-top: 0;
    padding-left: 1.25rem;
    padding-right: 1.25rem;
    padding-top: 1rem;
    box-shadow:
        inset 1px 1px 0 rgba(110, 100, 128, 0.08),
        inset -1px -1px 0 rgba(0, 0, 0, 0.35);
    border: none;
    border-top: 2px solid var(--psx-lite);
    border-bottom: 2px solid var(--psx-lite);
}

/* Stats inside floating band: full width inside chrome, no horizontal inset */
.inventory-modal-pinned-top #inventory-stats-section {
    margin-left: 0;
    margin-right: 0;
    margin-bottom: 0;
    margin-top: 0;
    padding-left: 0;
    padding-right: 0;
    padding-top: 0.5rem;
    padding-bottom: 0.5rem;
}

.mmorpg-section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 2px solid var(--psx-dark);
    box-shadow: 0 1px 0 var(--psx-hi);
    padding-bottom: 0.35rem;
    margin-bottom: 0.35rem;
}

.mmorpg-section-title {
    color: #c8c0b0;
    margin: 0;
    font-size: 0.75rem;
    font-weight: 700;
    text-shadow: 1px 1px 0 #101018;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    font-family: 'Courier New', 'Courier', monospace;
}

.mmorpg-equipment-area {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    width: 100%;
    box-sizing: border-box;
    padding: 0.25rem 0;
}

.equipment-player-preview-stack {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 5px;
    flex: 0 0 auto;
}

.equipment-slots-row {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: center;
    gap: 4px;
    flex: 0 0 auto;
}

.equipment-slots-column {
    display: flex;
    flex-direction: column;
    gap: 3px;
    flex: 0 0 auto;
}

.equipment-slots-column .equipment-slot-cell {
    width: 2.35rem;
    height: 2.35rem;
    flex-shrink: 0;
}

.equipment-player-preview {
    display: flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    /* Canvas stays 72Ă—96; IK draw is scaled 2Ă— inside the same buffer. */
    min-width: 72px;
    min-height: 96px;
    overflow: hidden;
    padding: 0.25rem;
    background: rgba(14, 12, 18, 0.55);
    border: 1px solid;
    border-color: var(--psx-hi) var(--psx-dark) var(--psx-dark) var(--psx-hi);
    box-shadow: inset 1px 1px 0 rgba(120, 110, 140, 0.08);
}

#equipment-player-preview-canvas {
    display: block;
    width: 72px;
    height: 96px;
    image-rendering: pixelated;
    image-rendering: crisp-edges;
}

.equipment-player-preview-fallback {
    display: none;
    align-items: center;
    justify-content: center;
    text-align: center;
    width: 72px;
    min-height: 80px;
    padding: 0.5rem;
    font-size: 0.65rem;
    line-height: 1.35;
    color: #6b6578;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.equipment-slot-cell {
    --slot-accent: #5c5a68;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    justify-content: stretch;
    aspect-ratio: 1;
    width: 100%;
    min-height: 0;
    min-width: 0;
    padding: 0.12rem 0.1rem;
    border-radius: 0;
    border: 1px solid;
    border-color: #28262e #4a4658 #4a4658 #28262e;
    border-top-width: 2px;
    border-top-color: var(--slot-accent);
    background: #24222c;
    box-shadow:
        inset 1px 1px 0 rgba(120, 110, 140, 0.06),
        inset -1px -1px 0 rgba(0, 0, 0, 0.25);
    transition: none;
}

.equipment-slot-cell-inner {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.06rem;
    flex: 1;
    min-height: 0;
    text-align: center;
}

.equipment-slot-cell:hover {
    background: #2a2834;
    border-color: #343240 #544e62 #544e62 #343240;
    border-top-color: var(--slot-accent);
}

.equipment-slot-cell.filled {
    background: #2a2838;
}

.equipment-slot-emoji {
    font-size: 0.62rem;
    line-height: 1;
    flex-shrink: 0;
}

.equipment-slot-text {
    font-size: 0.44rem;
    font-weight: 700;
    line-height: 1.1;
    color: var(--slot-accent);
    font-family: 'Courier New', 'Courier', monospace;
    text-shadow: 1px 1px 0 #101018;
    overflow: hidden;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    word-break: break-word;
    max-width: 100%;
}

.equipment-slot-text--empty {
    color: #6b6578;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    font-size: 0.4rem;
}

/* Inventory modal â€” equipment slot tiles & label scale */
#equipment-area {
    --equipment-slot-text-scale: 1.6;
}

#equipment-area .equipment-slots-column .equipment-slot-cell,
#equipment-area .equipment-slots-row .equipment-slot-cell {
    width: calc(2.5rem * 1.15);
    height: 2.5rem;
    aspect-ratio: auto;
}

/* Icon in top region; label pinned to bottom of tile (matches smithing slot layout) */
#equipment-area .equipment-slot-cell-inner {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    gap: 0;
    flex: 1;
    min-height: 0;
    width: 100%;
    height: 100%;
    box-sizing: border-box;
    text-align: center;
}

#equipment-area .equipment-slot-emoji {
    font-size: calc(0.62rem * var(--equipment-slot-text-scale));
    flex: 1 1 auto;
    min-height: 0;
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

#equipment-area .equipment-slot-inner-empty {
    justify-content: center;
}

#equipment-area .equipment-slot-inner-empty .equipment-slot-emoji {
    flex: 0 0 auto;
}

#equipment-area .equipment-slot-text {
    font-size: calc(0.44rem * var(--equipment-slot-text-scale));
    flex-shrink: 0;
    margin-top: auto;
    width: 100%;
    padding-top: 2px;
    -webkit-line-clamp: 2;
    line-clamp: 2;
}

/* Empty slot: category icon at 30% opacity */
#equipment-area .equipment-slot-cell:not(.filled) .equipment-slot-emoji {
    opacity: 0.3;
}

#equipment-area .equipment-slot-cell.filled .equipment-slot-emoji {
    opacity: 1;
}

/* Smithing (blacksmith) â€” inventory-matching modal + armor list */
#smithing-modal.mmorpg-inventory-modal.smithing-modal-panel {
    max-width: min(520px, 94vw);
    max-height: 88vh;
    padding-left: 0;
    padding-right: 0;
    padding-bottom: 0;
}

#smithing-modal .mmorpg-inventory-header {
    padding-left: 1.25rem;
    padding-right: 1.25rem;
}

#smithing-modal .smithing-armors-section {
    margin-left: 0;
    margin-right: 0;
    margin-bottom: 0;
    padding-left: 0;
    padding-right: 0;
    padding-bottom: 0;
    border-left: none;
    border-right: none;
    border-bottom: none;
}

#smithing-modal .smithing-armor-list {
    gap: 0;
}

#smithing-modal .smithing-armor-card {
    padding-left: 0;
    padding-right: 0;
    padding-bottom: 0.7rem;
    border-left: none;
    border-right: none;
    border-radius: 0;
}

#smithing-modal .smithing-armor-name-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    padding-left: 1.25rem;
    padding-right: 1.25rem;
    box-sizing: border-box;
}

#smithing-modal .smithing-armor-name-row .smithing-armor-name {
    padding-left: 0;
    padding-right: 0;
    flex: 1;
    min-width: 0;
}

button.smithing-set-rename-btn,
button.smithing-boss-delete-btn {
    flex-shrink: 0;
    margin: 0;
    padding: 0.2rem 0.45rem;
    font-size: 0.55rem;
    line-height: 1.2;
    letter-spacing: 0.04em;
    min-height: unset;
}

button.smithing-set-rename-btn:active,
button.smithing-boss-delete-btn:active {
    transform: scale(0.96);
}

.smithing-admin-hint {
    font-size: 0.5rem;
    font-weight: 400;
    color: #8a8478;
    letter-spacing: 0.03em;
    text-transform: none;
    font-family: 'Courier New', 'Courier', monospace;
    margin-left: auto;
    padding-left: 0.5rem;
    text-align: right;
    line-height: 1.2;
}

#smithing-modal .smithing-armor-slots {
    padding-left: 0;
    padding-right: 0;
}

.smithing-armor-list {
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
}

.smithing-armor-card {
    background: var(--psx-deep);
    border: 2px solid;
    border-color: var(--psx-dark) var(--psx-lite) var(--psx-lite) var(--psx-dark);
    border-radius: 0;
    padding: 0.65rem 0.7rem 0.7rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    box-shadow:
        inset 1px 1px 0 rgba(110, 100, 128, 0.08),
        inset -1px -1px 0 rgba(0, 0, 0, 0.35);
}

.smithing-armor-name {
    margin: 0;
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.78rem;
    font-weight: 700;
    color: #e8d868;
    text-shadow: 1px 1px 0 #101018;
    letter-spacing: 0.06em;
    font-family: 'Courier New', 'Courier', monospace;
}

.smithing-armor-name .smithing-armor-emoji {
    font-size: 0.95rem;
    line-height: 1;
    flex-shrink: 0;
}

.smithing-armor-slots {
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
    gap: 3px;
    width: 100%;
    box-sizing: border-box;
    justify-content: space-between;
    align-items: stretch;
}

button.smithing-slot-btn.equipment-slot-cell {
    appearance: none;
    -webkit-appearance: none;
    margin: 0;
    cursor: pointer;
    font: inherit;
    flex: 1 1 0;
    min-width: 0;
    width: auto;
    max-width: none;
    min-height: 3.75rem;
    aspect-ratio: 1;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    justify-content: stretch;
}

/* Weapon row: shorter tiles (60% of armor slot height), emoji + label inline */
button.smithing-slot-btn.smithing-slot-btn--weapon-row.equipment-slot-cell {
    min-height: 2.25rem;
    max-height: 2.25rem;
    height: 2.25rem;
    aspect-ratio: unset;
}

button.smithing-slot-btn.smithing-slot-btn--weapon-row .equipment-slot-cell-inner {
    flex-direction: row;
    align-items: center;
    justify-content: flex-start;
    gap: 0.35rem;
    padding: 0.12rem 0.4rem;
    text-align: left;
}

button.smithing-slot-btn.smithing-slot-btn--weapon-row .equipment-slot-emoji:not(.armor-sheet-icon-host) {
    flex: 0 0 auto;
    min-height: unset;
    width: auto;
    font-size: clamp(0.9rem, 2.8vw, 1.1rem);
    line-height: 1;
}

button.smithing-slot-btn.smithing-slot-btn--weapon-row .equipment-slot-emoji.armor-sheet-icon-host {
    flex: 0 0 auto;
    width: auto;
    min-height: unset;
    align-self: center;
}

button.smithing-slot-btn.smithing-slot-btn--weapon-row .equipment-slot-text {
    flex: 1 1 auto;
    min-width: 0;
    text-align: left;
    font-size: clamp(0.62rem, 2.1vw, 0.76rem);
    line-height: 1.2;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

#smithing-modal .smithing-armor-slots--weapons {
    margin-top: 0.25rem;
    padding-left: 0.25rem;
    padding-right: 0.25rem;
    gap: 4px;
}

button.smithing-slot-btn.equipment-slot-cell:focus-visible {
    outline: 2px solid #e8d868;
    outline-offset: 2px;
}

button.smithing-slot-btn.equipment-slot-cell:active {
    background: #26242e;
    border-color: #28262e #686580 #686580 #28262e;
}

/* Icon area grows; label sits flush at bottom of tile */
button.smithing-slot-btn .equipment-slot-cell-inner {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    gap: 0;
    flex: 1;
    min-height: 0;
    width: 100%;
    height: 100%;
    box-sizing: border-box;
    text-align: center;
}

button.smithing-slot-btn .equipment-slot-emoji:not(.armor-sheet-icon-host) {
    flex: 1 1 auto;
    min-height: 0;
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

button.smithing-slot-btn .equipment-slot-emoji.armor-sheet-icon-host {
    flex: 1 1 auto;
    min-height: 0;
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Slot emoji fallback â€” inventory smithing size (sprites use armor-sheet host + larger canvas, not this font) */
button.smithing-slot-btn .equipment-slot-emoji {
    font-size: 1.24rem;
    line-height: 1;
}

/* Part name only â€” pinned to bottom */
button.smithing-slot-btn .equipment-slot-text,
button.smithing-slot-btn .equipment-slot-text--empty {
    flex-shrink: 0;
    margin-top: auto;
    width: 100%;
    padding-top: 2px;
    font-size: 0.9rem;
    line-height: 1.05;
    letter-spacing: 0.02em;
    font-weight: 700;
    -webkit-line-clamp: 1;
    line-clamp: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
}

button.smithing-slot-btn .equipment-slot-emoji.armor-sheet-icon-host,
.smithing-piece-icon-preview.armor-sheet-icon-host {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0;
    line-height: 0;
}

button.smithing-slot-btn .equipment-slot-emoji.armor-sheet-icon-host {
    width: calc(1.35rem * 1.5);
    height: calc(1.35rem * 1.5);
    min-width: 0;
    flex-shrink: 0;
    overflow: hidden;
    box-sizing: border-box;
}

.smithing-piece-icon-preview.armor-sheet-icon-host {
    overflow: hidden;
    box-sizing: border-box;
}

.armor-sheet-icon-canvas {
    image-rendering: pixelated;
    image-rendering: crisp-edges;
    display: block;
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: auto;
    flex-shrink: 0;
}

.armor-icon-frame-grid {
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
    align-items: center;
    gap: 6px;
    max-width: 100%;
    box-sizing: border-box;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    scroll-snap-type: x proximity;
    padding-bottom: 6px;
    scrollbar-gutter: stable;
    scrollbar-width: thin;
    scrollbar-color: #475569 rgba(15, 23, 42, 0.8);
}

.armor-icon-frame-grid::-webkit-scrollbar {
    height: 6px;
}

.armor-icon-frame-grid::-webkit-scrollbar-track {
    background: rgba(15, 23, 42, 0.8);
    border-radius: 3px;
}

.armor-icon-frame-grid::-webkit-scrollbar-thumb {
    background: #475569;
    border-radius: 3px;
}

.armor-icon-frame-grid::-webkit-scrollbar-thumb:hover {
    background: #64748b;
}

button.armor-icon-frame-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    scroll-snap-align: start;
    overflow: hidden;
    width: 48px;
    height: 48px;
    padding: 2px;
    border: 2px solid #475569;
    border-radius: 8px;
    background: #020617;
    cursor: pointer;
    box-sizing: border-box;
}

button.armor-icon-frame-btn:hover {
    border-color: #64748b;
    background: #0f172a;
}

button.armor-icon-frame-btn.selected {
    border-color: #10b981;
    box-shadow: 0 0 0 1px #10b981;
}

button.armor-icon-frame-btn canvas {
    width: 100%;
    height: 100%;
    display: block;
    pointer-events: none;
}

#smithing-piece-detail-modal.mmorpg-inventory-modal.smithing-piece-detail-panel {
    max-width: min(420px, 92vw);
    max-height: 85vh;
}

/* Piece detail body: no inner PSX panel frame */
.smithing-piece-detail-body {
    display: flex;
    flex-direction: column;
    gap: 0;
    padding: 0;
    margin: 0;
    background: transparent;
    border: none;
    box-shadow: none;
}

.smithing-piece-detail-stats,
.smithing-piece-detail-requirements {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    padding: 0;
    margin: 0 0 1rem 0;
    background: transparent;
    border: none;
    box-shadow: none;
}

.smithing-piece-detail-stat,
.smithing-piece-requirement-row {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 0.5rem;
    padding: 0.15rem 0;
    margin: 0;
    background: transparent;
    border: none;
    box-shadow: none;
    font-size: 12px;
}

.smithing-piece-requirement-label {
    flex: 1;
    min-width: 0;
}

.equipment-item-name {
    flex: 1;
    color: var(--slot-accent);
    font-family: 'Courier New', 'Courier', monospace;
    font-weight: 700;
    text-shadow: 1px 1px 0 #101018;
}

.equipment-empty-label {
    flex: 1;
    color: var(--slot-accent);
    font-family: 'Courier New', 'Courier', monospace;
    font-weight: 700;
    text-shadow: 1px 1px 0 #101018;
}

.mmorpg-stats-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.75rem;
}

/* Inventory stats: PSX tiles, exactly 6 equal-width columns (tile size independent of total count). */
#inventory-stats-list.inventory-stats-tiles {
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 4px;
    width: 100%;
    padding: 0.2rem 0 0;
    box-sizing: border-box;
    justify-items: stretch;
    align-items: stretch;
    overflow: visible;
}

#inventory-stats-list.inventory-stats-tiles .mmorpg-stat-tile {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    gap: 4px;
    width: 100%;
    min-width: 0;
    min-height: 2.85rem;
    padding: 0.32rem 0.12rem;
    box-sizing: border-box;
    background: #23212c;
    border: 2px solid;
    border-color: #635e72 #17151c #17151c #635e72;
    border-radius: 0;
    box-shadow:
        inset 1px 1px 0 rgba(150, 140, 170, 0.07),
        inset -1px -1px 0 rgba(0, 0, 0, 0.35);
    font-family: 'Courier New', 'Courier', monospace;
    transition: none;
    cursor: pointer;
    overflow: visible;
}

#inventory-stats-list.inventory-stats-tiles .mmorpg-stat-tile:focus {
    outline: 1px solid var(--psx-hi);
    outline-offset: 1px;
}

#inventory-stats-list.inventory-stats-tiles .mmorpg-stat-tile:focus:not(:focus-visible) {
    outline: none;
}

#inventory-stats-list.inventory-stats-tiles .mmorpg-stat-tile-flyout {
    position: absolute;
    bottom: calc(100% + 5px);
    left: 50%;
    transform: translateX(-50%);
    padding: 3px 7px;
    font-size: 0.5rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    line-height: 1.2;
    color: #e8e0d8;
    background: #1a1824;
    border: 2px solid;
    border-color: var(--psx-hi) var(--psx-dark) var(--psx-dark) var(--psx-hi);
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.5);
    white-space: nowrap;
    max-width: min(200px, 42vw);
    overflow: hidden;
    text-overflow: ellipsis;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    z-index: 30;
    text-shadow: 1px 1px 0 #101018;
}

#inventory-stats-list.inventory-stats-tiles .mmorpg-stat-tile--flyout-open .mmorpg-stat-tile-flyout {
    opacity: 1;
    visibility: visible;
}

#inventory-stats-list.inventory-stats-tiles .mmorpg-stat-tile:hover {
    background: #2a2734;
    border-color: #6e6880 #101018 #101018 #6e6880;
}

#inventory-stats-list.inventory-stats-tiles .mmorpg-stat-tile::after {
    content: '';
    position: absolute;
    inset: 3px;
    border-radius: 0;
    border: 1px solid rgba(20, 18, 28, 0.45);
    pointer-events: none;
}

#inventory-stats-list.inventory-stats-tiles .mmorpg-stat-tile-icon,
#inventory-stats-list.inventory-stats-tiles .mmorpg-stat-tile-value {
    position: relative;
    z-index: 1;
}

#inventory-stats-list.inventory-stats-tiles .mmorpg-stat-tile-icon {
    font-size: 0.896rem;
    line-height: 1;
    flex-shrink: 0;
}

#inventory-stats-list.inventory-stats-tiles .mmorpg-stat-tile-value {
    font-size: 0.72rem;
    font-weight: 700;
    color: #e8d878;
    text-shadow: 1px 1px 0 #101018;
    font-variant-numeric: tabular-nums;
    flex-shrink: 0;
    line-height: 1.15;
}

#inventory-stats-list.inventory-stats-tiles .mmorpg-stats-empty {
    grid-column: 1 / -1;
    text-align: center;
    color: #6a6478;
    font-size: 0.75rem;
    font-family: 'Courier New', 'Courier', monospace;
    padding: 0.75rem 0.5rem;
    border: 2px dashed #3a3648;
    border-radius: 0;
    background: #16141c;
}

.mmorpg-inventory-grid {
    display: flex;
    flex-direction: column;
    gap: 6px;
    max-width: 100%;
    overflow: visible;
    padding-right: 4px;
}

.inventory-list-item {
    --slot-accent: #5c5a68;
    display: flex;
    align-items: center;
    gap: calc(0.65rem * 0.85);
    padding: calc(0.55rem * 0.85) calc(0.65rem * 0.85);
    min-height: calc(56px * 0.85);
    flex-shrink: 0;
    box-sizing: border-box;
    border: 2px solid;
    border-color: #28262e #4a4658 #4a4658 #28262e;
    border-left-width: 4px;
    border-left-color: var(--slot-accent);
    background: #222028;
    box-shadow:
        inset 1px 1px 0 rgba(140, 130, 160, 0.05),
        inset -1px -1px 0 rgba(0, 0, 0, 0.28);
    transition: none;
}

.inventory-list-item:hover {
    border-color: #383640 #686378 #686378 #383640;
    border-left-color: var(--slot-accent);
    background: #292630;
}

.inventory-list-item .equipment-item-name.inventory-item-title-line {
    font-size: calc(0.9rem * 0.85);
    line-height: 1.2;
}

.inventory-list-item .equipment-item-name {
    color: var(--slot-accent);
}

.inventory-item-stats-preview {
    font-size: calc(0.72rem * 0.85);
    color: #dce6f2 !important;
    font-style: normal !important;
    font-family: 'Courier New', 'Courier', monospace;
    font-weight: 700;
    text-shadow: 1px 1px 0 #101018;
}

.inventory-empty-message {
    text-align: center;
    padding: 1.5rem;
    color: #c4d0e4;
    font-style: normal;
    font-family: 'Courier New', 'Courier', monospace;
    border: 2px dashed #3a3648;
    background: #16141c;
}

/* Retro PSX slot styles (equipment grid placeholders) */
.mmorpg-slot {
    aspect-ratio: 1;
    background: #1c1a22;
    border: 2px solid;
    border-color: #28262e #4a4658 #4a4658 #28262e;
    border-radius: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    position: relative;
    min-height: 40px;
    transition: none;
    box-shadow:
        inset 1px 1px 0 rgba(120, 110, 140, 0.06),
        inset -1px -1px 0 rgba(0, 0, 0, 0.32);
    font-family: 'Courier New', 'Courier', monospace;
    font-size: 9px;
    overflow: hidden;
    image-rendering: pixelated;
}

.mmorpg-slot::before {
    content: '';
    position: absolute;
    inset: 0;
    background: transparent;
    pointer-events: none;
}

.mmorpg-slot:hover {
    border-color: #3a3744 #584e68 #584e68 #3a3744;
    background: #24222e;
}

.mmorpg-slot.filled {
    background: #282630;
    border-color: #2e2c36 #4e4a58 #4e4a58 #2e2c36;
}

.mmorpg-slot.filled:hover {
    border-color: #34323e #686378 #686378 #34323e;
}

.mmorpg-slot-text {
    color: #c8c0b0;
    text-align: center;
    font-weight: 700;
    text-shadow: 1px 1px 0 #101018;
    letter-spacing: 0.04em;
    z-index: 1;
    position: relative;
    font-family: 'Courier New', 'Courier', monospace;
}

.mmorpg-stat-item {
    background: #1c1a22;
    border: 2px solid;
    border-color: #28262e #4a4658 #4a4658 #28262e;
    border-radius: 0;
    padding: 0.45rem 0.65rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow:
        inset 1px 1px 0 rgba(120, 110, 140, 0.05),
        inset -1px -1px 0 rgba(0, 0, 0, 0.28);
    font-family: 'Courier New', 'Courier', monospace;
    font-size: 11px;
    transition: none;
}

.mmorpg-stat-item:hover {
    border-color: #343240 #544e62 #544e62 #343240;
    background: #222028;
    box-shadow:
        inset 1px 1px 0 rgba(120, 110, 140, 0.07),
        inset -1px -1px 0 rgba(0, 0, 0, 0.25);
}

.mmorpg-stat-label {
    color: #a8a0b8;
    font-weight: 700;
    text-shadow: 1px 1px 0 #101018;
    font-family: 'Courier New', 'Courier', monospace;
}

.mmorpg-stat-value {
    color: #e8e0d0;
    font-weight: 700;
    text-shadow: 1px 1px 0 #101018;
    font-family: 'Courier New', 'Courier', monospace;
}
