/* === Wallet gate (top-right panel, outside the parchment) === */
#wallet-panel {
    display: none;
    position: fixed;
    top: 12px;
    right: 14px;
    z-index: 2000;
    text-align: right;
}
body.intro #wallet-panel {
    display: block;
}
.wallet-btn {
    display: inline-block;
    width: 125px;
    height: 51px;
    line-height: 51px;
    background: url('../img/2/spritesheet.png') no-repeat -227px -726px;
    background-size: 422px auto;
    image-rendering: pixelated;
    image-rendering: -moz-crisp-edges;
    font-family: 'GraphicPixel', sans-serif;
    font-size: 13px;
    color: #f5edcf;
    text-shadow: 1px 1px #000, 2px 2px rgba(0, 0, 0, 0.5);
    text-align: center;
    letter-spacing: 1px;
    margin-left: 8px;
    padding: 0;
    border: none;
    cursor: pointer;
}
.wallet-btn:hover {
    -webkit-filter: brightness(1.2);
    filter: brightness(1.2);
    color: #fff;
}
.wallet-btn:active {
    -webkit-filter: brightness(0.85);
    filter: brightness(0.85);
}
.wallet-chip {
    display: inline-block;
    font-family: 'GraphicPixel', sans-serif;
    font-size: 13px;
    color: #fff;
    background: #2e6b2e;
    border: 3px solid #153515;
    padding: 8px 14px;
    text-shadow: 1px 1px #000;
    letter-spacing: 1px;
}
.wallet-disconnect {
    display: inline-block;
    font-family: 'GraphicPixel', sans-serif;
    font-size: 13px;
    color: #fff;
    background: #8a2020;
    border: 3px solid #431010;
    padding: 8px 11px;
    margin-left: 8px;
    cursor: pointer;
    text-shadow: 1px 1px #000;
}
.wallet-disconnect:hover {
    background: #b03030;
}
.wallet-hint {
    display: block;
    font-family: 'GraphicPixel', sans-serif;
    font-size: 11px;
    color: #d8c88f;
    text-shadow: 1px 1px #000;
    margin-top: 6px;
}
body.wallet-connected .wallet-hint {
    display: none;
}
body:not(.wallet-connected) .play {
    opacity: 0.45;
    -webkit-filter: grayscale(80%);
    filter: grayscale(80%);
    cursor: not-allowed;
}
.wallet-btn.flash {
    -webkit-animation: walletflash 0.25s 2;
    animation: walletflash 0.25s 2;
}
@-webkit-keyframes walletflash { 50% { -webkit-filter: brightness(1.7) saturate(1.6); } }
@keyframes walletflash { 50% { filter: brightness(1.7) saturate(1.6); } }

/* === Footer cleanup === */
footer {
    display: none !important;
}

/* hide the red "i" info ribbon on the parchment */
.ribbon {
    display: none !important;
}

/* === Player level HUD === */
#playerlevel {
    display: none;
    position: absolute;
    top: 57px;
    left: 8px;
    z-index: 9;
    font-family: 'GraphicPixel', sans-serif;
    color: #fcda5c;
    background: rgba(21, 13, 8, 0.82);
    border: 2px solid #3d2c17;
    padding: 4px 9px 6px;
    text-shadow: 1px 1px #000;
    pointer-events: none;
}
body.started #playerlevel {
    display: block;
}
#playerlevel .lvl-caption {
    font-size: 11px;
    color: #e3e3e3;
    letter-spacing: 1px;
}
#level-number {
    font-size: 18px;
    margin-left: 3px;
}
#xpbar {
    width: 76px;
    height: 5px;
    background: #1d1408;
    border: 1px solid #000;
    margin-top: 4px;
}
#xpfill {
    height: 100%;
    width: 0;
    background: #7dc242;
    -webkit-transition: 0.4s width ease;
    transition: 0.4s width ease;
}
#playerlevel.pulse {
    -webkit-animation: lvlpulse 0.5s 1;
    animation: lvlpulse 0.5s 1;
}
@-webkit-keyframes lvlpulse { 50% { -webkit-transform: scale(1.15); } }
@keyframes lvlpulse { 50% { transform: scale(1.15); } }
.upscaled #playerlevel {
    top: 84px;
    left: 12px;
}

