#hud {
  position: fixed;
  inset: 0;
  z-index: 3;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  pointer-events: none;
  padding: max(10px, env(safe-area-inset-top)) 10px max(10px, env(safe-area-inset-bottom));
}

#topbar {
  display: flex;
  align-items: flex-start;
  flex-wrap: wrap;
  gap: 8px;
  min-width: 0;
}

#audio-open {
  display: none;
}

#audio-panel {
  display: contents;
}

#scoreboard {
  display: flex;
  gap: 4px;
  flex: 1 1 auto;
  min-width: 0;
  overflow-x: auto;
  pointer-events: auto;
  touch-action: pan-x;
  padding-bottom: 2px;
}

.frame {
  flex: 0 0 auto;
  width: 52px;
  padding: 4px 4px 5px;
  border-radius: 12px;
  background: var(--cream);
  color: var(--navy);
  box-shadow: var(--shadow);
}

.frame.is-on {
  outline: 3px solid var(--teal);
}

.frame .fn {
  display: block;
  font-size: 0.68rem;
  font-weight: 800;
  opacity: 0.7;
}

.frame .marks {
  display: flex;
  justify-content: flex-end;
  gap: 3px;
  min-height: 1.15rem;
  font-weight: 800;
}

.frame .marks i {
  font-style: normal;
  min-width: 0.7rem;
  text-align: center;
}

.frame .tot {
  display: block;
  text-align: right;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  min-height: 1.1rem;
}

#to-club {
  flex: 0 0 auto;
  background: var(--teal);
  color: var(--navy);
  border: 0;
  border-radius: 999px;
  min-height: 40px;
  padding: 8px 12px;
  font-weight: 800;
  pointer-events: auto;
  cursor: pointer;
  animation: club-pulse 1.15s ease-in-out infinite;
}

@keyframes club-pulse {
  0%, 100% {
    transform: scale(1);
    box-shadow:
      0 0 0 2px rgba(93, 12, 110, 0.55),
      0 0 8px 1px rgba(214, 255, 74, 0.45);
  }
  50% {
    transform: scale(1.08);
    box-shadow:
      0 0 0 4px #5d0c6e,
      0 0 22px 8px rgba(214, 255, 74, 0.95);
  }
}

@media (prefers-reduced-motion: reduce) {
  #to-club {
    animation: none;
    box-shadow: 0 0 0 3px #5d0c6e, 0 0 16px 4px rgba(214, 255, 74, 0.9);
  }
}

#sound,
#music {
  flex: 0 0 auto;
  background: var(--navy);
  color: var(--cream);
  border: 0;
  border-radius: 999px;
  min-height: 40px;
  padding: 8px 12px;
  font-weight: 800;
  pointer-events: auto;
  cursor: pointer;
}

#sound[aria-pressed="true"],
#music[aria-pressed="true"] {
  background: #b9b4be;
  color: #5e5966;
}

#banner {
  position: absolute;
  left: 50%;
  top: 42%;
  transform: translate(-50%, -50%);
  margin: 0;
  padding: 12px 22px;
  border-radius: 999px;
  background: var(--cream);
  color: var(--red);
  font-size: clamp(1.6rem, 6vw, 2.6rem);
  font-weight: 800;
  letter-spacing: -0.03em;
  box-shadow: var(--shadow);
}

#banner[hidden] { display: none; }

#tune {
  flex: 0 1 220px;
  margin: 0;
  padding: 8px 10px;
  border-radius: 999px;
  background: rgba(93, 12, 110, 0.78);
  color: var(--cream);
  font-weight: 800;
  font-size: 0.82rem;
  line-height: 1.2;
  max-width: 34vw;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  pointer-events: auto;
}

.music-volume {
  flex: 1 1 9.5rem;
  min-width: 8.5rem;
  max-width: 16rem;
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  padding: 2px 10px 2px 12px;
  border-radius: 999px;
  background: rgba(93, 12, 110, 0.78);
  color: var(--cream);
  font-weight: 800;
  font-size: 0.78rem;
  line-height: 1;
  pointer-events: auto;
}

.music-volume span {
  flex: 0 0 auto;
}

.music-volume input[type="range"] {
  --thumb: 22px;
  --fill: 80%;
  -webkit-appearance: none;
  appearance: none;
  flex: 1 1 auto;
  width: auto;
  min-width: 4.2rem;
  height: 36px;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  touch-action: pan-x;
  cursor: pointer;
}

.music-volume input[type="range"]:focus-visible {
  outline: none;
}

.music-volume input[type="range"]::-webkit-slider-runnable-track {
  height: 8px;
  border: 0;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--teal) var(--fill), rgba(246, 255, 230, 0.45) var(--fill));
  box-shadow: inset 0 0 0 2px var(--navy);
}

.music-volume input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  box-sizing: border-box;
  width: var(--thumb);
  height: var(--thumb);
  margin-top: calc((8px - var(--thumb)) / 2);
  border: 2px solid var(--navy);
  border-radius: 50%;
  background: var(--teal);
  cursor: grab;
}

.music-volume input[type="range"]::-moz-range-track {
  height: 8px;
  border: 0;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--teal) var(--fill), rgba(246, 255, 230, 0.45) var(--fill));
  box-shadow: inset 0 0 0 2px var(--navy);
}

.music-volume input[type="range"]::-moz-range-progress {
  background: transparent;
}

.music-volume input[type="range"]::-moz-range-thumb {
  box-sizing: border-box;
  width: var(--thumb);
  height: var(--thumb);
  border: 2px solid var(--navy);
  border-radius: 50%;
  background: var(--teal);
  cursor: grab;
}

.music-volume input[type="range"]:focus-visible::-webkit-slider-thumb,
.music-volume input[type="range"]:focus-visible::-moz-range-thumb {
  outline: 3px solid var(--cream);
  outline-offset: 2px;
}

.music-bg {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 0;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(93, 12, 110, 0.78);
  color: var(--cream);
  font-weight: 800;
  font-size: 0.78rem;
  line-height: 1.1;
  pointer-events: auto;
  cursor: pointer;
  min-height: 36px;
}

.music-bg input {
  width: 18px;
  height: 18px;
  margin: 0;
  accent-color: var(--teal);
  cursor: pointer;
}

#air {
  flex: 1 0 100%;
  width: 100%;
  margin: 2px 0 0;
  padding: 8px 14px;
  border-radius: 16px;
  background: var(--cream);
  color: var(--navy);
  font-weight: 800;
  font-size: 0.95rem;
  line-height: 1.25;
  text-align: center;
  pointer-events: none;
  box-shadow: var(--shadow);
}

#air[hidden] { display: none; }

#tune[hidden] { display: none; }

#tune.is-blocked {
  cursor: pointer;
  background: var(--teal);
  color: var(--navy);
}

body.is-rolling #dock,
body.is-banner #dock {
  display: none;
}

#lane-chat {
  position: fixed;
  z-index: 4;
  top: 92px;
  left: max(10px, env(safe-area-inset-left));
  width: min(320px, calc(100vw - 20px));
  display: grid;
  gap: 6px;
  pointer-events: none;
}

#lane-chat[hidden],
body.is-club #lane-chat {
  display: none;
}

#lane-chat .lane-toast,
#lane-chat .lane-reply,
#lane-chat .emoji-pop,
#lane-chat .lane-attach {
  pointer-events: auto;
}

.lane-toasts {
  display: grid;
  gap: 6px;
}

.lane-toast {
  display: grid;
  gap: 2px;
  padding: 8px 10px;
  border-radius: 16px;
  background: var(--cream);
  color: var(--navy);
  box-shadow: var(--shadow);
  animation: lane-toast-in 0.2s ease;
  cursor: pointer;
}

.lane-toast:focus-visible {
  outline: 3px solid var(--teal);
  outline-offset: 2px;
}

.lane-toast strong {
  font-size: 0.82rem;
}

