:root {
  --bg: #ecece7;
  --panel: rgba(255, 255, 255, 0.95);
  --panel-strong: rgba(255, 255, 255, 0.98);
  --ink: #151515;
  --line: #2a2a2a;
  --muted: #5f5f5f;
  --danger: #a11c1c;
  --danger-soft: #f7ecec;
  --ok: #145a27;
  --ok-soft: #edf6ef;
  --soft-line: #d5d5ce;
  --shadow: 0 26px 70px rgba(0, 0, 0, 0.16);
  --shadow-soft: 0 18px 42px rgba(0, 0, 0, 0.12);
}

* {
  box-sizing: border-box;
  scrollbar-width: none;
}

*::-webkit-scrollbar {
  display: none;
}

html,
body {
  height: 100%;
}

body {
  margin: 0;
  overflow: hidden;
  background:
    radial-gradient(circle at 92% 10%, #dfdfd8 0%, transparent 34%),
    radial-gradient(circle at 10% 92%, #d8d8d2 0%, transparent 30%),
    var(--bg);
  color: var(--ink);
  font-family: "Space Grotesk", "Segoe UI", sans-serif;
}

.auth-modal[hidden],
.toast[hidden] {
  display: none !important;
}

[hidden] {
  display: none !important;
}

.app {
  height: 100vh;
  width: min(1100px, 100vw);
  margin: 0 auto;
  padding: 10px clamp(8px, 2vw, 16px);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.screen-hidden {
  display: none !important;
}

.setup-screen {
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
  isolation: isolate;
}

.setup-screen::before,
.setup-screen::after {
  content: "";
  position: absolute;
  inset: auto;
  pointer-events: none;
  filter: blur(14px);
  opacity: 0.78;
  animation: setup-ambient-drift 18s ease-in-out infinite alternate;
}

.setup-screen::before {
  top: -40px;
  right: 3%;
  width: min(34vw, 360px);
  height: min(34vw, 360px);
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 205, 97, 0.22), transparent 70%);
}

.setup-screen::after {
  bottom: 2%;
  left: 4%;
  width: min(30vw, 320px);
  height: min(30vw, 320px);
  border-radius: 50%;
  background: radial-gradient(circle, rgba(112, 140, 255, 0.12), transparent 72%);
  animation-delay: -6s;
}

.setup-shell {
  position: relative;
  z-index: 1;
  height: 100%;
  min-height: 0;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  grid-template-areas:
    "intro intro"
    "standard ranked";
  gap: 18px;
  align-content: start;
}

.setup-intro {
  grid-area: intro;
  display: grid;
  gap: 8px;
  padding: 8px 4px 2px;
  max-width: 760px;
  animation: setup-card-enter 500ms ease;
}

.setup-intro-eyebrow,
.setup-mode-kicker,
.ranked-section-label {
  margin: 0;
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.setup-intro-eyebrow,
.setup-mode-kicker {
  color: rgba(17, 17, 17, 0.48);
}

.setup-intro-title,
.setup-mode-title {
  margin: 0;
  letter-spacing: -0.04em;
}

.setup-intro-title {
  font-size: clamp(2rem, 5vw, 3.6rem);
  line-height: 0.94;
  max-width: 12ch;
}

.setup-intro-copy {
  margin: 0;
  max-width: 50ch;
  color: rgba(17, 17, 17, 0.64);
  font-size: 0.98rem;
  line-height: 1.55;
}

.setup-mode-panel {
  position: relative;
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 24px;
  padding: clamp(22px, 3.4vw, 32px);
  border-radius: 30px;
  overflow: hidden;
  backdrop-filter: blur(18px);
  transition: transform 220ms ease, box-shadow 220ms ease;
  animation: setup-card-enter 520ms ease both;
}

.setup-mode-panel:hover {
  transform: translateY(-2px);
}

.setup-mode-panel::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
}

.setup-mode-panel-standard {
  grid-area: standard;
  color: #141414;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.9), rgba(246, 243, 236, 0.94)),
    rgba(255, 255, 255, 0.84);
  box-shadow:
    0 28px 60px rgba(20, 20, 20, 0.12),
    inset 0 1px 0 rgba(255, 255, 255, 0.8);
}

.setup-mode-panel-standard::before {
  box-shadow: inset 0 0 0 1px rgba(17, 17, 17, 0.08);
}

.setup-mode-panel-ranked {
  grid-area: ranked;
  color: #f8f5eb;
  background:
    radial-gradient(circle at top right, rgba(255, 208, 92, 0.18), transparent 34%),
    linear-gradient(160deg, rgba(12, 14, 20, 0.98), rgba(25, 27, 35, 0.94) 52%, rgba(52, 39, 13, 0.9) 100%);
  box-shadow:
    0 34px 72px rgba(11, 11, 16, 0.28),
    inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

.setup-mode-panel-ranked::before {
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.08);
}

.setup-mode-head {
  display: grid;
  gap: 8px;
}

.setup-mode-title {
  font-size: clamp(1.9rem, 4vw, 2.8rem);
  line-height: 0.94;
}

.setup-mode-subtitle {
  margin: 0;
  font-size: 1rem;
  font-weight: 600;
  color: rgba(17, 17, 17, 0.62);
}

.setup-mode-panel-ranked .setup-mode-kicker,
.setup-mode-panel-ranked .ranked-section-label {
  color: rgba(255, 228, 164, 0.68);
}

.setup-mode-panel-ranked .setup-mode-subtitle {
  color: rgba(255, 255, 255, 0.72);
}

.setup-standard-body {
  display: grid;
  gap: 18px;
  flex: 1 1 auto;
}

.setup-control-group,
.setup-control-grid {
  display: grid;
  gap: 12px;
}

.setup-control-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.setup-control-label {
  margin: 0;
  color: rgba(17, 17, 17, 0.58);
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.setup-segmented {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.setup-segment-button,
.ranked-queue-button,
.setup-cta {
  font-family: "Space Grotesk", "Segoe UI", sans-serif;
}

.setup-segment-button {
  min-width: 0;
  border-radius: 20px;
  border: 0;
  padding: 15px 14px;
  background: rgba(17, 17, 17, 0.05);
  color: #141414;
  box-shadow:
    inset 0 0 0 1px rgba(17, 17, 17, 0.06),
    0 10px 24px rgba(17, 17, 17, 0.04);
  font-size: 0.95rem;
  font-weight: 700;
}

.setup-segment-button:hover:not(:disabled),
.ranked-queue-button:hover:not(:disabled),
.setup-cta:hover:not(:disabled) {
  transform: translateY(-1px);
}

.setup-segment-button.active {
  background: linear-gradient(180deg, #171717, #262626);
  color: #fff;
  box-shadow:
    0 16px 28px rgba(17, 17, 17, 0.18),
    inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

.setup-control-card {
  display: grid;
  gap: 16px;
  padding: 16px 18px 18px;
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.58);
  box-shadow:
    inset 0 0 0 1px rgba(17, 17, 17, 0.05),
    0 16px 28px rgba(17, 17, 17, 0.05);
}

.setup-control-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin: 0;
  font-size: 0.98rem;
  font-weight: 600;
  color: rgba(17, 17, 17, 0.72);
}

.setup-control-head strong {
  color: #111;
  font-size: 1rem;
}

.setup-range {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 10px;
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: linear-gradient(90deg, rgba(17, 17, 17, 0.18), rgba(17, 17, 17, 0.06));
  cursor: pointer;
}

.setup-range::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 22px;
  height: 22px;
  border: 0;
  border-radius: 50%;
  background: #111;
  box-shadow: 0 8px 18px rgba(17, 17, 17, 0.2);
}

.setup-range::-moz-range-thumb {
  width: 22px;
  height: 22px;
  border: 0;
  border-radius: 50%;
  background: #111;
  box-shadow: 0 8px 18px rgba(17, 17, 17, 0.2);
}

.setup-range:focus-visible {
  outline: none;
  box-shadow: 0 0 0 4px rgba(17, 17, 17, 0.12);
}

.ranked-queue-switch {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.ranked-queue-button {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-width: 0;
  border: 0;
  border-radius: 20px;
  padding: 15px 14px;
  background: rgba(255, 255, 255, 0.08);
  color: rgba(255, 255, 255, 0.82);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.08);
  font-size: 0.96rem;
  font-weight: 700;
}

.ranked-queue-button.is-active {
  background: linear-gradient(135deg, rgba(255, 232, 170, 0.18), rgba(255, 207, 96, 0.1));
  color: #fff3d0;
  box-shadow:
    0 14px 28px rgba(0, 0, 0, 0.18),
    inset 0 0 0 1px rgba(255, 224, 148, 0.2);
}

.ranked-queue-button.is-locked {
  color: rgba(255, 255, 255, 0.62);
  cursor: not-allowed;
}

.ranked-queue-button.is-locked::after {
  content: attr(data-tooltip);
  position: absolute;
  left: 50%;
  bottom: calc(100% + 10px);
  transform: translateX(-50%) translateY(6px);
  width: max-content;
  max-width: 220px;
  padding: 8px 10px;
  border-radius: 12px;
  background: rgba(7, 9, 13, 0.96);
  color: #fff;
  font-size: 0.76rem;
  font-weight: 600;
  line-height: 1.35;
  opacity: 0;
  pointer-events: none;
  box-shadow: 0 16px 30px rgba(0, 0, 0, 0.24);
  transition: opacity 160ms ease, transform 160ms ease;
}

.ranked-queue-button.is-locked:hover::after,
.ranked-queue-button.is-locked:focus-visible::after {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.ranked-queue-badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  color: rgba(255, 255, 255, 0.72);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.ranked-rules {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.ranked-rule-chip {
  display: grid;
  gap: 6px;
  padding: 16px;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.06);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.07);
}

.ranked-rule-chip strong,
.ranked-rule-chip span {
  margin: 0;
}

.ranked-rule-chip strong {
  font-size: 1.15rem;
  line-height: 1;
  color: #fff3cf;
}

.ranked-rule-chip span {
  color: rgba(255, 255, 255, 0.62);
  font-size: 0.78rem;
  font-weight: 600;
}

.ranked-meta-grid {
  display: grid;
  grid-template-columns: minmax(0, 220px) minmax(0, 1fr);
  gap: 12px;
  flex: 1 1 auto;
}

.ranked-best-card,
.ranked-leaderboard-card {
  display: grid;
  gap: 12px;
  min-width: 0;
  padding: 18px;
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.06);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.08);
}

.ranked-section-label,
.leaderboard-status {
  margin: 0;
}

.ranked-best-score {
  margin: 0;
  font-size: clamp(1.55rem, 3vw, 2rem);
  font-weight: 700;
  line-height: 0.96;
}

.ranked-best-meta {
  margin: 0;
  color: rgba(255, 255, 255, 0.66);
  font-size: 0.86rem;
  font-weight: 600;
}

.ranked-best-card[data-state="locked"] .ranked-best-score,
.ranked-best-card[data-state="empty"] .ranked-best-score {
  font-size: 1.16rem;
  line-height: 1.1;
}

.ranked-best-card[data-state="locked"] .ranked-best-score {
  color: rgba(255, 255, 255, 0.86);
}

.ranked-best-card[data-state="empty"] .ranked-best-score {
  color: #fff3cf;
}

.ranked-leaderboard-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.leaderboard-status {
  color: rgba(255, 255, 255, 0.62);
  font-size: 0.78rem;
  font-weight: 600;
  text-align: right;
}

.leaderboard-preview-list {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 10px;
}

.leaderboard-item {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.045);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.05);
  transition: transform 180ms ease, background 180ms ease, box-shadow 180ms ease;
}

.leaderboard-item:hover {
  transform: translateY(-1px);
  background: rgba(255, 255, 255, 0.075);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.08);
}

.leaderboard-item.is-viewer {
  background: linear-gradient(135deg, rgba(255, 219, 131, 0.15), rgba(255, 255, 255, 0.06));
  box-shadow: inset 0 0 0 1px rgba(255, 223, 154, 0.2);
}

.leaderboard-rank,
.leaderboard-name,
.leaderboard-score {
  margin: 0;
}

.leaderboard-rank {
  min-width: 40px;
  color: rgba(255, 228, 164, 0.8);
  font-size: 0.84rem;
  font-weight: 700;
}