/* === Exit-to-menu button (replaces the "?" help barbutton) ===
   Custom sprite; positioned with the same media breakpoints main.css uses
   for #helpbutton, NOT the .upscaled class (Chrome always sets .upscaled). */
#exitbutton {
    background: url('../img/custom/dom2.png') no-repeat center !important;
    background-size: contain !important;
    image-rendering: pixelated;
    image-rendering: -moz-crisp-edges;
    border: none;
    cursor: pointer;
}
#exitbutton:hover {
    -webkit-filter: brightness(1.35);
    filter: brightness(1.35);
}
@media screen and (min-width: 1501px) {
    #exitbutton { top: 3px; left: 1350px; }
}
@media screen and (max-width: 1500px) {
    #exitbutton { top: 2px; left: 900px; }
}
@media screen and (max-height: 870px) {
    #exitbutton { top: 2px; left: 900px; }
}
@media screen and (max-width: 800px) {
    #exitbutton { top: 1px; left: 450px; }
}

/* === Marketplace === */
#market-btn {
    display: block;
    width: 125px;
    height: 51px;
    line-height: 51px;
    margin: 8px 0 0 auto;
    background: url('../img/2/spritesheet.png') no-repeat -227px -726px;
    background-size: 422px auto;
    image-rendering: pixelated;
    image-rendering: -moz-crisp-edges;
    font-family: 'GraphicPixel', sans-serif;
    font-size: 13px;
    color: #f5edcf;
    text-shadow: 1px 1px #000, 2px 2px rgba(0, 0, 0, 0.5);
    text-align: center;
    letter-spacing: 1px;
    cursor: pointer;
}
#market-btn:hover {
    -webkit-filter: brightness(1.2);
    filter: brightness(1.2);
    color: #fff;
}
#market {
    display: none;
    position: fixed;
    left: 50%;
    top: 50%;
    width: 880px;
    height: 650px;
    margin: -325px 0 0 -440px;
    z-index: 3000;
    background: url('../img/custom/market.png') no-repeat center;
    background-size: contain;
    image-rendering: pixelated;
    font-family: 'GraphicPixel', sans-serif;
}
#market.active {
    display: block;
}
#market-close {
    position: absolute;
    top: 8px;
    right: 10px;
    z-index: 5;
    color: #fff;
    background: #8a2020;
    border: 2px solid #431010;
    padding: 4px 8px;
    font-size: 12px;
    cursor: pointer;
    text-shadow: 1px 1px #000;
}
#market-close:hover {
    background: #b03030;
}
.market-tab {
    position: absolute;
    z-index: 4;
    cursor: pointer;
}
.market-tab.active {
    box-shadow: inset 0 0 0 2px #fcda5c;
}
.market-tab:hover {
    box-shadow: inset 0 0 0 2px rgba(252, 218, 92, 0.5);
}
.market-tab.active:hover {
    box-shadow: inset 0 0 0 2px #fcda5c;
}
#market-search {
    position: absolute;
    left: 588px;
    top: 63px;
    width: 236px;
    height: 24px;
    z-index: 4;
    background: #0d1733;
    border: none;
    outline: none;
    font-family: 'GraphicPixel', sans-serif;
    font-size: 13px;
    color: #dfe6ff;
    padding: 0 6px;
}
#market-search::placeholder {
    color: #4d5a7c;
}
#market-listings {
    position: absolute;
    left: 8px;
    top: 94px;
    width: 545px;
    height: 540px;
    overflow-y: auto;
    padding-right: 4px;
}
#market-listings::-webkit-scrollbar {
    width: 8px;
}
#market-listings::-webkit-scrollbar-track {
    background: rgba(13, 23, 51, 0.6);
}
#market-listings::-webkit-scrollbar-thumb {
    background: #2c3350;
    border: 1px solid #4d5a7c;
}
.market-row {
    position: relative;
    height: 72px;
    margin-bottom: 6px;
    padding: 12px 10px 0 14px;
    box-sizing: border-box;
    background: rgba(16, 24, 48, 0.85);
    border: 1px solid #2c3350;
}
.market-row .inv-icon {
    display: inline-block;
    vertical-align: middle;
    margin: 0 10px 0 0;
}
.market-info {
    display: inline-block;
    vertical-align: middle;
    max-width: 220px;
}
.market-name {
    display: block;
    color: #dfe6ff;
    font-size: 14px;
    text-shadow: 1px 1px #000;
}
.market-seller {
    display: block;
    color: #6d7a9c;
    font-size: 11px;
    margin-top: 3px;
}
.market-price {
    position: absolute;
    right: 110px;
    top: 24px;
    color: #fcda5c;
    font-size: 14px;
    text-shadow: 1px 1px #000;
}
.market-act {
    position: absolute;
    right: 12px;
    top: 18px;
    padding: 7px 12px;
    font-size: 12px;
    color: #fff;
    cursor: pointer;
    text-shadow: 1px 1px #000;
    letter-spacing: 1px;
}
.market-act.buy {
    background: #2e6b2e;
    border: 2px solid #153515;
}
.market-act.buy:hover {
    background: #3d8a3d;
}
.market-act.cancel {
    background: #8a2020;
    border: 2px solid #431010;
}
.market-act.cancel:hover {
    background: #b03030;
}
.market-act.dis {
    background: #3a3f52;
    border: 2px solid #23273a;
    cursor: default;
}
.market-empty {
    color: #6d7a9c;
    font-size: 14px;
    text-align: center;
    padding-top: 120px;
    line-height: 24px;
}
.market-empty.small {
    padding-top: 40px;
    font-size: 12px;
}
.market-row.soldrow {
    opacity: 0.75;
}
.market-row.soldrow .market-price {
    color: #7dc242;
    right: 14px;
}
.market-row.soldlog {
    opacity: 0.85;
}
.market-row.soldlog .market-price {
    right: 14px;
}
.market-row.soldlog .market-price.gain {
    color: #7dc242;
}
#market-sell {
    position: absolute;
    left: 578px;
    top: 96px;
    width: 292px;
    height: 540px;
}
#market-sell-title {
    color: #dfe6ff;
    font-size: 11px;
    text-align: center;
    letter-spacing: 1px;
    text-shadow: 1px 1px #000;
    margin-bottom: 10px;
}
#market-sell-grid {
    text-align: center;
}
.market-loot {
    display: inline-block;
    width: 44px;
    height: 44px;
    margin: 4px;
    padding-top: 6px;
    box-sizing: border-box;
    background: rgba(20, 28, 52, 0.6);
    border: 2px solid #2c3350;
    cursor: pointer;
}
.market-loot:hover {
    border-color: #fcda5c;
}
.market-loot .inv-icon {
    margin: 0 auto;
}

