html, body {
  margin: 0;
  padding: 0;
  background: #05020d;
  color: white;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Hiragino Sans", "Yu Gothic", sans-serif;
  overflow: hidden;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent;
}

button,
a,
img,
canvas {
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent;
}

button,
a {
  touch-action: manipulation;
}

#gameWrap {
  position: relative;
  width: 100vw;
  height: var(--app-height, 100vh);
  background: #05020d;
  display: grid;
  place-items: center;
}

#gameCanvas {
  width: min(100vw, calc(var(--app-height, 100vh) * 16 / 9));
  height: min(var(--app-height, 100vh), calc(100vw * 9 / 16));
  image-rendering: pixelated;
  background: #000;
  display: block;
}

.screen {
  position: absolute;
  inset: 0;
  display: none;
  place-items: center;
  text-align: center;
  pointer-events: none;
}

.screen.active {
  display: grid;
  pointer-events: auto;
}

.logo {
  width: min(76vw, 760px);
  max-height: 28vh;
  object-fit: contain;
  image-rendering: pixelated;
  margin-top: -12vh;
}

.subtitle {
  margin-top: -12vh;
  padding: 8px 22px;
  border: 4px solid #ffe145;
  background: rgba(5, 2, 13, 0.74);
  box-shadow: 6px 6px 0 #000, 0 0 16px #ff2fae;
  font-weight: 900;
  font-size: clamp(24px, 4vw, 46px);
  text-shadow: 4px 4px 0 #000, 0 0 12px #ff2fae;
  color: #fff;
}

.imageButton {
  border: 5px solid #ffe145;
  background: rgba(255, 47, 174, 0.3);
  padding: 8px 12px;
  cursor: pointer;
  margin-top: -7vh;
  box-shadow: 8px 8px 0 #000, 0 0 22px #ff2fae;
  animation: startPulse 1.15s ease-in-out infinite;
}

.imageButton img {
  width: min(72vw, 650px);
  image-rendering: pixelated;
  display: block;
}

.howtoPageButton {
  display: inline-block;
  margin-top: -8vh;
  padding: 12px 34px;
  color: #fff;
  background: #21a8ff;
  border: 5px solid #ffe145;
  box-shadow: 6px 6px 0 #000, 0 0 14px #21a8ff;
  font-weight: 900;
  font-size: clamp(22px, 3.4vw, 36px);
  text-decoration: none;
  text-shadow: 3px 3px 0 #000;
}

.titleButtons {
  margin-top: -8vh;
  display: flex;
  justify-content: center;
  gap: 12px;
  flex-wrap: wrap;
}

.titleButtons .howtoPageButton {
  margin-top: 0;
}

.rankingTitleButton {
  display: inline-block;
  padding: 12px 34px;
  color: #fff;
  background: #ff2fae;
  border: 5px solid #ffe145;
  box-shadow: 6px 6px 0 #000, 0 0 14px #ff2fae;
  font-weight: 900;
  font-size: clamp(22px, 3.4vw, 36px);
  text-decoration: none;
  text-shadow: 3px 3px 0 #000;
  cursor: pointer;
}

.howto {
  margin-top: -6vh;
  display: flex;
  gap: 14px;
  justify-content: center;
  flex-wrap: wrap;
  font-weight: 900;
  font-size: clamp(18px, 2.8vw, 30px);
  text-shadow: 3px 3px 0 #000;
}

.howto span {
  display: inline-block;
  padding: 8px 16px;
  border: 3px solid #fff;
  background: rgba(5, 2, 13, 0.72);
  box-shadow: 4px 4px 0 #000, 0 0 12px #ff2fae;
}

.bestText {
  padding: 8px 20px;
  border: 4px solid #ffe145;
  background: rgba(5, 2, 13, 0.78);
  box-shadow: 5px 5px 0 #000, 0 0 14px #ffe145;
  font-weight: 900;
  font-size: clamp(20px, 3vw, 34px);
  color: #ffe145;
  text-shadow: 3px 3px 0 #000;
  margin-top: -9vh;
}

@keyframes startPulse {
  0%, 100% {
    transform: scale(1);
    filter: brightness(1);
  }
  50% {
    transform: scale(1.04);
    filter: brightness(1.22);
  }
}

#hud {
  position: absolute;
  top: max(10px, env(safe-area-inset-top));
  left: max(10px, env(safe-area-inset-left));
  pointer-events: none;
  display: none;
}

