* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

:root {
  --navy-950: #061321;
  --navy-900: #081a2e;
  --navy-800: #0d2842;
  --cyan: #16d6c1;
  --cyan-2: #5cf5e5;
  --blue: #2b7fff;
  --text: #f4fbff;
  --muted: #8ea7bb;
  --panel: rgba(7, 23, 39, .88);
  --border: rgba(92, 245, 229, .18);
}

html, body {
  margin: 0;
  width: 100%;
  min-height: 100%;
  background:
    radial-gradient(circle at 50% 15%, rgba(43, 127, 255, .16), transparent 28rem),
    linear-gradient(180deg, #071421, #040b12 75%);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  overflow: hidden;
}

body {
  min-height: 100dvh;
}

button {
  font: inherit;
}

.app-shell {
  width: 100%;
  height: 100dvh;
  display: grid;
  place-items: center;
  padding: max(12px, env(safe-area-inset-top)) 12px max(12px, env(safe-area-inset-bottom));
}

.game-card {
  width: min(100%, 520px);
  height: min(100%, 860px);
  display: grid;
  grid-template-rows: 64px 1fr 40px;
  overflow: hidden;
  border: 1px solid rgba(92, 245, 229, .15);
  border-radius: 24px;
  background: rgba(4, 12, 20, .82);
  box-shadow: 0 30px 90px rgba(0, 0, 0, .45), inset 0 1px 0 rgba(255,255,255,.03);
  backdrop-filter: blur(18px);
}

.topbar, .footerbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-inline: 18px;
  background: linear-gradient(180deg, rgba(10, 30, 49, .94), rgba(7, 22, 37, .94));
  position: relative;
  z-index: 10;
}

.topbar {
  border-bottom: 1px solid rgba(92, 245, 229, .12);
}

.footerbar {
  border-top: 1px solid rgba(92, 245, 229, .1);
  color: #7f99ad;
  font-size: 11px;
  letter-spacing: .05em;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
}

.brand-mark {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border-radius: 10px;
  background: linear-gradient(145deg, var(--cyan), #0aa59b);
  color: #04121c;
  font-weight: 950;
  font-size: 21px;
  box-shadow: 0 0 26px rgba(22, 214, 193, .25);
}

.brand strong, .brand span {
  display: block;
}

.brand strong {
  font-size: 15px;
  letter-spacing: .11em;
}

.brand span {
  margin-top: 1px;
  color: var(--muted);
  font-size: 9px;
  letter-spacing: .18em;
}

.top-actions {
  display: flex;
  gap: 8px;
}

.icon-btn {
  width: 38px;
  height: 38px;
  border: 1px solid var(--border);
  border-radius: 11px;
  color: #d8f7f4;
  background: rgba(17, 51, 74, .6);
  cursor: pointer;
  transition: .18s ease;
}

.icon-btn:hover {
  border-color: rgba(92, 245, 229, .35);
  background: rgba(22, 214, 193, .1);
  transform: translateY(-1px);
}

.canvas-wrap {
  min-height: 0;
  position: relative;
  overflow: hidden;
  background: var(--navy-900);
  touch-action: none;
  user-select: none;
}

canvas {
  width: 100%;
  height: 100%;
  display: block;
}

.hud {
  position: absolute;
  inset: 16px 14px auto;
  display: flex;
  justify-content: space-between;
  pointer-events: none;
  z-index: 5;
}

.hud-pill {
  min-width: 86px;
  padding: 8px 12px;
  border: 1px solid rgba(92, 245, 229, .14);
  border-radius: 13px;
  background: rgba(6, 21, 35, .64);
  backdrop-filter: blur(10px);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.025);
}

.hud-pill.right {
  text-align: right;
}

.hud-pill span, .hud-pill strong {
  display: block;
}

.hud-pill span {
  color: #86a4b8;
  font-size: 9px;
  letter-spacing: .16em;
  font-weight: 800;
}

.hud-pill strong {
  margin-top: 1px;
  color: white;
  font-size: 25px;
  line-height: 1;
  font-weight: 900;
}

.overlay {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 24px;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  background: rgba(2, 10, 17, .28);
  backdrop-filter: blur(1px);
  transition: opacity .2s ease, visibility .2s ease;
  z-index: 8;
}