/* === Gold sparkles over the Pixelport logo in the intro background === */
#logosparkles {
    display: none;
    position: fixed;
    z-index: 2;
    pointer-events: none;
}
body.intro #logosparkles {
    display: block;
}
.fon-spark {
    position: absolute;
    background: #fff;
    box-shadow: 0 0 7px 2px rgba(255, 226, 130, 0.9);
    opacity: 0;
    clip-path: polygon(50% 0, 62% 38%, 100% 50%, 62% 62%, 50% 100%, 38% 62%, 0 50%, 38% 38%);
    -webkit-animation: fonspark linear 1;
    animation: fonspark linear 1;
}
@-webkit-keyframes fonspark {
    0% { opacity: 0; -webkit-transform: scale(0.3) rotate(0deg); }
    50% { opacity: 1; -webkit-transform: scale(1) rotate(20deg); }
    100% { opacity: 0; -webkit-transform: scale(0.4) rotate(40deg); }
}
@keyframes fonspark {
    0% { opacity: 0; transform: scale(0.3) rotate(0deg); }
    50% { opacity: 1; transform: scale(1) rotate(20deg); }
    100% { opacity: 0; transform: scale(0.4) rotate(40deg); }
}

/* === Top bar icons: weapon removed, armor icon = backpack button === */
#weapon {
    display: none !important;
}
#armor {
    background: url('../img/custom/bag.png') no-repeat center !important;
    background-size: contain !important;
    image-rendering: pixelated;
    image-rendering: -moz-crisp-edges;
    cursor: pointer;
}
#armor:hover {
    -webkit-filter: brightness(1.3);
    filter: brightness(1.3);
}
#inventory {
    display: none;
    position: fixed;
    left: 50%;
    top: 50%;
    width: 560px;
    height: 443px;
    margin: -222px 0 0 -280px;
    z-index: 40;
    background: url('../img/custom/inv.png') no-repeat center;
    background-size: contain;
    image-rendering: pixelated;
    image-rendering: -moz-crisp-edges;
}
#inventory.active {
    display: block;
}
#inventory .inv-title {
    display: none; /* the art carries its own INVENTORY title */
}
#inventory-slots {
    position: absolute;
    left: 0;
    top: 0;
    right: 0;
    bottom: 0;
}
.inv-slot {
    position: absolute;
    width: 40px;
    height: 40px;
    background: none;
    border: none;
    text-align: center;
}
.inv-slot.filled {
    cursor: pointer;
}
.inv-slot.filled:hover {
    outline: 2px solid #fcda5c;
    outline-offset: -3px;
}
/* item sheets are 6 frames of 32x32 (192x32) — show only frame 0 */
.inv-icon {
    width: 32px;
    height: 32px;
    margin: 4px auto 0;
    background-repeat: no-repeat;
    background-position: 0 0;
    background-size: auto 32px;
    image-rendering: pixelated;
    image-rendering: -moz-crisp-edges;
}
.inv-slot.equip {
    cursor: default;
}
.equip-portrait {
    position: absolute;
    width: 56px;
    height: 56px;
    image-rendering: pixelated;
    image-rendering: -moz-crisp-edges;
}

