.utility-group[data-menu-state="staged"] {
  flex: 1 1 auto;
  min-width: 0;
  justify-content: center;
  align-items: stretch;
}

.utility-group[data-menu-state="staged"] .utility,
.utility-group[data-menu-state="racing"] .back-to-start-button {
  min-height: 50px;
  padding: 8px clamp(10px, 1.55vw, 18px);
  border-radius: 14px;
  white-space: nowrap;
}

.back-to-lot-button {
  background: #ff7b54;
}

.sound-guide-button {
  background: #38d9ff;
}

.back-to-start-button,
.recalibrate-button,
.reset-rivals-button {
  background: var(--paper);
}

.back-to-start-button.is-lap-invalid {
  background: #ff6b6b;
}

.back-to-start-button.is-lap-invalid-pulse {
  animation: turn-restart-invalid-pulse 680ms cubic-bezier(0.2, 0.85, 0.3, 1.2) 1;
}

@keyframes turn-restart-invalid-pulse {
  0%, 100% { transform: scale(1); }
  36% { transform: scale(1.08); }
  64% { transform: scale(0.985); }
}

.utility-group[data-menu-state="hidden"] {
  display: none;
}

.sound-guide-dialog {
  width: min(760px, calc(100vw - 28px));
  max-width: none;
  max-height: calc(100dvh - 28px);
  padding: 0;
  border: 0;
  background: transparent;
  color: #08090a;
  overflow: visible;
}

.sound-guide-dialog:not([open]) {
  display: none;
}

.sound-guide-dialog::backdrop {
  background: rgba(8, 9, 10, 0.72);
  backdrop-filter: blur(5px);
}

.sound-guide-card {
  max-height: calc(100dvh - 28px);
  padding: clamp(18px, 3vw, 30px);
  overflow: auto;
  border: 4px solid #08090a;
  border-radius: 22px;
  background: var(--paper);
  box-shadow: 0 18px 0 rgba(8, 9, 10, 0.28);
}

.sound-guide-head {
  display: flex;
  gap: 18px;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 16px;
}

.sound-guide-head h2,
.sound-guide-card h3,
.sound-guide-card h4 {
  margin: 0;
  line-height: 1;
  text-transform: uppercase;
}

.sound-guide-head h2 {
  font-size: clamp(1.65rem, 4.4vw, 2.8rem);
}

.sound-guide-card h3 {
  margin-top: 20px;
  font-size: clamp(0.9rem, 2vw, 1.15rem);
  letter-spacing: 0.08em;
}

.sound-guide-card h4 {
  font-size: clamp(0.82rem, 1.8vw, 1rem);
}

.sound-guide-card p {
  margin: 8px 0 0;
  line-height: 1.42;
}

.sound-guide-close {
  flex: 0 0 auto;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 3px solid #08090a;
  border-radius: 50%;
  background: #ff6b6b;
  color: #08090a;
  font: inherit;
  font-size: 1.55rem;
  font-weight: 900;
  line-height: 1;
}

.sound-guide-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-top: 12px;
}

.sound-guide-list > section {
  min-width: 0;
  padding: 14px;
  border: 3px solid #08090a;
  border-radius: 15px;
  background: #fffdf6;
}

.sound-guide-button:focus-visible,
.sound-guide-close:focus-visible {
  outline: 4px solid #ffd43b;
  outline-offset: 3px;
}

@media (max-width: 620px) {
  .sound-guide-list {
    grid-template-columns: 1fr;
  }
}

@media (max-height: 430px) {
  .utility-group[data-menu-state="staged"] {
    gap: 7px;
  }

  .utility-group[data-menu-state="staged"] .utility,
  .utility-group[data-menu-state="racing"] .back-to-start-button {
    min-height: 40px;
    padding: 6px clamp(8px, 1.2vw, 13px);
    font-size: clamp(0.52rem, 1.18vw, 0.64rem);
  }

  .sound-guide-dialog {
    width: min(820px, calc(100vw - 18px));
    max-height: calc(100dvh - 18px);
  }

  .sound-guide-card {
    max-height: calc(100dvh - 18px);
    padding: 15px 18px 18px;
    border-radius: 16px;
  }

  .sound-guide-head {
    margin-bottom: 8px;
  }

  .sound-guide-head h2 {
    font-size: clamp(1.35rem, 3.8vw, 2rem);
  }

  .sound-guide-card h3 {
    margin-top: 12px;
  }

  .sound-guide-card p {
    margin-top: 5px;
    font-size: 0.82rem;
    line-height: 1.3;
  }

  .sound-guide-close {
    width: 38px;
    height: 38px;
  }

  .sound-guide-list {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
    margin-top: 8px;
  }

  .sound-guide-list > section {
    padding: 10px;
    border-width: 2px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .back-to-start-button.is-lap-invalid-pulse {
    animation: none;
  }
}
