/* Grindstone — Forge of Galaxy
   Tema: "Oficina Clara" — UI Minecraft em azul-claro/branco; as telas de forja e
   arena mergulham nos backgrounds de concept-art. Ícones sempre pixelados. */


@font-face {
  font-family: "Minecraftia";
  src: url("/static/fonts/Minecraftia-Regular.ttf") format("truetype");
  font-display: swap;
}
:root {
  --sky: #bfe3f5; --sky-2: #e8f4fc; --paper: #fdfefe;
  --ink: #22394a; --ink-soft: #51708a;
  --line: #7fa8c9; --line-dark: #4e7ba0;
  --slot: #cfe2ef; --slot-dark: #9dbdd4; --slot-light: #f2fafe;
  --em: #2fa860; --star: #d9a521; --err: #c0483b; --ok: #2fa860;
  --purple: #a05cd5;
  --font-pix: "Minecraftia", "Courier New", ui-monospace, monospace;
  --font-body: "Segoe UI", system-ui, -apple-system, sans-serif;
}

* { box-sizing: border-box; margin: 0; }
html, body { height: 100%; }
body { font-family: var(--font-body); color: var(--ink); background: var(--sky); overflow: hidden; }
img.icon, .slot img, .nav-btn img, .shop-card img, .foe-face img,
img[src*="/assets/items/"] { image-rendering: pixelated; }
button { font-family: inherit; cursor: pointer; }
.hidden { display: none !important; }
.pix { font-family: var(--font-pix); letter-spacing: 0; -webkit-font-smoothing: none; }
h1, h2, h3, .mc-btn, .cur, .t-name, .nav-btn span { font-family: var(--font-pix); letter-spacing: 0; -webkit-font-smoothing: none; }
h1 { font-size: 24px; } .mc-btn { text-transform: none; }

.screen { position: fixed; inset: 0; }
.bg-cover { background-size: cover; background-position: center; }