#hud.active {
  display: block;
}

.scoreBox {
  position: relative;
  width: min(44vw, 360px);
}

.scoreBox img {
  width: 100%;
  image-rendering: pixelated;
}

.scoreText {
  position: absolute;
  inset: 18% 8% 12% 8%;
  display: grid;
  align-content: center;
  gap: 2px;
  text-align: left;
  font-weight: 900;
  text-shadow: 2px 2px 0 #000;
}

#distanceText {
  font-size: clamp(18px, 3vw, 30px);
  color: #ffe145;
}

#remainText {
  font-size: clamp(10px, 1.7vw, 16px);
  color: #fff;
}

#touchControls {
  position: absolute;
  left: 0;
  right: 0;
  bottom: max(10px, env(safe-area-inset-bottom));
  display: none;
  justify-content: space-between;
  padding: 0 max(12px, env(safe-area-inset-left)) 0 max(12px, env(safe-area-inset-right));
  pointer-events: none;
}

#touchControls.active {
  display: flex;
}

.controlButton {
  pointer-events: auto;
  border: 0;
  background: transparent;
  padding: 0;
  opacity: 0.92;
}

.controlButton:active {
  transform: scale(0.96);
  opacity: 1;
}

.controlButton img {
  width: min(34vw, 210px);
  image-rendering: pixelated;
}

.gameOverPanel {
  width: min(78vw, 680px);
  image-rendering: pixelated;
  margin-top: -10vh;
}

.clearTitle,
.clearPlayer {
  display: none;
}

#gameOverScreen.is-clear .gameOverPanel {
  display: none;
}

#gameOverScreen.is-clear .clearTitle {
  display: block;
  margin-top: -12vh;
  padding: 10px 24px;
  color: #ffe145;
  background: rgba(5, 2, 13, 0.78);
  border: 5px solid #ff2fae;
  box-shadow: 8px 8px 0 #000, 0 0 24px #ffe145;
  font-weight: 900;
  font-size: clamp(42px, 8vw, 92px);
  line-height: 1;
  text-shadow: 5px 5px 0 #000, 0 0 18px #ff2fae;
}

#gameOverScreen.is-clear .clearPlayer {
  display: block;
  width: min(30vw, 230px);
  image-rendering: pixelated;
  filter: drop-shadow(8px 8px 0 #000) drop-shadow(0 0 14px #ffe145);
  margin-top: -6vh;
}

#gameOverScreen.is-clear .resultText {
  color: #ffe145;
  margin-top: -7vh;
}

#gameOverScreen.is-clear .gameOverActions {
  margin-top: -6vh;
}

.resultText {
  margin-top: -12vh;
  font-size: clamp(18px, 3vw, 32px);
  font-weight: 900;
  text-shadow: 4px 4px 0 #000, 0 0 14px #ff2fae;
  color: #fff;
}

.gameOverActions {
  display: flex;
  gap: 14px;
  justify-content: center;
  flex-wrap: wrap;
  margin-top: -10vh;
}

.retryButton,
.homeGameButton,
.shareButton,
.rankingButton,
.submitScoreButton,
.shareOption,
.shareCloseButton {
  font-weight: 900;
  font-size: clamp(16px, 2.6vw, 28px);
  padding: 12px 24px;
  color: white;
  background: #ff2fae;
  border: 4px solid #ffe145;
  box-shadow: 6px 6px 0 #000;
  cursor: pointer;
}

.shareButton {
  background: #21a8ff;
}

.rankingButton,
.submitScoreButton {
  background: #7b4dff;
}

.homeGameButton {
  background: #222;
}

.sharePanel {
  display: none;
  position: relative;
  grid-template-columns: repeat(2, minmax(120px, 1fr)) auto;
  gap: 10px;
  align-items: center;
  width: min(86vw, 520px);
  margin-top: -5vh;
  padding: 12px;
  background: rgba(5, 2, 13, 0.94);
  border: 4px solid #ffe145;
  box-shadow: 6px 6px 0 #000;
}

.sharePanel.active {
  display: grid;
}

.shareOption {
  width: 100%;
  background: #7b4dff;
  font-size: clamp(14px, 2.2vw, 22px);
  padding: 10px 12px;
}

.shareCloseButton {
  width: 48px;
  height: 48px;
  padding: 0;
  background: #222;
  line-height: 1;
}

