/* Paul's MC Server: the look of the game. Hard edges, no gradients, pixel font where available. */

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

:root {
  --font: "Monocraft", ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  /* Chat colours of the game: §e §a §c §b §7 §f */
  --yellow: #ffff55;
  --green: #55ff55;
  --red: #ff5555;
  --aqua: #55ffff;
  --gray: #aaaaaa;
  --white: #ffffff;
  --shadow: #3f3f3f;
  /* Inventory window */
  --inv: #c6c6c6;
  --inv-text: #3f3f3f;
  --inv-light: #ffffff;
  --inv-dark: #555555;
  --slot: #8b8b8b;
  --slot-dark: #373737;
  /* Buttons of the menus */
  --btn: #6f6f6f;
  --btn-light: #a8a8a8;
  --btn-dark: #484848;
  --btn-hover: #7b87c7;
  --btn-hover-light: #bcc5ff;
  --btn-hover-dark: #555f99;
  --dirt: #3b2c20;
  color-scheme: dark;
}

* { box-sizing: border-box; }

[hidden] { display: none !important; }

html, body {
  margin: 0;
  min-height: 100%;
}

body {
  font-family: var(--font);
  font-size: 14px;
  color: var(--white);
  background-color: var(--dirt);
  background-size: 64px 64px;
  image-rendering: pixelated;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-height: 100dvh;
}

button { font: inherit; }

/* ── Title ─────────────────────────────────────────────────────────────────── */

.title {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px 24px;
  padding: 16px 20px 10px;
}

.logo {
  position: relative;
  display: flex;
  align-items: center;
  gap: 14px;
  margin-right: 100px; /* room for the splash text */
}

#logo-block {
  width: 40px;
  height: 40px;
  image-rendering: pixelated;
  box-shadow: 3px 3px 0 #000;
}

h1 {
  margin: 0;
  font-size: 30px;
  font-weight: normal;
  letter-spacing: 1px;
  color: var(--white);
  text-shadow: 3px 3px 0 var(--shadow);
}

.splash {
  position: absolute;
  right: -110px;
  top: 26px;
  color: var(--yellow);
  font-size: 15px;
  text-shadow: 2px 2px 0 #3f3f00;
  transform: rotate(-16deg);
  white-space: nowrap;
  animation: splash 0.5s ease-in-out infinite alternate;
  pointer-events: none;
}

@keyframes splash {
  from { transform: rotate(-16deg) scale(1); }
  to { transform: rotate(-16deg) scale(1.08); }
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.chip {
  padding: 6px 10px;
  background: rgba(0, 0, 0, 0.55);
  color: var(--white);
  text-shadow: 2px 2px 0 #000;
  white-space: nowrap;
}

.chip.up { color: var(--green); }
.chip.down { color: var(--red); }

/* ── Panels like the inventory window ──────────────────────────────────────── */

.panel {
  background: var(--inv);
  color: var(--inv-text);
  border: 2px solid #000;
  box-shadow: inset 2px 2px 0 var(--inv-light), inset -2px -2px 0 var(--inv-dark);
  padding: 8px;
}

main {
  flex: 1;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: 14px;
  padding: 0 20px 14px;
  min-height: 0;
}

/* ── Buttons like the menus ────────────────────────────────────────────────── */

.mc-button {
  appearance: none;
  border: 2px solid #000;
  background: var(--btn);
  color: var(--white);
  text-shadow: 2px 2px 0 #383838;
  box-shadow: inset 2px 2px 0 var(--btn-light), inset -2px -3px 0 var(--btn-dark);
  padding: 6px 10px 7px;
  cursor: pointer;
  min-height: 32px;
  line-height: 1;
}

.mc-button:hover {
  background: var(--btn-hover);
  box-shadow: inset 2px 2px 0 var(--btn-hover-light), inset -2px -3px 0 var(--btn-hover-dark);
}

.mc-button.on {
  background: #4c4c4c;
  color: var(--yellow);
  box-shadow: inset 2px 2px 0 #2a2a2a, inset -2px -2px 0 #6b6b6b;
}

.mc-button:focus-visible, .slot:focus-visible { outline: 2px solid var(--yellow); outline-offset: 1px; }

.seg { display: flex; gap: 4px; flex-wrap: wrap; }
.seg.wide .mc-button { flex: 1; }

/* ── Map ───────────────────────────────────────────────────────────────────── */

.map-frame {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: 0;
}

.map-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: space-between;
}

.map {
  position: relative;
  flex: 1;
  min-height: 420px;
  background: #0f0f12;
  border: 2px solid #000;
  box-shadow: inset 2px 2px 0 var(--slot-dark), inset -2px -2px 0 var(--inv-light);
  overflow: hidden;
  touch-action: none;
  cursor: grab;
}

