/* ============================================================
   Minecraft JS — UI styling (Minecraft-flavored chrome)
   ============================================================ */

:root {
  --pixel-font: 'VT323', 'Courier New', monospace;
  --logo-font: 'Press Start 2P', 'VT323', monospace;
}

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

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

#game {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
}

.hidden { display: none !important; }

/* ======================= overlays ======================= */

.overlay {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 80;
}

#pause-menu, #options-menu, #controls-menu, #worlds-menu, #death-screen, #loading-screen {
  z-index: 90 !important;
  pointer-events: auto !important;
}

#pause-menu, #options-menu, #controls-menu {
  background: rgba(16, 16, 16, 0.62);
  backdrop-filter: blur(1px);
}

#title-screen {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  background: transparent;
  pointer-events: auto !important;
  overflow-y: auto;
  overflow-x: hidden;
  max-height: 100vh;
  box-sizing: border-box;
  padding: 16px 10px;
  touch-action: pan-y;
  z-index: 70;
}

/* ======================= MC buttons ======================= */

.mc-button {
  font-family: var(--pixel-font);
  font-size: 22px;
  letter-spacing: 1px;
  color: #fff;
  text-shadow: 2px 2px 0 #3f3f3f;
  background: linear-gradient(#828282, #6a6a6a 45%, #5a5a5a);
  border: 2px solid #000;
  box-shadow: inset 2px 2px 0 rgba(255,255,255,0.45), inset -2px -2px 0 rgba(0,0,0,0.45);
  padding: 8px 18px;
  min-width: 300px;
  cursor: pointer;
  image-rendering: pixelated;
}
.mc-button:hover {
  background: linear-gradient(#8f9ad1, #707bb4 45%, #5e69a3);
  border-color: #fff;
}
.mc-button:active { transform: translateY(1px); }
.mc-button.small { min-width: 0; font-size: 18px; padding: 6px 12px; }
.mc-button.toggle { min-width: 230px; }

/* ======================= title screen ======================= */

.title-stack {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  width: 100%;
  max-width: 520px;
  margin: auto;
  pointer-events: auto !important;
  position: relative;
  z-index: 55;
}

.mc-logo {
  font-family: var(--logo-font);
  font-size: clamp(36px, 7vw, 76px);
  color: #d8d8d8;
  letter-spacing: 4px;
  text-shadow:
    3px 3px 0 #3a3a3a,
    6px 6px 0 rgba(0,0,0,0.55);
  -webkit-text-stroke: 2px #1f1f1f;
  filter: drop-shadow(0 4px 0 rgba(0,0,0,0.3));
}

.mc-sublogo {
  font-family: var(--pixel-font);
  font-size: 22px;
  color: #ffce3d;
  text-shadow: 2px 2px 0 #3e2e00;
  margin-top: -8px;
  letter-spacing: 5px;
}

.splash {
  position: relative;
  color: #ffff00;
  font-size: 24px;
  text-shadow: 2px 2px 0 #3f3f00;
  transform: rotate(-12deg);
  animation: splash-pulse 0.9s ease-in-out infinite;
  margin-top: -24px;
  margin-left: 240px;
  pointer-events: none;
}
@keyframes splash-pulse {
  0%, 100% { scale: 1; }
  50% { scale: 1.08; }
}

.menu-buttons {
  margin-top: 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  width: 100%;
  position: relative;
  z-index: 60;
  pointer-events: auto !important;
}

.menu-buttons .mc-button {
  cursor: pointer !important;
  pointer-events: auto !important;
  position: relative;
  z-index: 65;
}

.seed-row { display: flex; gap: 8px; width: min(300px, 90vw); }

#seed-input {
  font-family: var(--pixel-font);
  font-size: 17px;
  flex: 1;
  min-width: 0;
  background: #000;
  color: #e0e0e0;
  border: 2px solid #a0a0a0;
  padding: 6px 8px;
  outline: none;
}
#seed-input:focus { border-color: #fff; }

.title-footer {
  margin-top: 14px;
  display: flex;
  justify-content: space-between;
  width: min(500px, 92vw);
  color: rgba(255, 255, 255, 0.7);
  font-size: 16px;
  text-shadow: 2px 2px 0 #3f3f3f;
  pointer-events: none;
}

.version-tag {
  font-size: 14px;
  color: rgba(255, 255, 255, 0.55);
  text-shadow: 2px 2px 0 #3f3f3f;
  letter-spacing: 1px;
}
.menu-stack .version-tag { margin-top: 6px; }

/* ======================= menus ======================= */

.menu-stack {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}
.menu-stack.wide { width: min(560px, 92vw); }

.menu-title {
  font-size: 30px;
  color: #fff;
  text-shadow: 2px 2px 0 #3f3f3f;
  margin-bottom: 12px;
}

.opt-row {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 2px;
  color: #e8e8e8;
  font-size: 20px;
  text-shadow: 1px 1px 0 #303030;
}
.opt-row input[type="range"] {
  width: 100%;
  accent-color: #7fbf4f;
  cursor: pointer;
}
.opt-row.checks {
  flex-direction: row;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  margin: 8px 0;
}

.controls-grid {
  display: grid;
  grid-template-columns: auto auto;
  gap: 4px 28px;
  color: #e8e8e8;
  font-size: 20px;
  text-shadow: 1px 1px 0 #303030;
  background: rgba(0,0,0,0.35);
  border: 2px solid #555;
  padding: 14px 20px;
}
.controls-grid span:nth-child(odd) { color: #a8d08f; }
.controls-note { color: #ffd75e; font-size: 18px; text-shadow: 1px 1px 0 #303030; }

/* ======================= loading ======================= */

#loading-screen { background: #2c2156; background: linear-gradient(#1c1633, #3a2d6b); }

.loading-stack { display: flex; flex-direction: column; align-items: center; gap: 16px; }
.loading-text { color: #fff; font-size: 28px; text-shadow: 2px 2px 0 #1a1a1a; }
.loading-bar {
  width: min(420px, 80vw);
  height: 12px;
  border: 2px solid #fff;
  background: #000;
  padding: 2px;
}
#loading-fill { height: 100%; width: 0%; background: #6ec24a; transition: width 0.15s linear; }
.loading-tip { color: #b9b9d8; font-size: 20px; }

/* ======================= HUD ======================= */

#hud { position: fixed; inset: 0; pointer-events: none; z-index: 10; }

#crosshair {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 22px;
  height: 22px;
  transform: translate(-50%, -50%);
  mix-blend-mode: difference;
}
#crosshair::before, #crosshair::after {
  content: '';
  position: absolute;
  background: #ddd;
}
#crosshair::before { left: 50%; top: 0; width: 2px; height: 100%; transform: translateX(-50%); }
#crosshair::after { top: 50%; left: 0; height: 2px; width: 100%; transform: translateY(-50%); }

/* --------- hotbar --------- */

#hotbar {
  position: absolute;
  bottom: 6px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  background: rgba(12, 12, 12, 0.55);
  border: 2px solid rgba(0, 0, 0, 0.8);
  outline: 2px solid rgba(255, 255, 255, 0.25);
}

.hotbar-slot {
  width: 54px;
  height: 54px;
  border: 2px solid rgba(255,255,255,0.18);
  border-right-width: 1px;
  border-left-width: 1px;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}
.hotbar-slot img { width: 44px; height: 44px; image-rendering: auto; }
.hotbar-slot .slot-num {
  position: absolute;
  top: 1px;
  left: 3px;
  font-size: 14px;
  color: rgba(255,255,255,0.6);
  text-shadow: 1px 1px 0 #000;
}
.hotbar-slot.selected {
  border: 3px solid #fff;
  outline: 2px solid #999;
  z-index: 2;
}

#item-name {
  position: absolute;
  bottom: 76px;
  left: 50%;
  transform: translateX(-50%);
  color: #fff;
  font-size: 24px;
  text-shadow: 2px 2px 0 rgba(0,0,0,0.7);
  opacity: 0;
  transition: opacity 0.4s ease;
}

/* --------- debug (F3) --------- */

#debug {
  position: absolute;
  top: 6px;
  left: 6px;
  color: #fff;
  font-size: 17px;
  line-height: 1.25;
  text-shadow: 1px 1px 0 #000;
  background: rgba(16,16,16,0.35);
  padding: 6px 10px;
  white-space: pre;
}