.lane-toast p {
  margin: 0;
  font-weight: 700;
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.lane-toast img {
  width: 100%;
  max-height: 92px;
  object-fit: cover;
  border-radius: 10px;
  margin-top: 4px;
}

.lane-jump,
.lane-emoji,
.lane-photo,
.lane-send {
  min-height: 40px;
  border: 0;
  border-radius: 999px;
  font-weight: 800;
  cursor: pointer;
}

.lane-jump {
  justify-self: start;
  margin-top: 4px;
  padding: 4px 10px;
  background: var(--navy);
  color: var(--cream);
}

.lane-reply {
  display: grid;
  gap: 6px;
  padding: 8px;
  border-radius: 18px;
  background: rgba(93, 12, 110, 0.88);
}

.lane-reply[hidden] { display: none; }

.lane-row {
  display: flex;
  gap: 6px;
  align-items: center;
}

.lane-reply input {
  flex: 1 1 auto;
  min-width: 0;
  min-height: 44px;
  border: 0;
  border-radius: 12px;
  padding: 8px 10px;
  font: inherit;
  font-size: 16px;
  background: var(--cream);
  color: var(--ink);
}

.lane-emoji,
.lane-photo {
  flex: 0 0 auto;
  background: var(--cream);
  color: var(--navy);
  padding: 0 10px;
}

.lane-send {
  flex: 0 0 auto;
  background: var(--teal);
  color: var(--navy);
  padding: 0 12px;
}

.lane-note {
  margin: 0;
  color: var(--cream);
  font-size: 0.78rem;
  font-weight: 700;
  min-height: 0;
}

.lane-note:empty { display: none; }

.lane-attach {
  display: flex;
  align-items: center;
  gap: 8px;
}

.lane-attach[hidden] { display: none; }

.lane-attach img {
  width: 48px;
  height: 48px;
  object-fit: cover;
  border-radius: 10px;
}

#lane-chat .emoji-pop {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

#lane-chat .emoji-pop[hidden] { display: none; }

#lane-chat .emoji {
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: 10px;
  background: var(--cream);
  cursor: pointer;
}

#lane-chat.is-drop .lane-reply {
  outline: 3px dashed var(--lane);
}

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

@media (max-width: 720px) {
  #lane-chat {
    top: 72px;
    bottom: auto;
    left: 8px;
    width: calc(100vw - 16px);
  }

  .lane-send,
  .lane-photo,
  .lane-emoji {
    font-size: 0.82rem;
    padding: 0 8px;
  }
}

#dock {
  width: min(860px, 100%);
  margin: 0 auto;
}

#throw-note {
  display: none;
  margin: 0 0 8px;
  padding: 12px 14px;
  border: 3px solid var(--navy);
  border-radius: 18px;
  background: var(--cream);
  color: var(--navy);
  text-align: center;
  font-weight: 800;
  line-height: 1.35;
  box-shadow: var(--shadow);
  pointer-events: auto;
  cursor: pointer;
}

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

#hint {
  margin: 0 0 6px;
  padding: 6px 10px;
  border-radius: 14px;
  background: rgba(93, 12, 110, 0.72);
  color: var(--cream);
  text-align: center;
  line-height: 1.35;
}

#hint[hidden] { display: none; }

@media (max-width: 799px) {
  #throw-note { display: block; }
  #hint { display: none; }
}

#controls {
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-template-areas:
    "stance aim"
    "hook ball"
    "throw throw";
  gap: 6px;
  pointer-events: auto;
  padding: 8px;
  border-radius: 22px;
  background: rgba(255, 246, 232, 0.92);
  box-shadow: var(--shadow);
}

#controls[hidden] { display: none; }

#controls label:nth-of-type(1) { grid-area: stance; }
#controls label:nth-of-type(2) { grid-area: aim; }
#controls label:nth-of-type(3) { grid-area: hook; }

#controls label {
  display: grid;
  gap: 4px;
  color: var(--navy);
  font-weight: 800;
  font-size: 0.85rem;
}

#ball-colors {
  grid-area: ball;
  display: grid;
  gap: 4px;
  min-width: 0;
  color: var(--navy);
  font-weight: 800;
  font-size: 0.85rem;
}

.swatches {
  display: flex;
  align-items: center;
  gap: 6px;
  height: 44px;
  min-width: 0;
  overflow-x: auto;
  scrollbar-width: none;
  touch-action: pan-x;
}

.swatches::-webkit-scrollbar { display: none; }

.swatch {
  flex: 0 0 36px;
  width: 36px;
  height: 36px;
  padding: 0;
  border-radius: 50%;
  border: 2px solid rgba(42, 6, 52, 0.45);
  background: var(--swatch);
  box-shadow: inset 0 -4px 0 rgba(42, 6, 52, 0.22);
  cursor: pointer;
}

.swatch[data-ball="lime"] { --swatch: #d6ff4a; }
.swatch[data-ball="purple"] { --swatch: #5d0c6e; }
.swatch[data-ball="pink"] { --swatch: #ff4d9a; }

.swatch.is-on {
  border-color: var(--navy);
  box-shadow: 0 0 0 2px var(--teal), inset 0 -4px 0 rgba(42, 6, 52, 0.22);
}

.swatch:focus-visible {
  outline: 3px solid var(--teal);
  outline-offset: 1px;
}

#controls input[type="range"] {
  --thumb: 36px;
  --fill: 50%;
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 44px;
  margin: 0;
  background: transparent;
  touch-action: pan-x;
  cursor: pointer;
}

#controls input[type="range"]:focus-visible {
  outline: none;
}

#controls input[type="range"]::-webkit-slider-runnable-track {
  height: 10px;
  border: 0;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--teal) var(--fill), #fff var(--fill));
  box-shadow: inset 0 0 0 2px var(--navy);
}

#controls input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  box-sizing: border-box;
  width: var(--thumb);
  height: var(--thumb);
  margin-top: calc((10px - var(--thumb)) / 2);
  border: 3px solid var(--navy);
  border-radius: 50%;
  background: var(--teal);
  cursor: grab;
}

#controls input[type="range"]::-moz-range-track {
  height: 10px;
  border: 0;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--teal) var(--fill), #fff var(--fill));
  box-shadow: inset 0 0 0 2px var(--navy);
}

#controls input[type="range"]::-moz-range-progress {
  background: transparent;
}

#controls input[type="range"]::-moz-range-thumb {
  box-sizing: border-box;
  width: var(--thumb);
  height: var(--thumb);
  border: 3px solid var(--navy);
  border-radius: 50%;
  background: var(--teal);
  cursor: grab;
}

#controls input[type="range"]:focus-visible::-webkit-slider-thumb,
#controls input[type="range"]:focus-visible::-moz-range-thumb {
  outline: 3px solid var(--navy);
  outline-offset: 2px;
}

#power {
  --meter: 136px;
  position: fixed;
  z-index: 4;
  left: 0;
  top: 0;
  box-sizing: border-box;
  width: calc(var(--meter) + 4px);
  height: 18px;
  margin: 0;
  border: 2px solid var(--navy);
  border-radius: 999px;
  background: rgba(22, 8, 30, 0.78);
  overflow: hidden;
  pointer-events: none;
  transform: translate(-50%, -100%);
}

#power[hidden] { display: none; }

#power-fill {
  width: 0%;
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, #2fce46 0%, #ffe14a 52%, #ff2a2a 100%);
  background-size: var(--meter) 100%;
  background-repeat: no-repeat;
}

#throw,
#replay,
#enter-club {
  min-height: 48px;
  border: 0;
  border-radius: 999px;
  font-weight: 800;
  font-size: 1.05rem;
  cursor: pointer;
}

#throw {
  grid-area: throw;
  background: var(--teal);
  color: var(--navy);
}

#victory[hidden],
#leave[hidden],
#hello[hidden] { display: none; }

#hello {
  position: fixed;
  inset: 0;
  z-index: 7;
  display: grid;
  place-items: center;
  overflow: auto;
  background: rgba(93, 12, 110, 0.5);
  pointer-events: auto;
  touch-action: manipulation;
}

#hello-copy {
  margin: 8px 0 0;
  font-size: 1.35rem;
  font-weight: 800;
  line-height: 1.3;
  color: var(--navy);
}

#hello-error {
  margin: 0 0 8px;
  color: var(--navy);
  font-weight: 800;
}

#hello-error[hidden] { display: none; }

#hello-go {
  width: 100%;
  min-height: 48px;
  border: 0;
  border-radius: 999px;
  background: var(--teal);
  color: var(--navy);
  font-weight: 800;
  font-size: 1.05rem;
  cursor: pointer;
}

#hello-nick {
  display: block;
  box-sizing: border-box;
  width: 100%;
  min-height: 48px;
  margin-top: 6px;
  border: 2px solid var(--navy);
  border-radius: 14px;
  padding: 0 12px;
  background: #fff;
  color: var(--ink);
  font-size: 16px;
}

#leave-nick-label[hidden],
#win-nick[hidden] { display: none; }

