:root {
  --sky-top: #6ec6ff;
  --sky-bottom: #d9f1ff;
  --wood: #7a3b0c;
  --wood-dark: #4a2306;
  --orange: #f58a1f;
  --orange-light: #ffb44d;
  --cream: #fff8e7;
  --cream-2: #fdecc8;
  --ink: #3b1d06;
  --muted: #74553a;
  --up: #23803a;
  --down: #c2302a;
  --gold: #f6c33b;
  --radius: 14px;
  /* Original v83 game cursors (UI.wz/Basic.img/Cursor 0, 1/0, 1/1); hotspots are the WZ origins. */
  --cursor: url(../assets/cursors/normal.png) 0 3, default;
  --cursor-link: url(../assets/cursors/hover.png) 3 6, pointer;
  --cursor-press: url(../assets/cursors/press.png) 4 4, pointer;
}

* { box-sizing: border-box; }
html { cursor: var(--cursor); }
:is(a, button, select, summary, [role="option"], .sale, .price-table tbody tr):active,
:is(a, button, select, summary, [role="option"], .sale, .price-table tbody tr):active * { cursor: var(--cursor-press); }
a, button, select, summary { cursor: var(--cursor-link); }
button:disabled { cursor: var(--cursor); }
input, textarea { cursor: text; }

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Nunito", system-ui, sans-serif;
  color: var(--ink);
  background: linear-gradient(180deg, var(--sky-top) 0%, var(--sky-bottom) 70%, #eaf8d8 100%);
  background-attachment: fixed;
  overflow-x: hidden;
}

h1, h2, h3, .window-title, .tab, .stat-value { font-family: "Fredoka", "Nunito", sans-serif; }

