.app {
  min-height: 100vh;
  display: grid;
  grid-template-rows: auto 1fr auto;
  gap: 16px;
  padding: 18px;
  background: radial-gradient(1100px 600px at 10% 0%, #113a5c 0%, #071726 60%, #050f18 100%);
  color: #eaf3ff;
  font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Arial, "Noto Sans",
    "Apple Color Emoji", "Segoe UI Emoji";
}

html,
body {
  margin: 0;
  padding: 0;
  height: 100%;
  overscroll-behavior: none;
}

.topbar {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 18px;
}

.brand .title {
  font-weight: 800;
  letter-spacing: 0.2px;
  font-size: 22px;
}
.brand .subtitle {
  opacity: 0.85;
  margin-top: 2px;
  font-size: 13px;
}

.hud {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.btnLink {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  background: linear-gradient(180deg, rgba(88, 190, 255, 0.95), rgba(34, 141, 245, 0.95));
  border: 1px solid rgba(255, 255, 255, 0.18);
  color: #031425;
  font-weight: 800;
  padding: 10px 12px;
  border-radius: 12px;
}
.btnLink:hover {
  filter: brightness(1.05);
}

.hudItem {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 12px;
  padding: 10px 12px;
  min-width: 84px;
}
.hudLabel {
  font-size: 11px;
  opacity: 0.8;
}
.hudValue {
  font-weight: 800;
  font-size: 18px;
  margin-top: 2px;
}

.btn {
  background: linear-gradient(180deg, rgba(88, 190, 255, 0.95), rgba(34, 141, 245, 0.95));
  border: 1px solid rgba(255, 255, 255, 0.18);
  color: #031425;
  font-weight: 800;
  padding: 10px 12px;
  border-radius: 12px;
  cursor: pointer;
}
.btn:hover {
  filter: brightness(1.05);
}

.stage {
  display: grid;
  place-items: center;
  gap: 10px;
}

/* Simple menu */
.menu {
  width: min(92vw, 840px);
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}
.card {
  display: grid;
  gap: 6px;
  text-decoration: none;
  color: inherit;
  padding: 18px;
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(255, 255, 255, 0.06);
  backdrop-filter: blur(10px);
}
.card:hover {
  border-color: rgba(120, 220, 255, 0.35);
  background: rgba(255, 255, 255, 0.08);
}
.cardTitle {
  font-weight: 900;
  font-size: 18px;
}
.cardText {
  opacity: 0.85;
  font-size: 13px;
}

canvas#game {
  width: min(92vw, 640px);
  height: min(92vw, 640px);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.05), rgba(255, 255, 255, 0.02));
  border-radius: 18px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.35);
  touch-action: none;
}

.help {
  width: min(92vw, 640px);
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-size: 12px;
  opacity: 0.85;
}

.touchControls {
  width: min(92vw, 640px);
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 12px;
  margin-top: 6px;
}

.pad {
  position: relative;
  width: 210px;
  height: 210px;
}

.padBtn {
  position: absolute;
  width: 68px;
  height: 68px;
  border-radius: 18px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: rgba(255, 255, 255, 0.08);
  color: rgba(234, 243, 255, 0.95);
  font-weight: 900;
  font-size: 22px;
  backdrop-filter: blur(10px);
  -webkit-tap-highlight-color: transparent;
}
.padBtn:active {
  filter: brightness(1.1);
  transform: translateY(1px);
}
.padBtn.up {
  left: 50%;
  top: 0;
  transform: translateX(-50%);
}
.padBtn.down {
  left: 50%;
  bottom: 0;
  transform: translateX(-50%);
}
.padBtn.left {
  left: 0;
  top: 50%;
  transform: translateY(-50%);
}
.padBtn.right {
  right: 0;
  top: 50%;
  transform: translateY(-50%);
}

.touchMeta {
  display: grid;
  gap: 10px;
  justify-items: end;
}

.btnGhost {
  background: rgba(255, 255, 255, 0.08);
  color: #eaf3ff;
  border: 1px solid rgba(255, 255, 255, 0.16);
}

/* Venus Bird: show touch buttons nicely */
.touchControls .touchMeta {
  justify-items: end;
}

@media (pointer: coarse) {
  #touchFlapBtn {
    font-weight: 900;
    letter-spacing: 0.6px;
    padding: 14px 18px;
    border-radius: 14px;
    min-width: 130px;
  }
}

.footer {
  opacity: 0.65;
  font-size: 12px;
  display: flex;
  justify-content: center;
}

.footer a.footerEmail {
  color: rgba(234, 243, 255, 0.9);
  text-decoration: none;
  font-weight: 800;
}
.footer a.footerEmail:hover {
  text-decoration: underline;
}

strong {
  font-weight: 800;
}

@media (max-width: 520px) {
  .app {
    padding: 12px;
    gap: 12px;
  }
  .help {
    display: none;
  }
  /* Mobile: controls docked to bottom for thumbs */
  .touchControls {
    width: min(96vw, 720px);
    position: sticky;
    bottom: 0;
    padding: 10px 10px calc(10px + env(safe-area-inset-bottom));
    border-radius: 18px;
    background: rgba(0, 0, 0, 0.22);
    border: 1px solid rgba(255, 255, 255, 0.10);
    backdrop-filter: blur(10px);
    grid-template-columns: 1fr auto;
    align-items: center;
  }
  .touchMeta {
    grid-auto-flow: row;
    justify-items: end;
  }
  .pad {
    width: 250px;
    height: 250px;
  }
  .padBtn {
    width: 82px;
    height: 82px;
    border-radius: 22px;
    font-size: 26px;
  }
}

@media (max-width: 760px) {
  .menu {
    grid-template-columns: 1fr;
  }
}

/* Phone landscape: split controls left/right, keep canvas large */
@media (max-width: 900px) and (orientation: landscape) and (pointer: coarse) {
  .app {
    padding: 10px;
    gap: 10px;
  }
  .topbar {
    align-items: center;
  }
  .stage {
    gap: 8px;
  }
  .touchControls {
    width: min(98vw, 980px);
    grid-template-columns: auto 1fr;
    align-items: center;
  }
  .touchMeta {
    grid-auto-flow: column;
    justify-items: end;
    justify-content: end;
  }
  .pad {
    width: 220px;
    height: 220px;
  }
  .padBtn {
    width: 72px;
    height: 72px;
    border-radius: 20px;
    font-size: 24px;
  }
}

/* Tablet touch: keep controls under canvas but slightly larger */
@media (min-width: 521px) and (pointer: coarse) {
  .touchControls {
    width: min(96vw, 760px);
  }
  .pad {
    width: 240px;
    height: 240px;
  }
  .padBtn {
    width: 78px;
    height: 78px;
    border-radius: 22px;
    font-size: 24px;
  }
}
