:root {
  --bird-game-fullscreen-left: 0px;
  --bird-game-fullscreen-top: 0px;
  --bird-game-fullscreen-width: 100vw;
  --bird-game-fullscreen-height: 100vh;
}

.bird-game-page {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  padding: 1rem 0 2rem;
}

.bird-game-header h1 {
  margin-bottom: 0.5rem;
  font-weight: 700;
}

.bird-game-header p {
  margin-bottom: 0;
  color: #52606d;
}

.bird-game-menu-actions {
  display: flex;
  justify-content: center;
  margin-top: 1rem;
}

.bird-game-highscore-board {
  display: grid;
  grid-template-columns: minmax(150px, 0.7fr) minmax(220px, 1.3fr);
  gap: 0.75rem 1rem;
  align-items: start;
  width: min(720px, 100%);
  margin: 1rem auto 0;
  padding: 0.8rem 1rem;
  border: 1px solid rgba(53, 94, 141, 0.14);
  border-radius: 8px;
  text-align: left;
  color: #1e3551;
  background: rgba(255, 255, 255, 0.72);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.5);
}

.bird-game-highscore-board h2 {
  margin: 0;
  font-size: 1rem;
  font-weight: 800;
}

.bird-game-highscore-board p {
  margin: 0.15rem 0 0;
  color: #52606d;
  font-size: 0.92rem;
}

.bird-game-highscore-board ol {
  display: grid;
  gap: 0.35rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.bird-game-highscore-board li {
  display: grid;
  grid-template-columns: 2rem 1fr auto;
  gap: 0.5rem;
  align-items: center;
  min-height: 2rem;
  padding: 0.35rem 0.55rem;
  border-radius: 8px;
  background: rgba(233, 241, 251, 0.82);
}

.bird-game-highscore-rank {
  font-weight: 800;
  color: #2478d4;
}

.bird-game-highscore-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 700;
}

.bird-game-highscore-score {
  font-variant-numeric: tabular-nums;
  font-weight: 800;
}

.bird-game-highscore-board #highscoreBoardEmpty {
  display: none;
  align-self: center;
  margin: 0;
  color: #52606d;
}

.bird-game-highscore-board.is-empty {
  grid-template-columns: minmax(150px, 0.7fr) minmax(220px, 1.3fr);
}

.bird-game-highscore-board.is-empty #highscoreBoardList {
  display: none;
}

.bird-game-highscore-board.is-empty #highscoreBoardEmpty {
  display: block;
}

.bird-game-level-selector {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 0.75rem;
  margin-top: 1rem;
}

.bird-game-level-selector .level-label {
  font-weight: 800;
  color: #1e3551;
}

.level-btn {
  padding: 0.5rem 1.1rem;
  border: 2px solid transparent;
  border-radius: 999px;
  font-weight: 600;
  font-size: 0.95rem;
  color: #1e3551;
  background: rgba(255, 255, 255, 0.75);
  box-shadow: inset 0 0 0 1px rgba(53, 94, 141, 0.18);
  cursor: pointer;
  transition: all 0.2s ease;
}

.level-btn:hover {
  background: rgba(255, 255, 255, 0.95);
  border-color: rgba(111, 218, 255, 0.4);
  transform: translateY(-1px);
}