.map.dragging { cursor: grabbing; }

#map-canvas {
  position: absolute;
  inset: 2px;
  width: calc(100% - 4px);
  height: calc(100% - 4px);
  image-rendering: pixelated;
}

.readout, .follow {
  position: absolute;
  left: 10px;
  bottom: 10px;
  padding: 5px 8px;
  background: rgba(0, 0, 0, 0.6);
  color: var(--white);
  text-shadow: 2px 2px 0 #000;
  pointer-events: none;
  font-size: 13px;
}

.follow {
  left: auto;
  right: 10px;
  color: var(--yellow);
  pointer-events: auto;
  cursor: pointer;
}

.map-empty {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  color: var(--white);
  text-shadow: 2px 2px 0 #000;
  padding: 20px;
  pointer-events: none;
}

.small { color: var(--gray); font-size: 12px; max-width: 420px; line-height: 1.5; }

/* ── Side panel with a hotbar of tabs ──────────────────────────────────────── */

.side {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 0;
}

.hotbar {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 4px;
  padding: 4px;
  background: #000;
}

.slot {
  appearance: none;
  border: 0;
  background: var(--slot);
  color: var(--white);
  text-shadow: 2px 2px 0 #383838;
  box-shadow: inset 2px 2px 0 var(--slot-dark), inset -2px -2px 0 var(--inv-light);
  padding: 8px 2px 6px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  font-size: 11px;
}

.slot .icon { font-size: 18px; }

.slot.on {
  outline: 3px solid var(--white);
  outline-offset: -3px;
  background: #a0a0a0;
}

.tab {
  overflow: auto;
  min-height: 0;
  flex: 1;
}

.section-title {
  margin: 6px 2px 8px;
  font-size: 13px;
  color: var(--inv-text);
}

