:root {
  font-family: system-ui,-apple-system,"Hiragino Kaku Gothic ProN","Noto Sans JP",Meiryo,sans-serif;
  color: #183846;
  font-synthesis: none;
}

* {
  box-sizing: border-box;
}

html,body {
  height: 100%;
  width: 100%;
  margin: 0;
  overflow: hidden;
  overscroll-behavior: none;
}

body {
  display: grid;
  place-items: center;
  background: #142834;
}

button {
  font: inherit;
}

.game {
  position: relative;
  width: 100%;
  max-width: 490px;
  height: 100%;
  height: 100dvh;
  overflow: hidden;
  background: #daedf2;
  user-select: none;
  -webkit-user-select: none;
}

canvas {
  width: 100%;
  height: 100%;
  display: block;
}

#scene {
  touch-action: none;
}

.hud {
  position: absolute;
  inset: 0;
  pointer-events: none;
  padding: calc(env(safe-area-inset-top) + 17px) 18px calc(env(safe-area-inset-bottom) + 18px);
}

.controls-guide {
  position: absolute;
  top: calc(env(safe-area-inset-top) + 16px);
  right: calc(env(safe-area-inset-right) + 12px);
  padding: 4px 7px;
  border-radius: 6px;
  background: rgba(247,250,244,.78);
  color: #304e55;
  font-size: 11px;
  font-weight: 600;
  line-height: 1.5;
  pointer-events: none;
}

.controls-guide span {
  display: block;
}

.score {
  text-align: left;
  font-size: 10px;
  letter-spacing: .08em;
  font-weight: 900;
  color: #547984;
}

.score strong {
  display: block;
  font-size: 32px;
  line-height: 1.2;
  letter-spacing: -.03em;
  color: #234b5a;
  font-variant-numeric: tabular-nums;
}

.overlay {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  align-items: center;
  text-align: center;
  padding: calc(env(safe-area-inset-top) + 49px) 22px calc(env(safe-area-inset-bottom) + 31px);
  background: linear-gradient(180deg,#e4f3f4f2 0%,#e4f3f4df 38%,#e4f3f4ab 58%,#0c3041eb 100%);
  z-index: 5;
}

.overlay.hidden {
  display: none;
}

.title {
  font-size: clamp(57px,17vw,85px);
  line-height: .87;
  letter-spacing: -.08em;
  margin: 17px 0 20px;
  font-weight: 1000;
  color: #1c4352;
}

.primary {
  display: block;
  border: 0;
  border-radius: 14px;
  background: #f09b70;
  box-shadow: 0 6px #ad644d;
  width: 100%;
  height: 57px;
  color: #173645;
  font-size: 17px;
  font-weight: 950;
  cursor: pointer;
  touch-action: manipulation;
}

.primary:active {
  transform: translateY(4px);
  box-shadow: 0 2px #ad644d;
}

@media(min-width:700px) {
  body {
    padding: 16px;
  }
  .game {
    height: min(920px,calc(100dvh - 32px));
    border-radius: 18px;
    box-shadow: 0 24px 80px #07111a90;
  }
}

@media(max-height:650px) {
  .overlay {
    padding-top: 23px;
    padding-bottom: 18px;
  }
  .primary {
    height: 51px;
  }
}

#intro {
  background: linear-gradient(180deg,#edf4f44d,transparent 40%,transparent 70%,#172e3e66);
  padding-top: clamp(24px,8vh,84px);
}

#intro .title {
  font-size: clamp(54px,min(17vw,12vh),86px);
  line-height: .88;
  margin: 0;
  color: #193c4a;
  letter-spacing: -.065em;
  text-shadow: 0 2px #ffffff70;
}

.title-hero {
  position: relative;
  width: fit-content;
  max-width: 100%;
  flex: 0 0 auto;
}

