#startScreen.rr-start {
  width: var(--rr-panel-width);
  max-width: none;
  min-height: 100%;
  justify-content: flex-start;
  overflow-x: hidden;
  overflow-y: auto;
  padding: max(18px, env(safe-area-inset-top)) var(--rr-space-5)
    max(18px, env(safe-area-inset-bottom));
  color: var(--rr-text);
  background-color: var(--rr-bg);
  background-image:
    linear-gradient(180deg, rgba(8, 1, 13, .28) 0%, rgba(8, 1, 13, .62) 47%, rgba(8, 1, 13, .92) 100%),
    url("inicio-fondo-calle-reflejos.png");
  background-position: center top;
  background-repeat: no-repeat;
  background-size: cover;
  scrollbar-width: thin;
  scrollbar-color: var(--rr-magenta-dark) transparent;
  isolation: isolate;
}

#startScreen.rr-start::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background-image:
    radial-gradient(circle at 11% 12%, rgba(255, 117, 184, .9) 0 1px, transparent 2px),
    radial-gradient(circle at 87% 9%, rgba(255, 233, 0, .72) 0 1px, transparent 2px),
    radial-gradient(circle at 77% 28%, rgba(255, 35, 140, .78) 0 1px, transparent 2px),
    radial-gradient(circle at 18% 34%, rgba(255, 117, 184, .72) 0 1px, transparent 2px),
    radial-gradient(circle at 61% 17%, rgba(255, 255, 255, .62) 0 1px, transparent 2px);
  background-size: 183px 211px, 227px 173px, 263px 239px, 211px 269px, 307px 197px;
  opacity: .46;
}

#startScreen.rr-start::after {
  content: "";
  position: absolute;
  z-index: 0;
  top: 48px;
  left: 50%;
  width: 290px;
  height: 350px;
  transform: translateX(-50%);
  border-radius: 50%;
  pointer-events: none;
  background:
    conic-gradient(from 205deg at 50% 48%, transparent 0 10%, rgba(255, 35, 140, .075) 12%, transparent 15% 30%, rgba(255, 117, 184, .055) 33%, transparent 36% 100%);
  filter: blur(7px);
  mix-blend-mode: screen;
}

/* La portada es una pantalla propia: el mundo 3D no puede transparentarse
   ni asomarse por sus bordes mientras el juego todavía no ha comenzado. */
body.rr-start-active #game,
body.rr-start-active #hud,
body.rr-start-active #crt {
  visibility: hidden;
}

.rr-start__shell {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 390px;
  margin: 0 auto;
}

.rr-start__hud {
  min-height: 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--rr-space-3);
}

.rr-start__brand {
  margin: 0;
  color: var(--rr-magenta);
  font-size: 22px;
  font-weight: 900;
  letter-spacing: -1.5px;
  line-height: 1;
  text-shadow: var(--rr-glow);
}

.rr-start__status {
  min-height: 28px;
  display: flex;
  align-items: center;
  gap: 7px;
  margin: 0;
  padding: 5px 11px;
  border: 1px solid var(--rr-magenta);
  border-radius: 999px;
  background: rgba(25, 3, 31, .72);
  box-shadow: 0 0 12px rgba(255, 35, 140, .18);
  color: var(--rr-text);
  font-size: 12px;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.rr-start__status img {
  width: 14px;
  height: 14px;
  object-fit: contain;
  image-rendering: pixelated;
}

.rr-start__status-separator { color: var(--rr-text-muted); opacity: .7; }

.rr-start__hero {
  position: relative;
  width: 207px;
  height: 207px;
  display: grid;
  place-items: center;
  margin: 12px auto 11px;
  border: 2px solid var(--rr-magenta);
  border-radius: 50%;
  background:
    radial-gradient(circle at 50% 46%, rgba(216, 11, 105, .11) 0 51%, rgba(8, 1, 13, .76) 72%);
  box-shadow:
    0 0 7px rgba(255, 117, 184, .9),
    0 0 21px rgba(255, 35, 140, .75),
    inset 0 0 18px rgba(255, 35, 140, .18);
  transform-origin: 50% 58%;
}

.rr-start__hero::before {
  content: "";
  position: absolute;
  inset: -10px;
  border: 1px dashed rgba(255, 117, 184, .52);
  border-radius: 50%;
  box-shadow: 0 0 11px rgba(255, 35, 140, .24);
  pointer-events: none;
}

.rr-start__hero::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: -20px;
  width: 82px;
  height: 44px;
  transform: translateX(-50%);
  background: radial-gradient(ellipse, rgba(255, 35, 140, .45), transparent 68%);
  filter: blur(4px);
  pointer-events: none;
}

