/* Hub chrome. Every rule here is a transliteration of an inline style from the
   design handoff; `style-hover="..."` attributes became real `:hover` rules
   (which is exactly what the design runtime generated at runtime anyway). */

.app {
  min-height: 100dvh;
  background: var(--bg);
  color: var(--ink);
  font-family: VT323, monospace;
}

.scanlines {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 50;
  background: repeating-linear-gradient(0deg, rgba(0, 0, 0, 0.13) 0 1px, transparent 1px 3px);
}

/* ---------- shared button chrome ---------- */

.btn {
  font-family: "Press Start 2P", monospace;
  font-size: 8px;
  padding: 10px 12px;
  background: var(--panel);
  border: 2px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
}

.btn:hover {
  border-color: var(--acc);
}

.btn--bar {
  padding: 9px 10px;
  background: var(--panel2);
}

/* The handoff styled only :hover, leaving 18 icon buttons with no keyboard
   focus indicator at all. */
:focus-visible {
  outline: 2px solid var(--acc);
  outline-offset: 2px;
}

/* ---------- menu ---------- */

.menu {
  max-width: 1100px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  min-height: 100dvh;
}

.menu__header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  padding: 26px 20px 10px;
  flex-wrap: wrap;
}

.menu__title {
  margin: 0;
  font-family: "Press Start 2P", monospace;
  font-weight: 400;
  font-size: clamp(18px, 4vw, 30px);
  color: var(--acc);
  text-shadow: 0 0 16px var(--acc);
}

.menu__sub {
  font-size: 20px;
  color: var(--dim);
  margin-top: 10px;
}

.menu__coin {
  color: var(--warn);
  animation: mg-blink 1.2s steps(1) infinite;
}

.menu__toggles {
  display: flex;
  gap: 8px;
}

.menu__main {
  flex: 1;
  padding: 14px 20px 8px;
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 12px;
}

.menu__footer {
  padding: 16px 20px 26px;
  text-align: center;
  font-size: 17px;
  color: var(--dim);
}

/* ---------- game tile ---------- */

.tile {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 9px;
  padding: 18px 8px 14px;
  background: var(--panel);
  border: 2px solid var(--line);
  border-radius: 10px;
  color: var(--ink);
  font-family: VT323, monospace;
  transition:
    transform 0.08s,
    border-color 0.08s,
    box-shadow 0.08s;
}

.tile:hover {
  border-color: var(--acc);
  transform: translateY(-2px);
  box-shadow: 0 0 16px color-mix(in oklab, var(--acc) 35%, transparent);
}

.tile__save {
  position: absolute;
  top: 7px;
  right: 9px;
  font-size: 13px;
  color: var(--acc);
  letter-spacing: 1px;
}

.tile-icon {
  width: 64px;
  height: 64px;
  image-rendering: pixelated;
}

.tile__name {
  font-family: "Press Start 2P", monospace;
  font-size: 9px;
  letter-spacing: 0.5px;
  color: hsl(var(--game-hue) 85% var(--name-l));
  text-shadow: var(--glow);
  line-height: 1.5;
  text-align: center;
}

.tile__tag {
  font-size: 16px;
  color: var(--dim);
  line-height: 1;
}

.tile__hi {
  font-size: 15px;
  color: var(--warn);
  line-height: 1;
}

/* ---------- game view ---------- */

.game {
  height: 100dvh;
  display: flex;
  flex-direction: column;
}

.game__bar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border-bottom: 2px solid var(--line);
  background: var(--panel);
  flex-wrap: wrap;
}

.game__name {
  font-family: "Press Start 2P", monospace;
  font-size: 12px;
  color: hsl(var(--game-hue) 85% var(--name-l));
  text-shadow: var(--glow);
}

.game__status {
  flex: 1;
  text-align: center;
  font-size: 20px;
  color: var(--warn);
  min-width: 40px;
}

.game__hi {
  font-size: 18px;
  color: var(--dim);
}

.game__stage {
  flex: 1;
  min-height: 0;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: auto;
}

.game__hint {
  padding: 7px 12px;
  text-align: center;
  font-size: 18px;
  color: var(--dim);
  border-top: 2px solid var(--line);
  background: var(--panel);
}

/* Shown when a game module fails to load or its loop throws. The prototype
   surfaced this only as the string "LOAD ERROR" in the score line. */
.game__error {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  padding: 20px;
  text-align: center;
  background: color-mix(in oklab, var(--bg) 78%, transparent);
  z-index: 6;
}

.game__error h2 {
  margin: 0;
  font-family: "Press Start 2P", monospace;
  font-size: 14px;
  color: var(--bad);
  line-height: 1.6;
}

.game__error p {
  margin: 0;
  font-size: 20px;
  color: var(--ink);
}

/* ---------- update pill ---------- */

.update-pill {
  position: fixed;
  left: 50%;
  bottom: 16px;
  transform: translateX(-50%);
  z-index: 60;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  max-width: calc(100vw - 24px);
  flex-wrap: wrap;
  justify-content: center;
  background: var(--panel2);
  border: 2px solid var(--acc);
  border-radius: 10px;
  box-shadow: 0 0 20px color-mix(in oklab, var(--acc) 30%, transparent);
  font-family: "Press Start 2P", monospace;
  font-size: 9px;
  line-height: 1.6;
  color: var(--ink);
}

.btn--hot {
  border-color: var(--acc);
  color: var(--acc);
}

/* ---------- debug panel ---------- */

.dbg {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 12px;
  background: color-mix(in oklab, var(--bg) 75%, transparent);
  overflow: auto;
}

@media (min-width: 640px) {
  .dbg {
    align-items: center;
  }
}

.dbg__sheet {
  width: min(720px, 100%);
  max-height: calc(100dvh - 24px);
  overflow: auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 16px;
  background: var(--panel);
  border: 2px solid var(--line);
  border-radius: 12px;
  -webkit-overflow-scrolling: touch;
}

.dbg__title {
  margin: 0;
  font-family: "Press Start 2P", monospace;
  font-size: 12px;
  color: var(--acc);
  text-shadow: var(--glow);
}

.dbg__body {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-family: VT323, monospace;
  font-size: 17px;
}

.dbg__row {
  display: flex;
  gap: 10px;
  align-items: baseline;
  border-bottom: 1px solid color-mix(in oklab, var(--line) 60%, transparent);
  padding-bottom: 3px;
}

.dbg__k {
  flex: 0 0 42%;
  color: var(--dim);
  letter-spacing: 0.5px;
}

.dbg__v {
  flex: 1;
  min-width: 0;
  color: var(--ink);
  overflow-wrap: anywhere;
}

.dbg__v--hot {
  color: var(--warn);
}

.dbg__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