.info-home {
  position: absolute;
  top: calc(env(safe-area-inset-top) + 10px);
  right: calc(env(safe-area-inset-right) + 10px);
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border: 1px solid #cbdad8;
  border-radius: 50%;
  color: #284d59;
  background: #f6faf5e8;
  cursor: pointer;
  z-index: 2;
  touch-action: manipulation;
}

.info-home:focus-visible, .install-home:focus-visible {
  outline: 3px solid #f09b70;
  outline-offset: 3px;
}

.title-actions {
  display: grid;
  justify-items: center;
  gap: 10px;
  width: min(85%,240px);
}

#customize {
  border: 1px solid #ecf1ed;
  border-radius: 24px;
  background: #f6faf5ed;
  color: #244753;
  padding: 9px 16px;
  font-size: 13px;
  font-weight: 750;
  cursor: pointer;
}

#intro.hidden {
  display: flex;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity .55s ease-out,visibility 0s .55s;
}

#custom-dialog {
  width: min(86vw,350px);
  max-height: 86vh;
  overflow: auto;
  box-sizing: border-box;
  border: 0;
  border-radius: 18px;
  padding: 24px;
  background: #f5f9f7;
  color: #214550;
  text-align: center;
}

#custom-dialog::backdrop {
  background: #102b39a8;
}

#bird-preview {
  width: 160px;
  height: 80px;
  max-width: 100%;
  margin: 15px auto;
}

#custom-dialog {
  width: min(92vw,400px);
  padding: 18px;
  overflow: hidden;
}

#custom-dialog[open] {
  display: flex;
  flex-direction: column;
  max-height: 90vh;
  max-height: 90dvh;
}

.modal-close {
  position: absolute;
  top: 0;
  right: 0;
  width: 34px;
  height: 34px;
  border: 1px solid #becdce;
  border-radius: 50%;
  background: transparent;
  color: #34525b;
  font: 24px/1 system-ui;
  cursor: pointer;
}

#bird-preview {
  flex: none;
  height: clamp(36px,9vh,75px);
  width: auto;
  aspect-ratio: 2;
  margin: 18px auto 20px;
}

.part-colors {
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  display: grid;
  gap: 25px;
  text-align: left;
  margin: 4px 0 22px;
  padding: 5px;
}

.swatch-row {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.swatch-row strong {
  flex-basis: 100%;
  margin-bottom: 6px;
  font-size: 13px;
}

.swatch-row button {
  width: 33px;
  height: 33px;
  border: 2px solid #38566528;
  border-radius: 50%;
  padding: 0;
  cursor: pointer;
}

.swatch-row button[aria-pressed="true"] {
  border-color: white;
  outline: 2px solid #266979;
  outline-offset: 1px;
}

#custom-done {
  flex-shrink: 0;
}

#hud [hidden] {
  display: none;
}

#passed.gain {
  color: #087546;
  text-shadow: 0 1px 2px white,0 0 4px white;
}

.meat-counter {
  display: flex;
  align-items: center;
  gap: 3px;
  font-size: 14px;
  line-height: 24px;
  font-variant-numeric: tabular-nums;
}

#target-score {
  display: block;
  margin-top: 2px;
  font-size: 11px;
  font-weight: 750;
  letter-spacing: .04em;
}

#score-breakdown {
  margin: 5px 0;
  color: #45616a;
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}

@media(prefers-reduced-motion:no-preference) {
  #meat-icon.bounce-a {
    animation: meat-pop-a .28s ease-out;
  }
  #meat-icon.bounce-b {
    animation: meat-pop-b .28s ease-out;
  }
  @keyframes meat-pop-a {
    45% {
      transform: translateY(-2px) scale(1.2);
    }
  }
  @keyframes meat-pop-b {
    45% {
      transform: translateY(-2px) scale(1.2);
    }
  }
}