#leave {
  position: fixed;
  inset: 0;
  z-index: 7;
  display: grid;
  place-items: center;
  overflow: auto;
  background: rgba(93, 12, 110, 0.5);
  pointer-events: auto;
  touch-action: manipulation;
}

#leave-copy {
  margin: 0 0 8px;
  font-size: 1.2rem;
  font-weight: 800;
  line-height: 1.4;
  color: var(--navy);
}

#leave-stay,
#leave-go {
  width: 100%;
  min-height: 48px;
  border: 0;
  border-radius: 999px;
  font-weight: 800;
  font-size: 1.05rem;
  cursor: pointer;
}

#leave-stay {
  margin-bottom: 8px;
  background: var(--teal);
  color: var(--navy);
}

#leave-go {
  background: var(--navy);
  color: var(--cream);
}

#victory {
  position: fixed;
  inset: 0;
  z-index: 6;
  display: grid;
  place-items: center;
  overflow: auto;
  background: rgba(93, 12, 110, 0.5);
  pointer-events: auto;
  touch-action: manipulation;
}

.card {
  width: min(420px, calc(100% - 32px));
  background: var(--cream);
  color: var(--ink);
  border-radius: 28px;
  padding: 28px 22px;
  text-align: center;
  box-shadow: var(--shadow);
}

.card h2 {
  font-size: 3rem;
  margin: 0.1em 0;
  color: var(--red);
  letter-spacing: -0.03em;
  line-height: 0.95;
}

.eyebrow {
  margin: 0;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--navy);
  font-weight: 700;
}

#win-stats {
  margin: 0.4em 0 0;
  line-height: 1.4;
}

.nick {
  display: block;
  text-align: left;
  font-weight: 700;
  margin: 16px 0;
}

#nick,
#leave-nick,
#replay,
#enter-club {
  width: 100%;
  font-size: 16px;
}

#nick,
#leave-nick {
  display: block;
  box-sizing: border-box;
  min-height: 48px;
  margin-top: 6px;
  border: 2px solid var(--navy);
  border-radius: 14px;
  padding: 0 12px;
  background: #fff;
  color: var(--ink);
}

#replay {
  margin-bottom: 8px;
  background: var(--navy);
  color: var(--cream);
}

#enter-club {
  background: var(--teal);
  color: var(--navy);
}

#throw:focus-visible,
#replay:focus-visible,
#enter-club:focus-visible,
#to-club:focus-visible,
#audio-open:focus-visible,
#sound:focus-visible,
#music:focus-visible,
#leave-stay:focus-visible,
#leave-go:focus-visible,
#leave-nick:focus-visible,
#nick:focus-visible {
  outline: 3px solid var(--teal);
  outline-offset: 2px;
}

@media (min-width: 800px) {
  #controls {
    grid-template-columns: 1.15fr 1fr 0.9fr auto;
    grid-template-areas:
      "ball ball ball ball"
      "stance aim hook throw";
    align-items: end;
  }

  #ball-colors {
    display: flex;
    align-items: center;
    gap: 10px;
  }

  .swatches {
    height: auto;
    overflow: visible;
  }

  #throw {
    min-width: 8.5rem;
  }

  #controls input[type="range"] {
    --thumb: 32px;
    height: 40px;
  }
}

@media (max-width: 720px) {
  .frame {
    flex: 1 1 0;
    width: auto;
    min-width: 0;
    padding: 3px 1px 4px;
  }

  .frame .marks,
  .frame .tot {
    font-size: 0.72rem;
  }

  #topbar { flex-wrap: wrap; }

  #scoreboard { flex: 1 0 100%; }

  #audio-open {
    display: inline-flex;
    align-items: center;
    order: 1;
    flex: 0 0 auto;
    min-height: 40px;
    padding: 8px 14px;
    border: 0;
    border-radius: 999px;
    background: var(--navy);
    color: var(--cream);
    font-weight: 800;
    pointer-events: auto;
    cursor: pointer;
  }

  #audio-open[aria-expanded="true"] {
    background: rgba(246, 255, 230, 0.28);
  }

  #to-club { order: 2; }

  #audio-panel {
    display: none;
    order: 3;
    flex: 1 0 100%;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    box-sizing: border-box;
    margin: 0;
    padding: 8px;
    border-radius: 16px;
    background: rgba(93, 12, 110, 0.92);
    pointer-events: auto;
  }

  #audio-panel.is-open { display: flex; }

  #air { order: 4; }

  #audio-panel #tune,
  #audio-panel .music-volume {
    flex: 1 1 100%;
    max-width: none;
    min-width: 0;
  }
}

@media (max-height: 520px) {
  #hint { display: none; }
  #throw-note { margin-bottom: 4px; padding: 8px 10px; font-size: 0.92rem; }
  #controls { gap: 6px; padding: 8px; }
  #controls input[type="range"] {
    --thumb: 28px;
    height: 36px;
  }
}

/* ---------------------------------------------------------------------------
   Lane pop-ups in the hall's look: dark glass, a pink neon edge for club
   messages, lime for the reply bar. Compact, so the lane stays in view.
--------------------------------------------------------------------------- */

.lane-toast {
  position: relative;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  column-gap: 8px;
  row-gap: 1px;
  padding: 7px 8px 7px 14px;
  border-radius: 14px;
  background: rgba(26, 6, 36, 0.9);
  color: #f6ffe6;
  box-shadow:
    0 0 0 1px rgba(255, 74, 216, 0.5),
    0 0 18px rgba(255, 74, 216, 0.25),
    0 10px 26px rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(6px);
}

.lane-toast::before {
  content: "";
  position: absolute;
  left: 5px;
  top: 8px;
  bottom: 8px;
  width: 3px;
  border-radius: 3px;
  background: #ff4ad8;
  box-shadow: 0 0 8px #ff4ad8;
}

.lane-toast strong {
  grid-column: 1;
  color: #d6ff4a;
  font-size: 0.78rem;
  letter-spacing: 0.01em;
}

.lane-toast p {
  grid-column: 1;
  color: #f6ffe6;
  font-size: 0.92rem;
  font-weight: 700;
  -webkit-line-clamp: 2;
}

.lane-toast img {
  grid-column: 1;
  max-height: 72px;
  border: 1px solid rgba(214, 255, 74, 0.35);
}

.lane-jump {
  grid-column: 2;
  grid-row: 1 / span 3;
  align-self: center;
  margin: 0;
  min-height: 32px;
  padding: 4px 10px;
  background: #d6ff4a;
  color: #2a0634;
  font-size: 0.8rem;
  box-shadow: 0 0 12px rgba(214, 255, 74, 0.35);
}

.lane-toast:focus-visible {
  outline: 2px solid #d6ff4a;
}

/* Quiz toast: gold like «Викторина» in the club, answered right here. */
.lane-toast.quiz {
  box-shadow:
    0 0 0 1px rgba(255, 200, 64, 0.85),
    0 0 22px rgba(255, 190, 40, 0.45),
    0 10px 26px rgba(0, 0, 0, 0.45);
}

.lane-toast.quiz::before {
  background: #ffc83e;
  box-shadow: 0 0 8px #ffc83e;
}

.lane-toast.quiz strong {
  color: #ffd45a;
  text-shadow: 0 0 6px rgba(255, 196, 46, 0.9), 0 0 12px rgba(255, 160, 20, 0.6);
}

.lane-toast.quiz strong::before { content: "★ "; }
.lane-toast.quiz p { -webkit-line-clamp: 4; }
.lane-toast.quiz .lane-jump { display: none; }

.lane-quiz {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 5px;
  margin-top: 5px;
}

.lane-quiz-opt {
  display: flex;
  align-items: center;
  gap: 6px;
  min-height: 34px;
  margin: 0;
  padding: 4px 8px;
  border: 1px solid rgba(255, 200, 64, 0.6);
  border-radius: 9px;
  background: rgba(26, 8, 30, 0.8);
  color: #fff4d6;
  font-size: 0.8rem;
  text-align: left;
  box-shadow: none;
}

.lane-quiz-opt b {
  flex: none;
  display: grid;
  place-items: center;
  width: 19px;
  height: 19px;
  border-radius: 50%;
  background: #ffc83e;
  color: #2a0634;
  font-size: 0.7rem;
}

