.screen { position: absolute; inset: 0; z-index: 30; }
#screen-menu {
  display: flex; align-items: center; justify-content: center;
  /* Was a faint rgba(6,14,10,0.6) tint with no card behind the text — the
     wave HUD/castle/enemies rendered on the board underneath showed straight
     through, so the menu read as a stray translucent popup rather than an
     intentional start screen. Matched to .modal-backdrop + .modal-box below
     (solid card, real border/shadow, darker/blurred backdrop) so it reads
     the same as every other screen in the game. */
  background: rgba(4,10,7,0.88); backdrop-filter: blur(3px);
  padding: 16px;
}
.modal-backdrop {
  display: flex; align-items: center; justify-content: center;
  background: rgba(5,10,8,0.72); backdrop-filter: blur(2px);
  padding: 16px;
}
.modal-box {
  background: #12201a; border: 1px solid #234433; border-radius: 16px;
  padding: 22px 20px; width: 100%; max-width: 360px; max-height: 85vh;
  overflow-y: auto; -webkit-overflow-scrolling: touch; touch-action: pan-y;
  text-align: center; box-shadow: 0 20px 60px rgba(0,0,0,0.5);
}
.modal-box h3 { color: #fbbf24; font-size: 1.25rem; margin-bottom: 12px; }
.modal-box-wide { max-width: 440px; }

.btn-primary, .btn-secondary, .btn-ghost {
  display: block; width: 100%; padding: 13px 16px; border-radius: 12px;
  font-weight: 700; font-size: 0.95rem; margin: 8px 0; transition: transform 0.1s ease;
}
.btn-primary { background: linear-gradient(180deg, #facc15, #eab308); color: #1a1400; }
.btn-primary.btn-lg { font-size: 1.05rem; padding: 16px; }
.btn-secondary { background: #1f3a2a; color: #d1fae5; border: 1px solid #2f5540; }
.btn-ghost { background: transparent; color: #9ca3af; border: 1px solid #2a2a2a; }
.btn-primary:active, .btn-secondary:active, .btn-ghost:active { transform: scale(0.97); }

.menu-box {
  text-align: center; max-width: 320px; width: 100%; padding: 24px 20px;
  background: #12201a; border: 1px solid #234433; border-radius: 16px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.5);
}
.menu-icon { font-size: 3rem; margin-bottom: 4px; }
.menu-box h2 { font-size: 1.8rem; color: #fbbf24; letter-spacing: 0.04em; }
.menu-tagline { color: #9ca3af; margin-bottom: 18px; }
.menu-row { display: flex; gap: 8px; }
.menu-row .btn-ghost, .menu-row .btn-icon { flex: 1; }
.menu-best {
  display: flex; justify-content: space-between; margin: 14px 0 10px;
  font-size: 0.82rem; color: #9ca3af; background: rgba(255,255,255,0.05);
  padding: 8px 12px; border-radius: 10px;
}
.menu-toggles { justify-content: center; gap: 14px; }
.menu-toggles .btn-icon { flex: none; }

.howto-list { text-align: left; padding-left: 1.1em; line-height: 1.6; color: #d1d5db; font-size: 0.9rem; }
.howto-list li { margin-bottom: 8px; }

.achv-list { text-align: left; margin: 10px 0; display: flex; flex-direction: column; gap: 8px; }
.achv-row { display: flex; gap: 10px; align-items: center; padding: 8px; border-radius: 10px; background: rgba(255,255,255,0.04); opacity: 0.5; }
.achv-row.unlocked { opacity: 1; background: rgba(250,204,21,0.1); }
.achv-icon { font-size: 1.4rem; }
.achv-desc { font-size: 0.75rem; color: #9ca3af; }

.score-breakdown { text-align: left; font-size: 0.9rem; color: #d1d5db; display: flex; flex-direction: column; gap: 4px; margin: 10px 0; }
.score-breakdown div { display: flex; justify-content: space-between; }
.perfect-line { color: #facc15; }
.score-total { font-size: 1.1rem; margin: 10px 0 16px; color: #fff; }
.score-total b { color: #4ade80; font-size: 1.4rem; margin-left: 6px; }

.card-row { display: flex; flex-direction: column; gap: 10px; margin-top: 12px; }
.power-card {
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  background: rgba(255,255,255,0.05); border: 1px solid #2a4536; border-radius: 12px;
  padding: 14px; color: #e5e7eb;
}
.power-card:active { transform: scale(0.97); background: rgba(250,204,21,0.12); }
.power-icon { font-size: 1.6rem; }
.power-card span:last-child { font-size: 0.78rem; color: #9ca3af; }

.pause-box .pause-toggles { display: flex; justify-content: center; gap: 14px; margin-bottom: 14px; }
.pause-box .btn-primary, .pause-box .btn-secondary, .pause-box .btn-ghost { width: 100%; }

.toast {
  position: fixed; top: 14px; left: 50%; transform: translateX(-50%) translateY(-20px);
  background: #111827; color: #fde68a; padding: 10px 18px; border-radius: 999px;
  font-size: 0.85rem; font-weight: 700; box-shadow: 0 8px 24px rgba(0,0,0,0.4);
  opacity: 0; transition: opacity 0.3s ease, transform 0.3s ease; z-index: 999;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

.daily-best-line { color: #9ca3af; font-size: 0.85rem; }

.lb-tabs { display: flex; gap: 6px; margin: 10px 0; }
.lb-tab {
  flex: 1; padding: 8px; border-radius: 8px; font-size: 0.8rem; font-weight: 700;
  background: rgba(255,255,255,0.05); color: #9ca3af; border: 1px solid transparent;
}
.lb-tab.active { background: rgba(250,204,21,0.15); color: #facc15; border-color: #facc15; }
.lb-list { text-align: left; max-height: 320px; overflow-y: auto; margin-bottom: 10px; }
.lb-list-compact { max-height: 140px; margin: 10px 0; }
.lb-row {
  display: flex; align-items: center; gap: 8px; padding: 7px 6px; font-size: 0.85rem;
  border-bottom: 1px solid rgba(255,255,255,0.06);
}
.lb-row .lb-rank { width: 26px; color: #9ca3af; font-weight: 700; flex-shrink: 0; }
.lb-row .lb-name { flex: 1; color: #e5e7eb; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lb-row .lb-score { color: #4ade80; font-weight: 700; }
.lb-row.lb-top1 .lb-rank { color: #facc15; }
.lb-loading, .lb-empty { color: #6b7280; font-size: 0.85rem; text-align: center; padding: 16px 0; }

.nickname-sub { color: #9ca3af; font-size: 0.85rem; }
#nickname-input {
  width: 100%; padding: 12px 14px; border-radius: 10px; margin: 10px 0;
  background: rgba(255,255,255,0.06); border: 1px solid #2f5540; color: #fff;
  font-size: 1rem; text-align: center;
}
#nickname-input:focus { outline: none; border-color: #facc15; }
.nickname-error { color: #f87171; font-size: 0.8rem; margin: -4px 0 8px; }
.go-rank-line { color: #facc15; font-weight: 700; font-size: 0.9rem; }