/* ==== GLOBAL ==== */

body {
    margin: 0;
    padding: 0;
    background: #0f0f0f;
    color: #e6d7b0;
    font-family: "Cinzel", serif;
    font-size: 16px;
}

a {
    color: #d4b46a;
    text-decoration: none;
}
a:hover {
    text-decoration: underline;
}

/* ==== TOPBAR ==== */

.topbar {
    background: linear-gradient(#3a2a1a, #2a1c12);
    padding: 10px 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 3px solid #5a3e22;
    position: sticky;
    top: 0;
    z-index: 5000;
}

.topbar-left,
.topbar-center,
.topbar-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

.topbar-avatar {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    border: 2px solid #5a3e22;
    object-fit: cover;
}

.topbar-currencies {
    display: flex;
    gap: 12px;
    align-items: center;
}

.currency {
    display: flex;
    align-items: center;
    gap: 4px;
    font-weight: bold;
}

.currency-icon {
    width: 20px;
    height: 20px;
}

.currency.total-level {
    color: #4ec9ff;
    font-weight: bold;
}

.topbar-task {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 260px;
}

.task-name {
    font-size: 14px;
    opacity: 0.9;
}

.task-bar {
    width: 140px;
    height: 10px;
    background: #3a2a1a;
    border: 1px solid #5a3e22;
    border-radius: 4px;
    overflow: hidden;
}

.task-bar-fill {
    height: 100%;
    background: #d4b46a;
}

.renew-btn {
    background: #5a3e22;
    border: none;
    padding: 4px 8px;
    font-size: 14px;
    cursor: pointer;
}
.renew-btn:hover {
    background: #7a532e;
}

.notif-wrapper {
    position: relative;
}

.notif-btn {
    background: none;
    border: none;
    font-size: 22px;
    cursor: pointer;
    color: #e6d7b0;
}

.notif-dropdown {
    display: none;
    position: absolute;
    right: 0;
    top: 32px;
    background: #1a120a;
    border: 2px solid #5a3e22;
    padding: 10px;
    width: 180px;
    border-radius: 6px;
    z-index: 9999;
}

.notif-wrapper:hover .notif-dropdown {
    display: block;
}

.notif-item {
    padding: 6px 0;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}

.notif-item.empty {
    opacity: 0.7;
}

.logout-link {
    margin-left: 10px;
}

/* ==== MOBILE HEADER ==== */

.mobile-header {
    display: none;
}

.hamburger-btn {
    font-size: 28px;
    background: none;
    border: none;
    color: #e6d7b0;
    cursor: pointer;
}

/* ==== LAYOUT GRID ==== */

.layout-grid {
    display: grid;
    grid-template-columns: 240px 1fr;
    height: calc(100vh - 120px);
}

/* ==== SIDEBAR ==== */

.sidebar {
    background: #1a120a;
    border-right: 3px solid #5a3e22;
    padding: 20px;
    overflow-y: auto;
    transition: transform 0.3s ease;
}

.sidebar h4 {
    margin: 20px 0 8px;
    font-size: 14px;
    text-transform: uppercase;
    color: #b08b4f;
}

.sidebar a {
    display: block;
    padding: 6px 0;
    font-size: 15px;
}

.sidebar-category {
    margin: 20px 0 6px;
    font-size: 13px;
    text-transform: uppercase;
    color: #b08b4f;
    letter-spacing: 1px;
}

.sidebar-link {
    display: flex;
    justify-content: space-between;
    padding: 6px 0;
    font-size: 15px;
    color: #e6d7b0;
}

.sidebar-link.disabled {
    opacity: 0.5;
    cursor: default;
}

.coming-soon {
    font-size: 11px;
    opacity: 0.7;
}

.skill-level {
    font-size: 13px;
    color: #d4b46a;
}

#sidebar-overlay {
    display: none;
}

/* ==== CONTENT AREA ==== */

.content-area {
    padding: 24px;
    overflow-y: auto;
    padding-bottom: 250px;
    background: #141414;
}

/* ==== BOTTOMBAR ==== */

#bottombar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 260px;
    background: rgba(18, 14, 10, 0.96);
    display: flex;
    border-top: 3px solid #3a2f22;
    box-shadow: 0 -4px 12px rgba(0,0,0,0.6);
    backdrop-filter: blur(3px);
    transition: height 0.25s ease, padding 0.25s ease;
    z-index: 900;
}

#bottombar.collapsed {
    height: 0;
    padding: 0;
    border-top: none;
    overflow: hidden;
}

/* ==== BOTTOMBAR: DESKTOP COLLAPSE TOGGLE (rechtsboven) ==== */
#bottombar {
    position: fixed; /* staat al, maar laten we 'm zo expliciet houden */
}