/* --------- water / effects --------- */

#underwater-overlay {
  position: absolute;
  inset: 0;
  background: rgba(20, 60, 160, 0.28);
  opacity: 0;
  transition: opacity 0.2s;
}

#damage-vignette {
  position: absolute;
  inset: 0;
  box-shadow: inset 0 0 120px rgba(255, 40, 20, 0.85);
  opacity: 0;
  transition: opacity 0.1s;
  pointer-events: none;
}

#fire-overlay {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(ellipse at 50% 120%, rgba(255, 110, 0, 0.65) 0%, rgba(255, 40, 0, 0.35) 45%, transparent 75%);
  box-shadow: inset 0 -70px 100px rgba(255, 80, 0, 0.6);
  opacity: 0;
  transition: opacity 0.15s ease-in-out;
  mix-blend-mode: screen;
}

#portal-overlay {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(circle at 50% 50%, rgba(130, 20, 210, 0.45) 0%, rgba(70, 10, 150, 0.75) 70%, rgba(30, 5, 80, 0.92) 100%);
  box-shadow: inset 0 0 150px rgba(180, 40, 255, 0.8);
  opacity: 0;
  transition: opacity 0.2s ease-in-out;
  mix-blend-mode: color-dodge;
  animation: portalSwirl 3s ease-in-out infinite alternate;
}