.rr-start__hero img {
  width: 181px;
  height: 201px;
  display: block;
  object-fit: contain;
  image-rendering: pixelated;
  filter: drop-shadow(0 0 4px rgba(255, 35, 140, .55));
  transform-origin: 50% 72%;
}

.rr-start__headline {
  margin: 0;
  color: var(--rr-text);
  font-size: 24px;
  font-weight: 900;
  line-height: 1.1;
  letter-spacing: 1.5px;
  text-align: center;
  text-shadow: 0 0 7px rgba(255, 117, 184, .7);
}

.rr-start__subtitle {
  margin: 4px 0 8px;
  color: var(--rr-text-muted);
  font-size: 12px;
  line-height: 1.35;
  text-align: center;
}

.rr-start__identity {
  width: min(100%, 286px);
  margin: 0 auto 9px;
  text-align: left;
}

.rr-start__identity-label {
  display: block;
  margin: 0 0 4px 5px;
  color: var(--rr-pink);
  font-size: 10px;
  font-weight: 700;
  line-height: 1;
  letter-spacing: 1.8px;
  text-shadow: 0 0 7px rgba(255, 35, 140, .55);
}

.rr-start__identity-field {
  min-height: var(--rr-touch-min);
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 13px;
  border: 1px solid rgba(255, 117, 184, .78);
  border-radius: var(--rr-radius-sm);
  background:
    linear-gradient(180deg, rgba(35, 4, 43, .93), rgba(15, 1, 22, .93));
  box-shadow:
    inset 0 0 13px rgba(255, 35, 140, .09),
    0 0 12px rgba(255, 35, 140, .16);
  transition: border-color 150ms ease, box-shadow 150ms ease, transform 100ms ease;
}

.rr-start__identity-field > span {
  flex: 0 0 auto;
  color: var(--rr-yellow);
  font-size: 16px;
  font-weight: 900;
  line-height: 1;
  text-shadow: 0 0 8px rgba(255, 233, 0, .48);
}

#startScreen #nameInput {
  min-width: 0;
  width: 100%;
  height: var(--rr-touch-min);
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  outline: 0;
  background: transparent;
  color: var(--rr-text);
  font: 700 13px/1 "Courier New", monospace;
  letter-spacing: 1px;
  text-align: left;
  text-transform: uppercase;
  caret-color: var(--rr-yellow);
  -webkit-user-select: text;
  user-select: text;
  touch-action: manipulation;
}

#startScreen #nameInput::placeholder {
  color: rgba(229, 184, 203, .58);
  opacity: 1;
}

.rr-start__identity-field:focus-within {
  border-color: var(--rr-yellow);
  box-shadow:
    inset 0 0 14px rgba(255, 35, 140, .16),
    0 0 0 2px rgba(255, 233, 0, .22),
    0 0 18px rgba(255, 35, 140, .34);
}

.rr-start__identity-help {
  margin: 4px 4px 0;
  color: var(--rr-text-muted);
  font-size: 9px;
  line-height: 1.25;
  text-align: center;
  opacity: .78;
}

