#screen-title.home-screen {
  padding: max(16px, var(--safe-top)) max(24px, var(--safe-right))
    max(12px, var(--safe-bottom)) max(24px, var(--safe-left));
  overflow: hidden;
  isolation: isolate;
  background:
    radial-gradient(ellipse at 82% 72%, #59377835, transparent 40%),
    radial-gradient(ellipse at 17% 40%, #174e5d35, transparent 40%), #080e20;
}
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}
.home-top {
  flex: 0 0 clamp(78px, 22vh, 160px);
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(240px, 2.1fr) minmax(0, 1fr);
  align-items: start;
  z-index: 1;
}
.home-logo {
  grid-column: 2;
  position: relative;
  margin: 0;
  align-self: center;
  width: 100%;
  filter: drop-shadow(0 0 12px #7a8cff55);
  animation: logo-breathe 4s ease-in-out infinite;
}
.home-logo img {
  display: block;
  width: 100%;
  height: auto;
}
.logo-star {
  position: absolute;
  color: #f9b3ff;
  text-shadow: 0 0 12px #ff80e9;
  font-size: 17px;
  animation: logo-sparkle 4s ease-in-out infinite;
}
.logo-star.s1 {
  left: 3%;
  top: 10%;
}
.logo-star.s2 {
  right: 1%;
  top: 9%;
  animation-delay: -1.3s;
  color: #8cffee;
}
.logo-star.s3 {
  left: 62%;
  bottom: 3%;
  font-size: 11px;
  animation-delay: -2.5s;
}
.home-player-hud {
  grid-column: 1;
  grid-row: 1;
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 10px;
  margin-top: 2px;
  width: min(215px, 100%);
  border: 1px solid #6ddec957;
  background: linear-gradient(120deg, #174052bb, #191d3988);
  border-radius: 16px;
  box-shadow:
    inset 0 0 18px #74f4f410,
    0 0 16px #6ff5dc0c;
}
.home-level {
  flex: none;
  border: 1px solid #81f5df77;
  border-radius: 50%;
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  font-weight: 700;
  font-size: 11px;
  color: #9cffe9;
  background: #163c4b;
}
.home-player-copy {
  min-width: 0;
  flex: 1;
}
.home-player-copy strong {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 12px;
}
.home-player-copy > span {
  font-size: 10px;
  color: #f1dc9d;
}
.home-exp {
  height: 3px;
  border-radius: 3px;
  overflow: hidden;
  background: #ffffff12;
  margin-top: 5px;
}
.home-exp i {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, #b995ff, #75f6dc);
}
.home-stage {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(220px, 340px) minmax(0, 1fr);
  gap: 24px;
  align-items: center;
  position: relative;
  z-index: 1;
}
.home-nav {
  grid-column: 2;
  height: min(100%, 340px);
  min-height: 0;
  display: grid;
  grid-template-rows: repeat(5, minmax(0, 1fr));
  gap: 11px;
  padding: 8px 5px;
}
.home-nav .home-action {
  min-height: 0;
  width: 100%;
  padding: 8px 22px;
  gap: 14px;
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr) 16px;
  font-size: 14px;
  text-align: left;
  color: #eafaf7;
  line-height: 1.3;
}
.home-nav .home-action > span {
  margin: 0;
}
.home-action-icon {
  color: #93f4e7;
  font-size: 20px;
  text-align: center;
}
.home-action-icon svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}
#screen-title #btn-start {
  position: relative;
}
#screen-title #btn-start::before {
  content: "";
  position: absolute;
  inset: 22% 6%;
  border-radius: 999px;
  background: linear-gradient(90deg, #27ddc52e, #9582ff1a);
  z-index: -1;
  pointer-events: none;
}
.home-action-arrow {
  color: #c7b2ff;
  font-size: 16px;
}
.home-nav #btn-start {
  color: #a0fff0;
  text-shadow: 0 0 12px #65f3d888;
}
.home-nav .home-action:hover {
  filter: brightness(1.25);
}
.home-nav .home-action:focus-visible {
  outline: 2px solid #b6fff2;
  outline-offset: 4px;
}
.home-character {
  grid-column: 3;
  height: 100%;
  min-height: 0;
  position: relative;
  max-height: 430px;
  align-self: end;
}
.home-character canvas {
  width: 100%;
  height: calc(100% - 20px);
  display: block;
}
.home-character-caption {
  display: block;
  text-align: center;
  color: #a5abcb;
  letter-spacing: 0.16em;
  font-size: 8px;
}
.home-vinyl {
  grid-column: 1;
  justify-self: center;
  align-self: center;
  width: min(22vw, 230px);
  aspect-ratio: 1;
  border-radius: 50%;
  border: 1px solid #79e8e331;
  display: flex;
  flex-direction: column;
  gap: 9px;
  align-items: center;
  justify-content: center;
  background:
    repeating-radial-gradient(circle, transparent 0 9px, #7eafff08 10px 11px),
    radial-gradient(circle, #43325c55, #08102488);
  box-shadow: 0 0 60px #71ddf00d;
  color: #9ed8d5;
  transform: rotate(-12deg);
}
.home-vinyl i {
  font-style: normal;
  font-size: clamp(36px, 6vw, 76px);
  color: #a1f9e6;
  text-shadow: 0 0 24px #75eddc55;
}
.home-vinyl span,
.home-vinyl small {
  font-size: 8px;
  letter-spacing: 0.15em;
}
.home-vinyl small {
  font-size: 6px;
  color: #91a8c2;
}
.home-session-hint {
  flex: none;
  font-size: 10px;
  color: #8c9bb7;
  text-align: center;
  margin: 12px 0 0;
  line-height: 1.6;
  z-index: 1;
}
.home-atmosphere {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: -1;
  background: linear-gradient(0deg, #6db5ff08 1px, transparent 1px) 0 0 / 100%
    50px;
  mask-image: linear-gradient(transparent 20%, #000);
}
.home-atmosphere i {
  position: absolute;
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: #95f7eb;
  box-shadow: 0 0 13px 3px #6feff188;
  top: 18%;
  left: 15%;
  animation: logo-sparkle 5s ease-in-out infinite;
}
.home-atmosphere i:nth-child(2) {
  left: 83%;
  top: 12%;
  animation-delay: -2s;
}
.home-atmosphere i:nth-child(3) {
  left: 7%;
  top: 80%;
  animation-delay: -3s;
}
.home-atmosphere i:nth-child(4) {
  left: 89%;
  top: 76%;
  background: #ff9ae7;
  animation-delay: -1s;
}
.home-atmosphere i:nth-child(5) {
  left: 31%;
  top: 87%;
  animation-delay: -4s;
}
.home-atmosphere i:nth-child(6) {
  left: 67%;
  top: 49%;
  animation-delay: -2.5s;
}
@keyframes logo-breathe {
  0%,
  100% {
    filter: drop-shadow(0 0 9px #7b9dff44);
  }
  50% {
    filter: drop-shadow(0 0 17px #9b8bff88);
  }
}
@keyframes logo-sparkle {
  0%,
  100% {
    opacity: 0.25;
    transform: scale(0.7);
  }
  50% {
    opacity: 1;
    transform: scale(1.15);
  }
}
.reduced-motion .home-logo,
.reduced-motion .logo-star,
.reduced-motion .home-atmosphere i {
  animation: none;
}
@media (prefers-reduced-motion: reduce) {
  .home-logo,
  .logo-star,
  .home-atmosphere i {
    animation: none;
  }
}
@media (max-width: 750px) {
  .home-top {
    grid-template-columns: minmax(0, 1fr) minmax(220px, 2.3fr) minmax(0, 1fr);
  }
  .home-player-hud {
    padding: 6px;
    gap: 5px;
    border-radius: 10px;
  }
  .home-level {
    width: 28px;
    height: 28px;
    font-size: 8px;
  }
  .home-player-copy strong {
    font-size: 9px;
  }
  .home-player-copy > span {
    font-size: 8px;
  }
  .home-stage {
    gap: 12px;
    grid-template-columns: minmax(0, 1fr) minmax(215px, 300px) minmax(0, 1fr);
  }
  .home-nav .home-action {
    font-size: 12px;
    gap: 7px;
    padding: 6px 17px;
  }
  .home-vinyl span,
  .home-vinyl small {
    display: none;
  }
  .home-character-caption {
    font-size: 6px;
    letter-spacing: 0.05em;
  }
  .home-session-hint {
    font-size: 8px;
  }
}
@media (max-height: 420px) {
  .home-top {
    flex-basis: 75px;
  }
  .home-nav {
    max-height: 260px;
    gap: 8px;
    padding: 3px 5px;
  }
  .home-session-hint {
    margin-top: 6px;
  }
}
@media (max-height: 310px) {
  #screen-title.home-screen {
    padding-top: 6px;
    padding-bottom: 5px;
  }
  .home-top {
    flex-basis: 52px;
  }
  .home-logo {
    max-height: 52px;
  }
  .home-logo img {
    height: 52px;
  }
  .home-nav {
    gap: 5px;
    padding: 2px 5px;
  }
  .home-nav .home-action {
    padding-top: 3px;
    padding-bottom: 3px;
    font-size: 10px;
  }
  .home-action-icon {
    font-size: 14px;
  }
  .home-session-hint {
    font-size: 7px;
    margin-top: 4px;
  }
  .home-player-hud {
    padding: 4px;
  }
  .home-exp {
    display: none;
  }
}
.leaderboard-controls {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 130px;
  gap: 12px;
  margin: 14px 0;
}
.leaderboard-tabs {
  display: flex;
  gap: 10px;
}
.leaderboard-list {
  display: grid;
  gap: 8px;
  margin-top: 14px;
}
.leaderboard-row {
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr) auto;
  align-items: center;
  padding: 12px;
  gap: 12px;
  background: #ffffff04;
  border: 1px solid #7d94b326;
  border-radius: 12px;
}
.leaderboard-row.is-you {
  background: #70ebd010;
  border-color: #70ebd070;
}
.leaderboard-row strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.leaderboard-row small {
  display: block;
  color: var(--muted);
}
.leaderboard-score {
  text-align: right;
  font-weight: 700;
  color: #a0f8e5;
}
.cloud-save-status {
  font-size: 11px;
  color: #9bdcce;
  line-height: 1.7;
  margin-top: 12px;
}
.cloud-save-status button {
  margin-top: 6px;
}
.guest-account-note {
  color: #9baec6;
  font-size: 11px;
  line-height: 1.8;
}

/* Recovery shares the search row so short phones retain their song-list height. */
#library-sync-retry {
  flex: none;
  min-width: 68px;
  min-height: 30px;
  height: 32px;
  padding: 0 8px;
  font-size: 10px;
}
#library-sync-retry[hidden] {
  display: none !important;
}

/* Keep catalog progress visible inside the existing scroll area on short phones. */
.library-sync-status {
  position: sticky;
  top: 0;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 12px 10px;
  border: 1px solid #83efda44;
  border-radius: 10px;
  background: #111e30;
  color: #b6ffed;
  font-size: 13px;
  font-weight: 600;
  line-height: 1.4;
  text-align: center;
}
.library-sync-status[hidden] {
  display: none;
}
.library-sync-status[data-phase="loading"]::before {
  content: "";
  flex: none;
  width: 14px;
  height: 14px;
  border: 2px solid #83efda33;
  border-top-color: #83efda;
  border-radius: 50%;
  animation: library-sync-spin 1s linear infinite;
}
@keyframes library-sync-spin {
  to {
    transform: rotate(360deg);
  }
}
@media (prefers-reduced-motion: reduce) {
  .library-sync-status::before {
    animation: none;
  }
}