@keyframes portalSwirl {
  0% { transform: scale(1.0) rotate(0deg); filter: hue-rotate(0deg); }
  50% { transform: scale(1.04) rotate(0.5deg); filter: hue-rotate(25deg); }
  100% { transform: scale(1.0) rotate(-0.5deg); filter: hue-rotate(-25deg); }
}

/* ======================= picker ======================= */

#picker { background: rgba(16, 16, 16, 0.55); pointer-events: auto; }

.picker-window {
  background: #c6c6c6;
  border: 3px solid #000;
  box-shadow:
    inset 3px 3px 0 #ffffff,
    inset -3px -3px 0 #555555,
    0 10px 30px rgba(0,0,0,0.5);
  padding: 14px 16px;
  max-width: min(640px, 94vw);
}

.picker-title {
  font-size: 22px;
  color: #3f3f3f;
  margin-bottom: 10px;
}
.picker-hint { font-size: 16px; color: #6e6e6e; }

#picker-grid {
  display: grid;
  grid-template-columns: repeat(9, 52px);
  gap: 4px;
  max-height: 52vh;
  overflow-y: auto;
  padding: 6px;
  background: #8b8b8b;
  border: 2px solid #373737;
  box-shadow: inset 2px 2px 0 #313131, inset -2px -2px 0 #ffffff;
}