.lane-quiz-opt:disabled { opacity: 0.55; }
.lane-quiz-opt.is-right { opacity: 1; border-color: #d6ff4a; background: rgba(214, 255, 74, 0.2); }
.lane-quiz-opt.is-right b { background: #d6ff4a; }
.lane-quiz-opt.is-wrong { opacity: 1; border-color: #ff5a7a; background: rgba(255, 74, 110, 0.18); }
.lane-quiz-opt.is-wrong b { background: #ff5a7a; }

.lane-toast p.lane-quiz-status {
  grid-column: 1 / -1;
  margin-top: 3px;
  color: #ffd45a;
  font-size: 0.74rem;
  font-weight: 600;
}

.lane-reply {
  gap: 6px;
  padding: 6px;
  border-radius: 999px;
  background: rgba(26, 6, 36, 0.92);
  box-shadow:
    0 0 0 1px rgba(214, 255, 74, 0.5),
    0 0 18px rgba(214, 255, 74, 0.2),
    0 10px 26px rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(6px);
}

.lane-reply:has(.lane-attach:not([hidden])),
.lane-reply:has(.emoji-pop:not([hidden])),
.lane-reply:has(.lane-note:not(:empty)) {
  border-radius: 18px;
}

.lane-reply input {
  min-height: 40px;
  border: 1px solid rgba(214, 255, 74, 0.28);
  border-radius: 999px;
  padding: 8px 12px;
  background: rgba(14, 3, 20, 0.85);
  color: #f6ffe6;
}

.lane-reply input::placeholder {
  color: rgba(201, 184, 212, 0.6);
}

/* The field's natural width (about 20 characters) must not stretch the column
   past a phone screen; the column and the field both give way instead. */
#lane-chat {
  grid-template-columns: minmax(0, 1fr);
}

.lane-reply input {
  width: 0;
}

.lane-reply input:focus {
  outline: none;
  border-color: #d6ff4a;
  box-shadow: 0 0 0 2px rgba(214, 255, 74, 0.3);
}

.lane-emoji,
.lane-photo {
  min-height: 40px;
  border: 1px solid rgba(246, 255, 230, 0.16);
  background: rgba(14, 3, 20, 0.85);
  color: #f6ffe6;
}

.lane-send {
  min-height: 40px;
  background: #d6ff4a;
  color: #2a0634;
  box-shadow: 0 0 14px rgba(214, 255, 74, 0.35);
}

.lane-note {
  padding: 0 8px;
  color: #ff8be6;
}

#lane-chat .emoji {
  border: 1px solid rgba(246, 255, 230, 0.12);
  background: rgba(58, 14, 76, 0.8);
}

/* The song announcement under the top bar: a lit marquee strip. */
#air {
  padding: 6px 14px;
  border-radius: 999px;
  background: rgba(26, 6, 36, 0.88);
  color: #d6ff4a;
  font-size: 0.88rem;
  box-shadow:
    0 0 0 1px rgba(214, 255, 74, 0.5),
    0 0 18px rgba(214, 255, 74, 0.22);
  text-shadow: 0 0 8px rgba(214, 255, 74, 0.45);
}

#tune {
  background: rgba(26, 6, 36, 0.85);
  color: #d6ff4a;
  box-shadow: 0 0 0 1px rgba(214, 255, 74, 0.4);
}

@media (max-width: 720px) {
  #lane-chat {
    left: 8px;
    width: calc(100vw - 16px);
    gap: 5px;
  }

  .lane-toast p { font-size: 0.88rem; }
}

/* ---------------------------------------------------------------------------
   Lane HUD in the hall's look: the score frames, the audio controls, the
   control dock with its sliders, the throw banner and the dialogs all sit on
   dark glass with the pink and lime neon of the lanes, like the club.
   Layout and sizes above stay as they are; only the surfaces change.
--------------------------------------------------------------------------- */

#hud,
#hello,
#leave,
#victory {
  --glass: rgba(26, 6, 36, 0.86);
  --glass-deep: rgba(14, 3, 20, 0.88);
  --edge: rgba(246, 255, 230, 0.14);
  --pink: #ff4ad8;
  --lime: #d6ff4a;
  --text: #f6ffe6;
  --soft: #c9b8d4;
  --ink-dark: #2a0634;
  --glow-pink: 0 0 0 1px rgba(255, 74, 216, 0.5), 0 0 18px rgba(255, 74, 216, 0.22);
  --glow-lime: 0 0 0 1px rgba(214, 255, 74, 0.45), 0 0 18px rgba(214, 255, 74, 0.18);
}

/* Score frames: dark tiles, marks in lime, the live frame lit up. */
.frame {
  background: var(--glass);
  color: var(--text);
  box-shadow: 0 0 0 1px var(--edge), 0 6px 18px rgba(0, 0, 0, 0.35);
  backdrop-filter: blur(6px);
}

.frame .fn { color: var(--soft); opacity: 1; }
.frame .marks { color: var(--lime); }
.frame .tot { color: var(--text); }

.frame.is-on {
  outline: 0;
  box-shadow: 0 0 0 2px var(--lime), 0 0 16px rgba(214, 255, 74, 0.45);
}

/* Audio buttons and the music strip. */
#sound,
#music,
#audio-open {
  border: 1px solid rgba(255, 74, 216, 0.55);
  background: var(--glass);
  color: var(--text);
  backdrop-filter: blur(6px);
}

#sound[aria-pressed="true"],
#music[aria-pressed="true"] {
  border-color: rgba(201, 184, 212, 0.3);
  background: rgba(40, 26, 48, 0.85);
  color: #8e8896;
}

#hud .music-volume,
#hud .music-bg {
  border: 1px solid rgba(214, 255, 74, 0.3);
  background: var(--glass);
  color: var(--text);
  backdrop-filter: blur(6px);
}

#hud .music-volume input[type="range"]::-webkit-slider-runnable-track {
  background: linear-gradient(90deg, var(--lime) var(--fill), rgba(246, 255, 230, 0.16) var(--fill));
  box-shadow: none;
}

#hud .music-volume input[type="range"]::-moz-range-track {
  background: linear-gradient(90deg, var(--lime) var(--fill), rgba(246, 255, 230, 0.16) var(--fill));
  box-shadow: none;
}

#hud .music-volume input[type="range"]::-webkit-slider-thumb {
  border-color: var(--ink-dark);
  box-shadow: 0 0 10px rgba(214, 255, 74, 0.55);
}

#hud .music-volume input[type="range"]::-moz-range-thumb {
  border-color: var(--ink-dark);
  box-shadow: 0 0 10px rgba(214, 255, 74, 0.55);
}

@media (max-width: 720px) {
  #audio-open[aria-expanded="true"] {
    border-color: var(--lime);
    background: rgba(58, 14, 76, 0.9);
  }

  #audio-panel {
    background: var(--glass);
    box-shadow: var(--glow-pink);
    backdrop-filter: blur(6px);
  }

  #audio-panel .music-volume,
  #audio-panel .music-bg {
    background: var(--glass-deep);
  }
}

/* The throw result: a neon sign over the lane. */
#banner {
  border: 0;
  background: var(--glass);
  color: #eaff9a;
  text-shadow:
    0 0 2px #fff,
    0 0 10px rgba(255, 74, 216, 0.95),
    0 0 26px rgba(255, 74, 216, 0.6);
  box-shadow: var(--glow-pink), 0 12px 32px rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(6px);
}

/* Notes above the dock. */
#throw-note {
  border: 0;
  background: var(--glass);
  color: var(--text);
  box-shadow: var(--glow-lime), 0 10px 26px rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(6px);
}

#hint {
  background: var(--glass);
  color: var(--soft);
  box-shadow: 0 0 0 1px var(--edge);
  backdrop-filter: blur(6px);
}

/* Control dock and sliders. */
#controls {
  background: var(--glass);
  box-shadow: var(--glow-lime), 0 12px 32px rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(8px);
}

#controls label,
#ball-colors {
  color: var(--soft);
  letter-spacing: 0.02em;
}

#controls input[type="range"]::-webkit-slider-runnable-track {
  background: linear-gradient(90deg, var(--lime) var(--fill), rgba(246, 255, 230, 0.14) var(--fill));
  box-shadow: inset 0 0 0 1px rgba(246, 255, 230, 0.12);
}

#controls input[type="range"]::-moz-range-track {
  background: linear-gradient(90deg, var(--lime) var(--fill), rgba(246, 255, 230, 0.14) var(--fill));
  box-shadow: inset 0 0 0 1px rgba(246, 255, 230, 0.12);
}

#controls input[type="range"]::-webkit-slider-thumb {
  border-color: var(--ink-dark);
  background: var(--lime);
  box-shadow: 0 0 12px rgba(214, 255, 74, 0.55);
}