.bottombar-toggle-desktop {
    position: absolute;
    top: 8px;
    right: 10px;
    z-index: 950;              /* boven inventory/chat */
    width: 34px;
    height: 34px;
    padding: 0;
    border-radius: 8px;

    background: linear-gradient(#3a2f22, #2a2218);
    border: 2px solid #5a4a33;
    color: #e2d3b5;
    font-size: 18px;
    font-weight: bold;
    line-height: 1;
    text-shadow: 0 0 4px #000;
}

.bottombar-toggle-desktop:hover {
    background: linear-gradient(#4a3b2a, #2f261c);
}
/* ==== BOTTOMBAR: FLOATING OPEN BUTTON (FAB) ==== */
.bottombar-fab {
    position: fixed;
    right: 18px;
    bottom: 18px;
    z-index: 20000;

    width: 54px;
    height: 54px;
    padding: 0;
    border-radius: 14px;

    background: linear-gradient(#3a2f22, #2a2218);
    border: 2px solid #c8a46b;
    color: #e2d3b5;

    font-size: 22px;
    font-weight: bold;
    line-height: 1;

    box-shadow: 0 8px 22px rgba(0,0,0,0.7);
    display: none; /* default: verborgen */
}

/* Toon de FAB als de bottombar is ingeklapt */
#bottombar.collapsed ~ .bottombar-fab {
    display: block;
}

@media (max-width: 768px) {
    .bottombar-toggle-desktop,
    .bottombar-fab {
        display: none !important;
    }
}

/* ==== INVENTORY ==== */

#bottom-left {
    width: 40%;
    border-right: 3px solid #3a2f22;
    padding: 10px;
    box-sizing: border-box;
}

.inv-view {
    display: none;
    margin-top: 12px;
}

.inv-view.active {
    display: block;
}

.inv-tabs button {
    background: linear-gradient(#3a2f22, #2a2218);
    border: 2px solid #5a4a33;
    padding: 6px 12px;
    margin-right: 5px;
    cursor: pointer;
    border-radius: 6px;
    color: #e2d3b5;
    font-weight: bold;
    text-shadow: 0 0 4px #000;
    transition: 0.15s;
}

.inv-tabs button:hover {
    background: linear-gradient(#4a3b2a, #2f261c);
}

.inv-tabs button.active {
    background: linear-gradient(#6a553c, #3a2f22);
    border-color: #c8a46b;
    box-shadow: 0 0 6px #c8a46b;
}

.inventory-container {
    max-height: 240px;
    overflow-y: auto;
    overflow-x: hidden;
    padding-right: 6px;
    box-sizing: border-box;
}

.inventory-grid {
    display: grid;
    grid-template-columns: repeat(8, 1fr);
    gap: 6px;
    width: 100%;
    box-sizing: border-box;
}

.inv-slot {
    aspect-ratio: 1 / 1;
    width: 100%;
    background: rgba(25, 20, 15, 0.85);
    border: 2px solid #3a2f22;
    border-radius: 6px;
    position: relative;
    box-shadow: inset 0 0 6px rgba(0,0,0,0.6);
    cursor: pointer;
    transition: 0.15s;
    overflow: hidden;
}

.inv-slot:hover {
    border-color: #c8a46b;
    box-shadow: 0 0 8px #c8a46b;
}

.inv-slot.empty {
    background: rgba(20, 16, 12, 0.6);
    border: 2px dashed #3a2f22;
    opacity: 0.6;
}

.inv-slot.empty:hover {
    opacity: 1;
    border-color: #c8a46b;
}

.durability-bar {
    position: absolute;
    bottom: 2px;
    left: 2px;
    right: 2px;
    height: 6px;
    border-radius: 3px;
    background: linear-gradient(
        to right,
        #4caf50 var(--durability),
        #222 var(--durability)
    );
}

.item-icon {
    width: 100%;
    height: 100%;
    object-fit: contain;
    pointer-events: none;
}

.item-qty {
    position: absolute;
    bottom: 3px;
    right: 4px;
    background: rgba(0,0,0,0.7);
    padding: 2px 5px;
    border-radius: 4px;
    font-size: 12px;
    color: #e2d3b5;
    font-weight: bold;
}

.inv-slot[data-tier="common"]    { border-color: #6b6b6b; }
.inv-slot[data-tier="uncommon"]  { border-color: #4caf50; }
.inv-slot[data-tier="rare"]      { border-color: #3f51b5; }
.inv-slot[data-tier="epic"]      { border-color: #9c27b0; }
.inv-slot[data-tier="legendary"] { border-color: #ff9800; }

#item-tooltip {
    position: fixed;
    background: rgba(18,14,10,0.95);
    border: 2px solid #c8a46b;
    padding: 8px 12px;
    border-radius: 6px;
    color: #e2d3b5;
    font-size: 14px;
    pointer-events: none;
    display: none;
    z-index: 2000;
    max-width: 220px;
    box-shadow: 0 0 10px rgba(0,0,0,0.7);
}

#context-menu {
    position: fixed;
    background: rgba(18,14,10,0.95);
    border: 2px solid #c8a46b;
    border-radius: 6px;
    padding: 6px 0;
    display: none;
    z-index: 3000;
}

#context-menu button {
    display: block;
    width: 100%;
    padding: 8px 12px;
    background: none;
    border: none;
    color: #e2d3b5;
    text-align: left;
}

#context-menu button:hover {
    background: rgba(255,255,255,0.1);
}

/* ==== EQUIPMENT ==== */

.equipment-container {
    max-height: 240px;
    overflow-y: auto;
    overflow-x: hidden;
    padding-right: 6px;
    box-sizing: border-box;
}

.equipment-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 6px;
    padding: 10px;
}

.equip-slot {
    aspect-ratio: 1 / 1;
    background: rgba(25, 20, 15, 0.85);
    border: 2px solid #3a2f22;
    border-radius: 6px;
    position: relative;
    overflow: hidden;
    cursor: pointer;
    transition: 0.15s;
}

.equip-slot:hover {
    border-color: #c8a46b;
    box-shadow: 0 0 8px #c8a46b;
}

.equip-slot.filled img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.equip-slot.empty {
    opacity: 0.5;
    border: 2px dashed #3a2f22;
}

.equip-slot[data-tier="common"]    { border-color: #6b6b6b; }
.equip-slot[data-tier="uncommon"]  { border-color: #4caf50; }
.equip-slot[data-tier="rare"]      { border-color: #3f51b5; }
.equip-slot[data-tier="epic"]      { border-color: #9c27b0; }
.equip-slot[data-tier="legendary"] { border-color: #ff9800; }

.equip-slot .durability-bar {
    position: absolute;
    bottom: 2px;
    left: 2px;
    right: 2px;
    height: 6px;
    border-radius: 3px;
    background: linear-gradient(
        to right,
        #4caf50 var(--durability),
        #222 var(--durability)
    );
}

.equipment-layout {
    position: relative;
    width: 260px;
    height: 360px;
    margin: 0 auto;
}

.equipment-layout .equip-slot {
    width: 48px;
    height: 48px;
    position: absolute;
}

/* Left column */
.equip-slot.helmet { top: 10px;  left: 10px; }
.equip-slot.chest  { top: 70px;  left: 10px; }
.equip-slot.gloves { top: 130px; left: 10px; }
.equip-slot.legs   { top: 190px; left: 10px; }
.equip-slot.boots  { top: 250px; left: 10px; }

/* Middle column */
.equip-slot.weapon  { top: 110px; left: 50%; transform: translateX(-50%); }
.equip-slot.offhand { top: 170px; left: 50%; transform: translateX(-50%); }
.equip-slot.tool    { top: 230px; left: 50%; transform: translateX(-50%); }

/* Right column */
.equip-slot.ammo     { top: 10px;  right: 10px; }
.equip-slot.amulet   { top: 70px;  right: 10px; }
.equip-slot.cape     { top: 130px; right: 10px; }
.equip-slot.backpack { top: 190px; right: 10px; }
.equip-slot.ring1    { top: 250px; right: 10px; }

.equip-slot::before {
    content: "";
    position: absolute;
    inset: 0;
    opacity: 0.25;
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
    pointer-events: none;
}

.equip-slot::after {
    content: attr(data-emoji);
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    opacity: 0.15;
    pointer-events: none;
}

/* ==== CHAT ==== */

#bottom-right {
    width: 60%;
    padding: 10px;
}

.chat-tabs button {
    background: linear-gradient(#3a2f22, #2a2218);
    border: 2px solid #5a4a33;
    padding: 6px 12px;
    margin-right: 5px;
    cursor: pointer;
    border-radius: 6px;
    color: #e2d3b5;
    font-weight: bold;
    text-shadow: 0 0 4px #000;
    transition: 0.15s;
}

.chat-tabs button:hover {
    background: linear-gradient(#4a3b2a, #2f261c);
}

.chat-tabs button.active {
    background: linear-gradient(#6a553c, #3a2f22);
    border-color: #c8a46b;
    box-shadow: 0 0 6px #c8a46b;
}

.chat-view {
    display: none;
    height: 200px;
    margin-top: 10px;
    flex-direction: column;
}

.chat-view.active {
    display: flex;
}

.chat-view .messages {
    flex: 1;
    overflow-y: auto;
    background: rgba(25, 20, 15, 0.9);
    padding: 10px;
    border-radius: 6px;
    border: 2px solid #3a2f22;
    box-shadow: inset 0 0 8px rgba(0,0,0,0.6);
    color: #e2d3b5;
}

.chat-view input {
    padding: 8px;
    border-radius: 6px;
    border: 2px solid #3a2f22;
    background: #2a2218;
    color: #e2d3b5;
    font-weight: bold;
    outline: none;
}

.chat-view input::placeholder {
    color: #9c8b6a;
}

.chat-bubble {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    background: #222;
    padding: 8px 10px;
    border-radius: 8px;
    margin-bottom: 6px;
    max-width: 95%;
    color: #fff;
}

.chat-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
}

.chat-content {
    display: flex;
    flex-direction: column;
    max-width: calc(100% - 40px);
}

.chat-line {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}

.chat-user {
    font-weight: bold;
}

.chat-text {
    word-break: break-word;
}

.chat-time {
    font-size: 10px;
    opacity: 0.6;
    margin-top: 2px;
}

/* ==== FRIENDS DM CHAT STYLING ==== */

.dm-container {
    display: flex;
    height: 100%;
    gap: 0;
}

.dm-sidebar {
    width: 180px;
    background: rgba(15, 12, 9, 0.95);
    border-right: 2px solid #3a2f22;
    overflow-y: auto;
    padding: 8px;
}

.dm-sidebar h4 {
    margin: 0 0 8px 0;
    font-size: 13px;
    color: #e1bb7b;
    text-transform: uppercase;
}

.friends-list-dm {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.friend-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px;
    background: rgba(42, 34, 24, 0.7);
    border: 1px solid #3a2f22;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s;
}

.friend-item:hover {
    background: rgba(58, 47, 34, 0.9);
    border-color: #c8a46b;
}

.friend-item.active {
    background: #5d4a37;
    border-color: #e1bb7b;
}

.friend-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 1px solid #5d4a37;
}

.friend-name {
    font-size: 12px;
    color: #e2d3b5;
    font-weight: bold;
}

.dm-main {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.dm-header {
    padding: 8px 12px;
    background: rgba(0, 0, 0, 0.4);
    border-bottom: 2px solid #3a2f22;
    font-weight: bold;
    font-size: 13px;
    color: #e1bb7b;
}

.dm-messages {
    flex: 1;
    overflow-y: auto;
    padding: 10px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.dm-bubble {
    max-width: 75%;
    padding: 8px 12px;
    border-radius: 8px;
    word-wrap: break-word;
    font-size: 13px;
}

.dm-bubble.sent {
    align-self: flex-end;
    background: #5d4a37;
    color: #fff;
}

.dm-bubble.received {
    align-self: flex-start;
    background: #3a2f22;
    color: #e2d3b5;
}

.dm-content {
    margin-bottom: 4px;
}

.dm-time {
    font-size: 9px;
    opacity: 0.6;
    text-align: right;
}

.dm-input-container {
    display: flex;
    gap: 6px;
    padding: 8px;
    background: rgba(0, 0, 0, 0.4);
    border-top: 2px solid #3a2f22;
}

#dm-message-input {
    flex: 1;
    padding: 6px 10px;
    background: #2a2218;
    border: 2px solid #3a2f22;
    border-radius: 4px;
    color: #e2d3b5;
    font-size: 13px;
}

#dm-message-input:focus {
    outline: none;
    border-color: #c8a46b;
}

.send-btn {
    padding: 6px 14px;
    background: #5d4a37;
    border: 2px solid #e1bb7b;
    color: #e1bb7b;
    border-radius: 4px;
    cursor: pointer;
    font-weight: bold;
    font-size: 12px;
}

.send-btn:hover {
    background: #e1bb7b;
    color: #2a241e;
}

.no-friends, .loading, .no-messages {
    text-align: center;
    padding: 20px;
    opacity: 0.6;
    font-size: 12px;
}

/* ==== MOBILE TABS ==== */

#mobile-bottom-tabs {
    display: none;
}

#mobile-bottom-toggle {
    display: none;
}

/* ==== FORMS ==== */

input, select, button {
    padding: 8px;
    background: #2a1c12;
    border: 1px solid #5a3e22;
    color: #e6d7b0;
    font-family: inherit;
}

button {
    cursor: pointer;
    background: #5a3e22;
    transition: 0.2s;
}
button:hover {
    background: #7a532e;
}

/* ==== SCROLLBARS ==== */

::-webkit-scrollbar {
    width: 10px;
}
::-webkit-scrollbar-track {
    background: #1a120a;
}
::-webkit-scrollbar-thumb {
    background: #5a3e22;
}
::-webkit-scrollbar-thumb:hover {
    background: #7a532e;
}

/* ==== TICK POPUPS ==== */

#tick-popups {
    position: fixed;
    bottom: 120px;
    left: 50%;
    transform: translateX(-50%);
    pointer-events: none;
    z-index: 9999;
}

.tick-popup {
    position: absolute;
    color: #e0c48c;
    font-weight: bold;
    font-size: 20px;
    opacity: 0;
    animation: tickFloat 1.2s ease-out forwards;
    text-shadow: 0 0 6px rgba(0,0,0,0.6);
}

@keyframes tickFloat {
    0%   { opacity: 0; transform: translateY(10px) scale(0.9); }
    20%  { opacity: 1; transform: translateY(0) scale(1); }
    100% { opacity: 0; transform: translateY(-40px) scale(1); }
}

/* ========================================
   GRAND EXCHANGE / MARKETPLACE STYLING
   ======================================== */

.ge-container {
    background: linear-gradient(135deg, #2a241e 0%, #1f1a15 100%);
    border: 3px solid #5d4a37;
    border-radius: 8px;
    padding: 24px;
    color: #e1bb7b;
    box-shadow: 0 8px 24px rgba(0,0,0,0.6);
}

/* Header */
.ge-header {
    margin-bottom: 24px;
    padding-bottom: 16px;
    border-bottom: 2px solid #5d4a37;
}

.ge-title-group {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.ge-title {
    font-size: 28px;
    margin: 0;
    color: #f4d799;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.8);
}

.ge-stats {
    display: flex;
    gap: 8px;
    align-items: center;
}

.ge-label {
    font-size: 14px;
    opacity: 0.8;
}

.ge-value {
    font-size: 16px;
    font-weight: bold;
    color: #ffd700;
}

.ge-progress-container {
    display: flex;
    align-items: center;
    gap: 12px;
}

.ge-progress-bar {
    flex: 1;
    height: 12px;
    background: #1a1712;
    border: 2px solid #5d4a37;
    border-radius: 6px;
    overflow: hidden;
}

.ge-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #d4b06a 0%, #b48a4a 100%);
    transition: width 0.3s ease;
}

.ge-hint {
    font-size: 12px;
    opacity: 0.7;
}

/* Top Traded Items */
.ge-top-traded {
    background: rgba(0,0,0,0.3);
    border: 2px solid #5d4a37;
    border-radius: 6px;
    padding: 16px;
    margin-bottom: 24px;
}

.ge-subtitle {
    font-size: 18px;
    margin: 0 0 12px 0;
    color: #f4d799;
    display: flex;
    align-items: center;
    gap: 8px;
}

.ge-top-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 12px;
}

.ge-top-card {
    background: #3d3327;
    border: 2px solid #5d4a37;
    border-radius: 6px;
    padding: 10px;
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    transition: all 0.2s;
}

.ge-top-card:hover {
    border-color: #e1bb7b;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.4);
}

.ge-item-icon-small {
    width: 36px;
    height: 36px;
    background: #2a241e;
    border: 2px solid #1a1712;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.ge-item-icon-small img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    image-rendering: pixelated;
}

.ge-top-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.ge-top-name {
    font-size: 13px;
    font-weight: bold;
    color: #e1bb7b;
}

.ge-top-vol {
    font-size: 11px;
    opacity: 0.7;
}

/* Main Grid */
.ge-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 16px;
}

/* Slot Styling */
.ge-slot {
    background: linear-gradient(135deg, #3d3327 0%, #2f2820 100%);
    border: 2px solid #1a1712;
    border-radius: 8px;
    position: relative;
    height: 200px;
    box-shadow: inset 0 0 10px rgba(0,0,0,0.5);
    transition: all 0.2s;
    overflow: hidden;
}

.ge-slot:hover {
    border-color: #e1bb7b;
    box-shadow: 0 0 12px rgba(225, 187, 123, 0.3);
}

.ge-slot-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
}

.ge-slot-active {
    border-color: #5d4a37;
}

.ge-slot-locked {
    opacity: 0.5;
    background: #25201a;
}

.ge-lock-overlay {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    gap: 8px;
    color: #8a6f4f;
}

.ge-lock-overlay i {
    font-size: 32px;
}

/* Order Header */
.ge-order-header {
    padding: 8px 12px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 12px;
    font-weight: bold;
    border-bottom: 1px solid rgba(0,0,0,0.3);
}

.mp-type-buy {
    background: linear-gradient(135deg, #8a4a00 0%, #6a3800 100%);
    color: #ff9800;
}

.mp-type-sell {
    background: linear-gradient(135deg, #1e4d2b 0%, #153a1f 100%);
    color: #4caf50;
}

.ge-order-label {
    text-transform: uppercase;
    letter-spacing: 1px;
}

.ge-btn-cancel {
    background: rgba(122, 0, 0, 0.8);
    border: 1px solid #4a0000;
    color: #fff;
    padding: 4px 8px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.2s;
}

.ge-btn-cancel:hover {
    background: rgba(180, 0, 0, 0.9);
}

/* Order Body */
.ge-order-body {
    padding: 16px;
}

.ge-item-preview {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    margin-bottom: 12px;
}

.ge-icon-frame {
    width: 64px;
    height: 64px;
    background: #2a241e;
    border: 3px solid #5d4a37;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 4px;
    box-shadow: inset 0 0 8px rgba(0,0,0,0.6);
}

.ge-icon-frame img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    image-rendering: pixelated;
}

.ge-order-status-text {
    font-size: 14px;
    font-weight: bold;
    color: #e1bb7b;
}

.ge-order-details {
    text-align: center;
}

.ge-price-tag {
    font-size: 16px;
    font-weight: bold;
    color: #ffd700;
    margin-bottom: 8px;
}

.ge-progress-mini {
    height: 8px;
    background: #1a1712;
    border: 1px solid #5d4a37;
    border-radius: 4px;
    overflow: hidden;
}

.ge-progress-mini-fill {
    height: 100%;
    background: linear-gradient(90deg, #4caf50 0%, #8bc34a 100%);
    transition: width 0.3s ease;
}

.ge-refund-badge {
    position: absolute;
    bottom: 8px;
    right: 8px;
    background: rgba(76, 175, 80, 0.9);
    color: #fff;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: bold;
    display: flex;
    align-items: center;
    gap: 4px;
}

/* Empty State */
.ge-empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    padding: 20px;
    gap: 12px;
}

.ge-empty-icon {
    font-size: 48px;
    color: #5d4a37;
    opacity: 0.5;
}

.ge-empty-actions {
    display: flex;
    gap: 8px;
    width: 100%;
}

.ge-btn {
    flex: 1;
    background: #5d4a37;
    border: 2px solid #e1bb7b;
    color: #e1bb7b;
    padding: 8px 12px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
    font-weight: bold;
    transition: all 0.2s;
    text-transform: uppercase;
}

.ge-btn:hover {
    background: #e1bb7b;
    color: #2a241e;
    transform: translateY(-1px);
}

.ge-btn-buy {
    border-color: #ff9800;
    color: #ff9800;
}

.ge-btn-buy:hover {
    background: #ff9800;
    color: #fff;
}

.ge-btn-sell {
    border-color: #4caf50;
    color: #4caf50;
}

.ge-btn-sell:hover {
    background: #4caf50;
    color: #fff;
}

/* ========================================
   MODAL SYSTEM (Buy/Sell/Details)
   ======================================== */

.mp-modal {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0,0,0,0.75);
    z-index: 10000;
    backdrop-filter: blur(4px);
}

.mp-modal.mp-hidden {
    display: none;
}

.mp-modal-open {
    overflow: hidden;
}

/* Modal Window */
.medieval-window {
    background: linear-gradient(135deg, #2a241e 0%, #1f1a15 100%);
    border: 4px solid #5d4a37;
    border-radius: 12px;
    box-shadow: 0 12px 48px rgba(0,0,0,0.8);
    width: 90%;
    max-width: 520px;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    color: #e1bb7b;
}

/* Modal Header */
.medieval-window-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    background: rgba(0,0,0,0.3);
    border-bottom: 2px solid #5d4a37;
}

.medieval-window-header h2 {
    margin: 0;
    font-size: 22px;
    color: #f4d799;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.8);
}

.medieval-close,
.mp-modal-close {
    background: rgba(122, 0, 0, 0.8);
    border: 2px solid #4a0000;
    color: #fff;
    padding: 6px 12px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 16px;
    font-weight: bold;
    transition: all 0.2s;
}

.medieval-close:hover,
.mp-modal-close:hover {
    background: rgba(180, 0, 0, 0.9);
}

/* Modal Body */
.medieval-window-body {
    padding: 20px;
    overflow-y: auto;
    flex: 1;
}

/* Selected Item Display */
/* ==== FIX: Selected item image exploding in Buy/Sell modals ==== */

/* Force the icon wrapper to stay small even if flex/grid tries to stretch it */
.medieval-selected-item .medieval-item-icon {
    width: 48px;
    height: 48px;
    max-width: 48px;
    max-height: 48px;
    flex: 0 0 48px;
    overflow: hidden;
}

/* Force any image inside the selected item area to be constrained */
.medieval-selected-item img,
#mp-buy-selected-icon,
#mp-sell-selected-icon {
    width: 48px;
    height: 48px;
    max-width: 48px;
    max-height: 48px;
    object-fit: contain;
    display: block;
}

.medieval-item-icon img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    image-rendering: pixelated;
}

.medieval-item-info {
    flex: 1;
}

.medieval-item-name {
    font-size: 16px;
    font-weight: bold;
    color: #f4d799;
    margin-bottom: 4px;
}

.medieval-avg-price {
    font-size: 13px;
    opacity: 0.8;
}

/* Search Input */
.medieval-input {
    width: 100%;
    padding: 10px 12px;
    background: rgba(0,0,0,0.4);
    border: 2px solid #5d4a37;
    border-radius: 6px;
    color: #e1bb7b;
    font-size: 14px;
    margin-bottom: 12px;
}

.medieval-input:focus {
    outline: none;
    border-color: #e1bb7b;
}

.medieval-input::placeholder {
    color: #8a6f4f;
}

/* Search Results */
.medieval-search-results {
    max-height: 200px;
    overflow-y: auto;
    background: rgba(0,0,0,0.3);
    border: 2px solid #5d4a37;
    border-radius: 6px;
    margin-bottom: 16px;
}

.medieval-search-item {
    padding: 10px 12px;
    cursor: pointer;
    transition: background 0.2s;
    color: #e1bb7b;
}

.medieval-search-item:hover {
    background: rgba(225, 187, 123, 0.2);
}

.medieval-empty {
    padding: 20px;
    text-align: center;
    opacity: 0.6;
}

/* Number Controls */
.medieval-number-row {
    display: flex;
    gap: 8px;
    margin-bottom: 12px;
    align-items: center;
}

.medieval-number-row label {
    flex: 0 0 80px;
    font-weight: bold;
}

.medieval-number-row input {
    flex: 1;
    padding: 8px;
    background: rgba(0,0,0,0.4);
    border: 2px solid #5d4a37;
    border-radius: 6px;
    color: #e1bb7b;
    font-size: 14px;
}

.medieval-num-btn,
.medieval-pct-btn {
    background: #5d4a37;
    border: 2px solid #e1bb7b;
    color: #e1bb7b;
    padding: 6px 10px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    font-weight: bold;
    transition: all 0.2s;
}

.medieval-num-btn:hover,
.medieval-pct-btn:hover {
    background: #e1bb7b;
    color: #2a241e;
}

/* Total Display */
.medieval-total,
.medieval-avg {
    font-size: 15px;
    margin: 12px 0;
    padding: 10px;
    background: rgba(0,0,0,0.3);
    border: 2px solid #5d4a37;
    border-radius: 6px;
    text-align: center;
}

.medieval-total strong,
.medieval-avg strong {
    color: #ffd700;
    font-size: 18px;
}

/* Modal Footer / Actions */
.medieval-actions-row,
.medieval-window-footer {
    display: flex;
    gap: 12px;
    padding: 16px 20px;
    background: rgba(0,0,0,0.3);
    border-top: 2px solid #5d4a37;
}

.medieval-btn {
    flex: 1;
    padding: 10px 16px;
    border: 2px solid;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    font-weight: bold;
    text-transform: uppercase;
    transition: all 0.2s;
}

.medieval-btn-confirm {
    background: #4caf50;
    border-color: #2e7d32;
    color: #fff;
}

.medieval-btn-confirm:hover {
    background: #66bb6a;
}

.medieval-btn-cancel {
    background: #7a0000;
    border-color: #4a0000;
    color: #fff;
}

.medieval-btn-cancel:hover {
    background: #b40000;
}

/* Inventory Grid in Sell Modal */
.medieval-inventory-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(60px, 1fr));
    gap: 8px;
    max-height: 240px;
    overflow-y: auto;
    padding: 8px;
    background: rgba(0,0,0,0.3);
    border: 2px solid #5d4a37;
    border-radius: 6px;
}

.medieval-inventory-item {
    aspect-ratio: 1;
    background: #2a241e;
    border: 2px solid #5d4a37;
    border-radius: 6px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 6px;
    cursor: pointer;
    transition: all 0.2s;
}

.medieval-inventory-item:hover {
    border-color: #e1bb7b;
    transform: translateY(-2px);
}

.medieval-inventory-item img {
    width: 32px;
    height: 32px;
    object-fit: contain;
    image-rendering: pixelated;
}

.medieval-inventory-item span {
    font-size: 10px;
    text-align: center;
    margin-top: 4px;
}

.medieval-inventory-item small {
    font-size: 9px;
    opacity: 0.7;
}

/* ==== SKILLS (WOODCUTTING, FISHING, MINING) ==== */

.skill-wrapper {
    max-width: 900px;
    margin: 0 auto;
}

.skill-header {
    text-align: center;
    margin-bottom: 30px;
}

.skill-xp-bar {
    width: 100%;
    height: 20px;
    background: #3a2a1a;
    border: 2px solid #5a3e22;
    border-radius: 4px;
    overflow: hidden;
}

.skill-xp-fill {
    height: 100%;
    background: #d4b46a;
}

.actions-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 18px;
    margin-top: 20px;
}