.part-unlock-toast {
  position: absolute;
  top: calc(env(safe-area-inset-top) + 105px);
  left: 18px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 11px 4px 6px;
  border: 1px solid #f3c86d;
  border-radius: 8px;
  background: #332b29;
  color: #fff3ce;
  font-size: clamp(14px,4vw,17px);
  font-weight: 800;
  line-height: 1.35;
  pointer-events: none;
}

.part-unlock-toast img {
  flex: none;
}

#part-unlock-toast[hidden],#result-parts[hidden] {
  display: none;
}

.result-parts {
  margin: 4px 0 0;
  color: #785121;
  text-align: center;
  font-size: 13px;
  line-height: 1.4;
}

.result-parts::before,.result-parts::after {
  content: "";
  display: inline-block;
  width: 5px;
  height: 5px;
  margin: 0 8px 2px;
  background: #bd8730;
  transform: rotate(45deg);
}

#speedup {
  position: absolute;
  top: 43%;
  left: 18%;
  font-weight: 950;
  font-style: italic;
  color: #09653c;
  background: #f2ffdcf2;
  border-radius: 14px;
  padding: 3px 10px;
  font-size: 16px;
}

@media(prefers-reduced-motion:no-preference) {
  #speedup:not([hidden]) {
    animation: speedup-impact .36s cubic-bezier(.2,1,.25,1) both;
  }
  @keyframes speedup-impact {
    0% {
      opacity: 0;
      transform: translateX(14px) skewX(-12deg) scale(1.24);
    }
    45% {
      opacity: 1;
      transform: translateX(-2px) skewX(-7deg) scale(1.08);
    }
    100% {
      opacity: 1;
      transform: none;
    }
  }
}

.close-row {
  display: flex;
  justify-content: flex-end;
  flex: none;
  width: 100%;
}

.close-row .modal-close {
  position: static;
  border: 0;
  background: transparent;
  width: 38px;
  height: 36px;
  font: 19px/1 system-ui;
  color: #38535e;
}

#custom-dialog {
  padding: 6px 19px 20px;
}

.custom-tabs,.result-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.custom-tabs {
  background: #e3eae7;
  border-radius: 10px;
  padding: 3px;
  flex: none;
}

.custom-tabs button {
  border: 0;
  border-radius: 8px;
  padding: 8px;
  color: #4a6269;
  font-weight: 700;
  background: transparent;
}

.custom-tabs [aria-selected="true"] {
  background: white;
  color: #193e49;
  box-shadow: 0 1px 4px #16394525;
}

.custom-pane {
  overflow-y: auto;
  touch-action: pan-y pinch-zoom;
  min-height: 0;
  overscroll-behavior: contain;
  margin: 18px 0 20px;
}

.custom-pane .part-colors {
  overflow: visible;
}

#restore-colors,#restore-shapes {
  background: transparent;
  border: 0;
  color: #315f69;
  text-decoration: underline;
  padding: 10px;
  font-size: 13px;
  cursor: pointer;
}

#body-pane section {
  text-align: left;
  border-bottom: 1px solid #d5e0de;
  padding: 16px 4px;
}

#body-pane h3 {
  font-size: 14px;
  margin: 0;
}

#body-pane section:last-child {
  border-bottom: 0;
}

#end {
  padding: 24px 19px 20px;
  width: min(88vw,360px);
  border: 0;
  border-radius: 19px;
  background: #f5f9f7;
  color: #193e49;
  text-align: center;
  max-height: 90vh;
  overflow: auto;
}

#end::backdrop {
  background: #142f3d85;
}

#end.result-locked #retry,#end.result-locked #back-title,#end.result-locked #open-record {
  opacity: .48;
  cursor: default;
  transform: none;
  box-shadow: none;
}

#end.result-locked button:disabled {
  pointer-events: none;
}

.game-over {
  position: absolute;
  inset: 0;
  z-index: 4;
  display: grid;
  place-items: center;
  pointer-events: auto;
  background: rgba(16,38,46,.25);
}