#controls input[type="range"]::-moz-range-thumb {
  border-color: var(--ink-dark);
  background: var(--lime);
  box-shadow: 0 0 12px rgba(214, 255, 74, 0.55);
}

#controls input[type="range"]:focus-visible::-webkit-slider-thumb,
#controls input[type="range"]:focus-visible::-moz-range-thumb {
  outline-color: var(--pink);
}

.swatch {
  border-color: rgba(246, 255, 230, 0.25);
  box-shadow: inset 0 -4px 0 rgba(0, 0, 0, 0.25);
}

.swatch.is-on {
  border-color: var(--ink-dark);
  box-shadow: 0 0 0 2px var(--lime), 0 0 14px rgba(214, 255, 74, 0.6), inset 0 -4px 0 rgba(0, 0, 0, 0.25);
}

#throw,
#enter-club,
#hello-go,
#leave-stay {
  background: var(--lime);
  color: var(--ink-dark);
  box-shadow: 0 0 18px rgba(214, 255, 74, 0.4);
}

#power {
  border-color: rgba(246, 255, 230, 0.35);
  background: var(--glass-deep);
  box-shadow: 0 0 12px rgba(0, 0, 0, 0.4);
}

/* Dialogs: name, leave and the final score. */
#hello,
#leave,
#victory {
  background: rgba(10, 2, 14, 0.62);
  backdrop-filter: blur(3px);
}

.card {
  border: 0;
  background: rgba(31, 6, 41, 0.94);
  color: var(--text);
  box-shadow: var(--glow-pink), 0 18px 44px rgba(0, 0, 0, 0.55);
}

.eyebrow { color: var(--lime); }

#hello-copy,
#leave-copy,
#hello-error {
  color: var(--text);
}

.card h2 {
  color: #eaff9a;
  text-shadow:
    0 0 2px #fff,
    0 0 12px rgba(255, 74, 216, 0.95),
    0 0 30px rgba(255, 74, 216, 0.55);
}

#win-stats { color: var(--soft); }

.nick { color: var(--soft); }

#hello-nick,
#nick,
#leave-nick {
  border: 1px solid rgba(214, 255, 74, 0.35);
  border-radius: 999px;
  padding: 0 16px;
  background: var(--glass-deep);
  color: var(--text);
}

#hello-nick::placeholder,
#nick::placeholder,
#leave-nick::placeholder {
  color: rgba(201, 184, 212, 0.6);
}

#hello-nick:focus,
#nick:focus,
#leave-nick:focus {
  outline: none;
  border-color: var(--lime);
  box-shadow: 0 0 0 2px rgba(214, 255, 74, 0.3);
}

#leave-go,
#replay {
  border: 1px solid rgba(255, 74, 216, 0.55);
  background: rgba(93, 12, 110, 0.85);
  color: var(--text);
}

/* ---------------------------------------------------------------------------
   One audio drop-down on every screen: the ♫ button opens a glass panel under
   the top bar with the song, the volume, music and sound switches and the
   background-play box. It floats over the lane instead of pushing the bar.
--------------------------------------------------------------------------- */

#topbar {
  position: relative;
  align-items: center;
}

#audio-open,
#hud #audio-open {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex: 0 0 auto;
  min-height: 40px;
  padding: 8px 14px;
  border-radius: 999px;
  font-weight: 800;
  pointer-events: auto;
  cursor: pointer;
}

.ao-icon {
  color: var(--lime);
  font-size: 1.1rem;
  line-height: 1;
  text-shadow: 0 0 8px rgba(214, 255, 74, 0.7);
}

#audio-open[aria-expanded="true"] {
  border-color: var(--lime);
  background: rgba(58, 14, 76, 0.92);
  box-shadow: 0 0 14px rgba(214, 255, 74, 0.35);
}

#audio-panel,
#hud #audio-panel {
  display: none;
}

#audio-panel.is-open,
#hud #audio-panel.is-open {
  position: absolute;
  z-index: 5;
  right: 0;
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-template-areas:
    "tune tune"
    "vol vol"
    "mus snd"
    "bg bg";
  gap: 8px;
  width: min(330px, calc(100vw - 20px));
  margin: 0;
  padding: 10px;
  border-radius: 20px;
  background: rgba(26, 6, 36, 0.94);
  box-shadow:
    0 0 0 1px rgba(255, 74, 216, 0.55),
    0 0 22px rgba(255, 74, 216, 0.25),
    0 16px 40px rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(8px);
  pointer-events: auto;
  animation: audio-drop 0.16s ease;
}

@keyframes audio-drop {
  from { opacity: 0; transform: translateY(-6px); }
  to { opacity: 1; transform: none; }
}

#audio-panel.is-open #tune {
  grid-area: tune;
  max-width: none;
  margin: 0;
}

#audio-panel.is-open #tune[hidden] { display: none; }

#audio-panel.is-open .music-volume {
  grid-area: vol;
  max-width: none;
  min-width: 0;
  background: rgba(14, 3, 20, 0.88);
}

#audio-panel.is-open #music { grid-area: mus; }
#audio-panel.is-open #sound { grid-area: snd; }

#audio-panel.is-open .music-bg {
  grid-area: bg;
  justify-content: center;
  background: rgba(14, 3, 20, 0.88);
}

#audio-panel.is-open #music,
#audio-panel.is-open #sound {
  width: 100%;
  min-height: 42px;
}

#audio-panel.is-open #music::before { content: "♪ "; }
#audio-panel.is-open #sound::before { content: "🎳 "; }

/* «В клуб»: a lit sign with a pulsing pink and lime halo. */
#to-club,
#hud #to-club {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 42px;
  padding: 8px 16px 8px 13px;
  border: 1px solid rgba(255, 255, 255, 0.55);
  border-radius: 999px;
  background: linear-gradient(180deg, #ecff9c, #d6ff4a 55%, #c4f02e);
  color: #2a0634;
  font-weight: 900;
  font-size: 0.95rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  animation: club-glow 1.6s ease-in-out infinite;
}

#to-club[hidden] { display: none; }

.club-icon {
  font-size: 1.05rem;
  line-height: 1;
}

.club-arrow {
  font-weight: 900;
  transition: transform 0.2s ease;
}

@media (hover: hover) {
  #to-club:hover .club-arrow { transform: translateX(3px); }
}

@keyframes club-glow {
  0%, 100% {
    transform: scale(1);
    box-shadow:
      0 0 0 2px rgba(255, 74, 216, 0.75),
      0 0 12px rgba(214, 255, 74, 0.55),
      0 0 26px rgba(255, 74, 216, 0.3);
  }
  50% {
    transform: scale(1.04);
    box-shadow:
      0 0 0 3px #ff4ad8,
      0 0 22px rgba(214, 255, 74, 0.95),
      0 0 46px rgba(255, 74, 216, 0.6);
  }
}

@media (prefers-reduced-motion: reduce) {
  #to-club,
  #hud #to-club {
    animation: none;
    box-shadow:
      0 0 0 3px #ff4ad8,
      0 0 18px rgba(214, 255, 74, 0.85);
  }
}

@media (max-width: 720px) {
  .ao-label { display: none; }

  #audio-open,
  #hud #audio-open {
    width: 42px;
    min-width: 42px;
    padding: 0;
    justify-content: center;
  }

  #audio-panel.is-open,
  #hud #audio-panel.is-open {
    left: 0;
    right: 0;
    width: auto;
  }

  #to-club,
  #hud #to-club {
    padding: 8px 14px 8px 11px;
    font-size: 0.88rem;
  }
}

/* ---------------------------------------------------------------------------
   First-visit walkthrough: the lane dims, one control is lit in a neon frame,
   and a glass card beside it explains it.
--------------------------------------------------------------------------- */

#tour {
  position: fixed;
  inset: 0;
  z-index: 9;
  pointer-events: auto;
  touch-action: manipulation;
  transition: opacity 0.25s ease;
}

#tour.is-out { opacity: 0; }

#tour.is-center {
  display: grid;
  place-items: center;
  background: rgba(10, 2, 14, 0.66);
}

.tour-spot {
  position: fixed;
  border-radius: 18px;
  box-shadow:
    0 0 0 9999px rgba(10, 2, 14, 0.66),
    0 0 0 2px #d6ff4a,
    0 0 22px 4px rgba(214, 255, 74, 0.55);
  pointer-events: none;
  transition: left 0.3s ease, top 0.3s ease, width 0.3s ease, height 0.3s ease;
  animation: tour-pulse 1.6s ease-in-out infinite;
}

