/* NEEDLE RUN Styles */

*,
*::before,
*::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box
}

html,
body {
  width: 100%;
  height: 100%;
  height: 100dvh; /* Dynamic viewport height for mobile */
  background: #000;
  overflow: hidden;
  user-select: none;
  -webkit-user-select: none;
  /* Safe areas for notched phones */
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left)
}

canvas {
  position: fixed;
  top: 0;
  left: 0;
  touch-action: none
}

#ui {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  font-family: 'Orbitron', 'Courier New', monospace;
  pointer-events: none;
  z-index: 2
}

#hud-score {
  position: absolute;
  top: 20px;
  left: 50%;
  transform: translateX(-50%);
  text-align: center;
  pointer-events: none
}

#score-num {
  font-size: clamp(28px, 5vw, 46px);
  font-weight: 900;
  color: #fff;
  text-shadow: 0 0 20px #00cfff;
  letter-spacing: 5px
}

#mult-num {
  font-size: 12px;
  color: #00cfff;
  letter-spacing: 5px;
  margin-top: 4px
}


#bomb-ind {
  font-size: 10px;
  color: #ff6a00;
  letter-spacing: 4px;
  margin-top: 8px
}

#bomb-ind.used {
  color: #333
}

#controls-hint {
  position: absolute;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 12px;
  color: rgba(150, 180, 200, 0.7);
  letter-spacing: 1px;
  text-align: center;
  pointer-events: none
}

#controls-hint b {
  color: rgba(0, 207, 255, 0.9);
}

#best-block {
  position: absolute;
  top: 20px;
  left: 18px;
  text-align: left;
  pointer-events: none
}

#best-label {
  font-size: 8px;
  color: #0a8a8a;
  letter-spacing: 3px
}

#best-val {
  font-size: 18px;
  font-weight: 700;
  color: #00cfff;
  letter-spacing: 3px;
  margin-top: 3px
}

#target-block {
  position: absolute;
  top: 20px;
  right: 18px;
  text-align: right;
  pointer-events: none
}

#target-label {
  font-size: 8px;
  color: #b35900;
  letter-spacing: 3px
}

#target-name {
  font-size: 10px;
  color: #ff6a00;
  letter-spacing: 2px;
  margin: 3px 0 2px
}

#target-val {
  font-size: 18px;
  font-weight: 700;
  color: #ff6a00;
  letter-spacing: 3px
}

.screen {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  pointer-events: all
}

.hidden {
  display: none !important
}

/* Mobile notice */
#mobile-notice {
  justify-content: center;
  align-items: center;
  background: rgba(0, 0, 5, 0.95);
  z-index: 100
}

.mobile-notice-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 40px;
  max-width: 90%
}

.mobile-notice-icon {
  font-size: 64px;
  margin-bottom: 24px
}

.mobile-notice-title {
  font-size: clamp(24px, 6vw, 36px);
  font-weight: 900;
  color: #00cfff;
  letter-spacing: 4px;
  margin-bottom: 16px;
  text-shadow: 0 0 20px #00cfff
}

.mobile-notice-text {
  font-size: clamp(12px, 3.5vw, 16px);
  color: #8af;
  line-height: 1.8;
  margin-bottom: 32px;
  letter-spacing: 1px
}

#btn-mobile-continue {
  margin-bottom: 24px
}

.mobile-notice-hint {
  font-size: clamp(9px, 2.5vw, 11px);
  color: #456;
  letter-spacing: 2px
}

/* Title */
#title {
  flex-direction: row;
  justify-content: space-between;
  align-items: flex-end;
  padding: clamp(24px, 4vw, 52px) clamp(24px, 5vw, 60px);
  background: transparent;
  pointer-events: all
}

.title-left {
  display: flex;
  flex-direction: column
}

.title-lb {
  width: 520px;
  max-height: 70vh;
  overflow-y: auto;
  padding: 18px 20px;
  margin-bottom: 70px;
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid rgba(0, 207, 255, 0.15);
  border-radius: 4px
}