.game-over[hidden] {
  display: none;
}

.game-over strong {
  display: block;
  padding: 13px 25px 15px;
  border: 2px solid #fff7e7;
  border-radius: 12px;
  background: #da694f;
  color: #fffaf0;
  box-shadow: 0 6px 0 #9a453c,0 14px 30px #162c3a45;
  font-size: clamp(27px,7vw,39px);
  font-weight: 950;
  letter-spacing: .035em;
  white-space: nowrap;
  animation: game-over-appear .32s cubic-bezier(.19,1.65,.41,1) both;
}

@keyframes game-over-appear {
  from {
    opacity: 0;
    transform: translateY(-12px) scale(.88);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@media(prefers-reduced-motion:reduce) {
  .game-over strong {
    animation: none;
  }
}

.result-summary h2 {
  font-size: 15px;
  margin: 0;
}

.result-summary strong {
  display: block;
  font-size: clamp(48px,13vw,72px);
  letter-spacing: -.06em;
  line-height: 1.12;
  font-variant-numeric: tabular-nums;
}

.result-summary small {
  font-size: 13px;
  color: #506a71;
}

.result-actions {
  grid-template-columns: 1fr;
  gap: 12px;
  border-top: 1px solid #ccd9d6;
  padding-top: 18px;
  margin: 18px 0 0;
}

.result-actions button {
  height: 46px;
  font-size: 15px;
  border-radius: 10px;
}

.result-actions .secondary {
  background: #e4ece9;
  border: 1px solid #c9d8d4;
  color: #254956;
  font-weight: 700;
  cursor: pointer;
}

.result-actions .secondary:disabled {
  color: #64767a;
  cursor: default;
}

.save-action {
  width: 100%;
  margin-top: 18px;
  border: 1px solid #a9c1bc;
  border-radius: 10px;
  padding: 12px;
  background: #e5f0ea;
  color: #214751;
  font: inherit;
  font-weight: 750;
  cursor: pointer;
}

#record-dialog {
  width: min(90vw,400px);
  max-height: 92vh;
  max-height: 92dvh;
  overflow: auto;
  border: 0;
  border-radius: 18px;
  padding: 6px 19px 24px;
  background: #f5f9f7;
  color: #193e49;
}

#record-dialog::backdrop {
  background: #142f3d85;
}

#record-heading {
  margin: 0;
  text-align: center;
  font-size: 18px;
}

#record-card,
#record-save-preview {
  display: block;
  width: min(100%,46vh);
  height: auto;
  aspect-ratio: 1;
  margin: 15px auto;
  border-radius: 8px;
}

#record-save-fallback-dialog {
  width: min(90vw,400px);
  max-height: 92vh;
  max-height: 92dvh;
  overflow: auto;
  border: 0;
  border-radius: 18px;
  padding: 6px 19px 24px;
  background: #f5f9f7;
  color: #193e49;
}

#record-save-fallback-dialog::backdrop {
  background: #142f3da8;
}

#record-save-fallback-heading {
  margin: 0;
  text-align: center;
  font-size: 18px;
}

#record-save-fallback-message,
#record-save-fallback-note {
  margin: 16px 0 0;
  font-size: 13px;
  line-height: 1.65;
}

/* In iOS Safari long-press saving requires a genuine image, not a canvas. */
#record-save-preview {
  -webkit-touch-callout: default;
  -webkit-user-select: auto;
  user-select: auto;
  touch-action: auto;
  -webkit-user-drag: none;
}

#record-save-preview[hidden],
#record-save-fallback-note[hidden] {
  display: none;
}

#record-dialog label {
  display: block;
  margin: 15px 0 7px;
  font-size: 13px;
  font-weight: 700;
}

#record-name {
  width: 100%;
  border: 1px solid #a9c1bc;
  border-radius: 8px;
  background: white;
  color: #193e49;
  padding: 9px;
  font: inherit;
  font-size: 16px;
  user-select: text;
}