.level-btn.active {
  color: #fff;
  background: linear-gradient(135deg, #3fa9ff 0%, #6fdaff 100%);
  border-color: transparent;
  box-shadow: 0 6px 16px rgba(63, 169, 255, 0.3);
}

.bird-game-shell {
  position: relative;
  background: linear-gradient(180deg, #eef7ff 0%, #ffffff 100%);
  border-radius: 24px;
  box-shadow: 0 20px 45px rgba(32, 67, 107, 0.15);
  padding: 1rem;
  user-select: none;
  -webkit-user-select: none;
}

.bird-game-hud {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  margin-bottom: 0.75rem;
  font-weight: 700;
  color: #1e3551;
}

.bird-game-hud span {
  padding: 0.55rem 0.9rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.8);
  box-shadow: inset 0 0 0 1px rgba(53, 94, 141, 0.12);
}

.bird-game-action {
  padding: 0.55rem 1rem;
  border: 0;
  border-radius: 999px;
  font-weight: 700;
  color: #fff;
  background: linear-gradient(135deg, #3fa9ff 0%, #6fdaff 100%);
  box-shadow: 0 10px 20px rgba(63, 169, 255, 0.24);
}

.bird-game-action:hover {
  background: linear-gradient(135deg, #319bf5 0%, #61d4ff 100%);
}

#birdGameCanvas {
  display: block;
  width: 100%;
  height: min(70vh, 680px);
  min-height: 420px;
  border-radius: 18px;
  background: linear-gradient(180deg, #8ed8ff 0%, #dff7ff 55%, #fefefe 100%);
  cursor: pointer;
  touch-action: none;
  -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent;
}

.bird-game-help {
  margin-top: 0.75rem;
  text-align: center;
  color: #5f6f81;
}

.bird-game-score-panel {
  position: absolute;
  inset: 0;
  z-index: 4;
  display: grid;
  place-items: center;
  padding: 1rem;
  background: rgba(11, 21, 34, 0.34);
}

.bird-game-score-panel[hidden] {
  display: none;
}

.bird-game-score-form {
  width: min(390px, 100%);
  padding: 1rem;
  border: 1px solid rgba(255, 255, 255, 0.58);
  border-radius: 8px;
  color: #17283c;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 20px 45px rgba(5, 17, 30, 0.24);
}

.bird-game-score-form strong {
  display: block;
  font-size: 1.35rem;
}

.bird-game-score-form span,
.bird-game-score-message {
  color: #52606d;
}

.bird-game-score-form label {
  display: block;
  margin-top: 0.85rem;
  margin-bottom: 0.3rem;
  font-weight: 700;
}

.bird-game-score-form input {
  width: 100%;
  padding: 0.62rem 0.72rem;
  border: 1px solid rgba(53, 94, 141, 0.24);
  border-radius: 8px;
  font: inherit;
}

.bird-game-score-actions {
  display: flex;
  gap: 0.55rem;
  margin-top: 0.85rem;
}

.bird-game-score-actions button {
  flex: 1;
  padding: 0.6rem 0.8rem;
  border: 0;
  border-radius: 8px;
  font-weight: 700;
  color: #fff;
  background: #2478d4;
}

.bird-game-score-actions button[type="button"] {
  color: #1e3551;
  background: #e9f1fb;
}

.bird-game-score-message {
  min-height: 1.4rem;
  margin-top: 0.7rem;
  font-size: 0.92rem;
}

.bird-game-score-list {
  margin: 0.45rem 0 0;
  padding-left: 1.35rem;
  font-size: 0.95rem;
}

.bird-game-score-list li {
  margin-top: 0.18rem;
}

@media (max-width: 991.98px) and (orientation: landscape) {
  html {
    width: 100%;
    height: 100%;
    overflow: hidden;
  }

  body.game-page-home {
    width: 100%;
    height: 100%;
    margin: 0;
    padding: 0;
    overflow: hidden;
    background: #d8f5ff;
    overscroll-behavior: none;
  }

  .game-page-home .game-shell {
    width: 100vw;
    height: 100vh;
    min-width: 100vw;
    min-height: 100vh;
    margin: 0;
    padding: 0;
    overflow: hidden;
    background: #d8f5ff;
  }

  .game-page-home .game-header,
  .game-page-home .game-footer,
  .game-page-home .bird-game-header,
  .game-page-home .bird-game-hud,
  .game-page-home .bird-game-help,
  .game-page-home .bird-game-highscore-board,
  .game-page-home .bird-game-menu-actions {
    display: none;
  }

  .game-page-home .game-main-wrap.container,
  .game-page-home .game-main {
    display: block;
    width: 100vw;
    min-width: 100vw;
    height: 100vh;
    min-height: 100vh;
    max-width: none;
    padding: 0;
    margin: 0;
    overflow: hidden;
  }

  .game-page-home main.pb-3 {
    min-height: 100vh;
    padding-bottom: 0 !important;
  }

  .game-page-home .bird-game-page {
    gap: 0;
    width: 100vw;
    min-width: 100vw;
    height: 100vh;
    min-height: 100vh;
    padding: 0;
    overflow: hidden;
  }

  .game-page-home .bird-game-shell {
    width: 100vw;
    min-width: 100vw;
    height: 100vh;
    min-height: 100vh;
    padding: 0;
    border-radius: 0;
    box-shadow: none;
    background: linear-gradient(180deg, #d8f5ff 0%, #ffffff 100%);
  }

  .game-page-home #birdGameCanvas {
    width: 100%;
    height: 100%;
    min-height: 0;
    border-radius: 0;
  }

  @supports (width: 100dvw) {
    .game-page-home .game-shell,
    .game-page-home .game-main-wrap.container,
    .game-page-home .game-main,
    .game-page-home .bird-game-page,
    .game-page-home .bird-game-shell {
      width: 100dvw;
      min-width: 100dvw;
      height: 100dvh;
      min-height: 100dvh;
    }
  }
}

.bird-game-shell:fullscreen {
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  max-width: none;
  margin: 0;
  padding: 0;
  border-radius: 0;
  overflow: hidden;
  box-sizing: border-box;
  background: linear-gradient(180deg, #d8f5ff 0%, #ffffff 100%);
}

.bird-game-shell:-webkit-full-screen {
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  max-width: none;
  margin: 0;
  padding: 0;
  border-radius: 0;
  overflow: hidden;
  box-sizing: border-box;
  background: linear-gradient(180deg, #d8f5ff 0%, #ffffff 100%);
}

.bird-game-shell:fullscreen .bird-game-hud,
.bird-game-shell:fullscreen .bird-game-help,
.bird-game-shell:-webkit-full-screen .bird-game-hud,
.bird-game-shell:-webkit-full-screen .bird-game-help {
  display: none;
}

.bird-game-shell:fullscreen #birdGameCanvas {
  flex: 1 1 auto;
  width: 100%;
  height: 100%;
  min-width: 0;
  min-height: 0;
  border-radius: 0;
}

.bird-game-shell:-webkit-full-screen #birdGameCanvas {
  flex: 1 1 auto;
  width: 100%;
  height: 100%;
  min-width: 0;
  min-height: 0;
  border-radius: 0;
}

.bird-game-shell:fullscreen .bird-game-help {
  margin-top: 0.5rem;
}

body.game-page-home.is-pseudo-fullscreen {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
  background: #d8f5ff;
  overscroll-behavior: none;
  touch-action: none;
}

html.is-pseudo-fullscreen-root {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #d8f5ff;
  overscroll-behavior: none;
}

body.game-page-home.is-pseudo-fullscreen .game-shell,
body.game-page-home.is-pseudo-fullscreen .game-main-wrap.container,
body.game-page-home.is-pseudo-fullscreen .game-main,
body.game-page-home.is-pseudo-fullscreen main.pb-3,
body.game-page-home.is-pseudo-fullscreen .bird-game-page {
  display: block;
  width: var(--bird-game-fullscreen-width, 100vw);
  min-width: var(--bird-game-fullscreen-width, 100vw);
  height: var(--bird-game-fullscreen-height, 100vh);
  min-height: var(--bird-game-fullscreen-height, 100vh);
  max-width: none;
  margin: 0;
  padding: 0;
  overflow: hidden;
}

body.game-page-home.is-pseudo-fullscreen .game-header,
body.game-page-home.is-pseudo-fullscreen .game-footer,
body.game-page-home.is-pseudo-fullscreen .bird-game-header > :not(.bird-game-menu-actions),
body.game-page-home.is-pseudo-fullscreen .bird-game-hud,
body.game-page-home.is-pseudo-fullscreen .bird-game-help {
  display: none;
}

body.game-page-home.is-pseudo-fullscreen .bird-game-header {
  position: static;
  margin: 0;
}

body.game-page-home.is-pseudo-fullscreen .bird-game-menu-actions {
  position: fixed;
  top: calc(var(--bird-game-fullscreen-top, 0px) + max(0.55rem, env(safe-area-inset-top)));
  right: max(0.55rem, env(safe-area-inset-right));
  z-index: 1010;
  display: block;
  margin: 0;
}

body.game-page-home.is-pseudo-fullscreen .bird-game-action {
  width: auto;
  min-width: 5.6rem;
  padding: 0.5rem 0.8rem;
  border: 1px solid rgba(255, 255, 255, 0.58);
  color: #14304d;
  background: rgba(255, 255, 255, 0.86);
  box-shadow: 0 10px 24px rgba(13, 32, 51, 0.18);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

body.game-page-home.is-pseudo-fullscreen .bird-game-shell {
  position: fixed;
  top: var(--bird-game-fullscreen-top, 0px);
  left: var(--bird-game-fullscreen-left, 0px);
  right: auto;
  bottom: auto;
  z-index: 1000;
  width: var(--bird-game-fullscreen-width, 100vw);
  min-width: var(--bird-game-fullscreen-width, 100vw);
  height: var(--bird-game-fullscreen-height, 100vh);
  min-height: var(--bird-game-fullscreen-height, 100vh);
  max-width: none;
  margin: 0;
  padding: 0;
  border-radius: 0;
  overflow: hidden;
  box-shadow: none;
  box-sizing: border-box;
  background: linear-gradient(180deg, #d8f5ff 0%, #ffffff 100%);
}

body.game-page-home.is-pseudo-fullscreen #birdGameCanvas {
  width: 100%;
  height: 100%;
  min-height: 0;
  border-radius: 0;
}

@supports (width: 100dvw) {
  body.game-page-home.is-pseudo-fullscreen .game-shell,
  body.game-page-home.is-pseudo-fullscreen .game-main-wrap.container,
    body.game-page-home.is-pseudo-fullscreen .game-main,
    body.game-page-home.is-pseudo-fullscreen main.pb-3,
    body.game-page-home.is-pseudo-fullscreen .bird-game-page,
    body.game-page-home.is-pseudo-fullscreen .bird-game-shell {
    width: var(--bird-game-fullscreen-width, 100dvw);
    min-width: var(--bird-game-fullscreen-width, 100dvw);
    height: var(--bird-game-fullscreen-height, 100dvh);
    min-height: var(--bird-game-fullscreen-height, 100dvh);
  }
}

@media (max-width: 768px) {
  .bird-game-shell {
    padding: 0.75rem;
  }

  .bird-game-hud {
    flex-direction: column;
    margin-bottom: 0.5rem;
  }

  .bird-game-hud span {
    width: 100%;
  }

  .bird-game-action {
    width: 100%;
  }

  .bird-game-highscore-board {
    grid-template-columns: 1fr;
  }

  .bird-game-menu-actions {
    margin-top: 0.85rem;
  }

  #birdGameCanvas {
    min-height: 340px;
    height: 58vh;
  }
}
