/* Tudo fica dentro de #gg-game para não interferir no restante do site. */
html, body { margin: 0; height: 100%; background: #14160f; overscroll-behavior: none; }

#gg-game {
  --gg-green: #7ba42d;
  --gg-dark: #14160f;
  position: relative;
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: 480px;
  height: 100vh;
  height: 100dvh;
  margin: 0 auto;
  background: var(--gg-dark);
  color: #fff;
  font: 700 14px/1.2 "Courier New", ui-monospace, monospace;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
  touch-action: none;
  overflow: hidden;
}
#gg-game *, #gg-game *::before { box-sizing: border-box; }
#gg-game [hidden] { display: none !important; }

.gg-stage { position: relative; flex: 1; min-height: 0; display: flex; align-items: center; justify-content: center; }
#gg-canvas { display: block; image-rendering: pixelated; image-rendering: crisp-edges; }

.gg-hud {
  position: absolute; top: 6px; left: 6px; right: 6px;
  display: grid; grid-template-columns: 1fr auto 1fr; gap: 6px; align-items: start;
  pointer-events: none;
}
.gg-col { display: flex; flex-direction: column; gap: 4px; justify-self: start; }
.gg-box {
  background: rgba(20, 22, 15, .82); border: 2px solid #3d4a4f; border-radius: 4px;
  padding: 2px 6px; text-align: center; min-width: 78px;
}
.gg-box small { display: block; font-size: 8px; color: #b9c2b0; letter-spacing: 1px; }
.gg-box b { display: block; font-size: 14px; white-space: nowrap; font-variant-numeric: tabular-nums; }
.gg-speed { border-color: #5d6c73; padding: 2px 12px; }
.gg-speed b { font-size: 26px; color: #ff8a3a; min-width: 3ch; }
.gg-speed small { font-size: 9px; }

.gg-logo {
  position: absolute; top: 6px; right: 6px; width: 88px; height: auto; pointer-events: none;
  filter: drop-shadow(0 2px 0 rgba(0, 0, 0, .45));
}
.gg-side { position: absolute; top: 56px; right: 6px; display: flex; gap: 6px; }
.gg-mini {
  width: 41px; height: 36px; padding: 0; display: flex; align-items: center; justify-content: center;
  background: rgba(20, 22, 15, .82); color: #fff; border: 2px solid #3d4a4f; border-radius: 4px;
  font: inherit; font-size: 10px; letter-spacing: 1px; cursor: pointer;
}
.gg-mini svg { width: 16px; height: 16px; fill: #fff; shape-rendering: crispEdges; }
.gg-mini.gg-off { color: #7d857a; text-decoration: line-through; }

.gg-screen { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; padding: 16px; }
.gg-dim { background: rgba(10, 12, 8, .6); }

.gg-talk { display: flex; align-items: flex-end; gap: 10px; margin-bottom: 12px; }
.gg-talk img { width: 66px; height: 60px; flex: none; image-rendering: pixelated; image-rendering: crisp-edges; }
.gg-talk p {
  position: relative; margin: 0; padding: 8px 10px; text-align: left;
  background: #fff; color: #14160f; border: 3px solid #14160f; border-radius: 4px;
  font-size: 13px; line-height: 1.25;
}
.gg-talk p::before { /* ponta do balão, virada para o Guerreiro */
  content: ""; position: absolute; left: -11px; bottom: 12px; width: 8px; height: 8px;
  background: #fff; border-left: 3px solid #14160f; border-bottom: 3px solid #14160f;
  transform: rotate(45deg);
}

.gg-btn {
  display: block; width: 100%; min-height: 48px; margin-top: 10px; padding: 10px 14px;
  background: var(--gg-green); color: #10140a; border: 0; border-radius: 4px;
  box-shadow: 0 4px 0 #4a6617; font: inherit; font-size: 15px; letter-spacing: 1px; cursor: pointer;
}
.gg-btn:active { transform: translateY(3px); box-shadow: 0 1px 0 #4a6617; }
.gg-btn.gg-big { width: auto; min-height: 64px; padding: 14px 34px; font-size: 24px; }
.gg-btn.gg-sec { background: #2a3036; color: #fff; box-shadow: 0 4px 0 #15191c; }
.gg-btn:disabled { opacity: .45; cursor: default; }

.gg-panel {
  width: 100%; max-width: 300px; max-height: 100%; overflow-y: auto; padding: 16px; text-align: center;
  background: #1b1f17; border: 3px solid var(--gg-green); border-radius: 6px;
}
.gg-panel h2 { margin: 0 0 8px; font-size: 18px; letter-spacing: 2px; }
.gg-panel dl { display: grid; grid-template-columns: 1fr auto; gap: 6px 10px; margin: 10px 0 4px; text-align: left; }
.gg-panel dt { color: #b9c2b0; font-weight: 400; }
.gg-panel dd { margin: 0; text-align: right; font-variant-numeric: tabular-nums; }
.gg-record {
  margin: 0; padding: 6px; background: #ffd23f; color: #201a00; border-radius: 4px;
  font-size: 16px; letter-spacing: 2px; animation: gg-blink .5s steps(2) infinite;
}
@keyframes gg-blink { 50% { background: #ff8a3a; } }

/* Controles por cima da pista, 40% transparentes. */
.gg-controls {
  position: absolute; left: 0; right: 0; bottom: 0;
  display: grid; grid-template-columns: 1fr auto 1fr; align-items: end;
  padding: 0 10px calc(10px + env(safe-area-inset-bottom, 0px));
  pointer-events: none;
}
.gg-arrows { grid-column: 2; display: flex; gap: 28px; }
.gg-key {
  width: 68px; height: 62px; padding: 0; pointer-events: auto; opacity: .6;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 5px;
  background: #cfd6da; color: #1b1f17; border: 3px solid #5d6c73; border-radius: 6px;
  box-shadow: 0 4px 0 #3d4a4f; font: inherit; font-size: 12px; letter-spacing: 1px; cursor: pointer;
  touch-action: none;
}
.gg-key svg { width: 36px; height: 36px; fill: #1b1f17; shape-rendering: crispEdges; }
.gg-key:active { transform: translateY(3px); box-shadow: 0 1px 0 #3d4a4f; background: #aeb8bd; }
.gg-turbo { grid-column: 3; justify-self: end; background: #2a3036; color: #ffd23f; border-color: #ff8a3a; }
.gg-turbo:active { background: #3a2a1a; }
.gg-turbo.gg-empty { opacity: .3; }
.gg-pips { display: flex; gap: 4px; }
.gg-pips i { width: 10px; height: 10px; background: #ff8a3a; border: 2px solid #ffd23f; }
.gg-pips i.gg-used { background: #15191c; border-color: #4b4e54; }

/* Tela inicial: o Guerreiro ao lado do botão */
.gg-intro { display: flex; align-items: center; justify-content: center; gap: 14px; }
.gg-intro img {
  height: min(36vh, 228px); width: auto; flex: none;
  image-rendering: pixelated; image-rendering: crisp-edges;
  filter: drop-shadow(0 4px 0 rgba(0, 0, 0, .45));
}
.gg-intro-go { display: flex; flex-direction: column; align-items: center; gap: 10px; }
.gg-tip {
  margin: 0; padding: 6px 8px; max-width: 190px; text-align: center;
  background: rgba(20, 22, 15, .82); border-radius: 4px; font-size: 11px; font-weight: 400; color: #dfe5d8;
}

/* Compartilhar recorde */
.gg-btn.gg-share { background: #ffd23f; color: #201a00; box-shadow: 0 4px 0 #a88708; }
.gg-shareto { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 6px; margin-top: 8px; }
.gg-shareto a {
  padding: 8px 4px; border-radius: 4px; background: #2a3036; color: #fff;
  font-size: 11px; text-decoration: none; text-align: center;
}
.gg-shareto a[hidden] { display: none; }
.gg-shareto small { grid-column: 1 / -1; color: #b9c2b0; font-weight: 400; font-size: 10px; }

@media (max-width: 350px) {
  .gg-key { width: 60px; height: 56px; }
  .gg-arrows { gap: 20px; }
  .gg-btn.gg-big { padding: 12px 22px; font-size: 20px; }
}
@media (max-height: 420px) { .gg-key { height: 48px; } }
@media (max-height: 560px) {
  .gg-panel { padding: 10px; }
  .gg-btn { min-height: 40px; margin-top: 7px; padding: 6px 10px; }
  .gg-talk { margin-bottom: 8px; }
}