#save-image {
  margin-top: 16px;
}

@media(max-height:510px) {
  #custom-dialog[open] {
    display: block;
    overflow: auto;
  }
  .custom-pane {
    overflow: visible;
  }
}

#intro .title img {
  display: block;
  width: min(77vw,345px,65vh);
  height: auto;
}

.game.loading #intro {
  visibility: hidden;
}

#loading {
  position: absolute;
  inset: 0;
  z-index: 9;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  background: #daedf2;
  color: #234653;
  font-size: 15px;
  font-weight: 700;
}

#loading[hidden] {
  display: none;
}

#resume-run,
#loading-retry {
  border: 1px solid #96b4ba;
  border-radius: 10px;
  background: #f5faf8;
  padding: 8px 16px;
  color: inherit;
}

.shape-options {
  display: grid;
  grid-template-columns: repeat(auto-fit,minmax(min(56px,100%),1fr));
  gap: 8px;
  margin-top: 10px;
}

.shape-choice {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-width: 0;
  padding: 7px 2px;
  border: 2px solid #c8d7d4;
  border-radius: 12px;
  background: white;
  color: #334f56;
  cursor: pointer;
}

.shape-choice[aria-pressed="true"] {
  border-color: white;
  outline: 2px solid #266979;
  outline-offset: 1px;
  font-weight: 700;
}

.shape-thumb {
  pointer-events: none;
  display: block;
  width: 56px;
  height: 42px;
}

.shape-choice span {
  font-size: 11px;
  line-height: 1.2;
}

.title-secondary {
  width: 100%;
  padding: 11px;
  border: 1px solid #f0f6f0;
  border-radius: 13px;
  background: #f6faf5ed;
  color: #244753;
  font-size: 15px;
  font-weight: 800;
  cursor: pointer;
}

.title-secondary:disabled {
  opacity: .52;
  cursor: default;
}

#end.result-locked #invite-friend {
  opacity: .48;
  pointer-events: none;
  cursor: default;
}

#invite-dialog {
  width: min(90vw,390px);
  max-height: 90dvh;
  overflow: auto;
  border: 0;
  border-radius: 18px;
  background: #f5f9f7;
  color: #214550;
  text-align: center;
  padding: 6px 20px 22px;
}

#invite-dialog::backdrop {
  background: #142f3d85;
}

#invite-heading {
  font-size: 19px;
  margin: 0 0 8px;
}

.invite-caption {
  font-size: 13px;
  line-height: 1.65;
  color: #506a71;
  margin: 10px 0 17px;
}

#invite-dialog label {
  display: block;
  text-align: left;
  font-size: 12px;
  font-weight: 750;
  margin: 0 0 6px;
}

#invite-url {
  width: 100%;
  height: 43px;
  font-size: 13px;
  padding: 8px 10px;
  border: 1px solid #a9c1bc;
  border-radius: 9px;
  background: #fff;
  color: #244753;
  user-select: text;
  -webkit-user-select: text;
}

#copy-invite {
  margin-top: 14px;
  font-size: 15px;
  height: 49px;
}

#copy-invite:disabled {
  opacity: .5;
  cursor: wait;
  transform: none;
  box-shadow: none;
}

.invite-status {
  margin: 13px 0 0;
  font-size: 12px;
  line-height: 1.6;
  color: #506a71;
  min-height: 1.5em;
}

.invite-status.error {
  color: #a23f33;
}

#result {
  min-height: clamp(54px,14.5vw,82px);
  display: flex;
  align-items: center;
  justify-content: center;
}

#result.score-loading {
  font-size: clamp(28px,7.5vw,38px);
  color: #89979d;
  letter-spacing: .22em;
  animation: score-pulse .75s ease-in-out infinite alternate;
}

#result-more.score-loading {
  display: block;
  min-height: 1.5em;
}