/* ---------- Sky ---------- */
.sky { position: fixed; inset: 0; pointer-events: none; z-index: 0; overflow: hidden; }
.cloud {
  position: absolute; background: #fff; border-radius: 100px; opacity: .85;
  animation: drift linear infinite;
}
.cloud::before, .cloud::after { content: ""; position: absolute; background: #fff; border-radius: 50%; }
.cloud::before { width: 55%; height: 170%; top: -80%; left: 15%; }
.cloud::after { width: 40%; height: 130%; top: -50%; right: 12%; }
.c1 { width: 180px; height: 46px; top: 12%; animation-duration: 90s; animation-delay: -20s; }
.c2 { width: 120px; height: 32px; top: 30%; animation-duration: 70s; animation-delay: -50s; opacity: .7; }
.c3 { width: 220px; height: 54px; top: 55%; animation-duration: 120s; animation-delay: -5s; opacity: .6; }
.c4 { width: 140px; height: 38px; top: 78%; animation-duration: 95s; animation-delay: -70s; opacity: .5; }
@keyframes drift { from { transform: translateX(-260px); } to { transform: translateX(110vw); } }

/* ---------- Top bar ---------- */
.topbar {
  position: relative; z-index: 2;
  display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap;
  padding: 18px 28px; max-width: 1500px; margin: 0 auto;  /* same width and edges as .layout below */
}
.brand { display: flex; align-items: center; gap: 14px; }
.mushroom { width: 62px; height: 62px; animation: hop 1.6s ease-in-out infinite; filter: drop-shadow(0 4px 0 rgba(0,0,0,.15)); }
@keyframes hop { 0%,100% { transform: translateY(0) scaleY(1); } 45% { transform: translateY(-10px) scaleY(1.03); } 55% { transform: translateY(-10px); } 90% { transform: translateY(0) scaleY(.94); } }
.brand h1 {
  margin: 0; font-size: 2.2rem; letter-spacing: .5px; color: #fff;
  -webkit-text-stroke: 2px var(--wood); paint-order: stroke fill;
  text-shadow: 0 4px 0 var(--wood-dark);
}
.brand h1 span { color: var(--orange-light); }
.tag { margin: 2px 0 0; font-weight: 800; color: var(--wood); font-size: .85rem; }

.top-actions { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.search {
  display: flex; align-items: center; gap: 8px;
  background: var(--cream); border: 3px solid var(--wood); border-radius: 999px;
  padding: 6px 14px; box-shadow: 0 3px 0 var(--wood-dark);
}
.search input { border: 0; outline: 0; background: transparent; font: inherit; font-weight: 700; width: 260px; color: var(--ink); }
.ms-select {
  font: inherit; font-weight: 800; color: #fff; cursor: var(--cursor-link);
  background: linear-gradient(#ffb44d, #e0701a); border: 3px solid var(--wood); border-radius: 999px;
  padding: 7px 14px; box-shadow: 0 3px 0 var(--wood-dark);
}
.ms-select option { color: var(--ink); background: var(--cream); }

/* ---------- Megaphone ticker ---------- */
.megaphone {
  position: fixed; z-index: 15; left: 0; right: 0; top: 0;
  display: flex; align-items: stretch;
  background: linear-gradient(90deg, #ff7ac0, #c86cf0); border-bottom: 2px solid #6b2a78;
  box-shadow: 0 2px 0 #3f1747, 0 6px 16px rgba(63, 23, 71, .2);
  padding-top: env(safe-area-inset-top);
}
.mega-label {
  flex: none; display: flex; align-items: center; padding: 0 12px;
  font-weight: 800; color: #fff; background: #6b2a78; font-size: .74rem; white-space: nowrap;
}
body:has(.megaphone) { padding-top: 28px; }
.mega-track { overflow: hidden; flex: 1; }
.mega-inner { display: inline-flex; gap: 40px; white-space: nowrap; padding: 4px 0; font-size: .8rem; animation: scroll 60s linear infinite; }
.mega-inner span { color: #fff; font-weight: 700; text-shadow: 1px 1px 0 #6b2a78; }
.mega-inner b { color: #fff59d; }
.mega-dup { display: contents; }
.megaphone:hover .mega-inner { animation-play-state: paused; }
@keyframes scroll { from { transform: translateX(0); } to { transform: translateX(-50%); } }

/* ---------- Layout ---------- */
.layout {
  position: relative; z-index: 1;
  display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: 20px;
  padding: 4px 28px 40px; max-width: 1500px; margin: 0 auto;
}
.stats { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
.side { display: flex; flex-direction: column; gap: 20px; min-width: 0; }

/* ---------- Pinned panels ----------
   Free Market Prices and Item Info each fill the viewport under the fixed 28px megaphone.
   The Activity/Sales panel scrolls off first, then both stay pinned side by side. */
@media (min-width: 1101px) {
  .layout { --pin-top: 40px; --pin-h: max(520px, calc(100vh - var(--pin-top) - 16px)); }
  .layout > .market, .side > .detail {
    position: sticky; top: var(--pin-top); height: var(--pin-h); display: flex; flex-direction: column;
  }
  .layout > .market { align-self: start; }
  /* Extra room under the column so both panels stay pinned for a while before the footer pushes them up. */
  .side::after { content: ""; flex: none; height: 160px; }
  .market > .window-body { flex: 1; min-height: 0; display: flex; flex-direction: column; }
  .market .table-wrap { flex: 1; min-height: 0; overflow: auto; }
  .market .price-table thead th { position: sticky; top: 0; z-index: 2; box-shadow: 0 2px 0 #e2c592; }
  .detail > .window-body { flex: 1; min-height: 0; overflow-y: auto; display: flex; flex-direction: column; padding: 16px; }
  .detail > .window-body > * { flex: none; }
  .detail .detail-head { margin-bottom: 14px; }
  .detail .ranges { margin-bottom: 8px; }
  .detail .chart { height: 210px; }
  .detail .kv { gap: 10px; margin: 14px 0 4px; }
  .detail #detail-body > .sub-title { margin: 12px 0 6px; }
  .detail #detail-body > .feed-list { flex: 1 1 0; min-height: 110px; max-height: none; }
}

/* ---------- Activity / Sales panel ---------- */
.pulse > .window-title { gap: 10px; padding: 7px 10px 7px 8px; }
.pulse-toggle {
  position: relative; display: grid; grid-template-columns: 1fr 1fr; padding: 3px;
  background: rgba(90, 40, 0, .28); border-radius: 999px; box-shadow: inset 0 2px 3px rgba(60, 25, 0, .35);
}
.pulse-thumb {
  position: absolute; top: 3px; bottom: 3px; left: 3px; width: calc(50% - 3px); border-radius: 999px;
  background: linear-gradient(#fffaf0, #ffe7b8); box-shadow: 0 2px 0 var(--wood), 0 3px 6px rgba(60, 25, 0, .3);
  transition: transform .35s cubic-bezier(.3, 1.5, .5, 1);
}
.pulse[data-tab="activity"] .pulse-thumb { transform: translateX(100%); }
.pulse-toggle [role="tab"] {
  position: relative; z-index: 1; display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-width: 96px; padding: 5px 14px; border: 0; border-radius: 999px; background: none; cursor: var(--cursor-link);
  font-family: "Fredoka"; font-weight: 700; font-size: .92rem; color: #fff; text-shadow: 0 1px 0 var(--wood);
  transition: color .2s;
}
.pulse-toggle [role="tab"][aria-selected="true"] { color: var(--wood); text-shadow: none; }
.pulse-toggle [role="tab"]:not([aria-selected="true"]):hover { color: #ffe27a; }
.pulse-toggle svg { width: 13px; height: 13px; fill: currentColor; }
.new-count {
  display: inline-grid; place-items: center; min-width: 17px; height: 17px; padding: 0 4px; margin-left: -1px;
  font-family: "Nunito"; font-size: .66rem; font-weight: 800; color: #fff; text-shadow: none;
  background: #e0342b; border: 2px solid #fff; border-radius: 999px; box-shadow: 0 1px 0 var(--wood);
}
.new-count[hidden] { display: none; }
.new-count.bump { animation: bump .45s cubic-bezier(.3, 1.8, .5, 1); }
@keyframes bump { 0% { transform: scale(.4); } 60% { transform: scale(1.3); } 100% { transform: scale(1); } }
.pulse-panel { position: relative; }
.pulse-panel.enter { animation: rise .3s ease-out both; }
#sales-panel { padding-top: 6px; padding-bottom: 8px; }
#sales-panel[hidden] { display: none; }
#sales-panel .feed-list { max-height: none; }
#sales-panel li:last-child .sale { border-bottom: 0; }
#pulse[hidden] { display: none; }
.pulse-close {
  display: grid; place-items: center; width: 26px; height: 26px; margin-left: auto; padding: 0 0 2px;
  font: 800 1.1rem/1 "Nunito"; color: #fff; text-shadow: 0 1px 0 var(--wood); cursor: var(--cursor-link);
  background: rgba(90, 40, 0, .28); border: 0; border-radius: 50%; transition: background .15s, transform .15s;
}
.pulse-close:hover { background: #e0342b; transform: rotate(90deg); }
/* Push-down: the new row grows from zero height while the oldest collapses, so the list height stays steady. */
#feed > li { display: grid; grid-template-rows: 1fr; }
#feed > li > .sale { min-height: 0; overflow: hidden; }
#feed > li.entering, #feed > li.leaving { overflow: hidden; }
#feed > li.entering { animation: feed-grow .45s cubic-bezier(.2, .8, .3, 1); }
#feed > li.entering > .sale { animation: flash 1.6s ease-out, slide-in .45s ease-out; }
#feed > li.leaving { animation: feed-shrink .45s cubic-bezier(.4, 0, .2, 1) forwards; pointer-events: none; }
@keyframes feed-grow { from { grid-template-rows: 0fr; } }
@keyframes feed-shrink { to { grid-template-rows: 0fr; opacity: 0; } }
.act-foot-right { display: inline-flex; align-items: center; gap: 10px; margin-left: auto; }
.act-note { flex-basis: 100%; }


/* ---------- MapleStory window ---------- */
.window {
  background: var(--cream); border: 3px solid var(--wood); border-radius: var(--radius);
  box-shadow: 0 5px 0 var(--wood-dark), 0 12px 24px rgba(40, 20, 0, .18);
  overflow: hidden; min-width: 0;
}
.window-title {
  display: flex; justify-content: space-between; align-items: center;
  padding: 8px 14px; font-weight: 700; font-size: 1.05rem; color: #fff;
  background: linear-gradient(#ffb44d, #e8741c 60%, #d7650f);
  border-bottom: 3px solid var(--wood);
  text-shadow: 0 2px 0 var(--wood);
}
.window-title small { font-family: "Nunito"; font-weight: 700; font-size: .75rem; opacity: .95; }
.window-body { padding: 14px; }

/* ---------- Stat cards ---------- */
.stat {
  display: flex; align-items: center; gap: 12px; padding: 14px 16px;
  background: linear-gradient(var(--cream), var(--cream-2));
}
.stat-icon {
  flex: none; width: 46px; height: 46px; border-radius: 12px; display: grid; place-items: center;
  background: #fff; border: 2px solid var(--wood); font-size: 1.4rem;
}
.stat-icon img { width: 32px; height: 32px; image-rendering: pixelated; }
.stat-label { font-size: .75rem; font-weight: 800; color: var(--muted); text-transform: uppercase; letter-spacing: .5px; }
.stat-value { font-size: 1.35rem; font-weight: 700; line-height: 1.2; }
.stat-sub { font-size: .8rem; font-weight: 700; }

/* ---------- Tabs ---------- */
.tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 12px; }
.tab {
  cursor: var(--cursor-link); border: 2px solid var(--wood); border-radius: 10px 10px 4px 4px;
  background: #f3dcae; color: var(--wood); font-weight: 600; font-size: .95rem; padding: 6px 14px;
  box-shadow: 0 2px 0 var(--wood-dark); transition: transform .08s;
}
.tab:hover { transform: translateY(-1px); background: #ffe7b8; }
.tab.active { background: linear-gradient(#ffb44d, #e8741c); color: #fff; text-shadow: 0 1px 0 var(--wood); }
.tab .count { font-family: "Nunito"; font-size: .75rem; opacity: .8; margin-left: 4px; }

/* ---------- Price table ---------- */
.table-wrap { overflow-x: auto; border: 2px solid #e2c592; border-radius: 10px; background: #fff; }
.price-table { width: 100%; border-collapse: collapse; font-size: .92rem; }
.price-table th {
  text-align: left; font-size: .75rem; text-transform: uppercase; letter-spacing: .5px; color: var(--muted);
  padding: 10px; background: #fbefd4; border-bottom: 2px solid #e2c592; white-space: nowrap; user-select: none;
}
.price-table th[data-sort] { cursor: var(--cursor-link); }
.price-table th[data-sort]:hover { color: var(--wood); }
.price-table th.sorted > button::after { content: "\00a0▼"; font-size: .65rem; }
.price-table th.sorted.asc > button::after { content: "\00a0▲"; }
.price-table td { padding: 8px 10px; border-bottom: 1px dashed #f0dcb6; vertical-align: middle; }
.price-table tbody tr { cursor: var(--cursor-link); transition: background .1s; }
.price-table tbody tr:hover { background: #fff4dc; }
.price-table tbody tr.selected { background: #ffe8b8; box-shadow: inset 4px 0 0 var(--orange); }
.num { text-align: right !important; white-space: nowrap; font-variant-numeric: tabular-nums; }
.num.center { text-align: center !important; }
.star-col { width: 34px; }
.spark-col { width: 120px; }

.item-cell { display: flex; align-items: center; gap: 10px; min-width: 220px; }
.item-icon {
  flex: none; width: 40px; height: 40px; display: grid; place-items: center;
  background: radial-gradient(#fff, #f3e6cc); border: 2px solid #d9b57a; border-radius: 8px;
}
.item-icon img { max-width: 32px; max-height: 32px; image-rendering: pixelated; }
.item-name { font-weight: 800; line-height: 1.2; }
.item-cat { font-size: .72rem; font-weight: 800; color: var(--muted); }

.star {
  border: 0; background: none; cursor: var(--cursor-link); font-size: 1.1rem; color: #d8c4a0; padding: 2px; line-height: 1;
}
.star.on { color: var(--gold); text-shadow: 0 1px 0 var(--wood); }
.star:hover { transform: scale(1.2); }

.meso { display: inline-flex; align-items: center; gap: 5px; font-weight: 800; }
.coin {
  width: 13px; height: 13px; border-radius: 50%; flex: none;
  background: radial-gradient(circle at 35% 30%, #fff3a8, var(--gold) 45%, #c68a00);
  border: 1px solid #8a5b00; box-shadow: inset 0 -1px 0 rgba(0,0,0,.2);
}
.chg { font-weight: 800; }
.chg.up { color: var(--up); }
.chg.down { color: var(--down); }
.chg.flat { color: var(--muted); }
.range { color: var(--muted); font-weight: 700; font-size: .82rem; }
.empty { text-align: center; color: var(--muted); font-weight: 800; padding: 30px; margin: 0; }
.empty p { margin: 0; }
.empty b { color: var(--gold); -webkit-text-stroke: .5px var(--wood); }
.empty-snail { display: block; margin: 0 auto 10px; image-rendering: pixelated; animation: snail 6s linear infinite alternate; }
@keyframes snail { from { transform: translateX(-60px); } to { transform: translateX(60px); } }

/* ---------- Detail ---------- */
.detail-head { display: flex; gap: 12px; align-items: center; margin-bottom: 12px; }
.detail-head .item-icon { width: 60px; height: 60px; }
.detail-head .item-icon img { max-width: 44px; max-height: 44px; }
.detail-head h2 { margin: 0; font-size: 1.1rem; line-height: 1.2; }
.detail-desc { margin: 2px 0 0; font-size: .8rem; color: var(--muted); font-weight: 700; }
.detail-price { display: flex; align-items: baseline; gap: 10px; margin-bottom: 10px; }
.detail-price .meso { font-size: 1.5rem; font-family: "Fredoka"; }
.detail-price .coin { width: 18px; height: 18px; }

.ranges { display: flex; gap: 4px; margin-bottom: 6px; }
.range-btn {
  cursor: var(--cursor-link); font: inherit; font-weight: 800; font-size: .75rem; color: var(--wood);
  background: #f3dcae; border: 2px solid var(--wood); border-radius: 8px; padding: 2px 10px;
}
.range-btn.active { background: #b9560a; color: #fff; }
.range-btn:not(.active):hover { background: #ffe7b8; }

.chart { width: 100%; height: 190px; display: block; background: #fff; border: 2px solid #e2c592; border-radius: 10px; }
.chart .grid line { stroke: #f1e2c4; }
.chart .axis text { fill: var(--muted); font-size: 10px; font-weight: 700; font-family: Nunito; }
.chart .vol rect { fill: #f7d49a; }
.chart .line { fill: none; stroke: var(--orange); stroke-width: 2.5; stroke-linejoin: round; }
.chart .line.draw { stroke-dasharray: 1; stroke-dashoffset: 1; animation: draw .7s ease-out forwards; }
@keyframes draw { to { stroke-dashoffset: 0; } }
.chart .band { fill: rgba(245, 138, 31, .12); }
.chart .cross { stroke: var(--wood); stroke-dasharray: 3 3; }
.chart .dot { fill: #fff; stroke: var(--wood); stroke-width: 2; }

.kv { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 12px 0; }
.kv div { background: #fbefd4; border: 2px solid #e8cf9e; border-radius: 8px; padding: 6px 8px; }
.kv > div > span { display: block; font-size: .68rem; font-weight: 800; color: var(--muted); text-transform: uppercase; }
.kv b { font-size: .95rem; }

.sub-title { margin: 12px 0 6px; font-size: .9rem; color: var(--wood); }

/* ---------- Feed ---------- */

.feed-list { list-style: none; margin: 0; padding: 0; max-height: 420px; overflow-y: auto; }
.feed-list.compact { max-height: 220px; -webkit-mask-image: linear-gradient(#000 82%, transparent); mask-image: linear-gradient(#000 82%, transparent); }
.sale {
  display: flex; gap: 10px; align-items: center; padding: 8px 4px; border-bottom: 1px dashed #f0dcb6; cursor: var(--cursor-link);
}
.sale:hover { background: #fff4dc; }
.sale.new { animation: flash 1.4s ease-out, slide-in .35s ease-out; }
@keyframes slide-in { from { transform: translateY(-8px); opacity: 0; } }
@keyframes flash { from { background: #fff1a8; } to { background: transparent; } }
.sale .item-icon { width: 34px; height: 34px; }
.sale .item-icon img { max-width: 26px; max-height: 26px; }
.sale-main { flex: 1; min-width: 0; }
.sale-name { font-weight: 800; font-size: .85rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sale-meta { display: flex; font-size: .72rem; color: var(--muted); font-weight: 700; white-space: nowrap; min-width: 0; }
.sale-who { overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.sale-when { flex: none; }
.sale-price { text-align: right; font-size: .85rem; }
.sale-price small { display: block; color: var(--muted); font-weight: 700; font-size: .7rem; }

/* ---------- Table toolbar ---------- */
.toolbar { display: flex; align-items: center; gap: 10px 12px; margin-bottom: 12px; flex-wrap: wrap; }
.toolbar .tabs { flex: none; flex-wrap: nowrap; gap: 4px; margin: 0; }
.toolbar .search { flex: 1 1 180px; min-width: 0; box-shadow: 0 2px 0 var(--wood-dark); padding: 5px 12px; }

.icon-tab {
  position: relative; width: 40px; height: 38px; padding: 0; display: grid; place-items: center;
  color: #fff; border-radius: 9px;
  background: linear-gradient(#c98a4c, #9a5620); border: 2px solid var(--wood-dark);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .3), 0 2px 0 var(--wood-dark);
}
.icon-tab svg { filter: drop-shadow(0 1px 0 rgba(58, 26, 4, .7)); }
.tab-sprite {
  max-width: 26px; max-height: 26px; image-rendering: pixelated;
  filter: url(#whiteout) drop-shadow(0 1px 0 rgba(58, 26, 4, .8)) drop-shadow(0 0 1px rgba(58, 26, 4, .6));
}
.text-tab { width: auto; padding: 0 16px 0 12px; }
.tab-text {
  font-family: "Fredoka"; font-weight: 700; font-size: .95rem; letter-spacing: .5px; color: #fff;
  text-shadow: 0 1px 0 rgba(58, 26, 4, .8);
}
.icon-tab:hover { background: linear-gradient(#dba061, #ad6428); transform: translateY(-1px); }
.icon-tab.active {
  background: linear-gradient(#ffc766, #f08a22 60%, #e0701a); border-color: var(--wood);
  box-shadow: inset 0 0 0 2px rgba(255, 245, 190, .55), 0 2px 0 var(--wood-dark), 0 0 0 3px rgba(255, 210, 90, .45);
}
.icon-tab .count {
  position: absolute; right: 2px; bottom: 0; margin: 0; opacity: 1;
  font-family: "Nunito"; font-size: .62rem; font-weight: 800; line-height: 1; color: #fff;
  text-shadow: -1px -1px 0 var(--wood-dark), 1px -1px 0 var(--wood-dark), -1px 1px 0 var(--wood-dark), 1px 1px 0 var(--wood-dark);
}
.toolbar .search input { width: 100%; }
.toolbar-right { display: flex; align-items: center; gap: 8px; }
.visually-hidden {
  position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* ---------- Class picker ---------- */
.class-picker { position: relative; }
/* Let the class menu overflow the market window when the table is short. */
.window:has(.class-picker) { overflow: visible; }
.window:has(.class-picker) > .window-title { border-radius: calc(var(--radius) - 3px) calc(var(--radius) - 3px) 0 0; }
.class-button {
  display: flex; align-items: center; gap: 8px; min-width: 158px; height: 38px; padding: 0 10px 0 4px;
  font: inherit; font-weight: 800; color: var(--ink); cursor: var(--cursor-link); text-align: left;
  background: linear-gradient(#fffdf5, #f6e6c4); border: 2px solid var(--wood); border-radius: 999px;
  box-shadow: inset 0 1px 0 #fff, 0 2px 0 var(--wood-dark);
}
.class-button:hover { background: linear-gradient(#fff, #fbeccd); }
.class-button[aria-expanded="true"] { box-shadow: inset 0 1px 0 #fff, 0 2px 0 var(--wood-dark), 0 0 0 3px rgba(255, 180, 77, .5); }
.class-button.filtered { background: linear-gradient(#ffc766, #f08a22 60%, #e0701a); color: #fff; text-shadow: 0 1px 0 rgba(58, 26, 4, .7); }
.class-button-text { flex: 1; white-space: nowrap; }
.chevron {
  width: 8px; height: 8px; margin: -3px 2px 0 4px;
  border-right: 3px solid currentColor; border-bottom: 3px solid currentColor; border-radius: 1px;
  transform: rotate(45deg); transition: transform .15s;
}
.class-button[aria-expanded="true"] .chevron { transform: rotate(225deg); margin-top: 4px; }

.class-emblem {
  flex: none; display: grid; place-items: center; width: 28px; height: 28px; border-radius: 50%;
  border: 2px solid rgba(58, 26, 4, .55); box-shadow: inset 0 2px 0 rgba(255, 255, 255, .45);
  background: radial-gradient(circle at 35% 30%, #fff6d8, #f6c33b 70%);
}
.class-emblem img { max-width: 22px; max-height: 22px; image-rendering: pixelated; filter: drop-shadow(0 1px 0 rgba(0, 0, 0, .35)); }
.cls-warrior { background: radial-gradient(circle at 35% 30%, #ffd2c4, #e2553f 70%); }
.cls-magician { background: radial-gradient(circle at 35% 30%, #d6e8ff, #4f86e8 70%); }
.cls-bowman { background: radial-gradient(circle at 35% 30%, #dcf7c9, #4fae3c 70%); }
.cls-thief { background: radial-gradient(circle at 35% 30%, #ecd6ff, #9458d6 70%); }

.class-menu {
  position: absolute; z-index: 20; top: calc(100% + 8px); right: 0; width: 330px; margin: 0; padding: 32px 6px 6px;
  list-style: none; outline: none;
  background: var(--cream); border: 3px solid var(--wood); border-radius: 12px;
  box-shadow: 0 4px 0 var(--wood-dark), 0 14px 30px rgba(58, 26, 4, .35);
  animation: class-menu-in .12s ease-out;
}
.class-menu[hidden] { display: none; }
.class-menu::before {
  content: "Choose a job"; position: absolute; inset: 0 0 auto; height: 26px; padding: 0 12px;
  display: flex; align-items: center; border-radius: 8px 8px 0 0;
  font-family: "Fredoka"; font-size: .78rem; font-weight: 700; letter-spacing: .6px; text-transform: uppercase; color: #fff;
  background: linear-gradient(#ffb44d, #e0701a); text-shadow: 0 1px 0 rgba(58, 26, 4, .7);
}
.class-menu [role="option"] {
  display: flex; align-items: center; gap: 10px; padding: 7px 8px; border-radius: 8px; cursor: var(--cursor-link);
  border: 2px solid transparent;
}
.class-menu [role="option"].active { background: #ffe6b8; border-color: #f0b25a; }
.class-menu [role="option"][aria-selected="true"] b { color: var(--orange); }
.class-menu [role="option"] + [role="option"] { margin-top: 2px; }
.class-menu [data-class="All"] { margin-bottom: 6px; position: relative; }
.class-menu [data-class="All"]::after {
  content: ""; position: absolute; left: 8px; right: 8px; bottom: -6px; border-bottom: 2px dashed rgba(122, 59, 12, .25);
}
.class-opt-text { flex: 1; display: grid; line-height: 1.15; }
.class-opt-text b { font-size: .9rem; color: var(--ink); }
.class-opt-text small { font-size: .7rem; font-weight: 700; color: var(--muted); }
.class-opt-count {
  min-width: 26px; padding: 2px 7px; border-radius: 999px; text-align: center;
  font-size: .72rem; font-weight: 800; color: #fff; background: var(--wood);
}
.class-check { width: 12px; font-weight: 900; color: var(--orange); }
@keyframes class-menu-in { from { opacity: 0; transform: translateY(-4px); } }
@media (max-width: 640px) { .class-menu { right: auto; left: 0; width: min(330px, calc(100vw - 32px)); } }
.used-by { margin: -4px 0 10px; font-size: .78rem; font-weight: 700; color: var(--muted); }
.used-by b { color: var(--wood); }

/* ---------- Header buttons, badges, dialog ---------- */
.beta-badge {
  font-size: .68rem; text-transform: uppercase; letter-spacing: .5px; color: #fff;
  background: var(--wood); border-radius: 999px; padding: 2px 8px; margin-right: 6px; vertical-align: middle;
}
.ms-button, .help-button {
  font: inherit; font-weight: 800; color: #fff; cursor: var(--cursor-link); text-shadow: 0 1px 0 var(--wood);
  background: linear-gradient(#ffb44d, #e0701a); border: 3px solid var(--wood); border-radius: 999px;
  padding: 7px 14px; box-shadow: 0 3px 0 var(--wood-dark);
}
.ms-button:hover, .help-button:hover { filter: brightness(1.06); }
.ms-button.active { background: linear-gradient(#ffe27a, #f6b21c); color: var(--wood-dark); text-shadow: none; }
#watch-count { display: inline-block; min-width: 20px; margin-left: 4px; padding: 0 6px; border-radius: 999px; background: var(--wood); color: #fff; font-size: .75rem; text-shadow: none; }
.help-button { width: 38px; height: 38px; padding: 0; display: grid; place-items: center; }
.world-pill {
  display: inline-flex; align-items: center; gap: 6px; font-weight: 800; color: var(--wood);
  background: var(--cream); border: 3px solid var(--wood); border-radius: 999px;
  padding: 6px 14px; box-shadow: 0 3px 0 var(--wood-dark);
}
.world-pill::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: #3fbf52; box-shadow: 0 0 0 2px rgba(46, 155, 62, .25); animation: online 2.4s ease-in-out infinite; }
@keyframes online { 50% { box-shadow: 0 0 0 5px rgba(46, 155, 62, 0); } }

/* ---------- NPC price ---------- */
.detail-meta { display: flex; flex-wrap: wrap; gap: 4px 12px; margin: -4px 0 10px; font-size: .78rem; font-weight: 700; color: var(--muted); }
.detail-meta b { color: var(--wood); }
.detail-meta .used-by { margin: 0; }
.detail-meta .warn { color: var(--down); }
.detail-meta .meso .coin { width: 12px; height: 12px; }
.chart .npc-line { stroke: var(--wood); stroke-width: 1; stroke-dasharray: 3 4; opacity: .45; }
.chart .npc-label { font-size: 9px; font-weight: 800; fill: var(--wood); opacity: .6; }
button:focus-visible, input:focus-visible, select:focus-visible, .sale:focus-visible { outline: 3px solid #6b2a78; outline-offset: 2px; }
kbd {
  font-family: inherit; font-size: .72rem; font-weight: 800; color: var(--wood);
  padding: 0 6px; border: 2px solid #e2c592; border-bottom-width: 3px; border-radius: 5px; background: #fff;
}

.window-title h2 { margin: 0; font-size: 1.05rem; font-weight: 700; }
.title-right { display: flex; align-items: center; gap: 10px; }
.data-badge {
  font-family: "Nunito"; font-size: .65rem; font-weight: 800; letter-spacing: .5px; text-shadow: none;
  color: var(--wood-dark); background: #fff1a8; border: 2px solid var(--wood); border-radius: 6px; padding: 1px 6px;
}

.price-table th button {
  font: inherit; color: inherit; text-transform: inherit; letter-spacing: inherit;
  background: none; border: 0; padding: 0; cursor: var(--cursor-link);
}
.item-select { display: block; font: inherit; font-weight: 800; color: inherit; text-align: left; background: none; border: 0; padding: 0; cursor: var(--cursor-link); }
.table-footer { display: flex; justify-content: space-between; gap: 10px; margin-top: 10px; font-size: .8rem; font-weight: 700; color: var(--muted); }
.table-footer > span:last-child { display: inline-flex; align-items: center; gap: 6px; }

dialog.window { max-width: 460px; width: calc(100% - 32px); padding: 0; color: var(--ink); }
dialog::backdrop { background: rgba(40, 20, 0, .45); }
dialog .help-button { width: 30px; height: 30px; border-width: 2px; }
dialog p { margin: 0 0 10px; line-height: 1.6; font-weight: 600; }
.grass strong { font-family: "Fredoka"; font-size: 1rem; color: #fff; }

/* ---------- Market Activity (experimental) ---------- */
.activity {
  --lv0: #f3e6c8; --lv1: #ffd9a0; --lv2: #ffb44d; --lv3: #ee8420; --lv4: #b8540a;
}
.exp-badge { background: #e9ddff; }
.act-ranges { display: flex; gap: 4px; }
.act-tiles { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; margin-bottom: 12px; }
.act-tile { background: #fbefd4; border: 2px solid #e8cf9e; border-radius: 8px; padding: 5px 8px; min-width: 0; }
.act-tile > span { display: block; font-size: .62rem; font-weight: 800; color: var(--muted); text-transform: uppercase; letter-spacing: .4px; }
.act-tile b { display: block; font-size: .88rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.heatmap {
  display: grid; grid-template-columns: 26px repeat(24, minmax(0, 1fr)); gap: 2px; align-items: center;
}
.hm-hour { font-size: .56rem; font-weight: 800; color: var(--muted); white-space: nowrap; }
.hm-day { font-size: .62rem; font-weight: 800; color: var(--muted); }
.hm-cell { display: block; aspect-ratio: 1; max-height: 28px; border-radius: 3px; background: var(--lv0); transition: transform .08s; }
.hm-cell:hover { transform: scale(1.3); position: relative; box-shadow: 0 0 0 2px var(--wood); }
.hm-cell.lv1 { background: var(--lv1); }
.hm-cell.lv2 { background: var(--lv2); }
.hm-cell.lv3 { background: var(--lv3); }
.hm-cell.lv4 { background: var(--lv4); }
.hm-cell.lvx { background: repeating-linear-gradient(45deg, #f6ecd6 0 3px, #efe0bf 3px 6px); }
.hm-cell.now { box-shadow: 0 0 0 2px var(--wood-dark); animation: hm-pulse 2s ease-in-out infinite; }
@keyframes hm-pulse { 50% { box-shadow: 0 0 0 2px var(--wood-dark), 0 0 0 5px rgba(232, 116, 28, .25); } }
.act-foot { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 10px; font-size: .75rem; font-weight: 700; color: var(--muted); }
.legend { display: inline-flex; align-items: center; gap: 3px; }
.legend i { width: 12px; height: 12px; border-radius: 3px; background: var(--lv0); }
.legend .lv1 { background: var(--lv1); } .legend .lv2 { background: var(--lv2); } .legend .lv3 { background: var(--lv3); } .legend .lv4 { background: var(--lv4); }
@media (max-width: 640px) {
  .act-tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (prefers-reduced-motion: reduce) { .hm-cell.now { animation: none; } }

/* ---------- Tooltip ---------- */
.tooltip {
  position: fixed; z-index: 50; pointer-events: none;
  background: rgba(30, 20, 50, .92); color: #fff; border: 2px solid #b9a4ff; border-radius: 8px;
  padding: 6px 10px; font-size: .78rem; font-weight: 700; box-shadow: 0 4px 12px rgba(0,0,0,.3);
}
.tooltip b { color: #ffe27a; }

/* ---------- Footer ---------- */
.grass {
  position: relative; z-index: 1; margin-top: 10px; padding: 30px 20px 18px; text-align: center;
  background:
    radial-gradient(circle at 10px -4px, transparent 12px, #5fbf3a 13px) 0 0 / 20px 20px repeat-x,
    linear-gradient(#5fbf3a 20px, #8b5a2b 20px, #6b4220);
  color: #fde7c0; font-weight: 700; font-size: .8rem;
}
.grass p { margin: 18px 0 0; }

/* ---------- Delight ---------- */
.star.pop { animation: star-pop .45s cubic-bezier(.3, 1.6, .5, 1); }
@keyframes star-pop { 0% { transform: scale(.6) rotate(-20deg); } 60% { transform: scale(1.45) rotate(8deg); } 100% { transform: scale(1); } }
td.tick-up .meso, td.tick-down .meso { border-radius: 6px; animation: tick-up 1.6s ease-out; }
td.tick-down .meso { animation-name: tick-down; }
@keyframes tick-up { from { background: rgba(35, 128, 58, .22); box-shadow: 0 0 0 4px rgba(35, 128, 58, .22); } }
@keyframes tick-down { from { background: rgba(194, 48, 42, .2); box-shadow: 0 0 0 4px rgba(194, 48, 42, .2); } }
#detail-body.enter > * { animation: rise .35s ease-out both; }
#detail-body.enter > :nth-child(2) { animation-delay: .03s; }
#detail-body.enter > :nth-child(n+3) { animation-delay: .06s; }
@keyframes rise { from { opacity: 0; transform: translateY(6px); } }
.heatmap.enter .hm-cell { animation: pop-in .3s ease-out both; animation-delay: calc(var(--d) * 12ms); }
@keyframes pop-in { from { opacity: 0; transform: scale(.4); } }
.heatmap.enter .hm-cell.now { animation: pop-in .3s ease-out both, hm-pulse 2s ease-in-out .6s infinite; animation-delay: calc(var(--d) * 12ms), .6s; }
.stat { transition: transform .15s; }
.stat:hover { transform: translateY(-2px); }
.stat:hover .stat-icon img { animation: bob .6s ease-in-out; }
@keyframes bob { 50% { transform: translateY(-4px); } }
.price-table tbody tr:hover .item-icon img { animation: bob .6s ease-in-out; }

.toasts { position: fixed; z-index: 40; right: 16px; bottom: 16px; display: grid; gap: 8px; width: min(340px, calc(100vw - 32px)); pointer-events: none; }
.toast {
  display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px;
  font-size: .82rem; font-weight: 700; line-height: 1.35; color: #fff;
  background: linear-gradient(135deg, rgba(58, 30, 90, .96), rgba(40, 22, 64, .96)); border: 2px solid #b9a4ff; border-radius: 10px;
  box-shadow: 0 4px 0 #1e1030, 0 10px 24px rgba(0, 0, 0, .3);
  animation: toast 5.4s ease-in-out forwards;
}
.toast b { color: #ffe27a; }
.toast-glyph { font-size: 1.1rem; line-height: 1.1; }
@keyframes toast {
  0% { opacity: 0; transform: translateY(12px) scale(.96); }
  6%, 92% { opacity: 1; transform: none; }
  100% { opacity: 0; transform: translateY(6px); }
}

@media (prefers-reduced-motion: reduce) {
  .cloud, .empty-snail, .world-pill::before { animation: none; }
  .mega-inner { animation-duration: 180s; }
  .toast { animation: toast-fade 5.4s linear forwards; }
  @keyframes toast-fade { 0%, 92% { opacity: 1; } 100% { opacity: 0; } }
  .stat:hover, .icon-tab:hover { transform: none; }
  .stat:hover .stat-icon img, .price-table tbody tr:hover .item-icon img { animation: none; }
  td.tick-up .meso, td.tick-down .meso, .sale.new { animation-duration: .01s; }
}

/* ---------- Responsive ---------- */
@media (max-width: 360px) { .top-actions { flex-wrap: wrap; } }
@media (max-width: 1100px) {
  .layout { grid-template-columns: 1fr; }
  .stats { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 640px) {
  .topbar, .layout { padding-left: 14px; padding-right: 14px; }
  .mega-label { padding: 0 8px; }
  .toolbar .tabs { width: 100%; justify-content: space-between; }
  .toolbar .search { flex-basis: 100%; }
  .toolbar-right { flex-wrap: wrap; }
  .topbar { padding-top: 12px; padding-bottom: 12px; gap: 10px; }
  .brand { flex-direction: column; align-items: flex-start; gap: 2px; }
  .top-actions { width: 100%; flex-wrap: nowrap; }
  .top-actions .world-pill { margin-right: auto; }
  .world-pill, .ms-button { padding: 5px 12px; font-size: .9rem; white-space: nowrap; }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .stat { padding: 10px; gap: 8px; }
  .stat-icon { width: 34px; height: 34px; border-radius: 9px; }
  .stat-icon img { width: 24px; height: 24px; }
  .stat-value { font-size: 1.05rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .stat-label { font-size: .62rem; }
  .stat-sub { font-size: .72rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .toolbar .tabs { overflow-x: auto; scrollbar-width: none; padding-bottom: 3px; }
  .icon-tab { flex: none; }
  .hide-sm, .spark-col { display: none; }
  .item-cell { min-width: 0; gap: 8px; }
  .price-table td, .price-table th { padding-left: 6px; padding-right: 6px; }
  .price-table .item-icon { width: 34px; height: 34px; }
  .star-col { width: 26px; }
  .price-table td.spark-cell, .price-table td.hide-sm { display: none; }
}

/* Real data (console.publish market file) */
.low-data { display:inline-block; margin-left:4px; padding:0 6px; border-radius:8px; font-size:10px; font-weight:700; letter-spacing:.02em;
  background:#fff1c9; color:#8a5a00; border:1px solid #e7c26a; vertical-align:1px; text-transform:uppercase; }
.craft-check { display:inline-block; margin-left:5px; padding:0 5px; border-radius:8px; font-size:10px; font-weight:700;
  background:#e3f3e6; color:#2e8049; border:1px solid #9fd4ab; vertical-align:1px; cursor:help; }
.price-note { font-size:13px; color:var(--muted); font-weight:600; }
.spark-none { font-size:11px; color:var(--muted); }
.data-badge.real { background:#2e8049; color:#fff; }

/* Sales / Activity widget: tabled for now (Grant, 2026-09-30). Remove these two rules to bring it back. */
#pulse, #pulse-restore-row { display: none !important; }
.chart .day-dots circle { fill: var(--orange, #e8872e); stroke: #fff; stroke-width: 1.5; }

/* Columns menu + optional columns (real data) */
.cols-picker { position: relative; }
.cols-button { font: inherit; font-weight: 700; padding: 7px 12px; border-radius: 999px; border: 2px solid var(--wood-dark, #8a5a2b);
  background: #fff8e8; color: var(--ink); cursor: pointer; }
.cols-menu { position: absolute; right: 0; top: calc(100% + 6px); z-index: 20; background: #fffaf0; border: 2px solid var(--wood-dark, #8a5a2b);
  border-radius: 12px; padding: 8px 10px; min-width: 210px; box-shadow: 0 6px 18px rgba(0,0,0,.18); display: grid; gap: 4px; }
.cols-menu[hidden] { display: none; }
.cols-menu label { display: flex; align-items: center; gap: 8px; font-weight: 600; cursor: pointer; }
.cols-menu label.soon { color: var(--muted); cursor: default; }
.cols-menu label small { font-weight: 500; }
.cols-reset { margin-top: 4px; font: inherit; font-size: 12px; background: none; border: none; color: var(--muted); cursor: pointer; text-align: left; padding: 0; }
/* Real-data table: a fixed layout so the free width is shared evenly by the data columns instead of piling up
   after the item name. */
@media (min-width: 761px) {
  .price-table.real { table-layout: fixed; }
  .price-table.real th.star-col { width: 44px; }
  .price-table.real th.item-th { width: 240px; }
  .price-table.real th.spark-col { width: 132px; }  /* the 110px sparkline plus cell padding */
  /* Headers may wrap to two lines when the table is narrow; they share one bottom line and the sort arrow stays on
     the label's last word. */
  .price-table.real th { white-space: normal; line-height: 1.2; vertical-align: bottom; letter-spacing: .3px; }
  .price-table.real th.spark-col, .price-table.real td.spark-cell { text-align: center; }
  .price-table.real td.item-col .item-name { max-width: 100%; }
}
.lvl-picker .cols-button.on { background: var(--orange, #e8872e); color: #fff; border-color: #b8641c; }
.lvl-menu { min-width: 250px; gap: 8px; }
.lvl-inputs { display: flex; align-items: end; gap: 8px; }
.lvl-inputs label { display: grid; gap: 2px; font-size: 12px; color: var(--muted); font-weight: 700; cursor: default; }
.lvl-inputs input { width: 84px; font: inherit; font-size: 15px; padding: 5px 8px; border-radius: 8px; border: 2px solid #e2c592; background: #fff; color: var(--ink); }
.lvl-inputs span { padding-bottom: 7px; color: var(--muted); }
.lvl-presets { display: flex; flex-wrap: wrap; gap: 5px; }
.lvl-presets button { font: inherit; font-size: 12.5px; font-weight: 700; padding: 3px 9px; border-radius: 999px; border: 1.5px solid #e2c592; background: #fff8e8; color: var(--ink); cursor: pointer; }
.lvl-presets button.on { background: var(--orange, #e8872e); border-color: #b8641c; color: #fff; }
.lvl-note { color: var(--muted); font-size: 11.5px; line-height: 1.35; }
.per-set { margin-left: 3px; color: var(--muted); font-weight: 600; }
.ask-gap.over { color: #b4541a; } .ask-gap.under { color: #2e8049; }
.moves.fast { color: #2e8049; } .moves.slow { color: #b4541a; }
.price-table tr.low td .meso, .price-table tr.low td.num { opacity: .6; }

/* Item column: long names are cropped with an ellipsis (full name on hover) so the numbers get the room */
.price-table td.item-col .item-text { min-width: 0; }
.price-table td.item-col .item-name { display: block; max-width: 230px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-align: left; }

/* Item hover card: MapleStory's navy item tooltip */
.tooltip.item-card { background: rgba(28, 36, 74, .96); color: #fff; border: 1px solid #8b93c9; border-radius: 6px; padding: 10px 12px;
  min-width: 210px; max-width: 280px; box-shadow: 0 6px 18px rgba(0,0,0,.35); font-size: 12.5px; line-height: 1.45; }
.item-card .ic-name { font-weight: 800; font-size: 14px; color: #fff; }
.item-card .ic-sub { color: #b9c0ea; margin-bottom: 6px; text-transform: capitalize; }
.item-card .ic-block { border-top: 1px solid rgba(185, 192, 234, .35); padding-top: 5px; margin-top: 5px; }
.item-card .ic-row { display: flex; justify-content: space-between; gap: 12px; }
.item-card .ic-row span { color: #cfd4f3; }
.item-card .ic-row b { color: #fff; font-weight: 700; }
.item-card .ic-price .ic-row b { color: #ffd66b; }
.item-card .ic-npc .ic-row b { color: #9fe0ff; }
.item-card .ic-row small { color: #8f97c4; font-size: 10.5px; }
.item-card .ic-note { margin-top: 6px; color: #8f97c4; font-size: 11px; }

/* Phones: let item names wrap onto two lines so the price and sales columns fit without sideways scrolling. */
@media (max-width: 760px) {
  .price-table td.item-col .item-name { max-width: none; white-space: normal; overflow-wrap: anywhere; line-height: 1.2; }
  .price-table td.item-col .item-cell { gap: 6px; }
}

/* Items listed from the COT2 item data with no player sales yet */
.price-table tr.unsold td .item-name { color: #6d5a43; }
.price-table tr.unsold td.num .meso { opacity: .85; }
.sellback .meso { color: var(--muted); }
.sold-toggle.on { background: var(--orange, #e8872e); color: #fff; border-color: #b8641c; }
.shop-list { margin: 4px 0 10px; padding-left: 18px; font-size: .88rem; color: var(--ink); display: grid; gap: 2px; }
.no-sales-note { color: var(--muted); font-size: .85rem; margin-top: 8px; }
.item-card .ic-shops { color: #8f97c4; font-size: 11px; margin-top: 3px; line-height: 1.35; }
/* Sales count: a small centred pill, so the column reads as a count rather than a stray number */
.sales-count { display: inline-block; min-width: 2.4em; padding: 2px 9px; border-radius: 999px; background: #f6e5c3;
  color: var(--ink); font-weight: 700; font-size: .88rem; line-height: 1.5; }
.price-table tr.low .sales-count { background: #f8eedb; color: var(--muted); }

/* Table: no NPC shop, Last 3 sales */
.no-shop { color: var(--muted); font-size: .82rem; font-weight: 700; white-space: normal; }
.cell-sub { display: block; font-size: .72rem; font-weight: 700; color: var(--muted); line-height: 1.2; margin-top: 1px; white-space: nowrap; }
.cell-sub.up { color: #b4541a; } .cell-sub.down { color: #2e8049; }
.detail .kv b small { display: block; font-size: .72rem; color: var(--muted); font-weight: 700; }

/* Sales chart (real data): one dot per sale */
.chart-views { margin-left: auto; display: flex; gap: 4px; }
.chart .typ-band { fill: rgba(245, 138, 31, .10); }
.chart .typ-line { stroke: var(--orange, #e8872e); stroke-width: 1.5; stroke-dasharray: 5 4; }
.chart .typ-label { font-size: 9.5px; font-weight: 800; fill: #b8641c; font-family: Nunito; }
.chart .base-line { stroke: #e2c592; stroke-width: 1.5; }
.chart .sale-dot { fill: var(--orange, #e8872e); stroke: #fff; stroke-width: 1.5; transition: r .1s; }
.chart .sale-dots.many .sale-dot { fill-opacity: .8; stroke-width: 1; }
.chart .sale-dot.on { fill: var(--wood, #8a5a2b); stroke-width: 2; }
.chart .chart-empty { fill: var(--muted); font-size: 12px; font-weight: 700; font-family: Nunito; }

/* ---------- Item hover card v2: header, stat chips, market bar, NPC, priced recipe ---------- */
.tooltip.item-card { min-width: 270px; max-width: 320px; padding: 0; overflow: hidden; font-weight: 600; }
.item-card .ic-head { display: flex; gap: 10px; align-items: center; padding: 10px 12px 9px;
  background: linear-gradient(180deg, rgba(120, 132, 214, .35), rgba(28, 36, 74, 0)); }
.item-card .ic-icon { width: 46px; height: 46px; flex: none; display: grid; place-items: center; border-radius: 8px;
  background: radial-gradient(circle at 50% 40%, #3d4a8f, #222a59); border: 1px solid #8b93c9; }
.item-card .ic-icon img { max-width: 36px; max-height: 36px; image-rendering: pixelated; }
.item-card .ic-name { font-size: 14.5px; line-height: 1.2; }
.item-card .ic-sub { margin: 1px 0 4px; font-size: 11.5px; }
.item-card .ic-tags { display: flex; flex-wrap: wrap; gap: 4px; }
.item-card .ic-tag { font-size: 10.5px; font-weight: 800; padding: 1px 6px; border-radius: 999px; background: rgba(185, 192, 234, .18); color: #dfe3ff; }
.item-card .ic-tag.lv { background: #ffd66b; color: #3a2a00; }
.item-card .ic-sec { padding: 7px 12px; border-top: 1px solid rgba(185, 192, 234, .25); }
.item-card .ic-h { display: flex; justify-content: space-between; align-items: baseline; font-size: 10.5px; font-weight: 800;
  letter-spacing: .6px; text-transform: uppercase; color: #9aa3dc; margin-bottom: 4px; }
.item-card .ic-h span { text-transform: none; letter-spacing: 0; font-weight: 700; color: #c9cff5; }
.item-card .ic-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 2px 12px; }
.item-card .ic-stat { display: flex; justify-content: space-between; }
.item-card .ic-stat span { color: #cfd4f3; }
.item-card .ic-stat b { color: #fff; }
.item-card .ic-effect { color: #b8f5c8; }
.item-card .ic-reqs { margin-top: 4px; color: #9aa3dc; font-size: 11px; }
.item-card .ic-req { color: #ffb4a8; font-weight: 800; margin-left: 4px; }
.item-card .ic-price { font-size: 19px; font-weight: 900; color: #ffd66b; display: flex; align-items: center; gap: 5px; }
.item-card .ic-price small { font-size: 11px; color: #c9cff5; font-weight: 700; }
.item-card .ic-price .coin { width: 15px; height: 15px; }
.item-card .ic-bar { position: relative; height: 6px; margin: 6px 2px 2px; border-radius: 3px; background: rgba(185, 192, 234, .2); }
.item-card .ic-bar i { position: absolute; top: 0; bottom: 0; border-radius: 3px; background: rgba(255, 214, 107, .55); }
.item-card .ic-bar em { position: absolute; top: -3px; width: 3px; height: 12px; margin-left: -1.5px; border-radius: 2px; background: #ffd66b; }
.item-card .ic-bar-ends { display: flex; justify-content: space-between; font-size: 10px; color: #8f97c4; margin-bottom: 3px; }
.item-card .ic-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 3px 12px; margin-top: 3px; }
.item-card .ic-kv { display: flex; justify-content: space-between; gap: 6px; }
.item-card .ic-kv span { color: #aab1e0; font-size: 11.5px; }
.item-card .ic-kv b { color: #fff; }
.item-card .ic-kv.shop b { color: #9fe0ff; }
.item-card .ic-none { color: #aab1e0; font-style: italic; }
.item-card .ic-shops { margin-top: 3px; }
.item-card .ic-note { padding: 6px 12px 8px; margin: 0; border-top: 1px solid rgba(185, 192, 234, .18); font-size: 10.5px; }

/* Priced recipe (hover card and Item Info) */
.rc-list { display: grid; gap: 3px; }
.rc-row { display: grid; grid-template-columns: 22px 30px 1fr auto; align-items: center; gap: 4px; }
.rc-icon { width: 22px; height: 22px; display: grid; place-items: center; }
.rc-icon img { max-width: 22px; max-height: 22px; image-rendering: pixelated; }
.rc-icon .coin { width: 13px; height: 13px; }
.rc-n { font-weight: 800; text-align: right; }
.rc-name { line-height: 1.15; min-width: 0; }
.rc-name small { display: block; font-size: 10px; opacity: .7; font-weight: 700; }
.rc-cost { font-weight: 800; white-space: nowrap; }
.rc-fee .rc-name { opacity: .85; font-style: italic; }
.rc-total { display: flex; justify-content: space-between; margin-top: 5px; padding-top: 5px; border-top: 1px dashed rgba(185, 192, 234, .35); font-weight: 800; }
.rc-verdict { margin-top: 6px; padding: 4px 8px; border-radius: 6px; font-weight: 800; font-size: 11.5px; text-align: center; }
.rc-verdict.save { background: rgba(92, 214, 128, .2); color: #9df0b4; }
.rc-verdict.buy { background: rgba(255, 168, 92, .2); color: #ffc58f; }
.rc-verdict.even { background: rgba(185, 192, 234, .15); color: #c9cff5; }
.item-card .rc-row { color: #e4e7ff; font-size: 12px; }
.item-card .rc-cost { color: #ffd66b; }
.item-card .rc-total b { color: #ffd66b; }
/* in the Item Info panel (light theme) */
.detail-recipe { background: #fffaf0; border: 2px solid #e2c592; border-radius: 10px; padding: 8px 10px; margin-bottom: 10px; font-size: .85rem; }
.detail-recipe .rc-total { border-top-color: #e2c592; }
.detail-recipe .rc-verdict.save { background: #e3f5e7; color: #2e8049; }
.detail-recipe .rc-verdict.buy { background: #fbe9d8; color: #b4541a; }
.detail-recipe .rc-verdict.even { background: #f6ecd8; color: var(--muted); }
.sub-title small { font-size: .72rem; color: var(--muted); font-weight: 700; margin-left: 4px; text-transform: none; letter-spacing: 0; }
.no-shop .cell-sub { white-space: normal; }
.saving { display: block; width: max-content; margin: 2px 0 0 auto; padding: 0 7px; border-radius: 999px; background: #e3f5e7;
  color: #2e8049; font-size: .72rem; font-weight: 800; line-height: 1.6; }
.saving.est { background: #f1e8d6; color: var(--muted); }
.rc-verdict.est { background: rgba(185, 192, 234, .15); color: #c9cff5; font-weight: 700; }
.detail-recipe .rc-verdict.est { background: #f6ecd8; color: var(--muted); }

/* Empty-state chips (same family as the Sales pill) */
.na-chip { display: inline-block; padding: 2px 9px; border-radius: 999px; background: #f4ead6; color: #9a8466;
  font-size: .72rem; font-weight: 800; line-height: 1.5; white-space: nowrap; letter-spacing: .1px; }
.na-chip.faint { background: transparent; border: 1.5px dashed #e6d4b0; color: #b9a588; padding: 1px 8px; }
.na-chip.warn { background: #fbe9d8; color: #b4541a; }
/* Levelling cost under a recipe */
.rc-level { margin-top: 6px; font-size: 11px; line-height: 1.4; opacity: .9; }
.item-card .rc-level { color: #c9cff5; }
.item-card .rc-level b { color: #fff; }
.detail-recipe .rc-level { color: var(--muted); }
.detail-recipe .rc-level b { color: var(--ink); }
/* Craftable tag beside the category, in the same pill family as Low data */
.item-cat .craft-check { margin-left: 4px; padding: 0 7px; border-radius: 999px; font-size: .68rem; font-weight: 800; letter-spacing: .3px;
  text-transform: uppercase; border: 1.5px solid #9fd4ab; background: #eef8f0; color: #2e8049; vertical-align: 1px; }
/* Readability pass on the empty-state chips: darker ink, solid fill for all, a touch larger */
.na-chip { background: #f1e3c6; color: #6f5a3e; font-size: .76rem; padding: 3px 10px; }
.na-chip.faint { background: #f7eedd; border: 0; color: #8a7556; padding: 3px 10px; }
/* Header labels are buttons, and buttons centre their text: a two-line label ("TYPICAL / SALE") then sat centred over
   right-aligned numbers. Labels take their column's alignment instead. */
.price-table th button { text-align: inherit; }
/* One-line headers: short labels (full meaning in each header's hover title), no wrapping */
.price-table.real th { white-space: nowrap; vertical-align: middle; }
/* Narrower laptop windows (the side panel takes ~360px): seven data columns don't fit beside a 240px item column.
   Narrow the item column, tighten the cells and drop Trend (the Item Info chart still shows it). */
@media (min-width: 761px) and (max-width: 1499px) {
  .price-table.real th.item-th { width: 200px; }
  .price-table.real th.spark-col, .price-table.real td.spark-cell { display: none; }
  .price-table.real th, .price-table.real td { padding-left: 6px; padding-right: 6px; }
  .price-table.real .na-chip { padding: 3px 8px; }
}

/* Market picker in the top bar (the world pill as a dropdown) */
.world-picker { position: relative; }
.world-picker .world-pill { font: inherit; font-weight: 800; cursor: pointer; }
.world-picker .world-pill small { font-size: .7rem; font-weight: 800; color: var(--muted); letter-spacing: .4px; }
.world-picker .world-pill .caret { font-size: .7rem; margin-left: 2px; }
.world-menu { position: absolute; right: 0; top: calc(100% + 8px); z-index: 30; list-style: none; margin: 0; padding: 6px; min-width: 250px;
  background: #fffaf0; border: 3px solid var(--wood); border-radius: 14px; box-shadow: 0 6px 0 var(--wood-dark), 0 10px 24px rgba(0,0,0,.18); }
.world-menu[hidden] { display: none; }
.world-menu button, .world-menu .soon { display: grid; width: 100%; text-align: left; font: inherit; border: 0; background: none;
  padding: 7px 10px; border-radius: 10px; color: var(--ink); cursor: pointer; }
.world-menu button:hover { background: #fff1d6; }
.world-menu button.on { background: #ffe8b8; }
.world-menu button.on b::after { content: "  ✓"; color: #2e8049; }
.world-menu small { color: var(--muted); font-weight: 700; font-size: .74rem; }
.world-menu .soon { cursor: default; opacity: .6; }
.world-menu .soon b::after { content: "  · soon"; font-weight: 700; font-size: .72rem; color: var(--muted); }
