/* ===== Variáveis (atualizadas em JS por fase) ===== */
:root {
  --bg: #f7f5ef;
  --ink: #2b2b2b;
  --muted: #888;
  --accent: #8b5a2b;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  overflow: hidden;
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  transition: background 0.6s ease;
}

#wrap {
  position: relative;
  width: 100vw;
  height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

h1 {
  margin: 0 0 8px;
  font-size: 28px;
  letter-spacing: 2px;
  color: var(--accent);
}

#hud {
  margin: 0 0 8px;
  font-size: 13px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  display: flex;
  gap: 18px;
  flex-wrap: wrap;
  justify-content: center;
  max-width: 95vw;
}
#hud b { color: var(--ink); font-weight: 700; }

#combo-wrap b {
  color: #e08020;
  display: inline-block;
  transform-origin: center;
}

@keyframes comboPop {
  0%   { transform: scale(1); }
  30%  { transform: scale(1.9); }
  100% { transform: scale(1); }
}
.pulse { animation: comboPop 0.45s ease-out; }

#phase-hud   { color: var(--accent); font-weight: 700; }
#powerup-hud { color: #2a7; font-weight: 700; min-width: 80px; }
#fps-wrap    { font-size: 11px; opacity: 0.7; }
#fps-wrap b  { color: var(--ink); }

canvas {
  background: #fff;
  border: 2px solid var(--ink);
  border-radius: 6px;
  max-width: 95vw;
  height: auto;
  image-rendering: pixelated;
  box-shadow: 0 8px 24px rgba(0,0,0,0.08);
  transition: background 0.6s ease;
}

#help {
  margin-top: 10px;
  font-size: 11px;
  color: var(--muted);
  text-align: center;
  line-height: 1.6;
  max-width: 95vw;
}

kbd {
  background: #eee;
  border: 1px solid #ccc;
  border-bottom-width: 2px;
  border-radius: 4px;
  padding: 1px 6px;
  font-family: ui-monospace, Menlo, monospace;
  font-size: 11px;
}

/* ===== Util buttons (mudo, skin, conquistas) - sempre visíveis ===== */
#util-btns {
  position: fixed;
  top: 8px;
  right: 8px;
  display: flex;
  gap: 4px;
  z-index: 5;
}
#util-btns button {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: rgba(0,0,0,0.06);
  border: 1px solid currentColor;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s, color 0.15s, transform 0.1s;
}
#util-btns button:hover { background: rgba(255,255,255,0.18); color: var(--ink); }
#util-btns button:active { transform: scale(0.88); }
#util-btns button.off { opacity: 0.45; text-decoration: line-through; }

/* ===== Mobile UI (escondido por padrão, JS adiciona .mobile no body) ===== */
#mobile-ui { display: none; }

body.mobile #help { display: none; }

body.mobile #mobile-ui {
  display: flex;
  position: fixed;
  bottom: 12px;
  left: 0;
  right: 0;
  padding: 0 16px;
  justify-content: space-between;
  align-items: flex-end;
  gap: 8px;
  z-index: 10;
  pointer-events: none;
}

body.mobile #mobile-ui .group {
  display: flex;
  gap: 8px;
  pointer-events: auto;
}

body.mobile #mobile-ui button {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  border: 2px solid rgba(0,0,0,0.4);
  background: rgba(255,255,255,0.78);
  font-size: 22px;
  font-weight: 700;
  color: var(--ink);
  font-family: inherit;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  line-height: 1;
  user-select: none;
  -webkit-user-select: none;
  touch-action: none;
}

body.mobile #mobile-ui button.big {
  width: 96px;
  height: 96px;
  background: rgba(139, 90, 43, 0.65);
  color: #fff;
  border-color: rgba(0,0,0,0.5);
  font-size: 28px;
}

body.mobile #mobile-ui button:active {
  transform: scale(0.92);
  background: rgba(255,255,255,0.85);
}
body.mobile #mobile-ui button.big:active {
  background: rgba(139, 90, 43, 0.9);
}

body.mobile #mobile-ui button small {
  font-size: 9px;
  font-weight: 600;
  opacity: 0.85;
  margin-top: 3px;
}

body.mobile #hud { font-size: 11px; gap: 10px; }
body.mobile h1 { font-size: 20px; margin-bottom: 4px; }

#orient-warn {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(247,245,239,0.97);
  z-index: 20;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 24px;
  font-size: 16px;
  color: var(--ink);
}
body.mobile.portrait #orient-warn { display: flex; }