@keyframes score-pulse {
  from {
    opacity: .35;
    transform: translateY(2px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media(prefers-reduced-motion:reduce) {
  #result.score-loading {
    animation: none;
  }
}

.challenge-toast {
  position: absolute;
  z-index: 8;
  left: 18px;
  right: 18px;
  bottom: calc(env(safe-area-inset-bottom) + 26px);
  padding: 13px 15px;
  border: 1px solid #f5c2c7;
  border-radius: 11px;
  background: #f8d7da;
  color: #842029;
  box-shadow: 0 8px 28px #23323b29;
  font-size: 13px;
  font-weight: 700;
  line-height: 1.5;
  text-align: center;
  pointer-events: none;
  animation: challenge-toast-in .2s ease-out both;
}

.challenge-toast.is-loading {
  border-color: #c6d5dc;
  background: #eaf2f5;
  color: #3a606b;
}

.challenge-toast[hidden] {
  display: none;
}

@keyframes challenge-toast-in {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media(prefers-reduced-motion:reduce) {
  .challenge-toast {
    animation: none;
  }
}

.invite-caption span {
  display: block;
}

#race-dialog {
  width: min(90vw,390px);
  max-height: 90dvh;
  overflow: auto;
  border: 0;
  border-radius: 18px;
  padding: 6px 20px 22px;
  background: #f5f9f7;
  color: #214550;
  text-align: center;
}

#race-dialog::backdrop {
  background: #142f3d85;
}

#race-heading {
  margin: 13px 0 28px;
  font-size: 19px;
  font-weight: 850;
}

#race-bird-preview {
  display: block;
  width: min(100%,215px);
  height: auto;
  aspect-ratio: 2;
  margin: 18px auto 25px;
}

.race-score {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  margin: 6px 0 18px;
}

.race-score span {
  font-size: 13px;
  font-weight: 700;
  color: #506a71;
}

.race-score strong {
  font-size: clamp(38px,11vw,58px);
  font-weight: 900;
  line-height: 1.1;
  letter-spacing: -.05em;
  font-variant-numeric: tabular-nums;
  color: #193e49;
}

#race-play {
  height: 53px;
}

#race-play:disabled {
  opacity: .5;
  cursor: wait;
  box-shadow: none;
  transform: none;
}

.install-home {
  position: absolute;
  top: 72%;
  left: 50%;
  transform: translate(-50%,-50%);
  z-index: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 40px;
  padding: 9px 16px;
  border: 1px solid #b6c9c7;
  border-radius: 22px;
  background: #f8fbf5f5;
  box-shadow: 0 3px 12px #15313a38;
  color: #2a515b;
  font-size: 12px;
  font-weight: 800;
  line-height: 1.2;
  white-space: nowrap;
  cursor: pointer;
  touch-action: manipulation;
}

.install-home[hidden] {
  display: none;
}

.install-home svg {
  flex: none;
}

.info-dialog {
  width: min(90vw,390px);
  max-height: 84vh;
  max-height: 84dvh;
  overflow-x: hidden;
  overflow-y: auto;
  border: 0;
  border-radius: 18px;
  padding: 8px 22px 24px;
  background: #f5f9f7;
  color: #214550;
  line-height: 1.7;
  text-align: left;
  user-select: text;
  -webkit-user-select: text;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-y;
}

.info-dialog::backdrop {
  background: #142f3da6;
}

.info-dialog [hidden] {
  display: none;
}

.info-dialog h2 {
  margin: 7px 0 17px;
  font-size: 20px;
  line-height: 1.35;
  text-align: center;
}

.info-dialog h3 {
  font-size: 14px;
  margin: 12px 0 7px;
}

.info-dialog p {
  margin: 5px 0 11px;
  font-size: 13px;
  line-height: 1.8;
  color: #415d66;
  overflow-wrap: anywhere;
}

.info-section + .info-section {
  margin-top: 15px;
}