/* ---------- painel estilo Minecraft (claro) ---------- */
.mc-panel {
  background: linear-gradient(180deg, var(--paper), var(--sky-2));
  border: 3px solid var(--line-dark);
  border-radius: 10px;
  box-shadow: inset 0 3px 0 #ffffffcc, inset 0 -4px 0 #a9c8dd, 0 6px 18px #1c374d33;
}
.mc-btn {
  background: linear-gradient(180deg, #f6fbff, #cfe6f5);
  border: 2px solid var(--line-dark); border-radius: 9px;
  padding: 9px 16px; font-weight: 700; color: var(--ink);
  box-shadow: inset 0 2px 0 #fff, inset 0 -3px 0 #9dbdd4, 0 2px 0 #4e7ba055;
  transition: transform .08s, filter .12s;
}
.mc-btn:hover { filter: brightness(1.05); }
.mc-btn:active { transform: translateY(2px); box-shadow: inset 0 2px 0 #fff, inset 0 -1px 0 #9dbdd4; }
.mc-btn.primary { background: linear-gradient(180deg, #8fd6ff, #4aa8e0); color: #08324f; border-color: #2d6f9d; }
.mc-btn.gold { background: linear-gradient(180deg, #ffe9a8, #ecc253); border-color: #a8842b; color: #4d3a08; }
.mc-btn.danger { background: linear-gradient(180deg, #ffc9c0, #e57a6a); border-color: #a03e30; color: #4d130b; }
.mc-btn.small { padding: 5px 10px; font-size: 13px; }
.mc-btn:disabled { filter: grayscale(.7) brightness(.95); cursor: not-allowed; }
.mc-input {
  background: var(--paper); border: 2px solid var(--line-dark); border-radius: 8px;
  padding: 10px 12px; font-size: 15px; color: var(--ink); width: 100%;
  box-shadow: inset 0 2px 4px #9dbdd466;
}
.mc-input:focus { outline: 3px solid #8fd6ff88; }

/* ---------- login ---------- */
#scr-login { display: grid; place-items: center; }
.login-box { width: min(400px, 92vw); padding: 26px 28px 22px; text-align: center; display: grid; gap: 11px; }
.login-logo { width: 108px; margin: -70px auto 0; filter: drop-shadow(0 6px 10px #0007); }
.login-box h1 { font-size: 30px; }
.login-box .sub { color: var(--ink-soft); margin-top: -10px; font-style: italic; }
.hint { font-size: 12px; color: var(--ink-soft); }
.err { color: var(--err); font-weight: 700; min-height: 1.2em; font-size: 13px; }
.appear { animation: pop .35s cubic-bezier(.2,1.4,.4,1); }
@keyframes pop { from { transform: scale(.9); opacity: 0 } }

/* ---------- layout do jogo ---------- */
#scr-game { display: grid; grid-template: 62px 1fr / 88px 1fr; gap: 10px; padding: 10px; }
#hud { grid-column: 1 / 3; display: flex; align-items: center; gap: 16px; padding: 6px 16px; z-index: 5; }
.hud-logo { height: 44px; }
.hud-title { font-size: 20px; }
.hud-level { flex: 1; max-width: 300px; }
.lvl-bar { height: 12px; background: var(--slot-dark); border: 2px solid var(--line-dark); border-radius: 7px; overflow: hidden; }
.lvl-bar i { display: block; height: 100%; background: linear-gradient(90deg, #63e08b, #2fa860); transition: width .5s; }
.lvl-txt { font-size: 11px; color: var(--ink-soft); font-weight: 700; }
.hud-cur { display: flex; gap: 14px; align-items: center; }
.cur { display: flex; gap: 5px; align-items: center; font-weight: 800; }
.cur .icon { width: 16px; height: 16px; }
.hud-galaxy { font-size: 18px; color: var(--ok); }
.hud-galaxy.off { color: var(--err); }

#nav { display: flex; flex-direction: column; gap: 4px; padding: 8px 6px; align-items: stretch; z-index: 5; }
.nav-btn { display: grid; justify-items: center; gap: 2px; background: none; border: 2px solid transparent; border-radius: 9px; padding: 6px 2px; color: var(--ink); font-size: 10.5px; font-weight: 700; }
.nav-btn img { width: 32px; height: 32px; }
.nav-btn:hover { background: #ffffff88; }
.nav-btn.active { background: #fff; border-color: var(--line-dark); box-shadow: inset 0 -3px 0 #9dbdd4; }

#stage { position: relative; border-radius: 12px; overflow: auto; border: 3px solid var(--line-dark);
         background-color: var(--sky-2); transition: background-image .3s; }
#content { min-height: 100%; padding: 20px; }

/* véu de leitura sobre concept-art */
.veil { background: linear-gradient(180deg, #0a1420b0, #0a142070 30%, #0a1420c8); position: absolute; inset: 0; pointer-events: none; }
.veil.lite { background: linear-gradient(180deg, #0a142022, transparent 30%, #0a142040); }
.forge-hero .mc-panel { background: linear-gradient(180deg, #14283aa8, #0d1c2ab0); backdrop-filter: blur(3px); }
.on-art { position: relative; color: #eaf4fb; }
.on-art .mc-panel { background: linear-gradient(180deg, #14283ae8, #0d1c2ae8); border-color: #3d5f7d; color: #eaf4fb; box-shadow: inset 0 2px 0 #ffffff22, 0 8px 24px #0009; }
.on-art .mc-input { background: #0d1c2a; color: #eaf4fb; border-color: #3d5f7d; }

/* ---------- cards genéricos ---------- */
.grid { display: grid; gap: 14px; }
.cols-2 { grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }
.cols-3 { grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); }
.card { padding: 16px; }
.card h2 { font-size: 17px; margin-bottom: 8px; display: flex; gap: 8px; align-items: center; }
.card h2 img { width: 16px; height: 16px; image-rendering: pixelated; }
.muted { color: var(--ink-soft); font-size: 13px; }
.on-art .muted { color: #a9c3d8; }

/* ---------- inventário / slots ---------- */
.inv-grid { display: grid; grid-template-columns: repeat(8, 62px); gap: 8px; justify-content: center; }
.slot {
  width: 62px; height: 62px; border-radius: 8px; position: relative; display: grid; place-items: center;
  background: var(--slot); border: 2px solid var(--slot-dark);
  box-shadow: inset 2px 2px 0 #8fb2c9, inset -2px -2px 0 var(--slot-light);
  transition: transform .12s;
}
.slot img { width: 48px; height: 48px; pointer-events: none; }
.slot:hover { transform: translateY(-3px); background: #dcedf8; }
.slot.drag-over { outline: 3px dashed var(--line-dark); }
.slot .badge { position: absolute; right: 3px; bottom: 2px; font-size: 10px; font-weight: 900; color: #fff; text-shadow: 0 1px 2px #000; }
.slot.forging::after { content: "🔥"; position: absolute; top: 2px; left: 4px; animation: flick 1s infinite alternate; }
@keyframes flick { to { transform: scale(1.25) rotate(-6deg); } }
.slot .ptime { position: absolute; left: 0; right: 0; bottom: -2px; height: 6px; background: #0006; border-radius: 0 0 6px 6px; overflow: hidden; }
.slot .ptime i { display: block; height: 100%; background: linear-gradient(90deg, #ffb347, #ff6b35); }
.slot.trash { background: #f3d3ce; border-color: #c98177; }
.slot.trash img { opacity: .8; width: 32px; height: 32px; }
.slot.sel { outline: 3px solid var(--star); }
.slot.floaty img { animation: floaty 2.4s ease-in-out infinite; }
@keyframes floaty { 50% { transform: translateY(-4px); } }

/* tooltip estilo Minecraft */
.mc-tooltip {
  position: fixed; z-index: 99; pointer-events: none; max-width: 280px;
  background: #180d20f0; border: 2px solid #2a0e5a; outline: 2px solid #180d20f0;
  color: #fff; padding: 8px 10px; font-size: 13px; border-radius: 3px;
}
.mc-tooltip .t-name { font-weight: 800; }
.mc-tooltip .t-ench { color: var(--purple); }
.mc-tooltip .t-gray { color: #9aa3ad; font-style: italic; }

/* ---------- forja ---------- */
.forge-hero { display: grid; gap: 14px; max-width: 1040px; margin: 0 auto; }
.forge-row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.pick { display: flex; gap: 8px; flex-wrap: wrap; }
.pick .opt { display: grid; justify-items: center; gap: 4px; padding: 8px 10px; border: 2px solid #3d5f7d; border-radius: 9px; background: #0d1c2a; color: #cfe3f2; font-size: 12px; font-weight: 700; }
.pick .opt img { width: 32px; height: 32px; image-rendering: pixelated; }
.pick .opt.sel { border-color: var(--star); background: #241d0a; box-shadow: 0 0 12px #d9a52166; }
.pick .opt:disabled { opacity: .35; cursor: not-allowed; }
.forge-progress { height: 20px; border: 2px solid #3d5f7d; border-radius: 10px; background: #0d1c2a; overflow: hidden; position: relative; }
.forge-progress i { display: block; height: 100%; background: linear-gradient(90deg, #ff9a3d, #ff5722); transition: width 1s linear; }
.sparks { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.spark { position: absolute; width: 4px; height: 4px; background: #ffd45e; border-radius: 50%; animation: spark 1s ease-out forwards; }
@keyframes spark { to { transform: translate(var(--dx), var(--dy)) scale(0); opacity: 0; } }
.up-card { display: flex; gap: 10px; align-items: center; }
.up-card img { width: 32px; height: 32px; image-rendering: pixelated; }
.tag-owned { color: var(--ok); font-weight: 800; }

/* ---------- loja ---------- */
.shop-card { padding: 12px; display: grid; justify-items: center; gap: 6px; text-align: center; }
.shop-card img { width: 48px; height: 48px; }
.shop-card .price { font-weight: 900; }
.stockbar { width: 100%; height: 8px; border-radius: 5px; background: var(--slot-dark); overflow: hidden; }
.stockbar i { display: block; height: 100%; background: var(--ok); }
.shop-shelf { background: linear-gradient(180deg, #f7efdd, #ead9b8); border-color: #a8845a; color: var(--ink); }
.shop-shelf .muted { color: #7a6238; }

/* ---------- arena ---------- */
.foe-card { display: flex; gap: 12px; align-items: center; }
.foe-face { width: 64px; height: 64px; border-radius: 10px; display: grid; place-items: center; background: #0d1c2a; border: 2px solid #3d5f7d; font-size: 34px; }
.foe-face.strong { border-color: var(--err); box-shadow: 0 0 14px #c0483b88; }
.foe-eyes { text-shadow: 0 0 10px #ff3b3b; }
.battle { max-width: 900px; margin: 0 auto; display: grid; gap: 12px; }
.hp-row { display: flex; justify-content: space-between; gap: 20px; }
.hp { flex: 1; }
.hp-bar { height: 16px; border: 2px solid #3d5f7d; border-radius: 9px; background: #0d1c2a; overflow: hidden; }
.hp-bar i { display: block; height: 100%; background: linear-gradient(90deg, #63e08b, #2fa860); transition: width .5s; }
.hp-bar.enemy i { background: linear-gradient(90deg, #ff7b6b, #c0483b); }
.duel { display: flex; justify-content: space-between; align-items: flex-end; min-height: 130px; padding: 0 30px; }
.duel .fighter { font-size: 64px; filter: drop-shadow(0 6px 8px #000c); transition: transform .25s; }
.duel .fighter img { width: 80px; height: 80px; image-rendering: pixelated; }
.atk-p { animation: lunge-r .45s; } .atk-e { animation: lunge-l .45s; }
@keyframes lunge-r { 30% { transform: translateX(46px) rotate(12deg); } }
@keyframes lunge-l { 30% { transform: translateX(-46px) rotate(-12deg); } }
.hurt { animation: hurt .4s; }
@keyframes hurt { 25%, 75% { transform: translateX(-5px); filter: brightness(2) sepia(1) hue-rotate(-50deg); } 50% { transform: translateX(5px); } }
.battle-log { height: 140px; overflow-y: auto; font-size: 13.5px; padding: 10px; display: grid; gap: 3px; align-content: start; }
.battle-log .p { color: #8fd6ff; } .battle-log .e { color: #ff9a8d; } .battle-log .s { color: #ffd45e; font-weight: 800; }
.actions { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; }
.float-dmg { position: absolute; font-weight: 900; font-size: 22px; color: #ffd45e; text-shadow: 0 2px 4px #000; animation: rise 1s forwards; pointer-events: none; }
@keyframes rise { to { transform: translateY(-60px); opacity: 0; } }

/* ---------- taverna ---------- */
.tavern { max-width: 860px; margin: 0 auto; display: grid; gap: 10px; }
.parchment { background: linear-gradient(180deg, #f6ecd4, #ecd9ad); border: 3px solid #9c7a45; color: #3c2c12;
  border-radius: 4px; box-shadow: inset 0 0 40px #b98f4a55, 0 8px 24px #0008; }
.chat-box { height: 46vh; overflow-y: auto; padding: 14px; display: grid; gap: 4px; align-content: start; font-size: 14px; }
.chat-line b { color: #6b4a12; }
.chat-line.priv { color: #7c3aa8; }
.chat-line .ts { color: #9c7a45; font-size: 11px; margin-right: 6px; }
.chat-send { display: flex; gap: 8px; padding: 10px; }

/* ---------- amigos ---------- */
.friend-row { display: flex; align-items: center; gap: 10px; padding: 8px 4px; border-bottom: 1px dashed var(--line); }
.dot { width: 10px; height: 10px; border-radius: 50%; background: #9aa3ad; }
.dot.on { background: var(--ok); box-shadow: 0 0 8px var(--ok); }

/* ---------- suporte / tabelas ---------- */
.ticket { border-left: 4px solid var(--line-dark); padding: 8px 12px; background: #ffffffaa; border-radius: 6px; }
.ticket .re { border-left: 3px solid var(--ok); margin-top: 6px; padding-left: 8px; }

/* ---------- toasts ---------- */
#toasts { position: fixed; right: 16px; bottom: 16px; display: grid; gap: 8px; z-index: 100; }
.toast { padding: 10px 16px; border-radius: 9px; color: #fff; font-weight: 700; animation: pop .3s; box-shadow: 0 6px 18px #0006; max-width: 340px; }
.toast.info { background: #35688f; } .toast.success { background: var(--ok); }
.toast.warning { background: var(--star); color: #3c2c02; } .toast.error { background: var(--err); }

/* ---------- home ---------- */
.home-hero { max-width: 900px; margin: 4vh auto; text-align: center; display: grid; gap: 18px; }
.home-hero .mc-panel { padding: 26px; }
.home-hero h1 { font-size: 34px; }
.quick { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }

@media (max-width: 760px) {
  #scr-game { grid-template: 58px 1fr 64px / 1fr; }
  #nav { grid-row: 3; flex-direction: row; overflow-x: auto; }
  #stage { grid-row: 2; }
  .hud-title, .nav-btn span { display: none; }
  .inv-grid { grid-template-columns: repeat(4, 62px); }
}
@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}

.login-ver { position: absolute; right: 14px; bottom: 10px; font-family: var(--font-pix);
  font-size: 12px; color: #ffffffb8; text-shadow: 0 1px 2px #000c; letter-spacing: 0; }
