html, body {
  margin: 0;
  padding: 0;
  /* dvh follows the phone browser's bars, so the canvas never reaches under them */
  height: 100vh;
  height: 100dvh;
  background: #1d2b1f;
  overflow: hidden;
  touch-action: none;
  overscroll-behavior: none;
  -webkit-user-select: none;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

#game {
  width: 100%;
  height: 100%;
}

#game canvas {
  display: block;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  /* Blurring in CSS instead of a Phaser shader — the game falls back to the canvas
     renderer when opened from disk, where WebGL effects are not available. */
  filter: blur(0);
  transition: filter 0.7s ease;
}

body.is-intro #game canvas {
  filter: blur(7px) brightness(0.75);
}

#start {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 28px;
  z-index: 10;
  opacity: 1;
  transition: opacity 0.5s ease;
  font-family: system-ui, -apple-system, sans-serif;
}

#start.is-gone {
  opacity: 0;
  pointer-events: none;
}

#start h1 {
  margin: 0;
  font-size: clamp(34px, 11vw, 60px);
  font-weight: 700;
  letter-spacing: 0.02em;
  color: #f6f3e6;
  text-shadow: 0 3px 18px rgba(0, 0, 0, 0.75);
}

#start-button {
  font: inherit;
  font-size: 21px;
  font-weight: 700;
  color: #1d2b1f;
  background: #ffd75e;
  border: 3px solid #2c3d2a;
  border-radius: 999px;
  /* Comfortable finger target, same as the in-game buttons. */
  padding: 15px 46px;
  min-height: 48px;
  cursor: pointer;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.45);
}

#loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

#loading-bar {
  width: min(240px, 62vw);
  height: 8px;
  border-radius: 999px;
  background: rgba(246, 243, 230, 0.22);
  overflow: hidden;
}

#loading-fill {
  display: block;
  width: 0;
  height: 100%;
  border-radius: 999px;
  background: #ffd75e;
  transition: width 0.25s ease;
}

#loading-text {
  margin: 0;
  font-size: 15px;
  letter-spacing: 0.04em;
  color: #d8dcd2;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.7);
}

#loading.is-done {
  display: none;
}

/* ---- kódový zámek ---- */

#lock {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
}

#lock[hidden] {
  display: none;
}

#lock-label {
  margin: 0;
  font-size: 16px;
  letter-spacing: 0.06em;
  color: #d8dcd2;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.7);
}

#lock-dots {
  display: flex;
  gap: 14px;
}

#lock-dots span {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 2px solid rgba(246, 243, 230, 0.65);
  transition: background 0.15s ease, transform 0.15s ease;
}

#lock-dots span.is-filled {
  background: #ffd75e;
  border-color: #ffd75e;
  transform: scale(1.15);
}

#lock.is-wrong #lock-dots {
  animation: shake 0.4s;
}

#lock.is-wrong #lock-dots span {
  background: #e86a6a;
  border-color: #e86a6a;
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-9px); }
  40% { transform: translateX(9px); }
  60% { transform: translateX(-6px); }
  80% { transform: translateX(6px); }
}

#keypad {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}

#keypad button {
  font: inherit;
  font-size: 24px;
  font-weight: 600;
  /* Pohodlný cíl pro palec i na malém displeji. */
  width: 72px;
  height: 64px;
  color: #f6f3e6;
  background: rgba(246, 243, 230, 0.12);
  border: 2px solid rgba(246, 243, 230, 0.35);
  border-radius: 14px;
  cursor: pointer;
}

#keypad button:active {
  background: rgba(255, 215, 94, 0.35);
  transform: scale(0.95);
}

#keypad button.is-blank {
  visibility: hidden;
}

#start-button:active {
  transform: scale(0.96);
}