.rr-start__cta {
  position: relative;
  min-width: 235px;
  min-height: 52px;
  display: block;
  margin: 0 auto;
  padding: 12px 28px;
  border: 2px solid var(--rr-pink);
  border-radius: var(--rr-radius-md);
  background: linear-gradient(180deg, var(--rr-magenta) 0%, var(--rr-magenta-dark) 100%);
  box-shadow: var(--rr-glow), inset 0 0 10px rgba(255, 255, 255, .25);
  color: #170018;
  font: 900 16px/1 "Courier New", monospace;
  letter-spacing: 1.5px;
  cursor: pointer;
  overflow: hidden;
  transition: transform 100ms ease, filter 140ms ease, box-shadow 140ms ease;
}

.rr-start__cta::after {
  content: "";
  position: absolute;
  inset: -80% auto -80% -28%;
  width: 16%;
  transform: rotate(18deg);
  background: rgba(255, 255, 255, .38);
  filter: blur(2px);
  pointer-events: none;
}

.rr-start__cta:hover,
.rr-start__cta:focus-visible {
  filter: brightness(1.12) saturate(1.06);
  box-shadow: 0 0 24px rgba(255, 35, 140, .8), inset 0 0 12px rgba(255, 255, 255, .35);
  outline: 3px solid var(--rr-yellow);
  outline-offset: 3px;
}

.rr-start__cta:active { transform: scale(.98); }
body.rr-start-active .rr-start__cta:active { animation: none; }
.rr-start__cta:disabled {
  cursor: not-allowed;
  opacity: .46;
  filter: grayscale(.35);
  box-shadow: none;
}

.rr-start__controls {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--rr-space-2);
  margin-top: 15px;
}

.rr-control {
  min-width: 0;
  min-height: 92px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  padding: 9px 6px 7px;
  border: 1px solid var(--rr-magenta);
  border-radius: var(--rr-radius-sm);
  background: rgba(25, 3, 31, .72);
  box-shadow: inset 0 0 12px rgba(255, 35, 140, .05);
  transform-origin: 50% 100%;
}

.rr-control__icon {
  min-width: var(--rr-touch-min);
  min-height: 30px;
  display: grid;
  place-items: center;
  color: var(--rr-yellow);
  font-size: 20px;
  font-weight: 900;
  line-height: 1;
}

.rr-control h3 {
  margin: 0 0 4px;
  color: var(--rr-pink);
  font-size: 12px;
  line-height: 1;
}

.rr-control p {
  margin: 0;
  color: var(--rr-text-muted);
  font-size: 12px;
  line-height: 1.25;
  text-align: center;
}

.rr-start__challenge {
  margin-top: var(--rr-space-3);
  padding: 11px 12px 12px;
  border: 1px solid var(--rr-magenta);
  border-radius: var(--rr-radius-sm);
  background: rgba(25, 3, 31, .72);
  box-shadow: inset 0 0 18px rgba(255, 35, 140, .06);
}

.rr-section-label {
  margin: 0 0 7px;
  color: var(--rr-pink);
  font-size: 12px;
  font-weight: 400;
  letter-spacing: 2px;
}

.rr-start__challenge-copy {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--rr-space-2);
}

.rr-start__challenge-copy strong {
  color: var(--rr-text);
  font-size: 16px;
  line-height: 1;
}

.rr-start__challenge-copy output {
  color: var(--rr-yellow);
  font-size: 12px;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.rr-progress {
  height: 7px;
  margin-top: 10px;
  overflow: hidden;
  border: 1px solid var(--rr-magenta);
  background: #050008;
}

.rr-progress__bar {
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, var(--rr-magenta) 0%, var(--rr-magenta) 72%, var(--rr-yellow) 100%);
  transition: width 280ms ease;
}

.rr-start__ranking {
  margin-top: 11px;
  padding-top: 9px;
  border-top: 1px solid var(--rr-magenta-dark);
}