.info-policy-link {
  width: 100%;
  margin-top: 12px;
  min-height: 46px;
  padding: 10px 13px;
  border: 1px solid #bdcfcd;
  border-radius: 11px;
  background: #e5f1ed;
  color: #1c4856;
  text-align: left;
  font-size: 13px;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  touch-action: manipulation;
}

.info-back {
  min-height: 38px;
  margin: 2px 0 8px;
  padding: 4px 2px;
  background: transparent;
  border: 0;
  color: #276479;
  text-align: left;
  font-weight: 750;
  cursor: pointer;
}

.info-dialog a {
  color: #175b74;
  text-decoration: underline;
  overflow-wrap: anywhere;
}

.info-dialog .info-policy-foot {
  margin-top: 16px;
  padding-top: 12px;
  border-top: 1px solid #d2e0dd;
}

#install-dialog {
  width: min(88vw,350px);
  max-height: 88dvh;
  overflow: auto;
  border: 0;
  border-radius: 18px;
  padding: 6px 22px 24px;
  background: #f5f9f7;
  color: #214550;
  text-align: center;
}

#install-dialog::backdrop {
  background: #142f3d85;
}

.install-icon {
  display: block;
  width: 66px;
  height: 66px;
  object-fit: contain;
  margin: 10px auto 13px;
  border-radius: 16px;
}

#install-heading {
  font-size: 19px;
  margin: 0 0 10px;
}

.install-caption {
  font-size: 13px;
  line-height: 1.65;
  color: #4e6870;
  margin: 0 0 17px;
}

.install-steps {
  font-size: 13px;
  line-height: 1.9;
  text-align: left;
  background: #eaf1ee;
  padding: 14px 15px;
  border-radius: 11px;
  color: #31535d;
  margin: 0;
}

#install-action {
  margin-top: 18px;
  height: 49px;
  font-size: 15px;
}

#install-action[hidden] {
  display: none;
}

.install-dismiss-forever {
  display: block;
  margin: 20px auto 0;
  padding: 11px 14px;
  min-height: 44px;
  border: 0;
  background: transparent;
  color: #516b74;
  font: inherit;
  font-size: 12px;
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}

.install-dismiss-forever:focus-visible {
  outline: 3px solid #f09b70;
  outline-offset: 2px;
  border-radius: 6px;
}

.controls-guide {
  text-align: right;
}

#sound-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  min-width: 54px;
  min-height: 44px;
  border: 0;
  background: transparent;
  color: #304e55;
  pointer-events: auto;
  cursor: pointer;
  font-size: 11px;
}

#sound-toggle[aria-pressed="false"] .sound-waves {
  opacity: 0;
}

#sound-toggle[hidden],#random-race[hidden],#race-new[hidden],#race-unlock[hidden] {
  display: none;
}

#race-new {
  margin-left: 4px;
  color: #934422;
  background: #fae3be;
  border-radius: 4px;
  padding: 2px 5px;
  font-size: 10px;
  letter-spacing: .05em;
}

.menu-carousel {
  width: 100%;
  display: grid;
  justify-items: center;
  gap: 6px;
}

.menu-window {
  width: calc(100% + 44px);
  overflow: hidden;
  padding: 6px 0 9px;
}

.menu-track {
  display: flex;
  align-items: start;
  transition: transform .36s cubic-bezier(.22,.75,.28,1);
}

.menu-track .title-actions {
  width: 100%;
  flex: 0 0 100%;
  padding: 0 max(32px,calc((100% - 240px)/2));
}

.menu-track #normal-menu.race-locked {
  display: flex;
  align-items: center;
  justify-content: center;
}

.menu-track #normal-menu.race-locked #start {
  width: min(100%,240px);
}

.menu-carousel.race-locked:not(.page-two) #sudden-menu {
  height: 0;
  overflow: hidden;
}