.shareStatus {
  grid-column: 1 / -1;
  min-height: 1.2em;
  font-weight: 900;
  font-size: clamp(11px, 1.8vw, 15px);
  color: #ffe145;
  text-shadow: 2px 2px 0 #000;
}


#bgmWarning {
  position: absolute;
  left: 50%;
  bottom: max(78px, calc(env(safe-area-inset-bottom) + 78px));
  transform: translateX(-50%);
  display: none;
  max-width: min(88vw, 620px);
  padding: 10px 14px;
  border: 3px solid #ffe145;
  background: rgba(5, 2, 13, 0.92);
  color: #fff;
  font-weight: 900;
  font-size: clamp(12px, 2.4vw, 18px);
  text-align: center;
  text-shadow: 2px 2px 0 #000;
  box-shadow: 4px 4px 0 #000;
  pointer-events: none;
}

#bgmWarning.active {
  display: block;
}


@media (pointer: coarse) {
  html,
  body {
    width: 100%;
    height: var(--app-height, 100vh);
    overscroll-behavior: none;
  }

  #gameWrap {
    width: 100vw;
    height: var(--app-height, 100vh);
    overflow: hidden;
  }

  #gameCanvas {
    width: min(100vw, calc(var(--app-height, 100vh) * 16 / 9));
    height: min(var(--app-height, 100vh), calc(100vw * 9 / 16));
  }

  #hud {
    top: max(6px, env(safe-area-inset-top));
    left: max(6px, env(safe-area-inset-left));
  }

  .scoreBox {
    width: min(30vw, 190px);
    opacity: 0.86;
  }

  #distanceText {
    font-size: clamp(12px, 2.5vw, 18px);
  }

  #remainText {
    font-size: clamp(7px, 1.45vw, 11px);
  }

  #touchControls {
    position: fixed;
    inset: 0;
    display: none;
    padding: 0;
    pointer-events: none;
    z-index: 10;
  }

  #touchControls.active {
    display: block;
  }

  .controlButton {
    position: absolute;
    top: 50%;
    width: clamp(86px, 15vw, 132px);
    min-width: 190px;
    min-height: 170px;
    display: grid;
    place-items: center;
    transform: translateY(-50%);
    touch-action: none;
  }

  .controlButton:active {
    transform: translateY(-50%) scale(0.94);
  }

  #duckButton {
    left: max(8px, env(safe-area-inset-left));
  }

  #jumpButton {
    right: max(8px, env(safe-area-inset-right));
  }

  .controlButton img {
    width: clamp(64px, 9vw, 96px);
    display: block;
    opacity: 0.72;
  }

  .imageButton {
    animation-duration: 1.8s;
  }
}

@media (pointer: coarse) and (orientation: portrait) {
  #gameWrap {
    align-content: start;
  }

  #gameCanvas {
    width: 100vw;
    height: 56.25vw;
    transform: translateY(8vh);
  }

  #touchControls .controlButton {
    top: auto;
    bottom: max(18px, env(safe-area-inset-bottom));
    width: clamp(86px, 24vw, 126px);
    min-width: 190px;
    min-height: 160px;
  }

  #hud {
    top: calc(8vh + 8px);
  }
}

@media (pointer: coarse) and (orientation: landscape) {
  #titleScreen {
    align-content: center;
    gap: 6px;
    padding: 8px max(12px, env(safe-area-inset-left)) 8px max(12px, env(safe-area-inset-right));
    box-sizing: border-box;
  }

  #titleScreen .logo {
    width: min(42vw, 380px);
    max-height: 19vh;
    margin-top: 0;
  }

  #titleScreen .subtitle {
    margin-top: 0;
    padding: 5px 14px;
    font-size: clamp(16px, 2.5vw, 26px);
    border-width: 3px;
  }

  #titleScreen .imageButton {
    margin-top: 0;
    padding: 5px 8px;
    border-width: 4px;
    box-shadow: 5px 5px 0 #000, 0 0 16px #ff2fae;
  }

  #titleScreen .imageButton img {
    width: min(46vw, 420px);
  }

  #titleScreen .titleButtons {
    margin-top: 0;
    gap: 8px;
  }

  #titleScreen .howtoPageButton,
  #titleScreen .rankingTitleButton {
    margin-top: 0;
    padding: 7px 22px;
    font-size: clamp(16px, 2.4vw, 24px);
    border-width: 4px;
  }

  #titleScreen .howto {
    margin-top: 0;
    gap: 8px;
    font-size: clamp(13px, 2vw, 19px);
  }

  #titleScreen .howto span {
    padding: 5px 10px;
    border-width: 2px;
  }

  #titleScreen .bestText {
    margin-top: 0;
    padding: 5px 14px;
    font-size: clamp(14px, 2.2vw, 22px);
    border-width: 3px;
  }

  #gameCanvas {
    width: min(100vw, calc(var(--app-height, 100vh) * 16 / 9));
    height: min(var(--app-height, 100vh), calc(100vw * 9 / 16));
  }

  .controlButton {
    width: clamp(70px, 9vw, 96px);
    min-width: 220px;
    min-height: 190px;
  }

  .controlButton img {
    width: clamp(70px, 9vw, 96px);
    opacity: 0.72;
  }
}

