/* Character Marketplace — public pages */

.market-body {
    min-height: 100vh;
    color: #eef0f6;
    font-family: 'Inter', 'Segoe UI', sans-serif;
    background: #07080d;
    overflow-x: hidden;
    padding-top: 80px;
    box-sizing: border-box;
}

.market-body .site-bg {
    z-index: 0;
}

.market-main {
    position: relative;
    z-index: 5;
    pointer-events: auto;
}

.market-sell-banner {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(160px, 220px);
    gap: 20px;
    align-items: center;
    padding: 18px 20px;
    border-radius: 14px;
    background: rgba(14, 16, 24, 0.92);
    border: 1px solid rgba(197, 160, 89, 0.22);
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    overflow: hidden;
}

.market-sell-banner__text {
    min-width: 0;
}

.market-sell-banner h2 {
    margin: 0 0 10px;
    font-family: 'Cinzel', Georgia, serif;
    font-size: 1.1rem;
    color: #d8c08e;
}

.market-sell-steps {
    margin: 0;
    padding-left: 18px;
    color: #8b93a7;
    font-size: 0.88rem;
    line-height: 1.55;
}

.market-sell-banner__action {
    display: flex;
    flex-direction: column;
    gap: 8px;
    width: 100%;
    max-width: 220px;
    min-width: 0;
    justify-self: end;
    box-sizing: border-box;
}

.market-sell-banner__action .market-btn--wide {
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
}

.market-item-icon img,
.market-skill-icon img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
    padding: 2px;
    box-sizing: border-box;
}

.market-item-icon.is-fallback::after,
.market-skill-icon:not(:has(img))::after {
    display: none;
}

.market-item-icon.is-fallback,
.market-item-icon:not(:has(img:not([hidden]))) {
    display: grid;
    place-items: center;
}

.market-item-icon__fallback,
.market-item-icon.is-fallback::before {
    font-size: 0.62rem;
    font-weight: 800;
    color: #d8c08e;
    letter-spacing: 0.04em;
    text-shadow: 0 1px 2px #000;
    pointer-events: none;
}

.market-item-icon.is-fallback::before {
    content: attr(data-label);
}

.market-item-icon__fallback {
    position: absolute;
    inset: 0;
    display: grid;
    place-items: center;
}

.market-topbar {
    position: sticky;
    top: 0;
    z-index: 100;
    backdrop-filter: blur(12px);
    background: rgba(8, 10, 16, 0.88);
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    width: 100%;
    box-sizing: border-box;
}

.market-topbar__inner {
    max-width: 1280px;
    width: 100%;
    margin: 0 auto;
    padding: 12px 20px;
    display: flex;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
    box-sizing: border-box;
}

.market-brand {
    display: flex;
    flex-direction: column;
    line-height: 1.1;
    min-width: 0;
    flex: 0 1 auto;
}

.market-brand__line {
    font-size: 0.65rem;
    letter-spacing: 0.18em;
    color: #8b93a7;
}

.market-brand__name {
    font-family: 'Cinzel', Georgia, serif;
    font-size: 1rem;
    color: #d8c08e;
    letter-spacing: 0.06em;
}

.market-nav {
    display: flex;
    gap: 16px;
    flex: 1 1 auto;
    min-width: 0;
    flex-wrap: wrap;
}

.market-nav a {
    color: #8b93a7;
    font-size: 0.92rem;
    font-weight: 500;
    white-space: nowrap;
}

.market-nav a:hover,
.market-nav a.active {
    color: #eef0f6;
}

.market-topbar__actions {
    display: flex;
    gap: 8px;
    flex: 0 1 auto;
    flex-wrap: wrap;
    justify-content: flex-end;
    margin-left: auto;
    max-width: 100%;
}

.market-topbar__actions .market-btn {
    padding: 8px 14px;
    font-size: 0.82rem;
    white-space: nowrap;
}

