@font-face {
  font-family: "Monocraft";
  src: url("Monocraft.ttf") format("truetype");
  font-display: swap;
}

:root {
  --panel-bg: rgba(0, 0, 0, 0.314);
  --panel-outline: rgba(255, 255, 255, 0.314);
  --focus: #aaffff;
  --yellow: #ffff00;
  --white: #ffffff;
  --grey: #a0a0a0;
  --placeholder: #656565;
  --summary-bg: rgba(0, 0, 0, 0.133);
  --summary-outline: rgba(255, 255, 255, 0.2);
  --widget: #6f6f6f;
  --widget-dark: #4c4c4c;
  --tt-bg: rgba(16, 0, 16, 0.94);
  --tt-border-a: #5000ff;
  --tt-border-b: #28007f;
  --shadow: 2px 2px 0 rgba(0, 0, 0, 0.75);
  --menubar-h: 30px;
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  overflow: hidden;
  font-family: "Monocraft", ui-monospace, Consolas, monospace;
  font-size: 16px;
  line-height: 1.35;
  color: var(--white);
  text-shadow: var(--shadow);
  background: #06030c;
}

#portal {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  z-index: -1;
  image-rendering: pixelated;
}

[hidden] { display: none !important; }

img, canvas.sprite { image-rendering: pixelated; }

/* ── Menu bar ─────────────────────────────────────────── */

.menubar {
  position: relative;
  z-index: 5;
  height: var(--menubar-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 10px 0 4px;
  background: rgba(0, 0, 0, 0.62);
  border-bottom: 2px solid #000;
}

.menus { display: flex; }

.menuitem {
  font: inherit;
  color: var(--white);
  text-shadow: var(--shadow);
  background: none;
  border: 0;
  padding: 4px 12px;
  cursor: pointer;
}

.menuitem:hover, .menuitem:focus-visible, .menuitem.open {
  background: rgba(255, 255, 255, 0.18);
  color: var(--yellow);
  outline: none;
}

.namepill {
  background: #ff8000;
  color: #402000;
  text-shadow: none;
  font-size: 13px;
  padding: 2px 14px;
  border-radius: 8px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.dropmenu {
  position: fixed;
  z-index: 30;
  top: var(--menubar-h);
  display: flex;
  flex-direction: column;
  min-width: 220px;
  background: rgba(12, 12, 12, 0.96);
  border: 2px solid var(--panel-outline);
  padding: 4px;
}

.dropentry {
  font: inherit;
  font-size: 15px;
  text-align: left;
  color: var(--white);
  text-shadow: var(--shadow);
  text-decoration: none;
  background: none;
  border: 0;
  padding: 6px 10px;
  cursor: pointer;
}

.dropentry:hover, .dropentry:focus-visible {
  background: rgba(255, 255, 255, 0.16);
  color: var(--yellow);
  outline: none;
}

/* ── Screen layout ────────────────────────────────────── */

.screen {
  display: grid;
  grid-template-columns: minmax(240px, 300px) 1fr;
  gap: 10px;
  height: calc(100vh - var(--menubar-h));
  padding: 10px;
}

.panel {
  background: var(--panel-bg);
  border: 2px solid var(--panel-outline);
}

.leftcol {
  display: grid;
  grid-template-rows: 1fr;
  min-height: 0;
}

.filters {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 14px;
  overflow-y: auto;
}

.paneltitle {
  margin: 4px 0 8px;
  font-size: 16px;
  font-weight: 400;
  text-align: center;
  letter-spacing: 0.02em;
}

.mcselect, .mcsearch {
  font: inherit;
  font-size: 15px;
  color: var(--white);
  text-shadow: var(--shadow);
  width: 100%;
  padding: 7px 9px;
  border: 2px solid #000;
}

.mcselect {
  background: var(--widget);
  box-shadow: inset 1px 1px 0 rgba(255, 255, 255, 0.35), inset -1px -1px 0 rgba(0, 0, 0, 0.4);
  cursor: pointer;
}

.mcselect:focus-visible, .mcsearch:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: -2px;
}

option { background: #2b2b2b; }

.mcsearch {
  background: #000;
  border-color: var(--grey);
}

.mcsearch::placeholder { color: var(--placeholder); }

.mccheck {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  font-size: 15px;
  user-select: none;
}

.mccheck input {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
}

.mccheck .box {
  width: 22px;
  height: 22px;
  flex: none;
  background: var(--widget-dark);
  border: 2px solid #000;
  box-shadow: inset 1px 1px 0 rgba(255, 255, 255, 0.25);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--white);
  font-size: 16px;
}

.mccheck input:checked + .box::after { content: "\2714"; }
.mccheck input:focus-visible + .box { outline: 2px solid var(--focus); }

.sortrow {
  display: grid;
  grid-template-columns: 26px 1fr;
  align-items: center;
  gap: 8px;
}

.sorticon {
  font-size: 17px;
  color: var(--grey);
  text-align: center;
}

.resultcount {
  margin: auto 0 0;
  font-size: 13px;
  color: var(--grey);
  text-align: center;
}

/* ── Content panel ────────────────────────────────────── */

.content {
  min-height: 0;
  overflow-y: auto;
  padding: 18px 22px 26px;
  scroll-behavior: smooth;
}

.content:focus { outline: none; }

.groupheading {
  margin: 22px 0 10px;
  font-size: 16px;
  font-weight: 400;
  color: var(--yellow);
}

.groupheading:first-child { margin-top: 0; }

/* General-tab style label/value rows */

.statrows { display: flex; flex-direction: column; }

.statrow {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 20px;
  padding: 6px 10px 5px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.09);
}