.action-card {
    background: #1a120a;
    border: 2px solid #5a3e22;
    padding: 15px;
    border-radius: 6px;
}

.action-card h3 {
    margin-top: 0;
    color: #d4b46a;
}

.active-task {
    background: #2a1c10;
    border: 2px solid #8a5e2a;
    padding: 20px;
    border-radius: 6px;
    margin-bottom: 25px;
}

.task-progress-bar {
    width: 100%;
    height: 16px;
    background: #3a2a1a;
    border: 1px solid #5a3e22;
    border-radius: 4px;
    overflow: hidden;
    margin: 10px 0;
}

.task-progress-fill {
    height: 100%;
    background: #d4b46a;
}

.skill-log {
    margin-top: 30px;
    background: rgba(0,0,0,0.2);
    padding: 10px;
    border-radius: 6px;
}

.skill-log-entries {
    max-height: 160px;
    overflow-y: auto;
    padding-right: 6px;
}

.log-entry {
    background: #1a120a;
    padding: 8px;
    margin-bottom: 6px;
    border-left: 4px solid #d4b46a;
}

.action-card-header {
    display: flex;
    gap: 10px;
    align-items: center;
    margin-bottom: 8px;
}

.action-icon img {
    width: 48px;
    height: 48px;
    object-fit: contain;
}

