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

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #87c5ea;
  color: #1d2b3a;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent;
}

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

.hidden { display: none !important; }

/* HUD */
#hud {
  position: fixed;
  top: 0; left: 0; right: 0;
  padding: calc(env(safe-area-inset-top, 0px) + 10px) 14px 0;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  pointer-events: none;
  color: #fff;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.35);
}
.stat { display: flex; flex-direction: column; line-height: 1.1; }
.stat .label { font-size: 11px; text-transform: uppercase; letter-spacing: 0.08em; opacity: 0.85; }
.stat span:last-child { font-size: 26px; font-weight: 800; font-variant-numeric: tabular-nums; }
.stat.small span:last-child { font-size: 15px; font-weight: 700; }
.hud-center { flex: 1; display: flex; justify-content: center; padding-top: 6px; }
.hud-right { display: flex; flex-direction: column; align-items: flex-end; gap: 8px; }
#lives { font-size: 20px; letter-spacing: 2px; }
#lives .lost { opacity: 0.25; }

#pause-btn {
  pointer-events: auto;
  width: 38px; height: 38px;
  border-radius: 50%;
  border: none;
  background: rgba(255, 255, 255, 0.3);
  color: #fff;
  font-weight: 900;
  font-size: 14px;
}

#wind-indicator {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.22);
  font-weight: 700;
  font-size: 14px;
  opacity: 0;
  transition: opacity 0.3s;
}
#wind-indicator.show { opacity: 1; }
#wind-indicator.warn { animation: pulse 0.5s ease-in-out infinite alternate; }
#wind-arrow { font-size: 20px; line-height: 1; }
@keyframes pulse { from { transform: scale(1); } to { transform: scale(1.08); } }

/* Screens */
.screen {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: rgba(20, 40, 60, 0.35);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
}
.panel {
  width: 100%;
  max-width: 380px;
  background: #fffaf0;
  border-radius: 22px;
  padding: 26px 22px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.25);
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
h1 { font-size: 42px; letter-spacing: -0.02em; color: #c0582b; }
h2 { font-size: 26px; color: #c0582b; }
.tagline { font-size: 16px; color: #4a5866; }
.howto { text-align: left; list-style: none; display: flex; flex-direction: column; gap: 6px; font-size: 15px; }
.howto li::before { content: "▸ "; color: #c0582b; }
.hint { font-size: 13px; color: #6a7684; }
.note { font-size: 13px; color: #9a4a2a; min-height: 1em; }

button {
  font: inherit;
  border: none;
  border-radius: 14px;
  padding: 12px 18px;
  background: #e8dfcf;
  color: #1d2b3a;
  font-weight: 700;
  cursor: pointer;
}
button.big {
  background: #c0582b;
  color: #fff;
  font-size: 20px;
  padding: 16px 20px;
  box-shadow: 0 4px 0 #8c3c1a;
}
button:active { transform: translateY(2px); }

.result { display: flex; flex-direction: column; gap: 8px; margin: 6px 0; }
.result div { display: flex; justify-content: space-between; font-size: 17px; }
.result .label { color: #6a7684; }
.result span:last-child { font-weight: 800; font-variant-numeric: tabular-nums; }
.new-best { color: #2b8a4a; font-weight: 800; font-size: 18px; }
