/* ============ NEW BLOCKS theme ============ */
:root {
  --font-pixel: "Pixelify Sans", "Trebuchet MS", system-ui, sans-serif;
  --blue: #2f8bff;
  --blue-lite: #5fa8ff;
  --blue-dark: #1f6fe0;
  --blue-deep: #14467f;
  --cyan: #5fe0ff;
  --stone: #2a2d33;
  --stone-lite: #3a3e46;
  --stone-dark: #15171b;
  --ink: #0a0d12;
  --steel: #6b7079;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #8fc7ff;
  font-family: var(--font-pixel);
  color: #fff;
  user-select: none;
}

#game canvas { display: block; touch-action: none; }

.hidden { display: none !important; }

/* small cyan square accents in the four corners (signature block-UI look) */
.cyan-corners {
  background-image:
    linear-gradient(var(--cyan), var(--cyan)),
    linear-gradient(var(--cyan), var(--cyan)),
    linear-gradient(var(--cyan), var(--cyan)),
    linear-gradient(var(--cyan), var(--cyan));
  background-repeat: no-repeat;
  background-size: 8px 8px;
  background-position: 6px 6px, calc(100% - 6px) 6px, 6px calc(100% - 6px), calc(100% - 6px) calc(100% - 6px);
}

/* ---------- Overlays ---------- */
.overlay {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
}
.overlay.click-through { background: rgba(0, 0, 0, 0.12); cursor: pointer; }

#menu {
  background: linear-gradient(180deg, #5aa6ea 0%, #79bdf2 45%, #a6d6ff 100%);
  overflow: hidden;
}
/* drifting blocky Minecraft-style clouds */
.sky-clouds {
  position: absolute;
  inset: -20% -10%;
  pointer-events: none;
  opacity: 0.9;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='300' height='200' shape-rendering='crispEdges'%3E%3Cg fill='%23ffffff' opacity='0.8'%3E%3Crect x='24' y='34' width='96' height='22'/%3E%3Crect x='42' y='20' width='60' height='16'/%3E%3Crect x='12' y='50' width='118' height='14'/%3E%3Crect x='190' y='104' width='84' height='20'/%3E%3Crect x='208' y='92' width='46' height='14'/%3E%3Crect x='178' y='120' width='102' height='12'/%3E%3C/g%3E%3C/svg%3E");
  background-size: 360px 240px;
  animation: cloud-drift 70s linear infinite;
}
@keyframes cloud-drift { from { background-position: 0 0; } to { background-position: 360px 0; } }

.panel {
  position: relative;
  z-index: 1;
  background:
    linear-gradient(var(--cyan), var(--cyan)) 8px 8px/9px 9px no-repeat,
    linear-gradient(var(--cyan), var(--cyan)) calc(100% - 8px) 8px/9px 9px no-repeat,
    linear-gradient(var(--cyan), var(--cyan)) 8px calc(100% - 8px)/9px 9px no-repeat,
    linear-gradient(var(--cyan), var(--cyan)) calc(100% - 8px) calc(100% - 8px)/9px 9px no-repeat,
    linear-gradient(180deg, #34383f, #25282e);
  border: 4px solid var(--ink);
  box-shadow: 0 0 0 4px var(--steel), 0 0 0 7px var(--ink), 0 18px 54px rgba(0, 0, 0, 0.55);
  padding: 30px 40px 34px;
  border-radius: 4px;
  text-align: center;
  width: min(470px, 94vw);
}

.logo {
  display: block;
  width: min(360px, 84%);
  height: auto;
  margin: 2px auto 12px;
  filter: drop-shadow(0 5px 0 rgba(0, 0, 0, 0.35)) drop-shadow(0 3px 10px rgba(0, 0, 0, 0.5));
}

h1 {
  font-family: var(--font-pixel);
  letter-spacing: 4px;
  font-size: 40px;
  text-shadow: 3px 3px 0 #14467f, 0 0 18px rgba(95, 224, 255, 0.5);
  color: #fff;
}
.tag { opacity: 0.78; margin: 4px 0 18px; font-size: 14px; letter-spacing: 1px; }
.mode-tag { margin: 16px 0 6px; color: var(--cyan); font-size: 13px; letter-spacing: 2px; opacity: 1; }

#name-input {
  display: block;
  width: 100%;
  font-family: var(--font-pixel);
  font-size: 17px;
  text-align: center;
  padding: 12px 14px;
  margin: 6px 0 12px;
  color: #fff;
  background: var(--stone-dark);
  border: 3px solid var(--ink);
  box-shadow: inset 0 0 0 2px var(--stone-lite);
  outline: none;
  border-radius: 3px;
}
#name-input::placeholder { color: #7a818c; }
#name-input:focus { box-shadow: inset 0 0 0 2px var(--cyan); }

.name-row { display: flex; gap: 8px; margin: 6px 0 28px; }
.name-input-wrap { position: relative; flex: 1 1 auto; min-width: 0; }
.name-row #name-input { margin: 0; }
#name-count {
  position: absolute;
  top: calc(100% + 4px);
  right: 4px;
  color: #9aa4b2;
  font-size: 12px;
  line-height: 1;
  letter-spacing: 0.5px;
  pointer-events: none;
}
#name-refresh {
  flex: 0 0 auto;
  width: 48px;
  font-family: var(--font-pixel);
  font-size: 22px;
  line-height: 1;
  color: #fff;
  cursor: pointer;
  background: linear-gradient(180deg, var(--blue-lite), var(--blue) 55%, var(--blue-dark));
  border: 3px solid var(--ink);
  border-radius: 3px;
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.5), inset 0 2px 0 rgba(255, 255, 255, 0.25);
}
#name-refresh:hover { filter: brightness(1.1); }
#name-refresh:active { transform: translateY(2px); }

/* big blue block "PLAY" button */
#play-btn {
  display: block;
  width: 100%;
  cursor: pointer;
  font-family: var(--font-pixel);
  font-weight: 700;
  font-size: 24px;
  letter-spacing: 1px;
  color: #fff;
  text-shadow: 2px 2px 0 rgba(0, 0, 0, 0.4);
  padding: 0;
  margin: 8px 0 4px;
  border: none;
  border-radius: 4px;
  background:
    linear-gradient(var(--cyan), var(--cyan)) 6px 6px/7px 7px no-repeat,
    linear-gradient(var(--cyan), var(--cyan)) calc(100% - 6px) 6px/7px 7px no-repeat,
    linear-gradient(var(--cyan), var(--cyan)) 6px calc(100% - 6px)/7px 7px no-repeat,
    linear-gradient(var(--cyan), var(--cyan)) calc(100% - 6px) calc(100% - 6px)/7px 7px no-repeat,
    linear-gradient(180deg, var(--blue-lite) 0%, var(--blue) 52%, var(--blue-dark) 100%);
  box-shadow: 0 0 0 3px var(--ink), 0 0 0 6px rgba(255, 255, 255, 0.9), 0 8px 0 var(--blue-deep), 0 12px 18px rgba(0, 0, 0, 0.45);
  transition: filter 0.1s, transform 0.06s;
}
#play-btn span { display: block; padding: 16px 14px; }
#play-btn:hover { filter: brightness(1.08); }
#play-btn:active {
  transform: translateY(5px);
  box-shadow: 0 0 0 3px var(--ink), 0 0 0 6px rgba(255, 255, 255, 0.9), 0 3px 0 var(--blue-deep), 0 5px 10px rgba(0, 0, 0, 0.4);
}

.controls {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 6px;
  margin-top: 20px;
  font-size: 11px;
}
.controls span {
  background: rgba(0, 0, 0, 0.32);
  border: 1px solid var(--ink);
  border-radius: 3px;
  padding: 5px 4px;
}
.controls b { color: var(--cyan); font-weight: 700; }

#loading {
  flex-direction: column;
  gap: 22px;
  background: linear-gradient(180deg, rgba(10, 14, 22, 0.94), rgba(8, 12, 20, 0.97));
  font-family: var(--font-pixel);
  font-size: 24px;
  letter-spacing: 2px;
  color: var(--cyan);
}
.loading-logo {
  width: min(340px, 70vw);
  height: auto;
  filter: drop-shadow(0 4px 0 rgba(0, 0, 0, 0.35)) drop-shadow(0 3px 10px rgba(0, 0, 0, 0.5));
  animation: loading-pulse 1.6s ease-in-out infinite;
}
@keyframes loading-pulse { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-6px); } }

.hint {
  font-family: var(--font-pixel);
  font-weight: 700;
  color: #fff;
  text-shadow: 2px 2px 0 rgba(0, 0, 0, 0.4);
  padding: 16px 40px;
  border-radius: 4px;
  font-size: 24px;
  letter-spacing: 1px;
  background:
    linear-gradient(var(--cyan), var(--cyan)) 6px 6px/7px 7px no-repeat,
    linear-gradient(var(--cyan), var(--cyan)) calc(100% - 6px) 6px/7px 7px no-repeat,
    linear-gradient(var(--cyan), var(--cyan)) 6px calc(100% - 6px)/7px 7px no-repeat,
    linear-gradient(var(--cyan), var(--cyan)) calc(100% - 6px) calc(100% - 6px)/7px 7px no-repeat,
    linear-gradient(180deg, var(--blue-lite) 0%, var(--blue) 52%, var(--blue-dark) 100%);
  box-shadow: 0 0 0 3px var(--ink), 0 0 0 6px rgba(255, 255, 255, 0.9), 0 6px 0 var(--blue-deep), 0 10px 16px rgba(0, 0, 0, 0.45);
}

/* ---------- HUD ---------- */
#underwater-overlay {
  position: fixed;
  inset: 0;
  z-index: 4;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.18s ease;
  background:
    radial-gradient(circle at 50% 45%, rgba(105, 205, 235, 0.18), rgba(14, 74, 120, 0.42)),
    repeating-linear-gradient(115deg, rgba(180, 235, 255, 0.08) 0 10px, rgba(20, 90, 145, 0.06) 10px 22px);
  mix-blend-mode: screen;
}
#underwater-overlay.show {
  opacity: 1;
  animation: water-drift 5s linear infinite;
}

#rain-overlay {
  position: fixed;
  inset: 0;
  z-index: 3;
  pointer-events: none;
  opacity: 0;
  transition: opacity 1.2s ease;
  background:
    radial-gradient(circle at 50% 40%, rgba(60, 76, 96, 0.04), rgba(38, 50, 68, 0.22)),
    linear-gradient(rgba(46, 58, 74, 0.12), rgba(40, 52, 68, 0.18));
}
#rain-overlay.show { opacity: 1; }

#lightning-overlay {
  position: fixed;
  inset: 0;
  z-index: 4;
  pointer-events: none;
  opacity: 0;
  background: #e3edff;
  mix-blend-mode: screen;
}

#cave-vignette {
  position: fixed;
  inset: 0;
  z-index: 3;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.24s ease;
  background:
    radial-gradient(circle at 50% 48%, rgba(0, 0, 0, 0.02) 0 30%, rgba(0, 0, 0, 0.34) 72%, rgba(0, 0, 0, 0.72) 100%),
    linear-gradient(rgba(7, 10, 12, 0.12), rgba(7, 10, 12, 0.3));
}

@keyframes water-drift {
  from { background-position: 0 0, 0 0; }
  to { background-position: 0 0, 80px 36px; }
}

#crosshair {
  position: fixed;
  left: 50%;
  top: 50%;
  width: 22px;
  height: 22px;
  transform: translate(-50%, -50%);
  pointer-events: none;
  z-index: 5;
  background:
    linear-gradient(#fff, #fff) center/3px 22px no-repeat,
    linear-gradient(#fff, #fff) center/22px 3px no-repeat;
  mix-blend-mode: difference;
}

#bow-charge {
  position: fixed;
  left: 50%;
  top: calc(50% + 28px);
  width: 86px;
  height: 8px;
  transform: translateX(-50%);
  border: 2px solid rgba(8, 10, 14, 0.92);
  border-radius: 2px;
  background: rgba(6, 8, 12, 0.6);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.24), 0 0 8px rgba(0, 0, 0, 0.45);
  pointer-events: none;
  overflow: hidden;
  z-index: 5;
}
#bow-charge-fill {
  width: 100%;
  height: 100%;
  transform: scaleX(0);
  transform-origin: left center;
  background: linear-gradient(90deg, #cfefff, var(--cyan) 58%, #ffe27a);
  image-rendering: pixelated;
}
#bow-charge.ready #bow-charge-fill {
  background: linear-gradient(90deg, #fff6a5, #ffffff 52%, var(--cyan));
}

#attack-cooldown {
  position: fixed;
  left: 50%;
  top: calc(50% + 42px);
  width: 54px;
  height: 5px;
  transform: translateX(-50%);
  border: 2px solid rgba(8, 10, 14, 0.9);
  border-radius: 2px;
  background: rgba(6, 8, 12, 0.55);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.18), 0 0 7px rgba(0, 0, 0, 0.38);
  pointer-events: none;
  overflow: hidden;
  z-index: 5;
}
#attack-cooldown-fill {
  width: 100%;
  height: 100%;
  transform: scaleX(0);
  transform-origin: left center;
  background: linear-gradient(90deg, #d9e8cf, #ffffff);
  image-rendering: pixelated;
}
#attack-cooldown.ready #attack-cooldown-fill {
  background: linear-gradient(90deg, #fff6a5, #ffffff 62%, var(--cyan));
}

#coords {
  position: fixed;
  top: 8px;
  left: 8px;
  font-family: monospace;
  font-size: 13px;
  background: rgba(0, 0, 0, 0.4);
  padding: 4px 8px;
  border-radius: 4px;
  z-index: 5;
  pointer-events: none;
}

#debug-metrics {
  position: fixed;
  top: 34px;
  left: 8px;
  width: min(520px, 70vw);
  font-family: "Consolas", "Menlo", monospace;
  font-size: 12px;
  line-height: 1.35;
  white-space: pre;
  color: #dfffe0;
  background: rgba(0, 0, 0, 0.62);
  border: 1px solid rgba(190, 255, 190, 0.28);
  border-radius: 4px;
  padding: 6px 8px;
  z-index: 5;
  pointer-events: none;
  text-shadow: 1px 1px 1px #000;
}