.action-input-row {
    display: flex;
    gap: 6px;
    margin: 8px 0;
}

.btn-start {
    width: 100%;
    margin-top: 4px;
}

.tick-progress-bar {
    width: 100%;
    height: 10px;
    background: #3a2a1a;
    border: 1px solid #5a3e22;
    border-radius: 4px;
    overflow: hidden;
    margin-top: 6px;
}

.tick-progress-fill {
    height: 100%;
    width: 0%;
    background: #b58a4a;
    transition: width 0.2s linear;
}

/* ========================================
   MOBILE RESPONSIVE
   ======================================== */

@media (max-width: 768px) {
    .mobile-header {
        display: flex;
        align-items: center;
        padding: 10px 16px;
        background: #1a120a;
        border-bottom: 3px solid #5a3e22;
        position: sticky;
        top: 0;
        z-index: 3000;
    }
    
    .topbar {
        flex-direction: column;
        gap: 10px;
    }

    .topbar-center {
        width: 100%;
        justify-content: center;
    }

    .sidebar {
        position: fixed;
        top: 0;
        left: 0;
        height: 100vh;
        width: 180px;
        transform: translateX(-100%);
        z-index: 2500;
        padding-top: 60px;
    }

    .sidebar.open {
        transform: translateX(0);
    }

    #sidebar-overlay {
        display: block;
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background: rgba(0,0,0,0.55);
        opacity: 0;
        pointer-events: none;
        transition: opacity 0.3s ease;
        z-index: 2000;
    }

    #sidebar-overlay.visible {
        opacity: 1;
        pointer-events: auto;
    }

    .layout-grid {
        grid-template-columns: 1fr;
        height: auto;
    }

    .content-area {
        padding: 14px;
    }

    #mobile-bottom-tabs {
        position: fixed;
        bottom: 260px;
        left: 0;
        right: 0;
        height: 50px;
        background: rgba(18,14,10,0.96);
        display: flex;
        justify-content: space-around;
        align-items: center;
        border-top: 3px solid #3a2f22;
        box-shadow: 0 -4px 12px rgba(0,0,0,0.6);
        z-index: 999;
    }

    #mobile-bottom-tabs button {
        background: linear-gradient(#3a2f22, #2a2218);
        border: 2px solid #5a4a33;
        padding: 8px 16px;
        border-radius: 6px;
        color: #e2d3b5;
        font-size: 18px;
        font-weight: bold;
        text-shadow: 0 0 4px #000;
    }

    #mobile-bottom-tabs button.active {
        background: linear-gradient(#6a553c, #3a2f22);
        border-color: #c8a46b;
        box-shadow: 0 0 6px #c8a46b;
    }

    #mobile-bottom-tabs.collapsed {
        display: none;
    }

    #mobile-bottom-toggle {
        position: fixed;
        bottom: 240px;
        left: 0;
        right: 0;
        display: flex;
        justify-content: center;
        z-index: 1000;
        transition: bottom 0.25s ease;
    }

    #mobile-bottom-toggle.collapsed {
        bottom: 10px;
    }

    #mobile-bottom-toggle button {
        background: #3a2f22;
        border: 2px solid #5a4a33;
        padding: 6px 14px;
        border-radius: 6px;
        color: #e2d3b5;
        font-size: 18px;
        text-shadow: 0 0 4px #000;
    }

    #bottombar {
        height: 260px;
        display: block;
        overflow: hidden;
    }

    #bottom-left,
    #bottom-right {
        width: 100%;
        height: 100%;
        display: none;
    }

    #bottom-left.active,
    #bottom-right.active {
        display: block;
    }

    .ge-grid {
        grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
        gap: 12px;
    }

    .medieval-window {
        width: 95%;
        max-height: 90vh;
    }
}

