/* 112 — Hank Solo. Palette mirrors the official single art:
   sky blue, warm concrete white, signal red, dark steel.
   Blue is otherwise reserved for danger (telegraph + water) in-game. */

:root {
  --blue: #2d76b5;      /* cover sky */
  --paper: #ece7dc;     /* tower concrete */
  --paper-dim: #d9d2c2;
  --red: #d5372d;       /* the 112 sign */
  --ink: #15171a;
  --steel: #8b9097;
  --pixel: 'Press Start 2P', ui-monospace, monospace;
}

/* self-hosted, latin subset (covers ä/ö) — see fonts/LICENSE.txt */
@font-face {
  font-family: 'Press Start 2P';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('fonts/press-start-2p-latin.woff2') format('woff2');
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html, body {
  height: 100%;
  overflow: hidden;
  overscroll-behavior: none;
  background: #101114;
  color: var(--paper);
  font-family: var(--pixel);
  -webkit-user-select: none;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

body { position: fixed; inset: 0; }

#stage {
  position: relative;
  width: 100%;
  height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
}

#game-canvas {
  display: block;
  touch-action: none;
  image-rendering: pixelated;
}

.hidden { display: none !important; }

/* ---------- screens (cover-blue, cover type) ---------- */

.screen {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  padding: 24px 20px calc(24px + env(safe-area-inset-bottom));
  background: var(--blue);
  text-align: center;
  overflow-y: auto;
}

#title-cover {
  image-rendering: pixelated;
  width: min(66vw, 33dvh, 300px);
  height: auto;
  border: 4px solid var(--paper);
}

.section-label {
  color: #cfe2f2;
  font-size: 10px;
  letter-spacing: 0.35em;
  text-indent: 0.35em;
  margin-top: 8px;
}

#title-board { width: 100%; max-width: 280px; }
#title-board h2 {
  font-size: 8px;
  color: #cfe2f2;
  letter-spacing: 0.1em;
  margin-bottom: 6px;
}
#title-board ol { list-style: none; font-size: 9px; }
#title-board li {
  display: flex;
  justify-content: space-between;
  gap: 6px;
  padding: 3px 4px;
  white-space: nowrap;
}
#title-board li .n { overflow: hidden; text-overflow: ellipsis; color: #fff; }
#title-board li .s { color: #cfe2f2; }
#title-board .empty { color: #cfe2f2; }

.lyric {
  color: #fff;
  font-style: normal;
  font-size: 10px;
  line-height: 2;
}

/* Hank dancing under the lyric — 4-frame sheet, ping-pong baked in, 8 fps */
#title-hank {
  width: 80px;
  height: 80px;
  background: url('art/chunky_pixel_dancer_game_assets/sprites/chunky_dancer_dance_256.png')
    0 0 / 320px 80px no-repeat;
  image-rendering: pixelated;
  animation: hank-dance 0.5s steps(4) infinite;
}
@keyframes hank-dance {
  to { background-position-x: -320px; }
}

.howto { color: #cfe2f2; font-size: 8px; line-height: 2.1; }

#name-form { display: flex; gap: 8px; }

input[type="text"] {
  background: var(--paper);
  border: 0;
  color: var(--ink);
  font: inherit;
  font-size: 16px; /* 16px stops iOS zoom-on-focus */
  padding: 12px 8px;
  width: 12ch;
  outline: none;
}
input[type="text"]::placeholder { color: #7a7466; font-size: 10px; }

button {
  font-family: var(--pixel);
  font-size: 13px;
  border: 0;
  cursor: pointer;
  padding: 14px 18px;
  color: #fff;
  background: var(--red);
}
button:active { transform: translateY(1px); }

.error { color: #ffd9d4; font-size: 10px; line-height: 1.8; }

/* ---------- HUD (over the dark club) ---------- */

#hud {
  position: absolute;
  top: calc(6px + env(safe-area-inset-top));
  /* hug the game canvas (max 520px, centered), not the whole window */
  left: 50%;
  transform: translateX(-50%);
  width: min(100%, 520px);
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: 6px 12px;
  pointer-events: none;
}
#score {
  font-size: 30px;
  color: var(--paper);
  text-shadow: 4px 4px 0 #000;
}
#mute {
  pointer-events: auto;
  background: #232327;
  color: #b9b4a8;
  font-family: inherit;
  font-size: 8px;
  padding: 8px 10px;
  border: 2px solid #3a3a42;
}

/* ---------- death screen ---------- */

#death { justify-content: flex-start; padding-top: max(40px, 7dvh); }

.big-red {
  font-family: var(--pixel);
  color: #fff;
  font-size: clamp(20px, 6.4vw, 34px);
  line-height: 1.4;
  text-shadow: 3px 3px 0 rgba(0,0,0,0.35);
}
.subline { color: #cfe2f2; font-size: 10px; }

.card {
  background: var(--paper);
  color: var(--ink);
  width: 100%;
  max-width: 440px;
  padding: 16px 14px 18px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.final-score {
  font-family: var(--pixel);
  font-size: 14px;
  color: var(--ink);
}
.final-score span { color: var(--red); }

#boards {
  display: flex;
  gap: 18px;
  width: 100%;
  justify-content: center;
}
.board { flex: 1; min-width: 0; }
.board h2 {
  font-size: 8px;
  color: var(--red);
  letter-spacing: 0.1em;
  margin-bottom: 8px;
  line-height: 1.5;
}
.board ol { list-style: none; font-size: 9px; text-align: left; }
.board li {
  display: flex;
  justify-content: space-between;
  gap: 6px;
  padding: 3px 4px;
  border-bottom: 1px solid #d8d1c1;
  white-space: nowrap;
}
.board li .n { overflow: hidden; text-overflow: ellipsis; }
.board li .s { color: #6f6a5d; }
.board li.me { background: var(--red); color: #fff; }
.board li.me .s { color: #fff; }
.board .empty { color: #9a937f; padding: 3px 4px; }

#restart-btn { font-size: 16px; padding: 18px 26px; }

#rename-row { display: flex; gap: 8px; }
#rename-row[hidden] { display: none; }

/* pre-save: same paper button on title and death screens */
.presave-btn {
  display: inline-block;
  background: var(--paper);
  color: var(--ink);
  font-size: 12px;
  padding: 14px 18px;
  text-decoration: none;
}
.presave-btn:active { transform: translateY(1px); }