#tour.is-center .tour-spot { display: none; }

@keyframes tour-pulse {
  0%, 100% {
    box-shadow:
      0 0 0 9999px rgba(10, 2, 14, 0.66),
      0 0 0 2px #d6ff4a,
      0 0 18px 2px rgba(214, 255, 74, 0.45);
  }
  50% {
    box-shadow:
      0 0 0 9999px rgba(10, 2, 14, 0.66),
      0 0 0 3px #d6ff4a,
      0 0 30px 8px rgba(214, 255, 74, 0.75);
  }
}

.tour-card {
  --arrow: 50%;
  position: fixed;
  width: min(340px, calc(100vw - 24px));
  padding: 16px 16px 14px;
  border-radius: 20px;
  background: rgba(31, 6, 41, 0.97);
  color: #f6ffe6;
  box-shadow:
    0 0 0 1px rgba(255, 74, 216, 0.6),
    0 0 26px rgba(255, 74, 216, 0.3),
    0 18px 44px rgba(0, 0, 0, 0.55);
  opacity: 0;
  transform: translateY(6px);
  transition: opacity 0.2s ease, transform 0.2s ease, left 0.3s ease, top 0.3s ease;
}

.tour-card.is-in {
  opacity: 1;
  transform: none;
}

#tour.is-center .tour-card {
  position: relative;
  width: min(380px, calc(100vw - 32px));
  text-align: center;
}

/* Pointer toward the lit control. */
.tour-card::after {
  content: "";
  position: absolute;
  left: calc(var(--arrow) - 9px);
  bottom: -8px;
  width: 18px;
  height: 18px;
  background: rgba(31, 6, 41, 0.97);
  box-shadow: 1px 1px 0 rgba(255, 74, 216, 0.6);
  transform: rotate(45deg);
}

.tour-card.is-below::after {
  top: -8px;
  bottom: auto;
  box-shadow: -1px -1px 0 rgba(255, 74, 216, 0.6);
}

#tour.is-center .tour-card::after { display: none; }

.tour-step {
  margin: 0 0 4px;
  color: #d6ff4a;
  font-size: 0.74rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.tour-title {
  margin: 0 0 6px;
  color: #eaff9a;
  font-size: 1.35rem;
  line-height: 1.15;
  text-shadow: 0 0 10px rgba(255, 74, 216, 0.75);
}

.tour-text {
  margin: 0;
  color: #f6ffe6;
  font-size: 0.98rem;
  font-weight: 700;
  line-height: 1.4;
}

.tour-key {
  display: inline-block;
  margin: 10px 0 0;
  padding: 5px 10px;
  border-radius: 999px;
  background: rgba(214, 255, 74, 0.12);
  box-shadow: inset 0 0 0 1px rgba(214, 255, 74, 0.45);
  color: #d6ff4a;
  font-size: 0.85rem;
  font-weight: 800;
}

.tour-key[hidden] { display: none; }

.tour-dots {
  display: flex;
  justify-content: center;
  gap: 6px;
  margin: 14px 0 12px;
}

.tour-dots i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: rgba(246, 255, 230, 0.25);
}

.tour-dots i.is-on {
  background: #d6ff4a;
  box-shadow: 0 0 8px #d6ff4a;
}

.tour-actions {
  display: flex;
  gap: 8px;
}

.tour-actions button {
  flex: 1 1 0;
  min-height: 44px;
  border-radius: 999px;
  font: inherit;
  font-weight: 800;
  font-size: 1rem;
  cursor: pointer;
}

.tour-skip {
  border: 1px solid rgba(255, 74, 216, 0.55);
  background: rgba(93, 12, 110, 0.85);
  color: #f6ffe6;
}

.tour-skip[hidden] { display: none; }

.tour-next {
  border: 0;
  background: #d6ff4a;
  color: #2a0634;
  box-shadow: 0 0 16px rgba(214, 255, 74, 0.4);
}

.tour-actions button:focus-visible {
  outline: 2px solid #f6ffe6;
  outline-offset: 2px;
}

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

/* «Обучение» replays the walkthrough. A glass pill beside the audio one. */
#help {
  flex: 0 0 auto;
  width: auto;
  min-width: 0;
  min-height: 40px;
  padding: 0 14px;
  border: 1px solid rgba(214, 255, 74, 0.5);
  border-radius: 999px;
  background: rgba(26, 6, 36, 0.86);
  color: #d6ff4a;
  font-weight: 800;
  font-size: 0.86rem;
  line-height: 1;
  text-shadow: 0 0 8px rgba(214, 255, 74, 0.7);
  backdrop-filter: blur(6px);
  pointer-events: auto;
  cursor: pointer;
}

#help:focus-visible {
  outline: 2px solid #d6ff4a;
  outline-offset: 2px;
}

@media (max-width: 720px) {
  #help { order: 1; }
}

/* ---------------------------------------------------------------------------
   Account: the 👤 button on the lane, the «already have an account» link in
   the name box, and the login / sign-up dialog shared with the club.
--------------------------------------------------------------------------- */

#account-open {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  width: auto;
  min-width: 40px;
  min-height: 40px;
  padding: 0 12px;
  border: 1px solid rgba(255, 74, 216, 0.55);
  border-radius: 999px;
  color: #f6ffe6;
  background: rgba(26, 6, 36, 0.86);
  font-size: 1.05rem;
  line-height: 1;
  backdrop-filter: blur(6px);
  pointer-events: auto;
  cursor: pointer;
}

@media (max-width: 720px) {
  #account-open { order: 1; }
}

#hello-login {
  width: 100%;
  min-height: 44px;
  margin-top: 8px;
  border: 1px solid rgba(255, 74, 216, 0.55);
  border-radius: 999px;
  background: rgba(93, 12, 110, 0.85);
  color: #f6ffe6;
  font: inherit;
  font-weight: 800;
  cursor: pointer;
}

#account {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: grid;
  place-items: center;
  padding: 16px;
  background: rgba(10, 2, 14, 0.66);
  backdrop-filter: blur(3px);
  pointer-events: auto;
  touch-action: manipulation;
  user-select: text;
  -webkit-user-select: text;
}

.acc-card {
  position: relative;
  width: min(380px, 100%);
  padding: 22px 18px 18px;
  border-radius: 22px;
  background: rgba(31, 6, 41, 0.97);
  color: #f6ffe6;
  box-shadow:
    0 0 0 1px rgba(255, 74, 216, 0.6),
    0 0 26px rgba(255, 74, 216, 0.28),
    0 18px 44px rgba(0, 0, 0, 0.55);
}

.acc-close {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 34px;
  height: 34px;
  border: 0;
  border-radius: 50%;
  background: rgba(246, 255, 230, 0.08);
  color: #c9b8d4;
  font-size: 1rem;
  cursor: pointer;
}

.acc-eyebrow {
  margin: 0 0 10px;
  color: #d6ff4a;
  font-size: 0.74rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.acc-title {
  margin: 0 0 8px;
  color: #eaff9a;
  font-size: 1.6rem;
  text-shadow: 0 0 12px rgba(255, 74, 216, 0.8);
}

.acc-text {
  margin: 0 0 12px;
  color: #c9b8d4;
  font-size: 0.92rem;
  font-weight: 700;
  line-height: 1.4;
}

.acc-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  margin: 0 0 14px;
  padding: 3px;
  border-radius: 999px;
  background: rgba(14, 3, 20, 0.85);
  box-shadow: inset 0 0 0 1px rgba(246, 255, 230, 0.12);
}

.acc-tabs button {
  min-height: 38px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: #c9b8d4;
  font: inherit;
  font-weight: 800;
  cursor: pointer;
}

.acc-tabs button.is-on {
  background: #d6ff4a;
  color: #2a0634;
  box-shadow: 0 0 14px rgba(214, 255, 74, 0.45);
}

.acc-form {
  display: grid;
  gap: 10px;
}

.acc-field {
  display: grid;
  gap: 4px;
  color: #c9b8d4;
  font-size: 0.85rem;
  font-weight: 800;
}

.acc-field[hidden] { display: none; }

.acc-field input {
  min-height: 46px;
  padding: 0 16px;
  border: 1px solid rgba(214, 255, 74, 0.35);
  border-radius: 999px;
  background: rgba(14, 3, 20, 0.88);
  color: #f6ffe6;
  font: inherit;
  font-size: 16px;
}

