@font-face {
  font-family: "Minecraft";
  src: url("../fonts/minecraft.woff") format("woff");
  font-display: swap;
}

:root {
  --nav-h: 56px;
  --bg: #121212;
  --nav-bg: #0a0a0a;
  --panel: #1d1d1d;
  --panel-edge: #000;
  --text: #f0f0f0;
  --muted: #a8a8a8;
  --accent: #5ec43b;          /* creeper green */
  --danger: #e04545;
}

html, body {
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: "Minecraft", "Courier New", monospace;
  letter-spacing: .02em;
}
body { overflow: hidden; }
/* Pixel fonts look best unsmoothed */
* { -webkit-font-smoothing: none; font-smooth: never; }
h1, h2, h3, h4, h5 { font-family: inherit; font-weight: normal; }
.text-mc-muted { color: var(--muted) !important; }

/* ---------- Navbar ---------- */
.psmp-navbar {
  height: var(--nav-h);
  background: var(--nav-bg);
  border-bottom: 2px solid #000;
  box-shadow: 0 2px 0 #222;
  z-index: 10;
}
.psmp-brand {
  font-size: 1.6rem;
  color: #f7d35c !important;
  text-shadow: 3px 3px 0 #3f2f00;
  margin-right: 1.5rem;
}
.psmp-navbar .nav-link {
  color: var(--muted);
  padding: .4rem .9rem !important;
  border: 2px solid transparent;
}
.psmp-navbar .nav-link:hover { color: var(--text); }
.psmp-navbar .nav-link.active {
  color: #fff;
  background: #2a2a2a;
  border-color: #000;
  box-shadow: inset 2px 2px 0 #444, inset -2px -2px 0 #111;
}
.api-status { font-size: .8rem; color: var(--danger); white-space: nowrap; }
.psmp-navbar .container-fluid { flex-wrap: nowrap; min-width: 0; }
.psmp-navbar .navbar-nav { min-width: 0; }

/* Phones: tighter top bar; the status shows only its coloured dot. */
@media (max-width: 575.98px) {
  .psmp-brand { font-size: 1.25rem; margin-right: .4rem; }
  .psmp-navbar .nav-link { padding: .3rem .4rem !important; font-size: .85rem; }
  .api-status .api-text { display: none; }
  .mc-panel { padding: 1.1rem; }
}
.api-status.online { color: var(--accent); }

/* ---------- Tabs ---------- */
.tab-view { height: calc(100vh - var(--nav-h)); position: relative; }
#tab-pay { overflow-y: auto; }