/* === Pixelport background (replaces the wooden board) === */
body {
    background: #14100b url('../img/custom/fon.png') no-repeat center top fixed !important;
    background-size: cover !important;
}
/* the background art carries its own Pixelport logo */
#logo, #logosparks {
    display: none !important;
}

/* === Custom HP bar (img/custom/hp.png, 6 frames full → empty) === */
#healthbar {
    background-image: url('../img/custom/hp.png') !important;
    background-repeat: no-repeat !important;
    background-position: -16.5px -16.5px;
    background-size: 202px auto !important;
    width: 170px !important;
    height: 53px !important;
    top: 5px !important;
    left: 8px !important;
}
#hitpoints {
    display: none !important;
}
#healthbar.white {
    -webkit-filter: brightness(1.9);
    filter: brightness(1.9);
}

/* === Play button: text lights up white on hover === */
body.wallet-connected .play:not(.disabled):not(.loading) div:hover {
    background-position: -454px -1452px; /* blank red button frame */
}
body.wallet-connected .play:not(.disabled):not(.loading) div:hover::after {
    content: "PLAY";
    position: absolute;
    left: 0;
    right: 0;
    top: 50%;
    margin-top: -13px;
    text-align: center;
    font-family: 'GraphicPixel', sans-serif;
    font-size: 26px;
    color: #fff;
    text-shadow: 2px 2px #000;
    letter-spacing: 2px;
}
body.upscaled.wallet-connected .play:not(.disabled):not(.loading) div:hover {
    background-position: -681px -2178px;
}
body.upscaled.wallet-connected .play:not(.disabled):not(.loading) div:hover::after {
    font-size: 39px;
    margin-top: -20px;
}
/* pressed state wins over hover */
body.wallet-connected .play:not(.disabled) div:active {
    background-position: -458px -306px;
}
body.wallet-connected .play:not(.disabled) div:active::after {
    content: none;
}
body.upscaled.wallet-connected .play:not(.disabled) div:active {
    background-position: -687px -459px;
}
