﻿:root {
  color-scheme: dark;
  --bg-0: #070d1a;
  --bg-1: #0f1a33;
  --bg-2: #101f3d;
  --card-bg: rgba(12, 20, 40, 0.72);
  --card-border: rgba(163, 189, 245, 0.26);
  --text: #edf3ff;
  --text-soft: #aebedf;
  --accent: #5ce9bf;
  --accent-2: #74b5ff;
  --btn-bg: rgba(98, 127, 184, 0.14);
  --btn-border: rgba(144, 176, 241, 0.36);
  --radius: 14px;
  --gap: clamp(0.42rem, 0.9vh, 0.72rem);
  --pad: clamp(0.62rem, 1.15vh, 1rem);
  --control-height: 2.75rem;
  --canvas-size: clamp(480px, 65vmin, 640px);
  --canvas-vertical-reserve: 228px;
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html,
body {
  margin: 0;
  width: 100%;
  min-height: 100%;
  overflow-x: clip;
}

body {
  position: relative;
  min-height: 100svh;
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding:
    max(env(safe-area-inset-top), clamp(0.45rem, 1.5vh, 0.75rem))
    max(env(safe-area-inset-right), clamp(0.45rem, 1.5vh, 0.75rem))
    max(env(safe-area-inset-bottom), clamp(0.45rem, 1.5vh, 0.75rem))
    max(env(safe-area-inset-left), clamp(0.45rem, 1.5vh, 0.75rem));
  overflow: hidden;
  font-family: "Segoe UI", "Noto Sans", sans-serif;
  color: var(--text);
  background:
    radial-gradient(110% 80% at 18% 10%, rgba(105, 158, 255, 0.18), transparent 48%),
    radial-gradient(95% 70% at 92% 92%, rgba(92, 233, 191, 0.1), transparent 52%),
    linear-gradient(165deg, var(--bg-2), var(--bg-1) 52%, var(--bg-0));
  overflow-x: hidden;
}

body.is-playing {
  overscroll-behavior-x: none;
}

.bg-orb {
  position: fixed;
  width: 34vw;
  aspect-ratio: 1;
  pointer-events: none;
  filter: blur(72px);
  opacity: 0.28;
}

.orb-a {
  top: -12vw;
  left: -8vw;
  background: #63edc7;
}

.orb-b {
  right: -10vw;
  bottom: -12vw;
  background: #5b96ff;
}

.layout {
  width: min(100%, 1180px);
  max-width: 100%;
  min-width: 0;
  height: calc(100svh - 24px);
  height: calc(100dvh - 24px);
  max-height: calc(100svh - 24px);
  max-height: calc(100dvh - 24px);
  display: grid;
  grid-template-columns: minmax(0, 1.7fr) minmax(270px, 0.72fr);
  gap: clamp(0.65rem, 1.3vw, 1rem);
  align-items: start;
}

.card {
  border-radius: clamp(14px, 1.8vw, 20px);
  border: 1px solid var(--card-border);
  background: linear-gradient(180deg, rgba(20, 33, 63, 0.8), var(--card-bg));
  box-shadow:
    0 22px 48px rgba(0, 0, 0, 0.44),
    inset 0 1px 0 rgba(255, 255, 255, 0.09);
  backdrop-filter: blur(10px);
}

.game-card {
  height: 100%;
  min-width: 0;
  display: grid;
  grid-template-rows: auto auto auto auto minmax(0, 1fr) auto;
  gap: var(--gap);
  padding: var(--pad);
  overflow: hidden;
}

.leaderboard-card {
  height: calc(100dvh - 24px);
  max-height: calc(100dvh - 24px);
  min-height: 0;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: clamp(0.45rem, 0.7vh, 0.68rem);
  padding: var(--pad);
  overflow: hidden;
  position: sticky;
  top: 12px;
}

.panel-header h1,
.panel-header h2 {
  margin: 0;
  font-size: clamp(1.5rem, 1.6vw + 0.7rem, 2.2rem);
  letter-spacing: 0.02em;
}

.panel-header.compact h2 {
  font-size: clamp(1.2rem, 1.2vw + 0.72rem, 1.6rem);
}

.leaderboard-head-row {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 0.5rem;
}

.leaderboard-auth-indicator {
  margin-left: auto;
  padding: 0.16rem 0.5rem;
  border-radius: 999px;
  border: 1px solid rgba(128, 226, 191, 0.42);
  background: rgba(26, 108, 84, 0.22);
  color: #d6f7ec;
  font-size: 0.72rem;
  line-height: 1.2;
}

.leaderboard-toggle-btn {
  display: none;
  margin-left: auto;
  min-width: 44px;
  min-height: 44px;
  padding: 0 0.65rem;
  border-radius: 999px;
  border: 1px solid rgba(149, 177, 235, 0.4);
  background: rgba(8, 13, 28, 0.52);
  color: var(--text-soft);
  font-size: 0.78rem;
  font-weight: 600;
}

.leaderboard-toggle-btn:focus-visible {
  outline: 2px solid rgba(126, 242, 208, 0.72);
  outline-offset: 2px;
}

.panel-header p {
  margin: 0.28rem 0 0;
  color: var(--text-soft);
  font-size: clamp(0.8rem, 0.75rem + 0.2vw, 0.92rem);
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.mobile-tip {
  display: none;
}

.hud-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--gap);
}

