/* ===========================================================
   MinerPlay — Estilos compartilhados (visual futurista/cripto)
   Base: verde fósforo + ciano neon, painéis de vidro, grade.
   Mobile-first.
   =========================================================== */

:root {
  --bg: #060a08;
  --bg-2: #0a1210;
  --panel: rgba(18, 28, 22, 0.55);
  --panel-solid: #0f1a14;
  --line: rgba(124, 252, 90, 0.18);
  --line-2: rgba(73, 228, 255, 0.18);
  --screen: #080e0a;
  --green: #7cfc5a;
  --cyan: #49e4ff;
  --amber: #ffd34a;
  --food: #ff5a4a;
  --fg: #dff6d4;
  --muted: #7fa088;
  --glow-green: 0 0 20px rgba(124, 252, 90, 0.35);
  --glow-cyan: 0 0 20px rgba(73, 228, 255, 0.30);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }

body {
  background: var(--bg);
  color: var(--fg);
  font-family: 'VT323', ui-monospace, monospace;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  overflow-x: hidden;
  position: relative;
}

/* Fundo: brilhos neon + grade sutil */
body::before {
  content: "";
  position: fixed; inset: 0; z-index: -2;
  background:
    radial-gradient(60% 50% at 50% -10%, rgba(73, 228, 255, 0.12), transparent 70%),
    radial-gradient(70% 60% at 50% 110%, rgba(124, 252, 90, 0.10), transparent 70%),
    var(--bg);
}
body::after {
  content: "";
  position: fixed; inset: 0; z-index: -1;
  background-image:
    linear-gradient(rgba(124, 252, 90, 0.05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(124, 252, 90, 0.05) 1px, transparent 1px);
  background-size: 40px 40px;
  -webkit-mask-image: radial-gradient(circle at 50% 40%, #000 30%, transparent 85%);
  mask-image: radial-gradient(circle at 50% 40%, #000 30%, transparent 85%);
}

.app {
  max-width: 480px;
  margin: 0 auto;
  min-height: 100%;
  display: flex;
  flex-direction: column;
  padding:
    max(14px, env(safe-area-inset-top))
    max(14px, env(safe-area-inset-right))
    max(14px, env(safe-area-inset-bottom))
    max(14px, env(safe-area-inset-left));
  gap: 14px;
}

/* vidro reutilizável */
.glass {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

/* ---------- Barra de topo ---------- */
.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
}
.logo {
  font-family: 'Press Start 2P', monospace;
  font-size: 14px; letter-spacing: 1px; cursor: pointer;
  background: linear-gradient(90deg, var(--green), var(--cyan));
  -webkit-background-clip: text; background-clip: text; color: transparent;
  filter: drop-shadow(0 0 10px rgba(124, 252, 90, 0.4));
}
.logo span { -webkit-text-fill-color: var(--fg); filter: none; }

.wallet {
  display: flex; align-items: center; gap: 8px;
  background: var(--panel);
  border: 1px solid var(--line-2);
  border-radius: 999px; padding: 5px 13px;
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  box-shadow: inset 0 0 12px rgba(73, 228, 255, 0.06);
}
.wallet .mdot {
  width: 10px; height: 10px; border-radius: 50%;
  background: var(--muted); transition: background .3s, box-shadow .3s;
}
.wallet .mdot.live {
  background: var(--green);
  box-shadow: 0 0 0 4px rgba(124, 252, 90, 0.18);
  animation: pulse 1.6s infinite;
}
@keyframes pulse { 50% { box-shadow: 0 0 0 7px rgba(124, 252, 90, 0); } }
.wallet .amount { font-size: 22px; color: var(--green); line-height: 1; }
.wallet .cur { font-size: 15px; color: var(--cyan); }

/* ---------- HUD de jogo ---------- */
.gamebar { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.chips { display: flex; gap: 8px; }
.chip {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px; padding: 3px 11px; text-align: center; min-width: 56px;
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
}
.chip .l { display: block; font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: 1px; }
.chip .v { display: block; font-size: 24px; color: var(--green); line-height: 1; }
.backbtn {
  background: var(--panel); border: 1px solid var(--line-2); color: var(--fg);
  font-family: 'VT323', monospace; font-size: 20px; border-radius: 10px; padding: 4px 13px; cursor: pointer;
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
}
.backbtn:active { background: rgba(73, 228, 255, 0.15); }
.autobtn { font-size: 18px; }
.autobtn.on {
  background: rgba(124, 252, 90, 0.2);
  border-color: var(--green);
  box-shadow: 0 0 14px rgba(124, 252, 90, 0.4);
  animation: pulse 1.6s infinite;
}

/* ---------- Tela do jogo ---------- */
.board-wrap { position: relative; width: 100%; aspect-ratio: 1 / 1; }
canvas {
  width: 100%; height: 100%;
  background: var(--screen);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: 0 0 30px rgba(124, 252, 90, 0.08), inset 0 0 40px rgba(124, 252, 90, 0.05);
  display: block; touch-action: none;
}

/* ---------- Telas sobrepostas ---------- */
.overlay {
  position: absolute; inset: 0;
  background: radial-gradient(circle at 50% 35%, rgba(12, 28, 20, 0.85), rgba(4, 8, 6, 0.95));
  border-radius: 14px;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-align: center; gap: 14px; padding: 24px;
  backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px);
}
.overlay.hidden { display: none; }
.overlay h1 {
  font-family: 'Press Start 2P', monospace; font-size: 22px; margin: 0;
  background: linear-gradient(90deg, var(--green), var(--cyan));
  -webkit-background-clip: text; background-clip: text; color: transparent;
  filter: drop-shadow(0 0 16px rgba(124, 252, 90, 0.5));
}
.overlay h1.small { font-size: 16px; }
.overlay p { font-size: 20px; margin: 0; line-height: 1.3; }
.overlay .emoji { font-size: 42px; filter: drop-shadow(0 0 12px rgba(124,252,90,.5)); }
.overlay .amber { color: var(--amber); }

.btn {
  font-family: 'Press Start 2P', monospace; font-size: 13px; color: #04120a;
  background: linear-gradient(90deg, var(--green), #38d6b0);
  border: none; border-radius: 12px; padding: 14px 24px; cursor: pointer;
  box-shadow: 0 0 22px rgba(124, 252, 90, 0.4), 0 6px 0 rgba(10, 80, 50, 0.6);
  transition: transform .1s, box-shadow .2s;
}
.btn:hover { box-shadow: 0 0 30px rgba(124, 252, 90, 0.6), 0 6px 0 rgba(10, 80, 50, 0.6); }
.btn:active { transform: translateY(3px) scale(.98); box-shadow: 0 0 20px rgba(124,252,90,.4); }
.btn.ghost {
  background: transparent; color: var(--fg);
  border: 1px solid var(--line-2); box-shadow: none; font-size: 11px;
}

/* ---------- Direcional ---------- */
.dpad {
  display: grid; grid-template-columns: repeat(3, 54px); grid-template-rows: repeat(2, 54px);
  gap: 8px; justify-content: center;
}
.dpad.hidden { display: none; }
.dbtn {
  font-size: 22px; color: var(--green);
  background: var(--panel); border: 1px solid var(--line);
  border-radius: 12px; cursor: pointer; display: flex; align-items: center; justify-content: center;
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
}
.dbtn:active { background: rgba(124, 252, 90, 0.2); color: #04120a; }
.dbtn.up { grid-column: 2; grid-row: 1; }
.dbtn.left { grid-column: 1; grid-row: 2; }
.dbtn.down { grid-column: 2; grid-row: 2; }
.dbtn.right { grid-column: 3; grid-row: 2; }

.tip { font-size: 15px; color: var(--muted); text-align: center; margin: 0; }

/* ---------- HUB ---------- */
.hub-title {
  font-family: 'Press Start 2P', monospace; font-size: 12px; color: var(--cyan);
  text-align: center; letter-spacing: 2px; margin: 4px 0;
  text-shadow: 0 0 12px rgba(73, 228, 255, 0.4);
}
.grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.game-card {
  position: relative;
  background: linear-gradient(160deg, rgba(20, 34, 26, 0.7), rgba(10, 18, 14, 0.7));
  border: 1px solid var(--line);
  border-radius: 16px; padding: 18px 14px;
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  cursor: pointer; text-align: center;
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  transition: transform .12s, border-color .2s, box-shadow .2s;
  overflow: hidden;
}
.game-card::before {
  content: ""; position: absolute; inset: 0;
  background: radial-gradient(circle at 50% 0%, rgba(124, 252, 90, 0.12), transparent 60%);
  opacity: 0; transition: opacity .2s;
}
.game-card:hover { border-color: rgba(124, 252, 90, 0.5); box-shadow: 0 0 24px rgba(124, 252, 90, 0.15); }
.game-card:hover::before { opacity: 1; }
.game-card:active { transform: scale(.96); }
.game-card .ico { font-size: 40px; filter: drop-shadow(0 0 10px rgba(124, 252, 90, 0.5)); }
.game-card .name { font-family: 'Press Start 2P', monospace; font-size: 11px; color: var(--green); }
.game-card .tag { font-size: 16px; color: var(--muted); line-height: 1.2; }
.game-card.soon { opacity: .45; cursor: default; }
.game-card.soon:active { transform: none; }
.game-card .badge {
  font-size: 13px; color: var(--amber); border: 1px solid var(--amber);
  border-radius: 999px; padding: 1px 8px; letter-spacing: 1px;
}

/* ---------- Modal (gate de mineração) ---------- */
.modal-bg {
  position: fixed; inset: 0; z-index: 100;
  background: rgba(3, 6, 4, 0.75);
  backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
  display: flex; align-items: center; justify-content: center; padding: 20px;
}
.modal-bg.hidden { display: none; }
.modal {
  background: linear-gradient(160deg, rgba(20, 34, 26, 0.9), rgba(10, 18, 14, 0.92));
  border: 1px solid rgba(73, 228, 255, 0.3);
  border-radius: 18px; max-width: 400px; width: 100%; padding: 22px;
  display: flex; flex-direction: column; gap: 14px;
  box-shadow: 0 0 40px rgba(73, 228, 255, 0.15);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
}
.modal h2 {
  font-family: 'Press Start 2P', monospace; font-size: 15px; margin: 0; line-height: 1.5;
  background: linear-gradient(90deg, var(--green), var(--cyan));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.modal p { font-size: 18px; margin: 0; line-height: 1.35; }
.modal ul { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 8px; }
.modal li { font-size: 17px; display: flex; gap: 8px; align-items: flex-start; line-height: 1.3; }
.modal li b { color: var(--green); }
.modal .check { color: var(--green); flex: none; }
.modal .actions { display: flex; flex-direction: column; gap: 8px; margin-top: 4px; }

/* Visibilidade por telas */
.view { display: none; flex-direction: column; gap: 14px; }
.view.active { display: flex; }