.title-lb::-webkit-scrollbar {
  width: 3px
}

.title-lb::-webkit-scrollbar-thumb {
  background: #00cfff30
}

.title-lb-head {
  font-size: 14px;
  color: #00cfff;
  letter-spacing: 4px;
  margin-bottom: 14px;
  text-align: center
}

.title-lb-row {
  display: grid;
  grid-template-columns: 28px 1fr 1fr 90px;
  gap: 10px;
  padding: 8px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  font-size: 13px;
  align-items: center
}

.title-lb-rank {
  color: #666;
  font-weight: 600
}

.title-lb-rank.g {
  color: #ffd700
}

.title-lb-rank.s {
  color: #c0c0c0
}

.title-lb-rank.b {
  color: #cd7f32
}

.title-lb-name {
  color: #ccc;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis
}

.title-lb-handle {
  color: #6aa;
  font-size: 12px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis
}

.title-lb-saas {
  color: #8cf;
  font-size: 12px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis
}

.title-lb-handle a,
.title-lb-saas a {
  color: inherit;
  text-decoration: none;
  transition: color 0.15s;
  pointer-events: all;
  cursor: pointer;
  display: block;
  width: 100%;
  height: 100%
}

.title-lb-handle a:hover {
  color: #9dd
}

.title-lb-saas a:hover {
  color: #adf
}

.title-lb-score {
  color: #fff;
  text-align: right;
  font-weight: 700
}

.t-eyebrow {
  font-size: clamp(7px, 1.1vw, 10px);
  color: #4a7070;
  letter-spacing: 10px;
  margin-bottom: 10px
}

.t-needle {
  font-size: clamp(58px, 12vw, 140px);
  font-weight: 900;
  color: #dff8ff;
  text-shadow: 0 0 28px rgba(0, 207, 255, .7), 0 0 80px rgba(0, 207, 255, .2);
  letter-spacing: -3px;
  line-height: .88
}

.t-run {
  font-size: clamp(72px, 15vw, 175px);
  font-weight: 900;
  color: #ff6a00;
  text-shadow: 0 0 28px rgba(255, 106, 0, .85), 0 0 80px rgba(255, 106, 0, .3);
  letter-spacing: -5px;
  line-height: .88;
  margin-left: clamp(4px, 1vw, 14px)
}

.t-tag {
  font-size: clamp(12px, 1.8vw, 16px);
  color: #7ab0b0;
  letter-spacing: 6px;
  margin-top: clamp(14px, 2vw, 22px);
  margin-left: 4px
}

.t-hint {
  font-size: clamp(13px, 1.8vw, 17px);
  color: #90c8c8;
  letter-spacing: 5px;
  margin-top: clamp(22px, 3.5vw, 38px);
  margin-left: 4px;
  animation: blink 1.6s ease-in-out infinite
}

.t-ctrls {
  font-size: clamp(9px, 1.2vw, 11px);
  color: #6a9898;
  letter-spacing: 2px;
  margin-top: 14px;
  margin-left: 4px;
  line-height: 2
}

.t-ctrls b {
  color: #90c8c8
}

/* Dead */
#dead {
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 4, .84)
}

#dead .dead-label {
  font-size: 14px;
  color: #ff4466;
  letter-spacing: 6px;
  margin-bottom: 10px;
  text-shadow: 0 0 20px rgba(255, 68, 102, 0.5)
}

#dead .dead-score {
  font-size: clamp(40px, 8vw, 80px);
  font-weight: 900;
  color: #fff;
  text-shadow: 0 0 30px #fff4;
  letter-spacing: 6px;
  line-height: 1
}

#dead .dead-best {
  font-size: 11px;
  color: #1a3a3a;
  letter-spacing: 4px;
  margin-top: 8px;
  margin-bottom: 48px
}

#dead .dead-best b {
  color: #336644
}