@media (pointer: coarse) {
  body.is-playing #gameCanvas {
    width: min(112vw, calc(var(--app-height, 100vh) * 16 / 9 * 1.08));
    height: min(calc(var(--app-height, 100vh) * 1.08), calc(112vw * 9 / 16));
  }

  .gameOverPanel {
    width: min(62vw, 460px);
    margin-top: -7vh;
    pointer-events: none;
    user-select: none;
    -webkit-user-select: none;
    -webkit-user-drag: none;
    -webkit-touch-callout: none;
  }

  .resultText {
    margin-top: -7vh;
    font-size: clamp(16px, 2.5vw, 24px);
    pointer-events: none;
    user-select: none;
    -webkit-user-select: none;
  }

  .gameOverActions {
    margin-top: -7vh;
  }
}

@media (pointer: coarse) and (orientation: landscape) {
  body.is-playing #gameCanvas {
    width: min(112vw, calc(var(--app-height, 100vh) * 16 / 9 * 1.08));
    height: min(calc(var(--app-height, 100vh) * 1.08), calc(112vw * 9 / 16));
  }

  .gameOverPanel {
    width: min(50vw, 420px);
    max-height: 42vh;
    object-fit: contain;
  }

  .resultText {
    font-size: clamp(14px, 2.2vw, 22px);
  }
}

/* Readable in-game score strip. Keeps numbers on one line as they grow. */
#hud .scoreBox {
  width: min(76vw, 620px);
  min-height: 72px;
  padding: 10px 18px;
  box-sizing: border-box;
  border: 4px solid #ffe145;
  background: rgba(5, 2, 13, 0.78);
  box-shadow: 5px 5px 0 #000, 0 0 14px #ff2fae;
}

#hud .scoreBox img {
  display: none;
}

#hud .scoreText {
  position: static;
  inset: auto;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  gap: 4px;
  min-width: 0;
  text-align: left;
}

#hud #distanceText,
#hud #remainText {
  white-space: nowrap;
  overflow: visible;
  line-height: 1;
  -webkit-text-stroke: 1px #000;
  text-shadow: 3px 3px 0 #000, 0 0 10px #ff2fae;
}

#hud #distanceText {
  font-size: clamp(24px, 4vw, 40px);
  letter-spacing: 0;
}

#hud #remainText {
  font-size: clamp(13px, 2vw, 20px);
}

@media (pointer: coarse) {
  #hud .scoreBox {
    width: min(82vw, 520px);
    min-height: 48px;
    padding: 6px 10px;
    border-width: 3px;
    opacity: 0.9;
  }

  #hud #distanceText {
    font-size: clamp(16px, 4.2vw, 26px);
  }

  #hud #remainText {
    font-size: clamp(9px, 2.2vw, 14px);
  }
}

@media (pointer: coarse) and (orientation: landscape) {
  #hud .scoreBox {
    width: min(46vw, 460px);
    min-height: 44px;
  }

  #hud #distanceText {
    font-size: clamp(15px, 3vw, 22px);
  }

  #hud #remainText {
    font-size: clamp(8px, 1.6vw, 12px);
  }
}

/* Game-over screen readability and title return action. */
#gameOverScreen {
  align-content: center;
  gap: 12px;
  padding: max(12px, env(safe-area-inset-top)) max(12px, env(safe-area-inset-right)) max(12px, env(safe-area-inset-bottom)) max(12px, env(safe-area-inset-left));
  box-sizing: border-box;
}

