html,
body {
  height: 100%;
}

body {
  -webkit-text-size-adjust: 100%;
  overscroll-behavior: none;
}

.game-select,
.game-control-icon-btn,
.game-action-btn,
.game-review-close-btn,
.falling-block {
  -webkit-appearance: none;
  appearance: none;
  font: inherit;
}

.game-select {
  padding-right: 34px;
  background-image:
    linear-gradient(45deg, transparent 50%, rgba(232, 248, 255, 0.9) 50%),
    linear-gradient(135deg, rgba(232, 248, 255, 0.9) 50%, transparent 50%);
  background-repeat: no-repeat;
  background-position:
    calc(100% - 18px) calc(50% - 4px),
    calc(100% - 12px) calc(50% - 4px);
  background-size: 6px 6px, 6px 6px;
}

.game-actions {
  flex-wrap: nowrap;
}

.phone.game-page-shell {
  width: min(430px, calc(100vw - 24px));
  height: min(860px, calc(100dvh - 24px));
  height: min(860px, calc(100svh - 24px));
  min-height: 0;
  margin: 12px auto;
  overflow: hidden;
}

.game-page-shell .phone-header {
  flex: 0 0 auto;
}

.game-wrap {
  min-height: 0;
}

.game-stage {
  height: 100%;
  min-height: 0;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
}

.game-topbar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  column-gap: 8px;
}

.game-subject-box {
  flex: 1 1 auto;
  min-width: 0;
}

.game-select {
  width: 100%;
  min-width: 0;
  height: 40px;
  font-size: 0.88rem;
  padding-right: 30px;
}

.game-actions {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
}

.game-control-icon-btn {
  width: 34px;
  height: 34px;
  border-radius: 10px;
}

.game-icon {
  width: 16px;
  height: 16px;
}

.game-arena {
  height: auto;
  min-height: 0;
}

.game-hud {
  grid-template-columns: minmax(0, 1fr) auto auto;
  padding-top: 10px;
}

.game-score-panel {
  min-width: 0;
  font-size: clamp(0.58rem, 1.8vw, 0.7rem);
}

.game-combo-panel,
.game-lives-panel {
  white-space: nowrap;
}

.game-review-panel {
  bottom: 74px;
}

@media (max-width: 520px) {
  body {
    padding: 8px;
    align-items: center;
  }

  .phone.game-page-shell {
    width: min(430px, calc(100vw - 24px));
    height: min(820px, calc(100dvh - 16px));
    height: min(820px, calc(100svh - 16px));
    min-height: 0;
    margin: 12px auto;
    border-radius: 34px;
    border: 1px solid rgba(133, 204, 255, 0.24);
    box-shadow:
      0 36px 72px rgba(0, 0, 0, 0.58),
      inset 0 0 0 1px rgba(147, 219, 255, 0.16),
      inset 0 -24px 56px rgba(0, 28, 58, 0.32);
    overflow: hidden;
    padding: 18px 16px 14px;
  }

  .game-stage {
    height: 100%;
    min-height: 0;
  }

  .game-topbar {
    gap: 8px;
    align-items: end;
    grid-template-columns: minmax(0, 1fr) auto;
    grid-auto-flow: column;
    flex-direction: row;
  }

  .game-subject-box {
    flex: 1 1 auto;
    min-width: 0;
  }

  .game-select {
    width: 100%;
    min-width: 0;
    height: 40px;
  }

  .game-actions {
    flex: 0 0 auto;
    gap: 6px;
  }

  .game-arena {
    height: auto;
    min-height: 0;
    margin: 14px 10px 0;
  }

  .game-hud {
    margin: 12px 10px 0;
    grid-template-columns: minmax(0, 1fr) auto auto;
    gap: 8px;
    padding: 0;
  }

  .game-review-panel {
    left: 10px;
    right: 10px;
    top: 118px;
    bottom: 62px;
  }

  .game-control-icon-btn {
    width: 34px;
    height: 34px;
    border-radius: 10px;
  }

  .game-score-panel,
  .game-combo-panel,
  .game-lives-panel {
    min-height: 40px;
    border-radius: 12px;
  }

  .game-score-panel {
    padding: 0 10px;
    font-size: clamp(0.54rem, 2vw, 0.62rem);
  }

  .game-combo-panel {
    padding: 0 10px;
    font-size: 0.7rem;
  }

  .game-lives-panel {
    padding: 0 8px;
    gap: 3px;
  }

  .game-heart {
    font-size: 0.95rem;
  }
}