.market-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 18px;
    border-radius: 8px;
    border: 1px solid transparent;
    font-weight: 600;
    font-size: 0.88rem;
    cursor: pointer;
    transition: 0.15s ease;
}

.market-btn--ghost {
    background: rgba(255, 255, 255, 0.04);
    border-color: rgba(255, 255, 255, 0.1);
    color: #eef0f6;
}

.market-btn--gold,
.market-btn--buy {
    background: linear-gradient(135deg, var(--nexum-gold-dark) 0%, var(--nexum-gold) 55%, var(--nexum-gold-bright) 100%);
    color: #1a1408;
    font-weight: 700;
    border: 1px solid rgba(212, 184, 122, 0.35);
    box-shadow: 0 4px 14px rgba(197, 160, 89, 0.22);
}

.market-btn--gold:hover,
.market-btn--buy:hover {
    filter: brightness(1.06);
    box-shadow: 0 6px 18px rgba(197, 160, 89, 0.32);
    transform: translateY(-1px);
}

.market-btn--wide {
    width: 100%;
    margin-top: 10px;
}

.market-btn:hover {
    filter: brightness(1.06);
}

.market-btn--ghost:hover {
    transform: none;
    filter: none;
    background: rgba(255, 255, 255, 0.07);
}

.market-main {
    max-width: 1280px;
    width: 100%;
    margin: 0 auto;
    padding: 32px 20px 64px;
    box-sizing: border-box;
}

.market-page {
    display: flex;
    flex-direction: column;
    gap: 24px;
    width: 100%;
    max-width: 100%;
    min-width: 0;
}

.market-title {
    font-family: 'Cinzel', Georgia, serif;
    font-size: 2rem;
    margin: 0;
    letter-spacing: 0.04em;
}

.market-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: end;
    padding: 18px;
    background: rgba(14, 16, 24, 0.85);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 12px;
}

.market-filter {
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-width: 160px;
}

.market-filter span {
    font-size: 0.78rem;
    color: #8b93a7;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.market-filter input,
.market-filter select {
    padding: 10px 12px;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(0, 0, 0, 0.35);
    color: #eef0f6;
}

.market-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 20px;
}

