:root {
  --accent: #d97757;
  --accent-dark: #b85d3f;
  --panel: rgba(20, 18, 16, 0.82);
  --text: #f4efe8;
  --muted: #b9b0a5;
  --slot: rgba(0, 0, 0, 0.45);
  --font: "Segoe UI", system-ui, -apple-system, sans-serif;
  /* interface em pixel-art (menus do jogo): --px é a unidade; todo chanfro, contorno e sombra é múltiplo dela */
  --px: 3px;
  --accent-hi: #ef9a7b; --accent-lo: #6e321f;
  --bevel-hi: rgba(255, 255, 255, 0.34); --bevel-lo: rgba(0, 0, 0, 0.42);
  --px-edge: #14110f; --px-drop: rgba(8, 6, 10, 0.55);
  --stone: #6f6a66; --stone-hi: #9a938c; --stone-lo: #45413e;
  --wood: #a07840; --wood-hi: #d9aa6c; --wood-lo: #5a3a1e;
  --ink: #1d1826;
  --sky-1: #1b1d3a; --sky-2: #2a2550; --sky-3: #4a2f5e; --sky-4: #8a3f5a; --sky-5: #c9603f; --sky-6: #eda05a;
  --sun: #ffd98a; --sun-halo: #f6b565;
  --font-pixel: "Pixelify Sans", "Segoe UI", system-ui, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: var(--sky-1); color: var(--text); font-family: var(--font); }
canvas#game { display: block; width: 100vw; height: 100vh; image-rendering: pixelated; transition: opacity 1s ease-out; }
/* troca de cena da vitrine da home: escurece em 0,6 s e clareia em 1 s (a transição de volta é a de cima) */
canvas#game.corte { opacity: 0; transition: opacity 0.6s ease-in; }
[hidden] { display: none !important; }

.panel {
  background: var(--panel);
  border: 2px solid rgba(255, 255, 255, 0.12);
  border-radius: 10px;
  padding: 24px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.4);
}

/* mercador (B-111) */
#trade { position: fixed; inset: 0; display: flex; align-items: center; justify-content: center; padding: 16px; z-index: 11; }
.trade-panel { width: min(440px, 100%); display: flex; flex-direction: column; gap: 10px; }
.trade-panel h3, .trade-panel p { margin: 0; }
.trade-row { display: flex; align-items: center; gap: 8px; padding: 6px; border-radius: 6px; background: rgba(255, 255, 255, 0.05); }
.trade-row canvas { width: 32px; height: 32px; image-rendering: pixelated; }
.trade-row .n { min-width: 28px; font-weight: bold; }
.trade-row .arrow { opacity: 0.7; }
.trade-row button { margin-left: auto; }
.trade-row.missing { opacity: 0.55; }
#sign-edit { position: fixed; inset: 0; display: flex; align-items: center; justify-content: center; padding: 16px; z-index: 11; }
.sign-panel { width: min(420px, 100%); display: flex; flex-direction: column; gap: 10px; }
.sign-panel h3 { margin: 0; }
.sign-panel p { margin: 0; }
#menu, #paused, #inventory, #death {
  position: fixed; inset: 0; display: flex; align-items: center; justify-content: center;
  padding: 16px; background: rgba(0, 0, 0, 0.25); z-index: 10;
}
/* a tela de título (o #menu) tem folha própria: css/title.css, com a arte gerada em css/title-art.css */
/* logo em blocos: o ícone do jogo (o mesmo do favicon) e a palavra desenhada em pixel por código */
.logo { margin: 0; display: flex; align-items: center; justify-content: center; gap: 12px; }
.logo svg { display: block; height: 42px; width: auto; max-width: 100%; filter: drop-shadow(3px 3px 0 rgba(0, 0, 0, 0.55)); }
.logo .logo-ic { flex: none; }
.logo .logo-txt { min-width: 0; }
.logo-nome { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

form { display: flex; flex-direction: column; gap: 10px; text-align: left; }
label { font-size: 14px; color: var(--muted); }
input {
  font: inherit; font-size: 16px; padding: 10px 12px; border-radius: 6px;
  border: 2px solid rgba(255, 255, 255, 0.2); background: rgba(0, 0, 0, 0.4); color: var(--text);
  outline: none;
}
input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(217, 119, 87, 0.22); }
button {
  font: inherit; font-size: 18px; font-weight: 700; padding: 12px; border: 0; border-radius: 6px;
  background: var(--accent); color: #fff; cursor: pointer; box-shadow: 0 4px 0 var(--accent-dark);
}
button:hover { filter: brightness(1.08); }
button:active { transform: translateY(2px); box-shadow: 0 2px 0 var(--accent-dark); }
button:disabled { opacity: 0.6; cursor: wait; }
#status { min-height: 1.4em; color: #ffd27a; margin: 12px 0 0; }

kbd {
  background: rgba(255, 255, 255, 0.12); border-radius: 4px; padding: 1px 6px; box-shadow: 0 2px 0 rgba(0, 0, 0, 0.45);
  font-family: inherit; font-size: 12px; color: var(--text);
}