#dead .runa {
  font-size: 11px;
  color: #00cfff;
  letter-spacing: 6px;
  animation: blink 1s ease-in-out infinite;
  margin-bottom: 18px
}

#dead .sub-link {
  font-size: 9px;
  color: #222;
  letter-spacing: 3px;
  cursor: pointer;
  pointer-events: all;
  text-decoration: underline;
  border: none;
  background: transparent;
  font-family: inherit
}

#dead .sub-link:hover {
  color: #444
}

/* Submit */
#submit-screen {
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 4, .93)
}

#submit-screen .form-title {
  font-size: 11px;
  color: #00cfff;
  letter-spacing: 6px;
  margin-bottom: 24px
}

.eform {
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: min(440px, 90vw);
  margin-bottom: 22px
}

.eform input {
  background: rgba(0, 207, 255, .06);
  border: 1px solid rgba(0, 207, 255, .25);
  border-bottom-color: rgba(0, 207, 255, .5);
  color: #fff;
  outline: none;
  font-family: 'Orbitron', monospace;
  font-size: 13px;
  padding: 16px 18px;
  letter-spacing: 2px;
  transition: all .2s
}

.eform input:focus {
  border-color: #00cfff;
  background: rgba(0, 207, 255, .12)
}

.eform input::placeholder {
  color: #4a6a6a
}

.eform input:disabled {
  opacity: 0.35;
  cursor: not-allowed;
  border-color: rgba(100, 100, 100, .2);
  background: rgba(50, 50, 50, .1)
}

.eform input:disabled::placeholder {
  color: #333
}

.eform .sub-hint {
  font-size: 8px;
  color: #1a1a1a;
  letter-spacing: 2px;
  text-align: center;
  margin-top: 2px
}

.btn-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: center
}

.btn {
  background: transparent;
  border: 1px solid rgba(0, 207, 255, .35);
  color: #00cfff;
  cursor: pointer;
  pointer-events: all;
  font-family: 'Orbitron', monospace;
  font-size: 9px;
  padding: 12px 22px;
  letter-spacing: 3px;
  transition: all .2s
}

.btn:hover {
  background: rgba(0, 207, 255, .12);
  border-color: #00cfff
}

.btn.red {
  border-color: rgba(255, 34, 68, .35);
  color: #ff4466
}

.btn.red:hover {
  background: rgba(255, 34, 68, .12);
  border-color: #ff4466
}

/* Leaderboard */
#lb-screen {
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(0, 0, 2, .97)
}

#lb-screen h2 {
  font-size: clamp(20px, 4vw, 32px);
  font-weight: 900;
  color: #00cfff;
  text-shadow: 0 0 20px #00cfff;
  letter-spacing: 8px;
  margin-bottom: 20px
}

.lb-your-rank {
  font-size: 12px;
  color: #00cfff;
  letter-spacing: 3px;
  margin-bottom: 16px;
  padding: 12px 20px;
  background: rgba(0, 207, 255, 0.08);
  border: 1px solid rgba(0, 207, 255, 0.2);
  border-radius: 4px;
  text-align: center
}

.lb-your-rank span {
  color: #fff;
  font-weight: 700
}

.lb-wrap {
  width: min(800px, 96vw);
  max-height: 55vh;
  overflow-y: auto
}

.lb-wrap::-webkit-scrollbar {
  width: 2px
}

.lb-wrap::-webkit-scrollbar-thumb {
  background: #00cfff20
}

.lb-head,
.lb-row {
  display: grid;
  grid-template-columns: 44px 1fr 1fr 100px;
  gap: 10px;
  padding: 10px 14px;
  align-items: center;
  font-size: 11px
}

.lb-head {
  color: #151515;
  letter-spacing: 2px;
  font-size: 8px;
  border-bottom: 1px solid #0a0a0a
}

.lb-row {
  border-bottom: 1px solid rgba(255, 255, 255, .025)
}

