* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; width: 100%; height: 100%; overflow: hidden; }
body { background: #152e32; font: 700 16px system-ui, sans-serif; color: #fff; }
.game {
  --accent: #FF8A3D;
  position: relative;
  width: 100%;
  max-width: 540px;
  height: 100vh;
  height: 100dvh;
  margin: auto;
  overflow: hidden;
  isolation: isolate;
  background: #6bd2e9;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
}
.art, canvas, .overlay { position: absolute; inset: 0; width: 100%; height: 100%; }
.art { z-index: 1; object-fit: cover; object-position: center; pointer-events: none; }
.overlay { z-index: 3; display: grid; place-items: center; padding: 20px; pointer-events: none; }
.panel { width: min(100%, 284px); text-align: center; padding: 22px 18px; background: #173939ed; border: 2px solid #e3f3d8; border-radius: 16px; box-shadow: 0 5px #102d3299; }
.game:not(.is-over) .panel { align-self: end; margin-bottom: max(50px, calc(env(safe-area-inset-bottom) + 30px)); }
.game.has-art:not(.is-over) .panel { background: none; border: 0; box-shadow: none; padding: 0; }
.game.has-art:not(.is-over) h1 { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
h1 { margin: 0 0 14px; font-size: 30px; line-height: 1.1; }
#result { margin: 0 0 16px; font-size: 18px; color: #d7efe7; }
button { pointer-events: auto; width: 100%; min-height: 52px; padding: 10px 16px; border: 2px solid #7b3b1e; border-radius: 12px; background: var(--accent); color: #23170e; font: inherit; font-size: 18px; box-shadow: 0 4px #7b3b1e; cursor: pointer; }
button:active { transform: translateY(2px); box-shadow: 0 2px #7b3b1e; }
button:focus-visible { outline: 3px solid white; outline-offset: 4px; }
.score { z-index: 2; position: absolute; top: max(14px, env(safe-area-inset-top)); left: 0; right: 0; text-align: center; font-size: 50px; line-height: 1; font-variant-numeric: tabular-nums; text-shadow: 0 3px #173639, 2px 0 #173639, -2px 0 #173639, 0 -2px #173639; pointer-events: none; }

.instructions { margin: 0 0 16px; font-size: 14px; line-height: 1.7; color: #fff; font-weight: 500; text-shadow: 0 1px 3px #173939; }
.game.has-art:not(.is-over) .instructions { padding: 10px; border-radius: 10px; background: #173939df; }
.flap-control { position: absolute; z-index: 4; bottom: max(22px, env(safe-area-inset-bottom)); left: 50%; transform: translateX(-50%); width: 150px; min-height: 52px; opacity: .92; }
.flap-control:active { transform: translateX(-50%) translateY(2px); }

.is-over .instructions { display: none; }
#adHint { margin: .7em 0 1em; color: #e6f5eb; font-size: .875rem; }
#revivePanel ~ #action { background: #f6e3bc; }
#revivePanel[hidden] ~ #action { background: var(--accent); }
.panel button:disabled { background: #aeb8af; color: #354139; box-shadow: none; cursor: default; }
