/* Mercado L2 Darks — visual próprio (preto, dourado e vermelho) */

:root {
    --bg: #0b0b0d;
    --bg-2: #111114;
    --panel: #16161a;
    --panel-2: #1c1c21;
    --line: #26262c;
    --line-2: #33333b;
    --text: #ebe7df;
    --muted: #9b978e;
    --gold: #d6a32c;
    --gold-2: #f1c95d;
    --gold-dark: #8c6a1c;
    --red: #b3261e;
    --red-2: #e0533f;
    --ok: #4caf7a;
    --radius: 12px;
}

*, *::before, *::after { box-sizing: border-box; }
html { font-size: 16px; -webkit-text-size-adjust: 100%; }
body {
    margin: 0;
    background: var(--bg) radial-gradient(1200px 500px at 50% -200px, rgba(214, 163, 44, .08), transparent 70%) no-repeat;
    color: var(--text);
    font: 400 15px/1.5 Inter, system-ui, -apple-system, "Segoe UI", sans-serif;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}
a { color: var(--gold-2); text-decoration: none; }
a:hover { color: #fff; }
img { max-width: 100%; }
h1, h2 { margin: 0 0 .4em; line-height: 1.2; color: #fff; }
h1 { font-size: 1.6rem; font-weight: 800; }
h2 { font-size: 1.1rem; font-weight: 700; }
p { margin: 0 0 .8em; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.gold { color: var(--gold-2); }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.mk-wrap { width: 100%; max-width: 1240px; margin: 0 auto; padding: 0 20px; }

/* ---------- Botões e campos ---------- */

.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 6px;
    min-height: 40px; padding: 0 18px; border-radius: 999px; border: 1px solid transparent;
    font: 600 .92rem/1 Inter, sans-serif; cursor: pointer; white-space: nowrap;
    transition: background .15s, border-color .15s, color .15s, box-shadow .15s;
}
.btn-gold { background: linear-gradient(180deg, var(--gold-2), var(--gold)); color: #1a1205; }
.btn-gold:hover { color: #1a1205; box-shadow: 0 0 0 3px rgba(214, 163, 44, .25); }
.btn-ghost { background: transparent; border-color: var(--line-2); color: var(--text); }
.btn-ghost:hover { border-color: var(--gold); color: #fff; }
.btn-sm { min-height: 32px; padding: 0 14px; font-size: .85rem; }
.btn-block { display: flex; width: 100%; }
.btn[disabled], .is-sending .btn { opacity: .6; pointer-events: none; }

input[type=text], input[type=search], input[type=number], select {
    width: 100%; min-height: 40px; padding: 8px 12px;
    background: var(--bg-2); color: var(--text);
    border: 1px solid var(--line-2); border-radius: 10px;
    font: inherit; font-size: .95rem;
}
input:focus, select:focus { outline: none; border-color: var(--gold); box-shadow: 0 0 0 3px rgba(214, 163, 44, .18); }
select { cursor: pointer; }
option:disabled { color: #666; }

/* Lista suspensa própria (market.js troca os <select> por ela) */
.mk-dd { position: relative; width: 100%; }
.mk-dd-native { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; pointer-events: none; }
.mk-dd-btn {
    position: relative; display: flex; align-items: center; width: 100%; min-height: 40px;
    padding: 8px 38px 8px 12px; text-align: left; cursor: pointer;
    background: var(--bg-2); color: var(--text);
    border: 1px solid var(--line-2); border-radius: 10px;
    font: inherit; font-size: .95rem; transition: border-color .15s, box-shadow .15s;
}
.mk-dd-btn:hover { border-color: var(--gold-dark); }
.mk-dd-btn::after {
    content: ""; position: absolute; right: 14px; top: 50%; width: 7px; height: 7px; margin-top: -6px;
    border-right: 2px solid var(--gold); border-bottom: 2px solid var(--gold);
    transform: rotate(45deg); transition: transform .15s, margin-top .15s;
}
.mk-dd.is-open .mk-dd-btn::after { transform: rotate(-135deg); margin-top: -2px; }
.mk-dd-btn:focus-visible, .mk-dd.is-open .mk-dd-btn { outline: none; border-color: var(--gold); box-shadow: 0 0 0 3px rgba(214, 163, 44, .18); }
.mk-dd-btn.is-invalid { border-color: var(--red-2); }
.mk-dd-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mk-dd-list {
    position: absolute; z-index: 60; top: calc(100% + 6px); left: 0;
    min-width: 100%; width: max-content; max-width: calc(100vw - 32px); max-height: 290px; overflow-y: auto;
    margin: 0; padding: 6px; list-style: none;
    background: var(--panel-2); border: 1px solid var(--line-2); border-radius: 12px;
    box-shadow: 0 14px 34px rgba(0, 0, 0, .55);
    animation: mk-dd-in .12s ease-out;
}
.mk-dd-list[hidden] { display: none; }
.mk-dd-list.is-up { top: auto; bottom: calc(100% + 6px); }
.mk-dd-list.is-fixed { position: fixed; z-index: 1000; bottom: auto; }
@keyframes mk-dd-in { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }
.mk-dd-list li {
    position: relative; padding: 8px 30px 8px 12px; border-radius: 8px;
    font-size: .9rem; white-space: nowrap; cursor: pointer; color: var(--text);
}
.mk-dd-list li:hover, .mk-dd-list li:focus { outline: none; background: rgba(214, 163, 44, .13); color: #fff; }
.mk-dd-list li[aria-selected="true"] { color: var(--gold-2); font-weight: 600; }
.mk-dd-list li[aria-selected="true"]::after {
    content: ""; position: absolute; right: 12px; top: 50%; width: 5px; height: 9px; margin-top: -6px;
    border-right: 2px solid var(--gold); border-bottom: 2px solid var(--gold); transform: rotate(45deg);
}
.mk-dd-list li[aria-disabled="true"] { color: #666; cursor: not-allowed; background: none; }
.mk-field { display: grid; gap: 4px; }
.mk-field > span { font-size: .8rem; color: var(--muted); font-weight: 500; }

.alert { padding: 12px 16px; border-radius: 10px; margin: 0 0 16px; border: 1px solid; font-size: .93rem; }
.alert-success { background: rgba(76, 175, 122, .1); border-color: rgba(76, 175, 122, .4); color: #bfe8cf; }
.alert-error { background: rgba(179, 38, 30, .12); border-color: rgba(224, 83, 63, .45); color: #f3c4bb; }
.alert-info { background: rgba(214, 163, 44, .08); border-color: rgba(214, 163, 44, .35); color: #f0dca8; }

/* ---------- Topo ---------- */

.mk-top { background: #000; border-bottom: 1px solid #1d1d22; position: sticky; top: 0; z-index: 20; }
.mk-top-in { display: flex; align-items: center; gap: 18px; min-height: 68px; }
.mk-brand { display: flex; align-items: center; gap: 10px; color: #fff; flex: none; }
.mk-brand img { height: 40px; width: auto; }
.mk-brand span { display: grid; line-height: 1.1; }
.mk-brand b { font-weight: 800; font-style: italic; font-size: 1.05rem; letter-spacing: .02em; text-transform: uppercase; }
.mk-brand small { color: var(--gold); font-weight: 600; font-size: .78rem; text-transform: uppercase; letter-spacing: .12em; }
.mk-search { flex: 1; position: relative; max-width: 520px; }
.mk-search svg { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.mk-search input { padding-left: 36px; border-radius: 999px; background: var(--bg-2); }
.mk-actions { display: flex; align-items: center; gap: 10px; margin-left: auto; }
.mk-balance { border: 1px solid var(--gold-dark); border-radius: 999px; padding: 7px 14px; color: var(--gold-2); font-weight: 700; white-space: nowrap; }
.mk-balance small { font-weight: 500; color: var(--muted); }
.mk-balance:hover { border-color: var(--gold); color: #fff; }

.mk-account { position: relative; }
.mk-account summary {
    list-style: none; cursor: pointer; padding: 8px 14px; border-radius: 999px; border: 1px solid var(--line-2);
    font-weight: 600; font-size: .9rem; max-width: 160px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.mk-account summary::-webkit-details-marker { display: none; }
.mk-account summary::after { content: " ▾"; color: var(--muted); }
.mk-account[open] summary { border-color: var(--gold); }
.mk-menu {
    position: absolute; right: 0; top: calc(100% + 8px); min-width: 210px; padding: 6px;
    background: var(--panel); border: 1px solid var(--line-2); border-radius: 12px; box-shadow: 0 12px 30px rgba(0, 0, 0, .5);
    display: grid;
}
.mk-menu a { padding: 9px 12px; border-radius: 8px; color: var(--text); font-size: .92rem; }
.mk-menu a:hover { background: var(--panel-2); color: #fff; }
.mk-menu-sep { border: 0; border-top: 1px solid var(--line); margin: 6px 4px; }

.mk-tabs { display: flex; gap: 4px; overflow-x: auto; scrollbar-width: none; }
.mk-tabs a { padding: 10px 14px; color: var(--muted); font-weight: 600; font-size: .9rem; border-bottom: 2px solid transparent; white-space: nowrap; }
.mk-tabs a:hover { color: #fff; }
.mk-tabs a.active { color: var(--gold-2); border-bottom-color: var(--gold); }

.mk-main { flex: 1; padding-top: 24px; padding-bottom: 48px; }
.mk-head { margin-bottom: 12px; }
.mk-back { margin-bottom: 14px; font-size: .9rem; }

/* ---------- Como funciona ---------- */

.mk-how { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin-bottom: 20px; }
.mk-how div { display: flex; gap: 12px; align-items: flex-start; padding: 14px 16px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); font-size: .9rem; color: #cfcac0; }
.mk-how b {
    flex: none; width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center;
    background: var(--red); color: #fff; font-size: .85rem;
}

/* ---------- Filtros ---------- */

.mk-filters { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; padding: 12px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); }
.mk-chips { display: flex; flex-wrap: wrap; gap: 6px; flex: 1; }
.mk-chips a { padding: 7px 14px; border-radius: 999px; color: var(--muted); font-weight: 600; font-size: .88rem; border: 1px solid transparent; }
.mk-chips a:hover { color: #fff; border-color: var(--line-2); }
.mk-chips a.active { color: var(--gold-2); background: #1d1a12; border-color: var(--gold-dark); }
.mk-selects { display: flex; gap: 8px; }
.mk-selects select { width: auto; min-width: 150px; border-radius: 999px; font-size: .88rem; min-height: 36px; padding: 6px 12px; }
.mk-selects .mk-dd { width: auto; min-width: 160px; }
.mk-selects .mk-dd-btn { border-radius: 999px; font-size: .88rem; min-height: 36px; padding: 6px 36px 6px 16px; }
.mk-selects label:last-of-type .mk-dd-list { left: auto; right: 0; }
.mk-count { display: flex; justify-content: space-between; align-items: center; margin: 14px 2px 10px; color: var(--muted); font-size: .88rem; }

/* ---------- Cards ---------- */

.mk-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 14px; }
.mk-card {
    display: flex; flex-direction: column; gap: 12px; padding: 14px;
    background: linear-gradient(180deg, var(--panel), #131316); border: 1px solid var(--line); border-radius: var(--radius);
    color: var(--text); transition: border-color .15s, transform .15s, box-shadow .15s;
}
a.mk-card:hover { border-color: var(--gold-dark); transform: translateY(-2px); box-shadow: 0 10px 24px rgba(0, 0, 0, .35); color: var(--text); }
a.mk-card:hover .btn-gold { box-shadow: 0 0 0 3px rgba(214, 163, 44, .25); }
.mk-card-head { display: flex; gap: 12px; align-items: center; }
.mk-card-title { display: grid; gap: 4px; min-width: 0; }
.mk-card-title b { color: #fff; font-weight: 700; line-height: 1.25; overflow-wrap: anywhere; }
.mk-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; font-size: .8rem; color: var(--muted); }
.mk-meta .qty { color: var(--text); }
.ench { color: var(--gold-2); font-weight: 800; }
.mk-card-seller { display: flex; justify-content: space-between; gap: 8px; font-size: .82rem; color: var(--muted); border-top: 1px solid var(--line); padding-top: 10px; }
.mk-card-seller b { color: var(--text); font-weight: 600; }
.mk-card-foot { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-top: auto; }
.price { color: var(--gold-2); font-weight: 800; font-size: 1.05rem; white-space: nowrap; }
.price small { font-weight: 500; color: var(--muted); font-size: .75rem; }

.ic {
    flex: none; width: 46px; height: 46px; border-radius: 10px; display: grid; place-items: center;
    background: #0c0c0f; border: 1px solid var(--line-2); box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .6);
    color: var(--gold); overflow: hidden;
}
.ic img { width: 32px; height: 32px; image-rendering: auto; }
.ic-lg { width: 72px; height: 72px; border-radius: 14px; }
.ic-lg img { width: 48px; height: 48px; }
.ic-lg svg { width: 32px; height: 32px; }
.ic-sm { width: 34px; height: 34px; border-radius: 8px; }
.ic-sm img { width: 26px; height: 26px; }

.grade { display: inline-block; min-width: 22px; padding: 1px 6px; border-radius: 5px; border: 1px solid; font-size: .72rem; font-weight: 800; text-align: center; line-height: 1.4; }
.g-d { color: #8fb8e6; border-color: #3d5a7a; }
.g-c { color: #8ad19e; border-color: #3c6b4b; }
.g-b { color: #f0b46a; border-color: #7a5a2e; }
.g-a { color: #f08a7a; border-color: #7a3a30; }
.g-s { color: var(--gold-2); border-color: var(--gold-dark); background: rgba(214, 163, 44, .1); }

.mk-empty { text-align: center; padding: 48px 16px; background: var(--panel); border: 1px dashed var(--line-2); border-radius: var(--radius); color: var(--muted); }
.mk-pages { display: flex; justify-content: center; align-items: center; gap: 14px; margin-top: 22px; color: var(--muted); }

/* ---------- Detalhe do item ---------- */

.mk-item { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 18px; align-items: start; }
.mk-item-main, .mk-buybox, .mk-box { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; }
.mk-item-head { display: flex; gap: 16px; align-items: center; margin-bottom: 14px; }
.mk-item-head h1 { margin-bottom: 6px; }
.mk-desc { color: #cfcac0; }
.mk-facts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin: 14px 0 0; }
.mk-facts div { background: var(--bg-2); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; }
.mk-facts dt { font-size: .78rem; color: var(--muted); }
.mk-facts dd { margin: 2px 0 0; font-weight: 600; color: #fff; }
.mk-facts small { color: var(--muted); font-weight: 400; }
.mk-buybox { display: grid; gap: 12px; position: sticky; top: 130px; }
.mk-buybox .alert { margin: 0; }
.mk-buybox form { display: grid; gap: 10px; }
.mk-buybox p { margin: 0; }
.mk-buy-price { display: grid; }
.mk-buy-price span { color: var(--muted); font-size: .85rem; }
.mk-buy-price b { color: var(--gold-2); font-size: 1.9rem; font-weight: 800; line-height: 1.1; }
.mk-buy-price small { font-size: .9rem; color: var(--muted); font-weight: 500; }
.mk-buy-row { display: flex; justify-content: space-between; font-size: .9rem; padding: 8px 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }

/* ---------- Vender ---------- */

.mk-charpick { max-width: 320px; margin-bottom: 16px; }
.mk-sell-fields { display: grid; grid-template-columns: repeat(auto-fit, minmax(100px, 1fr)); gap: 8px; }
.mk-allowed { margin-top: 26px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 16px; }
.mk-allowed summary { cursor: pointer; font-weight: 600; color: var(--muted); }
.mk-allowed ul { list-style: none; margin: 12px 0 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 8px; }
.mk-allowed li { display: flex; align-items: center; gap: 8px; font-size: .88rem; }

/* ---------- Tabelas, saque ---------- */

.mk-box { margin-bottom: 16px; }
.mk-table-wrap { overflow-x: auto; }
.mk-table { width: 100%; border-collapse: collapse; font-size: .9rem; }
.mk-table th { text-align: left; color: var(--muted); font-weight: 500; font-size: .8rem; padding: 8px 10px; border-bottom: 1px solid var(--line-2); white-space: nowrap; }
.mk-table td { padding: 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.mk-table tr:last-child td { border-bottom: 0; }
.mk-table .num { text-align: right; white-space: nowrap; }
.mk-cell-item { display: flex; align-items: center; gap: 10px; }
.mk-inline { display: flex; gap: 6px; align-items: center; }
.mk-inline select { min-width: 150px; min-height: 32px; padding: 4px 10px; font-size: .85rem; }
.mk-inline .mk-dd { width: auto; min-width: 170px; }
.mk-inline .mk-dd-btn { min-height: 32px; padding: 4px 32px 4px 10px; font-size: .85rem; }
.tag { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: .78rem; font-weight: 600; border: 1px solid; }
.tag-ok { color: #9fe0bb; border-color: rgba(76, 175, 122, .5); }
.tag-no { color: #f3a99c; border-color: rgba(224, 83, 63, .5); }
.tag-off { color: var(--muted); border-color: var(--line-2); }
.tag-wait { color: var(--gold-2); border-color: var(--gold-dark); }
.tag-warn { color: #f5c07a; border-color: rgba(230, 150, 60, .55); }
.mk-table tr.is-expired td { background: rgba(230, 150, 60, .05); }
.mk-mailpref { display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap; }
.mk-mailpref h2 { margin-bottom: 4px; }
.mk-mailpref p { margin: 0; }
.mk-exp-note { margin: 0 0 6px; max-width: 300px; white-space: normal; }

.mk-stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; margin-bottom: 16px; }
.mk-stats div { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; display: grid; }
.mk-stats span { font-size: .8rem; color: var(--muted); }
.mk-stats b { font-size: 1.2rem; font-weight: 800; color: #fff; }
.mk-stats b.gold { color: var(--gold-2); }
.mk-stats small { font-size: .75rem; color: var(--muted); font-weight: 500; }
.mk-form { display: grid; gap: 12px; max-width: 460px; }
.mk-quote { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.mk-quote div { background: var(--bg-2); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; display: grid; }
.mk-quote span { font-size: .8rem; color: var(--muted); }
.mk-quote b { font-size: 1.1rem; }

/* ---------- Rodapé ---------- */

.mk-foot { border-top: 1px solid #1d1d22; background: #000; padding: 16px 0; font-size: .85rem; color: var(--muted); }
.mk-foot-in { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.mk-langs { display: flex; gap: 6px; }
.mk-langs a { color: var(--muted); padding: 2px 6px; border-radius: 6px; font-weight: 600; }
.mk-langs a.active { color: var(--gold-2); background: #1d1a12; }

/* ---------- Telas menores ---------- */

@media (max-width: 960px) {
    .mk-item { grid-template-columns: 1fr; }
    .mk-buybox { position: static; }
    .mk-how { grid-template-columns: 1fr; }
    .mk-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 760px) {
    .mk-wrap { padding: 0 16px; }
    .mk-top-in { flex-wrap: wrap; gap: 10px; padding: 10px 0; }
    .mk-brand img { height: 34px; }
    .mk-search { order: 3; flex-basis: 100%; max-width: none; }
    .mk-actions { gap: 6px; }
    .mk-actions .btn { min-height: 36px; padding: 0 12px; font-size: .85rem; }
    .mk-balance { padding: 6px 10px; font-size: .85rem; }
    .mk-account summary { max-width: 110px; padding: 7px 10px; }
    .mk-top { position: static; }
    .mk-filters { padding: 10px; }
    .mk-chips { flex-wrap: nowrap; overflow-x: auto; flex-basis: 100%; scrollbar-width: none; }
    .mk-selects { flex-basis: 100%; }
    .mk-selects label { flex: 1; }
    .mk-selects select { width: 100%; min-width: 0; }
    .mk-selects .mk-dd { width: 100%; min-width: 0; }
    .mk-grid { grid-template-columns: 1fr; }
    .mk-facts { grid-template-columns: 1fr; }
    h1 { font-size: 1.35rem; }
}
@media (max-width: 420px) {
    .mk-brand span { display: none; }
    .mk-stats { grid-template-columns: 1fr; }
    .mk-quote { grid-template-columns: 1fr; }
}