.leaderboard-name {
  min-width: 0;
  color: #fff;
  font-size: 0.98rem;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.leaderboard-score {
  color: #fff3cf;
  font-size: 0.96rem;
  font-weight: 700;
  white-space: nowrap;
}

.ranked-auth-hint {
  margin: 0;
  color: rgba(255, 255, 255, 0.66);
  font-size: 0.88rem;
  line-height: 1.45;
}

.setup-cta {
  position: relative;
  width: 100%;
  min-width: 0;
  border: 0;
  border-radius: 22px;
  padding: 18px 20px;
  box-shadow: 0 18px 34px rgba(17, 17, 17, 0.16);
  font-size: 1.06rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: none;
}

.setup-cta-standard {
  background: linear-gradient(180deg, #151515, #2a2a2a);
  color: #fff;
}

.setup-cta-ranked {
  background: linear-gradient(135deg, #fff1a8 0%, #f7d157 36%, #c58709 100%);
  background-size: 200% 200%;
  color: #4c2d00;
  box-shadow:
    0 20px 36px rgba(197, 134, 9, 0.32),
    inset 0 1px 0 rgba(255, 255, 255, 0.82);
  animation: ranked-button-shine 3.2s linear infinite;
}

.setup-cta.is-locked {
  filter: saturate(0.78) brightness(0.98);
}

.setup-cta:active {
  transform: translateY(1px);
}

.setup-segment-button:focus-visible,
.ranked-queue-button:focus-visible,
.setup-cta:focus-visible {
  outline: none;
  box-shadow:
    0 0 0 4px rgba(17, 17, 17, 0.12),
    inset 0 0 0 1px rgba(17, 17, 17, 0.08);
}

.setup-mode-panel-ranked .ranked-queue-button:focus-visible,
.setup-mode-panel-ranked .setup-cta:focus-visible {
  box-shadow:
    0 0 0 4px rgba(255, 214, 123, 0.18),
    inset 0 0 0 1px rgba(255, 222, 148, 0.18);
}

.duel-lobby-screen {
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
}

.duel-lobby-shell {
  min-height: 100%;
  display: grid;
  place-items: center;
  padding: 12px 0 20px;
}

.duel-lobby-card {
  width: min(760px, 100%);
  display: grid;
  gap: 18px;
  padding: clamp(24px, 4vw, 34px);
  border-radius: 30px;
  color: #f7f4ea;
  background:
    radial-gradient(circle at top right, rgba(255, 207, 96, 0.2), transparent 34%),
    linear-gradient(155deg, rgba(11, 14, 21, 0.98), rgba(24, 28, 39, 0.96) 56%, rgba(51, 37, 10, 0.92) 100%);
  box-shadow:
    0 34px 72px rgba(11, 11, 16, 0.28),
    inset 0 0 0 1px rgba(255, 255, 255, 0.08);
}

.duel-lobby-kicker,
.duel-lobby-title,
.duel-lobby-message,
.duel-lobby-versus,
.duel-lobby-player-label,
.duel-lobby-player strong,
.duel-lobby-stat span,
.duel-lobby-stat strong,
.duel-lobby-list,
.duel-lobby-list li {
  margin: 0;
}

.duel-lobby-kicker {
  color: rgba(255, 228, 164, 0.72);
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.duel-lobby-title {
  font-size: clamp(2rem, 4vw, 2.9rem);
  line-height: 0.94;
  letter-spacing: -0.04em;
}

.duel-lobby-message {
  color: rgba(255, 255, 255, 0.7);
  font-size: 1rem;
  line-height: 1.55;
}

.duel-lobby-matchup {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  gap: 14px;
  align-items: center;
  padding: 18px;
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.06);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.08);
}

.duel-lobby-player {
  display: grid;
  gap: 6px;
  padding: 14px 16px;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.05);
}

.duel-lobby-player-opponent {
  background: linear-gradient(135deg, rgba(255, 224, 148, 0.12), rgba(255, 255, 255, 0.05));
}

.duel-lobby-player-label {
  color: rgba(255, 255, 255, 0.54);
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.duel-lobby-player strong {
  font-size: 1.18rem;
  font-weight: 700;
}

.duel-lobby-versus {
  color: rgba(255, 229, 170, 0.76);
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.duel-lobby-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.duel-lobby-stat {
  display: grid;
  gap: 8px;
  padding: 16px;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.05);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.06);
}

.duel-lobby-stat span {
  color: rgba(255, 255, 255, 0.54);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.duel-lobby-stat strong {
  font-size: 1.02rem;
  font-weight: 700;
}

.duel-lobby-list {
  list-style: none;
  display: grid;
  gap: 10px;
  padding: 0;
}

.duel-lobby-list li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.045);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.05);
  color: rgba(255, 255, 255, 0.9);
}

.duel-lobby-list li.is-you {
  background: linear-gradient(135deg, rgba(255, 234, 171, 0.14), rgba(255, 255, 255, 0.08));
  box-shadow:
    inset 0 0 0 1px rgba(255, 229, 158, 0.18),
    0 16px 32px rgba(0, 0, 0, 0.12);
}

.duel-lobby-list li span:last-child {
  color: rgba(255, 255, 255, 0.52);
  font-size: 0.82rem;
  font-weight: 600;
}

.duel-lobby-list li.is-you span:last-child {
  color: #ffe8ac;
}

.duel-lobby-actions {
  display: flex;
  justify-content: flex-end;
}

.duel-lobby-leave-button {
  border-radius: 18px;
  padding: 14px 18px;
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.08);
}

.duel-hud {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  gap: 10px;
  align-items: center;
}

.duel-hud-player {
  display: grid;
  gap: 3px;
  min-width: 0;
  padding: 12px 14px;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.72);
  box-shadow:
    inset 0 0 0 1px rgba(17, 17, 17, 0.06),
    0 14px 24px rgba(17, 17, 17, 0.08);
}

.duel-hud-player-opponent {
  background: linear-gradient(135deg, rgba(255, 235, 189, 0.92), rgba(255, 255, 255, 0.74));
}

.duel-hud-label,
.duel-hud-name,
.duel-hud-score,
.duel-hud-versus,
.duel-pressure-notice p {
  margin: 0;
}

.duel-hud-label {
  color: rgba(17, 17, 17, 0.5);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.duel-hud-name {
  min-width: 0;
  font-size: 1rem;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.duel-hud-score {
  color: rgba(17, 17, 17, 0.68);
  font-size: 0.88rem;
  font-weight: 600;
}

.duel-hud-versus {
  color: rgba(17, 17, 17, 0.54);
  font-size: 0.86rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.duel-pressure-notice {
  display: grid;
  justify-items: center;
}

.duel-pressure-notice p {
  padding: 12px 16px;
  border-radius: 999px;
  background: linear-gradient(135deg, rgba(17, 17, 17, 0.92), rgba(48, 48, 48, 0.92));
  color: #fff4cf;
  box-shadow: 0 18px 34px rgba(17, 17, 17, 0.18);
  font-size: 0.9rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  animation: duel-pressure-pop 280ms ease;
}

@keyframes setup-ambient-drift {
  0% {
    transform: translate3d(0, 0, 0) scale(1);
  }

  50% {
    transform: translate3d(16px, -10px, 0) scale(1.06);
  }

  100% {
    transform: translate3d(-8px, 12px, 0) scale(0.98);
  }
}

@keyframes setup-card-enter {
  0% {
    opacity: 0;
    transform: translateY(24px) scale(0.985);
  }

  100% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes duel-pressure-pop {
  0% {
    opacity: 0;
    transform: translateY(10px) scale(0.94);
  }

  65% {
    opacity: 1;
    transform: translateY(-2px) scale(1.02);
  }

  100% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.game-screen {
  height: 100%;
  display: flex;
  flex-direction: column;
  gap: 8px;
  position: relative;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px;
  position: relative;
  z-index: 1000;
  isolation: isolate;
}

h1 {
  margin: 0;
  font-size: clamp(1.15rem, 2vw, 1.75rem);
  line-height: 1.1;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.subtitle {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 0.85rem;
}

.status-cluster {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  width: 100%;
  min-width: 0;
}

.status-main,
.status-side {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.status-main {
  flex: 1 1 auto;
}

.status-side {
  flex: 0 0 auto;
  margin-left: auto;
}

.score {
  margin: 0;
  font-size: 0.96rem;
  color: var(--line);
  font-weight: 600;
  white-space: nowrap;
}

.game-screen.ranked-active .score {
  padding: 8px 12px;
  border: 2px solid var(--line);
  border-radius: 10px;
  background: #fff;
  min-width: 72px;
  text-align: center;
  font-size: 1rem;
  font-weight: 700;
  line-height: 1;
}

.game-screen.ranked-active .score,
.game-screen.ranked-active .timer,
.game-screen.ranked-active .session-title {
  min-height: 44px;
  box-sizing: border-box;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 8px 12px;
  font-size: 1.35rem;
  line-height: 1;
}

.session-title {
  margin: 0;
  padding: 8px 12px;
  border: 2px solid var(--line);
  border-radius: 10px;
  background: #fff;
  color: var(--line);
  font-size: 0.92rem;
  font-weight: 700;
  line-height: 1;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  white-space: nowrap;
}

.timer {
  padding: 8px 12px;
  border: 2px solid var(--line);
  border-radius: 10px;
  background: #fff;
  min-width: 96px;
  text-align: center;
  font-size: 1.45rem;
  font-weight: 700;
  line-height: 1;
  transition: color 160ms ease, border-color 160ms ease, transform 160ms ease;
}

.timer.warning {
  color: var(--danger);
  border-color: var(--danger);
  transform: scale(1.03);
}

.timer.pulse {
  animation: timer-pulse 0.85s ease-in-out infinite;
}

.ranked-points {
  min-width: 132px;
  color: var(--line);
  border-color: var(--line);
  white-space: nowrap;
}

.ranked-points.is-losing,
.ranked-points.is-gaining {
  color: var(--line);
  border-color: var(--line);
}


.map-panel {
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
  border: 2px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
  background: #cdcdcd;
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.07);
}

#map {
  height: 100%;
  width: 100%;
  background:
    radial-gradient(circle at 18% 20%, rgba(255, 255, 255, 0.52), transparent 22%),
    linear-gradient(180deg, #d7dfeb 0%, #c7d1df 100%);
}

.leaflet-container {
  background:
    radial-gradient(circle at 18% 20%, rgba(255, 255, 255, 0.52), transparent 22%),
    linear-gradient(180deg, #d7dfeb 0%, #c7d1df 100%);
}

.leaflet-container canvas {
  filter: contrast(1.08) saturate(1.06) brightness(0.98);
}

.city-pin-icon {
  background: transparent;
  border: 0;
}

.city-pin-dot {
  display: block;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: linear-gradient(180deg, #ff5b57 0%, #d72d2a 100%);
  border: 2px solid #fffdf8;
  box-shadow:
    0 0 0 3px rgba(19, 25, 34, 0.7),
    0 10px 18px rgba(0, 0, 0, 0.25);
}

.city-pin-label {
  background: rgba(18, 22, 29, 0.94);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.92);
  border-radius: 9px;
  box-shadow: 0 10px 18px rgba(0, 0, 0, 0.18);
  padding: 4px 8px;
  font: 700 12px/1.2 "Space Grotesk", "Segoe UI", sans-serif;
}

.city-pin-label::before {
  display: none;
}

.map-tools {
  position: absolute;
  top: 10px;
  right: 10px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  z-index: 750;
}

.map-tool-button {
  border: 1px solid #666;
  border-radius: 9px;
  padding: 6px 10px;
  font: inherit;
  font-size: 0.82rem;
  font-weight: 700;
  color: #1a1a1a;
  background: rgba(255, 255, 255, 0.92);
  cursor: pointer;
}

.map-tool-button.active {
  color: #fff;
  background: #111;
  border-color: #111;
}

.switch-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 92px;
}

.switch-label {
  font-weight: 700;
}

.switch-ui {
  position: relative;
  width: 34px;
  height: 18px;
  border-radius: 999px;
  background: #969696;
  border: 1px solid #6d6d6d;
  transition: background-color 160ms ease, border-color 160ms ease;
}

.switch-ui::after {
  content: "";
  position: absolute;
  top: 1px;
  left: 1px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #fff;
  transition: transform 160ms ease;
}

.switch-toggle.active .switch-ui {
  background: #111;
  border-color: #111;
}

.switch-toggle.active .switch-ui::after {
  transform: translateX(16px);
}

.home-button {
  display: inline-flex;
  align-items: center;
  min-width: 72px;
  justify-content: center;
}

.map-loading {
  position: absolute;
  top: 10px;
  left: 10px;
  padding: 7px 12px;
  border-radius: 999px;
  border: 1px solid rgba(27, 33, 42, 0.16);
  background: rgba(255, 252, 247, 0.94);
  color: #14181f;
  box-shadow: 0 10px 18px rgba(0, 0, 0, 0.08);
  font-weight: 700;
  font-size: 0.78rem;
  letter-spacing: 0.01em;
  z-index: 700;
  opacity: 0;
  pointer-events: none;
  transition: opacity 160ms ease;
}

.leaflet-control-attribution {
  background: rgba(255, 253, 249, 0.92) !important;
  border-top-left-radius: 10px;
  border: 1px solid rgba(27, 33, 42, 0.12);
  border-bottom: 0;
  border-right: 0;
  color: #3f4853;
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.08);
}

.map-loading.visible {
  opacity: 1;
}

/* ---- Round hint notes ---------------------------------------- */
.hint-note {
  position: absolute;
  z-index: 680;
  background: var(--panel-strong);
  border: 2px solid var(--line);
  border-radius: 10px;
  padding: 8px 11px;
  box-shadow: 3px 4px 0 rgba(0, 0, 0, 0.18);
  max-width: 148px;
  pointer-events: none;
  /* entry animation state */
  opacity: 0;
  transform: scale(0.82) translateY(8px);
  transition: opacity 0.28s ease, transform 0.28s ease;
}

.hint-note.hint-visible {
  opacity: 1;
  transform: scale(1) translateY(0) rotate(var(--hint-tilt, 0deg));
}

/* corner positions - inside the map panel */
.hint-note--1 {
  top: 12px;
  left: 12px;
  --hint-tilt: -2deg;
  transform-origin: top left;
}

.hint-note--2 {
  bottom: 12px;
  left: 12px;
  --hint-tilt: 2deg;
  transform-origin: bottom left;
}

.hint-note--3 {
  bottom: 12px;
  right: 12px;
  --hint-tilt: -1.5deg;
  transform-origin: bottom right;
}

.hint-note--4 {
  top: 12px;
  right: 12px;
  --hint-tilt: 1.5deg;
  transform-origin: top right;
  max-width: 174px;
}

.hint-note__label {
  display: block;
  font-size: 0.6rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--muted);
  margin-bottom: 4px;
}

.hint-note__body {
  display: block;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--ink);
  line-height: 1.25;
}

.hint-note__flag {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 54px;
  margin-top: 4px;
}

.hint-note__flag-image {
  display: block;
  width: 72px;
  height: 54px;
  object-fit: cover;
  border-radius: 6px;
  border: 1px solid rgba(42, 42, 42, 0.16);
  background: #f6f4ef;
}

.hint-note__flag--fallback {
  font-size: 1.6rem;
  line-height: 1;
  letter-spacing: 0.04em;
  font-weight: 700;
}

.hint-note__photo {
  display: block;
  width: 152px;
  height: 102px;
  object-fit: cover;
  border-radius: 6px;
  margin-top: 3px;
  background: var(--soft-line);
}

.hint-note__photo--fallback {
  object-fit: contain;
  padding: 6px;
  background: #f2eee4;
}

/* ---- end hint notes ----------------------------------------- */

.form-panel,
.feedback {
  border: 1px solid #c6c6be;
  border-radius: 10px;
  background: var(--panel);
  padding: 9px 10px;
  transition:
    opacity 180ms ease,
    transform 180ms ease,
    border-color 180ms ease,
    background-color 180ms ease,
    box-shadow 180ms ease;
}

label {
  display: block;
  margin-bottom: 6px;
  font-size: 0.86rem;
  font-weight: 700;
}

.answer-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  align-items: start;
}

.answer-input-wrap {
  position: relative;
}

input,
button {
  border: 1px solid #999991;
  border-radius: 9px;
  padding: 9px 10px;
  font: inherit;
  color: var(--ink);
  background: #fff;
  transition:
    border-color 160ms ease,
    box-shadow 160ms ease,
    background-color 160ms ease,
    color 160ms ease,
    filter 160ms ease,
    transform 160ms ease;
}

input {
  width: 100%;
}

button {
  background: #111;
  color: #fff;
  border-color: #111;
  cursor: pointer;
  font-weight: 700;
  transition: filter 160ms ease;
  text-wrap: nowrap;
}

button:hover:not(:disabled) {
  filter: brightness(1.12);
}

input:focus-visible,
button:focus-visible {
  outline: none;
  border-color: #111;
  box-shadow: 0 0 0 3px rgba(17, 17, 17, 0.14);
}

button:disabled,
input:disabled {
  cursor: not-allowed;
  opacity: 0.56;
}

.setup-screen .mode-button {
  border: 1px solid rgba(17, 17, 17, 0.12);
  border-radius: 18px;
  padding: 15px 12px;
  background: rgba(255, 255, 255, 0.8);
  color: #121212;
  box-shadow:
    inset 0 0 0 1px rgba(17, 17, 17, 0.03),
    0 10px 24px rgba(17, 17, 17, 0.04);
  font: 700 1rem/1.1 "Space Grotesk", "Segoe UI", sans-serif;
}

.setup-screen .mode-button.active {
  background: #111;
  color: #fff;
  border-color: #111;
}

.setup-screen .setup-slider {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 14px;
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: linear-gradient(90deg, rgba(17, 17, 17, 0.14), rgba(17, 17, 17, 0.06));
  color: black;
  opacity: 0.92;
}

.setup-screen .setup-slider:hover {
  opacity: 1;
}

.setup-screen .setup-slider::-webkit-slider-thumb,
.setup-screen .setup-slider::-moz-range-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 22px;
  height: 22px;
  border: 0;
  border-radius: 50%;
  background: #111;
  box-shadow: 0 6px 18px rgba(17, 17, 17, 0.18);
}

.setup-screen .setup-start-button {
  width: 100%;
  min-width: 0;
  padding: 17px 20px;
  border-radius: 20px;
  border: 2px solid #111;
  background: #111;
  color: #fff;
  box-shadow: 0 18px 34px rgba(17, 17, 17, 0.14);
  font: 700 1.18rem/1 "Space Grotesk", "Segoe UI", sans-serif;
  letter-spacing: 0.05em;
}

.setup-screen .setup-start-button-ranked {
  width: 100%;
  max-width: 280px;
  border-color: #b67a08;
  background: linear-gradient(135deg, #fff4ae 0%, #f9d448 38%, #c58609 100%);
  background-size: 200% 200%;
  color: #4d2f00;
  box-shadow:
    0 16px 34px rgba(197, 134, 9, 0.26),
    inset 0 1px 0 rgba(255, 255, 255, 0.82);
}

.map-panel .map-tool-button {
  border: 1px solid #666;
  color: #1a1a1a;
  background: rgba(255, 255, 255, 0.92);
}

.map-panel .map-tool-button.active {
  color: #fff;
  background: #111;
  border-color: #111;
}

.autocomplete-list {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  margin: 0;
  padding: 4px;
  list-style: none;
  border: 1px solid #9d9d96;
  border-radius: 9px;
  background: #fff;
  max-height: 210px;
  overflow-y: auto;
  z-index: 820;
  box-shadow: 0 10px 22px rgba(0, 0, 0, 0.12);
}

.autocomplete-item {
  padding: 7px 9px;
  border-radius: 7px;
  cursor: pointer;
}

.autocomplete-item + .autocomplete-item {
  margin-top: 2px;
}

.autocomplete-item.active,
.autocomplete-item:hover {
  background: #111;
  color: #fff;
}

.controls {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

#skipButton {
  background: #fff;
  color: #111;
  border-color: #767676;
}

.feedback {
  min-height: 56px;
}

.feedback.is-empty {
  opacity: 0;
  transform: translateY(6px);
  border-color: transparent;
  background: transparent;
  box-shadow: none;
}

.feedback.is-pulsing {
  animation: feedback-pulse 320ms ease;
}

.feedback p {
  margin: 0;
}

.feedback #answerReveal {
  margin-top: 4px;
  font-weight: 700;
}

.ranked-finish-panel {
  position: relative;
  display: grid;
  gap: 8px;
  justify-items: center;
  padding: 20px 18px;
  border: 2px solid var(--line);
  border-radius: 18px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(247, 245, 238, 0.96));
  box-shadow: 0 14px 28px rgba(0, 0, 0, 0.08);
  overflow: hidden;
  text-align: center;
}

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