#gameOverScreen .gameOverPanel {
  width: min(66vw, 560px);
  margin-top: 2vh;
  padding: 8px;
  border: 4px solid #ffe145;
  background: rgba(5, 2, 13, 0.42);
  box-shadow: 6px 6px 0 #000, 0 0 18px #ff2fae;
}

#gameOverScreen .resultText {
  margin-top: 0;
  padding: 6px 16px;
  border: 3px solid #fff;
  background: rgba(5, 2, 13, 0.72);
  box-shadow: 4px 4px 0 #000;
}

#gameOverScreen .gameOverActions {
  margin-top: 0;
  gap: 10px;
}

.homeGameButton {
  font-weight: 900;
  font-size: clamp(16px, 2.3vw, 24px);
  padding: 12px 20px;
  color: white;
  background: #7b4dff;
  border: 4px solid #ffe145;
  box-shadow: 6px 6px 0 #000;
  cursor: pointer;
}

@media (pointer: coarse) {
  #gameOverScreen {
    gap: 8px;
  }

  #gameOverScreen .gameOverPanel {
    width: min(58vw, 420px);
    margin-top: 0;
    padding: 5px;
    border-width: 3px;
  }

  #gameOverScreen .resultText {
    font-size: clamp(14px, 2.5vw, 22px);
    padding: 5px 12px;
  }

  #gameOverScreen .gameOverActions {
    gap: 8px;
  }

  .retryButton,
  .shareButton,
  .homeGameButton {
    font-size: clamp(13px, 2.4vw, 22px);
    padding: 9px 14px;
    border-width: 3px;
    box-shadow: 4px 4px 0 #000;
  }
}

@media (pointer: coarse) and (orientation: landscape) {
  #gameOverScreen .gameOverPanel {
    width: min(42vw, 360px);
    max-height: 34vh;
  }

  #gameOverScreen .resultText {
    font-size: clamp(13px, 2vw, 19px);
  }
}


.rankingSubmit {
  width: min(86vw, 560px);
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  margin-top: -6vh;
  padding: 12px;
  box-sizing: border-box;
  background: rgba(5, 2, 13, 0.82);
  border: 4px solid #ffe145;
  box-shadow: 6px 6px 0 #000;
}

.playerNameInput {
  min-width: 0;
  padding: 12px 14px;
  color: #fff;
  background: rgba(255, 255, 255, 0.12);
  border: 3px solid #fff;
  font-weight: 900;
  font-size: clamp(15px, 2.3vw, 22px);
  text-shadow: 2px 2px 0 #000;
  outline: none;
}

.playerNameInput::placeholder {
  color: rgba(255, 255, 255, 0.72);
}

.submitScoreButton {
  padding: 10px 16px;
  font-size: clamp(14px, 2.1vw, 20px);
}

.submitScoreButton:disabled {
  opacity: 0.6;
  cursor: default;
}

.submitScoreStatus {
  grid-column: 1 / -1;
  min-height: 1.2em;
  color: #ffe145;
  font-weight: 900;
  font-size: clamp(12px, 1.9vw, 16px);
  text-shadow: 2px 2px 0 #000;
}

.rankingPanel {
  position: absolute;
  inset: 0;
  display: none;
  place-items: center;
  padding: 18px;
  box-sizing: border-box;
  background: rgba(5, 2, 13, 0.72);
  z-index: 30;
}

.rankingPanel.active {
  display: grid;
}

.rankingDialog {
  position: relative;
  width: min(88vw, 560px);
  max-height: min(86vh, 620px);
  overflow: auto;
  padding: 20px;
  box-sizing: border-box;
  background: rgba(10, 4, 24, 0.96);
  border: 5px solid #ffe145;
  box-shadow: 8px 8px 0 #000, 0 0 22px #ff2fae;
}

.rankingCloseButton {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 44px;
  height: 44px;
  color: #fff;
  background: #222;
  border: 3px solid #ffe145;
  box-shadow: 4px 4px 0 #000;
  font-weight: 900;
  font-size: 26px;
  cursor: pointer;
}

.rankingHeading {
  margin: 4px 48px 14px;
  color: #ffe145;
  font-weight: 900;
  font-size: clamp(26px, 5vw, 44px);
  text-shadow: 4px 4px 0 #000, 0 0 14px #ff2fae;
}

.rankingList {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style-position: inside;
  counter-reset: rank;
}

