/* KIROMAN: estilos do jogo. A estrutura (ids e classes) é a do pacman-js. */
* { box-sizing: border-box; }

body {
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font-ui);
  margin: 0;
  overflow: hidden;
  -webkit-tap-highlight-color: transparent;
}

.overflow-mask {
  background:
    radial-gradient(1200px 600px at 50% -10%, rgb(144 70 255 / 18%), transparent 60%),
    var(--bg);
  display: flex;
  height: 100vh;
  height: 100dvh;
  justify-content: center;
  overflow: hidden;
  position: relative;
  touch-action: none;
  user-select: none;
}

.fps-display { position: absolute; right: 10px; top: 10px; visibility: hidden; }

.preload-div {
  bottom: 0;
  display: flex;
  height: 1px;
  overflow: hidden;
  position: absolute;
  visibility: hidden;
  width: 1px;
}

/* ------------------------------------------------------------ cabeçalho */
.header-buttons {
  align-items: center;
  display: flex;
  justify-content: space-between;
  left: 0;
  padding: 14px 18px;
  position: absolute;
  top: 0;
  width: 100%;
  z-index: 6;
}

.header-buttons span { display: flex; gap: 6px; }

.header-buttons button,
.back-link {
  align-items: center;
  background: rgb(17 16 20 / 70%);
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--fg);
  cursor: pointer;
  display: inline-flex;
  font: 700 13px/1 var(--font-ui);
  height: 44px;
  justify-content: center;
  letter-spacing: 0.08em;
  min-width: 44px;
  padding: 0 12px;
  text-decoration: none;
}

.header-buttons button:hover,
.back-link:hover { border-color: var(--kiro-purple); color: var(--kiro-purple-300); }

.header-buttons button:focus-visible,
.back-link:focus-visible { outline: 3px solid var(--kiro-purple-300); outline-offset: 2px; }

.paused-text {
  align-items: center;
  color: var(--kiro-purple-300);
  display: flex;
  filter: drop-shadow(0 0 16px rgb(144 70 255 / 80%));
  font-size: 56px;
  height: 100%;
  justify-content: center;
  left: 0;
  position: absolute;
  visibility: hidden;
  width: 100%;
  z-index: 3;
}

/* ------------------------------------------------------------ HUD + labirinto */
.game-ui {
  display: flex;
  flex-direction: column;
  height: 100%;
  justify-content: center;
}

.game-ui .row { display: flex; }

.game-ui .top {
  font-weight: 700;
  letter-spacing: 0.08em;
}

.game-ui .top .column { display: grid; gap: 2px; }
.game-ui .top ._25 { width: 30%; }
.game-ui .top ._50 { width: 40%; }
.game-ui .top .column > div:first-child { color: var(--muted); font-size: 0.75em; text-align: center; }

.game-ui .top .column > div:last-child {
  color: var(--fg);
  font-variant-numeric: tabular-nums;
  text-align: center;
}

.game-ui .one-up { animation: blink 0.8s steps(1) infinite; color: var(--kiro-purple-300) !important; }

@keyframes blink { 50% { opacity: 0; } }

.game-ui .bottom { align-items: flex-start; justify-content: space-between; }
.game-ui .bottom .extra-lives { display: flex; gap: 4px; }
.game-ui .bottom .fruit-display { display: flex; flex-direction: row-reverse; }

.maze {
  margin: 0 auto;
  position: relative;
}

.maze-img {
  height: 100%;
  left: 0;
  position: absolute;
  top: 0;
  user-select: none;
  width: 100%;
}

.maze-cover {
  background: var(--bg);
  height: 100%;
  position: absolute;
  visibility: hidden;
  width: 100%;
  z-index: 3;
}

.pacman,
.ghost {
  background-repeat: no-repeat;
  margin: 0;
  position: absolute;
}

.pacman { z-index: 2; }
.ghost { z-index: 2; }

