/* The Global Market page (market.html, js/market.js): a night bazaar. Built on codex.css (the header, the fonts, the
   rarity classes' --rc) and portal.css (the login button).
   The page is always dark, like the landing page: its light is the items' own (each rarity's color, --rc) and gold.
   What moves only uses transform and opacity, and stands still with reduced motion. */

/* The dark theme's colors whatever theme the other pages are in (as body.lp-home does in landing.css) */
body.mk-page {
  --bg-body: #08070b;
  --bg-surface: #131118;
  --bg-surface-elevated: #1c1923;
  --bg-card: #121016;
  --bg-card-hover: #19161f;
  --border-subtle: #2a2632;
  --text-main: #f6f2ee;
  --text-muted: #aea69f;
  --text-faint: #8a8290;
  --text-accent: #ffb25c;
  --accent-text: #f8941a;
  --accent-soft: rgba(248, 148, 26, 0.16);
  --badge-bg: #1c1923;
  --badge-border: #332f3a;
  --input-bg: #0e0c12;
  --input-border: #332f3a;
  --rarity-common: #a3a9af;
  --rarity-rare: #3ea2ea;
  --rarity-super-rare: #b06cf9;
  --rarity-epic: #e2ae1f;
  --rarity-legendary: #f4514f;
  --rarity-mythical: #fff1cc;
  --rarity-divine: #f0c22e;
  --mk-gold: #ffd166;
  --mk-gold-hot: #f8941a;
  --mk-good: #4ade80;
  --mk-warn: #fbbf24;
  --mk-glass: rgba(16, 14, 21, 0.78);
  --mk-radius: 18px;
  background: var(--bg-body);
  color: var(--text-main);
  color-scheme: dark;
}
/* Light behind the whole page: two warm lamps and a cold one, far away */
body.mk-page::before {
  content: '';
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(ellipse 55% 40% at 12% 8%, rgba(248, 148, 26, 0.13), transparent 70%),
    radial-gradient(ellipse 45% 35% at 92% 30%, rgba(176, 108, 249, 0.09), transparent 70%),
    radial-gradient(ellipse 60% 45% at 50% 105%, rgba(255, 209, 102, 0.1), transparent 70%);
}
.mk-page .site-header { background: rgba(8, 7, 11, 0.82); border-bottom-color: rgba(255, 255, 255, 0.07); }
.mk-page .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-page.mk-locked { overflow: hidden; }
.mk-main { box-sizing: border-box; width: 100%; max-width: 1320px; margin: 0 auto; padding: 0 1.1rem 5rem; }
.mk-loading { padding: 3rem 0; }

/* ================= THE BANNER ================= */
.mk-hero {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 0.85fr);
  align-items: center;
  gap: 1.5rem;
  min-height: 430px;
  margin-top: 1.1rem;
  padding: clamp(1.5rem, 4vw, 3.2rem) clamp(1.2rem, 4vw, 3.4rem);
  border-radius: 28px;
  background: #0b0a0f;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.6), inset 0 0 0 1px rgba(255, 209, 102, 0.16), inset 0 1px 0 rgba(255, 255, 255, 0.08);
}
.mk-hero-art {
  position: absolute;
  inset: 0;
  z-index: -2;
  background:
    linear-gradient(95deg, rgba(8, 7, 11, 0.97) 0%, rgba(8, 7, 11, 0.86) 38%, rgba(8, 7, 11, 0.42) 72%, rgba(8, 7, 11, 0.72) 100%),
    linear-gradient(0deg, rgba(8, 7, 11, 0.9) 0%, transparent 38%),
    url("../assets/hero-wide.webp") 70% 32% / cover no-repeat;
}
.mk-hero::before { /* the lamp over the stage */
  content: '';
  position: absolute;
  z-index: -1;
  right: -8%;
  top: -30%;
  width: 62%;
  height: 160%;
  background: radial-gradient(ellipse at 50% 40%, rgba(248, 148, 26, 0.3), rgba(248, 148, 26, 0.08) 45%, transparent 68%);
}
.mk-hero::after { /* gold thread along the banner's foot */
  content: '';
  position: absolute;
  inset: auto 6% 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255, 209, 102, 0.85), transparent);
}
/* Sparks rising from the bazaar's fires */
.mk-embers { position: absolute; inset: 0; z-index: -1; overflow: hidden; pointer-events: none; }
.mk-embers i {
  position: absolute;
  bottom: -12px;
  left: calc(var(--x, 50) * 1%);
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: #ffd166;
  box-shadow: 0 0 8px 2px rgba(248, 148, 26, 0.8);
  opacity: 0;
  animation: mk-ember calc(var(--t, 9) * 1s) linear calc(var(--d, 0) * -1s) infinite;
}
.mk-embers i:nth-child(1) { --x: 6; --t: 11; --d: 2; } .mk-embers i:nth-child(2) { --x: 14; --t: 8; --d: 5; }
.mk-embers i:nth-child(3) { --x: 23; --t: 13; --d: 1; } .mk-embers i:nth-child(4) { --x: 31; --t: 9; --d: 7; }
.mk-embers i:nth-child(5) { --x: 40; --t: 12; --d: 4; } .mk-embers i:nth-child(6) { --x: 48; --t: 10; --d: 9; }
.mk-embers i:nth-child(7) { --x: 56; --t: 14; --d: 3; } .mk-embers i:nth-child(8) { --x: 63; --t: 9; --d: 6; }
.mk-embers i:nth-child(9) { --x: 70; --t: 11; --d: 0; } .mk-embers i:nth-child(10) { --x: 77; --t: 8; --d: 4; }
.mk-embers i:nth-child(11) { --x: 83; --t: 13; --d: 8; } .mk-embers i:nth-child(12) { --x: 89; --t: 10; --d: 2; }
.mk-embers i:nth-child(13) { --x: 94; --t: 12; --d: 6; } .mk-embers i:nth-child(14) { --x: 36; --t: 15; --d: 11; }
@keyframes mk-ember {
  0% { transform: translate3d(0, 0, 0) scale(1); opacity: 0; }
  12% { opacity: 0.9; }
  70% { opacity: 0.5; }
  100% { transform: translate3d(40px, -460px, 0) scale(0.3); opacity: 0; }
}

.mk-hero-copy { position: relative; min-width: 0; }
.mk-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  margin: 0 0 0.9rem;
  padding: 0.35rem 0.85rem;
  border-radius: 999px;
  border: 1px solid rgba(74, 222, 128, 0.3);
  background: rgba(74, 222, 128, 0.08);
  color: #a7f3c1;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}