.hud-item {
  background: rgba(8, 13, 28, 0.48);
  border: 1px solid rgba(136, 169, 235, 0.24);
  border-radius: 12px;
  padding: clamp(0.42rem, 0.85vh, 0.64rem) clamp(0.5rem, 1vw, 0.75rem);
}

.hud-item span {
  display: block;
  color: var(--text-soft);
  font-size: clamp(0.63rem, 0.6rem + 0.2vw, 0.74rem);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.hud-item strong {
  display: block;
  margin-top: 0.18rem;
  font-size: clamp(1.06rem, 0.98rem + 0.4vw, 1.28rem);
  line-height: 1.1;
}

.control-row {
  display: flex;
  flex-wrap: wrap;
  min-width: 0;
  gap: 0.52rem;
}

.btn,
.toggle {
  height: var(--control-height);
  min-height: 44px;
  border-radius: 10px;
  border: 1px solid var(--btn-border);
  background: var(--btn-bg);
  color: var(--text);
  font-size: 0.92rem;
  font-weight: 600;
}

.btn {
  min-width: 44px;
  min-width: 102px;
  padding: 0 0.95rem;
  cursor: pointer;
  transition: background-color 120ms ease, border-color 120ms ease, transform 120ms ease;
}

.btn:hover,
.btn:focus-visible {
  border-color: rgba(177, 204, 255, 0.75);
  background: rgba(108, 143, 212, 0.22);
}

.btn:active {
  transform: translateY(1px);
}

.btn-primary {
  border: none;
  color: #08263c;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
}

.btn:disabled {
  opacity: 0.48;
  cursor: default;
  transform: none;
}

.toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0 0.75rem;
}

.toggle input {
  width: 1.05rem;
  height: 1.05rem;
  accent-color: var(--accent);
}

.slowbar {
  height: 8px;
  border-radius: 999px;
  border: 1px solid rgba(154, 190, 246, 0.26);
  background: rgba(8, 13, 28, 0.5);
  overflow: hidden;
}

