.flappy-page {
  height: 100vh;
  height: 100dvh;
  max-height: 100vh;
  max-height: 100dvh;
  overflow: hidden;
  color: var(--ink);
  touch-action: none;
}

.flappy-shell {
  width: min(980px, calc(100% - 1.25rem));
  height: 100%;
  margin: 0 auto;
  padding: 0.45rem 0 0.55rem;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  box-sizing: border-box;
  overflow: hidden;
}

.flappy-top {
  flex: 0 0 auto;
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.45rem 1rem;
  min-width: 0;
}

.flappy-top .item-back {
  margin: 0;
  flex: 0 0 auto;
}

.flappy-top__title {
  margin: 0;
  font-family: "Unbounded", sans-serif;
  font-size: clamp(1.05rem, 2.2vw, 1.45rem);
  font-weight: 750;
  line-height: 1.1;
}

.flappy-top__hint {
  margin: 0;
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.3;
  min-width: 0;
}

.flappy-view {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.flappy-layout {
  flex: 1 1 auto;
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(190px, 250px) minmax(0, 1fr);
  gap: 0.55rem 0.75rem;
  align-items: stretch;
}

.flappy-side {
  display: grid;
  grid-auto-rows: auto;
  gap: 0.4rem;
  min-height: 0;
  overflow: auto;
  align-content: start;
  align-self: start;
}

.flappy-stat {
  display: grid;
  gap: 0.05rem;
  padding: 0.4rem 0.55rem;
  border: 1px solid var(--control-border, var(--line));
  border-radius: var(--btn-radius, var(--radius));
  background: var(--panel-surface, var(--panel));
}

.flappy-stat--score {
  border-color: color-mix(in srgb, var(--accent) 45%, var(--control-border, var(--line)));
  background:
    linear-gradient(145deg, color-mix(in srgb, var(--accent) 12%, transparent), transparent 60%),
    var(--panel-surface, var(--panel));
}

.flappy-stat span {
  color: var(--muted);
  font-size: 0.68rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.flappy-stat strong {
  font-size: 1.15rem;
  font-variant-numeric: tabular-nums;
  color: var(--ink);
  line-height: 1.1;
}

.flappy-stat--score strong {
  font-size: 1.4rem;
  color: var(--accent);
}

.flappy-media-title {
  margin: 0;
  min-height: 0;
  max-height: 2.6em;
  overflow: hidden;
  color: var(--muted);
  font-size: 0.8rem;
  line-height: 1.3;
}

.flappy-actions .btn {
  padding: 0.55rem 0.75rem;
  font-size: 0.84rem;
}

.game-vol {
  display: grid;
  gap: 0.35rem;
  padding: 0.4rem 0.55rem;
  border: 1px solid var(--control-border, var(--line));
  border-radius: var(--btn-radius, var(--radius));
  background: var(--panel-surface, var(--panel));
  cursor: pointer;
}

.game-vol__row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.5rem;
  color: var(--muted);
  font-size: 0.68rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.game-vol__row strong {
  font-size: 0.85rem;
  letter-spacing: 0;
  text-transform: none;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}

.game-vol input[type="range"] {
  width: 100%;
  margin: 0;
  accent-color: var(--accent);
  cursor: pointer;
}

.flappy-stage {
  min-width: 0;
  min-height: 0;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.flappy-board-wrap {
  position: relative;
  width: fit-content;
  height: fit-content;
  max-width: 100%;
  max-height: 100%;
  border: 2px solid var(--accent);
  border-radius: 8px;
  overflow: hidden;
  background: #071018;
  box-shadow:
    0 0 0 1px color-mix(in srgb, var(--accent) 40%, transparent),
    0 0 0 5px rgba(0, 0, 0, 0.55),
    0 18px 42px var(--shadow);
  box-sizing: border-box;
}

.flappy-board-wrap canvas {
  display: block;
  max-width: 100%;
  max-height: 100%;
  cursor: pointer;
  touch-action: none;
}

#flappy-board-bg {
  position: relative;
  z-index: 0;
  background: #071018;
}

#flappy-board,
#flappy-board-fg {
  position: absolute;
  left: 0;
  top: 0;
  z-index: 2;
  background: transparent;
}

#flappy-board-fg {
  z-index: 4;
  pointer-events: none;
}

.flappy-anim-layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
}

.flappy-anim-layer--clouds {
  z-index: 1;
}

.flappy-anim-layer--pipes {
  z-index: 3;
}

.flappy-anim-layer--bird {
  z-index: 5;
}

.flappy-anim-layer img {
  position: absolute;
  display: block;
  margin: 0;
  padding: 0;
  border: 0;
  object-fit: fill;
  image-rendering: auto;
  pointer-events: none;
  will-change: transform;
}

.flappy-overlay {
  position: absolute;
  inset: 0;
  z-index: 6;
  display: grid;
  place-content: center;
  gap: 0.55rem;
  padding: 1rem;
  text-align: center;
  background: rgba(5, 6, 8, 0.82);
  backdrop-filter: blur(5px);
}

.flappy-overlay.hidden {
  display: none;
}

.flappy-overlay__title {
  margin: 0;
  font-family: "Unbounded", sans-serif;
  font-size: clamp(1.2rem, 2.5vw, 1.55rem);
  color: var(--ink);
}

.flappy-overlay__text {
  margin: 0;
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.4;
  max-width: 18rem;
  justify-self: center;
}

@media (max-width: 860px) {
  .flappy-top__hint {
    display: none;
  }

  .flappy-layout {
    grid-template-columns: 1fr;
    grid-template-rows: auto minmax(0, 1fr);
    gap: 0.4rem;
  }

  .flappy-side {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.35rem;
  }

  .game-vol {
    grid-column: 1 / -1;
  }

  .flappy-media-title,
  .flappy-actions {
    display: none;
  }
}

@media (max-width: 560px) {
  .flappy-shell {
    width: calc(100% - 0.75rem);
    padding: 0.35rem 0 0.4rem;
  }
}