.rankingItem {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
  padding: 9px 12px;
  background: rgba(255, 255, 255, 0.1);
  border: 2px solid rgba(255, 255, 255, 0.7);
  box-shadow: 3px 3px 0 #000;
  font-weight: 900;
  text-align: left;
  counter-increment: rank;
}

.rankingItem::before {
  content: counter(rank) "位";
  color: #ffe145;
  text-shadow: 2px 2px 0 #000;
}

.rankingName {
  min-width: 0;
  overflow: visible;
  text-overflow: clip;
  white-space: normal;
  overflow-wrap: anywhere;
  line-height: 1.18;
}

.rankingScore {
  color: #ffe145;
  white-space: nowrap;
  text-shadow: 2px 2px 0 #000;
  font-size: 0.92em;
}

.rankingEmpty,
.rankingStatus {
  color: #fff;
  font-weight: 900;
  text-shadow: 2px 2px 0 #000;
}

.rankingStatus {
  min-height: 1.2em;
  margin-top: 12px;
  color: #ffe145;
}

/* Result screen layout: keep score submission separate from retry/share buttons. */
#gameOverScreen {
  align-content: center;
  gap: 10px;
  padding: max(10px, env(safe-area-inset-top)) max(12px, env(safe-area-inset-right)) max(10px, env(safe-area-inset-bottom)) max(12px, env(safe-area-inset-left));
  box-sizing: border-box;
  overflow: hidden;
}

#gameOverScreen .gameOverPanel {
  width: min(64vw, 520px);
  max-height: 30vh;
  object-fit: contain;
  margin-top: 0;
}

#gameOverScreen .clearTitle,
#gameOverScreen .clearPlayer,
#gameOverScreen .resultText,
#gameOverScreen .gameOverActions,
#gameOverScreen .rankingSubmit,
#gameOverScreen .sharePanel {
  margin-top: 0;
}

#gameOverScreen.is-clear .clearTitle {
  margin-top: 0;
  font-size: clamp(34px, 6.5vw, 78px);
}

#gameOverScreen.is-clear .clearPlayer {
  width: min(24vw, 180px);
  margin-top: 0;
}

#gameOverScreen .resultText {
  padding: 4px 14px;
  background: rgba(5, 2, 13, 0.72);
  border: 3px solid rgba(255, 225, 69, 0.8);
  box-shadow: 4px 4px 0 #000;
}

#gameOverScreen .gameOverActions {
  width: min(92vw, 720px);
  gap: 10px;
}

#gameOverScreen .rankingSubmit {
  width: min(92vw, 560px);
}

#gameOverScreen .sharePanel {
  width: min(92vw, 520px);
}

@media (pointer: coarse) {
  #gameOverScreen {
    gap: 6px;
  }

  #gameOverScreen .gameOverPanel {
    width: min(54vw, 360px);
    max-height: 24vh;
  }

  #gameOverScreen .gameOverActions {
    gap: 6px;
  }

  #gameOverScreen .retryButton,
  #gameOverScreen .homeGameButton,
  #gameOverScreen .shareButton,
  #gameOverScreen .rankingButton,
  #gameOverScreen .submitScoreButton {
    padding: 8px 12px;
    font-size: clamp(12px, 2.2vw, 18px);
    border-width: 3px;
    box-shadow: 4px 4px 0 #000;
  }

  #gameOverScreen .rankingSubmit {
    grid-template-columns: 1fr;
    gap: 7px;
    padding: 8px;
  }

  #gameOverScreen .playerNameInput {
    padding: 8px 10px;
    font-size: clamp(13px, 2.3vw, 18px);
  }
}

@media (pointer: coarse) and (orientation: landscape) {
  #gameOverScreen .gameOverPanel {
    width: min(38vw, 320px);
    max-height: 22vh;
  }

  #gameOverScreen .resultText {
    font-size: clamp(12px, 1.9vw, 17px);
  }

  #gameOverScreen .rankingSubmit {
    grid-template-columns: minmax(0, 1fr) auto;
    width: min(78vw, 520px);
  }
}

.rankingHeading {
  white-space: nowrap;
  font-size: clamp(22px, 6.2vw, 44px);
}

@media (max-width: 420px) {
  .rankingHeading {
    margin-left: 28px;
    margin-right: 44px;
    font-size: clamp(19px, 5.6vw, 28px);
  }
}