#player-list {
  position: fixed;
  top: 28px;
  left: 50%;
  width: min(360px, calc(100vw - 32px));
  transform: translateX(-50%);
  z-index: 8;
  pointer-events: none;
  padding: 10px;
  border: 2px solid rgba(210, 230, 210, 0.34);
  border-radius: 6px;
  background: rgba(12, 16, 22, 0.78);
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.38);
  color: #eef8e8;
  font-family: "Consolas", "Menlo", monospace;
  text-shadow: 1px 1px 1px #000;
}
.player-list-title {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  padding: 0 2px 6px;
  color: #cfe8b8;
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}
.player-list-rows {
  display: grid;
  gap: 4px;
}
.player-list-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  min-height: 28px;
  padding: 4px 7px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.06);
}
.player-list-row.self {
  border-color: rgba(95, 224, 255, 0.4);
  background: rgba(47, 139, 255, 0.22);
}
.player-list-name {
  overflow: hidden;
  color: #fff;
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.player-list-meta {
  color: #d9e8cf;
  font-size: 12px;
  white-space: nowrap;
}

#land-hud {
  position: fixed;
  top: 34px;
  left: 8px;
  z-index: 6;
  max-width: min(360px, calc(100vw - 16px));
  padding: 7px 9px;
  border: 2px solid rgba(95, 224, 255, 0.42);
  border-radius: 4px;
  background: rgba(8, 12, 18, 0.68);
  box-shadow: 0 7px 18px rgba(0, 0, 0, 0.28);
  color: #eff9ff;
  font-family: "Consolas", "Menlo", monospace;
  font-size: 12px;
  line-height: 1.25;
  text-shadow: 1px 1px 1px #000;
  pointer-events: auto;
}
.land-hud-title {
  color: var(--cyan);
  font-weight: 800;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.land-hud-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 4px;
}
.land-pill {
  padding: 2px 5px;
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.1);
  color: #dcecff;
}
.land-pill.warn { color: #ffe08a; }
.land-pill.danger { color: #ff9b8f; }
.land-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 6px;
}
.land-actions button {
  min-width: 34px;
  height: 23px;
  padding: 0 7px;
  border: 1px solid rgba(255, 255, 255, 0.28);
  border-radius: 3px;
  background: rgba(47, 139, 255, 0.52);
  color: #fff;
  font-family: var(--font-pixel);
  font-size: 12px;
  cursor: pointer;
}
.land-actions button:hover { filter: brightness(1.12); }

#party-hud {
  /* Top-right, below the boss-bar band and clear of the status-effect
     column at the far right edge; the old bottom-left spot sat inside
     the chat log. */
  position: fixed;
  right: 64px;
  top: 72px;
  z-index: 6;
  width: min(255px, 42vw);
  display: grid;
  gap: 4px;
  pointer-events: none;
  font-family: "Consolas", "Menlo", monospace;
  text-shadow: 1px 1px 1px #000;
}
.party-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
  min-height: 24px;
  padding: 4px 7px;
  border: 1px solid rgba(210, 230, 210, 0.22);
  border-radius: 4px;
  background: rgba(12, 16, 22, 0.64);
  color: #fff;
  font-size: 12px;
}
.party-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.party-hearts {
  display: flex;
  gap: 1px;
  align-items: center;
}
.party-hearts.party-hearts-offline {
  color: #9aa7b5;
  font-size: 11px;
}
.party-heart {
  width: 12px;
  height: 12px;
  background-size: contain;
  background-repeat: no-repeat;
  image-rendering: pixelated;
  filter: drop-shadow(1px 1px 0 rgba(0, 0, 0, 0.6));
}
.social-row .party-hearts { margin-top: 3px; }
.party-leader .party-name { color: #ffe08a; }

#social-action-bar {
  position: fixed;
  right: 12px;
  top: 50%;
  z-index: 8;
  display: grid;
  gap: 6px;
  transform: translateY(-50%);
  pointer-events: none;
  opacity: 0.78;
  transition: opacity 0.14s ease, transform 0.14s ease;
}
body.social-cursor-mode #social-action-bar,
#social-action-bar.social-panel-open {
  pointer-events: auto;
  opacity: 1;
}
body.social-cursor-mode #hud { cursor: default; }
body.social-cursor-mode #crosshair { opacity: 0.28; }
.social-action-button {
  width: 42px;
  height: 42px;
  border: 2px solid rgba(210, 230, 210, 0.44);
  border-radius: 6px;
  background:
    linear-gradient(180deg, rgba(41, 47, 55, 0.88), rgba(15, 18, 24, 0.88)),
    rgba(8, 12, 18, 0.86);
  box-shadow: 0 5px 14px rgba(0, 0, 0, 0.38), inset 0 1px 0 rgba(255, 255, 255, 0.18);
  color: #eef8e8;
  font-family: var(--font-pixel);
  font-size: 18px;
  font-weight: 800;
  line-height: 1;
  text-shadow: 1px 1px 1px #000;
  cursor: pointer;
}
.social-action-button:hover,
.social-action-button.active {
  border-color: var(--cyan);
  color: #fff;
  filter: brightness(1.12);
}

#economy-panel,
#land-panel,
#party-panel,
#marketplace-panel,
#trade-panel,
#skills-panel {
  position: fixed;
  right: 64px;
  top: 44px;
  z-index: 9;
  width: min(430px, calc(100vw - 82px));
  max-height: min(72vh, 620px);
  overflow: auto;
  padding: 12px;
  border: 2px solid rgba(210, 230, 210, 0.34);
  border-radius: 6px;
  background: rgba(12, 16, 22, 0.86);
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.38);
  color: #eef8e8;
  font-family: "Consolas", "Menlo", monospace;
  font-size: 12px;
  text-shadow: 1px 1px 1px #000;
  pointer-events: auto;
}
.social-title {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px;
  padding-bottom: 7px;
  color: #cfe8b8;
  font-weight: 800;
  text-transform: uppercase;
}
.social-meta-block {
  margin: 2px 0 8px;
}
.social-list {
  display: grid;
  gap: 5px;
  margin-top: 8px;
}
.social-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
  min-height: 30px;
  padding: 5px 7px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.06);
}
.social-main {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.social-sub { color: #b8c8d9; font-size: 11px; }
.social-actions {
  display: flex;
  gap: 4px;
  align-items: center;
}
.social-actions-wrap {
  flex-wrap: wrap;
  margin-top: 8px;
}
.social-actions button,
.social-command-form button,
.social-command-form input,
.social-command-form select {
  min-width: 32px;
  height: 24px;
  padding: 0 7px;
  border: 1px solid rgba(255, 255, 255, 0.28);
  border-radius: 3px;
  font-family: var(--font-pixel);
  font-size: 12px;
}
.social-actions button,
.social-command-form button {
  background: rgba(47, 139, 255, 0.52);
  color: #fff;
  cursor: pointer;
}
.social-command-form input,
.social-command-form select {
  min-width: 0;
  background: rgba(0, 0, 0, 0.42);
  color: #fff;
  outline: none;
}
.social-command-form input::placeholder { color: rgba(230, 240, 255, 0.6); }
.social-actions button:hover,
.social-command-form button:hover { filter: brightness(1.12); }
.social-close {
  width: 24px;
  min-width: 24px !important;
  padding: 0 !important;
  background: rgba(255, 95, 95, 0.42) !important;
}
.social-form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  margin-top: 8px;
}
.social-command-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 4px;
}
.social-command-form:has(input + input) {
  grid-template-columns: minmax(0, 1fr) minmax(0, 0.72fr) auto;
}
.social-command-form:has(input + input + input) {
  grid-template-columns: minmax(0, 0.9fr) minmax(0, 0.64fr) minmax(0, 0.64fr) auto;
}
.social-empty {
  min-height: 34px;
  padding: 9px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.05);
  color: #b8c8d9;
}
.trade-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  margin-top: 8px;
}
.trade-offer {
  min-width: 0;
  padding: 7px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.06);
}
.trade-offer b {
  display: block;
  color: var(--cyan);
  margin-bottom: 4px;
}

/* Skills panel: one row per profession with a thin XP bar. */
.skill-row {
  grid-template-columns: 26px minmax(0, 1fr) auto;
}
.skill-icon {
  font-size: 16px;
  line-height: 1;
  text-align: center;
}
.skill-copy {
  display: grid;
  gap: 4px;
  min-width: 0;
}
.skill-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
}
.skill-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.skill-level {
  color: #cfe8b8;
  font-weight: 800;
}
.skill-bar {
  height: 5px;
  border-radius: 2px;
  background: rgba(255, 255, 255, 0.12);
  overflow: hidden;
}
.skill-bar-fill {
  display: block;
  height: 100%;
  border-radius: 2px;
  background: linear-gradient(90deg, #6fbf4e, #b3e07a);
}
.skill-xp {
  min-width: 72px;
  color: #b8c8d9;
  font-size: 11px;
  text-align: right;
  white-space: nowrap;
}
.skill-row.skill-max .skill-bar-fill { background: linear-gradient(90deg, #d8a63a, #ffd964); }
.skill-row.skill-max .skill-xp { color: #ffe08a; font-weight: 800; }

@media (max-width: 700px) {
  #social-action-bar {
    left: 50%;
    right: auto;
    top: auto;
    bottom: 122px;
    grid-auto-flow: column;
    grid-template-columns: repeat(6, 38px);
    transform: translateX(-50%);
  }
  .social-action-button {
    width: 38px;
    height: 38px;
  }
  #economy-panel,
  #land-panel,
  #party-panel,
  #marketplace-panel,
  #trade-panel,
  #skills-panel {
    left: 8px;
    right: 8px;
    top: 42px;
    width: auto;
    max-height: 58vh;
  }
  .social-form-grid {
    grid-template-columns: 1fr;
  }
}

/* ---------- Unified inventory / professions / social menu ---------- */
body.game-menu-open #social-action-bar { visibility: hidden; opacity: 0; pointer-events: none; }
.social-action-button {
  position: relative;
  border: 3px solid var(--ink);
  border-radius: 3px;
  background: linear-gradient(180deg, rgba(55, 60, 70, 0.94), rgba(26, 29, 35, 0.94));
  box-shadow: 0 0 0 1px var(--steel), 0 4px 0 rgba(10, 13, 18, 0.72);
  color: #d9e8f5;
  font-weight: 900;
}
.social-action-button.has-alert::after {
  content: "!";
  position: absolute;
  top: -7px;
  right: -7px;
  display: grid;
  place-items: center;
  width: 17px;
  height: 17px;
  border: 2px solid var(--ink);
  border-radius: 50%;
  background: #f1b83b;
  color: #17120a;
  font: 900 10px/1 var(--font-pixel);
  text-shadow: none;
}
.social-action-button:hover,
.social-action-button.active {
  border-color: var(--cyan);
  background: linear-gradient(180deg, var(--blue-lite), var(--blue-dark));
  box-shadow: 0 0 0 1px var(--cyan), 0 4px 0 var(--blue-deep);
  color: #fff;
  filter: none;
}

#game-menu-screen {
  position: fixed;
  inset: 0;
  z-index: 14;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: radial-gradient(circle at 50% 42%, rgba(16, 28, 42, 0.34), rgba(0, 0, 0, 0.58));
  cursor: default;
}
.game-menu-shell {
  position: relative;
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr);
  width: min(980px, calc(100vw - 32px));
  height: min(760px, calc(100dvh - 32px));
  min-height: 0;
  overflow: hidden;
  background:
    linear-gradient(var(--cyan), var(--cyan)) 8px 8px/9px 9px no-repeat,
    linear-gradient(var(--cyan), var(--cyan)) calc(100% - 8px) 8px/9px 9px no-repeat,
    linear-gradient(var(--cyan), var(--cyan)) 8px calc(100% - 8px)/9px 9px no-repeat,
    linear-gradient(var(--cyan), var(--cyan)) calc(100% - 8px) calc(100% - 8px)/9px 9px no-repeat,
    linear-gradient(180deg, #34383f, #22262d);
  border: 4px solid var(--ink);
  border-radius: 4px;
  box-shadow: 0 0 0 4px var(--steel), 0 0 0 7px var(--ink), 0 22px 70px rgba(0, 0, 0, 0.72);
}
.game-menu-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  min-height: 76px;
  padding: 13px 18px 12px;
  border-bottom: 3px solid var(--ink);
  background: linear-gradient(180deg, rgba(60, 66, 77, 0.92), rgba(40, 44, 52, 0.92));
  box-shadow: inset 0 -2px 0 rgba(255, 255, 255, 0.08);
}
.game-menu-brand {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: baseline;
  column-gap: 10px;
  min-width: 0;
  padding-left: 10px;
}
.game-menu-brand strong {
  font-size: 23px;
  line-height: 1;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  text-shadow: 2px 2px 0 var(--blue-deep);
}
.game-menu-brand > span:last-child {
  grid-column: 1 / -1;
  margin-top: 5px;
  color: #b8c8d9;
  font-size: 12px;
  letter-spacing: 0.3px;
}
.game-menu-kicker {
  padding: 3px 6px;
  border: 2px solid var(--cyan);
  background: var(--blue-deep);
  color: #fff;
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 1px;
}
.game-menu-close {
  flex: 0 0 42px;
  width: 42px;
  height: 38px;
  padding: 0 0 3px;
  border: 3px solid var(--ink);
  border-radius: 3px;
  background: linear-gradient(180deg, #d76d5a, #a83f32);
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.35), 0 4px 0 #6d241d;
  color: #fff;
  font: 900 26px/1 var(--font-pixel);
  cursor: pointer;
  text-shadow: 1px 1px 0 #521812;
}
.game-menu-close:hover { filter: brightness(1.12); }
.game-menu-close:active { transform: translateY(2px); box-shadow: 0 2px 0 #6d241d; }
.game-menu-tabs {
  display: flex;
  gap: 5px;
  min-width: 0;
  overflow-x: auto;
  overflow-y: hidden;
  padding: 8px 12px 9px;
  border-bottom: 3px solid var(--ink);
  background: rgba(17, 20, 25, 0.7);
}
.game-menu-tab {
  position: relative;
  display: flex;
  flex: 1 0 auto;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-width: 108px;
  height: 39px;
  padding: 0 11px;
  border: 3px solid var(--ink);
  border-radius: 3px;
  background: linear-gradient(180deg, rgba(56, 61, 71, 0.96), rgba(32, 35, 42, 0.96));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.1), 0 3px 0 #15171b;
  color: #cbd9e6;
  font: 800 12px/1 var(--font-pixel);
  letter-spacing: 0.25px;
  cursor: pointer;
  text-shadow: 1px 1px 0 #000;
}
.game-menu-tab:hover { border-color: var(--steel); color: #fff; }
.game-menu-tab.active {
  border-color: var(--cyan);
  background: linear-gradient(180deg, var(--blue-lite), var(--blue) 55%, var(--blue-dark));
  box-shadow: 0 0 0 1px var(--cyan), inset 0 2px 0 rgba(255, 255, 255, 0.2), 0 3px 0 var(--blue-deep);
  color: #fff;
}
.game-menu-tab-icon { font-size: 16px; line-height: 1; }
.game-menu-tab-badge {
  position: absolute;
  top: -7px;
  right: -6px;
  display: grid;
  place-items: center;
  width: 18px;
  height: 18px;
  border: 2px solid var(--ink);
  border-radius: 50%;
  background: #f1b83b;
  color: #17120a;
  font: 900 11px/1 var(--font-pixel);
  font-style: normal;
  text-shadow: none;
}
.game-menu-content { min-height: 0; overflow: hidden; }
#game-menu-screen .game-menu-pane {
  position: relative;
  inset: auto;
  z-index: auto;
  width: 100%;
  height: 100%;
  min-height: 0;
  max-height: none;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 20px 22px 24px;
  border: 0;
  border-radius: 0;
  background: none;
  box-shadow: none;
  color: #edf6ff;
  font-family: var(--font-pixel);
  font-size: 13px;
  text-shadow: 1px 1px 0 rgba(0, 0, 0, 0.72);
  pointer-events: auto;
}
.game-menu-shell #inventory-screen { display: block; align-items: initial; justify-content: initial; }
.game-menu-shell #inventory-screen .inventory-panel {
  width: min(650px, 100%);
  max-height: none;
  margin: 0 auto;
  overflow: visible;
  padding: 0;
  border: 0;
  background: none;
  box-shadow: none;
}
.game-menu-pane .social-close { display: none; }