.market-card {
    background: rgba(14, 16, 24, 0.9);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 14px;
    padding: 18px;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.market-card__head {
    display: flex;
    gap: 14px;
    align-items: center;
}

.market-card__avatar {
    width: 56px;
    height: 64px;
    border-radius: 10px;
    background: radial-gradient(circle at 30% 30%, rgba(255, 255, 255, 0.08), transparent 55%),
        linear-gradient(135deg, #2a3148, #171b27);
    border: 1px solid rgba(197, 160, 89, 0.35);
    flex-shrink: 0;
    display: block;
    overflow: hidden;
    box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.35);
    position: relative;
}

.market-card__avatar--human { background-color: #2b3140; }
.market-card__avatar--elf { background-color: #1f3a2d; }
.market-card__avatar--darkelf { background-color: #2f2440; }
.market-card__avatar--orc { background-color: #3a2a22; }
.market-card__avatar--dwarf { background-color: #3a3420; }
.market-card__avatar--kamael { background-color: #2a2438; }

.market-card__class-icon {
    width: 100%;
    height: 200%;
    object-fit: cover;
    object-position: top center;
    display: block;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.45));
}

.market-card__race-icon {
    width: 44px;
    height: 44px;
    object-fit: contain;
    image-rendering: auto;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.45));
}

.market-card__avatar.is-empty::after {
    content: "?";
    color: #c5a059;
    font-weight: 800;
    font-size: 1.1rem;
}

.market-card__name {
    margin: 0;
    font-size: 1.15rem;
}

.market-card__class {
    color: #8b93a7;
    font-size: 0.88rem;
}

.market-card__race {
    color: #c5a059;
    font-size: 0.76rem;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    margin-top: 2px;
}

.market-card__stats {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 6px;
    font-size: 0.84rem;
}

.market-card__stats li {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    color: #8b93a7;
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
    padding-bottom: 5px;
}

.market-card__stats strong {
    color: #eef0f6;
    text-align: right;
}

.market-card__stats-skins strong {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 2px;
    max-width: 58%;
}

.market-card__skin-names {
    display: block;
    font-style: normal;
    font-weight: 500;
    font-size: 0.72rem;
    line-height: 1.35;
    color: #b8c0d4;
}

.market-card__foot {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-top: auto;
    padding-top: 8px;
}

.market-card__price {
    font-size: 1.35rem;
    font-weight: 800;
    color: var(--nexum-gold-light);
    text-shadow: 0 0 16px rgba(197, 160, 89, 0.35);
}

.market-empty {
    text-align: center;
    padding: 48px 24px;
    background: rgba(14, 16, 24, 0.7);
    border-radius: 14px;
    color: #8b93a7;
}

/* Detail page */
.market-detail {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.market-back {
    color: #8b93a7;
    font-size: 0.9rem;
}

.market-back:hover {
    color: #d8c08e;
}

.market-detail__header {
    background: rgba(14, 16, 24, 0.9);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 14px;
    padding: 20px;
}

.market-detail__hero {
    display: flex;
    gap: 20px;
    align-items: flex-start;
}

.market-detail__portrait {
    width: 96px;
    height: 110px;
    border-radius: 12px;
    border: 1px solid rgba(197, 160, 89, 0.35);
    overflow: hidden;
    flex-shrink: 0;
    background: linear-gradient(135deg, #2a3148, #171b27);
    box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.35);
}

.market-detail__portrait--human { background-color: #2b3140; }
.market-detail__portrait--elf { background-color: #1f3a2d; }
.market-detail__portrait--darkelf { background-color: #2f2440; }
.market-detail__portrait--orc { background-color: #3a2a22; }
.market-detail__portrait--dwarf { background-color: #3a3420; }
.market-detail__portrait--kamael { background-color: #2a2438; }

.market-detail__class-icon {
    width: 100%;
    height: 200%;
    object-fit: cover;
    object-position: top center;
    display: block;
}

.market-detail__info-grid {
    flex: 1;
    min-width: 0;
}
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 16px;
}

.market-info-box {
    background: rgba(0, 0, 0, 0.25);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 10px;
    padding: 14px;
    min-width: 0;
    box-sizing: border-box;
}

.market-info-row {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    font-size: 0.86rem;
    padding: 4px 0;
    color: #8b93a7;
}

.market-info-row strong {
    color: #eef0f6;
    text-align: right;
}

.market-live-badge {
    margin-top: 10px;
    font-size: 0.75rem;
    color: #39ff14;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.market-info-box--price {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: stretch;
    min-width: 0;
    overflow: hidden;
}

.market-info-box--price .market-btn {
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    margin-top: 10px;
    padding-left: 10px;
    padding-right: 10px;
    font-size: 0.82rem;
}

.market-detail__price {
    font-size: clamp(1.35rem, 2.2vw, 2rem);
    font-weight: 800;
    color: var(--nexum-gold-light);
    text-shadow: 0 0 20px rgba(197, 160, 89, 0.4);
    text-align: center;
    line-height: 1.1;
    word-break: break-word;
}

.market-sold-badge {
    text-align: center;
    padding: 12px;
    background: rgba(239, 68, 68, 0.15);
    color: #ef4444;
    border-radius: 8px;
    font-weight: 700;
    margin-top: 10px;
}

.market-detail__body {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.market-section-title {
    font-family: 'Cinzel', Georgia, serif;
    font-size: 1.2rem;
    margin: 0 0 16px;
    color: #d8c08e;
}

.market-subtitle {
    font-size: 0.9rem;
    color: #8b93a7;
    margin: 18px 0 10px;
}

.market-skill-group {
    margin-bottom: 20px;
    padding: 14px;
    background: rgba(14, 16, 24, 0.85);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 10px;
}

.market-items-col {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.market-item-panel {
    padding: 14px;
    background: rgba(14, 16, 24, 0.85);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 10px;
}

.market-item-panel .market-subtitle {
    margin: 0 0 12px;
}

.market-item-panel .market-skins-list {
    margin: 0;
}

.market-skill-group h3 {
    margin: 0 0 12px;
    font-size: 0.95rem;
    color: #eef0f6;
}

.market-skill-empty {
    color: #8b93a7;
    font-size: 0.85rem;
    margin: 0;
    padding: 12px;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 8px;
}

.market-skill-grid,
.market-item-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.market-item-grid--misc {
    max-height: none;
    overflow: visible;
}

.market-tooltip-source {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.market-has-tooltip {
    cursor: help;
    pointer-events: auto;
}

.market-skill-icon,
.market-item-icon {
    position: relative;
    width: 40px;
    height: 40px;
    background: rgba(8, 10, 16, 0.72);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 6px;
    overflow: hidden;
}

.market-skill-icon img,
.market-item-icon img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    padding: 2px;
    box-sizing: border-box;
}

.market-item-icon.is-fallback::after,
.market-skill-icon:not(:has(img))::after {
    content: '?';
    position: absolute;
    inset: 0;
    display: grid;
    place-items: center;
    color: #8b93a7;
    font-size: 0.8rem;
}

.market-skill-enchant,
.market-item-enchant {
    position: absolute;
    bottom: 1px;
    right: 2px;
    font-size: 0.62rem;
    font-weight: 800;
    color: #39ff14;
    text-shadow: 0 1px 2px #000;
}

.market-item-count {
    position: absolute;
    bottom: 1px;
    left: 2px;
    font-size: 0.58rem;
    font-weight: 700;
    color: #eef0f6;
    text-shadow: 0 1px 2px #000;
}

.market-skins-list {
    padding: 12px;
    background: rgba(0, 0, 0, 0.25);
    border-radius: 8px;
    font-size: 0.88rem;
    color: #8b93a7;
    line-height: 1.6;
}

.market-my-note {
    margin: 0 0 14px;
    color: #8b93a7;
    font-size: 0.88rem;
    line-height: 1.5;
}

.market-sell-note,
.market-fee-note {
    color: #8b93a7;
    font-size: 0.9rem;
    line-height: 1.5;
}

.market-sell-form {
    display: flex;
    flex-direction: column;
    gap: 16px;
    max-width: 480px;
}

.market-sell-preview {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 12px 14px;
    border-radius: 12px;
    border: 1px solid rgba(197, 160, 89, 0.25);
    background: rgba(0, 0, 0, 0.22);
}

.market-sell-preview__meta {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.market-sell-preview__meta strong {
    color: #eef0f6;
    font-size: 1rem;
}

.market-sell-preview__meta span {
    color: #c5a059;
    font-size: 0.76rem;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

@media (max-width: 1100px) {
    .market-sell-banner {
        grid-template-columns: 1fr;
    }

    .market-sell-banner__action {
        max-width: 100%;
        justify-self: stretch;
    }

    .market-topbar__actions {
        width: 100%;
        margin-left: 0;
        justify-content: flex-start;
    }
}

@media (max-width: 960px) {
    .market-detail__info-grid {
        grid-template-columns: 1fr 1fr;
    }

    .market-detail__body {
        grid-template-columns: 1fr;
    }

    .market-nav {
        order: 3;
        width: 100%;
    }
}

@media (max-width: 600px) {
    .market-detail__hero {
        flex-direction: column;
        align-items: center;
    }

    .market-detail__info-grid {
        grid-template-columns: 1fr;
    }

    .market-grid {
        grid-template-columns: 1fr;
    }
}

/* Rich tooltips (Exilium-style) */
.market-tooltip-float {
    position: fixed;
    z-index: 100000;
    max-width: 320px;
    padding: 0;
    border-radius: 8px;
    background: rgba(10, 12, 18, 0.98);
    border: 1px solid rgba(197, 160, 89, 0.45);
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.55);
    pointer-events: none;
    font-size: 0.82rem;
    line-height: 1.45;
    color: #eef0f6;
    overflow: hidden;
    display: none;
    opacity: 0;
    transform: translate(-50%, calc(-100% - 16px));
    transform-origin: center bottom;
}

.market-tooltip-float.is-visible {
    display: block;
    opacity: 1;
}

.market-tooltip-float.is-below {
    transform: translate(-50%, 16px);
    transform-origin: center top;
}

.market-tooltip-float[hidden] {
    display: none !important;
}

.market-tip-head {
    display: flex;
    gap: 10px;
    align-items: flex-start;
    padding: 10px 12px;
}

.market-tip-icon {
    width: 32px;
    height: 32px;
    flex-shrink: 0;
    border-radius: 4px;
    object-fit: contain;
    background: rgba(255, 255, 255, 0.04);
}

.market-tip-icon--empty {
    display: block;
}

.market-tip-copy {
    min-width: 0;
}

.market-tip-title {
    font-weight: 700;
    color: #d8c08e;
    margin-bottom: 2px;
}

.market-tip-body {
    color: #b8bfce;
    font-size: 0.78rem;
}

.market-tip-grade {
    color: #9fd4ff;
    font-weight: 600;
}

.market-skins-list {
    color: #d7dbe7;
    line-height: 1.7;
    font-size: 0.88rem;
}

.market-skin-mastery {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 14px;
    padding-top: 12px;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
    color: #eef0f6;
    font-weight: 600;
}

.market-skin-mastery__icon {
    width: 28px;
    height: 28px;
    object-fit: contain;
    opacity: 0.9;
}

/* Buy modal */
body.market-modal-open {
    overflow: hidden;
}

.market-modal[hidden] {
    display: none !important;
}

.market-modal {
    position: fixed;
    inset: 0;
    z-index: 2000;
    display: grid;
    place-items: center;
    padding: 20px;
}

.market-modal__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.72);
    backdrop-filter: blur(4px);
}

.market-modal__dialog {
    position: relative;
    width: min(480px, 100%);
    padding: 24px;
    border-radius: 14px;
    background: rgba(14, 16, 24, 0.98);
    border: 1px solid rgba(197, 160, 89, 0.35);
    box-shadow: 0 24px 64px rgba(0, 0, 0, 0.6);
}

.market-modal__close {
    position: absolute;
    top: 10px;
    right: 12px;
    border: 0;
    background: transparent;
    color: #8b93a7;
    font-size: 1.6rem;
    line-height: 1;
    cursor: pointer;
}

.market-modal__title {
    margin: 0 0 8px;
    font-family: 'Cinzel', Georgia, serif;
    color: #d8c08e;
    font-size: 1.2rem;
}

.market-modal__subtitle {
    margin: 0 0 18px;
    color: #8b93a7;
    font-size: 0.9rem;
    line-height: 1.5;
}

.market-form-field {
    display: grid;
    gap: 6px;
    margin-bottom: 14px;
}

.market-form-field span {
    font-size: 0.82rem;
    color: #8b93a7;
}

.market-form-field select {
    width: 100%;
    padding: 10px 12px;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(0, 0, 0, 0.35);
    color: #eef0f6;
}

.market-buy-summary {
    display: grid;
    gap: 8px;
    padding: 12px;
    margin: 8px 0 12px;
    border-radius: 8px;
    background: rgba(0, 0, 0, 0.25);
    border: 1px solid rgba(255, 255, 255, 0.06);
}

.market-buy-summary div {
    display: flex;
    justify-content: space-between;
    font-size: 0.88rem;
}

.market-buy-summary span {
    color: #8b93a7;
}

.market-buy-note {
    margin: 0 0 16px;
    font-size: 0.8rem;
    color: #6f778a;
    line-height: 1.45;
}

.market-modal__actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}