/* =========================
   Marketplace modal images
   ========================= */

/* Selected item icon (buy/sell modal header/selected area) */
#mp-buy-selected-icon,
#mp-sell-selected-icon {
  width: 48px;
  height: 48px;
  max-width: 48px;
  max-height: 48px;
  object-fit: contain;
  display: block;
  flex: 0 0 48px;
}

/* Inventory grid icons inside sell modal */
#mp-sell-inventory .medieval-inventory-item img,
#mp-buy-search-results .medieval-search-item img {
  width: 32px;
  height: 32px;
  max-width: 32px;
  max-height: 32px;
  object-fit: contain;
  display: block;
}

/* Order details modal item display icon (if applicable) */
#mp-order-details-body .medieval-item-display img {
  width: 48px;
  height: 48px;
  max-width: 48px;
  max-height: 48px;
  object-fit: contain;
  display: block;
}

/* Safety net: prevent modal images from ever expanding to full width */
.mp-modal img {
  max-width: 100%;
  height: auto;
}

/* =========================
   HOME PAGE
   ========================= */

.home-wrapper {
    max-width: 1100px;
    margin: 0 auto;
    padding: 10px 6px;
}

.home-title {
    margin: 0 0 6px;
    font-size: 28px;
    color: #f4d799;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.8);
}

.home-subtitle {
    margin: 0 0 18px;
    opacity: 0.85;
}

/* Grid of cards */
.home-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 16px;
}

@media (max-width: 980px) {
    .home-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 640px) {
    .home-grid {
        grid-template-columns: 1fr;
    }
}

/* Individual card */
.home-card {
    background: linear-gradient(135deg, #2a241e 0%, #1f1a15 100%);
    border: 3px solid #5d4a37;
    border-radius: 10px;
    padding: 16px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.55);
    color: #e1bb7b;
}

.home-card h2 {
    margin: 0 0 8px;
    font-size: 18px;
    color: #f4d799;
}

.home-card p {
    margin: 0 0 10px;
    opacity: 0.9;
}

.home-card ul {
    margin: 0;
    padding-left: 18px;
}

.home-card li {
    margin: 6px 0;
}

.home-card a {
    color: #d4b46a;
}

.home-card a:hover {
    text-decoration: underline;
}