.rr-start__ranking-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--rr-space-3);
}

.rr-start__personal-best {
  margin: 0 0 7px;
  color: var(--rr-pink);
  font-size: 12px;
  letter-spacing: 1.5px;
  white-space: nowrap;
}

.rr-start__personal-best strong {
  color: var(--rr-text);
  font-variant-numeric: tabular-nums;
}

.rr-start .records {
  width: 100%;
  margin: 0;
  font-size: 12px;
}

.rr-start .rec {
  min-height: 23px;
  align-items: center;
  padding: 3px 0;
  border-bottom: 1px dashed rgba(255, 35, 140, .38);
  font-variant-numeric: tabular-nums;
}

.rr-start .rec > b:first-child { color: var(--rr-magenta); }
.rr-start .rec > b:last-child { color: var(--rr-pink); }

.rr-start__footer {
  margin: 108px 0 0;
  color: var(--rr-pink);
  font-size: 12px;
  line-height: 1.4;
  letter-spacing: 1px;
  text-align: center;
}

.rr-visually-hidden {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

@keyframes rr-ring-pulse {
  0%, 100% { transform: translateY(0) scale(1) rotate(-.2deg); filter: brightness(.96); }
  50% { transform: translateY(-4px) scale(1.016) rotate(.4deg); filter: brightness(1.09); }
}

@keyframes rr-cta-intro {
  0% { opacity: 0; transform: translateY(12px) scale(.94); filter: brightness(.82); box-shadow: 0 0 6px rgba(255, 35, 140, .28); }
  72% { transform: translateY(-2px) scale(1.015); }
  100% { opacity: 1; transform: none; filter: brightness(1); box-shadow: var(--rr-glow), inset 0 0 10px rgba(255, 255, 255, .25); }
}

/* Coreografía de entrada: la portada se arma por profundidad como el final. */
body.rr-start-active #startScreen.rr-start {
  animation: rr-start-screen-in .42s ease-out both, rr-start-bg-breathe 10s .5s ease-in-out infinite alternate;
}

body.rr-start-active #startScreen.rr-start::before {
  animation: rr-start-stars-drift 8s linear infinite, rr-start-stars-twinkle 2.2s ease-in-out infinite alternate;
}

body.rr-start-active #startScreen.rr-start::after {
  animation: rr-start-rays-turn 16s linear infinite;
}

body.rr-start-active .rr-start__brand {
  animation: rr-start-logo-in .58s cubic-bezier(.2, .8, .2, 1) both, rr-start-logo-float 4.2s 1.1s ease-in-out infinite;
}

body.rr-start-active .rr-start__status {
  animation: rr-start-pill-in .54s .08s cubic-bezier(.2, .8, .2, 1) both, rr-start-pill-float 4.8s 1.2s ease-in-out infinite;
}

body.rr-start-active .rr-start__hero {
  animation: rr-start-hero-in .8s .14s cubic-bezier(.16, .9, .28, 1.18) both, rr-ring-pulse 3s 1.15s ease-in-out infinite;
}

body.rr-start-active .rr-start__hero::before {
  animation: rr-start-orbit-in .8s .26s ease-out both, rr-start-orbit-turn 13s 1.15s linear infinite;
}

body.rr-start-active .rr-start__hero img {
  animation: rr-start-cat-in .72s .25s cubic-bezier(.18, .9, .24, 1.12) both, rr-start-cat-float 3.1s 1.2s ease-in-out infinite;
}

body.rr-start-active .rr-start__headline {
  animation: rr-start-title-in .62s .48s ease-out both;
}

body.rr-start-active .rr-start__subtitle {
  animation: rr-start-fade-up .42s .64s ease-out both;
}

body.rr-start-active .rr-start__identity {
  animation: rr-start-fade-up .46s .72s ease-out both;
}