.acc-field input:focus {
  outline: none;
  border-color: #d6ff4a;
  box-shadow: 0 0 0 2px rgba(214, 255, 74, 0.3);
}

.acc-note {
  margin: 0;
  min-height: 0;
  color: #ff8be6;
  font-size: 0.88rem;
  font-weight: 800;
}

.acc-note:empty { display: none; }

.acc-primary,
.acc-secondary {
  width: 100%;
  min-height: 48px;
  border-radius: 999px;
  font: inherit;
  font-weight: 800;
  font-size: 1.02rem;
  cursor: pointer;
}

.acc-primary {
  border: 0;
  background: #d6ff4a;
  color: #2a0634;
  box-shadow: 0 0 18px rgba(214, 255, 74, 0.4);
}

.acc-primary:disabled { opacity: 0.6; cursor: default; }

.acc-secondary {
  border: 1px solid rgba(255, 74, 216, 0.55);
  background: rgba(93, 12, 110, 0.85);
  color: #f6ffe6;
}

.acc-close:focus-visible,
.acc-tabs button:focus-visible,
.acc-primary:focus-visible,
.acc-secondary:focus-visible {
  outline: 2px solid #f6ffe6;
  outline-offset: 2px;
}

/* Golden pin: the line that pops up mid-screen when it is caught or missed. */
#gold-pop {
  position: fixed;
  left: 50%;
  top: 34%;
  z-index: 60;
  max-width: min(92vw, 520px);
  padding: 12px 20px;
  border-radius: 16px;
  background: rgba(40, 14, 30, 0.92);
  color: #fff4d6;
  font-weight: 800;
  font-size: clamp(1rem, 3.6vw, 1.35rem);
  text-align: center;
  box-shadow:
    0 0 0 1px rgba(255, 200, 64, 0.85),
    0 0 28px rgba(255, 190, 40, 0.5);
  transform: translate(-50%, -50%);
  pointer-events: none;
}

#gold-pop.is-win {
  color: #ffd45a;
  text-shadow: 0 0 8px rgba(255, 196, 46, 0.9), 0 0 18px rgba(255, 160, 20, 0.6);
}

#gold-pop.is-in { animation: gold-pop-in 0.45s cubic-bezier(0.2, 1.4, 0.4, 1); }

@keyframes gold-pop-in {
  from { opacity: 0; transform: translate(-50%, -50%) scale(0.6); }
  to { opacity: 1; transform: translate(-50%, -50%) scale(1); }
}

@media (prefers-reduced-motion: reduce) {
  #gold-pop.is-in { animation: none; }
}

/* Challenges: cups by names, the lane chip, and the call / result cards. */
.cup {
  margin-left: 4px;
  color: #ffd45a;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  text-shadow: 0 0 6px rgba(255, 196, 46, 0.7);
  white-space: nowrap;
}

#duel-chip {
  position: fixed;
  left: 50%;
  top: calc(env(safe-area-inset-top, 0px) + 62px);
  z-index: 25;
  max-width: min(92vw, 560px);
  padding: 6px 14px;
  border-radius: 999px;
  background: rgba(26, 6, 36, 0.92);
  color: #fff4d6;
  font-size: 0.82rem;
  font-weight: 800;
  text-align: center;
  box-shadow: 0 0 0 1px rgba(255, 200, 64, 0.75), 0 0 16px rgba(255, 190, 40, 0.35);
  transform: translateX(-50%);
  pointer-events: none;
}

#duel-chip[hidden] { display: none; }

@media (max-width: 700px) {
  #duel-chip { top: calc(env(safe-area-inset-top, 0px) + 112px); font-size: 0.74rem; }
}

.duel-modal {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  place-items: center;
  padding: 16px;
  background: rgba(10, 2, 14, 0.72);
}

.duel-card {
  width: min(420px, 100%);
  padding: 20px 20px 18px;
  border-radius: 20px;
  background: #1f0629;
  color: #f6ffe6;
  text-align: center;
  animation: duel-in 0.35s cubic-bezier(0.2, 1.3, 0.4, 1);
}

.duel-card.is-call {
  box-shadow: 0 0 0 2px #ff4ad8, 0 0 30px rgba(255, 74, 216, 0.45);
}

.duel-card.is-gold {
  background: radial-gradient(120% 90% at 50% 0%, rgba(255, 196, 46, 0.28), transparent 60%), #2a0f22;
  box-shadow: 0 0 0 3px #ffc83e, 0 0 0 6px rgba(255, 200, 64, 0.25), 0 0 44px rgba(255, 190, 40, 0.6);
}

.duel-card.is-silver {
  background: radial-gradient(120% 90% at 50% 0%, rgba(214, 222, 236, 0.18), transparent 60%), #1f1a2a;
  box-shadow: 0 0 0 3px #c9d1de, 0 0 0 6px rgba(201, 209, 222, 0.2), 0 0 32px rgba(201, 209, 222, 0.35);
}

.duel-eyebrow {
  margin: 0 0 4px;
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  opacity: 0.8;
}

.duel-title {
  margin: 0 0 8px;
  font-size: 1.35rem;
}

.duel-card.is-gold .duel-title {
  color: #ffd45a;
  text-shadow: 0 0 10px rgba(255, 196, 46, 0.8);
}

.duel-card.is-silver .duel-title { color: #e4e9f2; }

.duel-text {
  margin: 0 0 14px;
  line-height: 1.4;
}

.duel-cups {
  margin: -6px 0 14px;
  color: #ffd45a;
  font-weight: 800;
}

.duel-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.duel-card button {
  min-height: 44px;
  padding: 8px 14px;
  border: 0;
  border-radius: 999px;
  font: inherit;
  font-weight: 800;
  cursor: pointer;
}

.duel-card > button { width: 100%; }

.duel-yes {
  background: #d6ff4a;
  color: #2a0634;
}

.duel-card.is-gold .duel-yes { background: #ffc83e; }
.duel-card.is-silver .duel-yes { background: #dfe5ef; }

.duel-no {
  background: rgba(255, 255, 255, 0.1);
  color: #f6ffe6;
}

@keyframes duel-in {
  from { opacity: 0; transform: scale(0.85); }
  to { opacity: 1; transform: scale(1); }
}

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

#duel-toast {
  position: fixed;
  left: 50%;
  top: calc(env(safe-area-inset-top, 0px) + 14px);
  z-index: 85;
  max-width: min(92vw, 520px);
  padding: 8px 16px;
  border-radius: 14px;
  background: #1f0629;
  color: #f6ffe6;
  font-weight: 800;
  text-align: center;
  box-shadow: 0 0 0 1px rgba(255, 200, 64, 0.8), 0 0 20px rgba(255, 190, 40, 0.4);
  transform: translateX(-50%);
  pointer-events: none;
}

#duel-toast[hidden] { display: none; }

/* Profile and online: 👤 with the online count, and its drop-down panel. */
#account-open .po-count {
  min-width: 0;
  color: #d6ff4a;
  font-size: 0.84rem;
  font-weight: 800;
  text-shadow: 0 0 6px rgba(214, 255, 74, 0.6);
}

#account-open .po-count:empty { display: none; }

#account-open[aria-expanded="true"] {
  background: rgba(93, 12, 110, 0.95);
  box-shadow: 0 0 14px rgba(255, 74, 216, 0.45);
}

.people-panel {
  position: fixed;
  z-index: 40;
  max-height: min(70vh, 460px);
  overflow-y: auto;
  padding: 10px;
  border-radius: 16px;
  background: rgba(26, 6, 36, 0.96);
  color: #f6ffe6;
  box-shadow: 0 0 0 1px rgba(255, 74, 216, 0.5), 0 0 22px rgba(255, 74, 216, 0.3), 0 14px 32px rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(8px);
}

.people-panel[hidden] { display: none; }

.pp-me {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 4px 4px 10px;
  border-bottom: 1px solid rgba(255, 74, 216, 0.3);
}