/* ---------- Minecraft-style controls ---------- */
.btn-mc {
  font-family: inherit;
  color: #fff;
  background: #6f6f6f;
  border: 2px solid #000;
  border-radius: 0;
  box-shadow: inset 2px 2px 0 #a5a5a5, inset -2px -3px 0 #3c3c3c;
  text-shadow: 2px 2px 0 #3f3f3f;
}
.btn-mc:hover, .btn-mc:focus-visible { background: #7d8fc7; color: #fff; box-shadow: inset 2px 2px 0 #b9c6ef, inset -2px -3px 0 #4a5786; }
.btn-mc:active { box-shadow: inset -2px -2px 0 #a5a5a5, inset 2px 3px 0 #3c3c3c; }

.mc-panel {
  background: var(--panel);
  border: 3px solid var(--panel-edge);
  box-shadow: inset 3px 3px 0 #3a3a3a, inset -3px -3px 0 #0f0f0f;
  padding: 1.75rem;
}
.mc-input, .mc-input:focus {
  font-family: inherit;
  background: #000;
  color: #fff;
  border: 2px solid #a0a0a0;
  border-radius: 0;
  box-shadow: none;
}
.mc-input:focus { border-color: #fff; }
.masked-input { -webkit-text-security: disc; text-security: disc; }

/* ---------- Map ---------- */
.map-viewport {
  position: absolute; inset: 0;
  overflow: hidden;
  cursor: grab;
  /* "Unknown territory" beyond the edges of the map image */
  background-color: #0b0b0b;
  background-image: repeating-linear-gradient(45deg, rgba(255,255,255,.035) 0 2px, transparent 2px 14px);
  touch-action: none;
  user-select: none;
  outline: none;
}
.map-viewport.dragging { cursor: grabbing; }
.map-viewport.picking, .map-viewport.picking .map-marker { cursor: crosshair; }
.pick-hint {
  position: absolute; top: 12px; left: 50%; transform: translateX(-50%);
  z-index: 25;
  background: rgba(0,0,0,.85); border: 2px solid #f2d21b;
  padding: 6px 12px; display: flex; align-items: center; gap: 10px;
  white-space: nowrap; max-width: calc(100vw - 24px);
}
#map-image {
  position: absolute; left: 0; top: 0;
  max-width: none;
  transform-origin: 0 0;
  will-change: transform;
  pointer-events: none;
  image-rendering: pixelated;  /* keep blocks crisp when zoomed in */
}
#marker-layer { position: absolute; inset: 0; pointer-events: none; }

#marker-layer { --ms: 1; }
.map-marker {
  position: absolute;
  width: calc(13px * var(--ms)); height: calc(17px * var(--ms));
  transform: translate(-50%, -100%);
  pointer-events: auto;
  cursor: pointer;
  filter: drop-shadow(2px 2px 0 rgba(0,0,0,.6));
  transition: transform .08s;
}
.map-marker:hover, .map-marker.active { transform: translate(-50%, -100%) scale(1.25); z-index: 2; }
.map-marker svg { width: 100%; height: 100%; display: block; }
.map-marker .label {
  position: absolute; top: 100%; left: 50%;
  transform: translateX(-50%);
  white-space: nowrap;
  font-size: max(7px, calc(5.5px * min(var(--ms), 1.5)));
  color: #fff;
  text-shadow: 1px 1px 0 #000, -1px -1px 0 #000, 1px -1px 0 #000, -1px 1px 0 #000;
  margin-top: 1px;
}

.map-hud {
  position: absolute; right: 12px; bottom: 12px;
  display: flex; align-items: flex-end; gap: 10px;
}
#cursor-coords, .zoom-hint {
  background: rgba(0,0,0,.7);
  border: 2px solid #000;
  padding: 4px 10px;
  font-size: .85rem;
}
.map-zoom .btn { width: 40px; height: 40px; font-size: 1.2rem; line-height: 1; padding: 0; }

/* ---------- Location hover card ---------- */
.loc-card {
  position: absolute;
  z-index: 20;
  width: 300px;
  max-width: calc(100vw - 24px);
  --c: #8ee06a;                                /* set per location to the marker colour */
  background: color-mix(in srgb, var(--c) 8%, rgba(8, 8, 8, .95));
  border: 2px solid #050505;
  outline: 2px solid color-mix(in srgb, var(--c) 65%, black);
  outline-offset: -4px;
  pointer-events: none;
  font-size: .85rem;
}
.loc-banner {
  height: 90px;
  background-size: cover;
  background-position: center;
  border-bottom: 2px solid #000;
  position: relative;
}
.loc-banner .owner-chip {
  position: absolute; left: 8px; bottom: 8px;
  padding: 2px 8px;
  border: 2px solid #000;
  color: #000;
  font-size: .75rem;
}
.loc-body { padding: 10px 12px 12px; }
.loc-title { font-size: 1.1rem; color: #ffff55; margin-bottom: 2px; }
.loc-owners { color: #55ffff; margin-bottom: 6px; }
.loc-coords { color: var(--muted); margin-bottom: 8px; }
.loc-desc { color: #e0e0e0; margin-bottom: 10px; line-height: 1.35; }
.loc-license { border-top: 2px solid color-mix(in srgb, var(--c) 45%, black); padding-top: 8px; display: grid; gap: 3px; }
.ok { color: #55ff55; }
.bad { color: #ff5555; }
.warn { color: #ffaa00; }

/* ---------- Pay ---------- */
.acct-face img, .gov-crest {
  width: 56px; height: 56px; display: block;
  image-rendering: pixelated; border: 2px solid #000; background: #333;
}
.gov-crest {
  background: #8f1d1d;
  box-shadow: inset 3px 3px 0 #c43a3a, inset -3px -3px 0 #4a0c0c;
}

/* Currency */
.px-icon { width: 1em; height: 1em; vertical-align: -0.12em; margin-left: .25em; image-rendering: pixelated; }
.icon-netherite { height: .7em; width: 1.2em; vertical-align: 0; }
.money { white-space: nowrap; }
.cur-diamond .money, .money.cur-diamond { color: #5ff2e1; }
.cur-netherite .money, .money.cur-netherite { color: #c9b8c2; }
.tx-in, .tx-in .money { color: #55ff55; white-space: nowrap; }
.tx-out, .tx-out .money { color: #ff6b6b; white-space: nowrap; }

.balance-box { background: #000; border: 2px solid #3a3a3a; padding: 10px 14px; height: 100%; }
.balance-box.cur-diamond { border-color: #1a6e68; }
.balance-box.cur-netherite { border-color: #4d444a; }
.balance { font-size: 1.8rem; text-shadow: 2px 2px 0 #000; }

.cur-picker { display: inline-flex; gap: 4px; }
.cur-option { cursor: pointer; display: inline-flex; align-items: center; justify-content: center; min-width: 44px; height: 38px; padding: 0 8px; background: #000; border: 2px solid #3a3a3a; font-size: 1.3rem; }
.cur-option input { position: absolute; opacity: 0; pointer-events: none; }
.cur-option .px-icon { margin: 0; }
.cur-option:has(input:checked) { border-color: #fff; background: #222; }
.cur-option:has(input:focus-visible) { outline: 2px solid #f2d21b; }

/* Pay sub-tabs */
.pay-tabs { gap: 6px; list-style: none; padding: 0; }
.pay-tab {
  font-family: inherit; color: var(--muted); background: #1d1d1d;
  border: 2px solid #000; padding: 6px 14px;
  box-shadow: inset 2px 2px 0 #333, inset -2px -2px 0 #0d0d0d;
}
.pay-tab:hover { color: #fff; }
.pay-tab.active { color: #fff; background: #3a3a3a; box-shadow: inset 2px 2px 0 #5a5a5a, inset -2px -2px 0 #1a1a1a; }

.tx-list { list-style: none; padding: 0; margin: 0; max-height: 460px; overflow-y: auto; }
.tx-list li { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 7px 0; border-bottom: 1px solid #2c2c2c; font-size: .85rem; }

.cost-summary { background: #000; border: 2px solid #2c2c2c; padding: 8px 12px; font-size: .85rem; display: grid; gap: 3px; }
.cost-summary .total { border-top: 1px solid #333; padding-top: 4px; margin-top: 2px; color: #fff; }

.biz-list { display: grid; gap: 10px; }
.biz-item { background: #111; border: 2px solid #000; border-left: 6px solid var(--c); padding: 10px 12px; }
.biz-name { font-size: 1.05rem; color: #ffff55; }
.btn-link-mc { background: none; border: 0; padding: 0; color: #55ffff; font-family: inherit; text-decoration: underline; }
.mc-check { display: flex; gap: 8px; align-items: center; cursor: pointer; }
/* Minecraft-style checkbox: bevelled dark slot, pixel tick when on. */
.mc-check input {
  appearance: none; -webkit-appearance: none; flex: none; margin: 0; cursor: pointer;
  width: 20px; height: 20px; background: #000 no-repeat center / 14px 14px;
  border: 2px solid #8b8b8b; box-shadow: inset 2px 2px 0 #373737;
  image-rendering: pixelated;
}
.mc-check input:checked {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 7 7' shape-rendering='crispEdges'%3E%3Cpath fill='%2355ff55' d='M6 0h1v2H6zM5 2h1v1H5zM4 3h1v1H4zM3 4h1v1H3zM2 5h1v1H2zM1 4h1v1H1zM0 3h1v1H0z'/%3E%3Cpath fill='%2355ff55' d='M5 1h1v1H5zM4 2h1v1H4zM3 3h1v1H3zM2 4h1v1H2zM1 3h1v1H1z'/%3E%3C/svg%3E");
}
.mc-check input:hover { border-color: #fff; }
.mc-check input:focus-visible { outline: 2px solid #55ffff; outline-offset: 1px; }
.mc-check input:disabled { opacity: .5; cursor: wait; }
.form-control-color.mc-input { height: 38px; padding: 2px; }

/* ---------- Pay: businesses ---------- */
.pay-tabs { flex-wrap: wrap; }
.pay-tab.biz-tab { border-bottom: 3px solid var(--c); }
.seg { display: inline-flex; flex-wrap: wrap; max-width: 100%; border: 2px solid #3a3a3a; background: #000; }
.seg-option { cursor: pointer; margin: 0; }
.seg-option input { position: absolute; opacity: 0; pointer-events: none; }
.seg-option span { display: inline-block; padding: 4px 10px; background: #000; color: var(--muted); white-space: nowrap; }
.seg-option:has(input:checked) span { background: #3a3a3a; color: #fff; }
.seg-option:has(input:focus-visible) span { outline: 2px solid #f2d21b; }

.owner-row { display: flex; gap: 6px; align-items: center; margin-bottom: 6px; min-width: 0; }
.owner-row .owner-name { flex: 1 1 0; width: auto; min-width: 0; }
.owner-row .owner-share { flex: 0 0 4.2rem; width: 4.2rem; min-width: 0; padding-left: 6px; padding-right: 2px; }
.owner-row .owner-name[readonly] { color: var(--muted); }
.owner-row .pct { flex: 0 0 auto; }
/* Last slot (founder label or remove button) has a fixed width so rows line up. */
.owner-row .founder-tag, .owner-row [data-act="remove-owner"] { flex: 0 0 4.2rem; width: 4.2rem; text-align: center; }
.owner-row .founder-tag { font-size: .75rem; }

.insurance-note { border-left: 3px solid #55ffff; padding-left: 8px; color: #bfefff; }

.biz-banner { height: 110px; background-size: cover; background-position: center; border: 2px solid #000; }
.biz-title { color: #ffff55; }
.biz-head { border-top: 4px solid var(--c); }
.biz-name-inline { color: #ffff55; }

.share-bar { display: flex; height: 12px; border: 2px solid #000; background: #000; }
.share-seg + .share-seg { border-left: 2px solid #000; }
.share-dot { display: inline-block; width: 9px; height: 9px; margin-right: 6px; border: 1px solid #000; }
.s0 { background: #55ffff; } .s1 { background: #ffaa00; } .s2 { background: #ff55ff; } .s3 { background: #55ff55; } .s4 { background: #aaaaaa; }

details > summary { cursor: pointer; color: #55ffff; }
.danger-zone { border-color: #4a0c0c; }
.btn-danger-mc { background: #8f1d1d; box-shadow: inset 2px 2px 0 #c43a3a, inset -2px -3px 0 #4a0c0c; }
.btn-danger-mc:hover, .btn-danger-mc:focus-visible { background: #b52a2a; box-shadow: inset 2px 2px 0 #e05a5a, inset -2px -3px 0 #5a1010; }

/* ---------- Rankings ---------- */
#tab-rankings { overflow-y: auto; }
.podium { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 14px; }
.podium-card { background: #111; border: 3px solid #000; outline: 2px solid var(--medal); outline-offset: -5px; padding: 10px; }
.podium-banner { height: 90px; background-size: cover; background-position: center; border: 2px solid #000; position: relative; }
.podium-rank { position: absolute; left: 6px; top: 6px; background: var(--medal); color: #000; padding: 2px 8px; border: 2px solid #000; font-size: 1.1rem; }
.podium-name { font-size: 1.15rem; color: #ffff55; margin: 8px 0 2px; word-break: break-word; }
.rank-gold { --medal: #ffd84a; } .rank-silver { --medal: #d0d0d0; } .rank-bronze { --medal: #cd7f32; }

.player-ranks { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
.player-rank { display: flex; align-items: center; gap: 12px; background: #111; border: 2px solid #000; border-left: 6px solid var(--medal, #3a3a3a); padding: 6px 12px; }
.player-rank img { image-rendering: pixelated; border: 2px solid #000; flex: 0 0 auto; }
.player-rank-num { width: 2.2rem; color: var(--medal, var(--muted)); font-size: 1.1rem; }
.player-rank-name { font-size: 1.1rem; min-width: 0; overflow-wrap: anywhere; }

/* Full-width three-way choice (e.g. To a player / business / government) */
.seg.seg-block { display: flex; width: 100%; }
.seg.seg-block .seg-option { flex: 1 1 0; min-width: max-content; }
.seg.seg-block .seg-option span { display: block; text-align: center; }
.cur-picker { flex-wrap: nowrap; }

/* Business page section tabs */
.biz-sections {
  display: flex; flex-wrap: nowrap; gap: 3px; border-bottom: 3px solid #000;
  overflow-x: auto; scrollbar-width: thin;          /* one row; scrolls sideways on narrow screens */
}
.biz-section-btn {
  flex: 0 0 auto; white-space: nowrap;
  font-family: inherit; font-size: .9rem; color: var(--muted); background: #161616; border: 2px solid #000; border-bottom: 0;
  padding: 5px 10px; box-shadow: inset 2px 2px 0 #2c2c2c;
}
.biz-section-btn:hover { color: #fff; }
.biz-section-btn.active { color: #fff; background: #2e2e2e; border-top: 3px solid var(--c); }
.site-item { background: #111; border: 2px solid #000; border-left: 6px solid #8ee06a; padding: 10px 12px; }
.confirm-box { display: inline-flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.confirm-box[hidden] { display: none !important; }
.form-select.mc-input { background-color: #000; color: #fff; border-color: #a0a0a0; }

.name-status:empty { display: none; }
.biz-picker { appearance: auto; max-width: 16rem; color: #fff; }
.biz-picker option { background: #111; color: #fff; }
.pay-tabs { row-gap: 6px; }

.zoom-hint { color: var(--muted); }
