/* Shared styles for individual game pages */

.game-page {
  padding: 30px 0;
}

.game-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 14px;
  margin-bottom: 26px;
}

.game-title h1 {
  font-size: 1.8rem;
  font-weight: 800;
}

.game-title .sub {
  color: var(--text-muted);
  font-size: 0.9rem;
}

.hud {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.stat {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 8px 16px;
  text-align: center;
  min-width: 74px;
}

.stat .label {
  font-size: 0.7rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.stat .value {
  font-size: 1.2rem;
  font-weight: 700;
}

.play-zone {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  margin-bottom: 28px;
}

.game-holder {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: 20px;
}

.controls {
  display: flex;
  gap: 10px;
  justify-content: center;
  flex-wrap: wrap;
  margin-top: 6px;
}

.controls .btn {
  min-width: 90px;
}

.legend {
  display: flex;
  gap: 16px;
  justify-content: center;
  flex-wrap: wrap;
  color: var(--text-muted);
  font-size: 0.85rem;
  margin-top: 14px;
}

.legend span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.swatch {
  width: 12px;
  height: 12px;
  border-radius: 3px;
  display: inline-block;
}

.settings-row {
  display: flex;
  gap: 12px;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  margin-bottom: 18px;
}

select {
  font-family: inherit;
  font-size: 0.9rem;
  padding: 9px 14px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
}

/* ===== Leaderboard ===== */
.leaderboard {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.leaderboard h2 {
  padding: 16px 22px;
  font-size: 1.1rem;
  border-bottom: 1px solid var(--border);
  font-weight: 700;
}

.leaderboard ol {
  list-style: none;
  max-height: 360px;
  overflow-y: auto;
}

.leaderboard li {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 22px;
  border-bottom: 1px solid var(--border);
  font-size: 0.95rem;
}

.leaderboard li:last-child {
  border-bottom: none;
}

.leaderboard .rank {
  width: 26px;
  height: 26px;
  border-radius: 8px;
  background: var(--surface-2);
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: 0.85rem;
}

.leaderboard li:nth-child(1) .rank { background: #fbbf24; color: #1a1c24; }
.leaderboard li:nth-child(2) .rank { background: #9ca3af; color: #1a1c24; }
.leaderboard li:nth-child(3) .rank { background: #d97706; color: #fff; }

.leaderboard .name {
  font-weight: 600;
}

.leaderboard .score {
  margin-left: auto;
  font-weight: 700;
  color: var(--accent);
}

.leaderboard .empty {
  padding: 26px;
  text-align: center;
  color: var(--text-muted);
}

.two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  max-width: 900px;
  margin: 0 auto;
}

@media (max-width: 720px) {
  .two-col {
    grid-template-columns: 1fr;
  }
}

/* ===== Modal ===== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 200;
  padding: 20px;
  backdrop-filter: blur(4px);
}

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

.modal {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 30px;
  max-width: 420px;
  width: 100%;
  text-align: center;
  animation: pop 0.25s ease;
}

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

.modal .emoji {
  font-size: 3rem;
  margin-bottom: 10px;
}

.modal h2 {
  font-size: 1.5rem;
  margin-bottom: 8px;
}

.modal p {
  color: var(--text-muted);
  margin-bottom: 20px;
}

.modal .actions {
  display: flex;
  gap: 10px;
}

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

/* ===== Toast ===== */
.toast-wrap {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 300;
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: center;
}

.toast {
  padding: 12px 22px;
  border-radius: 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  font-weight: 600;
  font-size: 0.9rem;
  animation: slide-up 0.25s ease;
}

.toast.error { border-color: var(--danger); color: var(--danger); }
.toast.success { border-color: var(--accent); color: var(--accent); }

@keyframes slide-up {
  from { transform: translateY(16px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

.fade-out {
  opacity: 0;
  transform: translateY(8px);
  transition: all 0.3s ease;
}

/* Score input for leaderboard */
.score-name-input {
  margin-bottom: 18px;
}

.score-name-input input {
  width: 100%;
  font-family: inherit;
  font-size: 1rem;
  padding: 11px 14px;
  border-radius: 12px;
  border: 1.5px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  text-align: center;
}

.score-name-input input:focus {
  outline: none;
  border-color: var(--primary);
}

/* ===== Share row ===== */
.share-row {
  margin-bottom: 20px;
  padding-top: 18px;
  border-top: 1px solid var(--border);
}

.share-label {
  display: block;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  margin-bottom: 10px;
}

.share-btns {
  display: flex;
  gap: 8px;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
}

.share-btn {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  font-size: 1rem;
  line-height: 1;
  display: inline-grid;
  place-items: center;
  cursor: pointer;
  text-decoration: none;
  transition: all 0.15s ease;
}

.share-btn:hover {
  border-color: var(--primary);
  background: var(--primary);
  color: #fff;
  transform: translateY(-2px);
}

.share-btn.hidden {
  display: none;
}