.slowbar-fill {
  height: 100%;
  width: 0%;
  border-radius: inherit;
  background: linear-gradient(90deg, #62eac6, #71c5f8);
  box-shadow: 0 0 10px rgba(98, 234, 198, 0.28);
}

.canvas-stage {
  min-height: 0;
  min-width: 0;
  display: grid;
  place-items: center;
  touch-action: none;
  overscroll-behavior: contain;
}

.canvas-wrap {
  position: relative;
  width: min(var(--canvas-size), 100%, calc(100dvh - var(--canvas-vertical-reserve)));
  height: auto;
  min-width: 0;
  max-height: none;
  aspect-ratio: 1 / 1;
  touch-action: none;
  border-radius: 15px;
  border: 1px solid rgba(150, 188, 255, 0.35);
  background: #0c1730;
  overflow: hidden;
}

@media (max-width: 1100px) {
  .layout {
    grid-template-columns: minmax(0, 1.95fr) minmax(200px, 0.52fr);
    gap: clamp(0.55rem, 1.1vw, 0.85rem);
  }
}

#game {
  display: block;
  width: 100%;
  height: 100%;
  touch-action: none;
}

.leaderboard-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  gap: 0.36rem;
}

.leaderboard-list-wrap {
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  display: block;
  flex: 1 1 auto;
  position: relative;
}

.leaderboard-list-wrap.has-overflow::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 22px;
  pointer-events: none;
  background: linear-gradient(180deg, rgba(8, 13, 28, 0), rgba(8, 13, 28, 0.9));
}

.leaderboard-list-wrap.at-bottom::after {
  opacity: 0;
}

.leaderboard-row {
  display: flex;
  flex: 0 0 auto;
  gap: 0.58rem;
  align-items: center;
  min-height: 46px;
  padding: 0.48rem 0.58rem;
  border-radius: 11px;
  border: 1px solid rgba(136, 169, 235, 0.16);
  background: rgba(8, 13, 28, 0.3);
}

.rank {
  font-weight: 700;
  color: #96b7f5;
  min-width: 2.25rem;
}