#game[data-sudden-death="false"] .mode-switch,
#game[data-sudden-death="false"] #sudden-menu {
  display: none;
}

.menu-carousel.page-two .menu-track {
  transform: translateX(-100%);
}

.mode-switch {
  display: inline-grid;
  grid-template-columns: 1fr 1fr;
  padding: 3px;
  border-radius: 30px;
  background: #19333edf;
  border: 1px solid #ffffff50;
}

.mode-switch button {
  background: transparent;
  color: #e0eded;
  border: 0;
  border-radius: 22px;
  font-size: 12px;
  font-weight: 700;
  min-height: 36px;
  padding: 0 13px;
  cursor: pointer;
}

.mode-switch button[aria-pressed="true"] {
  background: #f2f5ee;
  color: #264752;
}

.mode-switch button:focus-visible {
  outline: 2px solid #fab68f;
  outline-offset: 2px;
}

@media(min-width:700px) {
  .menu-carousel {
    grid-template-columns: auto auto;
    justify-content: center;
    align-items: center;
    column-gap: 12px;
  }
  .menu-window {
    grid-column: 1/-1;
    grid-row: 1;
    width: min(420px,calc(100vw - 76px));
  }
  .menu-track .title-actions {
    grid-auto-flow: column;
    grid-auto-columns: minmax(0,1fr);
    align-items: center;
    padding: 0 10px;
  }
  .menu-track #start {
    max-width: 240px;
  }
  .menu-track .primary,.menu-track .title-secondary {
    height: 46px;
    margin: 0;
  }
  #customize {
    justify-self: end;
  }
  .mode-switch {
    justify-self: start;
  }
  #game[data-sudden-death="false"] .menu-carousel {
    grid-template-columns: 1fr;
  }
  #game[data-sudden-death="false"] #customize {
    justify-self: center;
  }
}

.game.neon-run .score,.game.neon-run #passed {
  color: #e5fafa;
  text-shadow: 0 1px 3px #132134;
}

#retry-status {
  font-size: 13px;
  color: #865237;
}

@media(prefers-reduced-motion:reduce) {
  .menu-track {
    transition: none;
  }
}

.sudden-dialog {
  width: min(91vw,405px);
  max-height: 88dvh;
  overflow: auto;
  box-sizing: border-box;
  border: 0;
  border-radius: 17px;
  padding: 6px 20px 20px;
  background: #f5f9f7;
  color: #214550;
}

.sudden-dialog::backdrop {
  background: #142f3d85;
}

.sudden-dialog h2 {
  font-size: 20px;
  margin: 4px 0 18px;
  text-align: center;
}

#entry-form label {
  display: block;
  font-size: 14px;
  font-weight: 700;
}

#entry-name {
  box-sizing: border-box;
  width: 100%;
  margin: 7px 0 12px;
  padding: 10px;
  border: 1px solid #9eb9b6;
  border-radius: 8px;
  font-size: 16px;
}

#entry-returning-note {
  margin: -2px 0 12px;
  color: #496b71;
  font-size: 12px;
  line-height: 1.6;
}

#entry-returning-note[hidden] {
  display: none;
}

#entry-submit:disabled {
  opacity: .5;
}

#entry-status,#rank-status,#top-status {
  font-size: 13px;
  text-align: center;
}

#entry-status:empty,#top-status:empty {
  display: none;
}

#top-list {
  margin: 0;
  padding: 0;
  list-style: none;
}

#top-list li {
  display: grid;
  grid-template-columns: 22px 52px minmax(0,1fr) auto;
  gap: 6px;
  align-items: center;
  min-height: 44px;
  border-bottom: 1px solid #d5e1dd;
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}

#top-list canvas {
  width: 52px;
  height: 26px;
}

#top-list .runner-name {
  overflow-wrap: anywhere;
}

#result-more[hidden],#record-name[hidden],#record-label[hidden],#rank-status[hidden],#end button[hidden] {
  display: none;
}