.ranked-finish-panel[data-variant="celebrate"] {
  border-color: #c69219;
  background: linear-gradient(180deg, #fff9df 0%, #ffe8a2 100%);
}

.ranked-finish-panel[data-variant="retry"] {
  border-color: #8f8f8f;
  background: linear-gradient(180deg, #f4f4f4 0%, #ebebeb 100%);
}

.ranked-finish-burst {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
}

.ranked-finish-burst span {
  position: absolute;
  top: -18px;
  left: var(--x);
  width: 10px;
  height: 18px;
  border-radius: 999px;
  background: hsl(var(--hue) 90% 58%);
  transform: rotate(var(--rot));
  opacity: 0;
  animation: ranked-confetti-fall 1.8s ease-out forwards;
  animation-delay: var(--delay);
}

.ranked-finish-emoji {
  position: relative;
  z-index: 1;
  font-size: clamp(3.4rem, 7vw, 5.1rem);
  line-height: 1;
  font-family: "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji", sans-serif;
}

.ranked-finish-title,
.ranked-finish-subtitle {
  position: relative;
  z-index: 1;
  margin: 0;
}

.ranked-finish-title {
  font-size: clamp(1.35rem, 2.8vw, 1.85rem);
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.ranked-finish-subtitle {
  font-size: 1rem;
  color: var(--muted);
  font-weight: 600;
}

.game-screen.game-summary-active {
  justify-content: center;
}

.game-screen.game-summary-active .status-cluster,
.game-screen.game-summary-active .duel-hud,
.game-screen.game-summary-active .duel-pressure-notice,
.game-screen.game-summary-active .map-panel,
.game-screen.game-summary-active .form-panel,
.game-screen.game-summary-active .controls,
.game-screen.game-summary-active .feedback,
.game-screen.game-summary-active .ranked-finish-panel {
  display: none !important;
}

.game-summary-panel {
  flex: 1 1 auto;
  min-height: 0;
  display: grid;
  place-items: center;
  padding: clamp(8px, 1.8vw, 22px);
  overflow: hidden;
  background:
    radial-gradient(circle at top, rgba(255, 224, 148, 0.2), transparent 30%),
    linear-gradient(180deg, rgba(250, 249, 244, 0.96), rgba(242, 240, 233, 0.92));
  border: 1px solid rgba(17, 17, 17, 0.08);
  border-radius: 28px;
  box-shadow:
    0 30px 80px rgba(17, 17, 17, 0.08),
    inset 0 1px 0 rgba(255, 255, 255, 0.88);
}

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

.game-summary-shell {
  width: min(920px, 100%);
  display: grid;
  gap: 16px;
  align-content: center;
  justify-items: center;
  text-align: center;
  animation: summary-shell-in 520ms cubic-bezier(0.2, 0.9, 0.2, 1);
}

.game-summary-hero {
  position: relative;
  width: 100%;
  display: grid;
  justify-items: center;
  gap: 8px;
  padding: clamp(18px, 3vw, 28px) 16px 8px;
}

.game-summary-hero::before {
  content: "";
  position: absolute;
  inset: 0 auto auto 50%;
  width: min(420px, 78%);
  height: 180px;
  border-radius: 999px;
  transform: translateX(-50%);
  background: radial-gradient(circle, rgba(160, 174, 192, 0.2), transparent 70%);
  pointer-events: none;
  filter: blur(2px);
}

.game-summary-hero[data-variant="celebrate"]::before {
  background: radial-gradient(circle, rgba(235, 190, 88, 0.3), transparent 72%);
}

.game-summary-hero[data-variant="retry"]::before {
  background: radial-gradient(circle, rgba(194, 161, 161, 0.18), transparent 72%);
}

.game-summary-emoji {
  display: none;
}

.game-summary-emoji:empty {
  display: none;
}

.game-summary-eyebrow,
.game-summary-score,
.game-summary-title,
.game-summary-subtitle {
  position: relative;
  z-index: 1;
  margin: 0;
}

.game-summary-eyebrow {
  color: rgba(17, 17, 17, 0.46);
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.game-summary-score {
  font-family: "Space Grotesk", "Segoe UI", sans-serif;
  font-size: clamp(3.2rem, 11vw, 5.8rem);
  font-weight: 700;
  letter-spacing: -0.07em;
  line-height: 0.9;
  color: #111;
}

.game-summary-hero[data-variant="celebrate"] .game-summary-score {
  color: #8f6412;
}

.game-summary-title {
  font-size: clamp(1.15rem, 3vw, 1.95rem);
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.game-summary-subtitle {
  max-width: 540px;
  color: rgba(17, 17, 17, 0.5);
  font-size: 0.94rem;
  font-weight: 600;
}

.game-summary-subtitle:empty,
.game-summary-eyebrow:empty {
  display: none;
}

.game-summary-stats {
  width: 100%;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.game-summary-stat {
  display: grid;
  justify-items: center;
  gap: 8px;
  padding: 16px 14px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.74);
  box-shadow:
    inset 0 0 0 1px rgba(17, 17, 17, 0.06),
    0 10px 24px rgba(17, 17, 17, 0.04);
  animation: summary-item-in 440ms ease both;
}

.game-summary-stat:nth-child(1) {
  animation-delay: 70ms;
}

.game-summary-stat:nth-child(2) {
  animation-delay: 120ms;
}

.game-summary-stat:nth-child(3) {
  animation-delay: 170ms;
}

.game-summary-stat-icon,
.game-summary-stat-label,
.game-summary-stat-value {
  margin: 0;
}

.game-summary-stat-icon {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  background: rgba(17, 17, 17, 0.05);
  color: rgba(17, 17, 17, 0.64);
  font-family: "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji", sans-serif;
  font-size: 1.05rem;
  font-weight: 700;
  line-height: 1;
}

.game-summary-stat-value {
  font-size: clamp(1.15rem, 2.6vw, 1.45rem);
  font-weight: 700;
  line-height: 1;
}

.game-summary-stat-label {
  color: rgba(17, 17, 17, 0.4);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.game-summary-round-list {
  --summary-round-columns: 4;
  width: 100%;
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  grid-template-columns: repeat(var(--summary-round-columns), minmax(0, 1fr));
  gap: 10px;
}

.game-summary-round-item {
  min-height: 68px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  padding: 14px 16px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.82);
  box-shadow:
    inset 0 0 0 1px rgba(17, 17, 17, 0.06),
    0 10px 24px rgba(17, 17, 17, 0.04);
  transition: transform 180ms ease, box-shadow 180ms ease, background 180ms ease;
  animation: summary-item-in 480ms ease both;
}

.game-summary-round-item:hover {
  transform: translateY(-1px);
  box-shadow:
    inset 0 0 0 1px rgba(17, 17, 17, 0.08),
    0 14px 30px rgba(17, 17, 17, 0.07);
}

.game-summary-round-city,
.game-summary-round-status {
  margin: 0;
}

.game-summary-round-city {
  min-width: 0;
  font-size: 0.98rem;
  font-weight: 700;
  line-height: 1.15;
  text-align: left;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.game-summary-round-status {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  font-size: 0.94rem;
  font-weight: 700;
  line-height: 1;
}

.game-summary-round-item.is-correct {
  background: linear-gradient(180deg, rgba(236, 248, 241, 0.96), rgba(228, 244, 235, 0.92));
}

.game-summary-round-item.is-correct .game-summary-round-status {
  background: rgba(46, 125, 83, 0.12);
  color: #2e7d53;
}

.game-summary-round-item.is-wrong,
.game-summary-round-item.is-timeout,
.game-summary-round-item.is-skipped {
  background: linear-gradient(180deg, rgba(250, 243, 242, 0.96), rgba(247, 238, 238, 0.92));
}

.game-summary-round-item.is-wrong .game-summary-round-status,
.game-summary-round-item.is-timeout .game-summary-round-status,
.game-summary-round-item.is-skipped .game-summary-round-status {
  background: rgba(176, 84, 84, 0.12);
  color: #b05454;
}

.game-summary-actions {
  display: flex;
  justify-content: center;
  gap: 12px;
  flex-wrap: wrap;
}

.game-summary-actions button {
  min-width: 220px;
  padding-inline: 26px;
  border-radius: 999px;
  box-shadow: 0 16px 32px rgba(17, 17, 17, 0.1);
  animation: summary-item-in 520ms ease both;
  animation-delay: 220ms;
}

.game-summary-action-secondary {
  background: rgba(255, 255, 255, 0.78);
  color: #111;
  border-color: rgba(17, 17, 17, 0.14);
  box-shadow:
    inset 0 0 0 1px rgba(17, 17, 17, 0.03),
    0 12px 26px rgba(17, 17, 17, 0.06);
}

@keyframes summary-shell-in {
  from {
    opacity: 0;
    transform: translateY(18px) scale(0.98);
  }

  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes summary-item-in {
  from {
    opacity: 0;
    transform: translateY(12px) scale(0.985);
  }

  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.ranked-countdown-overlay {
  position: absolute;
  inset: 0;
  z-index: 980;
  display: grid;
  place-items: center;
  padding: 20px;
  background:
    radial-gradient(circle at top, rgba(255, 223, 127, 0.2), transparent 34%),
    linear-gradient(180deg, rgba(12, 12, 12, 0.18), rgba(12, 12, 12, 0.48));
  backdrop-filter: blur(6px);
}

.ranked-countdown-overlay[hidden] {
  display: none;
}

.ranked-countdown-card {
  position: relative;
  width: min(540px, calc(100% - 24px));
  display: grid;
  justify-items: center;
  gap: 12px;
  padding: 30px 26px 28px;
  border: 1px solid rgba(255, 255, 255, 0.56);
  border-radius: 28px;
  background:
    linear-gradient(140deg, rgba(255, 255, 255, 0.94), rgba(249, 241, 211, 0.86));
  box-shadow:
    0 24px 80px rgba(0, 0, 0, 0.2),
    inset 0 1px 0 rgba(255, 255, 255, 0.82);
  overflow: hidden;
  transform: translateY(10px) scale(0.94);
  opacity: 0;
}

.ranked-countdown-card::before,
.ranked-countdown-card::after {
  content: "";
  position: absolute;
  inset: auto;
  border-radius: 999px;
  pointer-events: none;
}

.ranked-countdown-card::before {
  width: 280px;
  height: 280px;
  top: -110px;
  right: -70px;
  background: radial-gradient(circle, rgba(255, 219, 102, 0.44), transparent 72%);
}

.ranked-countdown-card::after {
  width: 220px;
  height: 220px;
  bottom: -110px;
  left: -60px;
  background: radial-gradient(circle, rgba(17, 17, 17, 0.1), transparent 72%);
}

.ranked-countdown-overlay.is-animating .ranked-countdown-card {
  animation: ranked-countdown-pop 760ms cubic-bezier(0.2, 0.9, 0.2, 1) forwards;
}

.ranked-countdown-kicker,
.ranked-countdown-value,
.ranked-countdown-hint {
  position: relative;
  z-index: 1;
  margin: 0;
  text-align: center;
}

.ranked-countdown-value:empty,
.ranked-countdown-hint:empty {
  display: none;
}

.ranked-countdown-kicker {
  font-size: 0.92rem;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: rgba(17, 17, 17, 0.62);
}

.ranked-countdown-value {
  font-family: "Space Grotesk", "Segoe UI", sans-serif;
  font-size: clamp(4.8rem, 14vw, 8.6rem);
  font-weight: 700;
  letter-spacing: -0.05em;
  line-height: 0.9;
  color: #111;
  text-shadow: 0 10px 26px rgba(0, 0, 0, 0.12);
}

.ranked-countdown-hint {
  font-size: 1rem;
  font-weight: 600;
  color: rgba(17, 17, 17, 0.7);
}

.ranked-countdown-words {
  position: relative;
  z-index: 1;
  display: none;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
}

.ranked-countdown-words span {
  opacity: 0;
  transform: translateY(16px) scale(0.86);
  color: #ffe49a;
  font-family: "Space Grotesk", "Segoe UI", sans-serif;
  font-size: clamp(1.2rem, 3.8vw, 2rem);
  font-weight: 700;
  letter-spacing: 0.01em;
  line-height: 1;
  white-space: nowrap;
  text-shadow: 0 10px 24px rgba(0, 0, 0, 0.22);
}

.ranked-countdown-overlay[data-stage="launch"] .ranked-countdown-card {
  background:
    linear-gradient(140deg, rgba(17, 17, 17, 0.94), rgba(52, 52, 52, 0.92));
  border-color: rgba(255, 222, 138, 0.5);
}

.ranked-countdown-overlay[data-stage="launch"] .ranked-countdown-kicker,
.ranked-countdown-overlay[data-stage="launch"] .ranked-countdown-hint {
  color: rgba(255, 255, 255, 0.76);
}

.ranked-countdown-overlay[data-stage="launch"] .ranked-countdown-value {
  font-size: clamp(2.3rem, 6vw, 4.2rem);
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: #ffe49a;
  text-shadow: 0 10px 28px rgba(255, 199, 71, 0.24);
}

.ranked-countdown-overlay[data-stage="launch"] .ranked-countdown-words {
  display: flex;
}

.ranked-countdown-overlay[data-stage="launch"].is-animating .ranked-countdown-words span {
  animation: ranked-countdown-word-pop 420ms cubic-bezier(0.2, 0.9, 0.2, 1) forwards;
}

.ranked-countdown-overlay[data-stage="launch"].is-animating .ranked-countdown-words span:nth-child(1) {
  animation-delay: 0.02s;
}

.ranked-countdown-overlay[data-stage="launch"].is-animating .ranked-countdown-words span:nth-child(2) {
  animation-delay: 0.22s;
}

.ranked-countdown-overlay[data-stage="launch"].is-animating .ranked-countdown-words span:nth-child(3) {
  animation-delay: 0.42s;
}

.ranked-countdown-overlay[data-stage="launch"].is-animating .ranked-countdown-words span:nth-child(4) {
  animation-delay: 0.62s;
}

.feedback.neutral {
  border-left: 4px solid #505050;
}

.feedback.correct {
  border-left: 4px solid var(--ok);
}

.feedback.wrong,
.feedback.timeout {
  border-left: 4px solid var(--danger);
}

.auth-shell {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  min-height: 48px;
  opacity: 1;
  transition: opacity 180ms ease;
  position: relative;
  z-index: 1100;
}

.auth-shell-loading {
  opacity: 0;
  pointer-events: none;
}

.auth-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.topbar-button {
  min-width: 92px;
  padding: 10px 14px;
  border-radius: 999px;
  font-size: 0.92rem;
}

.topbar-button-secondary {
  background: rgba(255, 255, 255, 0.92);
  color: #111;
  border-color: #777;
}

.account-menu {
  position: relative;
  z-index: 1150;
}

.account-button {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-radius: 999px;
  min-width: 132px;
  justify-content: space-between;
}

.account-chevron {
  width: 10px;
  height: 10px;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(45deg) translateY(-1px);
  transition: transform 180ms ease;
}

.account-button[aria-expanded="true"] .account-chevron {
  transform: rotate(225deg) translateY(-1px);
}

.account-dropdown {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  min-width: 220px;
  padding: 12px;
  border-radius: 16px;
  border: 1px solid var(--soft-line);
  background: var(--panel-strong);
  box-shadow: var(--shadow-soft);
  z-index: 1250;
}

.account-dropdown-label {
  margin: 0 0 10px;
  color: var(--muted);
  font-size: 0.9rem;
}

.dropdown-action {
  width: 100%;
  justify-content: center;
}

.auth-modal {
  position: fixed;
  inset: 0;
  z-index: 1200;
  display: grid;
  place-items: center;
  padding: clamp(12px, 3vw, 28px);
}

.auth-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(14, 14, 14, 0.42);
  backdrop-filter: blur(8px);
}

.auth-card {
  position: relative;
  width: min(560px, 100%);
  max-height: min(92vh, 860px);
  overflow: auto;
  border-radius: 26px;
  border: 1px solid rgba(34, 34, 34, 0.1);
  background:
    radial-gradient(circle at top right, rgba(17, 17, 17, 0.06), transparent 30%),
    var(--panel-strong);
  box-shadow: var(--shadow);
  padding: clamp(18px, 4vw, 28px);
  animation: auth-card-in 220ms ease;
}

.auth-close-button {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 40px;
  height: 40px;
  padding: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.84);
  color: #111;
  border-color: rgba(17, 17, 17, 0.18);
}

.auth-card-header {
  display: grid;
  gap: 8px;
  margin-bottom: 16px;
}

.auth-kicker {
  margin: 0;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-size: 0.73rem;
  color: var(--muted);
}

.auth-card h2 {
  margin: 0;
  font-size: clamp(1.5rem, 5vw, 2rem);
  line-height: 1;
}

.auth-modal-subtitle {
  margin: 0;
  color: var(--muted);
  max-width: 36ch;
  line-height: 1.45;
}

.auth-mode-switch {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  padding: 6px;
  border-radius: 18px;
  border: 1px solid var(--soft-line);
  background: rgba(17, 17, 17, 0.04);
  margin-bottom: 18px;
}

.auth-mode-button {
  border-radius: 14px;
  background: transparent;
  color: #111;
  border-color: transparent;
  padding: 12px 14px;
}

.auth-mode-button.active {
  background: #111;
  color: #fff;
  border-color: #111;
}

.auth-panel {
  display: block;
}

.auth-form {
  display: grid;
  gap: 14px;
}

.form-field {
  display: grid;
  gap: 7px;
}

.form-field input {
  min-height: 48px;
}

.form-field.is-error input {
  border-color: var(--danger);
  box-shadow: 0 0 0 3px rgba(161, 28, 28, 0.12);
}

.form-field.is-success input {
  border-color: rgba(20, 90, 39, 0.45);
}

.form-field.is-pending input {
  border-color: rgba(17, 17, 17, 0.35);
}

.input-shell {
  position: relative;
}

.input-shell input {
  padding-right: 92px;
}

.password-toggle {
  position: absolute;
  top: 50%;
  right: 8px;
  transform: translateY(-50%);
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 36px;
  padding: 0 11px;
  border-radius: 999px;
  background: #fff;
  color: #111;
  border-color: rgba(17, 17, 17, 0.16);
}

.password-toggle.is-visible {
  background: #111;
  color: #fff;
  border-color: #111;
}

.password-eye {
  position: relative;
  width: 16px;
  height: 10px;
  border: 2px solid currentColor;
  border-radius: 999px / 80%;
}

.password-eye::before {
  content: "";
  position: absolute;
  inset: 2px;
  border-radius: 50%;
  background: currentColor;
}

.password-toggle.is-visible .password-eye::after {
  content: "";
  position: absolute;
  width: 2px;
  height: 16px;
  background: currentColor;
  top: -4px;
  left: 7px;
  transform: rotate(45deg);
}

.password-toggle-label {
  font-size: 0.78rem;
  font-weight: 700;
}

.field-message {
  margin: 0;
  min-height: 1.2em;
  font-size: 0.85rem;
  line-height: 1.35;
  color: var(--muted);
}

.field-message.is-error {
  color: var(--danger);
}

.field-message.is-success {
  color: var(--ok);
}

.field-message.is-pending {
  color: var(--muted);
}

.form-status {
  border-radius: 14px;
  padding: 11px 12px;
  border: 1px solid rgba(17, 17, 17, 0.12);
  background: rgba(17, 17, 17, 0.04);
  color: #111;
  font-size: 0.92rem;
  line-height: 1.45;
}

.form-status.is-error {
  border-color: rgba(161, 28, 28, 0.18);
  background: var(--danger-soft);
  color: var(--danger);
}

.form-status.is-success {
  border-color: rgba(20, 90, 39, 0.18);
  background: var(--ok-soft);
  color: var(--ok);
}

.auth-inline-actions {
  display: flex;
  justify-content: flex-end;
}

.link-button {
  appearance: none;
  border: 0;
  background: transparent;
  color: #111;
  padding: 0;
  font-weight: 700;
  text-decoration: underline;
  text-underline-offset: 0.18em;
}

.auth-submit-button {
  min-height: 52px;
  border-radius: 16px;
  font-size: 1rem;
  letter-spacing: 0.02em;
}

.auth-switch-copy {
  margin: 0;
  color: var(--muted);
  font-size: 0.92rem;
}

.password-checklist-card {
  border: 1px solid var(--soft-line);
  border-radius: 20px;
  padding: 14px;
  background:
    linear-gradient(180deg, rgba(17, 17, 17, 0.02), rgba(17, 17, 17, 0)),
    #fbfbfa;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.7);
}

.password-checklist-header {
  margin-bottom: 12px;
}

.password-checklist-title {
  margin: 0 0 4px;
  font-weight: 700;
}

.password-checklist-subtitle {
  margin: 0;
  color: var(--muted);
  font-size: 0.86rem;
  line-height: 1.45;
}

.password-checklist {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.password-rule {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 12px;
  border-radius: 15px;
  border: 1px solid rgba(17, 17, 17, 0.09);
  background: rgba(255, 255, 255, 0.78);
  color: #4e4e4e;
  transition:
    border-color 180ms ease,
    background-color 180ms ease,
    color 180ms ease,
    transform 180ms ease;
}

.password-rule.is-met {
  color: var(--ok);
  border-color: rgba(20, 90, 39, 0.18);
  background: var(--ok-soft);
}

.password-rule.is-unmet {
  color: var(--danger);
  border-color: rgba(161, 28, 28, 0.18);
  background: var(--danger-soft);
}

.rule-icon {
  position: relative;
  flex: 0 0 auto;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 1.5px solid rgba(17, 17, 17, 0.24);
  background: #fff;
  transition:
    background-color 180ms ease,
    border-color 180ms ease,
    transform 180ms ease;
}

.password-rule.is-met .rule-icon {
  background: var(--ok);
  border-color: var(--ok);
}

.password-rule.is-met .rule-icon::before {
  content: "";
  position: absolute;
  left: 6px;
  top: 3px;
  width: 5px;
  height: 9px;
  border-right: 2px solid #fff;
  border-bottom: 2px solid #fff;
  transform: rotate(42deg);
}

.password-rule.is-unmet .rule-icon {
  border-color: var(--danger);
}

.password-rule.is-unmet .rule-icon::before,
.password-rule.is-unmet .rule-icon::after {
  content: "";
  position: absolute;
  left: 9px;
  top: 4px;
  width: 2px;
  height: 10px;
  background: var(--danger);
}

.password-rule.is-unmet .rule-icon::before {
  transform: rotate(45deg);
}

.password-rule.is-unmet .rule-icon::after {
  transform: rotate(-45deg);
}

.password-specials {
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 0.8rem;
  line-height: 1.5;
}

.password-specials code {
  font-family: ui-monospace, "SFMono-Regular", Consolas, monospace;
  font-size: 0.78rem;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 22px;
  z-index: 1300;
  transform: translateX(-50%);
  min-width: min(420px, calc(100vw - 28px));
  max-width: calc(100vw - 28px);
  padding: 12px 16px;
  border-radius: 16px;
  border: 1px solid rgba(17, 17, 17, 0.12);
  background: rgba(255, 255, 255, 0.96);
  color: #111;
  box-shadow: var(--shadow-soft);
}

.toast.is-success {
  border-color: rgba(20, 90, 39, 0.18);
}

.toast.is-error {
  border-color: rgba(161, 28, 28, 0.2);
}

@keyframes auth-card-in {
  from {
    opacity: 0;
    transform: translateY(14px) scale(0.985);
  }

  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes feedback-pulse {
  0% {
    transform: translateY(0);
  }

  45% {
    transform: translateY(-2px);
    box-shadow: 0 0 0 4px rgba(161, 28, 28, 0.08);
  }

  100% {
    transform: translateY(0);
    box-shadow: none;
  }
}

@keyframes timer-pulse {
  0% {
    transform: scale(1);
    box-shadow: 0 0 0 0 rgba(161, 28, 28, 0.06);
  }

  45% {
    transform: scale(1.06);
    box-shadow: 0 0 0 5px rgba(161, 28, 28, 0.12);
  }

  100% {
    transform: scale(1);
    box-shadow: 0 0 0 0 rgba(161, 28, 28, 0);
  }
}

@keyframes ranked-button-shine {
  0% {
    background-position: 0% 50%;
    box-shadow:
      0 14px 30px rgba(197, 134, 9, 0.24),
      inset 0 1px 0 rgba(255, 255, 255, 0.82);
  }

  50% {
    background-position: 100% 50%;
    box-shadow:
      0 18px 34px rgba(197, 134, 9, 0.32),
      inset 0 1px 0 rgba(255, 255, 255, 0.9);
  }

  100% {
    background-position: 0% 50%;
    box-shadow:
      0 14px 30px rgba(197, 134, 9, 0.24),
      inset 0 1px 0 rgba(255, 255, 255, 0.82);
  }
}

@keyframes ranked-confetti-fall {
  0% {
    opacity: 0;
    transform: translateY(-24px) rotate(var(--rot));
  }

  12% {
    opacity: 1;
  }

  100% {
    opacity: 0;
    transform: translateY(185px) rotate(calc(var(--rot) + 160deg));
  }
}

@keyframes ranked-countdown-pop {
  0% {
    opacity: 0;
    transform: translateY(12px) scale(0.92);
  }

  30% {
    opacity: 1;
    transform: translateY(-2px) scale(1.03);
  }

  100% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes ranked-countdown-word-pop {
  0% {
    opacity: 0;
    transform: translateY(18px) scale(0.86);
  }

  60% {
    opacity: 1;
    transform: translateY(-2px) scale(1.08);
  }

  100% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@media (max-width: 760px) {
  .app {
    padding: 8px;
    gap: 6px;
  }

  .setup-screen {
    overflow: auto;
    padding-right: 2px;
  }

  .setup-shell {
    height: auto;
    min-height: 100%;
    grid-template-columns: 1fr;
    grid-template-areas:
      "intro"
      "standard"
      "ranked";
  }

  .setup-intro-title {
    max-width: 14ch;
  }

  .setup-segmented,
  .setup-control-grid,
  .ranked-meta-grid,
  .ranked-rules,
  .duel-lobby-matchup,
  .duel-lobby-stats,
  .duel-hud {
    grid-template-columns: 1fr;
  }

  .setup-mode-panel {
    border-radius: 24px;
  }

  .leaderboard-status {
    text-align: left;
  }

  .topbar {
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
  }

  .auth-shell,
  .auth-actions,
  .account-menu {
    width: 100%;
  }

  .auth-actions {
    justify-content: stretch;
  }

  .topbar-button,
  .account-button {
    flex: 1 1 0;
    justify-content: center;
  }

  .account-dropdown {
    left: 0;
    right: 0;
    min-width: 0;
  }

  .status-cluster {
    gap: 8px;
  }

  .ranked-queue-switch {
    grid-template-columns: 1fr;
  }

  .duel-lobby-actions {
    justify-content: stretch;
  }

  .duel-lobby-leave-button {
    width: 100%;
  }

  .duel-hud-versus,
  .duel-lobby-versus {
    display: none;
  }

  .ranked-finish-panel {
    padding: 18px 16px;
  }

  .ranked-countdown-card {
    width: min(500px, calc(100% - 20px));
    padding: 28px 22px 24px;
  }

  .map-panel {
    min-height: 50vh;
  }

  .timer {
    font-size: 1.25rem;
    min-width: 86px;
    padding: 7px 10px;
  }

  .session-title {
    font-size: 0.8rem;
  }

  .game-screen.ranked-active .score {
    min-width: 64px;
  }

  .ranked-points {
    min-width: 120px;
  }

  .game-summary-panel {
    padding: 12px;
  }

  .game-summary-shell {
    gap: 14px;
  }

  .game-summary-stats {
    gap: 10px;
  }

  .game-summary-round-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .map-tool-button {
    padding: 6px 8px;
    font-size: 0.77rem;
  }

  label {
    margin-bottom: 4px;
  }
}

@media (max-width: 520px) {
  .subtitle {
    display: none;
  }

  .setup-mode-panel {
    padding: 18px;
    border-radius: 20px;
  }

  .setup-intro-title {
    font-size: clamp(1.6rem, 10vw, 2.4rem);
  }

  .setup-intro-copy,
  .ranked-auth-hint {
    font-size: 0.9rem;
  }

  .ranked-leaderboard-head {
    flex-direction: column;
    align-items: flex-start;
  }

  .duel-lobby-card {
    padding: 18px;
    border-radius: 22px;
  }

  .ranked-best-card {
    width: 100%;
  }

  .leaderboard-item {
    grid-template-columns: auto 1fr;
  }

  .leaderboard-score {
    grid-column: 2;
  }

  .duel-lobby-list li {
    align-items: flex-start;
    flex-direction: column;
  }

  .auth-card {
    padding: 18px 14px;
    border-radius: 22px;
  }

  .password-toggle {
    gap: 4px;
    padding: 0 9px;
  }

  .password-toggle-label {
    font-size: 0.72rem;
  }

  .answer-row {
    grid-template-columns: 1fr auto;
    gap: 6px;
  }

  .controls {
    gap: 6px;
  }

  .status-cluster {
    flex-wrap: wrap;
  }

  .status-main {
    flex-wrap: wrap;
  }

  .status-side {
    width: 100%;
    justify-content: flex-end;
  }

  .game-screen.ranked-active .status-cluster,
  .game-screen.ranked-active .status-main,
  .game-screen.ranked-active .status-side {
    flex-wrap: nowrap;
  }

  .game-screen.ranked-active .status-side {
    width: auto;
  }

  .game-screen.ranked-active .status-cluster,
  .game-screen.ranked-active .status-main,
  .game-screen.ranked-active .status-side {
    gap: 6px;
  }

  .game-screen.ranked-active .score {
    min-width: 44px;
  }

  .game-screen.ranked-active .score,
  .game-screen.ranked-active .timer,
  .game-screen.ranked-active .session-title {
    min-height: 36px;
    padding: 6px 8px;
    font-size: 1.14rem;
  }

  .game-screen.ranked-active .ranked-points {
    min-width: 88px;
  }

  .game-screen.ranked-active .session-title {
    letter-spacing: 0.03em;
  }

  .ranked-finish-panel {
    padding: 16px 14px;
  }

  .ranked-finish-title {
    font-size: 1.2rem;
  }

  .ranked-finish-subtitle {
    font-size: 0.92rem;
  }

  .ranked-countdown-overlay {
    padding: 14px;
  }

  .ranked-countdown-card {
    width: min(100%, 420px);
    gap: 10px;
    padding: 24px 18px 20px;
    border-radius: 24px;
  }

  .ranked-countdown-kicker {
    font-size: 0.76rem;
    letter-spacing: 0.12em;
  }

  .ranked-countdown-value {
    font-size: clamp(3.1rem, 18vw, 5.2rem);
  }

  .ranked-countdown-words {
    gap: 8px;
  }

  .ranked-countdown-words span {
    font-size: clamp(0.98rem, 5.2vw, 1.45rem);
  }

  .ranked-countdown-overlay[data-stage="launch"] .ranked-countdown-value {
    font-size: clamp(1.8rem, 8vw, 2.7rem);
  }

  .ranked-countdown-hint {
    font-size: 0.88rem;
  }

  .game-summary-panel {
    border-radius: 18px;
  }

  .game-summary-shell {
    gap: 12px;
  }

  .game-summary-hero {
    padding: 14px 10px 4px;
  }

  .game-summary-score {
    font-size: clamp(2.7rem, 15vw, 4.2rem);
  }

  .game-summary-title {
    font-size: clamp(1rem, 5.5vw, 1.3rem);
  }

  .game-summary-subtitle {
    font-size: 0.84rem;
  }

  .game-summary-stats {
    gap: 8px;
  }

  .game-summary-stat {
    padding: 12px 8px;
    gap: 6px;
  }

  .game-summary-stat-icon {
    width: 28px;
    height: 28px;
    font-size: 0.82rem;
  }

  .game-summary-stat-value {
    font-size: 1rem;
  }

  .game-summary-stat-label {
    font-size: 0.58rem;
    letter-spacing: 0.1em;
  }

  .game-summary-round-list {
    gap: 8px;
  }

  .game-summary-round-item {
    min-height: 58px;
    padding: 12px;
  }

  .game-summary-round-status {
    width: 30px;
    height: 30px;
    font-size: 0.84rem;
  }

  .game-summary-actions button {
    width: 100%;
    min-width: 0;
  }
}

.uppercase {
    text-transform: uppercase;
}

:root {
  --page-bg: #f7f3ea;
  --page-bg-deep: #ebe5d7;
  --page-surface: rgba(255, 252, 246, 0.82);
  --page-surface-strong: rgba(255, 251, 243, 0.94);
  --page-surface-soft: rgba(122, 98, 57, 0.06);
  --page-border: rgba(88, 68, 36, 0.12);
  --page-border-strong: rgba(88, 68, 36, 0.18);
  --page-text: #1f1a12;
  --page-text-muted: rgba(31, 26, 18, 0.74);
  --page-text-faint: rgba(31, 26, 18, 0.5);
  --page-accent: #d39b2a;
  --page-accent-strong: #9b6706;
  --page-accent-soft: rgba(211, 155, 42, 0.14);
  --page-shadow: 0 30px 70px rgba(80, 57, 19, 0.12);
}

body {
  background:
    radial-gradient(circle at 18% 0%, rgba(240, 197, 106, 0.16), transparent 30%),
    radial-gradient(circle at 88% 16%, rgba(94, 120, 228, 0.08), transparent 22%),
    radial-gradient(circle at 50% 120%, rgba(255, 255, 255, 0.44), transparent 24%),
    linear-gradient(180deg, var(--page-bg-deep), var(--page-bg));
  color: var(--page-text);
}

h1 {
  margin: 0;
  letter-spacing: -0.05em;
  text-transform: none;
  line-height: 0.94;
}

.app {
  width: min(1500px, 100vw);
  padding: 18px clamp(14px, 2vw, 28px) 20px;
  gap: 18px;
}

.topbar.topbar-site {
  align-items: center;
  gap: 18px;
  padding: 10px 16px;
  border-radius: 20px;
  border: 1px solid var(--page-border);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.92), rgba(247, 242, 233, 0.9)),
    rgba(255, 250, 241, 0.88);
  box-shadow: var(--page-shadow);
  backdrop-filter: blur(20px);
}

.brand-lockup,
.site-nav-link,
.hero-cta {
  text-decoration: none;
}

.brand-lockup {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  color: var(--page-text);
}

.brand-mark {
  width: 40px;
  height: 40px;
  border-radius: 13px;
  display: inline-grid;
  place-items: center;
  background:
    linear-gradient(135deg, rgba(255, 245, 214, 0.95), rgba(244, 227, 178, 0.82)),
    rgba(255, 250, 241, 0.9);
  border: 1px solid var(--page-border);
  color: #7a5000;
  font-size: 0.92rem;
  font-weight: 700;
  letter-spacing: 0.14em;
}

.brand-name {
  color: var(--page-text);
  font-size: 0.88rem;
  font-weight: 700;
  letter-spacing: 0.24em;
}

.subtitle {
  margin: 0;
  color: var(--page-text-muted);
  font-size: 0.88rem;
}

.site-nav {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  flex: 1 1 auto;
  min-width: 0;
}

.site-nav-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 0 16px;
  border-radius: 999px;
  color: var(--page-text-muted);
  font-size: 0.92rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  transition:
    color 180ms ease,
    background-color 180ms ease,
    box-shadow 180ms ease,
    transform 180ms ease;
}

.site-nav-link:hover,
.site-nav-link.is-active {
  color: var(--page-text);
  background: rgba(122, 98, 57, 0.07);
  box-shadow: inset 0 0 0 1px rgba(88, 68, 36, 0.08);
}

.site-nav-link:hover {
  transform: translateY(-1px);
}

.topbar-button,
.account-button {
  border-color: var(--page-border-strong);
  background: rgba(255, 255, 255, 0.84);
  color: var(--page-text);
  box-shadow: none;
}

.topbar-button-secondary {
  background: rgba(122, 98, 57, 0.05);
  color: var(--page-text);
  border-color: var(--page-border);
}

.account-dropdown {
  border-color: var(--page-border-strong);
  background:
    linear-gradient(180deg, rgba(255, 252, 246, 0.98), rgba(245, 239, 228, 0.98)),
    var(--page-surface-strong);
  color: var(--page-text);
  box-shadow: var(--page-shadow);
}

.account-dropdown-label {
  color: var(--page-text-muted);
}

.dropdown-action {
  background: rgba(122, 98, 57, 0.06);
  color: var(--page-text);
  border-color: var(--page-border);
}

.setup-screen {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
  padding: 8px 4px 36px;
}

.setup-screen::before {
  top: 48px;
  right: 1%;
  width: min(32vw, 340px);
  height: min(32vw, 340px);
  background: radial-gradient(circle, rgba(240, 197, 106, 0.16), transparent 72%);
}

.setup-screen::after {
  bottom: 2%;
  left: 1%;
  width: min(28vw, 300px);
  height: min(28vw, 300px);
  background: radial-gradient(circle, rgba(104, 126, 255, 0.14), transparent 72%);
}

.page-stack {
  position: relative;
  z-index: 1;
  min-height: 100%;
}

.route-page {
  min-height: 100%;
  display: grid;
  gap: 54px;
  align-content: start;
  animation: page-shell-in 420ms ease both;
}

.page-header,
.page-copy-block {
  display: grid;
  gap: 12px;
  max-width: 760px;
}

.page-eyebrow,
.page-section-label {
  margin: 0;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.page-eyebrow {
  color: var(--page-accent-strong);
}

.page-section-label {
  color: var(--page-text-faint);
}

.page-title,
.mode-side-title,
.config-panel-title {
  margin: 0;
  color: var(--page-text);
  letter-spacing: -0.05em;
  line-height: 0.95;
}

.page-title {
  font-size: clamp(2.7rem, 7vw, 4.9rem);
  max-width: 11ch;
}

.page-description,
.config-panel-copy,
.ranked-panel-copy,
.mode-side-list,
.duel-note-copy,
.explainer-card p,
.landing-copy-text {
  margin: 0;
  color: var(--page-text-muted);
  font-size: 1rem;
  line-height: 1.65;
}

/* ─── Landing page (full-screen) ─── */

.landing-page {
  position: relative;
  height: 100%;
  overflow: hidden;
  display: block;
  gap: 0;
  min-height: 0;
  animation: none;
}

.landing-bg-map {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  background: #e8e4da;
}

.landing-bg-map .leaflet-container {
  background: #e8e4da;
}

.landing-bg-map .leaflet-tile {
  filter: contrast(1.14) saturate(1.08) brightness(0.95);
}

.landing-overlay {
  position: absolute;
  inset: 0;
  z-index: 1;
  background:
    radial-gradient(ellipse at 50% 50%, rgba(248, 244, 236, 0.06) 0%, rgba(236, 229, 215, 0.2) 100%),
    linear-gradient(180deg, rgba(241, 233, 219, 0.14) 0%, rgba(248, 244, 236, 0.03) 50%, rgba(241, 233, 219, 0.14) 100%);
}

.landing-stage {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: grid;
  align-items: center;
  justify-content: center;
  justify-items: center;
  align-content: center;
  gap: 18px;
  padding: 24px;
  text-align: center;
  max-width: 460px;
  width: 100%;
  animation: landing-card-in 600ms cubic-bezier(0.22, 1, 0.36, 1) both;
}

.landing-card-tagline {
  font-family: "Instrument Serif", Georgia, "Times New Roman", serif;
  font-size: clamp(2.4rem, 4.5vw, 3.8rem);
  font-style: italic;
  color: rgba(24, 18, 10, 0.94);
  text-shadow:
    0 2px 18px rgba(255, 250, 241, 0.75),
    0 1px 0 rgba(255, 255, 255, 0.92);
  line-height: 1.05;
  letter-spacing: -0.02em;
  margin: 0;
}

.landing-card-actions {
  display: grid;
  gap: 12px;
  width: min(320px, 100%);
}

.landing-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 58px;
  border-radius: 20px;
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-decoration: none;
  transition: transform 180ms ease, box-shadow 180ms ease, background 180ms ease;
  cursor: pointer;
}

.landing-btn:hover {
  transform: translateY(-2px);
}

.landing-btn-standard {
  background: rgba(255, 252, 245, 0.48);
  border: 1px solid rgba(88, 68, 36, 0.14);
  backdrop-filter: blur(10px);
  color: var(--page-text);
}

.landing-btn-standard:hover {
  background: rgba(255, 252, 245, 0.62);
  box-shadow: 0 16px 40px rgba(80, 57, 19, 0.12);
}

.landing-btn-ranked {
  background: linear-gradient(135deg, #ffe19f 0%, #efc25d 45%, #c89012 100%);
  border: 1px solid transparent;
  color: #3b2500;
  box-shadow: 0 12px 32px rgba(240, 197, 106, 0.4);
}

.landing-btn-ranked:hover {
  box-shadow: 0 20px 48px rgba(240, 197, 106, 0.55);
}

@keyframes landing-card-in {
  from {
    opacity: 0;
    transform: translateY(20px) scale(0.97);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* ─── Mode spotlights ─── */

.landing-modes {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 20px;
}

.mode-spotlight {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(200px, 0.9fr);
  gap: 32px;
  align-items: center;
  padding: clamp(28px, 3.5vw, 44px);
  border-radius: 28px;
  border: 1px solid var(--page-border);
  overflow: hidden;
  backdrop-filter: blur(20px);
}

.mode-spotlight-standard {
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.94), rgba(245, 239, 228, 0.92)),
    rgba(255, 250, 242, 0.92);
}

.mode-spotlight-ranked {
  background:
    radial-gradient(circle at top right, rgba(240, 197, 106, 0.22), transparent 46%),
    linear-gradient(155deg, rgba(255, 250, 241, 0.98), rgba(247, 235, 204, 0.94) 100%);
  border-color: rgba(240, 197, 106, 0.12);
}

.mode-spotlight-body {
  display: grid;
  gap: 18px;
  align-content: start;
}

.mode-spotlight-kicker {
  margin: 0;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.2em;
  text-transform: uppercase;
}

.mode-spotlight-standard .mode-spotlight-kicker {
  color: var(--page-text-faint);
}

.mode-spotlight-ranked .mode-spotlight-kicker {
  color: rgba(255, 228, 164, 0.64);
}

.mode-spotlight-title {
  margin: 0;
  font-size: clamp(1.8rem, 2.8vw, 2.6rem);
  line-height: 0.96;
  letter-spacing: -0.04em;
  color: var(--page-text);
}

.mode-spotlight-desc {
  margin: 0;
  color: var(--page-text-muted);
  font-size: 0.96rem;
  line-height: 1.62;
  max-width: 34ch;
}

.mode-spotlight-cta {
  display: inline-flex;
  align-items: center;
  align-self: start;
  min-height: 46px;
  padding: 0 20px;
  border-radius: 16px;
  border: 1px solid var(--page-border);
  background: rgba(122, 98, 57, 0.06);
  color: var(--page-text);
  font-size: 0.92rem;
  font-weight: 700;
  text-decoration: none;
  transition: transform 160ms ease, box-shadow 160ms ease;
}

.mode-spotlight-cta:hover {
  transform: translateY(-1px);
}

.mode-spotlight-cta-gold {
  background: linear-gradient(135deg, #ffe19f 0%, #efc25d 45%, #c89012 100%);
  border-color: transparent;
  color: #3b2500;
  box-shadow: 0 16px 36px rgba(240, 197, 106, 0.24);
}

.mode-spotlight-cta-gold:hover {
  box-shadow: 0 20px 44px rgba(240, 197, 106, 0.32);
}

.mode-spotlight-visual {
  display: grid;
  gap: 10px;
}

.mode-viz-config {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.mode-viz-btn {
  display: flex;
  align-items: center;
  min-height: 40px;
  padding: 0 14px;
  border-radius: 14px;
  background: rgba(122, 98, 57, 0.05);
  border: 1px solid rgba(88, 68, 36, 0.08);
  color: var(--page-text-faint);
  font-size: 0.86rem;
  font-weight: 700;
}

.mode-viz-btn.is-active {
  background: rgba(255, 255, 255, 0.86);
  border-color: rgba(88, 68, 36, 0.14);
  color: var(--page-text);
}

.mode-viz-params {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.mode-viz-param {
  display: grid;
  gap: 4px;
  padding: 14px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.7);
  border: 1px solid rgba(88, 68, 36, 0.08);
}

.mode-viz-param span {
  color: var(--page-text-faint);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.mode-viz-param strong {
  color: var(--page-text);
  font-size: 1.1rem;
  font-weight: 700;
  line-height: 1;
}

.mode-viz-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.mode-viz-chips span {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 0 14px;
  border-radius: 999px;
  background: rgba(240, 197, 106, 0.1);
  border: 1px solid rgba(240, 197, 106, 0.16);
  color: var(--page-accent-strong);
  font-size: 0.82rem;
  font-weight: 700;
}

/* ─── Leaderboard inline override ─── */

.hero-leaderboard-static {
  position: static !important;
  width: 100% !important;
  animation: none !important;
}


.floating-leaderboard-widget {
  position: absolute;
  left: 0;
  bottom: 26px;
  width: min(320px, calc(100% - 64px));
  padding: 18px;
  border-radius: 24px;
  border: 1px solid rgba(88, 68, 36, 0.12);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.94), rgba(245, 239, 228, 0.9)),
    rgba(255, 249, 239, 0.92);
  box-shadow: 0 28px 64px rgba(80, 57, 19, 0.14);
  backdrop-filter: blur(20px);
  animation: leaderboard-widget-float 7s ease-in-out infinite;
}

.floating-widget-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 14px;
}

.floating-widget-title,
.explainer-card h3 {
  margin: 6px 0 0;
  color: var(--page-text);
  letter-spacing: -0.04em;
}

.floating-widget-title {
  font-size: 1.3rem;
  line-height: 1;
}

.floating-widget-status {
  margin: 0;
  color: var(--page-text-faint);
  font-size: 0.8rem;
  font-weight: 600;
}

.floating-leaderboard-list,
.leaderboard-page-list,
.mode-side-list {
  margin: 0;
  padding: 0;
}

.floating-leaderboard-list,
.leaderboard-page-list {
  list-style: none;
}

.floating-leaderboard-list {
  display: grid;
  gap: 10px;
}

.floating-leaderboard-entry {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding: 12px 14px;
  border-radius: 18px;
  border: 1px solid rgba(88, 68, 36, 0.08);
  background: rgba(255, 255, 255, 0.66);
}

.floating-leaderboard-entry.is-viewer,
.leaderboard-page-row.is-viewer {
  background: linear-gradient(135deg, rgba(240, 197, 106, 0.2), rgba(255, 255, 255, 0.62));
  border-color: rgba(240, 197, 106, 0.2);
}

.floating-leaderboard-rank,
.floating-leaderboard-name,
.floating-leaderboard-score,
.floating-viewer-label,
.floating-viewer-score,
.floating-viewer-meta {
  margin: 0;
}

.floating-leaderboard-rank {
  color: var(--page-accent-strong);
  font-size: 0.82rem;
  font-weight: 700;
}

.floating-leaderboard-name {
  color: var(--page-text);
  font-size: 0.95rem;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.floating-leaderboard-score {
  color: var(--page-text);
  font-size: 0.92rem;
  font-weight: 700;
  white-space: nowrap;
}

.floating-viewer-card {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid rgba(88, 68, 36, 0.1);
  display: grid;
  gap: 8px;
}

.floating-viewer-label {
  color: var(--page-text-faint);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.floating-viewer-main {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.floating-viewer-main strong {
  color: var(--page-text);
  font-size: 1rem;
  font-weight: 700;
}

.floating-viewer-main span,
.floating-viewer-meta {
  color: var(--page-text-muted);
  font-size: 0.86rem;
}

.floating-viewer-score {
  color: var(--page-accent-strong);
  font-size: 1rem;
  font-weight: 700;
}

.landing-explainer,
.explainer-grid,
.mode-page-grid,
.ranked-split,
.leaderboard-layout {
  display: grid;
}

.landing-explainer {
  gap: 28px;
}

.explainer-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}

.explainer-card {
  display: grid;
  gap: 12px;
}

.explainer-card h3,
.mode-side-title {
  font-size: 1.4rem;
  line-height: 1;
}

.mode-page-grid {
  grid-template-columns: minmax(0, 1.08fr) minmax(300px, 0.72fr);
  gap: 22px;
  align-items: start;
}

.mode-config-panel,
.ranked-mode-panel,
.leaderboard-table-shell {
  display: grid;
  gap: 22px;
  padding: clamp(22px, 3vw, 30px);
  border-radius: 28px;
  border: 1px solid var(--page-border);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(244, 237, 226, 0.92)),
    var(--page-surface-strong);
  box-shadow: var(--page-shadow);
  backdrop-filter: blur(20px);
}

.mode-config-panel-standard {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.99), rgba(246, 239, 227, 0.94)),
    rgba(255, 250, 242, 0.9);
}

.config-panel-head,
.ranked-panel-head,
.leaderboard-table-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.config-panel-title {
  font-size: clamp(1.75rem, 4vw, 2.6rem);
}

.setup-standard-body {
  gap: 22px;
}

.setup-control-label {
  color: var(--page-text-faint);
}

.setup-control-card {
  background: rgba(255, 255, 255, 0.76);
  box-shadow:
    inset 0 0 0 1px rgba(88, 68, 36, 0.06),
    0 18px 36px rgba(80, 57, 19, 0.08);
}

.setup-control-head,
.setup-control-head strong,
.setup-segment-button {
  color: var(--page-text);
}

.setup-segment-button {
  background: rgba(122, 98, 57, 0.06);
  box-shadow:
    inset 0 0 0 1px rgba(88, 68, 36, 0.06),
    0 10px 24px rgba(80, 57, 19, 0.08);
}

.setup-segment-button.active {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(226, 228, 233, 0.94));
  color: #12151b;
}

.setup-range {
  background: linear-gradient(90deg, rgba(211, 155, 42, 0.18), rgba(122, 98, 57, 0.08));
}

.setup-range::-webkit-slider-thumb,
.setup-range::-moz-range-thumb {
  background: var(--page-accent);
  box-shadow: 0 10px 24px rgba(240, 197, 106, 0.32);
}

.setup-cta {
  min-height: 58px;
  border-radius: 20px;
  letter-spacing: 0.02em;
}

.setup-cta-standard {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(237, 231, 220, 0.94));
  color: #13161b;
  box-shadow: 0 22px 44px rgba(80, 57, 19, 0.1);
}

.setup-cta-ranked,
.setup-cta-duel {
  background: linear-gradient(135deg, #ffe19f 0%, #efc25d 45%, #bb8610 100%);
  color: #3b2500;
  box-shadow: 0 22px 44px rgba(240, 197, 106, 0.28);
}

.mode-side-panel {
  display: grid;
  gap: 14px;
}

.mode-side-list {
  list-style: none;
  display: grid;
  gap: 12px;
}

.mode-side-list li {
  padding: 12px 14px;
  border-radius: 16px;
  border: 1px solid rgba(88, 68, 36, 0.08);
  background: rgba(255, 255, 255, 0.7);
  color: var(--page-text-muted);
  line-height: 1.55;
}

.ranked-split {
  grid-template-columns: minmax(0, 1.08fr) minmax(0, 0.92fr);
  gap: 22px;
}

.ranked-mode-panel {
  align-content: start;
}

.ranked-mode-panel-solo {
  background:
    radial-gradient(circle at top right, rgba(240, 197, 106, 0.14), transparent 32%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(246, 238, 219, 0.92)),
    rgba(255, 250, 242, 0.94);
}

.ranked-mode-panel-duel {
  background:
    radial-gradient(circle at top right, rgba(94, 120, 228, 0.12), transparent 34%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(236, 241, 250, 0.92)),
    rgba(248, 250, 253, 0.9);
}

.ranked-panel-head .ranked-queue-button {
  flex: 0 0 auto;
  min-width: auto;
  padding: 10px 14px;
  border-radius: 999px;
}

.mode-status {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  padding: 0 14px;
  border-radius: 999px;
  border: 1px solid rgba(240, 197, 106, 0.18);
  background: rgba(240, 197, 106, 0.08);
  color: #8b5a00;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.ranked-rules {
  gap: 12px;
}

.ranked-rule-chip {
  background: rgba(122, 98, 57, 0.06);
}

.ranked-best-card {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.88), rgba(245, 239, 227, 0.8)),
    rgba(255, 255, 255, 0.52);
}

.ranked-auth-hint {
  color: var(--page-text-muted);
}

.duel-note-card {
  gap: 8px;
}

.leaderboard-layout {
  gap: 18px;
}

.leaderboard-page-viewer {
  display: grid;
  gap: 12px;
}

.leaderboard-page-viewer-main {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 14px;
  align-items: center;
}

.leaderboard-page-viewer-rank,
.leaderboard-page-viewer-score {
  color: var(--page-accent-strong);
  font-weight: 700;
}

.leaderboard-page-viewer-rank {
  font-size: 1.05rem;
}

.leaderboard-page-viewer-name {
  color: var(--page-text);
  font-size: 1.18rem;
  font-weight: 700;
}

.leaderboard-page-viewer-score {
  font-size: 1rem;
}

.leaderboard-page-viewer-meta,
.leaderboard-page-status {
  margin: 0;
  color: var(--page-text-muted);
  font-size: 0.92rem;
}

.leaderboard-table-shell {
  gap: 18px;
}

.leaderboard-table-column-head {
  display: grid;
  grid-template-columns: 92px minmax(0, 1fr) 132px;
  gap: 16px;
  padding: 0 16px;
  color: var(--page-text-faint);
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.leaderboard-page-list {
  display: grid;
  gap: 10px;
}

.leaderboard-page-row {
  display: grid;
  grid-template-columns: 92px minmax(0, 1fr) 132px;
  gap: 16px;
  align-items: center;
  padding: 16px;
  border-radius: 20px;
  border: 1px solid rgba(88, 68, 36, 0.08);
  background: rgba(255, 255, 255, 0.72);
  transition:
    transform 180ms ease,
    border-color 180ms ease,
    background-color 180ms ease;
}

.leaderboard-page-row:hover {
  transform: translateY(-1px);
  border-color: rgba(88, 68, 36, 0.14);
  background: rgba(255, 255, 255, 0.9);
}

.leaderboard-page-row.is-podium {
  border-color: rgba(240, 197, 106, 0.16);
}

.leaderboard-page-rank,
.leaderboard-page-name,
.leaderboard-page-score,
.leaderboard-page-meta {
  margin: 0;
}

.leaderboard-page-rank {
  color: var(--page-accent-strong);
  font-size: 0.94rem;
  font-weight: 700;
}

.leaderboard-page-body {
  min-width: 0;
  display: grid;
  gap: 4px;
}

.leaderboard-page-name {
  color: var(--page-text);
  font-size: 1rem;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.leaderboard-page-meta {
  color: var(--page-text-muted);
  font-size: 0.84rem;
  line-height: 1.45;
}

.leaderboard-page-score {
  color: var(--page-text);
  font-size: 1rem;
  font-weight: 700;
  text-align: right;
  white-space: nowrap;
}

@keyframes page-shell-in {
  from {
    opacity: 0;
    transform: translateY(12px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes demo-window-float {
  0%,
  100% {
    transform: translateY(0);
  }

  50% {
    transform: translateY(-8px);
  }
}

@keyframes leaderboard-widget-float {
  0%,
  100% {
    transform: translateY(0);
  }

  50% {
    transform: translateY(-6px);
  }
}

@keyframes demo-ping {
  0% {
    transform: scale(0.92);
    box-shadow:
      0 0 0 0 rgba(240, 197, 106, 0.2),
      0 0 26px rgba(240, 197, 106, 0.32);
  }

  70% {
    transform: scale(1.08);
    box-shadow:
      0 0 0 16px rgba(240, 197, 106, 0),
      0 0 36px rgba(240, 197, 106, 0.46);
  }

  100% {
    transform: scale(0.96);
    box-shadow:
      0 0 0 0 rgba(240, 197, 106, 0),
      0 0 22px rgba(240, 197, 106, 0.26);
  }
}

@keyframes demo-live-pulse {
  0%, 100% {
    opacity: 1;
    box-shadow: 0 0 6px rgba(74, 222, 128, 0.5);
  }

  50% {
    opacity: 0.72;
    box-shadow: 0 0 14px rgba(74, 222, 128, 0.82);
  }
}

@keyframes demo-caret-blink {
  0%,
  49% {
    opacity: 1;
  }

  50%,
  100% {
    opacity: 0;
  }
}

/* Light theme cleanup for nested ranked and landing preview components */

.hero-cta {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 0 18px;
  border-radius: 999px;
  border: 1px solid var(--page-border);
  background: rgba(255, 255, 255, 0.8);
  color: var(--page-text);
  font-size: 0.94rem;
  font-weight: 700;
  box-shadow: 0 12px 28px rgba(80, 57, 19, 0.08);
  transition:
    transform 160ms ease,
    background-color 160ms ease,
    box-shadow 160ms ease,
    border-color 160ms ease;
}

.hero-cta:hover {
  transform: translateY(-1px);
  box-shadow: 0 16px 34px rgba(80, 57, 19, 0.12);
}

.hero-cta-primary {
  background: #1e1912;
  border-color: #1e1912;
  color: #fff8ee;
}

.hero-cta-accent {
  background: linear-gradient(135deg, #ffe0a0 0%, #efbf53 45%, #c98a11 100%);
  border-color: transparent;
  color: #3b2500;
}

.hero-cta-secondary {
  background: rgba(122, 98, 57, 0.06);
  color: var(--page-text);
}

.landing-demo-card .demo-live-label,
.landing-demo-card .demo-answer-hint,
.landing-demo-card .demo-cursor-text {
  color: var(--page-text-muted);
}

.landing-demo-card .demo-chip {
  background: rgba(122, 98, 57, 0.08);
  border-color: rgba(88, 68, 36, 0.12);
  color: #5c4a2a;
}

.landing-demo-card .demo-chip-timer {
  background: rgba(211, 155, 42, 0.12);
  border-color: rgba(211, 155, 42, 0.22);
  color: #8b5a00;
}

.landing-demo-card .demo-answer-input {
  border-color: rgba(88, 68, 36, 0.14);
  background: rgba(255, 255, 255, 0.88);
  color: #52422a;
}

.mode-spotlight-ranked .mode-spotlight-kicker,
.ranked-page .page-section-label,
.ranked-page .page-eyebrow {
  color: #8b5a00;
}

.ranked-page .ranked-panel-copy,
.ranked-page .duel-note-copy,
.ranked-page .ranked-auth-hint,
.ranked-page .ranked-best-meta,
.ranked-page .leaderboard-status {
  color: rgba(31, 26, 18, 0.72);
}

.ranked-page .ranked-queue-button {
  background: rgba(122, 98, 57, 0.08);
  color: #5f4c29;
  box-shadow: inset 0 0 0 1px rgba(88, 68, 36, 0.1);
}

.ranked-page .ranked-queue-button.is-active {
  background: linear-gradient(135deg, rgba(255, 230, 170, 0.88), rgba(240, 197, 106, 0.72));
  color: #694300;
  box-shadow:
    0 14px 28px rgba(211, 155, 42, 0.18),
    inset 0 0 0 1px rgba(201, 138, 17, 0.18);
}

.ranked-page .ranked-queue-button.is-locked {
  color: rgba(31, 26, 18, 0.5);
}

.ranked-page .ranked-rule-chip {
  border: 1px solid rgba(88, 68, 36, 0.08);
  background: rgba(255, 255, 255, 0.7);
  box-shadow: none;
}

.ranked-page .ranked-rule-chip strong {
  color: #8b5a00;
}

.ranked-page .ranked-rule-chip span {
  color: rgba(31, 26, 18, 0.62);
}

.ranked-page .ranked-best-card,
.ranked-page .duel-note-card,
.ranked-page .leaderboard-page-viewer {
  border: 1px solid rgba(88, 68, 36, 0.08);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.92), rgba(246, 240, 229, 0.82)),
    rgba(255, 255, 255, 0.72);
  box-shadow: none;
}

.ranked-page .ranked-section-label {
  color: rgba(31, 26, 18, 0.84);
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.ranked-page .ranked-best-score {
  color: var(--page-text);
}

.ranked-page .ranked-best-card[data-state="locked"] .ranked-best-score,
.ranked-page .ranked-best-card[data-state="empty"] .ranked-best-score {
  color: #6e5630;
}

.ranked-page .mode-status {
  border-color: rgba(211, 155, 42, 0.22);
  background: rgba(211, 155, 42, 0.1);
  color: #8b5a00;
}

.ranked-page .setup-cta-ranked,
.ranked-page .setup-cta-duel {
  box-shadow: 0 16px 32px rgba(211, 155, 42, 0.18);
}

/* ─── Full-screen landing layout overrides ─── */

body.is-landing .app {
  padding: 0;
  gap: 0;
  position: relative;
}

body.is-landing .topbar.topbar-site {
  position: absolute;
  top: 16px;
  left: 16px;
  right: 16px;
  z-index: 300;
  margin: 0 auto;
  max-width: calc(min(1100px, 100vw) - 32px);
}

body.is-landing .setup-screen {
  flex: 1 1 auto;
  min-height: 0;
  height: 100%;
  padding: 0;
  overflow: hidden;
  background: transparent;
}

body.is-landing .setup-screen::before,
body.is-landing .setup-screen::after {
  display: none;
}

body.is-landing .page-stack {
  height: 100%;
  min-height: 0;
}

/* ─── Minimal subpages ─── */

.standard-page,
.ranked-page,
.leaderboard-page {
  width: min(1120px, 100%);
  margin: 0 auto;
  gap: 30px;
  padding: 6px 0 28px;
}

.standard-page .page-header,
.ranked-page .page-header,
.leaderboard-page .page-header {
  gap: 10px;
  max-width: 640px;
}

.standard-page .page-eyebrow,
.ranked-page .page-eyebrow,
.leaderboard-page .page-eyebrow {
  font-size: 0.72rem;
  letter-spacing: 0.16em;
  color: rgba(31, 26, 18, 0.5);
}

.standard-page .page-title,
.ranked-page .page-title,
.leaderboard-page .page-title {
  font-size: clamp(2.2rem, 5.4vw, 3.5rem);
  line-height: 0.96;
  letter-spacing: -0.055em;
  max-width: 12ch;
}

.standard-page .page-description,
.ranked-page .page-description,
.leaderboard-page .page-description {
  max-width: 44ch;
  font-size: 0.98rem;
  line-height: 1.55;
  color: rgba(31, 26, 18, 0.68);
}

.mode-page-grid,
.ranked-split,
.leaderboard-layout {
  gap: 16px;
}

.mode-config-panel,
.mode-side-panel,
.ranked-mode-panel,
.leaderboard-table-shell,
.leaderboard-page-viewer,
.duel-note-card,
.ranked-best-card {
  border-radius: 22px;
  border: 1px solid rgba(88, 68, 36, 0.08);
  background: rgba(255, 253, 249, 0.9);
  box-shadow: 0 10px 30px rgba(80, 57, 19, 0.06);
  backdrop-filter: none;
}

.mode-config-panel,
.ranked-mode-panel,
.leaderboard-table-shell,
.mode-side-panel,
.leaderboard-page-viewer {
  padding: 24px;
}

.mode-config-panel-standard,
.ranked-mode-panel-solo,
.ranked-mode-panel-duel {
  background: rgba(255, 253, 249, 0.92);
}

.config-panel-head,
.ranked-panel-head,
.leaderboard-table-head {
  align-items: baseline;
  gap: 12px;
}

.config-panel-title {
  font-size: clamp(1.45rem, 3vw, 2rem);
  letter-spacing: -0.04em;
}

.config-panel-copy,
.ranked-panel-copy,
.duel-note-copy,
.leaderboard-page-status,
.leaderboard-page-viewer-meta,
.ranked-auth-hint {
  font-size: 0.92rem;
  line-height: 1.5;
  color: rgba(31, 26, 18, 0.62);
}

.page-section-label {
  font-size: 0.7rem;
  letter-spacing: 0.14em;
  color: rgba(31, 26, 18, 0.46);
}

.setup-standard-body {
  gap: 18px;
}

.setup-control-group {
  display: grid;
  gap: 10px;
}

.setup-control-grid {
  gap: 12px;
}

.setup-control-card {
  padding: 14px 16px 16px;
  border-radius: 18px;
  background: rgba(250, 247, 241, 0.96);
  border: 1px solid rgba(88, 68, 36, 0.07);
  box-shadow: none;
}

.setup-control-head {
  color: rgba(31, 26, 18, 0.64);
  font-size: 0.92rem;
}

.setup-control-head strong {
  font-size: 0.98rem;
}

.setup-segmented {
  gap: 8px;
}

.setup-segment-button,
.ranked-queue-button {
  min-height: 48px;
  padding: 0 14px;
  border-radius: 14px;
  background: rgba(122, 98, 57, 0.05);
  color: rgba(31, 26, 18, 0.72);
  box-shadow: none;
}

.setup-segment-button.active {
  background: #1f1a12;
  color: #fff9ef;
  box-shadow: none;
}

.setup-range {
  height: 8px;
}

.setup-cta {
  min-height: 52px;
  border-radius: 16px;
  box-shadow: none;
}

.setup-cta-standard {
  background: #1f1a12;
  color: #fff8ee;
}

.setup-cta-ranked,
.setup-cta-duel {
  background: #1f1a12;
  color: #fff8ee;
  box-shadow: none;
}

.mode-side-panel {
  gap: 10px;
  align-content: start;
}

.mode-side-title {
  font-size: clamp(1.2rem, 2.2vw, 1.5rem);
  letter-spacing: -0.03em;
}

.mode-side-list {
  gap: 8px;
}

.mode-side-list li {
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: rgba(31, 26, 18, 0.66);
  line-height: 1.55;
}

.mode-side-list li::before {
  content: "— ";
  color: rgba(31, 26, 18, 0.38);
}

.ranked-panel-head .ranked-queue-button {
  padding: 0 12px;
  min-height: 38px;
  border-radius: 999px;
}

.mode-status {
  min-height: 30px;
  padding: 0 10px;
  border-radius: 999px;
  background: rgba(122, 98, 57, 0.05);
  border-color: rgba(88, 68, 36, 0.08);
  color: rgba(31, 26, 18, 0.56);
  font-size: 0.68rem;
  letter-spacing: 0.1em;
}

.ranked-rules {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.ranked-rule-chip {
  padding: 14px;
  border-radius: 16px;
  border: 1px solid rgba(88, 68, 36, 0.07);
  background: rgba(250, 247, 241, 0.9);
  box-shadow: none;
}

.ranked-rule-chip strong {
  color: #1f1a12;
  font-size: 1rem;
}

.ranked-rule-chip span {
  color: rgba(31, 26, 18, 0.5);
  font-size: 0.76rem;
}

.ranked-best-card,
.duel-note-card,
.leaderboard-page-viewer {
  padding: 18px;
}

.ranked-section-label {
  font-size: 0.7rem;
  letter-spacing: 0.14em;
  color: rgba(31, 26, 18, 0.42);
}

.ranked-best-score,
.leaderboard-page-viewer-rank,
.leaderboard-page-viewer-score,
.leaderboard-page-score {
  color: #1f1a12;
}

.leaderboard-layout {
  grid-template-columns: 1fr;
  align-items: start;
}

.leaderboard-layout > * {
  min-width: 0;
  width: 100%;
}

.leaderboard-page-viewer {
  max-width: 360px;
}

.leaderboard-page-viewer-main {
  grid-template-columns: auto 1fr auto;
  gap: 12px;
  align-items: center;
}

.leaderboard-page-viewer-score {
  grid-column: auto;
}

.leaderboard-table-shell {
  width: 100%;
}

.leaderboard-table-column-head {
  grid-template-columns: 84px minmax(0, 1fr) 140px;
  padding: 0 14px;
  color: rgba(31, 26, 18, 0.42);
  font-size: 0.68rem;
  letter-spacing: 0.14em;
}

.leaderboard-page-list {
  gap: 8px;
}

.leaderboard-page-row {
  grid-template-columns: 84px minmax(0, 1fr) 140px;
  padding: 14px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.82);
  box-shadow: none;
}

.leaderboard-page-row:hover {
  transform: none;
  background: rgba(255, 255, 255, 0.96);
}

.leaderboard-page-rank {
  color: rgba(31, 26, 18, 0.56);
  font-size: 0.86rem;
}

.leaderboard-page-name {
  font-size: 0.96rem;
}

.leaderboard-page-meta {
  color: rgba(31, 26, 18, 0.5);
  font-size: 0.8rem;
}

.leaderboard-page-score {
  font-size: 0.96rem;
  text-align: right;
}

@media (max-width: 1120px) {
  .landing-hero,
  .landing-modes,
  .mode-page-grid,
  .ranked-split,
  .explainer-grid {
    grid-template-columns: 1fr;
  }

  .mode-spotlight {
    grid-template-columns: 1fr;
  }

  .floating-leaderboard-widget:not(.hero-leaderboard-static) {
    position: static;
    width: 100%;
    margin-top: 18px;
  }

  .leaderboard-layout {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 860px) {
  .app {
    width: 100vw;
    padding: 10px;
    gap: 12px;
  }

  .topbar.topbar-site {
    align-items: stretch;
    gap: 14px;
    padding: 14px;
  }

  .site-nav {
    flex-wrap: wrap;
    justify-content: flex-start;
  }

  .landing-title {
    font-size: clamp(2.8rem, 12vw, 4.4rem);
  }

  .landing-stat:not(:first-child) {
    padding-left: 0;
    border-left: 0;
    border-top: 1px solid var(--page-border);
  }

  .config-panel-head,
  .ranked-panel-head,
  .leaderboard-table-head,
  .floating-widget-head {
    flex-direction: column;
    align-items: flex-start;
  }

  .leaderboard-table-column-head,
  .leaderboard-page-row,
  .leaderboard-page-viewer-main {
    grid-template-columns: 1fr;
  }

  .leaderboard-page-score {
    text-align: left;
  }

  .ranked-rules,
  .setup-control-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 620px) {
  .topbar.topbar-site {
    border-radius: 20px;
  }

  .brand-lockup {
    align-items: flex-start;
  }

  .site-nav-link,
  .hero-cta {
    width: 100%;
  }

  .landing-cta-row {
    display: grid;
  }

  .route-page {
    gap: 34px;
  }

  .page-title {
    max-width: 12ch;
    font-size: clamp(2.1rem, 13vw, 3.2rem);
  }

  .landing-demo-map {
    height: 280px;
  }

  .landing-hero {
    padding-bottom: 24px;
  }

  .floating-leaderboard-widget,
  .mode-config-panel,
  .ranked-mode-panel,
  .leaderboard-table-shell,
  .mode-side-panel,
  .leaderboard-page-viewer,
  .duel-note-card {
    padding: 18px;
    border-radius: 22px;
  }

  .leaderboard-page-row {
    padding: 14px;
  }
}
