/* ============================================================
   City API — tema Minecraft (gamificado)
   ============================================================ */
:root {
  --stone: #7a7a7a;
  --stone-d: #565656;
  --stone-l: #9a9a9a;
  --dirt: #79553a;
  --dirt-d: #513622;
  --grass: #5d9c3c;
  --grass-d: #3f6b28;
  --wood: #9c7a4d;
  --panel: #2b2b33;
  --panel-2: #3a3a44;
  --ink: #e8e8ec;
  --ink-dim: #a8a8b4;
  --gold: #ffd257;
  --gold-d: #c9962b;
  --xp: #7bd93b;
  --red: #d64b4b;
  --blue: #4c9aff;
  --shadow: rgba(0,0,0,.45);
  --px: 4px;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: 'VT323', 'Courier New', monospace;
  font-size: 22px;
  line-height: 1.15;
  color: var(--ink);
  background: #1a1a20;
  overflow-x: hidden;
  image-rendering: pixelated;
}
h1, h2, h3, .pixel { font-family: 'Press Start 2P', monospace; }
code { font-family: 'VT323', monospace; background: #0006; padding: 0 6px; color: var(--gold); }
button, input, select, textarea { font-family: inherit; font-size: inherit; color: inherit; }

/* céu com nuvens sutis ao fundo */
.sky {
  position: fixed; inset: 0; z-index: -2;
  background:
    linear-gradient(180deg, #6ba7e0 0%, #8fc0ea 40%, #bfe0f0 100%);
}
.sky::after {
  content: ""; position: fixed; inset: 0; z-index: -1; opacity: .5;
  background-image:
    radial-gradient(circle at 20% 30%, #fff 0 40px, transparent 41px),
    radial-gradient(circle at 25% 32%, #fff 0 55px, transparent 56px),
    radial-gradient(circle at 70% 20%, #fff 0 50px, transparent 51px),
    radial-gradient(circle at 75% 24%, #fff 0 40px, transparent 41px);
  filter: blur(2px);
}
body::before { /* faixa de terreno */
  content:""; position: fixed; left:0; right:0; bottom:0; height: 90px; z-index:-1;
  background:
    linear-gradient(180deg, var(--grass) 0 14px, var(--grass-d) 14px 20px, var(--dirt) 20px 100%);
  box-shadow: inset 0 6px 0 #ffffff22;
}

/* ---------- painel estilo GUI do Minecraft (bisel 3D) ---------- */
.mc-panel {
  background: var(--panel);
  border: var(--px) solid #000;
  box-shadow:
    inset 3px 3px 0 #ffffff18,
    inset -4px -4px 0 #00000055,
    0 6px 0 #00000040;
  position: relative;
}

/* ---------- botões ---------- */
.mc-btn {
  background: linear-gradient(180deg, var(--stone-l), var(--stone) 55%, var(--stone-d));
  border: var(--px) solid #000;
  box-shadow: inset 2px 2px 0 #ffffff40, inset -3px -3px 0 #00000060;
  color: #fff; text-shadow: 2px 2px 0 #000a;
  padding: 10px 16px; cursor: pointer; letter-spacing: .5px;
  transition: filter .05s;
}
.mc-btn:hover { filter: brightness(1.12); border-color: var(--gold); }
.mc-btn:active { box-shadow: inset -2px -2px 0 #ffffff30, inset 3px 3px 0 #00000060; transform: translateY(1px); }
.mc-btn.primary { background: linear-gradient(180deg, #7ed957, var(--grass) 55%, var(--grass-d)); text-shadow: 2px 2px 0 #0007; }
.mc-btn.danger { background: linear-gradient(180deg, #e87070, var(--red) 55%, #9c2f2f); }
.mc-btn.tiny { padding: 4px 10px; font-family: 'Press Start 2P'; font-size: 12px; }

.mc-input, .mc-select {
  background: #10101a; border: var(--px) solid #000;
  box-shadow: inset 2px 2px 0 #00000080;
  padding: 8px 12px; color: var(--ink); min-width: 220px;
}
.mc-input::placeholder { color: #66667a; }
.mc-select { cursor: pointer; }

/* ---------- header ---------- */
.hud-top {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  flex-wrap: wrap; padding: 14px 22px; margin: 14px auto 0; max-width: 1200px;
}
.title { display: flex; align-items: center; gap: 12px; }
.title .cube { font-size: 34px; filter: drop-shadow(3px 3px 0 #0007); }
.title h1 { margin: 0; font-size: 22px; color: #fff; text-shadow: 3px 3px 0 #000a, 0 0 2px #000; }
.hud-right { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.world-picker { display: flex; flex-direction: column; gap: 2px; }
.world-picker label { font-family: 'Press Start 2P'; font-size: 10px; color: #063; text-shadow: 1px 1px 0 #fff6; }
.key-btn.ok { border-color: var(--xp); }
.key-btn.no { border-color: var(--red); }

/* ---------- stats / xp ---------- */
.stats-bar {
  max-width: 1200px; margin: 10px auto 0; padding: 0 22px;
  display: flex; align-items: center; gap: 18px; flex-wrap: wrap;
}
.stat { display: flex; align-items: center; gap: 6px; color: #fff; text-shadow: 2px 2px 0 #000a; }
.stat b { color: var(--gold); font-size: 26px; }
.stat-ico { font-size: 20px; }
.xp {
  position: relative; flex: 1; min-width: 160px; height: 20px;
  background: #10240a; border: var(--px) solid #000; box-shadow: inset 2px 2px 0 #0009;
}
.xp-fill { height: 100%; width: 0; background: linear-gradient(180deg, #a6ff6b, var(--xp)); transition: width .4s; }
.xp span { position: absolute; inset: 0; display: grid; place-items: center; font-family: 'Press Start 2P'; font-size: 10px; text-shadow: 1px 1px 0 #000; }

/* ---------- hotbar ---------- */
.hotbar {
  max-width: 1200px; margin: 16px auto 0; padding: 8px; display: flex; gap: 8px;
  background: #0006; border: var(--px) solid #000; width: fit-content;
  box-shadow: inset 2px 2px 0 #ffffff14, inset -2px -2px 0 #0008;
}
.slot {
  width: 92px; height: 74px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
  background: linear-gradient(180deg, #8b8b8b, #6d6d6d); border: var(--px) solid #373737;
  box-shadow: inset 2px 2px 0 #ffffff40, inset -3px -3px 0 #00000055; cursor: pointer;
}
.slot span { font-size: 28px; filter: drop-shadow(2px 2px 0 #0006); }
.slot em { font-style: normal; font-family: 'Press Start 2P'; font-size: 9px; color: #2a2a2a; text-shadow: 1px 1px 0 #fff5; }
.slot:hover { filter: brightness(1.08); }
.slot.active { border-color: #fff; box-shadow: inset 0 0 0 2px #fff, inset 2px 2px 0 #ffffff40, 0 0 12px #fff8; }

/* ---------- main / tabs ---------- */
main { max-width: 1200px; margin: 18px auto 120px; padding: 0 22px; }
.panel-tab { display: none; }
.panel-tab.active { display: block; }
.toolbar { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; margin-bottom: 16px; }
.dim { color: #cfe9ff; text-shadow: 1px 1px 0 #0009; }

/* ---------- MAPA ---------- */
.map-shell { padding: 8px; height: 68vh; min-height: 460px; overflow: hidden; }
#map { display: block; width: 100%; height: 100%; cursor: grab; background: #12161d; image-rendering: pixelated; }
#map.grabbing { cursor: grabbing; }
.map-shell > * { position: absolute; }
.map-compass {
  top: 18px; left: 18px; width: 48px; height: 48px; border-radius: 50%;
  background: #0008; border: var(--px) solid #000; display: grid; place-items: center;
  font-family: 'Press Start 2P'; font-size: 12px; color: var(--red); box-shadow: inset 2px 2px 0 #fff2;
}
.map-compass .needle { position: absolute; top: -2px; color: var(--red); font-size: 14px; }
.map-controls { top: 18px; right: 18px; display: flex; flex-direction: column; gap: 6px; }
.map-readout {
  bottom: 16px; left: 18px; background: #000a; border: var(--px) solid #000;
  padding: 4px 10px; color: var(--gold); font-size: 18px;
}
.map-legend {
  bottom: 16px; right: 18px; padding: 10px 12px; max-width: 240px;
  display: flex; flex-direction: column; gap: 5px; background: #1e1e26ee;
}
.map-legend .lg { display: flex; align-items: center; gap: 8px; font-size: 18px; }
.map-legend .sw { width: 16px; height: 16px; border: 2px solid #000; flex: none; }
.map-tooltip {
  pointer-events: none; z-index: 20; background: #14131fee; border: var(--px) solid #000;
  box-shadow: 4px 4px 0 #0007; padding: 8px 12px; max-width: 280px; display: none;
}
.map-tooltip.show { display: block; }
.map-tooltip h4 { margin: 0 0 4px; font-family: 'Press Start 2P'; font-size: 11px; color: var(--gold); }
.map-tooltip .row { display: flex; justify-content: space-between; gap: 14px; color: var(--ink-dim); }
.map-tooltip .row b { color: #fff; }
.map-tooltip .dimreg { color: #6f7d8c; font-size: 15px; margin-bottom: 6px; }
.map-tooltip .cta { margin-top: 6px; color: var(--xp); }
.map-empty { inset: 0; display: grid; place-content: center; text-align: center; color: var(--ink-dim); gap: 6px; }
.map-empty p { margin: 4px; }

/* ---------- cards ---------- */
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 14px; }
.card { background: var(--panel); border: var(--px) solid #000; box-shadow: inset 2px 2px 0 #ffffff14, inset -3px -3px 0 #0007; padding: 14px; display: flex; flex-direction: column; gap: 8px; }
.card h3 { margin: 0; font-size: 13px; color: #fff; display: flex; align-items: center; gap: 8px; }
.card .sub { color: var(--ink-dim); word-break: break-word; }
.card .meta { display: flex; flex-wrap: wrap; gap: 6px; }
.tag { font-size: 16px; padding: 1px 8px; border: 2px solid #000; background: #0004; }
.tag.type { color: #cfe1ff; } .tag.reg { color: #001b06; background: var(--xp); }
.tag.unreg { color: #2a1c00; background: var(--gold); }
.tag.pub { color: #001b06; background: #7bd93b; } .tag.priv { color: #fff; background: var(--red); }
.card .actions { display: flex; gap: 8px; margin-top: 2px; flex-wrap: wrap; }
.empty { grid-column: 1/-1; text-align: center; padding: 40px; color: var(--ink-dim); }

/* ---------- modal ---------- */
.modal-backdrop { position: fixed; inset: 0; background: #000a; display: grid; place-items: center; padding: 20px; z-index: 50; }
.modal { width: 100%; max-width: 540px; max-height: 90vh; display: flex; flex-direction: column; background: var(--panel-2); }
.modal-head { display: flex; justify-content: space-between; align-items: center; padding: 14px 18px; border-bottom: var(--px) solid #000; }
.modal-head h2 { margin: 0; font-size: 14px; color: var(--gold); }
.modal-body { padding: 18px; overflow-y: auto; display: grid; gap: 14px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 10px; padding: 14px 18px; border-top: var(--px) solid #000; }
.field { display: flex; flex-direction: column; gap: 4px; }
.field > label { font-size: 18px; color: var(--ink-dim); }
.field input, .field select, .field textarea { background: #10101a; border: var(--px) solid #000; box-shadow: inset 2px 2px 0 #0008; padding: 8px 12px; width: 100%; }
.field textarea { min-height: 70px; resize: vertical; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.check { display: flex; align-items: center; gap: 8px; color: var(--ink-dim); }
.check input { width: 20px; height: 20px; }

/* ---------- toast ---------- */
.toast { position: fixed; bottom: 26px; left: 50%; transform: translateX(-50%); z-index: 60; background: var(--panel); border: var(--px) solid #000; box-shadow: 5px 5px 0 #0007; padding: 12px 18px; max-width: 90vw; }
.toast.ok { border-color: var(--xp); } .toast.err { border-color: var(--red); }
.hidden { display: none !important; }

@media (max-width: 640px) {
  body { font-size: 20px; }
  .title h1 { font-size: 15px; }
  .slot { width: 74px; height: 64px; }
  .map-legend { max-width: 160px; }
}