.overlay.show {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.panel {
  width: min(100%, 390px);
  padding: 28px 24px 22px;
  text-align: center;
  border: 1px solid rgba(92, 245, 229, .2);
  border-radius: 24px;
  background:
    linear-gradient(180deg, rgba(15, 41, 62, .96), rgba(5, 20, 33, .96));
  box-shadow: 0 24px 55px rgba(0,0,0,.43), inset 0 1px 0 rgba(255,255,255,.04);
}

.mini-panel {
  padding-block: 25px;
}

.bird-badge {
  width: 64px;
  height: 64px;
  margin: -62px auto 15px;
  display: grid;
  place-items: center;
  border-radius: 18px 18px 18px 7px;
  background: linear-gradient(145deg, #66f9eb, #11b7ad);
  color: #061824;
  font-size: 35px;
  font-weight: 950;
  transform: rotate(-6deg);
  box-shadow: 0 0 45px rgba(22, 214, 193, .28);
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--cyan-2);
  font-size: 10px;
  letter-spacing: .22em;
  font-weight: 850;
}

.panel h1, .panel h2 {
  margin: 0;
  letter-spacing: -.04em;
  line-height: 1;
}

.panel h1 {
  font-size: clamp(42px, 12vw, 58px);
}

.panel h2 {
  font-size: 38px;
}

.lead, .mini-panel p:not(.eyebrow) {
  margin: 13px auto 20px;
  max-width: 300px;
  color: #a9bdca;
  font-size: 14px;
  line-height: 1.5;
}

.primary-btn {
  width: 100%;
  min-height: 52px;
  margin-top: 7px;
  border: 0;
  border-radius: 14px;
  background: linear-gradient(135deg, #2df2dc, #14bcb2);
  color: #03151e;
  font-weight: 950;
  letter-spacing: .08em;
  cursor: pointer;
  box-shadow: 0 10px 30px rgba(22, 214, 193, .16);
  transition: transform .15s ease, filter .15s ease;
}

.primary-btn:hover {
  filter: brightness(1.06);
  transform: translateY(-1px);
}

.primary-btn:active {
  transform: translateY(1px) scale(.995);
}

.controls {
  margin-top: 15px;
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 8px 14px;
  color: #748fa2;
  font-size: 10px;
}

.result-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin: 22px 0 10px;
}

.result-grid > div {
  padding: 16px 8px;
  border-radius: 15px;
  border: 1px solid rgba(92, 245, 229, .13);
  background: rgba(2, 13, 23, .44);
}

.result-grid span, .result-grid strong {
  display: block;
}

.result-grid span {
  color: #829cad;
  font-size: 9px;
  letter-spacing: .15em;
  font-weight: 800;
}

.result-grid strong {
  margin-top: 4px;
  font-size: 31px;
}

.new-best {
  color: var(--cyan-2);
  font-size: 11px;
  letter-spacing: .14em;
  font-weight: 900;
}

.tap-hint {
  position: absolute;
  left: 50%;
  bottom: 18px;
  transform: translateX(-50%);
  padding: 7px 12px;
  border: 1px solid rgba(92,245,229,.12);
  border-radius: 999px;
  color: rgba(207,239,239,.56);
  background: rgba(3, 17, 29, .42);
  font-size: 9px;
  font-weight: 800;
  letter-spacing: .18em;
  pointer-events: none;
  z-index: 4;
  opacity: 0;
  transition: opacity .2s ease;
}

.tap-hint.show {
  opacity: 1;
}

@media (max-width: 560px) {
  .app-shell {
    padding: 0;
  }

  .game-card {
    width: 100%;
    height: 100dvh;
    border: 0;
    border-radius: 0;
  }

  .topbar {
    padding-top: env(safe-area-inset-top);
    min-height: calc(64px + env(safe-area-inset-top));
  }

  .footerbar {
    padding-bottom: env(safe-area-inset-bottom);
    min-height: calc(40px + env(safe-area-inset-bottom));
  }
}

@media (max-height: 650px) {
  .game-card {
    grid-template-rows: 54px 1fr 32px;
  }

  .brand-mark {
    width: 31px;
    height: 31px;
  }

  .panel {
    transform: scale(.88);
  }
}