#pacman { filter: drop-shadow(0 0 4px rgb(144 70 255 / 90%)); }
#pacman-arrow { opacity: 0.8; z-index: 1; }

#dot-container > div { filter: drop-shadow(0 0 2px rgb(216 180 254 / 90%)); }

.power-pellet {
  animation: spec-pulse 0.9s ease-in-out infinite;
  filter: drop-shadow(0 0 4px rgb(144 70 255 / 100%));
}

@keyframes spec-pulse {
  50% { opacity: 0.35; transform: scale(0.85); }
}

.float-text {
  align-items: center;
  display: flex;
  justify-content: center;
  pointer-events: none;
}

.float-text svg { height: 1em; overflow: visible; width: auto; }
.float-text--ready { color: var(--code-yellow); filter: drop-shadow(0 0 6px rgb(255 242 179 / 70%)); }
.float-text--over { color: var(--danger); filter: drop-shadow(0 0 6px rgb(255 92 122 / 70%)); }
.float-text--points { color: var(--code-cyan); filter: drop-shadow(0 0 4px rgb(128 244 255 / 70%)); }

/* ------------------------------------------------------------ cortinas */
.loading-cover {
  background:
    repeating-linear-gradient(90deg, rgb(255 255 255 / 4%) 0 2px, transparent 2px 24px),
    linear-gradient(180deg, var(--kiro-purple-700), var(--kiro-purple-900));
  height: 100%;
  position: absolute;
  top: 0;
  width: 50%;
  z-index: 4;
}

.left { left: 0; transition: left 0.5s 0.5s; }
.right { right: 0; transition: right 0.5s 0.5s; }

.loading-container {
  background: #000;
  border: 2px solid var(--kiro-purple);
  border-radius: 999px;
  box-shadow: var(--glow);
  height: 18px;
  overflow: hidden;
  position: absolute;
  top: 50%;
  transition: opacity 0.5s 0.4s;
  width: min(420px, 80vw);
  z-index: 5;
}

.loading-pacman {
  background: var(--kiro-purple-300);
  border-radius: 999px;
  height: 100%;
  position: absolute;
  transition: left 0.4s;
  width: 18px;
  z-index: 2;
}

.loading-dot-mask {
  background: var(--kiro-purple);
  height: 100%;
  left: 0;
  position: absolute;
  top: 0;
  transition: width 0.4s;
}

.error-message {
  color: var(--fg);
  font-size: 18px;
  opacity: 0;
  position: absolute;
  text-align: center;
  top: 30vh;
  transition: opacity 0.5s;
  visibility: hidden;
  width: min(560px, 90vw);
  z-index: 6;
}

.error-message pixel-text { color: var(--danger); font-size: 48px; }

/* ------------------------------------------------------------ menu inicial */
.main-menu-container {
  display: flex;
  flex-direction: column;
  height: 100%;
  left: 0;
  opacity: 0;
  overflow-y: auto;
  padding: 72px 16px 16px;
  position: absolute;
  transition: opacity 0.25s;
  visibility: hidden;
  width: 100%;
  z-index: 5;
}

.menu {
  align-items: center;
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: clamp(14px, 2.4vh, 26px);
  justify-content: center;
  margin: 0 auto;
  max-width: 760px;
  text-align: center;
  width: 100%;
}

.menu-title { display: grid; gap: 14px; justify-items: center; }

.menu-hero {
  animation: hero-float 0.44s steps(4) infinite;
  background: url(../assets/sprites/kiro_right.svg) 0 0 / 384px 96px no-repeat;
  filter: drop-shadow(0 0 18px rgb(144 70 255 / 80%));
  height: 96px;
  image-rendering: pixelated;
  width: 96px;
}

@keyframes hero-float { to { background-position: -384px 0; } }

.menu-logo {
  color: var(--kiro-purple-300);
  filter: drop-shadow(0 0 18px rgb(144 70 255 / 85%));
  font-size: clamp(44px, 9vw, 92px);
}