.player-name {
  flex: 1 1 auto;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.player-score {
  font-weight: 700;
  min-width: 2.2rem;
  margin-left: auto;
  text-align: right;
}

.leaderboard-row.is-top {
  border-color: rgba(255, 219, 130, 0.48);
  background: linear-gradient(90deg, rgba(255, 218, 114, 0.15), rgba(121, 103, 255, 0.13));
}

.leaderboard-row.is-top .player-name {
  font-weight: 700;
}

.record-badge,
.you-badge {
  margin-left: 0.34rem;
  padding: 0.08rem 0.36rem;
  border-radius: 999px;
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.03em;
}

.record-badge {
  color: #241000;
  background: linear-gradient(90deg, #ffd66b, #ffbe55);
}

.you-badge {
  color: #07263d;
  background: linear-gradient(90deg, #8cf7ff, #78d8ff);
}

.leaderboard-row.is-you {
  outline: 1px solid rgba(140, 247, 255, 0.54);
  outline-offset: 0;
}

.leaderboard-state {
  margin: 0;
  min-height: 1.05em;
  color: var(--text-soft);
  font-size: 0.77rem;
}

.leaderboard-footer {
  display: grid;
  gap: 0.15rem;
}

.seo-links {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.55rem;
  margin-top: 0.35rem;
}

.seo-links a {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  border: 1px solid rgba(145, 198, 255, 0.36);
  background: rgba(8, 13, 28, 0.45);
  color: var(--text-soft);
  text-decoration: none;
  font-size: 0.78rem;
  font-weight: 600;
  line-height: 1;
  padding: 0.34rem 0.62rem;
  transition: color 0.2s ease, border-color 0.2s ease, background 0.2s ease;
}

.seo-links a:hover {
  color: var(--text);
  border-color: rgba(126, 242, 208, 0.6);
  background: rgba(18, 31, 52, 0.72);
}

.seo-links a:focus-visible {
  outline: 2px solid rgba(126, 242, 208, 0.72);
  outline-offset: 2px;
}

.leaderboard-empty {
  margin-top: 0.35rem;
  border-radius: 12px;
  border: 1px solid rgba(144, 176, 241, 0.22);
  background: rgba(8, 13, 28, 0.36);
  padding: 0.72rem;
}

.leaderboard-empty h3 {
  margin: 0;
  font-size: 0.96rem;
}

.leaderboard-empty p {
  margin: 0.34rem 0 0;
  color: var(--text-soft);
  font-size: 0.82rem;
}

.record-strip {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 0.6rem;
  border-radius: 13px;
  border: 1px solid rgba(182, 207, 255, 0.28);
  background: linear-gradient(110deg, rgba(255, 222, 126, 0.14), rgba(130, 110, 255, 0.14));
  padding: 0.58rem 0.65rem;
}

.record-icon {
  width: 1.9rem;
  height: 1.9rem;
  border-radius: 10px;
  display: grid;
  place-items: center;
  background: radial-gradient(circle at 35% 25%, #ffe58b, #ffbf55);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.4);
}

.record-icon::before {
  content: "♕";
  color: #3a2200;
  font-size: 1rem;
  line-height: 1;
}

.record-copy span {
  display: block;
  color: var(--text-soft);
  font-size: 0.67rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.record-copy strong {
  display: block;
  margin-top: 0.1rem;
  font-size: 1.55rem;
  line-height: 1;
}

.leaderboard-motivation {
  border-radius: 12px;
  border: 1px solid rgba(140, 171, 234, 0.2);
  background: rgba(8, 13, 28, 0.28);
  padding: 0.55rem 0.62rem;
}

.motivation-main {
  margin: 0;
  font-size: 0.86rem;
}

.motivation-main strong {
  font-size: 1.05rem;
}

.motivation-tip {
  margin: 0.28rem 0 0;
  color: var(--text-soft);
  font-size: 0.75rem;
  line-height: 1.35;
}

.dpad {
  display: none;
  position: relative;
  width: 182px;
  height: 182px;
  margin: 0 auto;
}

.dpad-btn {
  position: absolute;
  width: 54px;
  height: 54px;
  border-radius: 12px;
  border: 1px solid rgba(161, 194, 255, 0.45);
  background: rgba(20, 35, 70, 0.78);
  color: var(--text);
  font-size: 1.15rem;
  touch-action: manipulation;
  user-select: none;
}

.dpad-btn.is-pressed {
  transform: scale(0.96);
  background: rgba(52, 79, 130, 0.9);
}

.dpad-btn.up {
  left: 64px;
  top: 0;
}

.dpad-btn.down {
  left: 64px;
  bottom: 0;
}

.dpad-btn.left {
  left: 0;
  top: 64px;
}

.dpad-btn.right {
  right: 0;
  top: 64px;
}

.modal {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(2, 6, 16, 0.66);
  padding:
    max(env(safe-area-inset-top), 1rem)
    max(env(safe-area-inset-right), 1rem)
    max(env(safe-area-inset-bottom), 1rem)
    max(env(safe-area-inset-left), 1rem);
  overflow-y: auto;
  z-index: 30;
}

.modal.is-open {
  display: flex;
}

.confetti-layer {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  pointer-events: none;
  z-index: 9999;
  opacity: 1;
}

.modal-card {
  width: min(92vw, 380px);
  border-radius: 14px;
  border: 1px solid rgba(165, 193, 245, 0.35);
  background: linear-gradient(180deg, rgba(20, 33, 63, 0.96), rgba(12, 20, 40, 0.94));
  padding: 0.95rem;
  box-shadow: 0 18px 45px rgba(0, 0, 0, 0.5);
}

.modal-card h3 {
  margin: 0;
  font-size: 1.2rem;
}

.modal-card p {
  margin: 0.4rem 0 0;
  color: var(--text-soft);
  font-size: 0.9rem;
}

.auth-input {
  width: 100%;
  height: 2.75rem;
  min-height: 44px;
  border-radius: 10px;
  border: 1px solid rgba(149, 177, 235, 0.44);
  background: rgba(8, 13, 28, 0.66);
  color: var(--text);
  padding: 0 0.7rem;
  font-size: 0.95rem;
}

.auth-input::placeholder {
  color: #95a8cf;
}

.auth-mode-switch {
  margin-top: 0.72rem;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.38rem;
  padding: 0.16rem;
  border-radius: 11px;
  border: 1px solid rgba(149, 177, 235, 0.3);
  background: rgba(7, 12, 26, 0.58);
}

.auth-mode-btn {
  height: 2.75rem;
  min-height: 44px;
  min-width: 44px;
  border-radius: 9px;
  border: 1px solid transparent;
  background: transparent;
  color: #c8d5f7;
  font-size: 0.84rem;
  font-weight: 600;
  cursor: pointer;
}

.auth-mode-btn.is-active {
  border-color: rgba(128, 226, 191, 0.56);
  background: linear-gradient(180deg, rgba(70, 190, 151, 0.25), rgba(34, 129, 101, 0.2));
  color: #eef8ff;
}

.auth-mode-btn:disabled {
  cursor: default;
  opacity: 0.72;
}

#auth-form {
  margin-top: 0.72rem;
  display: grid;
  gap: 0.6rem;
}

.name-error {
  margin: 0;
  min-height: 1.2em;
  color: #ffc3d1;
  font-size: 0.84rem;
}

.modal-actions {
  display: flex;
  gap: 0.5rem;
}

.modal-actions-stack {
  margin-top: 0.78rem;
  flex-direction: column;
}

.modal-actions .btn {
  flex: 1;
}

.btn-tertiary {
  background: transparent;
  border-color: rgba(149, 177, 235, 0.26);
  color: #bbcaee;
}

.record-toast {
  position: fixed;
  left: 50%;
  bottom: max(env(safe-area-inset-bottom), 1.4rem);
  transform: translateX(-50%) translateY(8px);
  padding: 0.62rem 0.9rem;
  border-radius: 999px;
  border: 1px solid rgba(174, 206, 255, 0.45);
  background: rgba(9, 16, 34, 0.92);
  color: #eef5ff;
  font-size: 0.88rem;
  box-shadow: 0 12px 24px rgba(0, 0, 0, 0.32);
  opacity: 0;
  pointer-events: none;
  transition: opacity 180ms ease, transform 180ms ease;
  z-index: 10000;
}

.record-toast.is-visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.ui-toast {
  position: fixed;
  left: 50%;
  bottom: max(env(safe-area-inset-bottom), 1.4rem);
  transform: translateX(-50%) translateY(8px);
  max-width: min(92vw, 420px);
  margin: 0;
  padding: 0.6rem 0.85rem;
  border-radius: 999px;
  border: 1px solid rgba(165, 193, 245, 0.38);
  background: rgba(8, 15, 32, 0.9);
  color: #eaf2ff;
  font-size: 0.84rem;
  text-align: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 180ms ease, transform 180ms ease;
  z-index: 1200;
}

.ui-toast.is-visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  border: 0;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
}

@media (max-width: 900px) {
  .layout {
    grid-template-columns: 1fr;
    grid-template-rows: minmax(0, 1fr) auto;
    width: 100%;
    min-height: calc(100dvh - 16px);
    height: calc(100dvh - 16px);
    max-height: calc(100dvh - 16px);
    overflow-y: hidden;
    gap: 0.58rem;
    padding-bottom: max(env(safe-area-inset-bottom), 0.45rem);
  }

  .game-card {
    min-height: 0;
  }

  .leaderboard-card {
    position: static;
    top: auto;
    height: auto;
    max-height: min(48dvh, 420px);
    min-height: 220px;
  }

  .leaderboard-toggle-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }

  .leaderboard-card.is-collapsed {
    max-height: none;
    min-height: 0;
    padding-bottom: 0.62rem;
  }

  .leaderboard-card.is-collapsed .record-strip,
  .leaderboard-card.is-collapsed .leaderboard-list-wrap,
  .leaderboard-card.is-collapsed .leaderboard-motivation,
  .leaderboard-card.is-collapsed .leaderboard-footer {
    display: none;
  }
}

@media (max-width: 767px) {
  .modal {
    align-items: flex-start;
    padding-top: max(env(safe-area-inset-top), 0.8rem);
  }

  .modal-card {
    margin-top: max(0.45rem, env(safe-area-inset-top));
  }

  .control-row {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.48rem;
  }

  .btn,
  .toggle {
    width: 100%;
    justify-content: center;
  }

  .dpad {
    display: block;
    width: 212px;
    height: 212px;
  }

  .dpad-btn {
    width: 64px;
    height: 64px;
    font-size: 1.25rem;
  }

  .dpad-btn.up {
    left: 74px;
    top: 0;
  }

  .dpad-btn.down {
    left: 74px;
    bottom: 0;
  }

  .dpad-btn.left {
    left: 0;
    top: 74px;
  }

  .dpad-btn.right {
    right: 0;
    top: 74px;
  }

  .mobile-tip {
    display: block;
  }
}

@media (max-width: 520px) {
  :root {
    --pad: 0.52rem;
    --gap: 0.42rem;
    --control-height: 2.75rem;
  }

  .layout {
    gap: 0.5rem;
  }

  .control-row {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.45rem;
  }

  .btn,
  .toggle {
    width: 100%;
    min-width: 0;
    min-height: 44px;
    justify-content: center;
  }

  .canvas-wrap {
    width: min(100%, calc(100dvw - 2 * var(--pad) - 2px));
    max-width: 100%;
    margin-inline: auto;
  }

  .leaderboard-card {
    max-height: min(54dvh, 430px);
  }
}

@media (max-width: 420px) {
  :root {
    --pad: 0.5rem;
    --gap: 0.4rem;
    --control-height: 2.75rem;
  }

  .panel-header h1 {
    font-size: 1.38rem;
  }

  .panel-header.compact h2 {
    font-size: 1.12rem;
  }

  .btn,
  .toggle {
    font-size: 0.82rem;
  }

  .leaderboard-row {
    min-height: 44px;
    padding: 0.4rem 0.5rem;
  }

  .rank {
    min-width: 2rem;
  }
}

@media (pointer: coarse) {
  .btn:hover {
    border-color: var(--btn-border);
    background: var(--btn-bg);
  }
}

@media (max-height: 820px) {
  :root {
    --pad: clamp(0.4rem, 0.62vh, 0.54rem);
    --gap: clamp(0.24rem, 0.5vh, 0.4rem);
    --control-height: 2.75rem;
    --canvas-vertical-reserve: 188px;
  }

  .game-card > .panel-header > p:first-of-type {
    display: none;
  }

  .control-row {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.42rem;
  }

  .panel-header p {
    margin-top: 0.18rem;
    font-size: 0.77rem;
  }

  .hud-item {
    padding: 0.35rem 0.46rem;
  }

  .hud-item span {
    font-size: 0.6rem;
  }

  .hud-item strong {
    font-size: 0.98rem;
  }

  .btn,
  .toggle {
    font-size: 0.82rem;
  }

  .record-copy strong {
    font-size: 1.28rem;
  }
}

@media (max-width: 900px) and (orientation: landscape) {
  :root {
    --canvas-size: clamp(260px, 68vmin, 420px);
  }

  .layout {
    grid-template-columns: minmax(0, 1.7fr) minmax(180px, 0.78fr);
    min-height: 0;
    height: calc(100dvh - 16px);
    max-height: calc(100dvh - 16px);
    overflow-y: hidden;
  }

  .leaderboard-card {
    position: sticky;
    top: 8px;
    min-height: 0;
    max-height: calc(100dvh - 16px);
  }

  .panel-header p {
    font-size: 0.78rem;
  }

  .mobile-tip {
    display: block;
    font-size: 0.74rem;
  }

  .leaderboard-toggle-btn {
    display: none;
  }
}

@media (orientation: landscape) and (max-height: 460px) {
  :root {
    --canvas-vertical-reserve: 150px;
  }

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

  .btn,
  .toggle {
    min-width: 0;
    font-size: 0.78rem;
  }

  .mobile-tip,
  .seo-links {
    display: none;
  }
}