body.rr-start-active .rr-start__identity-field {
  animation: rr-start-identity-glow 3.6s 1.35s ease-in-out infinite alternate;
}

body.rr-start-active .rr-start__cta {
  animation: rr-cta-intro .55s .86s cubic-bezier(.2, .8, .2, 1) both;
}

body.rr-start-active .rr-start__cta::after {
  animation: rr-start-button-shine 2.8s 1.45s ease-in-out infinite;
}

body.rr-start-active .rr-control:nth-child(1) {
  animation: rr-start-card-in .46s .9s cubic-bezier(.2, .8, .2, 1) both, rr-start-card-float 4.1s 1.6s ease-in-out infinite;
}

body.rr-start-active .rr-control:nth-child(2) {
  animation: rr-start-card-in .46s 1s cubic-bezier(.2, .8, .2, 1) both, rr-start-card-float 4.5s 1.85s ease-in-out infinite reverse;
}

body.rr-start-active .rr-control:nth-child(3) {
  animation: rr-start-card-in .46s 1.1s cubic-bezier(.2, .8, .2, 1) both, rr-start-card-float 4.3s 2.05s ease-in-out infinite;
}

body.rr-start-active .rr-start__challenge {
  animation: rr-start-panel-in .48s 1.18s cubic-bezier(.2, .8, .2, 1) both, rr-start-panel-glow 3.8s 1.9s ease-in-out infinite alternate;
}

body.rr-start-active .rr-start__ranking {
  animation: rr-start-fade-up .45s 1.35s ease-out both;
}

body.rr-start-active .rr-start .rec:nth-child(1) { animation: rr-start-row-in .34s 1.48s ease-out both; }
body.rr-start-active .rr-start .rec:nth-child(2) { animation: rr-start-row-in .34s 1.56s ease-out both; }
body.rr-start-active .rr-start .rec:nth-child(3) { animation: rr-start-row-in .34s 1.64s ease-out both; }
body.rr-start-active .rr-start__footer { animation: rr-start-fade-up .6s 1.72s ease-out both; }

@keyframes rr-start-screen-in {
  from { opacity: 0; filter: saturate(.72) brightness(.72); }
  to { opacity: 1; filter: none; }
}

@keyframes rr-start-bg-breathe {
  from { background-position: center top; }
  to { background-position: center -8px; }
}

@keyframes rr-start-stars-drift {
  to { background-position: 10px 14px, -9px 18px, 8px -11px, -12px 9px, 7px 16px; }
}

@keyframes rr-start-stars-twinkle {
  from { opacity: .28; filter: brightness(.82); }
  to { opacity: .62; filter: brightness(1.18); }
}

@keyframes rr-start-rays-turn {
  from { transform: translateX(-50%) rotate(-8deg) scale(.96); opacity: .55; }
  50% { opacity: .95; }
  to { transform: translateX(-50%) rotate(8deg) scale(1.04); opacity: .55; }
}

@keyframes rr-start-logo-in {
  from { opacity: 0; transform: translate(-10px, -8px) skewX(-8deg); }
  70% { transform: translate(2px, 1px) skewX(2deg); }
  to { opacity: 1; transform: none; }
}

@keyframes rr-start-logo-float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-2px); }
}

@keyframes rr-start-pill-in {
  from { opacity: 0; transform: translate(12px, -5px) scale(.9); }
  to { opacity: 1; transform: none; }
}

@keyframes rr-start-pill-float {
  0%, 100% { transform: translateY(0); box-shadow: 0 0 12px rgba(255, 35, 140, .18); }
  50% { transform: translateY(2px); box-shadow: 0 0 18px rgba(255, 35, 140, .32); }
}

@keyframes rr-start-hero-in {
  from { opacity: 0; transform: translateY(18px) scale(.72) rotate(-6deg); }
  68% { transform: translateY(-3px) scale(1.045) rotate(1.5deg); }
  to { opacity: 1; transform: none; }
}