.empty { color: #6b6b6b; padding: 10px 4px; line-height: 1.5; }

/* Rows sit in inventory slots */
.row {
  display: grid;
  grid-template-columns: 36px 1fr auto;
  gap: 10px;
  align-items: center;
  padding: 8px;
  margin-bottom: 6px;
  background: var(--slot);
  color: var(--white);
  text-shadow: 2px 2px 0 #383838;
  box-shadow: inset 2px 2px 0 var(--slot-dark), inset -2px -2px 0 var(--inv-light);
  cursor: pointer;
}

.row:hover { background: #9a9a9a; }

.row .name { font-size: 14px; }
.row .sub { color: #e0e0e0; font-size: 11px; margin-top: 3px; }
.row .right { text-align: right; font-size: 12px; }
.row .afk { color: var(--gray); }

.face {
  width: 32px;
  height: 32px;
  image-rendering: pixelated;
  box-shadow: 2px 2px 0 #000;
}

.hearts { display: flex; gap: 1px; margin-top: 4px; }
.hearts canvas { width: 9px; height: 9px; image-rendering: pixelated; }

.board { list-style: none; margin: 10px 0 0; padding: 0; }

.board li {
  display: grid;
  grid-template-columns: 28px 1fr auto;
  gap: 8px;
  align-items: center;
  padding: 8px;
  margin-bottom: 6px;
  background: var(--slot);
  color: var(--white);
  text-shadow: 2px 2px 0 #383838;
  box-shadow: inset 2px 2px 0 var(--slot-dark), inset -2px -2px 0 var(--inv-light);
  position: relative;
}

.board .rank { color: var(--gray); }
.board li:nth-child(1) .rank { color: var(--yellow); }
.board li:nth-child(2) .rank { color: var(--white); }
.board li:nth-child(3) .rank { color: #ffaa00; }
.board .value { color: var(--aqua); }

/* An XP bar under each entry: hard green on dark, the share of the best */
.board .bar {
  grid-column: 1 / -1;
  height: 5px;
  background: #1c1c1c;
  border: 1px solid #000;
}
.board .bar i { display: block; height: 100%; background: #80ff20; }

.event {
  padding: 6px 8px;
  margin-bottom: 4px;
  background: rgba(0, 0, 0, 0.72);
  color: var(--white);
  text-shadow: 2px 2px 0 #000;
  font-size: 12px;
  line-height: 1.45;
}
.event .when { color: var(--gray); margin-right: 6px; }
.event.join b { color: var(--green); }
.event.leave b { color: #ffaa00; }
.event.death b { color: var(--red); }
.event.start b, .event.stop b { color: var(--yellow); }

.foot {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  padding: 8px 20px 14px;
  color: var(--gray);
  text-shadow: 2px 2px 0 #000;
  font-size: 12px;
}
.foot b { color: var(--white); font-weight: normal; }

/* ── Inventory window ──────────────────────────────────────────────────────── */

.row .inv-btn { margin-top: 6px; min-height: 26px; padding: 4px 8px 5px; font-size: 11px; }

.modal {
  position: fixed;
  inset: 0;
  z-index: 10;
  background: rgba(0, 0, 0, 0.62);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.inv-window {
  width: min(100%, 392px);
  max-height: 100%;
  overflow: auto;
  padding: 12px 12px 10px;
}

.inv-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
  font-size: 15px;
}

.inv-head .mc-button { min-height: 28px; padding: 4px 9px 5px; }

.inv-top {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 10px;
  align-items: end;
  margin-bottom: 10px;
}

.inv-armor { display: grid; gap: 2px; }
.inv-off { display: grid; gap: 2px; }

.inv-doll {
  align-self: stretch;
  background: #000;
  box-shadow: inset 2px 2px 0 var(--slot-dark), inset -2px -2px 0 var(--inv-light);
  border: 2px solid #000;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px;
  color: var(--white);
  text-shadow: 2px 2px 0 #000;
  font-size: 12px;
  text-align: center;
}

.inv-doll canvas { width: 64px; height: 64px; image-rendering: pixelated; box-shadow: 3px 3px 0 #333; }
.inv-doll .lvl { color: #80ff20; }

.inv-label { margin: 2px 2px 4px; font-size: 12px; }

.inv-grid {
  display: grid;
  grid-template-columns: repeat(9, 1fr);
  gap: 2px;
}

.inv-grid.hot { margin-top: 8px; }

.cell {
  position: relative;
  aspect-ratio: 1;
  min-width: 0;
  background: var(--slot);
  box-shadow: inset 2px 2px 0 var(--slot-dark), inset -2px -2px 0 var(--inv-light);
  display: flex;
  align-items: center;
  justify-content: center;
}

.cell canvas { width: 80%; height: 80%; image-rendering: pixelated; }

.cell .count {
  position: absolute;
  right: 3px;
  bottom: 1px;
  color: var(--white);
  font-size: 12px;
  text-shadow: 2px 2px 0 #3f3f3f;
  pointer-events: none;
}

.cell .dur {
  position: absolute;
  left: 4px;
  right: 4px;
  bottom: 4px;
  height: 2px;
  background: #000;
}
.cell .dur i { display: block; height: 100%; }

.cell.sel { outline: 2px solid var(--white); outline-offset: -2px; }

/* The shimmer of enchanted items: a purple tint that comes and goes */
.cell.ench::after {
  content: "";
  position: absolute;
  inset: 4px;
  background: #a050ff;
  opacity: 0;
  mix-blend-mode: screen;
  animation: glint 2.4s steps(6) infinite;
  pointer-events: none;
}
@keyframes glint { 50% { opacity: 0.35; } }

.cell.empty-armor::before {
  content: attr(data-hint);
  color: #6d6d6d;
  font-size: 10px;
}

.inv-foot { margin-top: 8px; font-size: 11px; color: #5a5a5a; }

/* The tooltip of the game: near black with a purple frame */
.mc-tooltip {
  position: fixed;
  z-index: 20;
  max-width: 260px;
  padding: 6px 8px;
  background: rgba(16, 0, 16, 0.94);
  border: 2px solid #1b0f2e;
  box-shadow: inset 0 0 0 2px #3a1a7a;
  color: var(--white);
  text-shadow: 2px 2px 0 #1a1a1a;
  font-size: 12px;
  line-height: 1.5;
  pointer-events: none;
}
.mc-tooltip .t-name { font-size: 13px; }
.mc-tooltip .t-name.ench { color: var(--aqua); }
.mc-tooltip .t-name.renamed { font-style: italic; }
.mc-tooltip .t-line { color: var(--gray); }
.mc-tooltip .t-id { color: #5555ff; font-size: 10px; }

/* ── Phones ────────────────────────────────────────────────────────────────── */

@media (max-width: 900px) {
  main { grid-template-columns: minmax(0, 1fr); padding: 0 16px 12px; }
  .map { min-height: 62vh; }
  .side { max-height: none; }
  .title { padding: 12px 16px 8px; }
  h1 { font-size: 22px; }
  .splash { right: -80px; top: 20px; font-size: 12px; }
  .logo { margin-right: 80px; }
  .foot { padding: 8px 16px 12px; }
}

@media (max-width: 480px) {
  .splash { display: none; }
  .logo { margin-right: 0; }
  .map-bar .seg .mc-button { padding: 6px 7px 7px; font-size: 12px; }
}