.statrow:hover { background: rgba(255, 255, 255, 0.06); }

.statrow .lbl { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.statrow .val {
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.statrow .rk {
  margin-left: 10px;
  font-size: 13px;
  color: var(--grey);
}

.statrow .rk.top1 { color: var(--yellow); }
.statrow .rk.top2 { color: #dcdcdc; }
.statrow .rk.top3 { color: #d08c46; }

.statcols {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  column-gap: 34px;
}

/* World header block on General page */

.worldhead {
  display: flex;
  align-items: center;
  gap: 18px;
  margin-bottom: 20px;
}

.worldhead canvas.sprite {
  width: 72px;
  height: 72px;
  flex: none;
}

.worldhead img.render {
  width: 72px;
  height: 72px;
  flex: none;
  object-fit: contain;
}

.worldhead .k { font-size: 14px; color: var(--yellow); margin: 0 0 2px; }

.worldhead .pill {
  display: inline-block;
  background: #ff8000;
  color: #402000;
  text-shadow: none;
  border-radius: 8px;
  padding: 2px 16px;
  font-size: 15px;
  margin-bottom: 8px;
}

.worldhead .pill.wide { font-size: 13px; }

/* Slot grids (Items / Players) */

.slotsection { margin-bottom: 6px; }

.slotgrid {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-bottom: 14px;
}

.slot {
  width: 44px;
  height: 44px;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.13);
  border: 2px solid rgba(255, 255, 255, 0.25);
  cursor: pointer;
}

.slot:hover, .slot:focus-visible {
  border-color: var(--focus);
  outline: none;
  background: rgba(170, 255, 255, 0.12);
}

.slot canvas.sprite { width: 32px; height: 32px; }

/* Players leaderboard */

.board {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 14px;
}

.lbrow {
  display: grid;
  grid-template-columns: 34px 34px 1fr;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 5px 10px 5px 6px;
  font: inherit;
  color: var(--white);
  text-shadow: var(--shadow);
  text-align: left;
  background: rgba(255, 255, 255, 0.055);
  border: 2px solid transparent;
  cursor: pointer;
}

.lbrow:nth-child(even) { background: rgba(255, 255, 255, 0.02); }

.lbrow:hover, .lbrow:focus-visible {
  border-color: var(--focus);
  outline: none;
}

.lbrank {
  font-size: 15px;
  color: var(--grey);
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.lbrank.top1 { color: var(--yellow); }
.lbrank.top2 { color: #dcdcdc; }
.lbrank.top3 { color: #d08c46; }

.lbrow canvas.sprite { width: 30px; height: 30px; }

.lbbar {
  position: relative;
  display: flex;
  align-items: center;
  height: 26px;
  min-width: 0;
  background: rgba(0, 0, 0, 0.45);
  border: 1px solid rgba(255, 255, 255, 0.1);
  padding: 0 9px;
  overflow: hidden;
}

.lbfill {
  position: absolute;
  inset: 0 auto 0 0;
  background: linear-gradient(180deg, rgba(84, 216, 84, 0.42), rgba(84, 216, 84, 0.16));
}

.lbname {
  position: relative;
  font-size: 15px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.lbname.bedrock::before { content: ""; }

.lbval {
  position: absolute;
  top: 50%;
  left: 100%;
  transform: translateY(-50%);
  font-size: 14px;
  color: var(--yellow);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.lbval.inside { transform: translate(-100%, -50%); }

/* Mobs: free-floating sprites on a faint grid */

.mobgrid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(76px, 1fr));
  margin-bottom: 14px;
}

.mobcell {
  padding: 0;
  background: none;
  border: 2px solid transparent;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.055);
  height: 84px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.mobcell:hover, .mobcell:focus-visible {
  border-color: var(--focus);
  outline: none;
}

.mobcell canvas.sprite { width: 52px; height: 52px; }

.mobcell.small canvas.sprite { width: 38px; height: 38px; }

.mobcell img.render {
  max-width: 82%;
  max-height: 82%;
  object-fit: contain;
}

.mobcell.small img.render {
  max-width: 62%;
  max-height: 62%;
}

.slot img.render {
  max-width: 34px;
  max-height: 34px;
  object-fit: contain;
}

/* Summary strip (bottom of a page) */

.summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 0 30px;
  background: var(--summary-bg);
  border: 2px solid var(--summary-outline);
  padding: 8px 14px;
  margin-top: 18px;
}

.summary .statrow { border-bottom: 0; padding: 4px 0 3px; }

/* Back link row in detail view */

.backrow {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 16px;
}

.backbtn {
  font: inherit;
  font-size: 15px;
  color: var(--white);
  text-shadow: var(--shadow);
  background: var(--widget);
  border: 2px solid #000;
  box-shadow: inset 1px 1px 0 rgba(255, 255, 255, 0.35), inset -1px -1px 0 rgba(0, 0, 0, 0.4);
  padding: 6px 14px;
  cursor: pointer;
}

.backbtn:hover, .backbtn:focus-visible {
  color: var(--yellow);
  outline: 2px solid var(--focus);
  outline-offset: -2px;
}

.detailhead {
  display: flex;
  align-items: center;
  gap: 18px;
  margin-bottom: 18px;
}

.detailhead canvas.sprite { width: 64px; height: 64px; flex: none; }

.detailhead img.render {
  width: 64px;
  height: 64px;
  flex: none;
  object-fit: contain;
}

.detailhead .k { font-size: 14px; color: var(--yellow); margin: 0 0 2px; }

.detailhead .pill {
  display: inline-block;
  background: #ff8000;
  color: #402000;
  text-shadow: none;
  border-radius: 8px;
  padding: 2px 16px;
  font-size: 15px;
  margin-bottom: 8px;
}

/* ── Tooltip (vanilla purple) ─────────────────────────── */

.tooltip {
  position: fixed;
  z-index: 50;
  pointer-events: none;
  max-width: 340px;
  background: var(--tt-bg);
  border: 2px solid transparent;
  border-image: linear-gradient(180deg, var(--tt-border-a), var(--tt-border-b)) 1;
  box-shadow: 0 0 0 2px var(--tt-bg);
  padding: 7px 10px;
  font-size: 14px;
  line-height: 1.45;
}

.tooltip p { margin: 0; }

.tt-title { color: var(--yellow); }
.tt-id { color: var(--grey); margin-bottom: 7px !important; }
.tt-line { color: var(--white); }
.tt-line::first-letter { color: var(--yellow); }
.tt-dim { color: var(--grey); }

/* About modal reuses tooltip look */

.modalwrap {
  position: fixed;
  inset: 0;
  z-index: 60;
  background: rgba(0, 0, 0, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal {
  position: static;
  pointer-events: auto;
  max-width: 420px;
}

.modal .dropentry {
  margin-top: 10px;
  border: 2px solid var(--panel-outline);
  text-align: center;
}

/* ── Scrollbars (MC-list style) ───────────────────────── */

.content::-webkit-scrollbar, .filters::-webkit-scrollbar { width: 12px; }

.content::-webkit-scrollbar-track, .filters::-webkit-scrollbar-track {
  background: rgba(0, 0, 0, 0.55);
}

.content::-webkit-scrollbar-thumb, .filters::-webkit-scrollbar-thumb {
  background: #8b8b8b;
  border: 2px solid #000;
  box-shadow: inset 1px 1px 0 rgba(255, 255, 255, 0.4);
}

.content, .filters { scrollbar-color: #8b8b8b rgba(0, 0, 0, 0.55); scrollbar-width: thin; }

/* ── Small screens ────────────────────────────────────── */

@media (max-width: 720px) {
  body { overflow: auto; }
  .screen {
    grid-template-columns: 1fr;
    height: auto;
  }
  .leftcol { grid-template-rows: auto auto; }
  .content { overflow: visible; }
}

@media (prefers-reduced-motion: reduce) {
  .content { scroll-behavior: auto; }
}