.mk-dot { width: 8px; height: 8px; border-radius: 50%; background: #4ade80; box-shadow: 0 0 10px #4ade80; animation: mk-blink 1.6s ease-in-out infinite; }
@keyframes mk-blink { 50% { opacity: 0.35; } }
.mk-title {
  margin: 0;
  font-family: var(--font-epic);
  font-size: clamp(2.7rem, 8.2vw, 5.6rem);
  font-weight: 900;
  line-height: 0.95;
  letter-spacing: 0.015em;
  text-transform: uppercase;
  background: linear-gradient(180deg, #fffaf0 0%, #ffe39a 34%, #ffb347 68%, #d9730b 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  filter: drop-shadow(0 6px 26px rgba(248, 148, 26, 0.42));
}
.mk-tagline { margin: 1rem 0 0; max-width: 33rem; font-size: clamp(0.98rem, 2.2vw, 1.12rem); line-height: 1.55; color: rgba(246, 242, 238, 0.82); }
.mk-hero-stats { display: flex; flex-wrap: wrap; gap: 0.6rem; margin-top: 1.6rem; min-height: 4.1rem; }

.mk-plaque {
  position: relative;
  display: grid;
  gap: 0.1rem;
  min-width: 6.3rem;
  padding: 0.6rem 1rem 0.55rem;
  border-radius: 14px;
  border: 1px solid rgba(255, 209, 102, 0.24);
  background: linear-gradient(180deg, rgba(255, 209, 102, 0.1), rgba(255, 209, 102, 0.02)), rgba(10, 9, 13, 0.6);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08);
  line-height: 1.1;
}
.mk-plaque b { display: inline-flex; align-items: center; font: 800 1.55rem var(--font-display); color: #fff3d1; font-variant-numeric: tabular-nums; }
.mk-plaque > span { font-size: 0.7rem; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; color: rgba(246, 242, 238, 0.6); }
.mk-plaque .mk-price { color: var(--mk-gold); }
.mk-plaque .mk-coin { width: 22px; height: 22px; }

/* ----- the stage: the rarest things on sale, one at a time ----- */
.mk-stage { position: relative; display: grid; justify-items: center; align-content: center; min-height: 360px; min-width: 0; }
.mk-spot {
  --cy: 96px; /* where its light is centred: the middle of the picture */
  position: relative;
  display: grid;
  justify-items: center;
  width: min(100%, 340px);
  padding-top: 14px;
  color: inherit;
  text-decoration: none;
  transform: perspective(900px) rotateX(var(--rx, 0deg)) rotateY(var(--ry, 0deg));
  transition: transform 0.25s ease;
  animation: mk-spot-in 0.6s cubic-bezier(0.2, 0.8, 0.2, 1) both;
}
@keyframes mk-spot-in { from { opacity: 0; transform: perspective(900px) translateY(18px) scale(0.94); } }
.mk-spot-rays, .mk-spot-halo { position: absolute; left: 50%; top: var(--cy); border-radius: 50%; pointer-events: none; }
.mk-spot-rays {
  width: 460px;
  height: 460px;
  margin: -230px 0 0 -230px;
  background: repeating-conic-gradient(from 0deg, color-mix(in srgb, var(--rc) 62%, transparent) 0deg 4deg, transparent 4deg 18deg);
  -webkit-mask-image: radial-gradient(circle, #000 10%, rgba(0, 0, 0, 0.5) 32%, transparent 62%);
  mask-image: radial-gradient(circle, #000 10%, rgba(0, 0, 0, 0.5) 32%, transparent 62%);
  opacity: 0.5;
  animation: mk-spin 48s linear infinite;
}
.mk-spot-halo {
  width: 250px;
  height: 250px;
  margin: -125px 0 0 -125px;
  background: radial-gradient(circle, color-mix(in srgb, var(--rc) 62%, transparent) 0%, color-mix(in srgb, var(--rc) 16%, transparent) 46%, transparent 70%);
  animation: mk-breathe 4.5s ease-in-out infinite;
}
@keyframes mk-spin { to { transform: rotate(360deg); } }
@keyframes mk-breathe { 50% { transform: scale(1.1); opacity: 0.78; } }
.mk-spot-art { position: relative; display: grid; place-items: center; width: 164px; height: 164px; animation: mk-float 5.5s ease-in-out infinite; }
.mk-spot-art .emo { width: 148px; height: 148px; filter: drop-shadow(0 16px 22px rgba(0, 0, 0, 0.6)) drop-shadow(0 0 26px color-mix(in srgb, var(--rc) 60%, transparent)); }
.mk-spot-art .emo-txt { font-size: 6rem; }
@keyframes mk-float { 50% { transform: translateY(-10px); } }
.mk-spot-floor {
  position: relative;
  width: 210px;
  height: 30px;
  margin-top: -6px;
  border-radius: 50%;
  background: radial-gradient(ellipse, color-mix(in srgb, var(--rc) 70%, transparent) 0%, color-mix(in srgb, var(--rc) 22%, transparent) 42%, transparent 70%);
}
.mk-spot-plate {
  position: relative;
  display: grid;
  justify-items: center;
  gap: 0.2rem;
  width: 100%;
  margin-top: 0.5rem;
  padding: 0.85rem 1rem 0.9rem;
  border-radius: 18px;
  border: 1px solid color-mix(in srgb, var(--rc) 50%, rgba(255, 255, 255, 0.08));
  background: linear-gradient(180deg, color-mix(in srgb, var(--rc) 16%, transparent), transparent 70%), rgba(10, 9, 13, 0.78);
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.1);
  text-align: center;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}
.mk-spot-plate { min-width: 0; }
.mk-spot-kind { max-width: 100%; font-size: 0.68rem; font-weight: 800; letter-spacing: 0.14em; text-transform: uppercase; color: var(--rc); overflow-wrap: anywhere; }
.mk-spot-name { max-width: 100%; font: 800 1.3rem/1.2 var(--font-display); color: #fff; overflow-wrap: anywhere; }
.mk-spot-price { display: inline-flex; flex-wrap: wrap; justify-content: center; align-items: baseline; gap: 0.1rem 0.5rem; max-width: 100%; margin-top: 0.15rem; }
.mk-spot-price .mk-price { font: 800 1.5rem var(--font-display); color: var(--mk-gold); }
.mk-spot-price .mk-coin { width: 24px; height: 24px; align-self: center; }
.mk-spot-price small { font-size: 0.74rem; color: var(--text-muted); }
.mk-spot:hover .mk-spot-plate { border-color: var(--rc); }
.mk-spot:focus-visible { outline: 2px solid var(--rc); outline-offset: 6px; border-radius: 20px; }
.mk-spot-dots { position: relative; display: flex; gap: 0.15rem; margin-top: 0.5rem; }
.mk-spot-dots button { display: grid; place-items: center; width: 30px; height: 36px; padding: 0; border: 0; background: none; cursor: pointer; }
.mk-spot-dots button::before { content: ''; width: 8px; height: 8px; border-radius: 50%; background: rgba(255, 255, 255, 0.24); transition: transform 0.2s ease, background 0.2s ease; }
.mk-spot-dots button.is-on::before { background: var(--rc); transform: scale(1.5); box-shadow: 0 0 10px var(--rc); }

/* ================= BUTTONS, CHIPS, FIELDS ================= */
.mk-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  min-height: 42px;
  padding: 0 1.05rem;
  border-radius: 12px;
  border: 1px solid var(--border-subtle);
  background: var(--bg-surface);
  color: var(--text-main);
  font: 700 0.9rem var(--font-sans);
  text-decoration: none;
  cursor: pointer;
  transition: transform 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease, filter 0.15s ease;
}
.mk-btn:hover { border-color: rgba(255, 209, 102, 0.55); }
.mk-btn:active { transform: translateY(1px); }
.mk-btn:disabled { opacity: 0.5; cursor: not-allowed; }
.mk-btn.is-on { border-color: var(--mk-gold-hot); color: var(--accent-text); }
.mk-btn-gold {
  border-color: transparent;
  background: linear-gradient(180deg, #ffd98a 0%, #ffb23f 45%, #f08a10 100%);
  color: #221203;
  box-shadow: 0 8px 22px rgba(248, 148, 26, 0.32), inset 0 1px 0 rgba(255, 255, 255, 0.6), inset 0 -2px 0 rgba(120, 60, 0, 0.3);
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.35);
}
.mk-btn-gold:hover { border-color: transparent; filter: brightness(1.07); box-shadow: 0 10px 28px rgba(248, 148, 26, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.6), inset 0 -2px 0 rgba(120, 60, 0, 0.3); }
.mk-btn-gold.is-sure { animation: mk-pulse 1.1s ease-in-out infinite; }
.mk-btn-sm { box-sizing: border-box; min-height: 38px; padding: 0 0.85rem; font-size: 0.84rem; border-radius: 10px; }
.mk-btn-lg { min-height: 48px; padding: 0 1.4rem; font-size: 1rem; border-radius: 14px; }
.mk-btn.is-busy { cursor: progress; opacity: 0.7; }
@keyframes mk-pulse { 50% { box-shadow: 0 0 0 5px rgba(248, 148, 26, 0.3), 0 10px 28px rgba(248, 148, 26, 0.5); } }

.mk-x {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(10, 9, 13, 0.7);
  color: var(--text-main);
  font-size: 1.4rem;
  line-height: 1;
  cursor: pointer;
}
.mk-x:hover { border-color: var(--mk-gold); color: var(--mk-gold); }

.mk-chips { display: flex; flex-wrap: wrap; gap: 0.45rem; }
.mk-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  min-height: 38px;
  padding: 0 0.9rem;
  border-radius: 999px;
  border: 1px solid var(--border-subtle);
  background: var(--bg-surface);
  color: var(--text-main);
  font: 600 0.86rem var(--font-sans);
  cursor: pointer;
  white-space: nowrap;
  transition: border-color 0.15s ease, background 0.15s ease;
}
.mk-chip:hover { border-color: rgba(255, 209, 102, 0.55); }
.mk-chip.is-on { background: linear-gradient(180deg, #ffc661, #f8941a); border-color: transparent; color: #221203; font-weight: 800; }
.mk-chip-sm { min-height: 36px; font-size: 0.82rem; padding: 0 0.8rem; }
.mk-chip-rarity { border-color: color-mix(in srgb, var(--rc) 45%, transparent); color: var(--rc); }
.mk-chip-rarity.is-on { background: var(--rc); border-color: var(--rc); color: #0b0a0f; }
.mk-chip-icon .emo { width: 18px; height: 18px; }
.mk-chip-count { font-size: 0.72rem; font-weight: 800; padding: 0 0.42rem; border-radius: 999px; background: rgba(255, 255, 255, 0.1); line-height: 1.55; }
.mk-chip.is-on .mk-chip-count { background: rgba(0, 0, 0, 0.18); }

.mk-tools { display: flex; flex-wrap: wrap; gap: 0.55rem; align-items: center; margin: 1.1rem 0 0.8rem; }
.mk-search {
  flex: 1 1 280px;
  display: flex;
  align-items: center;
  gap: 0.55rem;
  min-height: 50px;
  padding: 0 1rem;
  border-radius: 16px;
  border: 1px solid var(--border-subtle);
  background: var(--input-bg);
  color: var(--text-faint);
  box-shadow: inset 0 2px 6px rgba(0, 0, 0, 0.4);
}
.mk-search:focus-within { border-color: var(--mk-gold-hot); box-shadow: 0 0 0 3px var(--accent-soft), inset 0 2px 6px rgba(0, 0, 0, 0.4); color: var(--mk-gold); }
.mk-search input { flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; color: var(--text-main); font: 500 1rem var(--font-sans); }
.mk-search input::placeholder { color: var(--text-faint); }
.mk-select select {
  min-height: 50px;
  padding: 0 2.1rem 0 0.95rem;
  border-radius: 16px;
  border: 1px solid var(--border-subtle);
  background: var(--bg-surface) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23aea69f' stroke-width='3'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E") right 0.8rem center no-repeat;
  color: var(--text-main);
  font: 700 0.88rem var(--font-sans);
  appearance: none;
  cursor: pointer;
}
.mk-select select:hover, .mk-select select:focus { border-color: rgba(255, 209, 102, 0.55); outline: 0; }
.mk-filters-btn { min-height: 50px; border-radius: 16px; }
.mk-badge:not(:empty) { min-width: 1.3rem; padding: 0 0.35rem; border-radius: 999px; background: var(--mk-gold-hot); color: #221203; font-size: 0.72rem; font-weight: 800; line-height: 1.3rem; text-align: center; }

.mk-tags { display: flex; flex-wrap: wrap; gap: 0.4rem; margin-top: 0.75rem; }
.mk-tags:empty { display: none; }
.mk-tag {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  min-height: 36px;
  padding: 0 0.75rem;
  border-radius: 999px;
  border: 1px solid rgba(248, 148, 26, 0.5);
  background: var(--accent-soft);
  color: #ffc680;
  font: 700 0.8rem var(--font-sans);
  cursor: pointer;
}
.mk-tag span { font-size: 1.05rem; line-height: 1; }
.mk-tag-clear { border-color: var(--border-subtle); background: transparent; color: var(--text-muted); }

/* The Filters sheet: under the tools on a wide screen, a sheet from the bottom on a phone */
.mk-sheet {
  display: grid;
  gap: 1.05rem;
  margin-top: 0.8rem;
  padding: 1.1rem;
  border-radius: var(--mk-radius);
  border: 1px solid rgba(255, 209, 102, 0.2);
  background: var(--bg-surface);
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.45);
}
.mk-sheet[hidden] { display: none; }
.mk-sheet-head { display: flex; align-items: center; justify-content: space-between; }
.mk-sheet-head b { font: 800 1.1rem var(--font-display); }
.mk-sheet-foot { display: none; gap: 0.5rem; }
.mk-field { display: grid; gap: 0.5rem; }
.mk-label { font-size: 0.7rem; font-weight: 800; letter-spacing: 0.12em; text-transform: uppercase; color: var(--text-faint); }
.mk-hint { font-size: 0.78rem; color: var(--text-faint); margin: 0; }
.mk-range { display: flex; align-items: center; gap: 0.5rem; max-width: 26rem; color: var(--text-muted); font-size: 0.85rem; }
.mk-range input {
  flex: 1;
  min-width: 0;
  min-height: 44px;
  padding: 0 0.85rem;
  border-radius: 12px;
  border: 1px solid var(--border-subtle);
  background: var(--input-bg);
  color: var(--text-main);
  font: 700 0.95rem var(--font-sans);
}
.mk-range input:focus { outline: 0; border-color: var(--mk-gold-hot); box-shadow: 0 0 0 3px var(--accent-soft); }
.mk-check { display: flex; align-items: center; gap: 0.55rem; min-height: 36px; font-size: 0.9rem; cursor: pointer; }
.mk-check input { width: 18px; height: 18px; accent-color: var(--mk-gold-hot); }

/* ================= "JUST SOLD" ================= */
.mk-ticker {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin: 1rem 0 0;
  padding: 0.5rem 0.6rem;
  border-radius: 16px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.04), transparent), #0e0c12;
  border: 1px solid rgba(255, 255, 255, 0.07);
  overflow: hidden;
}
.mk-ticker:empty { display: none; }
.mk-ticker-label {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.38rem 0.7rem;
  border-radius: 999px;
  background: rgba(74, 222, 128, 0.12);
  color: #86efac;
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}
.mk-ticker-view {
  flex: 1;
  min-width: 0;
  contain: inline-size; /* the moving strip is thousands of pixels long: it must not widen the page */
  overflow-x: auto;
  scrollbar-width: none;
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 1.5rem, #000 calc(100% - 2rem), transparent);
  mask-image: linear-gradient(90deg, transparent, #000 1.5rem, #000 calc(100% - 2rem), transparent);
}
.mk-ticker-view::-webkit-scrollbar { display: none; }
.mk-ticker-view:has(.is-moving) { overflow: hidden; }
.mk-ticker-track { display: flex; gap: 0.5rem; width: max-content; }
.mk-ticker-track.is-moving { animation: mk-scroll calc(var(--n) * 4.5s) linear infinite; }
.mk-ticker:hover .mk-ticker-track.is-moving, .mk-ticker:focus-within .mk-ticker-track.is-moving { animation-play-state: paused; }
.mk-ticker-copy { display: contents; }
@keyframes mk-scroll { to { transform: translateX(-50%); } }
.mk-tick {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  min-height: 38px;
  padding: 0 0.8rem 0 0.35rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.045);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: var(--text-main);
  font-size: 0.82rem;
  text-decoration: none;
  white-space: nowrap;
}
.mk-tick:hover { border-color: var(--rc); background: color-mix(in srgb, var(--rc) 12%, transparent); }
.mk-tick-art { display: grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; background: radial-gradient(circle, color-mix(in srgb, var(--rc) 50%, transparent), transparent 70%); }
.mk-tick-art .emo { width: 22px; height: 22px; }
.mk-tick-name { font-weight: 700; color: var(--rc); }
.mk-tick .mk-price { color: var(--mk-gold); }
.mk-tick-ago { color: var(--text-faint); font-size: 0.74rem; }

/* ================= THE BAR: TABS AND WALLET ================= */
.mk-bar {
  position: sticky;
  top: calc(var(--mk-header, 64px) + 8px);
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin: 1rem 0 0;
  padding: 0.4rem;
  border-radius: 18px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: var(--mk-glass);
  box-shadow: 0 14px 34px rgba(0, 0, 0, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.06);
  backdrop-filter: blur(16px) saturate(1.3);
  -webkit-backdrop-filter: blur(16px) saturate(1.3);
}
.mk-tabs { display: flex; flex: 1; gap: 0.3rem; min-width: 0; }
.mk-tab {
  flex: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  min-height: 46px;
  max-width: 15rem;
  padding: 0 0.6rem;
  border: 0;
  border-radius: 13px;
  background: transparent;
  color: var(--text-muted);
  font: 800 0.96rem var(--font-display);
  cursor: pointer;
  transition: color 0.15s ease, background 0.15s ease;
}
.mk-tab:hover { color: var(--text-main); background: rgba(255, 255, 255, 0.05); }
.mk-tab.is-on { background: linear-gradient(180deg, #ffd98a, #f8941a); color: #221203; box-shadow: 0 6px 18px rgba(248, 148, 26, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.55); }
.mk-tab-count { font-size: 0.72rem; font-weight: 800; padding: 0 0.45rem; border-radius: 999px; background: rgba(255, 255, 255, 0.1); line-height: 1.55; }
.mk-tab.is-on .mk-tab-count { background: rgba(0, 0, 0, 0.18); }
.mk-wallet-slot { flex-shrink: 0; display: flex; }
.mk-wallet-slot:empty { display: none; }
.mk-wallet { display: inline-flex; gap: 0.3rem; padding: 0.25rem; border-radius: 13px; background: rgba(0, 0, 0, 0.35); border: 1px solid rgba(255, 209, 102, 0.22); }
.mk-wallet-coin { display: inline-flex; align-items: center; gap: 0.3rem; min-height: 36px; padding: 0 0.6rem; border-radius: 10px; font-family: var(--font-display); }
.mk-wallet-coin:first-child { background: rgba(255, 209, 102, 0.12); }
.mk-wallet-coin b { font-weight: 800; color: #fff3d1; }
.mk-wallet .mk-coin { width: 22px; height: 22px; }
.mk-login-btn { min-height: 46px; border-radius: 13px; white-space: nowrap; }

.mk-part { display: none; }
#mk-body[data-tab="browse"] .mk-part[data-part="browse"],
#mk-body[data-tab="sell"] .mk-part[data-part="sell"],
#mk-body[data-tab="mine"] .mk-part[data-part="mine"] { display: block; }

/* ================= RAILS AND DEPARTMENTS ================= */
.mk-rail { margin-top: 1.9rem; }
.mk-rail-head, .mk-list-head { display: flex; align-items: center; gap: 0.75rem; margin-bottom: 0.7rem; }
.mk-rail-head h2, .mk-list-head h2 { margin: 0; font: 800 1.35rem var(--font-display); letter-spacing: 0.01em; }
.mk-rail-head p, .mk-list-head p { margin: 0.1rem 0 0; font-size: 0.84rem; color: var(--text-muted); }
.mk-list-head { display: block; margin-top: 2.1rem; }
.mk-sell-lead p { max-width: 46rem; line-height: 1.5; }
.mk-rail-icon { display: grid; place-items: center; flex-shrink: 0; width: 42px; height: 42px; border-radius: 13px; }
.mk-rail-deal { background: rgba(244, 81, 79, 0.16); color: #ff8a80; box-shadow: inset 0 0 0 1px rgba(244, 81, 79, 0.35); }
.mk-rail-fresh { background: rgba(62, 162, 234, 0.16); color: #7cc4ff; box-shadow: inset 0 0 0 1px rgba(62, 162, 234, 0.35); }
.mk-rail-shelves { background: rgba(255, 209, 102, 0.14); color: var(--mk-gold); box-shadow: inset 0 0 0 1px rgba(255, 209, 102, 0.32); }
.mk-rail-nav { display: flex; gap: 0.35rem; margin-left: auto; }
.mk-rail-nav button {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: 1px solid var(--border-subtle);
  background: var(--bg-surface);
  color: var(--text-main);
  cursor: pointer;
}
.mk-rail-nav button:hover { border-color: var(--mk-gold); color: var(--mk-gold); }
.mk-rail-track {
  display: flex;
  gap: 0.85rem;
  margin: -14px -1.1rem;
  padding: 14px 1.1rem 18px;
  overflow-x: auto;
  scroll-snap-type: x proximity;
  scroll-padding: 0 1.1rem;
  scrollbar-width: none;
}
.mk-rail-track::-webkit-scrollbar { display: none; }
.mk-rail-track .mk-card { flex: 0 0 196px; scroll-snap-align: start; }

.mk-depts-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(270px, 1fr)); gap: 0.75rem; }
.mk-dept {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  display: flex;
  align-items: center;
  gap: 0.85rem;
  min-height: 84px;
  padding: 0.85rem 1rem;
  border-radius: var(--mk-radius);
  border: 1px solid var(--border-subtle);
  background: var(--bg-card);
  color: var(--text-main);
  font-family: var(--font-sans);
  text-align: left;
  cursor: pointer;
  transition: transform 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
}
.mk-dept::before { /* the best thing on its shelf lights it */
  content: '';
  position: absolute;
  inset: 0;
  z-index: -1;
  background: radial-gradient(ellipse 60% 120% at 0% 50%, color-mix(in srgb, var(--rc) 24%, transparent), transparent 70%);
}
.mk-dept-icon { display: grid; place-items: center; flex-shrink: 0; width: 54px; height: 54px; border-radius: 16px; background: rgba(0, 0, 0, 0.35); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--rc) 45%, transparent); }
.mk-dept-icon .emo { width: 36px; height: 36px; }
.mk-dept-icon .emo-txt { font-size: 1.7rem; }
.mk-dept-text { display: grid; gap: 0.15rem; min-width: 0; flex: 1; }
.mk-dept-text b { font: 800 1.05rem var(--font-display); }
.mk-dept-text span { font-size: 0.78rem; color: var(--text-muted); }
.mk-dept-from { display: grid; justify-items: end; gap: 0.05rem; flex-shrink: 0; }
.mk-dept-from small { font-size: 0.68rem; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; color: var(--text-faint); }
.mk-dept-from .mk-price { font: 800 1.05rem var(--font-display); color: var(--mk-gold); }
@media (hover: hover) {
  .mk-dept:hover { transform: translateY(-3px); border-color: color-mix(in srgb, var(--rc) 70%, transparent); box-shadow: 0 14px 30px rgba(0, 0, 0, 0.45), 0 0 24px color-mix(in srgb, var(--rc) 22%, transparent); }
}

/* ================= THE CARDS ================= */
.mk-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 0.9rem; }
.mk-card {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 0;
  padding: 0.6rem 0.7rem 0.7rem;
  border-radius: var(--mk-radius);
  border: 1px solid color-mix(in srgb, var(--rc) 34%, var(--border-subtle));
  background:
    radial-gradient(ellipse 120% 62% at 50% 0%, color-mix(in srgb, var(--rc) 22%, transparent), transparent 72%),
    linear-gradient(180deg, #17141c 0%, #100e14 100%);
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.06);
  color: var(--text-main);
  font-family: var(--font-sans);
  text-align: center;
  cursor: pointer;
  transform: perspective(760px) rotateX(var(--rx, 0deg)) rotateY(var(--ry, 0deg));
  transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease, translate 0.2s ease;
}
.mk-card::before { /* the edge, lit in the rarity's color */
  content: '';
  position: absolute;
  inset: 0 0 auto;
  height: 3px;
  background: linear-gradient(90deg, transparent, var(--rc), transparent);
}
.mk-card::after { /* a light that follows the mouse (js/market.js sets --mx and --my) */
  content: '';
  position: absolute;
  inset: 0;
  z-index: 1;
  background: radial-gradient(circle 190px at var(--mx, 50%) var(--my, -40%), rgba(255, 255, 255, 0.14), transparent 62%);
  opacity: 0;
  transition: opacity 0.25s ease;
  pointer-events: none;
}
.mk-card-top { display: flex; align-items: center; gap: 0.3rem; width: 100%; min-height: 22px; }
.mk-card-rarity { margin-right: auto; font-size: 0.64rem; font-weight: 800; letter-spacing: 0.13em; text-transform: uppercase; color: var(--rc); }
.mk-deal, .mk-yours, .mk-qty { flex-shrink: 0; padding: 0.08rem 0.45rem; border-radius: 999px; font-size: 0.68rem; font-weight: 800; line-height: 1.5; }
.mk-deal { background: #16a34a; color: #fff; box-shadow: 0 0 12px rgba(74, 222, 128, 0.45); }
.mk-yours { background: var(--accent-soft); color: #ffc680; border: 1px solid rgba(248, 148, 26, 0.45); }
.mk-qty { background: rgba(255, 255, 255, 0.12); color: var(--text-main); }
.mk-card-art { position: relative; display: grid; place-items: center; width: 104px; height: 100px; margin: 0.15rem 0 0.3rem; }
.mk-card-art::before { /* the item's own light */
  content: '';
  position: absolute;
  inset: 4px 6px;
  z-index: -1;
  border-radius: 50%;
  background: radial-gradient(circle, color-mix(in srgb, var(--rc) 46%, transparent) 0%, transparent 68%);
}
.mk-card-art::after { /* Epic and up: rays behind the item, still (it's a list) */
  content: '';
  position: absolute;
  inset: -26px;
  z-index: -2;
  border-radius: 50%;
  background: repeating-conic-gradient(from 8deg, color-mix(in srgb, var(--rc) 46%, transparent) 0deg 5deg, transparent 5deg 20deg);
  -webkit-mask-image: radial-gradient(circle, #000 16%, transparent 64%);
  mask-image: radial-gradient(circle, #000 16%, transparent 64%);
  opacity: 0;
}
.mk-card:is(.r-epic, .r-legendary, .r-mythical, .r-divine) .mk-card-art::after { opacity: 0.6; }
.mk-card-art .emo { width: 76px; height: 76px; filter: drop-shadow(0 8px 12px rgba(0, 0, 0, 0.55)); transition: transform 0.3s cubic-bezier(0.2, 0.8, 0.2, 1); }
.mk-card-art .emo-txt { font-size: 3.2rem; }
.mk-card-name {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  overflow: hidden;
  min-height: 2.5em;
  font: 800 0.98rem/1.25 var(--font-display);
  color: #fff;
}
.mk-card-kind { margin-top: 0.1rem; font-size: 0.74rem; color: var(--text-faint); }
.mk-card-plate {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  width: 100%;
  min-height: 42px;
  margin-top: 0.6rem;
  padding: 0 0.6rem;
  border-radius: 12px;
  background: linear-gradient(180deg, rgba(255, 209, 102, 0.13), rgba(255, 209, 102, 0.03)), rgba(0, 0, 0, 0.42);
  box-shadow: inset 0 0 0 1px rgba(255, 209, 102, 0.26), inset 0 2px 6px rgba(0, 0, 0, 0.4);
}
.mk-card-plate .mk-price { font: 800 1.2rem var(--font-display); color: var(--mk-gold); }
.mk-card-plate .mk-coin { width: 22px; height: 22px; }
.mk-card-plate .mk-faint { font-size: 0.8rem; }
.mk-from { font-size: 0.68rem; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--text-faint); }
.mk-stock { margin-left: auto; font-size: 0.72rem; font-weight: 800; color: var(--text-muted); }
/* A price in the millions takes the plate's whole width: the small words step aside */
.mk-card-plate.is-long { gap: 0.2rem; padding: 0 0.4rem; }
.mk-card-plate.is-long .mk-from { display: none; }
.mk-card-plate.is-long .mk-price { font-size: 1.06rem; }
.mk-card-plate.is-long .mk-stock { margin-left: 0.15rem; }
.mk-card-foot { margin-top: 0.5rem; font-size: 0.73rem; color: var(--text-faint); }
.mk-card-foot b { color: var(--text-muted); }
.mk-card.is-held { filter: saturate(0.5) brightness(0.8); }
.mk-card:focus-visible { outline: 2px solid var(--rc); outline-offset: 3px; }
/* Mythical: a pale light. Divine: black and gold. Both still in a list (REDEPLOY.md: a page of moving gold is noise) */
.mk-card.r-mythical { background: radial-gradient(ellipse 120% 62% at 50% 0%, rgba(255, 241, 204, 0.3), transparent 72%), linear-gradient(160deg, #221f1a 0%, #100e14 70%); }
.mk-card.r-divine { background: radial-gradient(ellipse 120% 62% at 50% 0%, rgba(240, 194, 46, 0.34), transparent 72%), linear-gradient(160deg, #000 0%, #17130a 55%, #2a2106 100%); border-color: rgba(240, 194, 46, 0.6); }
@media (hover: hover) {
  .mk-card:hover {
    translate: 0 -6px;
    border-color: var(--rc);
    box-shadow: 0 22px 44px rgba(0, 0, 0, 0.55), 0 0 30px color-mix(in srgb, var(--rc) 34%, transparent), inset 0 1px 0 rgba(255, 255, 255, 0.1);
  }
  .mk-card:hover::after { opacity: 1; }
  .mk-card:hover .mk-card-art .emo { transform: scale(1.14) translateY(-3px); }
}

.mk-price { display: inline-flex; align-items: center; gap: 0.25rem; font-weight: 800; white-space: nowrap; font-variant-numeric: tabular-nums; }
.mk-coin { width: 18px; height: 18px; object-fit: contain; flex-shrink: 0; }
.mk-faint { color: var(--text-faint); font-weight: 500; }
.mk-good { color: var(--mk-good); font-weight: 700; }
.mk-warn { color: var(--mk-warn); font-weight: 700; }
.mk-more { display: flex; margin: 1.4rem auto 0; }

.mk-empty {
  display: grid;
  justify-items: center;
  gap: 0.45rem;
  margin: 1.4rem 0;
  padding: 2.8rem 1.2rem;
  border-radius: var(--mk-radius);
  border: 1px dashed var(--border-subtle);
  text-align: center;
  color: var(--text-muted);
}
.mk-empty p { margin: 0; max-width: 32rem; line-height: 1.5; }
.mk-empty .mk-btn { margin-top: 0.7rem; }
.mk-empty-title { font: 800 1.35rem var(--font-display); color: var(--text-main); }
.mk-empty code { padding: 0.1rem 0.4rem; border-radius: 6px; background: rgba(255, 255, 255, 0.08); color: var(--mk-gold); }
.mk-login {
  border-style: solid;
  border-color: rgba(255, 209, 102, 0.3);
  background: radial-gradient(ellipse 70% 100% at 50% 0%, rgba(248, 148, 26, 0.2), transparent 70%), var(--bg-surface);
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.4);
}

/* ================= MY LISTINGS ================= */
.mk-mine-sum { display: flex; flex-wrap: wrap; gap: 0.6rem; margin: 1.4rem 0 1rem; }
.mk-mine-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.6rem; }
.mk-mine-row {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 0.9rem;
  padding: 0.65rem 0.8rem;
  border-radius: 16px;
  border: 1px solid color-mix(in srgb, var(--rc) 30%, var(--border-subtle));
  background: var(--bg-card);
}
.mk-mine-row::before { content: ''; position: absolute; inset: 0; z-index: -1; background: radial-gradient(ellipse 40% 140% at 0% 50%, color-mix(in srgb, var(--rc) 20%, transparent), transparent 70%); }
.mk-mine-row > .mk-price { color: var(--mk-gold); font: 800 1.15rem var(--font-display); }
.mk-mine-row > .mk-price .mk-coin { width: 22px; height: 22px; }
.mk-mine-item { display: flex; align-items: center; gap: 0.8rem; min-width: 0; padding: 0; border: 0; background: none; color: inherit; text-align: left; cursor: pointer; font: inherit; }
.mk-mine-art { display: grid; place-items: center; flex-shrink: 0; width: 52px; height: 52px; border-radius: 14px; background: rgba(0, 0, 0, 0.35); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--rc) 45%, transparent); }
.mk-mine-art .emo { width: 38px; height: 38px; }
.mk-mine-text { display: grid; gap: 0.1rem; min-width: 0; }
.mk-mine-text b { color: #fff; font: 800 1rem var(--font-display); overflow-wrap: anywhere; }
.mk-mine-text span { font-size: 0.78rem; color: var(--text-muted); }

/* ================= THE ITEM'S PANEL AND THE MODAL ================= */
.mk-dialog {
  width: min(1000px, calc(100% - 2rem));
  max-height: min(90vh, 860px);
  margin: auto; /* codex.css zeroes every margin, which took away the browser's centering */
  padding: 0;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 26px;
  background: #100e14;
  color: var(--text-main);
  box-shadow: 0 40px 100px rgba(0, 0, 0, 0.75);
  overflow: auto;
  overscroll-behavior: contain;
}
.mk-dialog::backdrop { background: rgba(4, 3, 6, 0.78); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); }
.mk-dialog[open] { animation: mk-rise 0.26s cubic-bezier(0.2, 0.8, 0.2, 1); }
@keyframes mk-rise { from { opacity: 0; transform: translateY(18px) scale(0.97); } }

.mk-item { position: relative; display: grid; grid-template-columns: minmax(0, 0.82fr) minmax(0, 1.18fr); min-height: 520px; }
.mk-item-x { position: absolute; top: 0.9rem; right: 0.9rem; z-index: 3; }
.mk-item-stage {
  --cy: 128px;
  position: relative;
  isolation: isolate;
  overflow: hidden;
  display: grid;
  justify-items: center;
  align-content: start;
  gap: 0.35rem;
  padding: 2.2rem 1.4rem 1.6rem;
  background:
    radial-gradient(ellipse 110% 60% at 50% 0%, color-mix(in srgb, var(--rc) 30%, transparent), transparent 75%),
    linear-gradient(180deg, #17141d, #0c0a10);
  border-right: 1px solid rgba(255, 255, 255, 0.08);
  text-align: center;
}
.mk-item-stage .mk-spot-rays, .mk-item-stage .mk-spot-halo { z-index: -1; }
.mk-item-art { display: grid; place-items: center; width: 170px; height: 170px; animation: mk-float 5.5s ease-in-out infinite; }
.mk-item-art .emo { width: 150px; height: 150px; filter: drop-shadow(0 16px 22px rgba(0, 0, 0, 0.6)) drop-shadow(0 0 26px color-mix(in srgb, var(--rc) 55%, transparent)); }
.mk-item-art .emo-txt { font-size: 6rem; }
.mk-item-stage .mk-spot-floor { margin-bottom: 0.6rem; }
.mk-pill { display: inline-block; padding: 0.2rem 0.75rem; border-radius: 999px; border: 1px solid var(--rc); background: color-mix(in srgb, var(--rc) 14%, transparent); color: var(--rc); font-size: 0.7rem; font-weight: 800; letter-spacing: 0.14em; text-transform: uppercase; }
.mk-item-name { margin: 0.45rem 0 0; font: 800 clamp(1.4rem, 3.4vw, 1.9rem)/1.15 var(--font-display); color: #fff; overflow-wrap: anywhere; }
.mk-item-kind { margin: 0; font-size: 0.88rem; color: var(--text-muted); }
.mk-item-text { margin: 0.7rem 0 0; font-size: 0.9rem; line-height: 1.55; color: rgba(246, 242, 238, 0.76); }
.mk-item-lines { list-style: none; display: grid; gap: 0.35rem; width: 100%; margin: 0.8rem 0 0; padding: 0; }
.mk-item-lines li { padding: 0.45rem 0.7rem; border-radius: 10px; background: rgba(0, 0, 0, 0.35); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.07); font-size: 0.84rem; line-height: 1.4; }
.mk-link { margin-top: 0.9rem; color: var(--mk-gold); font-weight: 700; font-size: 0.86rem; }

.mk-item-body { min-width: 0; padding: 1.5rem 1.5rem 1.4rem; }
.mk-facts { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0.55rem; margin-right: 3rem; }
.mk-fact { display: grid; align-content: start; gap: 0.2rem; min-width: 0; padding: 0.7rem 0.8rem; border-radius: 14px; background: rgba(255, 255, 255, 0.035); border: 1px solid rgba(255, 255, 255, 0.08); }
.mk-fact > span { font-size: 0.66rem; font-weight: 800; letter-spacing: 0.1em; text-transform: uppercase; color: var(--text-faint); }
.mk-fact b { min-width: 0; font: 800 1.2rem var(--font-display); overflow-wrap: anywhere; }
.mk-fact .mk-price { color: var(--mk-gold); }
.mk-fact .mk-coin { width: 20px; height: 20px; }
.mk-fact small { font-size: 0.74rem; color: var(--text-faint); }
.mk-fact small.mk-good { color: var(--mk-good); }
.mk-chart { margin: 1rem 0 0; padding: 0.8rem 0.9rem 0.7rem; border-radius: 16px; background: rgba(0, 0, 0, 0.3); border: 1px solid rgba(255, 255, 255, 0.08); color: var(--rc); }
.mk-chart figcaption, .mk-chart-range { display: flex; justify-content: space-between; gap: 1rem; font-size: 0.72rem; font-weight: 700; color: var(--text-faint); }
.mk-chart figcaption span:first-child { letter-spacing: 0.1em; text-transform: uppercase; }
.mk-chart svg { display: block; width: 100%; height: 96px; margin: 0.4rem 0 0.3rem; overflow: visible; }
.mk-chart-range .mk-price { color: var(--mk-gold); margin-left: 0.25rem; }
.mk-chart-range .mk-coin { width: 14px; height: 14px; }
.mk-sub { margin: 1.3rem 0 0.6rem; font: 800 0.72rem var(--font-sans); letter-spacing: 0.12em; text-transform: uppercase; color: var(--text-faint); }
.mk-rows { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.4rem; max-height: 262px; overflow: auto; }
.mk-row {
  display: grid;
  grid-template-columns: auto auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 0.75rem;
  padding: 0.4rem 0.45rem 0.4rem 0.55rem;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.03);
}
.mk-row:first-child { border-color: rgba(255, 209, 102, 0.35); background: rgba(255, 209, 102, 0.06); }
.mk-row-n { display: grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; background: rgba(255, 255, 255, 0.08); font-size: 0.72rem; font-weight: 800; color: var(--text-muted); }
.mk-row .mk-price { color: var(--mk-gold); font: 800 1.08rem var(--font-display); }
.mk-row .mk-coin { width: 20px; height: 20px; }
.mk-row-ago { font-size: 0.8rem; color: var(--text-muted); }
.mk-row.is-mine { border-color: rgba(248, 148, 26, 0.45); }
.mk-item-foot { display: flex; flex-wrap: wrap; align-items: center; gap: 0.6rem; margin-top: 1.2rem; }
.mk-item-foot .mk-btn-gold { flex: 1; }

.mk-confirm { width: min(470px, calc(100% - 2rem)); }
.mk-ask { position: relative; isolation: isolate; display: grid; gap: 0.9rem; padding: 1.5rem; }
.mk-ask::before { content: ''; position: absolute; inset: 0 0 auto; z-index: -1; height: 180px; background: radial-gradient(ellipse 80% 100% at 50% 0%, color-mix(in srgb, var(--rc) 30%, transparent), transparent 75%); pointer-events: none; }
.mk-ask h2 { margin: 0; font: 800 1.45rem var(--font-display); }
.mk-ask p { margin: 0; line-height: 1.5; color: var(--text-muted); }
.mk-ask-item { display: flex; align-items: center; gap: 0.85rem; padding: 0.7rem; border-radius: 16px; background: rgba(0, 0, 0, 0.4); border: 1px solid color-mix(in srgb, var(--rc) 45%, rgba(255, 255, 255, 0.08)); }
.mk-ask-item > span:last-child { display: grid; gap: 0.15rem; min-width: 0; }
.mk-ask-item b { color: #fff; font: 800 1.02rem var(--font-display); overflow-wrap: anywhere; }
.mk-ask-item .mk-price { color: var(--mk-gold); }
.mk-ask-item .mk-faint { font-size: 0.8rem; }
.mk-ask-art { display: grid; place-items: center; flex-shrink: 0; width: 60px; height: 60px; border-radius: 16px; background: radial-gradient(circle, color-mix(in srgb, var(--rc) 46%, transparent), transparent 72%); }
.mk-ask-art .emo { width: 46px; height: 46px; }
.mk-sums { margin: 0; display: grid; }
.mk-sums div { display: flex; justify-content: space-between; align-items: center; gap: 1rem; padding: 0.5rem 0; border-bottom: 1px solid rgba(255, 255, 255, 0.08); }
.mk-sums div:last-child { border-bottom: 0; }
.mk-sums dt { color: var(--text-muted); font-size: 0.9rem; }
.mk-sums dd { margin: 0; font-family: var(--font-display); }
.mk-sums .mk-price { color: var(--mk-gold); font-size: 1.1rem; }
.mk-sums .mk-coin { width: 20px; height: 20px; }
.mk-price-box { display: flex; align-items: center; gap: 0.6rem; padding: 0 0 0 0.8rem; border-radius: 16px; border: 1px solid rgba(255, 209, 102, 0.3); background: var(--input-bg); box-shadow: inset 0 2px 6px rgba(0, 0, 0, 0.45); }
.mk-price-box:focus-within { border-color: var(--mk-gold-hot); box-shadow: 0 0 0 3px var(--accent-soft), inset 0 2px 6px rgba(0, 0, 0, 0.45); }
.mk-price-box .mk-coin { width: 28px; height: 28px; }
.mk-price-box input { flex: 1; min-width: 0; min-height: 54px; border: 0; outline: 0; background: transparent; color: var(--mk-gold); font: 800 1.4rem var(--font-display); }
.mk-price-box input::placeholder { color: var(--text-faint); font-weight: 600; font-size: 1rem; }
.mk-quick { display: flex; flex-wrap: wrap; gap: 0.4rem; }
.mk-payout { display: grid; gap: 0.3rem; min-height: 1.5rem; font-size: 0.88rem; color: var(--text-muted); }
.mk-payout b { color: var(--mk-gold); }
.mk-ask-buttons { display: flex; justify-content: flex-end; flex-wrap: wrap; gap: 0.5rem; margin-top: 0.3rem; }
.mk-ask-buttons .mk-btn { min-height: 48px; }
/* The modal's first half second: nothing can be pressed (a double click on Buy would land on it) */
.mk-dialog.is-waiting .mk-ask-buttons { pointer-events: none; }
.mk-dialog.is-waiting .mk-ask-buttons .mk-btn-gold { filter: saturate(0.6) brightness(0.85); }

/* A purchase that went through */
.mk-won {
  --cy: 118px;
  position: relative;
  isolation: isolate;
  overflow: hidden;
  display: grid;
  justify-items: center;
  gap: 0.4rem;
  padding: 2rem 1.5rem 1.5rem;
  text-align: center;
  background: radial-gradient(ellipse 100% 70% at 50% 0%, color-mix(in srgb, var(--rc) 34%, transparent), transparent 75%);
}
.mk-won .mk-spot-rays, .mk-won .mk-spot-halo { z-index: -1; }
.mk-won .mk-spot-rays { opacity: 0.7; animation-duration: 18s; }
.mk-won-art { display: grid; place-items: center; width: 170px; height: 170px; animation: mk-land 0.7s cubic-bezier(0.2, 1.4, 0.3, 1) both; }
.mk-won-art .emo { width: 150px; height: 150px; filter: drop-shadow(0 16px 22px rgba(0, 0, 0, 0.6)) drop-shadow(0 0 30px color-mix(in srgb, var(--rc) 70%, transparent)); }
@keyframes mk-land { from { opacity: 0; transform: translateY(-40px) scale(0.5) rotate(-12deg); } }
.mk-won-kicker { margin: 0.4rem 0 0; font-size: 0.74rem; font-weight: 800; letter-spacing: 0.24em; text-transform: uppercase; color: var(--mk-gold); }
.mk-won h2 { margin: 0; font: 800 1.7rem/1.15 var(--font-display); color: #fff; overflow-wrap: anywhere; }
.mk-won p { margin: 0; color: var(--text-muted); line-height: 1.5; }
.mk-won p .mk-price { color: var(--mk-gold); vertical-align: -0.2em; }
.mk-won .mk-ask-buttons { justify-content: center; margin-top: 0.9rem; width: 100%; }
.mk-won .mk-ask-buttons .mk-btn { min-width: 12rem; }

/* ================= NOTES IN THE CORNER ================= */
.mk-toasts { position: fixed; right: 1rem; bottom: 1rem; z-index: 300; display: grid; gap: 0.5rem; max-width: min(390px, calc(100% - 2rem)); }
.mk-toast {
  padding: 0.85rem 1rem;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-left: 4px solid var(--mk-gold-hot);
  background: #1c1923;
  color: var(--text-main);
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.6);
  font-size: 0.9rem;
  line-height: 1.45;
  animation: mk-rise 0.25s ease-out;
}
.mk-toast .mk-price { color: var(--mk-gold); vertical-align: -0.2em; }
.mk-toast.is-good { border-left-color: var(--mk-good); }
.mk-toast.is-error { border-left-color: #ef4444; }
.mk-toast.is-leaving { opacity: 0; transform: translateY(6px); transition: opacity 0.35s ease, transform 0.35s ease; }

/* ================= NARROWER SCREENS ================= */
@media (max-width: 900px) {
  .mk-hero { grid-template-columns: 1fr; gap: 0.5rem; padding-bottom: 1.4rem; }
  .mk-hero-art { background-position: center, center, 60% 20%; }
  .mk-hero::before { right: -20%; top: 30%; width: 140%; height: 90%; }
  .mk-stage { min-height: 330px; }
  .mk-item { grid-template-columns: 1fr; }
  .mk-item-stage { border-right: 0; border-bottom: 1px solid rgba(255, 255, 255, 0.08); padding-top: 1.6rem; --cy: 110px; }
  .mk-item-art { width: 150px; height: 150px; }
  .mk-item-art .emo { width: 128px; height: 128px; }
  .mk-facts { margin-right: 0; }
}
@media (max-width: 640px) {
  .mk-main { padding: 0 0.75rem 4rem; }
  .mk-hero { margin-top: 0.75rem; border-radius: 22px; min-height: 0; }
  .mk-plaque { min-width: 0; flex: 1; padding: 0.5rem 0.6rem; }
  .mk-plaque b { font-size: 1.2rem; }
  .mk-plaque > span { font-size: 0.6rem; letter-spacing: 0.06em; }
  /* A phone's first screen should reach the market itself: a shorter banner, the stage as one row */
  .mk-hero { padding: 1.1rem 1rem 0.8rem; }
  .mk-eyebrow { margin-bottom: 0.6rem; font-size: 0.64rem; }
  .mk-title { font-size: clamp(2.2rem, 11vw, 2.9rem); }
  .mk-tagline { margin-top: 0.6rem; font-size: 0.9rem; }
  .mk-hero-stats { margin-top: 0.9rem; min-height: 0; }
  .mk-stage { min-height: 0; margin-top: 0.4rem; }
  .mk-spot { --cy: 62px; grid-template-columns: 112px minmax(0, 1fr); align-items: center; gap: 0 0.6rem; width: 100%; padding-top: 6px; }
  .mk-spot-art { width: 112px; height: 112px; }
  .mk-spot-art .emo { width: 96px; height: 96px; }
  .mk-spot-rays { left: 56px; width: 300px; height: 300px; margin: -150px 0 0 -150px; }
  .mk-spot-halo { left: 56px; width: 170px; height: 170px; margin: -85px 0 0 -85px; }
  .mk-spot-floor { display: none; }
  .mk-spot-plate { justify-items: start; margin-top: 0; padding: 0.65rem 0.8rem; text-align: left; }
  .mk-spot-name { font-size: 1.05rem; }
  .mk-spot-price { flex-wrap: wrap; gap: 0.1rem 0.5rem; }
  .mk-spot-price .mk-price { font-size: 1.2rem; }
  .mk-spot-dots { margin-top: 0.1rem; }
  .mk-bar { flex-wrap: wrap; top: calc(var(--mk-header, 64px) + 4px); border-radius: 16px; }
  .mk-tabs { flex-basis: 100%; }
  .mk-tab { font-size: 0.86rem; min-height: 42px; padding: 0 0.25rem; gap: 0.3rem; }
  .mk-wallet-slot { flex: 1; }
  .mk-wallet { flex: 1; justify-content: space-between; }
  .mk-login-btn { flex: 1; min-height: 42px; }
  .mk-tools .mk-search { flex-basis: 100%; }
  .mk-tools .mk-select { flex: 1; }
  .mk-tools .mk-select select { width: 100%; }
  .mk-chips#mk-depts, .mk-chips#mk-sell-depts { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; margin: 0 -0.75rem; padding: 0 0.75rem; }
  .mk-chips#mk-depts::-webkit-scrollbar, .mk-chips#mk-sell-depts::-webkit-scrollbar { display: none; }
  .mk-rail-head h2, .mk-list-head h2 { font-size: 1.15rem; }
  .mk-rail-nav { display: none; }
  .mk-rail-track { margin-inline: -0.75rem; padding-inline: 0.75rem; scroll-padding: 0 0.75rem; gap: 0.6rem; }
  .mk-rail-track .mk-card { flex-basis: 158px; }
  .mk-depts-grid { grid-template-columns: 1fr; }
  .mk-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.6rem; }
  .mk-card { padding: 0.5rem 0.5rem 0.6rem; }
  .mk-card-art { width: 88px; height: 84px; }
  .mk-card-art .emo { width: 62px; height: 62px; }
  .mk-card-name { font-size: 0.88rem; }
  /* A phone's card is narrow: the small word goes over the price and the count into the corner, so "from 191,078 x3"
     never runs out of the plate (it did, and sooner in Firefox) */
  .mk-card-plate { position: relative; flex-direction: column; gap: 0; min-height: 46px; padding: 0.2rem 0.4rem; }
  .mk-card-plate .mk-from, .mk-card-plate.is-long .mk-from { display: block; font-size: 0.58rem; line-height: 1.15; }
  .mk-card-plate .mk-price, .mk-card-plate.is-long .mk-price { font-size: 1.02rem; }
  .mk-card-plate .mk-coin { width: 18px; height: 18px; }
  .mk-card-plate .mk-stock, .mk-card-plate.is-long .mk-stock { position: absolute; top: 3px; right: 7px; margin: 0; font-size: 0.64rem; }
  .mk-mine-sum .mk-plaque { flex: 1 1 8.5rem; }
  .mk-card-foot { font-size: 0.68rem; }
  /* The Filters sheet slides up from the bottom */
  .mk-sheet {
    position: fixed;
    inset: auto 0 0;
    z-index: 200;
    max-height: 82vh;
    overflow: auto;
    margin: 0;
    border-radius: 22px 22px 0 0;
    box-shadow: 0 -24px 70px rgba(0, 0, 0, 0.7);
    padding-bottom: calc(1rem + env(safe-area-inset-bottom));
    animation: mk-rise 0.22s ease-out;
  }
  .mk-sheet-foot { display: flex; position: sticky; bottom: 0; padding-top: 0.5rem; background: var(--bg-surface); }
  .mk-sheet-foot .mk-btn { flex: 1; min-height: 48px; }
  .mk-dialog { width: 100%; max-width: none; max-height: 93vh; margin: auto 0 0; border-radius: 24px 24px 0 0; border-bottom: 0; }
  .mk-confirm { width: 100%; }
  .mk-item-body { padding: 1.1rem; }
  .mk-facts { grid-template-columns: 1fr 1fr; }
  .mk-fact:last-child { grid-column: 1 / -1; }
  .mk-row { gap: 0.5rem; }
  .mk-row-n { display: none; }
  .mk-row { grid-template-columns: auto minmax(0, 1fr) auto; }
  .mk-item-foot .mk-btn { flex: 1; }
  .mk-mine-row { grid-template-columns: minmax(0, 1fr) auto; }
  .mk-mine-row > .mk-btn { grid-column: 1 / -1; }
  .mk-ask-buttons .mk-btn { flex: 1; }
  .mk-toasts { left: 0.75rem; right: 0.75rem; max-width: none; bottom: 0.75rem; }
}
@media (max-width: 360px) {
  .mk-tab-count { display: none; }
  .mk-wallet-coin { padding: 0 0.4rem; }
  .mk-spot { grid-template-columns: 96px minmax(0, 1fr); --cy: 54px; }
  .mk-spot-art { width: 96px; height: 96px; }
  .mk-spot-art .emo { width: 84px; height: 84px; }
  .mk-spot-rays, .mk-spot-halo { left: 48px; }
  .mk-spot-kind { letter-spacing: 0.08em; }
  .mk-spot-price .mk-price { font-size: 1.02rem; }
  .mk-spot-price .mk-coin { width: 18px; height: 18px; }
  .mk-card-plate .mk-price, .mk-card-plate.is-long .mk-price { font-size: 0.95rem; }
}

/* Browsers without color-mix (Safari before 16.2): a declaration that uses it is dropped whole, so the pieces that
   would lose their background or edge get plain ones. They keep their rarity color through var(--rc) alone. */
@supports not (color: color-mix(in srgb, red 10%, transparent)) {
  .mk-card { border: 1px solid var(--border-subtle); background: linear-gradient(180deg, #17141c 0%, #100e14 100%); }
  .mk-spot-plate { border: 1px solid var(--rc); background: rgba(10, 9, 13, 0.78); }
  .mk-item-stage { background: linear-gradient(180deg, #17141d, #0c0a10); }
  .mk-dept-icon, .mk-mine-art { box-shadow: inset 0 0 0 1px var(--rc); }
  .mk-ask-item { border: 1px solid var(--rc); }
  .mk-mine-row { border: 1px solid var(--border-subtle); }
  .mk-chip-rarity { border-color: var(--rc); }
  .mk-pill { background: transparent; }
  .mk-card-art .emo, .mk-spot-art .emo, .mk-item-art .emo, .mk-won-art .emo { filter: drop-shadow(0 8px 12px rgba(0, 0, 0, 0.55)); }
}

@media (prefers-reduced-motion: reduce) {
  .mk-embers { display: none; }
  .mk-dot, .mk-ticker-track.is-moving, .mk-btn-gold.is-sure, .mk-spot, .mk-spot-rays, .mk-spot-halo, .mk-spot-art, .mk-item-art, .mk-won-art { animation: none; }
  .mk-dialog[open], .mk-toast, .mk-sheet { animation: none; }
  .mk-card, .mk-card-art .emo, .mk-dept, .mk-spot { transition: none; transform: none; }
}