.social-title {
  align-items: center;
  gap: 14px;
  min-height: 54px;
  margin-bottom: 14px;
  padding: 0 0 12px;
  border-bottom: 2px solid rgba(107, 112, 121, 0.54);
  color: #fff;
  text-transform: none;
}
.social-title > div:first-child { min-width: 0; }
.social-title > div:first-child > .social-main {
  color: #fff;
  font-size: 22px;
  font-weight: 900;
  letter-spacing: 1px;
  text-transform: uppercase;
  text-shadow: 2px 2px 0 var(--blue-deep);
}
.social-meta-block { margin: 4px 0 12px; }
.social-list { gap: 7px; margin-top: 10px; }
.social-row {
  gap: 10px;
  min-height: 42px;
  padding: 8px 10px;
  border: 2px solid #20242b;
  background: linear-gradient(180deg, rgba(57, 62, 72, 0.7), rgba(37, 41, 49, 0.76));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.07);
}
.social-main { min-width: 0; }
.social-sub { color: #aebed0; font-size: 11px; line-height: 1.35; }
.social-eyebrow { margin-bottom: 4px; color: var(--cyan); font-size: 10px; font-weight: 900; letter-spacing: 1.2px; text-transform: uppercase; }
.social-actions { gap: 6px; }
.social-actions-wrap { margin-top: 10px; }
.social-actions button,
.social-command-form button,
.social-command-form input,
.social-command-form select,
.market-sell-form button,
.market-sell-form input,
.social-search,
.social-select {
  min-width: 32px;
  height: 34px;
  padding: 0 10px;
  border: 2px solid var(--ink);
  border-radius: 3px;
  font-family: var(--font-pixel);
  font-size: 12px;
  font-weight: 800;
}
.social-actions button,
.social-command-form button,
.market-sell-form button {
  background: linear-gradient(180deg, var(--blue-lite), var(--blue-dark));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.18), 0 2px 0 var(--blue-deep);
  color: #fff;
  cursor: pointer;
  text-shadow: 1px 1px 0 rgba(0, 0, 0, 0.55);
}
.social-command-form input,
.social-command-form select,
.market-sell-form input,
.social-search,
.social-select {
  min-width: 0;
  background: rgba(11, 14, 19, 0.82);
  color: #fff;
  outline: none;
  box-shadow: inset 0 0 0 1px rgba(107, 112, 121, 0.5);
}
.social-command-form input::placeholder,
.market-sell-form input::placeholder,
.social-search::placeholder { color: #728092; }
.social-command-form input:focus,
.market-sell-form input:focus,
.social-search:focus,
.social-select:focus { border-color: var(--cyan); }
.social-actions button:hover,
.social-command-form button:hover,
.market-sell-form button:hover { filter: brightness(1.12); }
.social-actions button.secondary { background: linear-gradient(180deg, #515966, #343a44); box-shadow: 0 2px 0 #1b1e24; }
.social-actions button.danger { background: linear-gradient(180deg, #d66a57, #a43c30); box-shadow: 0 2px 0 #651f18; }
.social-actions button.success { background: linear-gradient(180deg, #68b95c, #3d7e36); box-shadow: 0 2px 0 #244e21; }
.social-form-grid { gap: 10px; margin-top: 12px; }
.social-command-form { gap: 6px; }
.social-empty {
  min-height: 48px;
  padding: 13px;
  border: 2px dashed rgba(107, 112, 121, 0.65);
  background: rgba(10, 13, 18, 0.26);
  color: #9eafc1;
}
.social-section-heading { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; margin-top: 16px; }
.social-section-heading .social-main { color: #d8eaf9; font-size: 14px; font-weight: 900; letter-spacing: 0.6px; text-transform: uppercase; }
.social-invite-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 76px;
  margin: 2px 0 14px;
  padding: 13px 15px;
  border: 3px solid #cca43a;
  border-radius: 4px;
  background: linear-gradient(90deg, rgba(199, 151, 38, 0.18), transparent 60%), linear-gradient(180deg, rgba(60, 56, 45, 0.92), rgba(38, 37, 34, 0.94));
  box-shadow: inset 0 1px 0 rgba(255, 235, 165, 0.18), 0 3px 0 rgba(52, 38, 12, 0.7);
}
.social-invite-card.is-empty { border-color: #303641; background: linear-gradient(180deg, rgba(47, 52, 61, 0.72), rgba(31, 35, 42, 0.76)); box-shadow: none; }
.social-card-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin-top: 16px; }
.social-tool-card,
.market-sell-card { min-width: 0; padding: 13px; border: 2px solid #20242b; border-radius: 4px; background: rgba(20, 24, 30, 0.46); box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05); }
.social-tool-card .social-section-heading,
.market-sell-card .social-section-heading { display: grid; gap: 3px; margin: 0 0 10px; }
.social-footer-actions { justify-content: flex-end; padding-top: 10px; border-top: 2px solid rgba(107, 112, 121, 0.34); }
.status-chip { display: inline-flex; align-items: center; min-height: 20px; padding: 2px 6px; border: 1px solid rgba(255, 255, 255, 0.14); border-radius: 3px; background: rgba(0, 0, 0, 0.28); color: #b7c5d4; font-size: 10px; font-weight: 900; text-transform: uppercase; }
.status-chip.ready { border-color: rgba(99, 203, 105, 0.55); color: #9eeaa3; }
.status-chip.waiting { border-color: rgba(235, 188, 68, 0.55); color: #f4d47a; }
.status-chip.muted { color: #8793a0; }

/* Party */
.party-member-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.party-member-card { grid-template-columns: 40px minmax(0, 1fr); }
.party-member-card.is-offline { opacity: 0.62; }
.party-avatar { display: grid; place-items: center; width: 38px; height: 38px; border: 2px solid var(--ink); border-radius: 3px; background: linear-gradient(145deg, var(--blue), var(--blue-deep)); box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.2); color: #fff; font-size: 17px; font-weight: 900; }
.party-member-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.party-member-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 900; }
.party-member-card .party-hearts { margin-top: 6px; }
/* Friends roster rows carry a trailing Remove action as a third column. */
.friend-card { grid-template-columns: 40px minmax(0, 1fr) auto; }

/* Marketplace / auction house */
.market-layout { display: grid; grid-template-columns: 170px minmax(0, 1fr); gap: 16px; min-width: 0; }
.market-category-rail { align-self: start; display: grid; gap: 6px; padding: 12px; border: 2px solid var(--ink); border-radius: 4px; background: rgba(15, 18, 23, 0.54); box-shadow: inset 0 0 0 1px rgba(107, 112, 121, 0.34); }
.market-category-rail .social-section-heading { display: grid; gap: 2px; margin: 0 0 6px; }
.market-category-button { display: grid; grid-template-columns: 22px minmax(0, 1fr); align-items: center; gap: 7px; min-height: 36px; padding: 6px 8px; border: 2px solid transparent; border-radius: 3px; background: rgba(57, 62, 72, 0.52); color: #b9c8d7; font: 800 11px/1.1 var(--font-pixel); text-align: left; cursor: pointer; }
.market-category-button > span:first-child { color: var(--cyan); font-size: 15px; text-align: center; }
.market-category-button:hover { border-color: var(--steel); color: #fff; }
.market-category-button.active { border-color: var(--cyan); background: linear-gradient(180deg, var(--blue), var(--blue-dark)); color: #fff; }
.market-main { min-width: 0; }
.market-toolbar { display: grid; grid-template-columns: minmax(160px, 1fr) 180px; gap: 8px; margin-bottom: 12px; }
.market-list-heading { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 6px; }
.market-list-heading .social-main { color: #d8eaf9; font-weight: 900; text-transform: uppercase; }
.market-table-head,
.market-result-row { display: grid; grid-template-columns: minmax(205px, 1.7fr) minmax(86px, 0.75fr) 86px 62px minmax(154px, 1.15fr); gap: 9px; align-items: center; }
.market-table-head { min-height: 28px; padding: 0 10px; color: #8292a3; font-size: 10px; font-weight: 900; letter-spacing: 0.6px; text-transform: uppercase; }
.market-results { display: grid; gap: 5px; }
.market-result-row { min-height: 60px; padding: 6px 9px; border: 2px solid #20242b; border-radius: 4px; background: linear-gradient(180deg, rgba(58, 63, 73, 0.72), rgba(37, 41, 49, 0.78)); box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.07); }
.market-result-row:hover { border-color: #526171; background: linear-gradient(180deg, rgba(67, 74, 87, 0.78), rgba(41, 47, 57, 0.82)); }
.market-result-row.is-owned { border-color: rgba(95, 224, 255, 0.4); }
.market-result-row.search-hidden { display: none; }
.market-item-cell { display: flex; align-items: center; gap: 9px; min-width: 0; }
.market-item-cell canvas,
.trade-item-icon canvas { flex: 0 0 42px; width: 42px; height: 42px; image-rendering: pixelated; border: 2px solid var(--ink); border-radius: 3px; background: rgba(0, 0, 0, 0.3); }
.market-seller-cell,
.market-price-cell,
.market-quantity-cell { color: #c5d2de; font-size: 12px; }
.market-price-cell { color: #f3d578; font-weight: 900; }
.market-quantity-cell { text-align: center; }
.market-buyout-cell { justify-content: flex-end; }
.market-buyout-cell button { padding: 0 8px; font-size: 10px; }
.market-sell-card { margin-top: 14px; }
.market-sell-form { display: grid; grid-template-columns: minmax(90px, 0.7fr) minmax(90px, 0.7fr) minmax(110px, 1fr) auto; gap: 8px; align-items: end; }
.social-field { display: grid; gap: 4px; min-width: 0; }
.social-field > span { color: #92a2b3; font-size: 10px; font-weight: 900; letter-spacing: 0.4px; text-transform: uppercase; }

/* Drag-to-sell / drag-to-list grids (wallet + marketplace) */
.sell-section { margin: 12px 0 4px; }
.sell-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(56px, 1fr));
  gap: 6px;
  max-height: 210px;
  overflow-y: auto;
  padding: 6px;
  border: 2px solid #20242b;
  border-radius: 4px;
  background: rgba(12, 15, 20, 0.5);
}
.sell-tile {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  aspect-ratio: 1;
  padding: 2px;
  border: 2px solid #2b323c;
  border-radius: 4px;
  background: rgba(28, 33, 41, 0.85);
  cursor: grab;
  transition: border-color 0.1s ease, transform 0.05s ease;
}
.sell-tile:hover { border-color: var(--cyan); }
.sell-tile:active { cursor: grabbing; }
.sell-tile.is-dragging { opacity: 0.45; }
.sell-tile.is-staged { border-color: #f6c945; box-shadow: 0 0 0 1px #f6c945 inset; }
.sell-tile canvas { width: 100%; height: 100%; image-rendering: pixelated; pointer-events: none; }
.sell-tile-count {
  position: absolute; right: 2px; bottom: 1px;
  font-family: var(--font-pixel); font-size: 11px; font-weight: 700;
  color: #fff; text-shadow: 1px 1px 0 #000; pointer-events: none;
}
.sell-tile-value {
  position: absolute; left: 2px; top: 1px;
  font-size: 9px; font-weight: 900; color: #f6c945;
  text-shadow: 1px 1px 0 #000; pointer-events: none;
}
.sell-tray {
  margin-top: 8px; padding: 10px;
  border: 2px dashed #3a424d; border-radius: 4px;
  background: rgba(20, 24, 30, 0.4);
  transition: border-color 0.1s ease, background 0.1s ease;
}
.sell-tray.drag-over { border-color: var(--cyan); background: rgba(95, 224, 255, 0.08); }
.sell-tray.is-empty { display: flex; align-items: center; justify-content: center; min-height: 52px; }
.sell-tray-hint { color: #92a2b3; font-size: 12px; letter-spacing: 0.3px; }
.sell-tray-item { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.sell-tray-item canvas { width: 44px; height: 44px; image-rendering: pixelated; flex: 0 0 auto; }
.sell-tray-controls { display: flex; flex-wrap: wrap; gap: 8px; align-items: end; }
.sell-tray-controls .social-field { flex: 1 1 90px; }
.sell-tray-total { flex-basis: 100%; color: #f6c945; font-size: 12px; font-weight: 700; }
.sell-tray-submit { flex: 1 1 100%; }

/* Trade */
.trade-grid { gap: 12px; margin-top: 10px; }
.trade-offer { min-width: 0; padding: 13px; border: 3px solid #2e75b8; border-radius: 4px; background: linear-gradient(145deg, rgba(35, 63, 88, 0.62), rgba(27, 32, 39, 0.82)); box-shadow: inset 0 1px 0 rgba(138, 205, 255, 0.14); }
.trade-offer.partner-offer { border-color: #8c6eb2; background: linear-gradient(145deg, rgba(70, 49, 89, 0.54), rgba(29, 28, 37, 0.84)); }
.trade-offer-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding-bottom: 10px; border-bottom: 1px solid rgba(255, 255, 255, 0.1); }
.trade-offer-head > .social-main { font-weight: 900; text-transform: uppercase; }
.trade-offer-content { display: flex; align-items: center; gap: 12px; min-height: 78px; padding-top: 12px; }
.trade-item-icon { display: grid; flex: 0 0 58px; place-items: center; width: 58px; height: 58px; border: 2px solid var(--ink); border-radius: 4px; background: rgba(0, 0, 0, 0.3); color: #6f7a86; font-size: 24px; }
.trade-item-icon canvas { width: 54px; height: 54px; border: 0; }
.trade-money { margin-top: 6px; color: #f3d578; font-size: 15px; font-weight: 900; }
.trade-tool-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.trade-request-tool { margin-bottom: 14px; }
.trade-flow { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 14px; }
.trade-flow > div { display: flex; align-items: center; justify-content: center; gap: 7px; min-height: 38px; border: 2px solid #252a32; background: rgba(15, 18, 23, 0.42); }
.trade-step-number { display: grid; place-items: center; width: 22px; height: 22px; border: 2px solid var(--cyan); background: var(--blue-deep); color: #fff; font-weight: 900; }

/* Professions */
.skills-summary { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 16px; }
.skills-summary > div { padding: 12px; border: 2px solid #20242b; border-radius: 4px; background: rgba(15, 18, 23, 0.44); text-align: center; }
.skills-summary-value { color: var(--cyan); font-size: 23px; font-weight: 900; line-height: 1; text-shadow: 2px 2px 0 var(--blue-deep); }
.skills-group + .skills-group { margin-top: 18px; }
.skills-group > .social-section-heading { margin-top: 0; }
.skill-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.skill-row { grid-template-columns: 38px minmax(0, 1fr) auto; min-height: 68px; padding: 9px 11px; }
.skill-icon { display: grid; place-items: center; width: 34px; height: 34px; border: 2px solid #1c2026; border-radius: 3px; background: rgba(13, 17, 22, 0.5); font-size: 19px; }
.skill-level { color: var(--cyan); font-weight: 900; }
.skill-bar { height: 8px; border: 2px solid #15181d; background: rgba(0, 0, 0, 0.38); }
.skill-bar-fill { background: linear-gradient(180deg, var(--cyan), var(--blue)); box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.28); }
.skill-xp { min-width: 76px; color: #aebed0; font-size: 10px; }
.skill-progress-label { color: #7f90a2; font-size: 9px; }

@media (max-width: 820px) {
  .game-menu-shell { width: calc(100vw - 20px); height: calc(100dvh - 20px); }
  .game-menu-header { min-height: 64px; padding: 10px 12px; }
  .game-menu-brand strong { font-size: 19px; }
  #game-menu-screen .game-menu-pane { padding: 16px; }
  .market-layout { grid-template-columns: 1fr; }
  .market-category-rail { display: flex; gap: 5px; overflow-x: auto; }
  .market-category-rail > .social-section-heading { display: none; }
  .market-category-button { flex: 0 0 auto; min-width: 118px; }
  .market-table-head { display: none; }
  .market-result-row { grid-template-columns: minmax(180px, 1fr) 80px minmax(150px, auto); }
  .market-seller-cell,
  .market-quantity-cell { display: none; }
  .skill-list { grid-template-columns: 1fr; }
}

@media (max-width: 700px) {
  .touch-device #social-action-bar { pointer-events: auto; opacity: 1; }
  .game-menu-tabs { padding-inline: 8px; }
  .game-menu-tab { flex: 0 0 auto; min-width: 100px; height: 36px; }
  .social-form-grid,
  .social-card-grid,
  .party-member-list,
  .trade-tool-grid { grid-template-columns: 1fr; }
  .market-toolbar { grid-template-columns: 1fr; }
  .market-sell-form { grid-template-columns: 1fr 1fr; }
  .trade-grid { grid-template-columns: 1fr; }
}

@media (max-width: 500px) {
  #game-menu-screen { padding: 7px; }
  .game-menu-shell { width: calc(100vw - 14px); height: calc(100dvh - 14px); }
  .game-menu-brand { padding-left: 5px; }
  .game-menu-brand > span:last-child,
  .game-menu-kicker { display: none; }
  .game-menu-brand strong { grid-column: 1 / -1; font-size: 18px; }
  .game-menu-close { width: 38px; flex-basis: 38px; height: 34px; }
  #game-menu-screen .game-menu-pane { padding: 12px 10px 18px; }
  .social-title > div:first-child > .social-main { font-size: 18px; }
  .social-title .social-actions { display: none; }
  .social-invite-card { align-items: stretch; flex-direction: column; }
  .market-result-row { grid-template-columns: minmax(0, 1fr) auto; }
  .market-price-cell { display: none; }
  .market-buyout-cell { flex-direction: column; align-items: stretch; }
  .market-sell-form { grid-template-columns: 1fr; }
  .trade-flow { grid-template-columns: 1fr; }
  .skills-summary { gap: 5px; }
  .skills-summary > div { padding: 8px 4px; }
  .skills-summary-value { font-size: 18px; }
}

#chat-log {
  position: fixed;
  left: 8px;
  bottom: 96px;
  width: min(420px, 60vw);
  max-height: 30vh;
  overflow-y: auto;
  font-size: 14px;
  text-shadow: 1px 1px 2px #000;
  z-index: 5;
  pointer-events: none;
  scrollbar-width: none;
  -ms-overflow-style: none;
}
#chat-log::-webkit-scrollbar { display: none; width: 0; height: 0; }
#chat-log div { padding: 1px 0; }
#chat-log div.chat-pending { color: #f6f6f6; }
#chat-log div.chat-delayed { color: #ffe08a; }
#chat-log div.chat-rejected { color: #ff9b8f; opacity: 0.88; }

#chat-input {
  position: fixed;
  left: 8px;
  bottom: 70px;
  width: min(420px, 60vw);
  font-size: 15px;
  padding: 8px 10px;
  border: none;
  border-radius: 4px;
  background: rgba(0, 0, 0, 0.7);
  color: #fff;
  outline: none;
  z-index: 12;
}

/* ---------- Inventory ---------- */
#inventory-screen {
  position: fixed;
  inset: 0;
  z-index: 14;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.28);
}
#furnace-screen,
#chest-screen {
  position: fixed;
  inset: 0;
  z-index: 14;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.28);
}

.inventory-panel,
.furnace-panel,
.chest-panel {
  /* Slot size scales down on narrow screens so 9 columns always fit a phone. */
  --inv-slot: clamp(28px, calc((100vw - 96px) / 9), 52px);
  --inv-gap: 4px;
  width: min(560px, 94vw);
  max-height: min(92dvh, 760px);
  overflow-y: auto;
  overscroll-behavior: contain;
  background:
    linear-gradient(var(--cyan), var(--cyan)) 7px 7px/8px 8px no-repeat,
    linear-gradient(var(--cyan), var(--cyan)) calc(100% - 7px) 7px/8px 8px no-repeat,
    linear-gradient(var(--cyan), var(--cyan)) 7px calc(100% - 7px)/8px 8px no-repeat,
    linear-gradient(var(--cyan), var(--cyan)) calc(100% - 7px) calc(100% - 7px)/8px 8px no-repeat,
    linear-gradient(180deg, #2f333b, #23262c);
  border: 4px solid var(--ink);
  box-shadow: 0 0 0 4px var(--steel), 0 0 0 7px var(--ink), 0 16px 48px rgba(0, 0, 0, 0.55);
  border-radius: 4px;
  padding: 20px;
}

.furnace-row {
  display: flex;
  align-items: center;
  gap: 14px;
}
.furnace-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}
.furnace-header .inventory-label { margin: 0; }
.furnace-recipes-button {
  min-height: 32px;
  padding: 5px 10px;
  border: 2px solid var(--ink);
  border-radius: 3px;
  background: linear-gradient(180deg, var(--blue-lite), var(--blue-dark));
  color: #fff;
  box-shadow: 0 0 0 1px rgba(95, 224, 255, 0.5), 0 3px 0 var(--blue-deep);
  font: 900 10px/1.15 var(--font-pixel);
  text-shadow: 1px 1px 0 #12355f;
  cursor: pointer;
}
.furnace-recipes-button:hover:not(:disabled) { border-color: var(--cyan); filter: brightness(1.1); }
.furnace-recipes-button:disabled {
  background: linear-gradient(180deg, #4b535e, #303640);
  color: #89949f;
  box-shadow: 0 2px 0 #171a1f;
  cursor: not-allowed;
}
.furnace-inputs {
  display: grid;
  gap: 6px;
}
.furnace-meters {
  display: grid;
  gap: 8px;
  width: 96px;
}
.furnace-bar {
  height: 10px;
  border: 2px solid #11141a;
  background: rgba(0, 0, 0, 0.38);
  border-radius: 4px;
  overflow: hidden;
}
.furnace-bar span {
  display: block;
  height: 100%;
  background: #d98a36;
}
.furnace-bar.cook span { background: #d9e8cf; }
.furnace-inventory { margin-top: 16px; }
.chest-grid { margin-bottom: 14px; }

.inventory-section + .inventory-section { margin-top: 14px; }

.inventory-section-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
}

.inventory-gold {
  font-family: var(--font-pixel);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 1px;
  color: #f6c945;
  text-shadow: 1px 1px 1px #000;
  white-space: nowrap;
}

.inventory-label {
  font-family: var(--font-pixel);
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--cyan);
  margin: 0 0 6px;
  text-shadow: 1px 1px 1px #000;
}

.inventory-body {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

/* Minecraft-style top row: armour | player doll | crafting. */
.inventory-top {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  flex-wrap: wrap;
}

.craft-cluster {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 4px;
}

.armor-column {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  min-width: var(--inv-slot, 52px);
}

.armor-grid {
  display: grid;
  grid-template-columns: var(--inv-slot, 52px);
  gap: 6px;
}

.armor-slot .slot-num {
  font-size: 11px;
  color: rgba(255, 255, 255, 0.45);
}

/* Minecraft-style 3D player doll between the armour slots and crafting grid.
   Height tracks the 4 armour slots so the doll stays proportionate at any slot size. */
.player-preview {
  flex: 0 0 96px;
  width: 96px;
  height: calc(var(--inv-slot, 52px) * 4 + 24px);
  border-radius: 6px;
  background: linear-gradient(180deg, rgba(95, 224, 255, 0.10), rgba(10, 13, 18, 0.35));
  border: 1px solid rgba(95, 224, 255, 0.18);
  box-shadow: inset 0 0 18px rgba(0, 0, 0, 0.45);
  overflow: hidden;
}

.player-preview-canvas {
  display: block;
  width: 100%;
  height: 100%;
  cursor: grab;
  touch-action: none;
}

.player-preview-canvas.grabbing {
  cursor: grabbing;
}

.craft-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

.craft-grid {
  display: grid;
  grid-template-columns: repeat(2, var(--inv-slot, 52px)); /* JS overrides count for craftSize */
  gap: var(--inv-gap, 4px);
}

.craft-arrow {
  width: 24px;
  text-align: center;
  font-family: monospace;
  font-size: 22px;
  color: var(--cyan);
  text-shadow: 1px 1px 1px #000;
}

.recipe-book {
  display: grid;
  gap: 6px;
  margin-top: 10px;
}

.recipe-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.recipe-toolbar .inventory-label {
  margin: 0;
}

.recipe-search {
  flex: 1 1 120px;
  min-width: 0;
  height: 28px;
  padding: 0 8px;
  border: 2px solid #2a2d34;
  border-radius: 4px;
  background: rgba(10, 12, 16, 0.72);
  color: #f2ffe8;
  font-size: 12px;
  font-weight: 700;
  outline: none;
}

.recipe-toggle {
  height: 28px;
  min-width: 84px;
  padding: 0 10px;
  border: 2px solid #2a2d34;
  border-radius: 4px;
  background: rgba(46, 58, 70, 0.92);
  color: #f2ffe8;
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
  text-shadow: 1px 1px 1px #000;
}

.recipe-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.recipe-tab {
  height: 24px;
  padding: 0 8px;
  border: 2px solid #2a2d34;
  border-radius: 4px;
  background: rgba(30, 34, 40, 0.78);
  color: #cfe2f5;
  font-size: 11px;
  font-weight: 800;
  cursor: pointer;
  text-shadow: 1px 1px 1px #000;
}
.recipe-tab.active {
  background: linear-gradient(180deg, var(--blue), var(--blue-dark));
  color: #fff;
  border-color: var(--cyan);
}

.recipe-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  max-height: 112px;
  overflow-y: auto;
}

.recipe-button {
  position: relative;
  width: 124px;
  height: 38px;
  padding: 2px 8px 2px 4px;
  border: 2px solid #2a2d34;
  border-radius: 4px;
  background: linear-gradient(180deg, rgba(47, 72, 104, 0.85), rgba(34, 52, 78, 0.85));
  color: #eef4ff;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 5px;
  text-shadow: 1px 1px 1px #000;
}
.recipe-button canvas {
  width: 30px;
  height: 30px;
  flex: 0 0 30px;
  image-rendering: pixelated;
}
.recipe-button span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.recipe-button b {
  position: absolute;
  left: 26px;
  bottom: 1px;
  font-family: monospace;
  font-size: 11px;
  color: #fff;
  text-shadow: 1px 1px 0 #000;
}
.recipe-button.locked {
  opacity: 0.5;
  background: rgba(48, 52, 58, 0.72);
  cursor: default;
}
/* Expansion recipe with unmet station/profession requirements: greyed out but
   still clickable so the "Requires ..." toast can explain what is missing. */
.recipe-button.req-locked {
  opacity: 0.55;
  cursor: pointer;
}
.recipe-button.req-locked:hover { opacity: 0.8; }
.recipe-lock {
  position: absolute;
  right: 2px;
  top: 1px;
  font-size: 10px;
  font-style: normal;
  line-height: 1;
  filter: grayscale(0.3) drop-shadow(1px 1px 0 rgba(0, 0, 0, 0.7));
}
.recipe-button.search-hidden { display: none; }
.recipe-button:hover,
.recipe-toggle:hover,
.recipe-tab:hover { border-color: var(--cyan); }

.creative-mode {
  width: min(640px, 94vw);
}

.creative-pane {
  display: grid;
  gap: 8px;
  margin-top: 12px;
}

.creative-toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
}

.creative-toolbar .inventory-label {
  margin: 0;
}

.creative-search {
  flex: 1 1 180px;
  min-width: 0;
  height: 30px;
  padding: 0 9px;
  border: 2px solid #2a2d34;
  border-radius: 4px;
  background: rgba(10, 12, 16, 0.76);
  color: #f2ffe8;
  font-size: 12px;
  font-weight: 800;
  outline: none;
}

.creative-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.creative-tab {
  height: 26px;
  padding: 0 9px;
  border: 2px solid #2a2d34;
  border-radius: 4px;
  background: rgba(30, 34, 40, 0.84);
  color: #cfe2f5;
  font-size: 11px;
  font-weight: 900;
  cursor: pointer;
  text-shadow: 1px 1px 1px #000;
}

.creative-tab.active {
  background: linear-gradient(180deg, #c57f46, #8b4d28);
  color: #fff7e8;
  border-color: #ffd18f;
}

.creative-grid {
  display: grid;
  grid-template-columns: repeat(9, var(--inv-slot, 52px));
  gap: var(--inv-gap, 4px);
  max-height: calc(var(--inv-slot, 52px) * 4 + var(--inv-gap, 4px) * 3);
  overflow-y: auto;
  padding-right: 4px;
}

.creative-item.search-hidden { display: none; }
.creative-item:hover,
.creative-tab:hover { border-color: var(--cyan); }

.inventory-grid {
  display: grid;
  grid-template-columns: repeat(9, var(--inv-slot, 52px));
  gap: var(--inv-gap, 4px);
}

.inventory-hotbar { margin-top: 10px; }

.inv-slot {
  position: relative;
  width: var(--inv-slot, 52px);
  height: var(--inv-slot, 52px);
  background: rgba(0, 0, 0, 0.35);
  border: 2px solid #2a2d34;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 0;
  touch-action: manipulation;
  user-select: none;
}
.inv-slot:hover { border-color: var(--cyan); }
/* Minecraft-style instant item tooltip */
.inv-tooltip {
  position: fixed;
  z-index: 1200;
  display: none;
  pointer-events: none;
  max-width: min(360px, calc(100vw - 16px));
  padding: 6px 10px;
  background: rgba(12, 8, 22, 0.94);
  border: 2px solid #5a3aa0;
  border-radius: 3px;
  color: #f3f3f6;
  font-size: 14px;
  line-height: 1.35;
  white-space: pre-wrap;
  overflow-wrap: break-word;
  text-shadow: 1px 1px 0 #000;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.55);
}
.inv-tooltip.show { display: block; }
.inv-slot.selected { border-color: #fff; box-shadow: 0 0 0 2px #fff inset; }
.inv-slot canvas {
  width: calc(var(--inv-slot, 52px) - 12px);
  height: calc(var(--inv-slot, 52px) - 12px);
  image-rendering: pixelated;
}

/* ---------- Workbench / profession stations ---------- */
#workbench-screen {
  position: fixed;
  inset: 0;
  z-index: 16;
  display: grid;
  place-items: center;
  padding: clamp(10px, 2vw, 24px);
  overflow: hidden;
  background:
    radial-gradient(circle at 50% 34%, rgba(47, 139, 255, 0.16), transparent 48%),
    rgba(4, 7, 11, 0.72);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
}

.workbench-panel {
  --inv-slot: clamp(34px, 3vw, 50px);
  --inv-gap: clamp(3px, 0.35vw, 5px);
  --workbench-green: #66dc89;
  --workbench-green-dark: #153d2a;
  --workbench-red: #ff746e;
  --workbench-red-dark: #431d22;
  --workbench-amber: #ffd067;
  position: relative;
  width: min(1180px, calc(100vw - clamp(24px, 4vw, 56px)));
  height: min(880px, calc(100dvh - clamp(20px, 4vh, 48px)));
  min-height: 0;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  overflow: hidden;
  color: #f3f8ff;
  text-align: left;
  background:
    linear-gradient(var(--cyan), var(--cyan)) 8px 8px/8px 8px no-repeat,
    linear-gradient(var(--cyan), var(--cyan)) calc(100% - 8px) 8px/8px 8px no-repeat,
    linear-gradient(var(--cyan), var(--cyan)) 8px calc(100% - 8px)/8px 8px no-repeat,
    linear-gradient(var(--cyan), var(--cyan)) calc(100% - 8px) calc(100% - 8px)/8px 8px no-repeat,
    repeating-linear-gradient(0deg, rgba(255, 255, 255, 0.018) 0 1px, transparent 1px 4px),
    linear-gradient(180deg, #313640 0%, #20242c 100%);
  border: 4px solid var(--ink);
  border-radius: 4px;
  box-shadow:
    0 0 0 3px var(--steel),
    0 0 0 7px var(--ink),
    0 24px 70px rgba(0, 0, 0, 0.7),
    inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

.workbench-header {
  min-height: 66px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 10px 14px 10px 18px;
  border-bottom: 4px solid var(--ink);
  background:
    linear-gradient(90deg, rgba(95, 224, 255, 0.14), transparent 44%),
    linear-gradient(180deg, #3b424e, #2a2f38);
  box-shadow: inset 0 -2px 0 rgba(107, 112, 121, 0.55);
}

.workbench-heading {
  min-width: 0;
  display: grid;
  gap: 1px;
}

.workbench-kicker {
  color: var(--cyan);
  font-size: 10px;
  font-weight: 900;
  line-height: 1;
  letter-spacing: 2.2px;
  text-transform: uppercase;
  text-shadow: 1px 1px 0 #000;
}

.workbench-title {
  min-width: 0;
  overflow: hidden;
  color: #fff;
  font-size: clamp(22px, 2vw, 32px);
  font-weight: 900;
  line-height: 1.05;
  letter-spacing: 1px;
  text-overflow: ellipsis;
  text-shadow: 3px 3px 0 var(--blue-deep);
  white-space: nowrap;
}

.workbench-close {
  width: 42px;
  height: 42px;
  flex: 0 0 42px;
  padding: 0 0 4px;
  border: 3px solid var(--ink);
  border-radius: 2px;
  background: linear-gradient(180deg, #66717f, #39414d 58%, #2b3039);
  color: #fff;
  box-shadow:
    0 0 0 2px rgba(107, 112, 121, 0.72),
    inset 0 2px 0 rgba(255, 255, 255, 0.18),
    0 4px 0 #14171c;
  font: 900 28px/1 var(--font-pixel);
  text-shadow: 2px 2px 0 #111;
  cursor: pointer;
}

.workbench-close:hover {
  border-color: var(--cyan);
  color: var(--cyan);
}

.workbench-close:active {
  transform: translateY(3px);
  box-shadow: 0 0 0 2px rgba(107, 112, 121, 0.72), 0 1px 0 #14171c;
}

.workbench-layout {
  min-width: 0;
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(260px, 0.7fr) minmax(520px, 1.3fr);
  gap: 10px;
  padding: 12px;
  overflow: hidden;
}

.workbench-workspace {
  min-width: 0;
  min-height: 0;
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  gap: 10px;
  overflow: hidden;
}

.workbench-workspace.workbench-grid-workspace {
  grid-template-rows: auto minmax(0, 1fr);
}

.workbench-pane {
  min-width: 0;
  min-height: 0;
  padding: 13px;
  overflow: hidden;
  border: 2px solid #11151b;
  border-top-color: #596370;
  border-radius: 3px;
  background:
    linear-gradient(135deg, rgba(95, 224, 255, 0.045), transparent 32%),
    linear-gradient(180deg, rgba(28, 34, 42, 0.97), rgba(17, 21, 27, 0.97));
  box-shadow:
    inset 0 0 0 1px rgba(107, 112, 121, 0.28),
    0 3px 0 rgba(7, 9, 12, 0.82);
}

.workbench-recipes-pane {
  display: flex;
  flex-direction: column;
  border-top-color: var(--blue-lite);
}

.workbench-crafting-pane {
  display: flex;
  flex-direction: column;
  border-top-color: var(--cyan);
}

.workbench-inventory-pane {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  border-top-color: #a7b5c6;
}

.workbench-section-heading {
  flex: 0 0 auto;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  margin: 0 0 10px;
  padding: 0 0 7px;
  border-bottom: 2px solid rgba(95, 224, 255, 0.22);
}

.workbench-section-title {
  color: #fff;
  font-size: 15px;
  font-weight: 900;
  line-height: 1;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  text-shadow: 2px 2px 0 #000;
}

.workbench-section-subtitle {
  min-width: 0;
  overflow: hidden;
  color: #93a8ba;
  font-size: 10px;
  font-weight: 700;
  line-height: 1.2;
  text-align: right;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.workbench-recipe-book {
  min-height: 0;
  height: 100%;
  display: grid;
  grid-template-rows: auto auto auto minmax(0, 1fr);
  gap: 8px;
}

.workbench-recipe-book > .workbench-section-heading {
  margin-bottom: 0;
}

.workbench-recipe-toolbar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 6px;
}

.workbench-recipe-search {
  width: 100%;
  min-width: 0;
  height: 34px;
  padding: 0 9px;
  outline: 0;
  border: 2px solid #080b10;
  border-radius: 2px;
  background: #0c1016;
  color: #f2f7ff;
  box-shadow: inset 0 0 0 1px #333b46, inset 0 3px 7px rgba(0, 0, 0, 0.65);
  font: 700 11px/1 var(--font-pixel);
  user-select: text;
}

.workbench-recipe-search::placeholder { color: #748596; }
.workbench-recipe-search::-webkit-search-cancel-button { filter: invert(1); }
.workbench-recipe-search:focus {
  border-color: var(--cyan);
  box-shadow: inset 0 0 0 1px var(--blue), 0 0 0 1px rgba(95, 224, 255, 0.35);
}

.workbench-recipe-toggle,
.workbench-recipe-tab {
  border: 2px solid #0a0d12;
  border-radius: 2px;
  background: linear-gradient(180deg, #414a57, #272d36);
  color: #d9e7f5;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.13), 0 2px 0 #0a0d12;
  font-family: var(--font-pixel);
  font-weight: 900;
  text-shadow: 1px 1px 0 #000;
  cursor: pointer;
}

.workbench-recipe-toggle {
  min-width: 82px;
  height: 34px;
  padding: 0 10px;
  font-size: 11px;
}

.workbench-recipe-toggle.active,
.workbench-recipe-tab.active {
  border-color: var(--cyan);
  background: linear-gradient(180deg, var(--blue-lite), var(--blue-dark));
  color: #fff;
  box-shadow: inset 0 2px 0 rgba(255, 255, 255, 0.2), 0 2px 0 var(--blue-deep);
}

.workbench-recipe-toggle:hover,
.workbench-recipe-tab:hover { border-color: var(--cyan); }

.workbench-recipe-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.workbench-recipe-tab {
  min-height: 27px;
  padding: 3px 8px;
  font-size: 10px;
}

.workbench-recipe-list {
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 2px 5px 4px 2px;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.workbench-recipe-card {
  position: relative;
  width: 100%;
  min-height: 58px;
  flex: 0 0 auto;
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr);
  align-items: center;
  gap: 9px;
  padding: 6px 10px 6px 7px;
  overflow: hidden;
  border: 2px solid #0a0d12;
  border-radius: 2px;
  background:
    linear-gradient(90deg, rgba(47, 139, 255, 0.12), transparent 54%),
    linear-gradient(180deg, #303844, #222831);
  color: #e8f1fa;
  box-shadow: inset 4px 0 0 #536170, inset 0 1px 0 rgba(255, 255, 255, 0.1), 0 2px 0 #090c10;
  font-family: var(--font-pixel);
  text-align: left;
  cursor: pointer;
}

.workbench-recipe-card:hover {
  border-color: var(--cyan);
  filter: brightness(1.08);
}

.workbench-recipe-card.craftable {
  background:
    linear-gradient(90deg, rgba(102, 220, 137, 0.16), transparent 62%),
    linear-gradient(180deg, #30443d, #202e2a);
  box-shadow: inset 4px 0 0 var(--workbench-green), inset 0 1px 0 rgba(255, 255, 255, 0.1), 0 2px 0 #090c10;
}

.workbench-recipe-card.missing {
  background:
    linear-gradient(90deg, rgba(255, 116, 110, 0.1), transparent 62%),
    linear-gradient(180deg, #39343a, #27252b);
  box-shadow: inset 4px 0 0 #9a5657, inset 0 1px 0 rgba(255, 255, 255, 0.07), 0 2px 0 #090c10;
}

.workbench-recipe-card.req-locked {
  background:
    linear-gradient(90deg, rgba(255, 208, 103, 0.12), transparent 62%),
    linear-gradient(180deg, #3b382f, #292720);
  box-shadow: inset 4px 0 0 var(--workbench-amber), inset 0 1px 0 rgba(255, 255, 255, 0.08), 0 2px 0 #090c10;
}

.workbench-recipe-card.selected {
  z-index: 1;
  border-color: var(--cyan);
  color: #fff;
  box-shadow:
    inset 5px 0 0 var(--cyan),
    inset 0 0 0 1px var(--blue),
    0 0 0 2px rgba(95, 224, 255, 0.28),
    0 2px 0 #090c10;
}

.workbench-recipe-card.loaded::after {
  content: "GRID";
  position: absolute;
  top: 4px;
  right: 5px;
  padding: 2px 4px;
  border: 1px solid var(--cyan);
  background: #123c54;
  color: #bdf5ff;
  font-size: 8px;
  font-weight: 900;
  letter-spacing: 0.7px;
  text-shadow: 1px 1px 0 #000;
}

.workbench-recipe-card.search-hidden { display: none; }

.workbench-recipe-icon {
  position: relative;
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border: 2px solid #090c10;
  background: rgba(4, 7, 10, 0.5);
  box-shadow: inset 0 0 0 1px #3d4652;
}

.workbench-recipe-icon canvas {
  width: 36px;
  height: 36px;
  image-rendering: pixelated;
  filter: drop-shadow(2px 2px 0 rgba(0, 0, 0, 0.58));
}

.workbench-recipe-copy {
  min-width: 0;
  display: grid;
  gap: 3px;
}

.workbench-recipe-name {
  overflow: hidden;
  color: inherit;
  font-size: 12px;
  font-weight: 900;
  line-height: 1.15;
  text-overflow: ellipsis;
  text-shadow: 1px 1px 0 #000;
  white-space: nowrap;
}

.workbench-recipe-status {
  overflow: hidden;
  color: #a7b4c1;
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.25px;
  line-height: 1.2;
  text-overflow: ellipsis;
  text-transform: uppercase;
  white-space: nowrap;
}

.workbench-recipe-card.craftable .workbench-recipe-status { color: var(--workbench-green); }
.workbench-recipe-card.missing .workbench-recipe-status { color: #ff9b96; }
.workbench-recipe-card.req-locked .workbench-recipe-status { color: var(--workbench-amber); }
.workbench-recipe-card.loaded .workbench-recipe-status { color: var(--cyan); }

.workbench-recipe-result-count {
  position: absolute;
  left: 35px;
  bottom: 5px;
  min-width: 15px;
  padding: 0 2px;
  color: #fff;
  font: 900 11px/1.2 monospace;
  text-align: center;
  text-shadow: 1px 1px 0 #000, -1px 1px 0 #000, 1px -1px 0 #000;
}

.workbench-recipe-empty,
.workbench-detail-empty,
.workbench-detail-note {
  color: #8fa2b4;
  font-size: 11px;
  line-height: 1.45;
}

.workbench-recipe-empty {
  padding: 18px 12px;
  border: 2px dashed #3b4652;
  text-align: center;
}

.workbench-grid-area {
  flex: 0 0 auto;
  margin-bottom: 10px;
  padding: 12px;
  border: 2px solid #0b0e13;
  background:
    linear-gradient(90deg, transparent 49%, rgba(95, 224, 255, 0.03) 50%, transparent 51%),
    linear-gradient(0deg, transparent 49%, rgba(95, 224, 255, 0.03) 50%, transparent 51%),
    rgba(5, 8, 12, 0.46);
  box-shadow: inset 0 0 0 1px rgba(107, 112, 121, 0.23);
}

.workbench-grid-area.workbench-grid-hidden { display: none !important; }

.workbench-craft-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: clamp(10px, 1.4vw, 18px);
}

.workbench-craft-grid {
  display: grid;
  gap: var(--inv-gap);
}

.workbench-panel .inv-slot {
  width: var(--inv-slot);
  height: var(--inv-slot);
  flex: 0 0 var(--inv-slot);
  border: 2px solid #0a0d12;
  border-radius: 1px;
  background: linear-gradient(135deg, rgba(64, 73, 85, 0.72), rgba(9, 12, 17, 0.76));
  box-shadow:
    inset 2px 2px 0 rgba(130, 142, 156, 0.36),
    inset -2px -2px 0 rgba(0, 0, 0, 0.4);
}

.workbench-panel button.inv-slot:hover {
  z-index: 1;
  border-color: var(--cyan);
  box-shadow:
    inset 2px 2px 0 rgba(130, 142, 156, 0.36),
    inset -2px -2px 0 rgba(0, 0, 0, 0.4),
    0 0 0 1px rgba(95, 224, 255, 0.5);
}

.workbench-panel .inv-slot.selected {
  border-color: #fff;
  box-shadow: inset 0 0 0 2px var(--cyan), 0 0 7px rgba(95, 224, 255, 0.72);
}

.workbench-panel .inv-slot canvas {
  width: calc(var(--inv-slot) - 10px);
  height: calc(var(--inv-slot) - 10px);
  image-rendering: pixelated;
  filter: drop-shadow(2px 2px 0 rgba(0, 0, 0, 0.55));
}

.workbench-panel .workbench-craft-slot.workbench-ghost-slot {
  border-color: #626b75;
  background:
    repeating-linear-gradient(135deg, rgba(190, 200, 211, 0.055) 0 4px, transparent 4px 8px),
    linear-gradient(135deg, rgba(52, 58, 66, 0.72), rgba(13, 16, 21, 0.82));
  box-shadow:
    inset 2px 2px 0 rgba(165, 176, 187, 0.2),
    inset -2px -2px 0 rgba(0, 0, 0, 0.48);
}

.workbench-panel .workbench-ghost-slot canvas {
  opacity: 0.36;
  filter: grayscale(1) contrast(0.72) drop-shadow(1px 1px 0 rgba(0, 0, 0, 0.7));
}

.workbench-panel .workbench-ghost-slot .slot-count { opacity: 0.5; }

.workbench-craft-output {
  border-color: var(--cyan) !important;
  background:
    radial-gradient(circle, rgba(95, 224, 255, 0.15), transparent 66%),
    linear-gradient(135deg, #263b49, #10171e) !important;
  box-shadow:
    inset 0 0 0 2px rgba(47, 139, 255, 0.5),
    0 0 10px rgba(95, 224, 255, 0.24) !important;
}

.workbench-craft-arrow {
  width: 28px;
  flex: 0 0 28px;
  color: var(--cyan);
  font: 900 28px/1 monospace;
  text-align: center;
  text-shadow: 2px 2px 0 var(--blue-deep), 0 0 8px rgba(95, 224, 255, 0.5);
}

.workbench-recipe-detail {
  min-height: 0;
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  gap: 11px;
  padding-right: 3px;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.workbench-detail-empty {
  min-height: 124px;
  display: grid;
  place-items: center;
  padding: 20px;
  border: 2px dashed #3b4652;
  background: rgba(4, 7, 10, 0.28);
  text-align: center;
}

.workbench-detail-result {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  padding: 9px;
  border: 2px solid #102534;
  border-left: 4px solid var(--cyan);
  background: linear-gradient(90deg, rgba(47, 139, 255, 0.16), rgba(13, 18, 24, 0.62));
  box-shadow: inset 0 0 0 1px rgba(95, 224, 255, 0.1);
}

.workbench-detail-result-icon,
.workbench-ingredient-icon {
  cursor: default;
}

.workbench-detail-result-copy,
.workbench-ingredient-copy {
  min-width: 0;
  display: grid;
}

.workbench-detail-result-copy { gap: 2px; }

.workbench-detail-eyebrow {
  color: var(--cyan);
  font-size: 9px;
  font-weight: 900;
  letter-spacing: 1px;
  text-transform: uppercase;
}

.workbench-detail-name {
  overflow: hidden;
  color: #fff;
  font-size: 15px;
  line-height: 1.15;
  text-overflow: ellipsis;
  text-shadow: 1px 1px 0 #000;
  white-space: nowrap;
}

.workbench-detail-yield {
  color: #aebdca;
  font-size: 10px;
  line-height: 1.3;
}

.workbench-detail-section {
  display: grid;
  gap: 6px;
}

.workbench-detail-heading {
  color: #cfeaff;
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 1px;
  line-height: 1;
  text-transform: uppercase;
  text-shadow: 1px 1px 0 #000;
}

.workbench-ingredient-list,
.workbench-requirement-list {
  display: grid;
  gap: 5px;
}

.workbench-ingredient {
  min-width: 0;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  padding: 6px 7px;
  border: 2px solid #15201b;
  border-left-width: 4px;
  background: rgba(8, 13, 13, 0.58);
}

.workbench-ingredient.met {
  border-color: #19452d;
  border-left-color: var(--workbench-green);
  background: linear-gradient(90deg, rgba(102, 220, 137, 0.13), rgba(8, 13, 13, 0.48));
}

.workbench-ingredient.missing {
  border-color: #4a2326;
  border-left-color: var(--workbench-red);
  background: linear-gradient(90deg, rgba(255, 116, 110, 0.13), rgba(16, 9, 11, 0.52));
}

.workbench-ingredient-icon {
  --inv-slot: clamp(34px, 3vw, 42px);
}

.workbench-ingredient-name {
  overflow: hidden;
  color: #f3f7fb;
  font-size: 11px;
  font-weight: 900;
  line-height: 1.2;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.workbench-ingredient-owned {
  color: #8fa0af;
  font: 700 9px/1.25 var(--font-pixel);
}

.workbench-ingredient.met .workbench-ingredient-owned { color: #93cfa6; }
.workbench-ingredient.missing .workbench-ingredient-owned { color: #e6a19e; }

.workbench-ingredient-state {
  min-width: 62px;
  font-size: 9px;
  line-height: 1.15;
  text-align: right;
  text-transform: uppercase;
}

.workbench-ingredient.met .workbench-ingredient-state { color: var(--workbench-green); }
.workbench-ingredient.missing .workbench-ingredient-state { color: var(--workbench-red); }

.workbench-requirement-list {
  grid-template-columns: repeat(auto-fit, minmax(128px, 1fr));
}

.workbench-requirement {
  min-width: 0;
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr);
  align-items: center;
  gap: 6px;
  padding: 7px;
  border: 2px solid #28323d;
  background: #151b22;
}

.workbench-requirement.met {
  border-color: #286040;
  background: linear-gradient(90deg, rgba(102, 220, 137, 0.14), #151b22 62%);
}

.workbench-requirement.missing {
  border-color: #6a3032;
  background: linear-gradient(90deg, rgba(255, 116, 110, 0.15), #1d171b 62%);
}

.workbench-requirement-marker {
  width: 23px;
  height: 23px;
  display: grid;
  place-items: center;
  border: 2px solid currentColor;
  color: #aab7c3;
  font-size: 13px;
  font-weight: 900;
  line-height: 1;
}

.workbench-requirement.met .workbench-requirement-marker { color: var(--workbench-green); }
.workbench-requirement.missing .workbench-requirement-marker { color: var(--workbench-red); }

.workbench-requirement-copy {
  min-width: 0;
  display: grid;
  gap: 2px;
}

.workbench-requirement-copy strong {
  overflow: hidden;
  color: #f3f7fb;
  font-size: 10px;
  line-height: 1.15;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.workbench-requirement-copy span {
  overflow: hidden;
  color: #8999a8;
  font-size: 8px;
  line-height: 1.2;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.workbench-recipe-actions {
  flex: 0 0 auto;
  display: grid;
  gap: 7px;
  margin-top: 10px;
  padding-top: 9px;
  border-top: 2px solid rgba(95, 224, 255, 0.2);
}

.workbench-action-hint {
  min-height: 27px;
  display: flex;
  align-items: center;
  padding: 5px 8px;
  border: 1px solid #34404b;
  background: rgba(5, 8, 12, 0.5);
  color: #9aaaba;
  font-size: 9px;
  font-weight: 800;
  line-height: 1.25;
}

.workbench-action-hint.ready {
  border-color: #2c6845;
  color: var(--workbench-green);
}

.workbench-action-hint.blocked {
  border-color: #683336;
  color: #ffaaa5;
}

.workbench-action-buttons {
  display: flex;
  gap: 7px;
}

.workbench-action-button {
  min-width: 0;
  min-height: 38px;
  flex: 1 1 0;
  padding: 7px 12px;
  border: 3px solid var(--ink);
  border-radius: 2px;
  background: linear-gradient(180deg, var(--blue-lite), var(--blue) 55%, var(--blue-dark));
  color: #fff;
  box-shadow:
    0 0 0 1px rgba(95, 224, 255, 0.55),
    inset 0 2px 0 rgba(255, 255, 255, 0.22),
    0 4px 0 var(--blue-deep);
  font: 900 11px/1.15 var(--font-pixel);
  letter-spacing: 0.35px;
  text-shadow: 1px 1px 0 #12355f;
  cursor: pointer;
}

.workbench-action-button:hover:not(:disabled) {
  border-color: var(--cyan);
  filter: brightness(1.1);
}

.workbench-action-button:active:not(:disabled) {
  transform: translateY(3px);
  box-shadow: 0 0 0 1px rgba(95, 224, 255, 0.55), 0 1px 0 var(--blue-deep);
}

.workbench-action-button:disabled {
  border-color: #14171c;
  background: linear-gradient(180deg, #49515b, #303640);
  color: #828e9a;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08), 0 3px 0 #14171c;
  text-shadow: 1px 1px 0 #171a1f;
  cursor: not-allowed;
}

.workbench-craft-max {
  background: linear-gradient(180deg, #49bedd, #2585bd 55%, #195b91);
}

.workbench-inventory {
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding-top: 2px;
  overflow: hidden;
}

.workbench-inventory-grid {
  width: max-content;
  grid-template-columns: repeat(9, var(--inv-slot));
  gap: var(--inv-gap);
}

.workbench-inventory-hotbar {
  position: relative;
  margin-top: 8px;
}

.workbench-inventory-hotbar::before {
  content: "HOTBAR";
  position: absolute;
  left: 0;
  bottom: calc(100% + 4px);
  color: #758797;
  font-size: 8px;
  font-weight: 900;
  letter-spacing: 1px;
  line-height: 1;
}

.workbench-panel :is(
  .workbench-close,
  .workbench-recipe-toggle,
  .workbench-recipe-tab,
  .workbench-recipe-card,
  .workbench-action-button,
  button.inv-slot
):focus-visible {
  outline: 2px solid #fff;
  outline-offset: 2px;
}

:is(.workbench-layout, .workbench-recipe-list, .workbench-recipe-detail) {
  scrollbar-width: thin;
  scrollbar-color: var(--blue) var(--stone-dark);
}

:is(.workbench-layout, .workbench-recipe-list, .workbench-recipe-detail)::-webkit-scrollbar {
  width: 9px;
  height: 9px;
}

:is(.workbench-layout, .workbench-recipe-list, .workbench-recipe-detail)::-webkit-scrollbar-track {
  border: 2px solid var(--ink);
  background: var(--stone-dark);
}

:is(.workbench-layout, .workbench-recipe-list, .workbench-recipe-detail)::-webkit-scrollbar-thumb {
  border: 2px solid var(--ink);
  background: linear-gradient(180deg, var(--blue-lite), var(--blue-dark));
}

@media (max-width: 1120px) {
  .workbench-panel {
    --inv-slot: clamp(38px, calc((100vw - 96px) / 9), 48px);
    width: 100%;
    height: 100%;
  }

  .workbench-layout {
    grid-template-columns: minmax(230px, 0.68fr) minmax(490px, 1.32fr);
  }

  .workbench-inventory-pane { height: max-content; }
}

@media (max-width: 760px) {
  #workbench-screen { padding: 6px; }

  .workbench-panel {
    --inv-slot: clamp(24px, calc((100vw - 76px) / 9), 44px);
    --inv-gap: clamp(2px, 0.6vw, 3px);
    width: calc(100vw - 12px);
    height: calc(100dvh - 12px);
    box-shadow: 0 0 0 2px var(--steel), 0 0 0 5px var(--ink), 0 18px 44px rgba(0, 0, 0, 0.7);
  }

  .workbench-header {
    min-height: 56px;
    padding: 8px 9px 8px 12px;
  }

  .workbench-close {
    width: 37px;
    height: 37px;
    flex-basis: 37px;
    font-size: 24px;
  }

  .workbench-layout {
    grid-template-columns: minmax(0, 1fr);
    grid-auto-rows: max-content;
    align-content: start;
    gap: 8px;
    padding: 8px;
  }

  .workbench-workspace {
    grid-template-rows: max-content max-content;
    overflow: visible;
  }

  .workbench-workspace.workbench-grid-workspace {
    grid-template-rows: max-content max-content;
  }

  .workbench-pane { padding: 10px; }

  .workbench-recipes-pane,
  .workbench-crafting-pane {
    display: block;
    height: auto;
    min-height: 0;
    max-height: none;
  }

  .workbench-recipe-book {
    height: auto;
    display: flex;
    flex-direction: column;
  }

  .workbench-recipe-list {
    height: min(42dvh, 310px);
    min-height: 150px;
    max-height: min(42dvh, 310px);
    flex: 0 0 auto;
  }

  .workbench-recipe-detail {
    min-height: 0;
    flex: 0 0 auto;
    max-height: none;
    overflow: visible;
  }

  .workbench-craft-row { gap: 9px; }
  .workbench-craft-arrow { width: 22px; flex-basis: 22px; font-size: 23px; }
}

@media (max-width: 430px) {
  .workbench-kicker { display: none; }
  .workbench-title { font-size: 20px; }
  .workbench-section-subtitle { display: none; }
  .workbench-recipe-toggle { min-width: 76px; padding-inline: 7px; }

  .workbench-ingredient {
    grid-template-columns: auto minmax(0, 1fr);
  }

  .workbench-ingredient-state {
    grid-column: 2;
    min-width: 0;
    text-align: left;
  }

  .workbench-action-button { padding-inline: 7px; font-size: 10px; }
}

@media (max-height: 600px) and (min-width: 761px) {
  .workbench-panel { height: 100%; }
  .workbench-header { min-height: 52px; padding-block: 6px; }
  .workbench-layout { padding: 8px; }
  .workbench-pane { padding: 9px; }
}

#cursor-stack {
  position: fixed;
  z-index: 30;
  width: 52px;
  height: 52px;
  transform: translate(-18px, -18px);
  pointer-events: none;
}
#cursor-stack canvas {
  width: 48px;
  height: 48px;
  image-rendering: pixelated;
  filter: drop-shadow(2px 2px 0 rgba(0, 0, 0, 0.6));
}

/* ---------- Toast / hint ---------- */
#toast {
  position: fixed;
  left: 50%;
  bottom: 120px;
  transform: translateX(-50%);
  background: rgba(0, 0, 0, 0.62);
  color: #fff;
  font-size: 15px;
  padding: 8px 16px;
  border-radius: 6px;
  white-space: nowrap;
  z-index: 6;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.18s;
  text-shadow: 1px 1px 2px #000;
}
#toast.show { opacity: 1; }

#captions {
  position: fixed;
  right: 14px;
  bottom: calc(116px + env(safe-area-inset-bottom, 0px));
  z-index: 6;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
  max-width: min(320px, calc(100vw - 28px));
  pointer-events: none;
}
.caption-line {
  max-width: 100%;
  padding: 4px 8px;
  color: #fff;
  background: rgba(0, 0, 0, 0.62);
  border-radius: 2px;
  font: 15px/1.2 monospace;
  text-align: right;
  text-shadow: 2px 2px 0 #000;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ---------- Survival stats ---------- */
#stats {
  position: fixed;
  left: 50%;
  bottom: 76px;
  transform: translateX(-50%);
  width: 360px;
  z-index: 5;
  pointer-events: none;
}
.statrow {
  display: flex;
  justify-content: space-between;
}
.iconbar {
  display: flex;
  gap: 1px;
}
#air-bar {
  justify-content: flex-end;
  margin-bottom: 3px;
  min-height: 18px;
}
#armor-bar {
  margin-bottom: 2px;
  min-height: 18px;
  visibility: hidden;
}
.iconbar .icon {
  width: 18px;
  height: 18px;
  background-size: contain;
  background-repeat: no-repeat;
  image-rendering: pixelated;
  filter: drop-shadow(1px 1px 0 rgba(0, 0, 0, 0.6));
}
#hunger-bar {
  flex-direction: row-reverse; /* food drains from the inside out, like Minecraft */
}
#xp-wrap {
  position: relative;
  width: 100%;
  height: 16px;
  margin-top: 3px;
}
#xp-bar {
  position: absolute;
  left: 5px;
  right: 5px;
  bottom: 0;
  height: 6px;
  border: 2px solid rgba(0, 0, 0, 0.78);
  background: #1a1b21;
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.12), inset 0 0 0 1px #111;
}
#xp-fill {
  width: 0%;
  height: 100%;
  background: linear-gradient(180deg, #d7ff75 0%, #7bd629 45%, #398a16 100%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.35);
}
#xp-level {
  position: absolute;
  left: 50%;
  bottom: 5px;
  transform: translateX(-50%);
  min-width: 18px;
  text-align: center;
  color: #b8ff4f;
  font: 700 18px var(--font-pixel);
  text-shadow: 2px 2px 0 #15220b, -1px -1px 0 #15220b, 1px -1px 0 #15220b, -1px 1px 0 #15220b;
  opacity: 0;
}
#xp-level.show { opacity: 1; }

#status-effects {
  position: fixed;
  top: calc(58px + env(safe-area-inset-top, 0px));
  right: 14px;
  z-index: 6;
  display: flex;
  flex-direction: column;
  gap: 6px;
  pointer-events: none;
}
.status-effect {
  width: 42px;
  min-height: 48px;
  padding: 3px 2px 2px;
  border: 2px solid rgba(0, 0, 0, 0.78);
  background: rgba(17, 19, 24, 0.78);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.16), 2px 2px 0 rgba(0, 0, 0, 0.35);
}
.status-effect-icon {
  display: block;
  width: 24px;
  height: 24px;
  margin: 0 auto 1px;
  background-size: contain;
  background-repeat: no-repeat;
  image-rendering: pixelated;
  filter: drop-shadow(1px 1px 0 rgba(0, 0, 0, 0.75));
}
.status-effect-level,
.status-effect-time {
  display: block;
  min-height: 10px;
  color: #fff;
  font: 700 10px/1 var(--font-pixel);
  text-align: center;
  text-shadow: 1px 1px 0 #000;
}
.status-effect-regeneration { border-color: rgba(220, 82, 92, 0.85); }
.status-effect-absorption { border-color: rgba(245, 198, 73, 0.9); }
.status-effect-hunger { border-color: rgba(119, 170, 78, 0.88); }
.status-effect-poison { border-color: rgba(93, 196, 95, 0.9); }
.status-effect-fear {
  border-color: rgba(224, 79, 91, 0.94);
  background: linear-gradient(145deg, rgba(91, 25, 42, 0.94), rgba(28, 12, 24, 0.95));
}
.status-effect-petrify {
  border-color: rgba(190, 190, 177, 0.94);
  background: linear-gradient(145deg, rgba(79, 82, 77, 0.94), rgba(28, 30, 29, 0.94));
  box-shadow: inset 1px 1px 0 rgba(235, 232, 216, 0.2), inset -2px -2px 0 rgba(0, 0, 0, 0.28), 2px 2px 0 rgba(0, 0, 0, 0.42);
}

#damage-flash {
  position: fixed;
  inset: 0;
  z-index: 4;
  pointer-events: none;
  background: radial-gradient(circle, rgba(120, 0, 0, 0) 45%, rgba(160, 0, 0, 0.55) 100%);
  opacity: 0;
  transition: opacity 0.12s;
}
#damage-flash.show { opacity: 1; }

/* Spell feedback vignette: quick screen-edge pulse when the local player is
   healed (green) or a shadow lifesteal lands (violet). */
#spell-vignette {
  position: fixed;
  inset: 0;
  z-index: 4;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.55s ease;
}
#spell-vignette.show { opacity: 1; transition: opacity 0.1s ease; }
#spell-vignette.heal {
  background: radial-gradient(circle, rgba(74, 222, 128, 0) 52%, rgba(110, 231, 160, 0.38) 100%);
}
#spell-vignette.drain {
  background: radial-gradient(circle, rgba(109, 40, 217, 0) 50%, rgba(139, 92, 246, 0.45) 100%);
}
#damage-flash.burning {
  background:
    radial-gradient(circle at 50% 55%, rgba(255, 120, 12, 0.08) 0 28%, rgba(255, 70, 0, 0.26) 55%, rgba(115, 14, 0, 0.55) 100%),
    repeating-linear-gradient(90deg, rgba(255, 136, 0, 0.08) 0 5px, rgba(255, 44, 0, 0.04) 5px 13px);
  opacity: 0.72;
}
#damage-flash.burning.show { opacity: 1; }
#damage-flash.petrified {
  background:
    radial-gradient(circle at 50% 48%, rgba(80, 83, 78, 0.02) 0 26%, rgba(69, 72, 68, 0.22) 56%, rgba(28, 30, 29, 0.82) 100%),
    repeating-linear-gradient(132deg, rgba(221, 219, 207, 0.07) 0 3px, rgba(28, 30, 29, 0.05) 3px 11px),
    repeating-linear-gradient(38deg, transparent 0 19px, rgba(204, 201, 188, 0.08) 20px 22px, transparent 23px 39px);
  opacity: 0.84;
  transition: opacity 0.18s;
}
#damage-flash.petrified.show { opacity: 0.94; }
#damage-flash.feared:not(.petrified) {
  background:
    radial-gradient(circle at 50% 48%, rgba(74, 0, 20, 0.02) 0 30%, rgba(96, 8, 33, 0.3) 62%, rgba(20, 2, 13, 0.78) 100%),
    repeating-radial-gradient(circle at 50% 48%, transparent 0 28px, rgba(235, 65, 76, 0.06) 30px 33px, transparent 35px 52px);
  opacity: 0.72;
  animation: fear-vignette-pulse 0.34s ease-in-out infinite alternate;
}
@keyframes fear-vignette-pulse {
  from { opacity: 0.58; }
  to { opacity: 0.82; }
}

#death { background: rgba(60, 0, 0, 0.55); z-index: 20; }
#respawn-btn {
  display: block;
  width: 100%;
  font-family: var(--font-pixel);
  font-size: 18px;
  padding: 13px 14px;
  margin-top: 14px;
  border-radius: 4px;
  border: 3px solid var(--ink);
  background: linear-gradient(180deg, var(--blue-lite), var(--blue) 55%, var(--blue-dark));
  color: #fff;
  font-weight: 700;
  letter-spacing: 1px;
  text-shadow: 1px 1px 0 rgba(0, 0, 0, 0.4);
  cursor: pointer;
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.5), inset 0 2px 0 rgba(255, 255, 255, 0.25), 0 5px 0 var(--blue-deep);
}
#respawn-btn:hover { filter: brightness(1.08); }
#respawn-btn:active { transform: translateY(3px); box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.5), 0 2px 0 var(--blue-deep); }

.settings-panel {
  width: min(700px, 95vw);
  max-height: 90vh;
  overflow-y: auto;
  overflow-x: hidden;
}

/* ---- Tabbed settings layout ---- */
.settings-layout { display: flex; gap: 16px; text-align: left; min-height: 320px; }
.settings-tabs { display: flex; flex-direction: column; gap: 8px; flex: 0 0 154px; }
.settings-tab {
  font-family: var(--font-pixel);
  font-size: 14px;
  letter-spacing: 1px;
  text-align: left;
  padding: 12px 12px;
  color: #cfe2f5;
  cursor: pointer;
  background: linear-gradient(180deg, rgba(40, 44, 52, 0.95), rgba(28, 31, 38, 0.95));
  border: 3px solid var(--ink);
  border-radius: 4px;
}
.settings-tab:hover { border-color: var(--steel); }
.settings-tab.active {
  color: #fff;
  text-shadow: 1px 1px 0 rgba(0, 0, 0, 0.4);
  background: linear-gradient(180deg, var(--blue-lite), var(--blue) 55%, var(--blue-dark));
  border-color: var(--cyan);
  box-shadow: 0 0 0 1px var(--cyan), inset 0 2px 0 rgba(255, 255, 255, 0.25);
}
.settings-content { flex: 1 1 auto; min-width: 0; }
.settings-pane { display: none; }
.settings-pane.active { display: grid; gap: 12px; align-content: start; }
.settings-pane label {
  display: grid;
  grid-template-columns: 92px 1fr 60px;
  align-items: center;
  gap: 10px;
  min-height: 34px;
  font-size: 13px;
}
.settings-pane label > span,
.settings-pane b {
  font-family: var(--font-pixel);
  color: #cfe2f5;
  text-shadow: 1px 1px 1px #000;
}
.settings-pane .setting-check { grid-template-columns: 1fr 26px; }
.settings-pane .setting-pack { grid-template-columns: 70px minmax(0, 1fr) 70px; }
.settings-pane input[type="range"] { width: 100%; accent-color: var(--blue); }
.settings-pane input[type="checkbox"] { width: 22px; height: 22px; accent-color: var(--blue); justify-self: end; }
.keybind-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.keybind-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 118px;
  align-items: center;
  gap: 8px;
  color: #cfe2f5;
  font: 700 12px var(--font-pixel);
  text-shadow: 1px 1px 1px #000;
}
.settings-panel button.keybind-button { height: 34px; padding: 0 8px; font-size: 12px; }
.settings-panel button.keybind-button.listening { border-color: var(--cyan); filter: brightness(1.12); }
.settings-panel button.keybind-reset { grid-column: 1 / -1; height: 36px; font-size: 12px; }
@media (max-width: 560px) { .keybind-grid { grid-template-columns: 1fr; } }
.pause-controls { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin: 0; }
.settings-actions { display: flex; gap: 12px; margin-top: 18px; }
.settings-actions button { flex: 1 1 0; }
.settings-panel::-webkit-scrollbar { width: 10px; }
.settings-panel::-webkit-scrollbar-track { background: rgba(0, 0, 0, 0.3); }
.settings-panel::-webkit-scrollbar-thumb { background: var(--steel); border-radius: 4px; }

.settings-panel h1 {
  font-size: 34px;
  letter-spacing: 4px;
}

.settings-panel button,
.settings-panel select {
  width: 100%;
  height: 42px;
  border-radius: 4px;
  border: 3px solid var(--ink);
  color: #fff;
  font-family: var(--font-pixel);
  font-weight: 700;
  letter-spacing: 1px;
  cursor: pointer;
}

.settings-panel button {
  background: linear-gradient(180deg, var(--blue-lite), var(--blue) 55%, var(--blue-dark));
  text-shadow: 1px 1px 0 rgba(0, 0, 0, 0.4);
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.45), inset 0 2px 0 rgba(255, 255, 255, 0.22), 0 4px 0 var(--blue-deep);
}
.settings-panel button:hover { filter: brightness(1.08); }
.settings-panel button:active { transform: translateY(2px); }

.settings-panel input[type="text"] {
  width: 100%;
  min-width: 0;
  height: 42px;
  border-radius: 4px;
  border: 3px solid var(--ink);
  background: var(--stone-dark);
  color: #f4f7ef;
  font: 700 12px var(--font-pixel);
  padding: 0 10px;
  box-shadow: inset 0 0 0 2px var(--stone-lite);
}

.settings-panel select {
  background: var(--stone-dark);
  box-shadow: inset 0 0 0 2px var(--stone-lite);
  padding: 0 10px;
}

.settings-grid {
  display: grid;
  gap: 10px;
  margin: 16px 0;
}

.settings-grid label {
  display: grid;
  grid-template-columns: 86px 1fr 78px;
  align-items: center;
  gap: 10px;
  min-height: 34px;
  font-size: 13px;
  text-align: left;
}

.settings-grid label > span,
.settings-grid b {
  font-family: var(--font-pixel);
  color: #cfe2f5;
  text-shadow: 1px 1px 1px #000;
}

.settings-grid input[type="range"] {
  width: 100%;
  accent-color: var(--blue);
}

.settings-grid input[type="checkbox"] {
  width: 20px;
  height: 20px;
  accent-color: var(--blue);
}

.settings-grid .setting-check {
  grid-template-columns: 86px 1fr 78px;
}

.settings-grid .setting-pack {
  grid-template-columns: 86px minmax(0, 1fr) 78px;
}

.settings-grid .setting-pack button {
  height: 42px;
  font-size: 12px;
  padding: 0 8px;
}

.setting-pack-status {
  min-height: 28px;
  padding: 6px 8px;
  border: 1px solid rgba(217, 232, 207, 0.22);
  border-radius: 4px;
  background: rgba(10, 12, 16, 0.72);
  color: #d9e8cf;
  font: 700 12px monospace;
  line-height: 1.35;
  overflow-wrap: anywhere;
  text-shadow: 1px 1px 1px #000;
}

.pack-status-label {
  color: #b8c8ae;
  font-size: 11px;
  text-transform: uppercase;
}

.pack-status-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 4px;
  padding-top: 6px;
}

.pack-status-heading {
  display: flex;
  gap: 8px;
  align-items: baseline;
  min-width: 0;
}

.pack-status-heading strong {
  min-width: 0;
  overflow: hidden;
  color: #f4f7ef;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pack-status-heading span {
  flex: 0 0 auto;
  color: #96aa8e;
  font-size: 11px;
}

.pack-status-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.pack-status-badge {
  padding: 2px 5px;
  border: 1px solid rgba(217, 232, 207, 0.18);
  border-radius: 3px;
  background: rgba(120, 185, 87, 0.13);
  color: #d9e8cf;
  font-size: 11px;
  line-height: 1.2;
}

.pack-status-issues-label {
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid rgba(217, 232, 207, 0.16);
}

.pack-status-error .pack-status-badge {
  border-color: rgba(255, 112, 112, 0.35);
  background: rgba(190, 42, 42, 0.18);
  color: #ffd7d7;
}

.pack-status-warning .pack-status-badge {
  border-color: rgba(255, 213, 112, 0.35);
  background: rgba(196, 140, 35, 0.18);
  color: #ffe4a8;
}

.pack-status-message {
  color: #d9e8cf;
  font-size: 11px;
  font-weight: 700;
}

.pack-source-links {
  display: grid;
  gap: 4px;
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid rgba(217, 232, 207, 0.16);
}

.pack-source-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
}

.pack-source-row span {
  overflow: hidden;
  color: #f4f7ef;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pack-source-actions {
  display: flex;
  gap: 6px;
}

.pack-source-actions a {
  color: #cfe8b8;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.slot-count {
  position: absolute;
  bottom: 0;
  right: 2px;
  z-index: 4;
  font-size: 13px;
  font-family: monospace;
  font-weight: bold;
  color: #fff;
  text-shadow: 1px 1px 0 #000, -1px 1px 0 #000, 1px -1px 0 #000, -1px -1px 0 #000;
}

.durability {
  position: absolute;
  left: 5px;
  right: 5px;
  bottom: 4px;
  z-index: 4;
  height: 4px;
  background: rgba(30, 12, 10, 0.85);
  border: 1px solid rgba(0, 0, 0, 0.75);
  pointer-events: none;
}
.durability span {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, #c43d31, #e4c84b, #4fc45d);
}

#hotbar {
  --hotbar-slot-size: min(52px, calc((100vw - 36px) / 9));
  --hotbar-gap: clamp(1px, 0.7vw, 4px);
  --hotbar-pad: clamp(3px, 0.9vw, 5px);
  position: fixed;
  left: 50%;
  bottom: 14px;
  transform: translateX(-50%);
  display: flex;
  gap: var(--hotbar-gap);
  max-width: calc(100vw - 8px);
  padding: var(--hotbar-pad);
  background: linear-gradient(180deg, rgba(30, 33, 39, 0.82), rgba(18, 20, 25, 0.85));
  border: 2px solid var(--ink);
  box-shadow: 0 0 0 2px rgba(107, 112, 121, 0.6);
  border-radius: 4px;
  z-index: 5;
}
#selected-item-name {
  position: fixed;
  left: 50%;
  bottom: calc(82px + env(safe-area-inset-bottom, 0px));
  z-index: 6;
  transform: translateX(-50%);
  max-width: min(360px, calc(100vw - 24px));
  padding: 4px 10px;
  background: rgba(14, 12, 20, 0.72);
  color: #f5f5f5;
  border-radius: 2px;
  font: 18px/1.2 monospace;
  text-align: center;
  text-shadow: 2px 2px 0 #000;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  pointer-events: none;
  opacity: 0;
  transition: opacity 120ms linear;
}
#selected-item-name.show { opacity: 1; }
.slot {
  --slot-size: var(--hotbar-slot-size, 52px);
  position: relative;
  width: var(--slot-size);
  height: var(--slot-size);
  flex: 0 0 var(--slot-size);
  background: rgba(0, 0, 0, 0.35);
  border: 2px solid #2a2d34;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}
.slot canvas {
  position: relative;
  z-index: 1;
  width: calc(var(--slot-size) - 12px);
  height: calc(var(--slot-size) - 12px);
  image-rendering: pixelated;
}
.slot-cooldown {
  position: absolute;
  inset: 4px;
  z-index: 2;
  border-radius: 2px;
  background: linear-gradient(180deg, rgba(7, 10, 17, 0.78), rgba(10, 15, 24, 0.62));
  box-shadow: inset 0 -2px 0 rgba(153, 232, 255, 0.72);
  opacity: 0;
  pointer-events: none;
  transform: scaleY(0);
  transform-origin: top center;
  will-change: transform;
}
.slot-cooldown.active { opacity: 1; }
.slot:hover { border-color: var(--cyan); }
.slot.selected { border-color: #fff; box-shadow: 0 0 0 2px #fff inset, 0 0 8px rgba(95, 224, 255, 0.5); }
.slot-num {
  position: absolute;
  bottom: 1px;
  right: 3px;
  z-index: 4;
  font-size: 11px;
  font-family: monospace;
  text-shadow: 1px 1px 1px #000;
  opacity: 0.8;
}

/* ---------- Touch controls (mobile) ---------- */
#touch-controls {
  position: fixed;
  inset: 0;
  z-index: 9;
  pointer-events: none;
  touch-action: none;
}
#touch-controls .touch-look-zone,
#touch-controls .touch-move-zone {
  position: absolute;
  pointer-events: auto;
  touch-action: none;
}
.touch-look-zone { inset: 0; }                 /* whole screen is the look surface… */
.touch-move-zone { left: 0; bottom: 0; width: 46%; height: 58%; } /* …except the joystick corner */

.touch-joystick {
  position: fixed;
  left: 0;
  top: 0;
  width: 132px;
  height: 132px;
  margin: -66px 0 0 -66px;            /* centre on the touch point */
  border-radius: 50%;
  border: 2px solid rgba(95, 224, 255, 0.5);
  background: radial-gradient(circle, rgba(95, 224, 255, 0.10), rgba(10, 13, 18, 0.30));
  box-shadow: inset 0 0 18px rgba(0, 0, 0, 0.4);
  pointer-events: none;
  touch-action: none;
  display: none;
}
.touch-joystick.active { display: block; }
.touch-joystick .knob {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 56px;
  height: 56px;
  margin: -28px 0 0 -28px;
  border-radius: 50%;
  background: radial-gradient(circle at 38% 32%, #cfeaff, #2f8bff);
  border: 2px solid var(--ink);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.5);
}

.touch-btns {
  position: absolute;
  right: calc(16px + env(safe-area-inset-right, 0px));
  bottom: calc(88px + env(safe-area-inset-bottom, 0px)); /* clear the hotbar at the bottom */
  display: grid;
  grid-template-columns: repeat(2, auto);
  gap: 12px;
  align-items: end;
  justify-items: end;
  pointer-events: none;
}
.touch-topbar {
  position: absolute;
  right: calc(10px + env(safe-area-inset-right, 0px));
  top: calc(10px + env(safe-area-inset-top, 0px));
  display: flex;
  gap: 10px;
  pointer-events: none;
}

.touch-btn {
  pointer-events: auto;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  width: 66px;
  height: 66px;
  border-radius: 50%;
  border: 2px solid rgba(10, 13, 18, 0.9);
  background: linear-gradient(180deg, rgba(46, 58, 70, 0.82), rgba(26, 32, 40, 0.82));
  color: #eaf6ff;
  font-family: var(--font-pixel);
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.5px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.45), 0 0 0 2px rgba(107, 112, 121, 0.3);
  text-shadow: 1px 1px 1px #000;
}
.touch-btn.big { width: 80px; height: 80px; font-size: 14px; }
.touch-btn.pressed,
.touch-btn.active {
  background: linear-gradient(180deg, var(--blue), var(--blue-dark));
  border-color: var(--cyan);
}
.touch-topbar .touch-btn { width: 50px; height: 50px; font-size: 12px; box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4); }

/* On touch devices, lift the HUD hotbar above the look surface so taps select. */
.touch-device #hotbar { z-index: 11; bottom: calc(14px + env(safe-area-inset-bottom, 0px)); }

/* Tighter inventory padding on small screens so the panel fits comfortably. */
@media (max-width: 560px) {
  .inventory-panel,
  .furnace-panel,
  .chest-panel { width: 96vw; padding: 12px; }
  .recipe-button { width: auto; flex: 1 1 132px; }
  .recipe-list { max-height: 30dvh; }
}

/* Sign editor overlay */
#sign-editor { z-index: 16; }
.sign-panel { width: min(360px, 92vw); }
.sign-lines { display: flex; flex-direction: column; gap: 8px; margin: 16px 0; }
.sign-line {
  font-family: var(--font-pixel);
  font-size: 18px;
  text-align: center;
  padding: 9px 10px;
  color: #2a1a0c;
  background: linear-gradient(180deg, #d8b483, #c49a64);
  border: 3px solid #5a3a1c;
  border-radius: 4px;
  outline: none;
}
.sign-line:focus { box-shadow: inset 0 0 0 2px var(--cyan); }
.sign-done {
  font-family: var(--font-pixel);
  font-size: 18px;
  font-weight: 700;
  letter-spacing: 1px;
  color: #fff;
  width: 100%;
  padding: 12px;
  cursor: pointer;
  border: 3px solid var(--ink);
  border-radius: 4px;
  background: linear-gradient(180deg, var(--blue-lite), var(--blue) 55%, var(--blue-dark));
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.5), inset 0 2px 0 rgba(255, 255, 255, 0.25), 0 5px 0 var(--blue-deep);
}
.sign-done:hover { filter: brightness(1.08); }
.sign-done:active { transform: translateY(3px); box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.5), 0 2px 0 var(--blue-deep); }

/* Disconnect modal + Main Menu button */
#disconnect { z-index: 30; background: rgba(20, 10, 6, 0.5); }
#menu-btn {
  background: linear-gradient(180deg, #d06a4f, #b34a34 55%, #8a3322);
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.4), inset 0 2px 0 rgba(255, 255, 255, 0.2), 0 4px 0 #6e2618;
}

/* World-boss health bar: top-center banner shown while a boss is nearby. */
#boss-bar {
  position: fixed;
  top: 16px;
  left: 50%;
  transform: translateX(-50%);
  width: min(460px, 62vw);
  z-index: 5;
  pointer-events: none;
  text-align: center;
}
#boss-bar-name {
  color: #ffd9a0;
  font: 700 20px var(--font-pixel);
  text-shadow: 0 2px 0 rgba(0, 0, 0, 0.85), 0 0 12px rgba(255, 106, 26, 0.35);
  margin-bottom: 5px;
  letter-spacing: 1px;
}
#boss-bar-track {
  height: 10px;
  border: 2px solid rgba(0, 0, 0, 0.78);
  background: #1a1b21;
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.12), inset 0 0 0 1px #111;
}
#boss-bar-fill {
  width: 100%;
  height: 100%;
  background: linear-gradient(180deg, #ff9d5c 0%, #e0432c 45%, #8a1616 100%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.35);
  transition: width 0.18s ease-out;
}

/* Pixel-styled scrollbars for deliberate scroll surfaces. Chat stays hidden. */
:is(
  .game-menu-pane,
  .game-menu-tabs,
  .market-category-rail,
  .inventory-panel,
  .furnace-panel,
  .chest-panel,
  .recipe-list,
  .creative-grid,
  .settings-panel
) {
  scrollbar-width: thin;
  scrollbar-color: var(--blue) var(--stone-dark);
}
:is(
  .game-menu-pane,
  .game-menu-tabs,
  .market-category-rail,
  .inventory-panel,
  .furnace-panel,
  .chest-panel,
  .recipe-list,
  .creative-grid,
  .settings-panel
)::-webkit-scrollbar { width: 10px; height: 10px; }
:is(
  .game-menu-pane,
  .game-menu-tabs,
  .market-category-rail,
  .inventory-panel,
  .furnace-panel,
  .chest-panel,
  .recipe-list,
  .creative-grid,
  .settings-panel
)::-webkit-scrollbar-track {
  border: 2px solid var(--ink);
  background: var(--stone-dark);
}
:is(
  .game-menu-pane,
  .game-menu-tabs,
  .market-category-rail,
  .inventory-panel,
  .furnace-panel,
  .chest-panel,
  .recipe-list,
  .creative-grid,
  .settings-panel
)::-webkit-scrollbar-thumb {
  border: 2px solid var(--ink);
  border-radius: 2px;
  background: linear-gradient(180deg, var(--blue-lite), var(--blue-dark));
  box-shadow: inset 0 0 0 1px rgba(95, 224, 255, 0.45);
}
:is(
  .game-menu-pane,
  .game-menu-tabs,
  .market-category-rail,
  .inventory-panel,
  .furnace-panel,
  .chest-panel,
  .recipe-list,
  .creative-grid,
  .settings-panel
)::-webkit-scrollbar-thumb:hover { background: linear-gradient(180deg, var(--cyan), var(--blue)); }
:is(
  .game-menu-pane,
  .game-menu-tabs,
  .market-category-rail,
  .inventory-panel,
  .furnace-panel,
  .chest-panel,
  .recipe-list,
  .creative-grid,
  .settings-panel
)::-webkit-scrollbar-corner { background: var(--stone-dark); }