/* =========================
   SKILLS: LOCKED ACTION CARDS
   ========================= */

.action-card.action-card-locked {
    opacity: 0.55;
    filter: grayscale(0.55);
    background: #14100b;
    border-color: #3a2f22;
    box-shadow: inset 0 0 10px rgba(0,0,0,0.55);
    position: relative;
}

/* Make the icon a bit dimmer too */
.action-card.action-card-locked .action-icon img {
    opacity: 0.75;
}

/* Locked label styling */
.action-locked-label {
    display: inline-block;
    margin-top: 6px;
    padding: 2px 8px;
    font-size: 11px;
    letter-spacing: 1px;
    border-radius: 999px;
    border: 1px solid rgba(225, 187, 123, 0.35);
    color: rgba(225, 187, 123, 0.85);
    background: rgba(0,0,0,0.35);
}

/* Optional: subtle overlay to indicate disabled */
.action-card.action-card-locked::after {
    content: "";
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,0.18);
    pointer-events: none;
}

.hidden { display: none !important; }

.modal {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0,0,0,0.75);
    z-index: 10000;
}

.modal .modal-content {
    background: #1a120a;
    border: 2px solid #5a3e22;
    border-radius: 10px;
    padding: 16px;
    width: 90%;
    max-width: 420px;
}

/* ============================================================
   Profile page (medieval/game style)
   ============================================================ */

.profile-wrapper{
  max-width: 1100px;
  margin: 0 auto;
  padding: 16px;
}

.profile-header{
  display: grid;
  grid-template-columns: 96px 1fr;
  gap: 16px;
  align-items: center;

  background: rgba(20, 16, 12, 0.72);
  border: 1px solid rgba(255, 215, 128, 0.25);
  border-radius: 12px;
  padding: 16px;

  box-shadow: 0 10px 24px rgba(0,0,0,0.35);
  backdrop-filter: blur(4px);
}

.profile-avatar{
  width: 96px;
  height: 96px;
  border-radius: 12px;
  object-fit: cover;

  border: 2px solid rgba(255, 215, 128, 0.35);
  box-shadow: 0 6px 16px rgba(0,0,0,0.35);
  background: rgba(0,0,0,0.25);
}

.profile-info h1{
  margin: 0 0 6px 0;
  font-size: 22px;
  letter-spacing: 0.2px;
}

.profile-info p{
  margin: 4px 0;
  color: rgba(255,255,255,0.85);
  font-size: 14px;
}

.online-status{
  display: inline-block;
  margin-top: 8px;
  padding: 6px 10px;
  border-radius: 999px;
  font-weight: 700;
  font-size: 12px;
  letter-spacing: 0.3px;
  border: 1px solid rgba(255,255,255,0.14);
}

.online-status.online{
  color: #d7ffe0;
  background: rgba(38, 170, 90, 0.22);
  border-color: rgba(38, 170, 90, 0.35);
}

.online-status.offline{
  color: #ffe0e0;
  background: rgba(180, 60, 60, 0.22);
  border-color: rgba(180, 60, 60, 0.35);
}

.btn-edit-profile{
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;

  margin-top: 10px;
  padding: 10px 12px;
  border-radius: 10px;

  text-decoration: none;
  font-weight: 800;
  font-size: 13px;

  color: rgba(255, 235, 200, 0.95);
  background: linear-gradient(180deg, rgba(120,80,35,0.95), rgba(70,45,18,0.95));
  border: 1px solid rgba(255, 215, 128, 0.28);
  box-shadow: 0 8px 18px rgba(0,0,0,0.35);
  transition: transform 120ms ease, filter 120ms ease;
}

.btn-edit-profile:hover{
  transform: translateY(-1px);
  filter: brightness(1.05);
}

.btn-edit-profile:active{
  transform: translateY(0);
}

.section-title{
  margin: 18px 0 10px 0;
  font-size: 16px;
  letter-spacing: 0.3px;
  color: rgba(255, 235, 200, 0.95);
}

