:root {
  --ink: #2a0b05;
  --paper: #ffffff;
  --red: #e8202a;
  --gold: #ffd84a;
  --dim: rgba(0, 0, 0, 0.45);
  --fade-fast: 150ms;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: var(--paper);
  color: var(--ink);
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}

#view { position: fixed; inset: 0; width: 100%; height: 100%; display: block; }

/* UI layer: a 480x320 "reference screen" scaled to fit the height, widened to the window aspect */
#ui { position: fixed; inset: 0; pointer-events: none; }
#ui .layer { position: absolute; left: 0; top: 0; transform-origin: 0 0; }
#ui .page { position: absolute; inset: 0; pointer-events: auto; }
#ui .page.passthrough { pointer-events: none; }
#ui .page.passthrough .hit { pointer-events: auto; }

.sprite {
  position: absolute;
  background-repeat: no-repeat;
  image-rendering: auto;
}

.hit { position: absolute; cursor: pointer; }
.hit:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; border-radius: 8px; }
.hit.press, .hit:active { filter: brightness(1.25); transform: scale(0.96); }
.hit .sprite { transition: transform var(--fade-fast) ease-out; }
@media (hover: hover) { .hit:hover .sprite { transform: scale(1.06); } }

.screen-img { position: absolute; inset: 0; background-size: contain; background-position: center; background-repeat: no-repeat; }
.screen-cover { position: absolute; inset: 0; background: var(--paper); }
.dim { position: absolute; inset: 0; background: var(--dim); }

.locked { filter: grayscale(1) brightness(0.7); cursor: default; }
.level-stars { position: absolute; }

#flash { position: fixed; inset: 0; background: #fff; pointer-events: none; opacity: 0; }

#boot {
  position: fixed; inset: 0; display: grid; place-content: center; gap: 12px;
  background: var(--paper); z-index: 10; transition: opacity 400ms ease-out;
}
#boot.done { opacity: 0; pointer-events: none; }
.boot-bar { width: min(60vw, 320px); height: 10px; border-radius: 5px; background: #f3d6d6; overflow: hidden; }
.boot-fill { height: 100%; width: 0; background: var(--red); transition: width 200ms linear; }
.boot-msg { margin: 0; text-align: center; font-weight: 700; letter-spacing: 0.04em; color: var(--red); }

.rotate-hint {
  position: fixed; inset: auto 0 12px 0; text-align: center; font-weight: 700; color: var(--red);
  pointer-events: none; display: none;
}
@media (orientation: portrait) and (max-width: 700px) { .rotate-hint { display: block; } }

@media (prefers-reduced-motion: reduce) {
  .hit .sprite, .boot-fill, #boot { transition: none; }
}