@keyframes rr-start-orbit-in {
  from { opacity: 0; transform: rotate(-65deg) scale(.6); }
  to { opacity: 1; transform: none; }
}

@keyframes rr-start-orbit-turn { to { transform: rotate(360deg); } }

@keyframes rr-start-cat-in {
  from { opacity: 0; transform: translateY(15px) scale(.76) rotate(-5deg); }
  70% { transform: translateY(-3px) scale(1.035) rotate(1.2deg); }
  to { opacity: 1; transform: none; }
}

@keyframes rr-start-cat-float {
  0%, 100% { transform: translateY(1px) rotate(-.5deg); }
  50% { transform: translateY(-5px) rotate(.7deg); }
}

@keyframes rr-start-title-in {
  0% { opacity: 0; transform: scale(.93); text-shadow: none; }
  35% { opacity: 1; }
  45% { opacity: .56; }
  56%, 100% { opacity: 1; transform: none; }
}

@keyframes rr-start-fade-up {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: none; }
}

@keyframes rr-start-identity-glow {
  from {
    box-shadow: inset 0 0 13px rgba(255, 35, 140, .07), 0 0 9px rgba(255, 35, 140, .12);
  }
  to {
    box-shadow: inset 0 0 17px rgba(255, 35, 140, .14), 0 0 17px rgba(255, 35, 140, .24);
  }
}

@keyframes rr-start-button-shine {
  0%, 40% { left: -28%; opacity: 0; }
  50% { opacity: .9; }
  64%, 100% { left: 116%; opacity: 0; }
}

@keyframes rr-start-card-in {
  from { opacity: 0; transform: translateY(12px) scale(.92); }
  72% { transform: translateY(-2px) scale(1.02); }
  to { opacity: 1; transform: none; }
}

@keyframes rr-start-card-float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-2px); }
}

@keyframes rr-start-panel-in {
  from { opacity: 0; transform: translateY(12px) scale(.98); }
  to { opacity: 1; transform: none; }
}

@keyframes rr-start-panel-glow {
  from { box-shadow: inset 0 0 18px rgba(255, 35, 140, .06), 0 0 0 rgba(255, 35, 140, 0); }
  to { box-shadow: inset 0 0 24px rgba(255, 35, 140, .13), 0 0 12px rgba(255, 35, 140, .14); }
}

@keyframes rr-start-row-in {
  from { opacity: 0; transform: translateX(-8px); }
  to { opacity: 1; transform: none; }
}

@media (max-width: 349px) {
  #startScreen.rr-start { padding-inline: 12px; }
  .rr-start__controls { gap: 6px; }
  .rr-control { padding-inline: 4px; }
  .rr-start__status,
  .rr-control h3,
  .rr-control p,
  .rr-section-label,
  .rr-start__challenge-copy output,
  .rr-start__personal-best,
  .rr-start .records,
  .rr-start__footer { font-size: 12px; }
  .rr-control { min-height: 126px; }
  .rr-start__footer { line-height: 1.55; }
}

@media (prefers-reduced-motion: reduce) {
  #startScreen.rr-start,
  #startScreen.rr-start::before,
  #startScreen.rr-start::after,
  #startScreen.rr-start *,
  #startScreen.rr-start *::before,
  #startScreen.rr-start *::after {
    animation: none !important;
    scroll-behavior: auto !important;
    transition-duration: .01ms !important;
  }
}

@media (max-height: 700px) {
  #startScreen.rr-start { padding-top: max(10px, env(safe-area-inset-top)); }
  .rr-start__hero { width: 148px; height: 148px; margin: 4px auto 5px; }
  .rr-start__hero img { width: 132px; height: 145px; }
  .rr-start__headline { font-size: 20px; }
  .rr-start__subtitle { margin-bottom: 7px; }
  .rr-start__controls { margin-top: 12px; }
  .rr-start__footer { margin-top: 58px; }
}