.skills-grid{
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

@media (max-width: 980px){
  .skills-grid{ grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 720px){
  .profile-header{ grid-template-columns: 72px 1fr; }
  .profile-avatar{ width: 72px; height: 72px; }
  .skills-grid{ grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 460px){
  .skills-grid{ grid-template-columns: 1fr; }
}

.skill-card{
  background: rgba(16, 12, 9, 0.72);
  border: 1px solid rgba(255, 215, 128, 0.22);
  border-radius: 12px;
  padding: 12px;
  box-shadow: 0 10px 20px rgba(0,0,0,0.32);
}

.skill-card-header{
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 6px;
}

.skill-icon{
  width: 34px;
  height: 34px;
  object-fit: contain;
  border-radius: 8px;
  background: rgba(0,0,0,0.25);
  border: 1px solid rgba(255,255,255,0.10);
}

.skill-card h3{
  margin: 0;
  font-size: 14px;
  font-weight: 800;
}

.skill-level{
  margin: 6px 0 8px 0;
  font-size: 13px;
  color: rgba(255,255,255,0.86);
}

.skill-progress-bar{
  height: 10px;
  border-radius: 999px;
  overflow: hidden;
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.10);
}

.skill-progress-fill{
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, rgba(255, 215, 128, 0.95), rgba(255, 170, 80, 0.95));
  box-shadow: inset 0 0 10px rgba(0,0,0,0.25);
}

.skill-progress-text{
  margin: 8px 0 0 0;
  font-size: 12px;
  color: rgba(255,255,255,0.72);
}

.tavern-container{
  max-width: 1100px;
  margin: 20px auto 120px auto;
  padding: 20px;
  background: rgba(20,16,12,0.9);
  border: 2px solid #3a2f22;
  border-radius: 12px;
  box-shadow: 0 12px 30px rgba(0,0,0,0.45);
  color: #e2d3b5;
}

.tavern-header{
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin-bottom: 16px;
}

.tavern-title h1{
  margin: 0 0 6px 0;
  font-size: 24px;
}

.tavern-subtitle{
  margin: 0;
  opacity: 0.75;
  font-size: 13px;
}

.gold-display{
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  border-radius: 8px;
  background: rgba(40,30,22,0.8);
  border: 1px solid #6a553c;
}

.gold-amount{
  font-weight: 700;
}

.category-tabs{
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 16px;
}

.category-tab{
  background: linear-gradient(#4a3b2a, #2f261c);
  color: #e2d3b5;
  border: 2px solid #5a4a33;
  padding: 6px 12px;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 6px;
}

.category-tab.active{
  border-color: #c8a46b;
  box-shadow: 0 0 6px #c8a46b;
}

.items-grid{
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 12px;
}

.item-card{
  background: rgba(30,24,18,0.85);
  border: 2px solid #3a2f22;
  border-radius: 10px;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 180px;
}

.item-icon-container{
  position: relative;
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0,0,0,0.25);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 10px;
}

.item-icon{
  font-size: 26px;
}

.owned-badge{
  position: absolute;
  right: -6px;
  top: -6px;
  background: #c8a46b;
  color: #2a2218;
  border-radius: 10px;
  padding: 2px 6px;
  font-size: 11px;
  font-weight: 700;
}

.item-name{
  margin: 0 0 4px 0;
  font-size: 14px;
}

.item-description{
  margin: 0 0 6px 0;
  font-size: 12px;
  opacity: 0.8;
}

.item-effect{
  margin: 0;
  font-size: 12px;
  color: #ffd27f;
}

.item-footer{
  margin-top: auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.item-price{
  font-weight: 700;
}

.purchase-btn{
  background: linear-gradient(#6a553c, #3a2f22);
  border: 2px solid #c8a46b;
  color: #e2d3b5;
  padding: 6px 10px;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 700;
}

.purchase-btn.disabled,
.purchase-btn:disabled{
  opacity: 0.5;
  cursor: not-allowed;
}

.notification{
  margin-top: 16px;
  padding: 10px 12px;
  border-radius: 8px;
  display: none;
  background: rgba(30,24,18,0.9);
  border: 2px solid #3a2f22;
}

.notification.show{
  display: block;
}

.notification.success{
  border-color: #4caf50;
  color: #c8f7c5;
}

.notification.error{
  border-color: #b74b4b;
  color: #f5b2b2;
}

/* shop modal */
/* ==== SHOP MODAL (medieval-styled replacement) ==== */
/* Replace the previous "shop modal" block with this */

.shop-modal-overlay {
    position: fixed;
    inset: 0;
    display: none;
    align-items: center;
    justify-content: center;
    background: rgba(0,0,0,0.65);
    z-index: 9999;
    backdrop-filter: blur(3px);
}
.shop-modal-overlay.open {
    display: flex;
}

/* Make the modal match the medieval window style */
.shop-modal {
    background: linear-gradient(135deg, #2a241e 0%, #1f1a15 100%);
    border: 4px solid #5d4a37;
    border-radius: 12px;
    width: 320px;
    max-width: 95%;
    padding: 16px;
    box-shadow: 0 12px 36px rgba(0,0,0,0.7);
    position: relative;
    color: #e1bb7b; /* readable parchment text color */
    overflow: hidden;
}

/* close button */
.shop-modal .modal-close {
    position: absolute;
    right: 8px;
    top: 8px;
    background: rgba(122, 0, 0, 0.8);
    border: 2px solid #4a0000;
    color: #fff;
    padding: 6px 10px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 16px;
    font-weight: bold;
}
.shop-modal .modal-close:hover {
    background: rgba(180, 0, 0, 0.9);
}

/* Title & item info */
.modal-title {
    margin: 0 0 8px 0;
    font-size: 18px;
    color: #f4d799;
    text-shadow: 1px 1px 3px rgba(0,0,0,0.6);
}
.modal-item-info {
    margin-bottom: 10px;
    color: #e1bb7b; /* make description readable on dark background */
    font-size: 14px;
}

/* Quantity controls - high contrast and medieval buttons */
.modal-quantity-row {
    display:flex;
    align-items:center;
    gap:8px;
    margin: 8px 0;
    justify-content:center;
}

.qty-btn {
    width:36px;
    height:36px;
    border-radius:6px;
    border: 2px solid #5d4a37;
    background: linear-gradient(#5d4a37, #3a2f22);
    color: #e1bb7b;
    cursor:pointer;
    font-size:20px;
    line-height:1;
    box-shadow: 0 4px 10px rgba(0,0,0,0.5);
}
.qty-btn:hover { filter: brightness(1.05); }

/* Input: dark background, light text */
.qty-input {
    width:70px;
    text-align:center;
    font-size:16px;
    padding:6px;
    border-radius:6px;
    border: 2px solid #5d4a37;
    background: rgba(0,0,0,0.35);
    color: #e1bb7b;
    outline: none;
    box-shadow: inset 0 2px 6px rgba(0,0,0,0.6);
}
.qty-input:focus {
    border-color: #e1bb7b;
    box-shadow: 0 0 8px rgba(200,162,107,0.18);
}

/* Total & actions */
.modal-total {
    text-align:center;
    margin: 8px 0;
    font-weight:700;
    color: #ffd700;
}

.modal-actions {
    display:flex;
    gap:8px;
    justify-content:center;
    margin-top:12px;
}

/* Buttons - medieval style matching rest of UI */
.btn {
    padding:8px 12px;
    border-radius:6px;
    border: 2px solid #5d4a37;
    cursor:pointer;
    font-weight:700;
    color: #e1bb7b;
    background: linear-gradient(#3a2f22, #2a1c12);
    transition: all 0.15s;
    box-shadow: 0 6px 16px rgba(0,0,0,0.45);
}
.btn:hover { transform: translateY(-2px); }

.btn.confirm {
    background: linear-gradient(#4caf50, #2e7d32);
    color: #fff;
    border-color: #2e7d32;
}
.btn.confirm:hover { filter: brightness(1.05); }

.btn.cancel {
    background: linear-gradient(#7a0000, #4a0000);
    color: #fff;
    border-color: #4a0000;
}
.btn.cancel:hover { filter: brightness(1.05); }

/* Loading state for purchase button */
.purchase-btn.loading { opacity: 0.85; transform: none; pointer-events: none; }

/* Owned badge (ensure consistent look) */
.owned-badge {
    background: #c8a46b;
    color: #2a2218;
    border-radius: 10px;
    padding: 2px 6px;
    font-size: 11px;
    font-weight: 700;
    margin-left: 6px;
}

/* PURCHASE MODAL OVERLAY & STYLES (append to style.css) */

/* overlay that dims the page */
#purchase-overlay {
  position: fixed;
  inset: 0; /* top:0; right:0; bottom:0; left:0; */
  background: rgba(0,0,0,0.65);
  z-index: 9000;
  display: none;
  transition: opacity 180ms ease;
  opacity: 0;
  pointer-events: auto;
}

/* visible state (toggled by JS) */
#purchase-overlay.visible {
  display: block;
  opacity: 1;
}

/* ensure the modal sits above the overlay */
.purchase-form {
  position: fixed;
  z-index: 9010;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  display: none;
  max-width: 680px;
  width: calc(100% - 40px);
  box-sizing: border-box;
  padding: 0; /* interior handled by .modal-content in your markup */
  outline: none;
  transition: transform 180ms ease, opacity 180ms ease;
  opacity: 1;
}

/* optional: small scale animation when shown */
.purchase-form[aria-hidden="false"] {
  display: block;
  transform: translate(-50%, -50%) scale(1);
  opacity: 1;
}

/* modal content styling that matches a darker theme */
.purchase-form .modal-content,
.purchase-form .panel,
.purchase-form .box {
  background-color: #2e2418;      /* dark brown */
  color: #f7ecd8;                 /* light text */
  border-radius: 6px;
  box-shadow: 0 8px 40px rgba(0,0,0,0.6);
  padding: 18px;
}

/* form elements contrast for readability */
.purchase-form input,
.purchase-form select,
.purchase-form textarea {
  background: #3a2e24;
  color: #f7ecd8;
  border: 1px solid rgba(255,255,255,0.06);
  padding: 6px 8px;
  border-radius: 3px;
}

/* buttons inside purchase modal */
.purchase-form .btn,
.purchase-form button {
  background: #6b4f33;
  color: #fff;
  border: 1px solid rgba(0,0,0,0.2);
  padding: 8px 12px;
  border-radius: 4px;
  cursor: pointer;
}
.purchase-form .btn.cancel,
.purchase-form .btn.close {
  background: #4a392b;
}

/* prevent page jump when modal opens */
body.modal-open {
  overflow: hidden;
}

/* small responsive tweak */
@media (max-width: 520px) {
  .purchase-form { width: calc(100% - 20px); left: 50%; top: 50%; }
  .purchase-form .modal-content { padding: 12px; }
}

/* style.css */

/* Sell Modal Specifics */
.sell-info {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    margin-bottom: 20px;
    padding: 15px;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid #5a3e22;
    border-radius: 4px;
}

#sell-icon {
    width: 64px;
    height: 64px;
    object-fit: contain;
    border: 2px solid #d4b46a;
    background: #1a120a;
    padding: 5px;
    box-shadow: inset 0 0 10px rgba(0,0,0,0.5);
}

#sell-name {
    font-weight: bold;
    color: #d4b46a;
    font-size: 1.1em;
}

.marketplace-option {
    margin-top: 15px;
    border-top: 1px solid #5a3e22;
    padding-top: 15px;
}

#sell-marketplace {
    width: 100%;
    background: linear-gradient(#5a3e22, #3a2a1a);
    color: #e6d7b0;
    border: 1px solid #d4b46a;
    padding: 8px;
    cursor: pointer;
    font-family: "Cinzel", serif;
}

#sell-marketplace:hover {
    background: linear-gradient(#7a532e, #5a3e22);
    color: #fff;
}

/* ---- Shop-specific overrides (medieval theme) ---- */
        .tavern-container {
            max-width: 980px;
            margin: 0 auto;
            padding: 24px;
        }
        .tavern-header {
            display: flex;
            justify-content: space-between;
            align-items: center;
            margin-bottom: 20px;
            padding-bottom: 16px;
            border-bottom: 2px solid #5a3e22;
        }
        .tavern-title h1 {
            margin: 0;
            font-size: 26px;
            color: #f4d799;
            text-shadow: 2px 2px 4px rgba(0,0,0,0.8);
        }
        .tavern-subtitle {
            margin: 4px 0 0;
            color: #b08b4f;
            font-style: italic;
            font-size: 14px;
        }
        .gold-display {
            display: flex;
            align-items: center;
            gap: 8px;
            color: #d4b46a;
            font-weight: 700;
            font-size: 18px;
        }

        /* ---- Category Tabs ---- */
        .category-tabs {
            display: flex;
            flex-wrap: wrap;
            gap: 8px;
            margin-bottom: 20px;
        }
        .category-tab {
            display: flex;
            align-items: center;
            gap: 6px;
            padding: 8px 16px;
            border: 2px solid #5a3e22;
            border-radius: 6px;
            background: linear-gradient(#3a2f22, #2a2218);
            color: #e2d3b5;
            font-family: inherit;
            font-size: 14px;
            font-weight: bold;
            cursor: pointer;
            transition: all 0.15s;
            text-transform: capitalize;
        }
        .category-tab:hover {
            background: linear-gradient(#4a3b2a, #2f261c);
            border-color: #b08b4f;
        }
        .category-tab.active {
            background: linear-gradient(#6a553c, #3a2f22);
            border-color: #d4b46a;
            color: #f4d799;
            box-shadow: 0 0 8px rgba(212,180,106,0.4);
        }
        .tab-count {
            background: rgba(0,0,0,0.4);
            border-radius: 999px;
            padding: 1px 7px;
            font-size: 12px;
            color: #b08b4f;
        }
        .category-tab.active .tab-count {
            color: #d4b46a;
        }

        /* ---- Items Grid ---- */
        .items-grid {
            display: grid;
            grid-template-columns: 1fr;
            gap: 14px;
        }
        @media (min-width: 600px) {
            .items-grid { grid-template-columns: repeat(2, 1fr); }
        }
        @media (min-width: 900px) {
            .items-grid { grid-template-columns: repeat(3, 1fr); }
        }

        /* ---- Item Card ---- */
        .item-card {
            display: flex;
            flex-direction: column;
            background: linear-gradient(135deg, #2a241e 0%, #1f1a15 100%);
            border: 2px solid #5a3e22;
            border-radius: 8px;
            padding: 14px;
            transition: border-color 0.15s, box-shadow 0.15s;
        }
        .item-card:hover {
            border-color: #b08b4f;
            box-shadow: 0 0 10px rgba(180,139,79,0.25);
        }
        .item-card-top {
            display: flex;
            gap: 12px;
            align-items: flex-start;
            margin-bottom: 12px;
        }
        .item-icon-container {
            position: relative;
            width: 56px;
            height: 56px;
            flex-shrink: 0;
            background: #1a120a;
            border: 2px solid #5a3e22;
            border-radius: 6px;
            display: flex;
            align-items: center;
            justify-content: center;
            font-size: 28px;
        }
        .item-icon-container img {
            width: 100%;
            height: 100%;
            object-fit: contain;
            image-rendering: pixelated;
        }
        .owned-badge {
            position: absolute;
            top: -6px;
            right: -6px;
            background: #d4b46a;
            color: #1a120a;
            padding: 2px 6px;
            border-radius: 999px;
            font-size: 11px;
            font-weight: bold;
            border: 1px solid #5a3e22;
        }
        .item-details { flex: 1; min-width: 0; }
        .item-name {
            margin: 0 0 4px;
            font-size: 16px;
            color: #f4d799;
        }
        .item-description {
            margin: 0;
            font-size: 13px;
            color: #b08b4f;
            line-height: 1.4;
        }
        .item-effect {
            margin: 6px 0 0;
            font-size: 13px;
            color: #4caf50;
            font-weight: bold;
        }
        .item-footer {
            display: flex;
            align-items: center;
            justify-content: space-between;
            gap: 10px;
            margin-top: auto;
        }
        .item-price {
            display: flex;
            align-items: center;
            gap: 5px;
            background: rgba(0,0,0,0.3);
            border: 1px solid #5a3e22;
            border-radius: 6px;
            padding: 5px 10px;
            color: #d4b46a;
            font-weight: bold;
            font-size: 15px;
        }
        .purchase-btn {
            padding: 8px 16px;
            border-radius: 6px;
            border: 2px solid #5a3e22;
            background: linear-gradient(#5a3e22, #3a2a1a);
            color: #e6d7b0;
            font-family: inherit;
            font-size: 13px;
            font-weight: bold;
            cursor: pointer;
            transition: all 0.15s;
        }
        .purchase-btn:hover:not([disabled]):not(.disabled) {
            background: linear-gradient(#7a532e, #5a3e22);
            border-color: #d4b46a;
            color: #f4d799;
        }
        .purchase-btn.disabled,
        .purchase-btn[disabled] {
            background: #1a1a1a;
            border-color: #333;
            color: #555;
            cursor: not-allowed;
        }
        .purchase-btn.loading {
            opacity: 0.6;
            cursor: wait;
        }

        /* ---- Empty state ---- */
        .shop-empty {
            grid-column: 1 / -1;
            text-align: center;
            padding: 40px;
            color: #b08b4f;
            font-style: italic;
        }

        /* ---- Notification ---- */
        #notification {
            position: fixed;
            top: 20px;
            right: 20px;
            padding: 12px 20px;
            border-radius: 8px;
            font-weight: bold;
            font-size: 15px;
            z-index: 99999;
            opacity: 0;
            pointer-events: none;
            transition: opacity 0.3s;
            max-width: 320px;
        }
        #notification.show {
            opacity: 1;
            pointer-events: auto;
        }
        #notification.success {
            background: #1e4d2b;
            border: 2px solid #4caf50;
            color: #a5d6a7;
        }
        #notification.error {
            background: #4a0000;
            border: 2px solid #b71c1c;
            color: #ef9a9a;
        }

        /* ---- Purchase Modal ---- */
        .purchase-modal {
            position: fixed;
            inset: 0;
            display: none;
            align-items: center;
            justify-content: center;
            z-index: 100000;
        }
        .purchase-modal.show {
            display: flex;
        }
        .purchase-modal-backdrop {
            position: absolute;
            inset: 0;
            background: rgba(0,0,0,0.6);
        }
        .purchase-modal-content {
            position: relative;
            z-index: 1;
            width: 100%;
            max-width: 360px;
            background: linear-gradient(135deg, #2a241e 0%, #1f1a15 100%);
            border: 2px solid #5a3e22;
            border-radius: 10px;
            padding: 16px;
            color: #e2d3b5;
            box-shadow: 0 0 16px rgba(0,0,0,0.5);
        }
        .purchase-modal-title {
            font-size: 16px;
            font-weight: bold;
            color: #f4d799;
            margin: 0 0 10px;
        }
        .purchase-modal-row {
            display: flex;
            align-items: center;
            justify-content: space-between;
            gap: 10px;
            margin-bottom: 12px;
            font-size: 14px;
        }
        .purchase-modal-row input {
            width: 90px;
            padding: 6px 8px;
            border-radius: 6px;
            border: 2px solid #5a3e22;
            background: #1a120a;
            color: #e6d7b0;
            font-family: inherit;
        }
        .purchase-modal-actions {
            display: flex;
            gap: 10px;
            justify-content: flex-end;
        }
        .purchase-modal-actions button {
            padding: 7px 14px;
            border-radius: 6px;
            border: 2px solid #5a3e22;
            background: linear-gradient(#5a3e22, #3a2a1a);
            color: #e6d7b0;
            font-family: inherit;
            font-size: 13px;
            font-weight: bold;
            cursor: pointer;
        }
        .purchase-modal-actions .cancel-btn {
            background: #1a1a1a;
            border-color: #333;
            color: #b08b4f;
        }