.pp-name {
  min-width: 0;
  overflow: hidden;
  color: #d6ff4a;
  font-size: 1rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.people-panel button {
  min-height: 34px;
  padding: 4px 12px;
  border-radius: 999px;
  font: inherit;
  font-size: 0.82rem;
  font-weight: 800;
  white-space: nowrap;
  cursor: pointer;
}

.pp-account {
  border: 1px solid rgba(214, 255, 74, 0.6);
  background: transparent;
  color: #d6ff4a;
}

.pp-head {
  margin: 10px 4px 6px;
  color: #ff8be6;
  font-size: 0.74rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.pp-list {
  display: grid;
  gap: 6px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.pp-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  column-gap: 8px;
  padding: 7px 8px 7px 10px;
  border-radius: 12px;
  background: rgba(58, 14, 76, 0.7);
  box-shadow: inset 0 0 0 1px rgba(214, 255, 74, 0.2);
}

.pp-row.is-me { box-shadow: inset 0 0 0 1px rgba(214, 255, 74, 0.6); }

.pp-nick {
  grid-column: 1;
  overflow: hidden;
  color: #d6ff4a;
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pp-scores {
  grid-column: 1;
  color: rgba(246, 255, 230, 0.75);
  font-size: 0.74rem;
  font-weight: 700;
}

.pp-duel {
  grid-column: 2;
  grid-row: 1 / span 2;
  border: 1px solid rgba(255, 200, 64, 0.8);
  background: rgba(255, 200, 64, 0.12);
  color: #ffd45a;
  box-shadow: 0 0 10px rgba(255, 190, 40, 0.25);
}

.pp-duel.is-armed {
  background: #ffc83e;
  color: #2a0634;
}

.pp-empty {
  padding: 6px 4px;
  color: rgba(246, 255, 230, 0.7);
  font-size: 0.86rem;
}

/* First visit: the sign-up box opens with a greeting. */
.acc-title.acc-welcome {
  margin-bottom: 12px;
  font-size: clamp(1.25rem, 5vw, 1.55rem);
  line-height: 1.2;
}

/* Challenge game: the big line when it starts or ends, and the note above the lane. */
#duel-pop {
  position: fixed;
  left: 50%;
  top: 38%;
  z-index: 70;
  max-width: min(92vw, 540px);
  padding: 14px 22px;
  border-radius: 18px;
  background: rgba(40, 14, 30, 0.94);
  color: #ffd45a;
  font-weight: 900;
  font-size: clamp(1.05rem, 4vw, 1.4rem);
  line-height: 1.3;
  text-align: center;
  text-shadow: 0 0 8px rgba(255, 196, 46, 0.8);
  box-shadow: 0 0 0 2px #ffc83e, 0 0 36px rgba(255, 190, 40, 0.55);
  transform: translate(-50%, -50%);
  pointer-events: none;
}

#duel-pop[hidden] { display: none; }
#duel-pop.is-in { animation: gold-pop-in 0.45s cubic-bezier(0.2, 1.4, 0.4, 1); }

#duel-note {
  position: fixed;
  left: 50%;
  top: calc(env(safe-area-inset-top, 0px) + 62px);
  z-index: 25;
  max-width: min(92vw, 560px);
  padding: 6px 14px;
  border-radius: 999px;
  background: rgba(40, 14, 30, 0.94);
  color: #ffd45a;
  font-size: 0.84rem;
  font-weight: 900;
  text-align: center;
  box-shadow: 0 0 0 1px #ffc83e, 0 0 18px rgba(255, 190, 40, 0.45);
  transform: translateX(-50%);
  pointer-events: none;
  animation: duel-note-glow 2.4s ease-in-out infinite;
}

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

body:is(.is-club, .is-joining) #duel-note { display: none; }

@keyframes duel-note-glow {
  50% { box-shadow: 0 0 0 1px #ffc83e, 0 0 28px rgba(255, 190, 40, 0.75); }
}

@media (max-width: 700px) {
  #duel-note { top: calc(env(safe-area-inset-top, 0px) + 112px); font-size: 0.74rem; }
}

@media (prefers-reduced-motion: reduce) {
  #duel-pop.is-in, #duel-note { animation: none; }
}

/* Rating: the button in both online panels and the table window. */
.rating-open {
  display: block;
  width: 100%;
  min-height: 36px;
  margin: 8px 0 4px;
  padding: 6px 12px;
  border: 1px solid rgba(255, 200, 64, 0.8);
  border-radius: 999px;
  background: rgba(255, 200, 64, 0.14);
  color: #ffd45a;
  font: inherit;
  font-size: 0.86rem;
  font-weight: 800;
  cursor: pointer;
  box-shadow: 0 0 12px rgba(255, 190, 40, 0.25);
}

.rating-open:hover,
.rating-open:focus-visible {
  background: rgba(255, 200, 64, 0.26);
  outline: none;
}

.rating-back {
  position: fixed;
  inset: 0;
  z-index: 75;
  display: grid;
  place-items: center;
  padding: 12px;
  background: rgba(10, 2, 14, 0.72);
}

.rating-card {
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr);
  width: min(640px, 100%);
  max-height: min(86vh, 720px);
  padding: 16px;
  border-radius: 20px;
  background: #1f0629;
  color: #f6ffe6;
  box-shadow: 0 0 0 2px #ffc83e, 0 0 36px rgba(255, 190, 40, 0.4), 0 18px 40px rgba(0, 0, 0, 0.5);
}

.rating-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.rating-title {
  margin: 0;
  color: #ffd45a;
  font-size: 1.3rem;
  text-shadow: 0 0 10px rgba(255, 196, 46, 0.7);
}

.rating-close {
  flex: none;
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.1);
  color: #f6ffe6;
  font-size: 1rem;
  cursor: pointer;
}

.rating-note {
  margin: 4px 0 10px;
  color: rgba(246, 255, 230, 0.7);
  font-size: 0.8rem;
  font-weight: 700;
}

.rating-wrap {
  min-height: 0;
  overflow: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 200, 64, 0.5) transparent;
}

.rating-empty { margin: 16px 0; text-align: center; }

.rating-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0 4px;
  font-size: 0.88rem;
}

.rating-table th {
  position: sticky;
  top: 0;
  padding: 4px 6px;
  background: #1f0629;
  color: #ff8be6;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-align: left;
  text-transform: uppercase;
  white-space: nowrap;
}

.rating-table td {
  padding: 7px 6px;
  background: rgba(58, 14, 76, 0.7);
  font-weight: 700;
}

.rating-table td:first-child { border-radius: 10px 0 0 10px; }
.rating-table td:last-child { border-radius: 0 10px 10px 0; }

.rating-table tr.is-me td {
  background: rgba(214, 255, 74, 0.16);
}

.rating-table .r-place { width: 2.2rem; text-align: center; white-space: nowrap; }
.rating-table .r-num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.rating-table th.r-num { text-align: right; }
.rating-table .r-cups { color: #ffd45a; }
.rating-table .r-act { width: 1%; text-align: right; white-space: nowrap; }

.rating-table .r-nick {
  max-width: 12rem;
  overflow: hidden;
  color: #d6ff4a;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.r-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  margin-right: 6px;
  border-radius: 50%;
  background: rgba(246, 255, 230, 0.25);
  vertical-align: middle;
}

.r-dot.is-on {
  background: #d6ff4a;
  box-shadow: 0 0 6px #d6ff4a;
}

.r-you {
  margin-left: 6px;
  padding: 1px 6px;
  border-radius: 999px;
  background: rgba(214, 255, 74, 0.25);
  color: #eaff9a;
  font-size: 0.7rem;
}

.r-duel {
  min-height: 30px;
  padding: 2px 10px;
  border: 1px solid rgba(255, 200, 64, 0.8);
  border-radius: 999px;
  background: rgba(255, 200, 64, 0.12);
  color: #ffd45a;
  font: inherit;
  font-size: 0.8rem;
  font-weight: 800;
  cursor: pointer;
}

.r-duel.is-armed {
  background: #ffc83e;
  color: #2a0634;
}

@media (max-width: 520px) {
  .rating-card { padding: 12px 8px; }
  .rating-table { font-size: 0.78rem; }
  .rating-table th,
  .rating-table td { padding-left: 4px; padding-right: 4px; }
  .rating-table th { font-size: 0.62rem; letter-spacing: 0; }
  .rating-table .r-games { display: none; }
  .rating-table .r-place { width: 1.7rem; }
  .rating-table .r-nick { max-width: 6.2rem; }
  .r-dot { margin-right: 4px; }
  .r-you { display: none; }
  .r-duel { padding: 2px 7px; }
}

/* A challenge already sent: the button goes green and stays put. */
.pp-duel.is-sent,
.r-duel.is-sent,
.online-row .online-duel.is-sent {
  border-color: #d6ff4a;
  background: rgba(214, 255, 74, 0.22);
  color: #d6ff4a;
  box-shadow: 0 0 10px rgba(214, 255, 74, 0.35);
  opacity: 1;
  cursor: default;
}