/* pausa: menu inicial à esquerda e a página escolhida ao lado (no celular a página toma o lugar do menu) */
.pause-wrap { display: flex; gap: 16px; align-items: flex-start; justify-content: center; width: 100%; max-height: 100%; }
#paused h2 { margin-top: 0; }
.pause-panel {
  max-height: calc(100vh - 32px); max-height: calc(100dvh - 32px); overflow-y: auto;
  display: flex; flex-direction: column; gap: 8px; padding: 16px 18px;
}
.pause-home { flex: 0 0 370px; max-width: 100%; text-align: center; }
.pause-home h2 { margin-bottom: 0; font-size: 26px; }
.pause-where { margin: -4px 0 2px; font-size: 14px; }
.pm-list { display: flex; flex-direction: column; gap: 8px; }
.pm-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.pm-item {
  display: flex; align-items: center; gap: 12px; width: 100%; min-height: 50px; padding: 6px 12px; text-align: left;
  background: rgba(255, 255, 255, 0.08); box-shadow: 0 3px 0 rgba(0, 0, 0, 0.35); border: 1px solid transparent;
}
.pm-item:hover { border-color: var(--accent); }
.pm-item.pm-main { background: var(--accent); box-shadow: 0 4px 0 var(--accent-dark); }
.pm-item.active { background: rgba(217, 119, 87, 0.25); border-color: var(--accent); }
.pm-item:disabled { cursor: default; opacity: 0.5; }
.pm-item:disabled:hover { border-color: transparent; }
.pm-ic { flex: 0 0 28px; font-size: 22px; text-align: center; }
.pm-tx { display: flex; flex-direction: column; min-width: 0; }
.pm-tx b { font-size: 16px; }
.pm-tx small { font-size: 12.5px; font-weight: 400; color: var(--muted); line-height: 1.3; }
.pm-main .pm-tx small { color: rgba(255, 255, 255, 0.85); }
.pm-grid .pm-item { gap: 8px; padding: 8px; }
.pm-grid .pm-ic { flex-basis: 22px; font-size: 18px; }
.pm-grid .pm-tx b { font-size: 14px; }
.pm-sep { margin: 4px 0 0; text-align: left; }
.pm-quit { min-height: 44px; padding-top: 4px; padding-bottom: 4px; background: transparent; box-shadow: none; border-color: rgba(255, 255, 255, 0.12); }
.pause-page { flex: 0 1 560px; min-width: 0; text-align: left; }
.pp-head { display: flex; align-items: center; gap: 12px; margin-bottom: 6px; }
.pp-head h3 { margin: 0; }
#pause-back { min-height: 44px; }
#pause-extra { display: flex; flex-direction: column; gap: 12px; text-align: left; }
@media (max-width: 760px) {
  /* celular: uma coisa de cada vez; a página tem "← Voltar" no topo */
  .pause-home, .pause-page { flex: 1 1 100%; }
  #paused.on-page .pause-home { display: none; }
}
@media (max-width: 380px) { .pm-grid { grid-template-columns: 1fr; } }
button.secondary { background: rgba(255, 255, 255, 0.1); box-shadow: 0 4px 0 rgba(0, 0, 0, 0.35); font-size: 15px; padding: 9px; }
.tabs { display: flex; gap: 4px; border-bottom: 2px solid rgba(255, 255, 255, 0.12); }
.tab {
  flex: 1; font-size: 14px; padding: 8px 4px; border-radius: 6px 6px 0 0; box-shadow: none;
  background: transparent; color: var(--muted);
}
.tab.active { background: rgba(217, 119, 87, 0.25); color: var(--text); }
.tab:active { transform: none; box-shadow: none; }
.tab-page { min-height: 220px; }
.tab-page .opt-group:first-child { margin-top: 0; }
/* aba Aparência (B-098) */
.look-wrap { display: flex; gap: 16px; align-items: flex-start; flex-wrap: wrap; }
#look-preview { width: 160px; height: 220px; background: rgba(255, 255, 255, 0.05); border-radius: 8px; }
.look-opts { flex: 1; min-width: 220px; }
.swatches { display: flex; flex-wrap: wrap; gap: 6px; }
.swatch { width: 30px; height: 30px; padding: 0; border-radius: 6px; border: 2px solid rgba(255, 255, 255, 0.25); }
.swatch.active { border-color: #fff; box-shadow: 0 0 0 2px rgba(217, 119, 87, 0.9); }
.opt-group {
  margin: 14px 0 8px; font-size: 13px; text-transform: uppercase; letter-spacing: 1px; color: var(--accent);
  border-bottom: 1px dashed rgba(255, 255, 255, 0.15); padding-bottom: 4px;
}
.opt-group:first-child { margin-top: 4px; }
.opt { display: grid; grid-template-columns: minmax(120px, 1fr) minmax(90px, 1.4fr) 74px; align-items: center; gap: 4px 10px; margin-bottom: 8px; font-size: 15px; }
.opt input[type=range] { padding: 0; accent-color: var(--accent); border: 0; background: none; height: 24px; width: 100%; }
.opt input[type=number] { font-size: 14px; padding: 4px 6px; width: 74px; text-align: right; }
.opt small { grid-column: 1 / -1; margin-top: -4px; }
.check { display: flex; align-items: center; gap: 8px; margin: 6px 0 10px; color: var(--text); font-size: 15px; cursor: pointer; }
.check input { width: 18px; height: 18px; accent-color: var(--accent); }
.pause-tip { text-align: center; }
@media (max-width: 480px) {
  .opt { grid-template-columns: 1fr 74px; }
  .opt span { grid-column: 1 / -1; }
}
.help-table { width: 100%; border-collapse: collapse; font-size: 14px; }
#rules-list { margin: 0; padding-left: 22px; font-size: 14px; line-height: 1.5; }
#rules-list li { margin-bottom: 8px; }
#rules-list b { color: var(--accent); }
.help-table td { padding: 5px 4px; border-bottom: 1px solid rgba(255, 255, 255, 0.07); }
.help-table td:last-child { text-align: right; }
.help-table kbd { white-space: nowrap; }
.help-table button.key {
  min-width: 64px; font-size: 13px; padding: 3px 10px; box-shadow: none;
  background: rgba(255, 255, 255, 0.12); border: 1px solid rgba(255, 255, 255, 0.25); color: var(--text);
}
.help-table button.key:hover { border-color: var(--accent); }
.help-table button.key.waiting { border-color: #ffd27a; color: #ffd27a; }
.help-table button.key.changed { border-color: var(--accent); background: rgba(217, 119, 87, 0.25); }
.help-table tr.fixed td:first-child { color: var(--muted); }
.keys-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.keys-actions button { flex: 1 1 120px; font-size: 15px; padding: 9px; }
#cmds-list { display: flex; flex-direction: column; gap: 4px; }
.cmd {
  display: flex; gap: 10px; align-items: baseline; padding: 6px 8px; border-radius: 6px; cursor: pointer;
  background: rgba(255, 255, 255, 0.05); border: 1px solid transparent; font-size: 14px;
}
.cmd:hover { border-color: var(--accent); }
.cmd code { color: #ffd27a; white-space: nowrap; font-family: Consolas, monospace; }
.cmd span { color: var(--muted); }
.cmd .tag { margin-left: auto; font-size: 11px; color: var(--accent); white-space: nowrap; }

/* HUD */
#hud { position: fixed; inset: 0; pointer-events: none; }
#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: #fff; }
#crosshair::before { left: 10px; top: 0; width: 2px; height: 22px; }
#crosshair::after { left: 0; top: 10px; width: 22px; height: 2px; }

#debug {
  position: absolute; left: 8px; top: 8px; font: 13px/1.5 Consolas, monospace;
  background: rgba(0, 0, 0, 0.45); padding: 6px 10px; border-radius: 4px; white-space: pre;
}
#online {
  position: absolute; right: 8px; top: 8px; font-size: 13px; background: rgba(0, 0, 0, 0.4);
  padding: 4px 10px; border-radius: 4px;
}

#hotbar {
  position: absolute; bottom: 12px; left: 50%; transform: translateX(-50%);
  display: flex; gap: 4px; padding: 4px; background: rgba(0, 0, 0, 0.35); border-radius: 6px;
}
.slot {
  width: 52px; height: 52px; background: var(--slot); border: 3px solid rgba(255, 255, 255, 0.15);
  border-radius: 4px; display: flex; align-items: center; justify-content: center; position: relative;
}
.slot.selected { border-color: #fff; box-shadow: 0 0 0 2px var(--accent); }
.slot canvas { width: 38px; height: 38px; image-rendering: pixelated; }
.slot .num { position: absolute; left: 3px; top: 1px; font-size: 10px; color: rgba(255,255,255,0.6); }
#block-name {
  position: absolute; bottom: 80px; left: 50%; transform: translateX(-50%);
  font-weight: 700; text-shadow: 2px 2px 0 #000; transition: opacity 0.4s; opacity: 0;
}