.lb-row.me {
  background: rgba(0, 207, 255, .05)
}

.lb-rank {
  font-size: 11px;
  color: #222
}

.lb-rank.g {
  color: #ffd700;
  font-weight: 700
}

.lb-rank.s {
  color: #b0b0b0;
  font-weight: 700
}

.lb-rank.b {
  color: #b07040;
  font-weight: 700
}

.lb-handle {
  color: #6aa;
  font-size: 11px
}

.lb-handle a {
  color: #1da1f2;
  text-decoration: none;
  pointer-events: all;
  cursor: pointer;
  display: block;
  width: 100%;
  height: 100%
}

.lb-handle a:hover {
  text-decoration: underline
}

.lb-prod a {
  color: #ff6a00;
  font-size: 9px;
  text-decoration: none;
  pointer-events: all;
  cursor: pointer;
  display: block;
  width: 100%;
  height: 100%
}

.lb-prod a:hover {
  text-decoration: underline
}

.lb-sc {
  color: #fff;
  font-weight: 700;
  text-align: right;
  font-size: 12px
}

@keyframes blink {
  0%,
  100% {
    opacity: 1
  }

  50% {
    opacity: .15
  }
}

/* Profile link on title leaderboard */
.title-lb-profile {
  text-align: center;
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid rgba(0, 207, 255, 0.1)
}

.title-lb-profile a {
  display: block;
  color: #4a7a7a;
  font-size: 10px;
  letter-spacing: 3px;
  text-decoration: none;
  cursor: pointer;
  pointer-events: all;
  padding: 12px 20px;
  border: 1px solid rgba(0, 207, 255, 0.15);
  border-radius: 4px;
  transition: all 0.2s
}

.title-lb-profile a:hover {
  color: #00cfff;
  border-color: rgba(0, 207, 255, 0.4);
  background: rgba(0, 207, 255, 0.05)
}

/* Profile & Details Prompt screens */
#profile-screen,
#details-prompt {
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 4, .93)
}

.profile-subtitle {
  font-size: 12px;
  color: #7ab0b0;
  letter-spacing: 3px;
  margin-bottom: 24px;
  text-align: center
}

.prompt-score {
  font-size: 14px;
  color: #fff;
  letter-spacing: 4px;
  margin-bottom: 10px;
  text-shadow: 0 0 15px rgba(255, 255, 255, 0.3)
}

.prompt-score span {
  color: #00cfff;
  font-weight: 700
}

.btn-alt {
  border-color: rgba(100, 100, 100, 0.35);
  color: #666
}

.btn-alt:hover {
  background: rgba(100, 100, 100, 0.12);
  border-color: #888;
  color: #aaa
}

.dont-ask {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 20px;
  font-size: 8px;
  color: #333;
  letter-spacing: 2px;
  cursor: pointer;
  pointer-events: all
}

.dont-ask input[type="checkbox"] {
  width: 12px;
  height: 12px;
  accent-color: #00cfff;
  cursor: pointer
}

.dont-ask:hover {
  color: #555
}

/* Mute toggle button */
#mute-toggle {
  position: fixed;
  bottom: 80px;
  right: 20px;
  width: 44px;
  height: 44px;
  background: rgba(0, 0, 0, 0.6);
  border: 1px solid #00cfff;
  border-radius: 50%;
  color: #00cfff;
  font-size: 20px;
  cursor: pointer;
  z-index: 10;
  transition: all 0.2s ease;
  font-family: sans-serif
}

#mute-toggle:hover {
  background: rgba(0, 207, 255, 0.15);
  transform: scale(1.1)
}

#mute-toggle.muted {
  color: #666;
  border-color: #444
}

#mute-toggle.muted:hover {
  background: rgba(100, 100, 100, 0.15)
}