.picker-cell {
  width: 52px;
  height: 52px;
  background: #8b8b8b;
  border: 1px solid #6f6f6f;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  position: relative;
}
.picker-cell:hover { background: #a8a8c0; }
.picker-cell img { width: 42px; height: 42px; }

.picker-hotbar {
  margin-top: 12px;
  display: flex;
  justify-content: center;
  gap: 4px;
}
.picker-hotbar .hotbar-slot {
  background: #8b8b8b;
  border: 2px solid #373737;
  cursor: pointer;
}
.picker-hotbar .hotbar-slot.selected { border-color: #fff; background: #a8a8c0; }

/* tooltip */
.picker-cell::after {
  content: attr(data-name);
  position: absolute;
  bottom: 105%;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(16, 0, 32, 0.92);
  border: 1px solid #4a2a7a;
  color: #fff;
  font-size: 17px;
  padding: 2px 8px;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  z-index: 5;
}
.picker-cell:hover::after { opacity: 1; }

/* scrollbars */
#picker-grid::-webkit-scrollbar { width: 12px; }
#picker-grid::-webkit-scrollbar-track { background: #6f6f6f; }
#picker-grid::-webkit-scrollbar-thumb { background: #c6c6c6; border: 2px solid #373737; }

/* Item Stack Count Badge */
.slot-count {
  position: absolute;
  bottom: 1px;
  right: 4px;
  font-family: var(--pixel-font);
  font-size: 20px;
  font-weight: bold;
  color: #ffffff;
  text-shadow: 2px 2px 0 #3f3f3f, 1px 1px 0 #000;
  pointer-events: none;
  z-index: 3;
}

/* Picker Tabs */
.picker-tabs {
  display: flex;
  gap: 6px;
  margin-bottom: 8px;
}
.picker-tabs .mc-button {
  flex: 1;
  padding: 4px 10px;
  font-size: 18px;
}
.picker-tabs .mc-button.active {
  background: linear-gradient(#56ab2f, #3b7d1e 45%, #2d5f17);
  box-shadow: inset 2px 2px 0 rgba(255,255,255,0.6), inset -2px -2px 0 rgba(0,0,0,0.6);
}
.picker-tabs .close-tab {
  flex: 0 0 90px;
  background: linear-gradient(#b94a48, #993836);
}

/* Crafting Grid & Cards */
.crafting-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 8px;
  max-height: 270px;
  overflow-y: auto;
  padding: 4px;
  background: #8b8b8b;
  border: 2px solid #373737;
}
.crafting-grid::-webkit-scrollbar { width: 12px; }
.crafting-grid::-webkit-scrollbar-track { background: #6f6f6f; }
.crafting-grid::-webkit-scrollbar-thumb { background: #c6c6c6; border: 2px solid #373737; }

.crafting-card {
  background: #c6c6c6;
  border: 2px solid #373737;
  padding: 8px;
  display: flex;
  align-items: center;
  gap: 8px;
  box-shadow: inset 1px 1px 0 rgba(255,255,255,0.7), inset -1px -1px 0 rgba(0,0,0,0.5);
}
.crafting-card.can-craft {
  border-color: #2e7d32;
  background: #d4edda;
}
.crafting-card.cannot-craft {
  opacity: 0.65;
}

.crafting-icon-box {
  width: 44px;
  height: 44px;
  background: #8b8b8b;
  border: 2px solid #373737;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  position: relative;
}
.crafting-icon-box img {
  width: 36px;
  height: 36px;
  image-rendering: pixelated;
}
.crafting-info {
  flex: 1;
  text-align: left;
}
.crafting-name {
  font-size: 19px;
  font-weight: bold;
  color: #111;
  text-shadow: 1px 1px 0 rgba(255,255,255,0.8);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.crafting-reqs {
  font-size: 15px;
  color: #333;
  margin-top: 2px;
}
.req-ok { color: #1e7e34; font-weight: bold; }
.req-miss { color: #d32f2f; font-weight: bold; }

.btn-craft {
  padding: 4px 10px;
  font-size: 17px;
  font-family: var(--pixel-font);
  background: linear-gradient(#56ab2f, #3b7d1e);
  color: #fff;
  border: 2px solid #000;
  cursor: pointer;
  box-shadow: inset 1px 1px 0 rgba(255,255,255,0.5);
  align-self: center;
}
.btn-craft:disabled {
  background: #888;
  cursor: not-allowed;
  opacity: 0.5;
}

/* ======================= HUD Status (Hearts & Day/Night) ======================= */

#hud-status {
  position: absolute;
  bottom: 64px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 440px;
  max-width: 90vw;
  pointer-events: none;
  z-index: 2;
}

.hud-bars {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
}

.bubbles-bar {
  display: flex;
  gap: 3px;
  margin-bottom: 4px;
}

.bubble-cell {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #ffffff 0%, #66b3ff 45%, #0066cc 100%);
  border: 1px solid #003366;
  box-shadow: 0 0 3px rgba(102, 179, 255, 0.9);
  filter: drop-shadow(1px 1px 0 #000);
}

.bubble-cell.popped {
  opacity: 0;
  transform: scale(0.4);
  transition: opacity 0.15s ease-out, transform 0.15s ease-out;
}

.hearts-bar {
  display: flex;
  gap: 3px;
}

.heart-cell {
  width: 18px;
  height: 18px;
  display: inline-block;
  image-rendering: pixelated;
  filter: drop-shadow(1px 1px 0 #000);
}

.heart-cell.full {
  background: radial-gradient(circle at 35% 35%, #ff4d4d, #cc0000 70%);
  clip-path: polygon(50% 15%, 65% 0%, 90% 0%, 100% 25%, 100% 50%, 50% 95%, 0% 50%, 0% 25%, 10% 0%, 35% 0%);
}

.heart-cell.half {
  background: linear-gradient(to right, #ff3333 50%, #3a3a3a 50%);
  clip-path: polygon(50% 15%, 65% 0%, 90% 0%, 100% 25%, 100% 50%, 50% 95%, 0% 50%, 0% 25%, 10% 0%, 35% 0%);
}

.heart-cell.empty {
  background: #2a2a2a;
  border: 1px solid #111;
  clip-path: polygon(50% 15%, 65% 0%, 90% 0%, 100% 25%, 100% 50%, 50% 95%, 0% 50%, 0% 25%, 10% 0%, 35% 0%);
}

.time-badge {
  font-family: var(--pixel-font);
  font-size: 18px;
  color: #fff;
  background: rgba(0, 0, 0, 0.6);
  border: 2px solid #555;
  padding: 2px 10px;
  text-shadow: 1px 1px 0 #000;
  border-radius: 4px;
}

/* ======================= Saved Worlds Modal ======================= */

.worlds-modal {
  background: #2b2b2b;
  border: 4px solid #1a1a1a;
  box-shadow: inset 2px 2px 0 #555, 0 8px 32px rgba(0,0,0,0.8);
  padding: 16px;
  max-width: min(600px, 92vw);
}

.worlds-desc {
  font-size: 16px;
  color: #aaa;
  margin-bottom: 12px;
  text-shadow: 1px 1px 0 #000;
}

.worlds-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 48vh;
  overflow-y: auto;
  padding: 6px;
  background: #181818;
  border: 2px solid #444;
  margin-bottom: 14px;
}

.world-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #2f2f2f;
  border: 2px solid #555;
  padding: 8px 12px;
  transition: background 0.15s;
}

.world-card:hover {
  background: #3c3c3c;
  border-color: #888;
}

.world-card.active-world {
  border-color: #56ab2f;
  background: #253320;
}

.world-card-info {
  text-align: left;
}

.world-card-title {
  font-size: 20px;
  font-weight: bold;
  color: #fff;
  text-shadow: 1px 1px 0 #000;
}

.world-card-meta {
  font-size: 14px;
  color: #999;
  margin-top: 2px;
}

.world-card-actions {
  display: flex;
  gap: 6px;
}

.btn-world-action {
  padding: 4px 10px;
  font-size: 16px;
  font-family: var(--pixel-font);
  border: 2px solid #000;
  cursor: pointer;
}

.btn-world-play {
  background: linear-gradient(#56ab2f, #3b7d1e);
  color: #fff;
}

.btn-world-del {
  background: linear-gradient(#d32f2f, #8b0000);
  color: #fff;
}

.worlds-footer {
  display: flex;
  gap: 10px;
  justify-content: center;
  width: 100%;
}

/* ======================= Death Screen ======================= */

.death-screen {
  background: rgba(120, 0, 0, 0.75);
  backdrop-filter: blur(4px);
}

.death-stack {
  gap: 14px;
}

.death-title {
  font-family: var(--pixel-font);
  font-size: clamp(48px, 9vw, 84px);
  color: #ff2222;
  text-shadow: 3px 3px 0 #000, 6px 6px 0 rgba(0,0,0,0.6);
  animation: death-shake 0.4s ease;
}

@keyframes death-shake {
  0% { transform: translateY(-30px); opacity: 0; }
  60% { transform: translateY(8px); }
  100% { transform: translateY(0); opacity: 1; }
}

.death-reason {
  font-size: 22px;
  color: #f0f0f0;
  text-shadow: 2px 2px 0 #000;
  margin-bottom: 12px;
}

/* ======================= Title Options Card ======================= */
.title-options-card {
  background: rgba(12, 12, 16, 0.92);
  border: 3px solid #7c5c36;
  box-shadow: 0 6px 18px rgba(0,0,0,0.65), inset 0 0 10px rgba(0,0,0,0.5);
  padding: 8px 14px;
  border-radius: 8px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  width: min(94vw, 500px);
  margin: 0 auto;
  pointer-events: auto !important;
  position: relative;
  z-index: 60;
  box-sizing: border-box;
}

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

.option-label {
  font-family: var(--pixel-font);
  font-size: 18px;
  color: #ffdf40;
  text-shadow: 1px 1px 0 #000;
  letter-spacing: 1px;
  white-space: nowrap;
  min-width: 80px;
}

.option-button-group {
  display: flex;
  gap: 6px;
  flex: 1;
  justify-content: flex-end;
}

.option-btn {
  min-width: 0;
  flex: 1 1 130px;
  max-width: 200px;
  font-size: 16px;
  padding: 8px 10px;
  opacity: 0.75;
  cursor: pointer !important;
  pointer-events: auto !important;
  user-select: none;
  touch-action: manipulation;
  text-align: center;
  white-space: nowrap;
  position: relative;
  z-index: 65;
}

.option-btn:hover {
  opacity: 0.95;
  border-color: #fff;
}

.option-btn:active {
  transform: scale(0.96);
}

.option-btn.active {
  opacity: 1 !important;
  border: 3px solid #ffdf40 !important;
  background: linear-gradient(#4caf50, #2e7d32 45%, #1b5e20) !important;
  box-shadow: 0 0 12px #4caf50, inset 2px 2px 0 rgba(255,255,255,0.6) !important;
  color: #fff !important;
  font-weight: bold;
}

.mode-indicator {
  text-align: center;
  font-size: 15px;
  color: #ffdf40;
  text-shadow: 1px 1px 0 #000;
  background: rgba(0, 0, 0, 0.45);
  border: 1px solid #7c5c36;
  border-radius: 4px;
  padding: 4px 6px;
  margin-top: 2px;
}

@media (max-width: 460px) {
  .title-options-card {
    padding: 6px 10px;
    gap: 5px;
  }
  .option-row {
    flex-direction: column;
    align-items: stretch;
    gap: 3px;
  }
  .option-label {
    text-align: center;
    font-size: 15px;
  }
  .option-btn {
    min-width: 0;
    font-size: 14px;
    padding: 6px 4px;
  }
  .mc-logo {
    font-size: 38px;
  }
}

/* ======================= Chest Screen (27 slots) ======================= */
.chest-window {
  background: #c6c6c6;
  border: 4px solid #373737;
  box-shadow: inset 4px 4px 0 #fff, inset -4px -4px 0 #555, 0 10px 30px rgba(0,0,0,0.8);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-width: 580px;
  width: 95%;
  image-rendering: pixelated;
}

.chest-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 2px solid #888;
  padding-bottom: 6px;
}

.chest-title {
  font-size: 24px;
  color: #2e2e2e;
  font-weight: bold;
}

.chest-section-label {
  font-size: 17px;
  color: #333;
  margin-top: 2px;
}

.chest-grid, .chest-hotbar, .secondary-grid {
  display: grid;
  grid-template-columns: repeat(9, 1fr);
  gap: 5px;
  background: #8b8b8b;
  padding: 8px;
  border: 3px solid #373737;
  box-shadow: inset 2px 2px 0 #373737, inset -2px -2px 0 #fff;
}

.chest-slot {
  width: 100%;
  aspect-ratio: 1;
  background: #8b8b8b;
  border: 2px solid #373737;
  box-shadow: inset 2px 2px 0 #373737, inset -2px -2px 0 #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  cursor: pointer;
}

.chest-slot:hover {
  background: #a0a0a0;
  border-color: #ffff00;
}

.chest-slot img {
  width: 75%;
  height: 75%;
  image-rendering: pixelated;
  pointer-events: none;
}

.chest-slot .count {
  position: absolute;
  right: 2px;
  bottom: 2px;
  font-size: 15px;
  color: #fff;
  text-shadow: 1px 1px 0 #000;
  pointer-events: none;
}

.chest-slot.moving-selected, .hotbar-slot.moving-selected {
  outline: 3px solid #ffea00 !important;
  box-shadow: 0 0 12px #ffea00, inset 0 0 8px rgba(255, 234, 0, 0.6) !important;
  transform: scale(1.1) !important;
  z-index: 10 !important;
}

/* --------- Armor UI in Secondary Tab --------- */
.secondary-content-wrap {
  display: flex;
  gap: 16px;
  align-items: flex-start;
}

.armor-column {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  background: rgba(0, 0, 0, 0.12);
  padding: 8px 10px;
  border: 2px solid #555;
  border-radius: 4px;
}

.armor-header {
  font-size: 13px;
  font-weight: bold;
  color: #333;
  text-transform: uppercase;
  margin-bottom: 2px;
}

.armor-slots {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.armor-slot {
  width: 48px;
  height: 48px;
  background: #8b8b8b;
  border: 2px solid #373737;
  box-shadow: inset 2px 2px 0 #373737, inset -2px -2px 0 #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  cursor: pointer;
}

.armor-slot:hover {
  background: #a0a0a0;
  border-color: #ffff00;
}

.armor-slot img {
  width: 80%;
  height: 80%;
  image-rendering: pixelated;
  pointer-events: none;
}

.armor-placeholder {
  font-size: 24px;
  opacity: 0.45;
  pointer-events: none;
}

.backpack-column {
  flex: 1;
}

/* ============================================================
   Round Character Editor Button & Modal (Personalizar Personagem)
   ============================================================ */

.skin-avatar-btn-container {
  display: flex;
  justify-content: center;
  margin: 10px 0 14px 0;
}

.round-character-btn {
  display: flex;
  align-items: center;
  gap: 12px;
  background: linear-gradient(135deg, #2b4570, #1b263b);
  border: 3px solid #5bc0be;
  border-radius: 40px;
  padding: 6px 20px 6px 8px;
  cursor: pointer;
  color: #fff;
  font-family: inherit;
  font-size: 13px;
  font-weight: bold;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.4), 0 0 12px rgba(91, 192, 190, 0.4);
  transition: all 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.round-character-btn:hover {
  transform: scale(1.06) translateY(-2px);
  border-color: #ffd166;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.5), 0 0 18px rgba(255, 209, 102, 0.6);
  background: linear-gradient(135deg, #3a5a8c, #24344d);
}

.round-btn-avatar-circle {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: radial-gradient(circle, #ffd166 0%, #ef476f 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: inset 0 2px 4px rgba(255, 255, 255, 0.4), 0 2px 6px rgba(0, 0, 0, 0.4);
  border: 2px solid #ffffff;
  animation: pulse-avatar 3s infinite alternate;
}

@keyframes pulse-avatar {
  0% { transform: scale(1); filter: drop-shadow(0 0 2px #ffd166); }
  100% { transform: scale(1.08); filter: drop-shadow(0 0 8px #ef476f); }
}

.round-btn-emoji {
  font-size: 26px;
  pointer-events: none;
}

.round-btn-text {
  text-shadow: 1px 1px 2px #000;
  letter-spacing: 0.5px;
}

/* Modal do Editor de Personagem */
.character-editor-modal {
  background: rgba(22, 27, 34, 0.96);
  border: 4px solid #5bc0be;
  border-radius: 12px;
  width: 92vw;
  max-width: 820px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.8), 0 0 25px rgba(91, 192, 190, 0.35);
  color: #fff;
  overflow: hidden;
  animation: modal-pop 0.25s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes modal-pop {
  0% { transform: scale(0.92); opacity: 0; }
  100% { transform: scale(1); opacity: 1; }
}

.character-editor-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 20px;
  background: #161b22;
  border-bottom: 2px solid #30363d;
}

.character-editor-title {
  margin: 0;
  font-size: 16px;
  color: #ffd166;
  text-shadow: 1px 1px 0 #000;
}

.btn-close-modal {
  background: #da3633;
  color: #fff;
  border: 2px solid #f85149;
  border-radius: 6px;
  width: 32px;
  height: 32px;
  font-size: 16px;
  font-weight: bold;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.15s;
}

.btn-close-modal:hover {
  transform: scale(1.1);
  background: #f85149;
}

.character-editor-body {
  display: flex;
  flex: 1;
  overflow: hidden;
  padding: 16px;
  gap: 16px;
}

@media (max-width: 680px) {
  .character-editor-body {
    flex-direction: column;
    overflow-y: auto;
  }
}

/* Coluna de Pré-Visualização 3D */
.character-preview-col {
  width: 250px;
  display: flex;
  flex-direction: column;
  align-items: center;
  background: #0d1117;
  border: 2px solid #30363d;
  border-radius: 8px;
  padding: 12px;
}

.preview-canvas-box {
  width: 100%;
  height: 250px;
  position: relative;
  border-radius: 6px;
  overflow: hidden;
  background: radial-gradient(circle at center, #1f2937 0%, #0d1117 100%);
  cursor: grab;
}

.preview-canvas-box:active {
  cursor: grabbing;
}

#skin-preview-canvas {
  width: 100%;
  height: 100%;
  display: block;
}

.preview-rotate-hint {
  position: absolute;
  bottom: 6px;
  left: 0;
  right: 0;
  text-align: center;
  font-size: 9px;
  color: #8b949e;
  pointer-events: none;
  text-shadow: 1px 1px 1px #000;
}

.preview-controls-row {
  display: flex;
  gap: 6px;
  margin-top: 10px;
  width: 100%;
}

.preview-controls-row .mc-button {
  flex: 1;
  font-size: 9px;
  padding: 6px 4px;
}

.character-name-box {
  width: 100%;
  margin-top: 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.character-name-box label {
  font-size: 10px;
  color: #8b949e;
}

.character-name-box input {
  background: #161b22;
  border: 2px solid #30363d;
  color: #fff;
  padding: 6px 10px;
  border-radius: 4px;
  font-family: inherit;
  font-size: 11px;
}

.character-name-box input:focus {
  border-color: #5bc0be;
  outline: none;
}

/* Coluna de Opções */
.character-options-col {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.skin-tabs-row {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding-bottom: 8px;
  border-bottom: 2px solid #30363d;
}

.skin-tab-btn {
  background: #21262d;
  color: #c9d1d9;
  border: 2px solid #30363d;
  border-radius: 6px;
  padding: 6px 10px;
  font-family: inherit;
  font-size: 10px;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s;
}

.skin-tab-btn:hover {
  background: #30363d;
  color: #fff;
}

.skin-tab-btn.active {
  background: #238636;
  border-color: #2ea043;
  color: #fff;
  font-weight: bold;
}

.skin-options-grid {
  flex: 1;
  overflow-y: auto;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 8px;
  padding: 10px 4px 10px 0;
}

.skin-option-card {
  background: #161b22;
  border: 2px solid #30363d;
  border-radius: 6px;
  padding: 8px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 6px;
  transition: all 0.15s;
}

.skin-option-card:hover {
  background: #21262d;
  border-color: #5bc0be;
  transform: translateY(-2px);
}

.skin-option-card.selected {
  background: #1c3553;
  border-color: #ffd166;
  box-shadow: 0 0 10px rgba(255, 209, 102, 0.4);
}

.skin-option-swatch {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 2px solid #fff;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
}

.skin-option-title {
  font-size: 10px;
  font-weight: bold;
  color: #f0f6fc;
}

.skin-option-desc {
  font-size: 8px;
  color: #8b949e;
  line-height: 1.2;
}

.character-editor-footer {
  padding: 12px 20px;
  background: #161b22;
  border-top: 2px solid #30363d;
  display: flex;
  justify-content: flex-end;
}

.large-btn {
  padding: 10px 24px !important;
  font-size: 12px !important;
  background: #238636 !important;
  border-color: #2ea043 !important;
}

.large-btn:hover {
  background: #2ea043 !important;
}

/* ============================================================
   Friends Radar / Compass Indicator (Sítio das outras pessoas)
   ============================================================ */

.friends-radar {
  position: absolute;
  top: 14px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  z-index: 25;
  pointer-events: auto;
}

.friend-radar-badge {
  background: rgba(13, 17, 23, 0.88);
  border: 2px solid #5bc0be;
  border-radius: 20px;
  padding: 5px 14px;
  color: #fff;
  font-size: 11px;
  font-weight: bold;
  display: flex;
  align-items: center;
  gap: 7px;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.55), 0 0 10px rgba(91, 192, 190, 0.3);
  cursor: pointer;
  user-select: none;
  transition: transform 0.15s, border-color 0.15s;
}

.friend-radar-badge:hover {
  transform: scale(1.06);
  border-color: #ffd166;
  background: rgba(22, 27, 34, 0.95);
}

.friend-radar-badge .badge-icon {
  font-size: 14px;
}

.friend-radar-badge .badge-name {
  color: #ffd166;
  text-shadow: 1px 1px 0 #000;
}

.friend-radar-badge .badge-dist {
  color: #c9d1d9;
  font-size: 10px;
}

.friend-radar-badge .badge-arrow {
  color: #5bc0be;
  font-size: 14px;
  font-weight: bold;
}