.menu-tagline {
  color: var(--muted);
  font-size: clamp(14px, 1.9vw, 17px);
  line-height: 1.5;
  margin: 0;
  max-width: 560px;
}

.menu-cast {
  background: rgb(17 16 20 / 80%);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px 18px;
  width: 100%;
}

.menu-cast h2 { color: var(--muted); font-size: 14px; margin: 0 0 12px; }

.menu-cast ul {
  display: grid;
  gap: 10px;
  list-style: none;
  margin: 0;
  padding: 0;
}

.bug {
  align-items: center;
  column-gap: 12px;
  display: grid;
  grid-template-columns: 40px minmax(130px, auto) 1fr;
  text-align: left;
}

.bug strong { font-size: 14px; letter-spacing: 0.06em; }
.bug span:last-child { color: var(--muted); font-size: 13px; }
.bug--race strong { color: #ff4d6d; }
.bug--off strong { color: #ff80b5; }
.bug--dead strong { color: #80f4ff; }
.bug--heisen strong { color: #ffb15c; }

.bug-sprite {
  animation: bug-walk 0.5s steps(2) infinite;
  background-position: 0 0;
  background-repeat: no-repeat;
  background-size: 80px 40px;
  height: 40px;
  image-rendering: pixelated;
  width: 40px;
}

@keyframes bug-walk { to { background-position: -80px 0; } }

.menu-legend {
  color: var(--muted);
  display: flex;
  flex-wrap: wrap;
  font-size: 13px;
  gap: 10px 22px;
  justify-content: center;
}

.menu-legend span { align-items: center; display: inline-flex; gap: 8px; }
.menu-legend b { color: var(--fg); }
.menu-legend i { display: inline-block; height: 18px; width: 18px; }
.legend-task { background: center / 6px 6px no-repeat url(../assets/sprites/task.svg); }
.legend-spec { background: center / 18px 18px no-repeat url(../assets/sprites/spec.svg); }
.legend-bonus { background: center / 18px 18px no-repeat url(../assets/sprites/mcp.svg); }

.menu-goal { font-size: clamp(15px, 2vw, 18px); margin: 0; }
.menu-goal strong { color: var(--code-green); }

.game-start { font-size: 20px; min-height: 58px; min-width: 220px; }
.game-start:disabled { cursor: default; opacity: 0.6; }

.menu-hint { color: var(--muted); font-size: 12px; letter-spacing: 0.04em; margin: 0; }

.menu-credits {
  color: #71717a;
  font-size: 11px;
  padding-top: 14px;
  text-align: center;
}

.menu-credits a { color: inherit; }

@media (max-width: 640px) {
  .bug { grid-template-columns: 34px 1fr; row-gap: 2px; }
  .bug span:last-child { grid-column: 2; }
  .bug-sprite { background-size: 68px 34px; height: 34px; width: 34px; }
  @keyframes bug-walk { to { background-position: -68px 0; } }
}

@media (max-height: 760px) {
  .menu-cast { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  .menu-hero, .bug-sprite, .power-pellet, .game-ui .one-up { animation: none; }
}

/* Vitrine (?embed=1): o Kiro joga sozinho; sem menu, botões nem cortinas. */
.is-demo .main-menu-container,
.is-demo .header-buttons,
.is-demo .loading-cover,
.is-demo .loading-container { display: none !important; }
.is-demo .overflow-mask { pointer-events: none; }

/* Fim de partida: botão TERMINAR (só durante a partida), vidas no placar, "DEPLOY FEITO!" */
.header-buttons .end-button { display: none; }
.is-playing .header-buttons .end-button { display: inline-flex; padding: 0 16px; }

.lives { align-items: center; display: flex; gap: 0.6em; }
.lives-label { color: var(--muted); font-size: 0.75em; font-weight: 700; letter-spacing: 0.08em; }

.float-text--win { color: var(--code-green); filter: drop-shadow(0 0 6px rgb(128 255 181 / 70%)); }