/* Mobile Responsive */
@media (max-width: 1024px) {
  /* Title screen - stack vertically */
  #title {
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    padding: 20px;
    gap: 20px;
    overflow-y: auto
  }

  .title-left {
    align-items: center;
    text-align: center
  }

  .t-needle,
  .t-run {
    font-size: clamp(36px, 12vw, 80px)
  }

  .t-tag,
  .t-hint,
  .t-ctrls {
    font-size: 10px;
    letter-spacing: 2px;
    margin-left: 0
  }

  .t-ctrls {
    display: none
  }

  .title-lb {
    width: 100%;
    max-width: 400px;
    margin-bottom: 80px;
    max-height: 40vh
  }

  .title-lb-row {
    grid-template-columns: 24px 1fr 70px;
    font-size: 11px;
    gap: 6px
  }

  .title-lb-saas {
    display: none
  }

  /* HUD */
  #hud-score {
    top: 10px
  }

  #score-num {
    font-size: clamp(22px, 6vw, 32px)
  }

  #best-block {
    top: 10px;
    left: 10px
  }

  #target-block {
    top: 10px;
    right: 10px
  }

  #best-val,
  #target-val {
    font-size: 14px
  }

  /* Dead screen */
  #dead .dead-score {
    font-size: clamp(32px, 10vw, 50px)
  }

  #dead .runa {
    font-size: 10px;
    letter-spacing: 4px
  }

  /* Forms */
  .eform {
    width: 90vw;
    max-width: 360px
  }

  .eform input {
    font-size: 12px;
    padding: 14px 12px
  }

  .btn {
    font-size: 10px;
    padding: 12px 18px
  }

  /* Leaderboard screen */
  .lb-wrap {
    width: 95vw;
    max-height: 50vh
  }

  .lb-head,
  .lb-row {
    grid-template-columns: 32px 1fr 80px;
    font-size: 10px;
    padding: 8px
  }

  .lb-prod {
    display: none
  }

  /* Mute button */
  #mute-toggle {
    bottom: 70px;
    right: 10px;
    width: 38px;
    height: 38px;
    font-size: 16px
  }
}

@media (max-width: 480px) {
  .t-needle,
  .t-run {
    font-size: clamp(28px, 14vw, 50px)
  }

  .t-tag,
  .t-hint {
    font-size: 9px
  }

  .title-lb {
    padding: 12px;
    max-height: 35vh
  }

  .title-lb-head {
    font-size: 11px;
    margin-bottom: 10px
  }

  .title-lb-row {
    font-size: 10px;
    padding: 6px 0
  }
}

/* Landscape mobile - short height */
@media (max-height: 500px) {
  #title {
    flex-direction: row;
    align-items: flex-start;
    justify-content: space-between;
    padding: 15px 20px;
    overflow-y: auto
  }

  .title-left {
    align-items: flex-start;
    text-align: left;
    max-width: 55%
  }

  .t-needle,
  .t-run {
    font-size: clamp(28px, 8vh, 50px);
    line-height: 0.9
  }

  .t-tag {
    font-size: 8px;
    margin-top: 8px
  }

  .t-hint {
    font-size: 9px;
    margin-top: 10px
  }

  .t-ctrls {
    display: none
  }

  .title-lb {
    width: 40%;
    max-width: 280px;
    max-height: 80vh;
    margin-bottom: 60px;
    padding: 10px
  }

  .title-lb-head {
    font-size: 10px;
    margin-bottom: 8px
  }

  .title-lb-row {
    grid-template-columns: 20px 1fr 60px;
    font-size: 9px;
    padding: 4px 0;
    gap: 4px
  }

  .title-lb-saas {
    display: none
  }

  .title-lb-profile a {
    padding: 8px 12px;
    font-size: 8px
  }

  #mute-toggle {
    bottom: 60px;
    width: 32px;
    height: 32px;
    font-size: 14px
  }

  /* HUD in landscape */
  #score-num {
    font-size: clamp(20px, 5vh, 30px)
  }

  #best-val,
  #target-val {
    font-size: 12px
  }
}