#chat { position: absolute; left: 8px; bottom: 104px; width: min(480px, calc(100vw - 16px)); }
#chat-log { display: flex; flex-direction: column; gap: 2px; max-height: 40vh; overflow: hidden; justify-content: flex-end; }
.chat-line {
  background: rgba(0, 0, 0, 0.45); padding: 3px 8px; border-radius: 3px; font-size: 14px;
  text-shadow: 1px 1px 0 #000; transition: opacity 1s; word-wrap: break-word;
}
.chat-line.system { color: #ffd27a; }
.chat-line.private { color: #e59cff; font-style: italic; }
.chat-line.faded { opacity: 0; }
#chat.open .chat-line.faded { opacity: 1; }
/* chat aberto: a lista rola para ver as mensagens anteriores (roda do mouse, dedo ou PgUp/PgDn no campo) */
#chat.open #chat-log { display: block; overflow-y: auto; max-height: 45vh; pointer-events: auto; overscroll-behavior: contain; }
#chat.open .chat-line { margin-top: 2px; }
#chat-log { scrollbar-width: thin; scrollbar-color: rgba(255, 255, 255, 0.35) transparent; }
#chat-log::-webkit-scrollbar { width: 6px; }
#chat-log::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, 0.35); border-radius: 3px; }
#chat-input { pointer-events: auto; width: 100%; margin-top: 4px; }
#chat-suggest { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; max-height: 5.5em; overflow-y: auto; pointer-events: auto; }
#chat-suggest[hidden] { display: none; }
#chat-suggest .sug { font: 13px/1.2 monospace; padding: 2px 6px; background: rgba(0, 0, 0, 0.7); color: #dfe; border-radius: 3px; cursor: pointer; }
#chat-suggest .sug.on { background: #2a7; color: #fff; }

#player-list {
  position: absolute; top: 40px; left: 50%; transform: translateX(-50%);
  background: rgba(0, 0, 0, 0.6); padding: 10px 16px; border-radius: 6px; min-width: 220px;
}
#player-list h3 { margin: 0 0 6px; font-size: 14px; color: var(--muted); }
#player-list div.p { padding: 2px 0; }

.muted { color: var(--muted); font-size: 12px; }
button.ghost { background: transparent; box-shadow: none; padding: 4px 10px; font-size: 18px; }

/* status */
#stats {
  position: absolute; bottom: 76px; left: 50%; transform: translateX(-50%);
  width: 492px; font-size: 18px; line-height: 1; text-shadow: 1px 1px 0 #000;
}
.stats-row { display: flex; justify-content: space-between; }
#armor-bar, #air-bar { margin-bottom: 3px; min-height: 1em; }
#armor-bar span, #air-bar span { display: inline-block; width: 19px; text-align: center; }
.bubble { color: #7fd0ff; } .bubble.half { color: #4f8fb8; } .bubble.empty { visibility: hidden; }
.shield { color: #cfe3ea; } .shield.half { color: #8aa3ab; } .shield.empty { color: #3b3b3b; }
.inv-top { display: flex; gap: 8px; align-items: flex-start; }
#inv-armor { display: grid; grid-template-columns: 44px; gap: 4px; }
#inv-armor .slot { width: 44px; height: 44px; cursor: pointer; }
#inv-armor .slot canvas { width: 32px; height: 32px; }
/* B-707: área de equipamento (armadura, boneco e mão esquerda), como no Minecraft. Casas de 44 px também no celular */
.inv-upper { display: flex; flex-wrap: wrap; gap: 4px 16px; align-items: flex-start; }
.equip { background: rgba(255, 255, 255, 0.04); border: 1px solid rgba(255, 255, 255, 0.12); border-radius: 6px; padding: 0 8px 8px; margin-bottom: 6px; }
.equip .inv-row-label { margin-top: 6px; }
#equip-pts { color: #cfe3ea; margin-left: 4px; }
.equip-body { display: flex; gap: 6px; align-items: flex-start; }
.equip-figure { display: flex; flex-direction: column; align-items: center; gap: 4px; width: 72px; }
#equip-preview {
  width: 72px; height: 128px; border-radius: 4px;
  background: radial-gradient(ellipse at 50% 92%, rgba(0, 0, 0, 0.45), transparent 55%), rgba(0, 0, 0, 0.22);
}
#inv-offhand .slot { width: 44px; height: 44px; cursor: pointer; border-color: rgba(207, 227, 234, 0.35); }
#inv-offhand .slot canvas { width: 32px; height: 32px; }
#inv-offhand .slot::before { content: 'esq.'; position: absolute; left: 3px; top: 0; font-size: 9px; color: rgba(255, 255, 255, 0.5); }
/* mão esquerda também no HUD, à esquerda da barra (só mostra; some no celular, onde a barra já ocupa a largura) */
#hotbar .slot.off-slot { margin-right: 10px; border-color: rgba(207, 227, 234, 0.35); pointer-events: none; }
@media (max-width: 700px) { #hotbar .slot.off-slot { display: none; } }
.equip-slot:not(:has(canvas)) { background-repeat: no-repeat; background-position: center; background-size: 28px; }
.equip-slot[data-piece=helmet]:not(:has(canvas)) { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath fill='%23fff' fill-opacity='.3' d='M2 12V7a6 6 0 0 1 12 0v5h-3V9H5v3z'/%3E%3C/svg%3E"); }
.equip-slot[data-piece=chestplate]:not(:has(canvas)) { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath fill='%23fff' fill-opacity='.3' d='M3 2h3l2 2 2-2h3l2 3-2 2v7H3V7L1 5z'/%3E%3C/svg%3E"); }
.equip-slot[data-piece=leggings]:not(:has(canvas)) { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath fill='%23fff' fill-opacity='.3' d='M3 2h10v4l-1 8H9L8 7l-1 7H4L3 6z'/%3E%3C/svg%3E"); }
.equip-slot[data-piece=boots]:not(:has(canvas)) { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath fill='%23fff' fill-opacity='.3' d='M1 6h4v5h2v3H1zM9 6h4v5h2v3H9z'/%3E%3C/svg%3E"); }
.equip-slot[data-piece=shield]:not(:has(canvas)) { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath fill='%23fff' fill-opacity='.3' d='M8 1l6 2v5c0 3.5-2.6 6-6 7-3.4-1-6-3.5-6-7V3z'/%3E%3C/svg%3E"); }
#chest-section h3 { margin: 6px 0; }
#chest-bars { display: grid; gap: 4px; margin-bottom: 8px; max-width: 280px; font-size: 12px; }
#chest-bars .bar-track { height: 8px; background: rgba(0, 0, 0, 0.45); border: 1px solid rgba(255, 255, 255, 0.25); }
#chest-bars .bar-fill { height: 100%; background: #e0a03c; }
#chest-grid { display: grid; grid-template-columns: repeat(9, 44px); gap: 4px; margin-bottom: 8px; }
#chest-grid .slot { width: 44px; height: 44px; cursor: pointer; background: rgba(120, 80, 30, 0.45); }
#chest-grid .slot canvas { width: 32px; height: 32px; }
#hearts span, #hunger span { display: inline-block; width: 19px; text-align: center; }
.heart { color: #e23b3b; } .heart.half { color: #e88a8a; } .heart.empty { color: #3b3b3b; }
.food { color: #d6923f; } .food.half { color: #a87a4a; } .food.empty { color: #3b3b3b; }
#stats.shake { animation: shake 0.3s; }
@keyframes shake { 25% { transform: translate(calc(-50% - 3px), 0); } 75% { transform: translate(calc(-50% + 3px), 0); } }

#break-bar {
  position: absolute; left: 50%; top: calc(50% + 22px); transform: translateX(-50%);
  width: 60px; height: 5px; background: rgba(0, 0, 0, 0.5); border-radius: 3px; display: none;
}
#break-fill { height: 100%; width: 0; background: #fff; border-radius: 3px; }

#hurt-flash {
  position: fixed; inset: 0; pointer-events: none; opacity: 0; transition: opacity 0.4s;
  background: radial-gradient(circle, transparent 40%, rgba(200, 0, 0, 0.55));
}
#hurt-flash.on { opacity: 1; transition: none; }

/* nome da zona de perigo ao cruzar a fronteira (B-014) */
#zone-title {
  position: absolute; top: 22%; left: 50%; transform: translateX(-50%); text-align: center;
  opacity: 0; transition: opacity 0.8s; text-shadow: 3px 3px 0 #000;
}
#zone-title.show { opacity: 1; }
#zone-title b { display: block; font-size: 40px; font-weight: 900; letter-spacing: 2px; }
#zone-title span { font-size: 18px; color: var(--text); }
@media (max-width: 700px) { #zone-title b { font-size: 26px; } #zone-title span { font-size: 14px; } }

#mode-badge {
  position: absolute; top: 8px; left: 50%; transform: translateX(-50%);
  background: var(--accent); padding: 3px 10px; border-radius: 4px; font-size: 12px; font-weight: 700;
}

#hotbar .slot { pointer-events: auto; }
.slot .count {
  position: absolute; right: 3px; bottom: 1px; font-size: 13px; font-weight: 700; text-shadow: 1px 1px 0 #000;
}
.slot .dur { position: absolute; left: 5px; right: 5px; bottom: 3px; height: 3px; background: #222; }
.slot .dur i { display: block; height: 100%; background: #5fd35f; }

#death { background: rgba(120, 0, 0, 0.45); z-index: 12; }

/* carregando o mundo: cobre o jogo até o terreno em volta ter malha (js/client/loading-screen.ts). Opaco, em degraus
   duros como a tela de título; o fundo é um xadrez de terra feito só com gradientes */
#loading {
  position: fixed; inset: 0; z-index: 30; display: flex; align-items: center; justify-content: center; padding: 16px;
  background-color: #3b2a1e;
  background-image:
    linear-gradient(45deg, #33241a 25%, transparent 25%, transparent 75%, #33241a 75%),
    linear-gradient(45deg, #33241a 25%, transparent 25%, transparent 75%, #33241a 75%);
  background-size: 32px 32px; background-position: 0 0, 16px 16px;
  image-rendering: pixelated;
}
#loading[hidden] { display: none; }
#loading .loading-box { width: min(360px, 100%); text-align: center; }
#loading .loading-title { margin: 0 0 14px; font-size: 20px; color: #f2f2f2; text-shadow: 2px 2px 0 #000; letter-spacing: 1px; }
#loading .loading-track { height: 14px; background: #15171c; border: 2px solid #000; box-shadow: inset 2px 2px 0 #0b0c0f; }
#loading .loading-bar { height: 100%; width: 0; background: #5fd35f; box-shadow: inset 0 -3px 0 #3c9a3c, inset 0 3px 0 #8ef08e; }
#loading .loading-pct { margin: 8px 0 0; font-size: 12px; color: #c8ccd6; text-shadow: 1px 1px 0 #000; }
#death .panel { text-align: center; min-width: 280px; }
#death h2 { margin-top: 0; font-size: 32px; }
#death-text { color: var(--muted); }

/* inventário */
/* inventário à esquerda e "Criar" à direita; só as listas rolam (nada de barra na janela inteira) */
.inv-panel {
  width: min(1040px, 100%); height: min(720px, calc(100vh - 32px)); overflow: hidden;
  display: flex; flex-direction: column; gap: 8px;
}
.inv-head { display: flex; justify-content: space-between; align-items: center; }
.inv-head h2 { margin: 0; }
.inv-tabs { display: none; }
.inv-body { display: flex; gap: 24px; flex: 1; min-height: 0; }
.items-section { flex: 0 0 auto; overflow-y: auto; padding-right: 4px; }
.craft-section { flex: 1 1 300px; min-width: 0; display: flex; flex-direction: column; min-height: 0; }
/* width 0 + min-width 100%: a dica quebra linha na largura da grade em vez de esticar a coluna */
#inventory .hint { color: var(--muted); margin: 8px 0 12px; font-size: 13px; width: 0; min-width: 100%; }
#inv-grid, #inv-hotbar { display: grid; grid-template-columns: repeat(9, 44px); gap: 4px; }
#inv-grid .slot, #inv-hotbar .slot { width: 44px; height: 44px; cursor: pointer; }
#inv-grid .slot canvas, #inv-hotbar .slot canvas { width: 32px; height: 32px; }
.slot.picked { border-color: var(--accent); background: rgba(217, 119, 87, 0.35); }
.inv-row-label { color: var(--muted); font-size: 12px; margin: 10px 0 4px; }
#trash {
  margin-top: 10px; width: 44px; height: 44px; border-radius: 4px; background: rgba(120, 30, 30, 0.6);
  display: flex; align-items: center; justify-content: center; cursor: pointer; font-size: 20px;
}
/* grade de crafting (2×2; 3×3 com bancada por perto) ao lado do resultado */
.craft-grid-row { display: flex; align-items: flex-start; gap: 10px; margin-bottom: 10px; }
#craft-grid { display: grid; gap: 4px; }
#craft-grid[data-size="2"] { grid-template-columns: repeat(2, 44px); }
#craft-grid[data-size="3"] { grid-template-columns: repeat(3, 44px); }
#craft-grid .slot, #craft-result .slot { width: 44px; height: 44px; cursor: pointer; background: rgba(255, 255, 255, 0.06); }
#craft-grid .slot canvas, #craft-result .slot canvas { width: 32px; height: 32px; }
.craft-arrow { align-self: center; font-size: 26px; color: var(--muted); margin-top: 18px; }
#craft-result .slot { width: 56px; height: 56px; border-color: rgba(255, 255, 255, 0.25); }
#craft-result .slot canvas { width: 40px; height: 40px; }
#craft-result .slot.ready { border-color: var(--accent); background: rgba(217, 119, 87, 0.25); }
#craft-result .slot.blocked { opacity: 0.45; }
.craft-grid-help { flex: 1; min-width: 0; margin: 22px 0 0; color: var(--muted); font-size: 12px; }
.slot.ghost canvas { opacity: 0.35; }
.craft-head { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.craft-section h3 { margin: 0; }
#station-info { display: flex; gap: 6px; flex-wrap: wrap; font-size: 12px; }
.station { padding: 2px 8px; border-radius: 10px; background: rgba(255, 255, 255, 0.08); color: var(--muted); }
.station.on { background: rgba(95, 211, 95, 0.18); color: #9be89b; }
.craft-filters { display: flex; gap: 10px; align-items: center; margin: 8px 0 6px; }
.craft-filters input[type=search] { flex: 1; min-width: 0; font-size: 14px; padding: 6px 10px; }
.craft-filters .check { margin: 0; font-size: 13px; white-space: nowrap; }
.craft-cats { display: flex; gap: 4px; flex-wrap: wrap; margin-bottom: 6px; }
.craft-cats button {
  font-size: 12px; padding: 4px 10px; border-radius: 12px; box-shadow: none;
  background: rgba(255, 255, 255, 0.08); color: var(--muted);
}
.craft-cats button.active { background: rgba(217, 119, 87, 0.35); color: var(--text); }
.craft-cats button:active { transform: none; }
.craft-cats b { color: #9be89b; font-weight: 700; }
#recipes { display: flex; flex-direction: column; gap: 4px; flex: 1; min-height: 0; overflow-y: auto; padding-right: 4px; }
.recipe-group { margin: 8px 2px 2px; font-size: 11px; text-transform: uppercase; letter-spacing: 1px; color: var(--accent); }
.recipe-empty { color: var(--muted); font-size: 13px; padding: 12px 4px; }
.recipe {
  display: grid; grid-template-columns: 32px 1fr auto; align-items: center; gap: 2px 10px;
  padding: 6px 8px; border-radius: 6px; background: rgba(255, 255, 255, 0.05); border: 1px solid transparent; font-size: 13px;
}
.recipe.ok { cursor: pointer; background: rgba(95, 211, 95, 0.08); }
.recipe.fills { cursor: pointer; }
.recipe.fills:hover { border-color: var(--accent); }
.recipe.ok:hover { border-color: var(--accent); }
.recipe > canvas { width: 32px; height: 32px; image-rendering: pixelated; grid-row: span 2; }
.recipe .rname { font-weight: 700; }
.recipe:not(.ok) .rname, .recipe:not(.ok) > canvas { opacity: 0.55; }
.recipe .rin { display: flex; flex-wrap: wrap; gap: 4px 10px; color: var(--muted); font-size: 12px; grid-column: 2; }
.recipe .ing { display: inline-flex; align-items: center; gap: 3px; white-space: nowrap; }
.recipe .ing canvas { width: 16px; height: 16px; image-rendering: pixelated; }
.recipe .ing.short { color: #ff8a7a; }
.recipe .why { grid-column: 2 / -1; font-size: 11px; color: #ffb38a; }
.recipe .ract { grid-row: 1 / span 2; grid-column: 3; display: flex; gap: 4px; }
.recipe .ract button { font-size: 12px; padding: 5px 10px; box-shadow: 0 2px 0 var(--accent-dark); }
.recipe .ract button.adm { background: #6a4bb0; box-shadow: 0 2px 0 #3f2a70; } /* B-859: só admin */
.recipe .adm-cmd { color: #c9b6ff; font-family: monospace; user-select: text; cursor: text; }
.recipe .ract button.more { background: rgba(255, 255, 255, 0.14); box-shadow: 0 2px 0 rgba(0, 0, 0, 0.35); }
.recipe .ract button:disabled { opacity: 0.35; cursor: default; }
.recipe .flash { color: #9be89b; font-weight: 700; margin-left: 6px; animation: flash-up 1.2s ease-out forwards; display: inline-block; }
@keyframes flash-up { from { opacity: 1; transform: translateY(0); } to { opacity: 0; transform: translateY(-10px); } }

/* paleta do criativo (B-706): no criativo, no lugar do "Criar"; casas de 48 px (dedo cabe) */
.tab[hidden] { display: none; }
.creative-section { display: none; flex: 1 1 300px; min-width: 0; flex-direction: column; min-height: 0; }
#inventory.creative .creative-section { display: flex; }
#inventory.creative .craft-section { display: none; }
.creative-tip { color: var(--muted); font-size: 12px; }
#creative-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(48px, 1fr)); gap: 4px; align-content: start;
  flex: 1; min-height: 0; overflow-y: auto; padding-right: 4px; touch-action: pan-y;
}
#creative-grid .slot { width: auto; height: 48px; cursor: pointer; }
#creative-grid .slot canvas { width: 36px; height: 36px; }
#creative-grid .slot:hover { border-color: var(--accent); }
#creative-grid.mobs { grid-template-columns: repeat(auto-fill, minmax(132px, 1fr)); }
.pal-mob {
  display: flex; align-items: center; gap: 8px; min-height: 52px; padding: 6px 10px; font-size: 14px; text-align: left;
  background: rgba(255, 255, 255, 0.08); box-shadow: 0 2px 0 rgba(0, 0, 0, 0.35); color: var(--text);
}
.pal-mob .emo { font-size: 26px; line-height: 1; }
.pal-mob.done { background: rgba(95, 211, 95, 0.22); }
.creative-empty { color: var(--muted); font-size: 13px; padding: 12px 4px; grid-column: 1 / -1; }

/* tela estreita (celular): abas Itens | Criar em vez das duas colunas */
@media (max-width: 760px) {
  .inv-tabs { display: flex; }
  .inv-body { gap: 0; }
  .inv-body[data-tab=items] .craft-section, .inv-body[data-tab=craft] .items-section { display: none; }
  #inventory .inv-body[data-tab=items] .creative-section, #inventory .inv-body[data-tab=craft] .creative-section,
  #inventory .inv-body[data-tab=creative] .items-section, #inventory .inv-body[data-tab=creative] .craft-section { display: none; }
  .items-section { flex: 1; }
  .recipe .ract button { padding: 8px 12px; font-size: 13px; }
}

/* toque */
body.touch #chat { top: 8px; bottom: auto; width: min(46vw, 420px); }
/* no toque o chat fica no topo esquerdo: os dados do F3 ("Mostrar FPS") descem para cima do joystick */
body.touch #debug { top: auto; bottom: 190px; font-size: 11px; line-height: 1.4; padding: 4px 8px; max-width: calc(50vw - 20px); white-space: pre-wrap; } /* metade esquerda: não cobre a mira */
body.touch .chat-line { font-size: 12px; padding: 2px 6px; }
body.touch #chat-input { pointer-events: auto; }
#touch-ui { position: fixed; inset: 0; pointer-events: none; z-index: 5; }
#joy-zone { position: absolute; left: 0; bottom: 0; width: 45%; height: 60%; pointer-events: auto; }
#look-zone { position: absolute; right: 0; top: 0; width: 55%; height: 100%; pointer-events: auto; }
#joy-base {
  position: absolute; left: 40px; bottom: 60px; width: 100px; height: 100px; border-radius: 50%;
  background: rgba(255, 255, 255, 0.12); border: 2px solid rgba(255, 255, 255, 0.3); opacity: 0.6;
}
#joy-base.active { opacity: 1; }
#joy-knob {
  position: absolute; left: 30px; top: 30px; width: 40px; height: 40px; border-radius: 50%;
  background: rgba(255, 255, 255, 0.5);
}
.tbtn {
  position: absolute; width: 64px; height: 64px; border-radius: 50%; pointer-events: auto;
  background: rgba(0, 0, 0, 0.35); border: 2px solid rgba(255, 255, 255, 0.35);
  display: flex; align-items: center; justify-content: center; font-size: 26px; user-select: none;
}
.tbtn.down { background: rgba(217, 119, 87, 0.6); }
.tbtn.small { width: 46px; height: 46px; font-size: 20px; }
#t-jump { right: 24px; bottom: 150px; }
#t-break { right: 100px; bottom: 200px; }
#t-place { right: 24px; bottom: 230px; }
#t-inv { right: 12px; top: 50px; }
#t-chat { right: 66px; top: 50px; }
#t-fly { right: 120px; top: 50px; }
#t-menu { right: 174px; top: 50px; }
#t-down { right: 100px; bottom: 120px; }
#t-dodge { right: 170px; bottom: 140px; }
#t-games { right: 228px; top: 50px; }
#t-shop { right: 228px; top: 50px; } /* só na partida de um jogo com loja, onde o 🎮 do lobby não aparece */

@media (max-width: 700px) {
  .slot { width: 36px; height: 36px; }
  .slot canvas { width: 26px; height: 26px; }
  .logo svg { height: 32px; }
  .logo { gap: 9px; }
  #stats { width: 340px; font-size: 14px; bottom: 58px; }
  #hearts span, #hunger span { width: 14px; }
  #armor-bar span, #air-bar span { width: 14px; }
  .inv-panel { padding: 12px; }
  .inv-top { flex-direction: column; }
  #inv-grid, #inv-hotbar, #chest-grid { grid-template-columns: repeat(9, 32px); gap: 3px; }
  /* B-707: as casas do equipamento ficam com 44 px (dedo) */
  #inv-grid .slot, #inv-hotbar .slot, #chest-grid .slot { width: 32px; height: 32px; }
  #inv-grid .slot canvas, #inv-hotbar .slot canvas, #chest-grid .slot canvas { width: 24px; height: 24px; }
  #chat { bottom: 110px; }
}

/* celular em pé: botões acima da barra, joystick mais alto */
@media (orientation: portrait) {
  body.touch #joy-zone { height: 50%; bottom: 90px; }
  body.touch #joy-base { bottom: 40px; }
  body.touch #debug { bottom: 250px; } /* acima do joystick, que em pé fica mais alto */
  body.touch #t-jump { right: 16px; bottom: 130px; }
  body.touch #t-break { right: 92px; bottom: 175px; }
  body.touch #t-place { right: 16px; bottom: 210px; }
  body.touch #t-inv { right: 12px; top: 56px; }
  body.touch #t-chat { right: 64px; top: 56px; }
  body.touch #t-fly { right: 116px; top: 56px; }
  body.touch #t-menu { right: 168px; top: 56px; }
  body.touch #t-down { right: 92px; bottom: 115px; }
  body.touch #t-dodge { right: 160px; bottom: 125px; }
  body.touch #stats { width: min(340px, calc(100vw - 16px)); }
  body.touch #hotbar { bottom: 8px; }
}

/* painel de jogos do lobby (B-120) */
#games { position: fixed; inset: 0; display: flex; align-items: center; justify-content: center; padding: 16px; background: rgba(0, 0, 0, 0.35); z-index: 10; }
.games-panel { width: min(560px, 100%); max-height: calc(100vh - 32px); overflow-y: auto; display: flex; flex-direction: column; gap: 10px; }
.games-panel h2, .games-panel p { margin: 0; }
#games-list { display: flex; flex-direction: column; gap: 8px; }
.game-card { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 10px; background: rgba(255, 255, 255, 0.06); border: 2px solid transparent; }
.game-card.queued { border-color: var(--accent); background: rgba(217, 119, 87, 0.15); }
.game-card .gi { font-size: 30px; width: 40px; text-align: center; }
.game-card .gt { flex: 1; min-width: 0; }
.game-card .gt b { display: block; font-size: 17px; }
.game-card .gt small { display: block; color: var(--muted); font-size: 13px; }
.game-card .gs { display: block; font-size: 13px; color: var(--text); margin-top: 2px; }
.game-card .gs.hot { color: var(--accent); font-weight: 700; }
.game-card button { min-height: 44px; min-width: 112px; font-size: 15px; padding: 8px 12px; }
.game-card select { min-height: 44px; max-width: 140px; }
.duel-row { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
#games-all:not(.secondary) { min-height: 56px; font-size: 20px; } /* B-243: a ação principal do painel */
.games-actions { display: flex; gap: 8px; }
.games-actions button { flex: 1; min-height: 48px; }
.games-hint { font-size: 12px; text-align: center; }
body.touch .games-hint { display: none; }
#games-banner {
  position: absolute; top: 34px; left: 50%; transform: translateX(-50%); max-width: calc(100% - 32px);
  background: rgba(0, 0, 0, 0.6); border: 2px solid var(--accent); border-radius: 8px; padding: 6px 14px;
  font-size: 15px; font-weight: 700; text-align: center; text-shadow: 1px 1px 0 #000; pointer-events: none;
}
@media (max-width: 480px) { .game-card { flex-wrap: wrap; } .game-card button { flex: 1; } }
/* loja dos Guardiões do Ovo (B-128) */
#shop-hud {
  position: absolute; right: 8px; top: 40px; pointer-events: none; font-weight: 700;
  background: rgba(0, 0, 0, 0.55); border: 2px solid var(--accent); border-radius: 8px; padding: 6px 12px; text-shadow: 1px 1px 0 #000;
}
body.touch #shop-hud { display: none; }
#shop { position: fixed; inset: 0; display: flex; align-items: center; justify-content: center; padding: 16px; background: rgba(0, 0, 0, 0.35); z-index: 11; }
/* no celular o chat e os botões de toque ficam atrás: fundo sem transparência para ler os preços */
.shop-panel { background: rgb(20, 18, 16); width: min(460px, 100%); max-height: calc(100vh - 32px); overflow-y: auto; display: flex; flex-direction: column; gap: 8px; }
.shop-panel h3, .shop-panel p { margin: 0; }
#shop-list { display: flex; flex-direction: column; gap: 6px; }
.shop-row { display: flex; align-items: center; gap: 8px; padding: 6px; border-radius: 6px; background: rgba(255, 255, 255, 0.05); }
.shop-row canvas { width: 32px; height: 32px; image-rendering: pixelated; }
.shop-row .nm { flex: 1; min-width: 0; }
.shop-row .pr { display: flex; align-items: center; gap: 4px; font-weight: bold; white-space: nowrap; }
.shop-row .pr canvas { width: 24px; height: 24px; }
.shop-row button { min-height: 44px; min-width: 96px; }
.shop-row.missing { opacity: 0.55; }
.shop-row .nm small { display: block; color: var(--muted); font-size: 12px; }
#shop-list h4 { margin: 6px 0 0; font-size: 15px; } /* B-173: melhorias do time */

/* aviso grande no meio da tela (B-300) */
#big-title {
  position: absolute; top: 28%; left: 50%; transform: translateX(-50%); width: max-content; max-width: calc(100% - 32px);
  text-align: center; pointer-events: none; color: #fff; text-shadow: 2px 2px 0 #000, 0 0 12px rgba(0, 0, 0, 0.6);
  animation: big-title-in 0.25s ease-out;
}
#big-title b { display: block; font-size: 44px; line-height: 1.1; color: #ffd84a; }
#big-title small { display: block; margin-top: 6px; font-size: 18px; font-weight: 600; }
@keyframes big-title-in { from { opacity: 0; transform: translateX(-50%) scale(1.25); } to { opacity: 1; transform: translateX(-50%) scale(1); } }
@media (max-width: 480px) { #big-title b { font-size: 32px; } #big-title small { font-size: 15px; } }

/* guia de primeiros passos (B-323): cartão no canto de cima à esquerda, acima da pausa para dar para clicar com o mouse solto */
#guia {
  position: fixed; top: 8px; left: 8px; z-index: 11; width: min(340px, calc(100vw - 16px));
  display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px;
  background: rgba(20, 18, 16, 0.86); border: 2px solid var(--accent); border-radius: 8px;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.4); text-shadow: 1px 1px 0 #000; animation: guia-in 0.3s ease-out;
}
#guia.fim { border-color: #ffd84a; }
#guia .guia-ic { width: 48px; height: 48px; flex: none; image-rendering: pixelated; }
#guia .guia-tx { flex: 1; min-width: 0; }
#guia .guia-tx small { color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: 1px; }
#guia .guia-ti { display: block; font-size: 16px; margin: 2px 0; }
#guia .guia-p { margin: 0; font-size: 13px; line-height: 1.4; }
#guia .guia-p kbd { font-size: 12px; }
#guia .guia-pontos { margin-top: 6px; font-size: 11px; letter-spacing: 2px; color: var(--accent); }
#guia .guia-bt { display: flex; flex-direction: column; gap: 6px; flex: none; }
#guia .guia-bt button { font-size: 13px; padding: 6px 8px; min-width: 76px; min-height: 36px; }
@keyframes guia-in { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: none; } }
@media (max-width: 480px) { #guia { flex-wrap: wrap; } #guia .guia-bt { flex-direction: row; width: 100%; } #guia .guia-bt button { flex: 1; } }
body.touch #guia { top: 44px; } /* abaixo do contador de online, longe da zona de olhar */

/* notas da Batalha de Construção (B-601) */
#vote-bar {
  position: fixed; bottom: 110px; left: 50%; transform: translateX(-50%); display: flex; align-items: center; gap: 6px; z-index: 6;
  background: rgba(0, 0, 0, 0.6); border: 2px solid #ffd84a; border-radius: 8px; padding: 6px 10px; color: #fff; text-shadow: 1px 1px 0 #000;
}
#vote-bar[hidden] { display: none; }
#vote-bar span { font-weight: 600; margin-right: 4px; }
#vote-bar button { width: 40px; height: 40px; font-size: 18px; font-weight: 700; border-radius: 6px; border: 2px solid #888; background: #333; color: #ffd84a; cursor: pointer; }
#vote-bar button.on { border-color: #ffd84a; background: #6a5a10; }

/* modpack mode: the active pack under the title of the start screen */
.modpack-line { margin: 4px 0; font-size: 12px; opacity: .75; text-align: center; }


.mods-btn { width: 100%; margin: 8px 0; padding: 8px 12px; border: 1px solid rgba(255, 255, 255, 0.18); border-radius: 6px; background: rgba(255, 255, 255, 0.07); color: var(--text); font: 600 14px var(--font); cursor: pointer; }
.mods-btn:hover, .mods-btn:focus-visible { background: rgba(255, 255, 255, 0.14); }
.mods-dialog { width: min(760px, calc(100vw - 32px)); height: min(680px, calc(100vh - 32px)); padding: 16px; border: 1px solid rgba(255, 255, 255, 0.16); border-radius: 10px; background: #1c1916; color: var(--text); font-family: var(--font); }
.mods-dialog[open] { display: flex; flex-direction: column; gap: 12px; }
.mods-dialog::backdrop { background: rgba(0, 0, 0, 0.6); }
.mods-head { display: flex; justify-content: space-between; align-items: center; }
.mods-head h2 { margin: 0; font-size: 20px; }
.mods-close { width: 32px; height: 32px; border: 0; border-radius: 6px; background: transparent; color: var(--text); font-size: 16px; cursor: pointer; }
.mods-close:hover { background: rgba(255, 255, 255, 0.12); }
.mods-body { flex: 1; min-height: 0; display: grid; grid-template-columns: 260px 1fr; gap: 16px; }
.mods-left { min-height: 0; display: flex; flex-direction: column; gap: 8px; }
.mods-search { padding: 8px 10px; border: 1px solid rgba(255, 255, 255, 0.18); border-radius: 6px; background: var(--slot); color: var(--text); font: 14px var(--font); }
.mods-list { flex: 1; min-height: 0; margin: 0; padding: 0; list-style: none; overflow-y: auto; }
.mods-empty { padding: 12px; color: var(--muted); font-size: 13px; }
.mod-row { width: 100%; display: flex; align-items: center; gap: 10px; padding: 8px; border: 0; border-radius: 6px; background: transparent; color: var(--text); text-align: left; cursor: pointer; }
.mod-row:hover { background: rgba(255, 255, 255, 0.07); }
.mod-row.selected { background: rgba(217, 119, 87, 0.28); }
.mod-row-text { min-width: 0; display: flex; flex-direction: column; }
.mod-row-text strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 14px; }
.mod-row-text small { color: var(--muted); }
.mod-badge { flex: none; width: 36px; height: 36px; display: grid; place-items: center; border-radius: 6px; color: #fff; font-weight: 700; }
.mod-detail { min-width: 0; overflow-y: auto; padding: 4px 8px; overflow-wrap: anywhere; }
.mod-detail-head { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.mod-detail-head h3 { margin: 0; font-size: 18px; }
.mod-version { color: var(--muted); font-size: 13px; }
.mod-description { line-height: 1.5; }
.mod-field { margin: 6px 0; font-size: 14px; }
.mod-field a { color: var(--accent); }
@media (max-width: 600px) { .mods-body { grid-template-columns: 1fr; grid-template-rows: 40% 1fr; } }
.mods-close, .mod-row { box-shadow: none; transform: none; }

/* a tela em pixel do inventário (camada de GUI) está aberta: o resto do DOM do inventário/HUD não aparece por baixo */
body.gui-screen-open #hotbar, body.gui-screen-open #stats, body.gui-screen-open #block-name, body.gui-screen-open #crosshair { visibility: hidden; }
/* um MENU do jogo desenhado em pixel está na frente. No CELULAR o HUD e os botões de toque são HTML e ficariam
   aparecendo em volta do painel (e o canvas, que está por cima, já come o dedo deles), então eles saem de cena —
   é o que o fundo do painel em HTML fazia. No computador o HUD é desenhado na mesma camada e nada disto se aplica. */
/* `opacity` e não só `visibility`: o #stats ganha `style.visibility` no código (no criativo ele some), e um estilo
   em linha ganha de qualquer regra daqui — a opacidade do pai apaga o grupo inteiro de um jeito que não se discute. */
body.touch.gui-menu-open #hud, body.touch.gui-menu-open #touch-ui { opacity: 0; visibility: hidden; }
/* botões de toque de ações de mods (ctx.client.input.action com `touch`): uma coluna no meio da direita */
#touch-mod { position: absolute; right: 12px; top: 110px; display: flex; flex-direction: column; gap: 8px; pointer-events: none; }
#touch-mod .tbtn { position: static; }
/* tela de atalhos: categorias das ações registradas e aviso de tecla repetida */
#keys-table tr.section th { text-align: left; padding: 10px 6px 4px; color: #d97757; font-size: 13px; letter-spacing: .04em; text-transform: uppercase; }
#keys-table .conflict { color: #e0b020; }
#keys-table button.key.conflict { border-color: #e0b020; }

/* componentes que um mod põe num menu registrado (ctx.ui.gui.widgets('menu:pause', ...)) e as páginas de mod da pausa */
.menu-widgets { display: flex; flex-direction: column; gap: 6px; margin-top: 8px; }
.menu-widget-row { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.menu-widget-label { color: #9aa0a6; font-size: 14px; }
.menu-widget-btn { min-height: 44px; width: 100%; }
.menu-widget-row .menu-widget-btn { width: auto; flex: 1 1 auto; }
/* um menu que um MOD monta em HTML (ctx.ui.gui.menu(id, { dom: { mount } })): o motor dá este nó vazio na frente de
   tudo e o mod monta o que quiser dentro, com o kit em DOM (e.ui). Vale para qualquer mod, não só o jogo base. */
.menu-dom { position: fixed; inset: 0; z-index: 8; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; padding: 16px; overflow: auto; }
.menu-dom[hidden] { display: none; }
/* um menu de tipo `card` (ctx.ui.gui.menu(id, { kind: 'card' })): fica num canto sobre o HUD, sem cobrir a tela e
   sem comer o clique do jogo (só o que ele desenha dentro é clicável). */
.menu-dom.menu-card { inset: auto 10px 76px auto; align-items: flex-end; justify-content: flex-end; padding: 0; overflow: visible; pointer-events: none; }
.menu-dom.menu-card > * { pointer-events: auto; }
/* pausa DESENHADA EM PIXEL com uma página aberta: o nó #paused volta à tela só para o painel da página (as quatro
   páginas ainda são HTML), e o menu inicial em HTML fica fora — quem o desenha é o canvas. */
#paused.pixel .pause-home { display: none; }

/* Meus mods (client/src/my-mods-panel.ts): the player's own client-only mods, inside the mods dialog */
.my-mods { flex: none; max-height: 40%; overflow-y: auto; border-top: 1px solid rgba(255, 255, 255, 0.16); padding-top: 10px; display: flex; flex-direction: column; gap: 8px; }
.my-mods.drop { outline: 2px dashed #d8b45a; outline-offset: -4px; }
.my-mods h3 { margin: 0; font-size: 16px; }
.my-mods-warn, .my-mods-desc, .my-mods-why, .my-mods-msg { margin: 0; font-size: 12px; line-height: 1.4; opacity: 0.85; }
.my-mods-msg.bad, .my-mods-why { color: #ffb48a; opacity: 1; }
.my-mods-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.my-mods-hint { font-size: 12px; opacity: 0.7; }
.my-mods-btn { padding: 4px 10px; border-radius: 6px; border: 1px solid rgba(255, 255, 255, 0.25); background: #2a2622; color: inherit; font: inherit; font-size: 13px; cursor: pointer; }
.my-mods-list { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 6px; }
.my-mods-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 6px 10px; padding: 6px 8px; border-radius: 6px; background: rgba(255, 255, 255, 0.05); }
.my-mods-row-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 8px; }
.my-mods-row p { flex-basis: 100%; }
.my-mods-actions { display: flex; gap: 6px; }
.my-mods-badge { font-size: 10px; font-weight: 700; letter-spacing: 0.04em; padding: 1px 6px; border-radius: 999px; background: #3b5a3a; color: #d8f0d4; }
.my-mods-empty { font-size: 12px; opacity: 0.6; }

/* Opções aberta pela tela de título: só o painel da página, sem o menu da pausa */
#paused.title-opts .pause-home, #paused.title-opts .pause-tip { display: none; }
#paused.title-opts { background: rgba(8, 10, 14, 0.78); }
#paused.title-opts .pause-page { background: #1d1e22; }

/* "Convidar amigos" (client/src/host/invite-panel.ts): o código da sala enquanto o mundo está aberto a visitas.
   Fica abaixo do contador de jogadores (#online), no mesmo canto. */
#invite-box {
  position: absolute; right: 8px; top: 40px; max-width: 260px;
  display: flex; flex-direction: column; gap: 4px; align-items: flex-start;
  padding: 8px 10px; background: rgba(0, 0, 0, 0.55); border-radius: 4px; font-size: 13px;
}
#invite-box .invite-label { font-size: 11px; text-transform: uppercase; letter-spacing: 0.08em; opacity: 0.7; }
#invite-box .invite-code { font-size: 26px; letter-spacing: 0.22em; line-height: 1.1; }
#invite-box .invite-players { opacity: 0.85; }
#invite-box .invite-hint { font-size: 11px; opacity: 0.7; overflow-wrap: anywhere; }
#invite-box .invite-actions { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 2px; }
