:root {
  color-scheme: dark;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: #05121f;
  color: #f6efd5;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  overscroll-behavior: none;
  background: #05121f;
}

body {
  display: grid;
  place-items: center;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

button { font: inherit; }

#app {
  position: relative;
  width: min(100vw, calc(100vh * .5));
  height: min(100vh, 780px);
  width: min(100vw, max(320px, 50dvh), 390px);
  height: min(100dvh, 780px);
  overflow: hidden;
  background: #071b2c;
  box-shadow: 0 0 60px #0009;
  isolation: isolate;
}

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

.hud {
  position: absolute;
  inset: max(14px, env(safe-area-inset-top)) 16px auto;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  pointer-events: none;
  text-shadow: 0 2px 6px #00111b;
}

.brand { font-weight: 800; letter-spacing: .08em; }
.brand small { display: block; margin-top: 3px; color: #75cbd0; font-size: 10px; }
.stats { display: grid; gap: 3px; text-align: right; font-variant-numeric: tabular-nums; font-weight: 700; }
.stats span:last-child { color: #b4dadd; font-size: 13px; }

.panel {
  position: absolute;
  z-index: 5;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 32px 26px max(34px, env(safe-area-inset-bottom));
  text-align: center;
  background: linear-gradient(#071726cc, #03101ae6);
  backdrop-filter: blur(3px);
}

.panel[hidden] { display: none; }
.eyebrow { margin: 0 0 12px; color: #78d9d6; font-weight: 800; font-size: 12px; letter-spacing: .18em; }
.panel h1, .panel h2 { margin: 0; color: #fff7d9; line-height: 1.18; }
.panel h1 { font-size: clamp(27px, 8vw, 36px); }
.panel h2 { font-size: clamp(34px, 10vw, 46px); }
.panel > p:not(.eyebrow) { max-width: 280px; line-height: 1.7; color: #d2e6e8; }

.howto {
  display: flex;
  align-items: center;
  gap: 14px;
  margin: 34px 0 26px;
  padding: 14px 18px;
  border: 1px solid #81d8d652;
  border-radius: 16px;
  background: #0d3349bd;
  text-align: left;
}

.howto p { margin: 0; color: #cce6e5; line-height: 1.55; font-size: 14px; }
.tap-icon { font-size: 34px; filter: grayscale(1) brightness(2); }

.panel button {
  min-width: 210px;
  min-height: 56px;
  border: 0;
  border-radius: 999px;
  background: #f6c35b;
  color: #112535;
  font-weight: 900;
  letter-spacing: .08em;
  box-shadow: 0 8px 22px #0008, inset 0 1px #fff9;
  cursor: pointer;
}

.panel button:active { transform: translateY(2px) scale(.99); }

.lighthouse-control {
  position: absolute;
  z-index: 3;
  left: 50%;
  bottom: max(18px, env(safe-area-inset-bottom));
  translate: -50% 0;
  width: 184px;
  min-height: 82px;
  padding: 13px 24px 11px;
  border: 2px solid #ffdb76;
  border-radius: 44px;
  background: #0b2435e8;
  color: #ffe58c;
  font-weight: 900;
  box-shadow: 0 9px 25px #0009, 0 0 24px #f9d56b33;
  cursor: pointer;
}

.lighthouse-control small { display: block; margin-top: 3px; color: #b7d2d3; font-size: 11px; font-weight: 650; }
.lighthouse-control:active { transform: scale(.97); }
.lighthouse-control:disabled { opacity: .25; }

.pause-notice {
  position: absolute;
  z-index: 8;
  inset: 50% auto auto 50%;
  translate: -50% -50%;
  padding: 14px 20px;
  border-radius: 12px;
  background: #03101aee;
  border: 1px solid #7ddad5;
  font-weight: 800;
  box-shadow: 0 12px 30px #000a;
}

@media (max-height: 620px) {
  .panel { justify-content: flex-start; padding-top: 72px; }
  .howto { margin: 20px 0 18px; }
  .lighthouse-control { min-height: 68px; }
}

@media (prefers-reduced-motion: reduce) {
  * { scroll-behavior: auto !important; }
}
