:root {
  --ink: #0b1a22;
  --paper: #cfe0e6;
  --dim: #7f9aa4;
  --glow: #ffd48a;
  --edge: rgba(159, 196, 201, 0.26);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: radial-gradient(circle at 50% 12%, #0d2230 0%, #050d13 70%);
  color: var(--paper);
  font-family: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  -webkit-text-size-adjust: 100%;
}

#marsh {
  display: flex;
  flex-direction: column;
  justify-content: center;
  height: 100%;
  height: 100dvh;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) 0 env(safe-area-inset-left);
}

#stage {
  position: relative;
  flex: 0 0 auto;
  min-height: 0;
  display: grid;
  place-items: center;
  padding: 6px;
}

#scene {
  display: block;
  image-rendering: pixelated;
  border-radius: 14px;
  box-shadow: 0 0 0 1px var(--edge), 0 18px 40px rgba(0, 0, 0, 0.55);
  touch-action: none;
  cursor: pointer;
}

#hud {
  text-align: center;
  padding: 6px 14px 2px;
  line-height: 1.4;
}

#hud p { margin: 2px 0; }

#level-line {
  font-size: 0.86rem;
  letter-spacing: 0.06em;
  color: var(--paper);
}

#hint { font-size: 0.78rem; color: var(--dim); }

#progress {
  font-size: 0.74rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--glow);
}

#controls {
  display: flex;
  gap: 10px;
  justify-content: center;
  padding: 8px 12px calc(12px + env(safe-area-inset-bottom));
}

button {
  min-height: 48px;
  min-width: 44px;
  padding: 0 16px;
  border-radius: 12px;
  border: 1px solid var(--edge);
  background: rgba(20, 43, 53, 0.9);
  color: var(--paper);
  font: inherit;
  font-size: 0.8rem;
  letter-spacing: 0.04em;
  cursor: pointer;
  touch-action: manipulation;
}

button:hover, button:focus-visible { border-color: var(--glow); color: #fff4de; }
button:active { transform: translateY(1px); }
#btn-sound[aria-pressed="true"] { color: var(--glow); border-color: rgba(255, 212, 138, 0.5); }

#ending {
  position: absolute;
  inset: 6px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 18px;
  border-radius: 14px;
  background: rgba(6, 16, 22, 0.72);
  backdrop-filter: blur(2px);
}

#ending[hidden] { display: none; }

#ending p { max-width: 22rem; font-size: 0.86rem; line-height: 1.5; }

#blazor-error-ui {
  position: fixed;
  inset: auto 0 0 0;
  padding: 12px;
  background: #2a1f10;
  color: #ffe6b8;
  font-size: 0.78rem;
  text-align: center;
}

@media (max-height: 560px) {
  #hud p { display: none; }
  #progress { display: block; }
}
