/* ---------------------------------------------------------------
   Main menu layout
   ----------------------------------------------------------------*/
[data-view='mainMenu'] {
  flex-direction: column;
  min-height: 100vh;
  background:
    linear-gradient(rgba(231, 225, 204, 0.25), rgba(231, 225, 204, 0.25)),
    url(../assets/backgrounds/loginBG.jpg) center/cover no-repeat;
}

.menu-topbar {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 22px 28px 10px;
}

.menu-topbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.menu-brand {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.menu-brand h1 {
  margin: 0;
  font-family: 'Fraunces', Georgia, serif;
  font-size: clamp(1.75rem, 3vw, 2.6rem);
  color: var(--ink);
  line-height: 1;
}

.menu-shell {
  width: min(1100px, calc(100% - 32px));
  margin: auto;
  display: grid;
  grid-template-columns: 1.4fr 0.9fr;
  gap: 26px;
  padding: 12px 0 28px;
}

.menu-panel {
  position: relative;
  background: rgba(241, 236, 217, 0.88);
  border: 1px solid rgba(166, 156, 124, 0.9);
  box-shadow: 0 18px 34px -22px rgba(32, 42, 31, 0.55);
  padding: 28px;
}

.menu-panel--primary {
  min-height: 420px;
  overflow: auto;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.menu-kicker {
  margin: 0 0 8px;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: rgba(32, 42, 31, 0.68);
}

.menu-panel--primary h2 {
  margin: 0 0 12px;
  font-family: 'Fraunces', Georgia, serif;
  font-size: clamp(2.2rem, 4vw, 3.4rem);
  line-height: 0.95;
  color: var(--ink);
}

.menu-summary {
  max-width: 46ch;
  margin: 0 0 28px;
  color: rgba(32, 42, 31, 0.75);
  font-size: 1.02rem;
  line-height: 1.6;
}

.menu-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
}

.menu-action {
  min-width: 160px;
}

.menu-panel--stats {
  display: flex;
  flex-direction: column;
  gap: 18px;
  max-height: 620px;
  overflow-y: auto;
  overflow-x: hidden;
  padding-right: 4px;
}

.menu-panel--stats>* {
  flex-shrink: 0;
}

.panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.panel-label {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: rgba(32, 42, 31, 0.7);
}

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

.stat-card {
  background: rgba(231, 225, 204, 0.9);
  border: 1px solid rgba(166, 156, 124, 0.8);
  padding: 18px 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.stat-label {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(32, 42, 31, 0.6);
}

.stat-card strong {
  font-family: 'Fraunces', Georgia, serif;
  font-size: 1.8rem;
  font-weight: 600;
  color: var(--ink);
  line-height: 1;
}

.mini-panel {
  background: rgba(231, 225, 204, 0.8);
  border: 1px solid rgba(166, 156, 124, 0.8);
  padding: 18px 16px;
}

.leaderboard-panel {
  display: flex;
  flex-direction: column;
}

.leaderboard-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}

.leaderboard-badge {
  font-size: 0.58rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--pine);
  background: rgba(51, 80, 62, 0.08);
  border: 1px solid rgba(51, 80, 62, 0.25);
  padding: 4px 6px;
  border-radius: 999px;
}

.leaderboard-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
  overflow: visible;
}

.leaderboard-list li {
  display: grid;
  grid-template-columns: 46px 1fr auto;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-bottom: 1px solid rgba(166, 156, 124, 0.7);
}

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

.rank {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: rgba(32, 42, 31, 0.6);
}

.leaderboard-list strong {
  font-family: 'Fraunces', Georgia, serif;
  font-size: 1rem;
  font-weight: 600;
  color: var(--ink);
  text-align: left;
}

.leaderboard-list em {
  font-style: normal;
  font-weight: 700;
  color: var(--pine);
  font-size: 0.8rem;
}

/* Level Carousel & Cards */
.level-carousel-wrapper {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  min-width: 0;
}

.level-carousel {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  gap: 12px;
  overflow-x: auto;
  padding: 12px;
  scroll-behavior: smooth;
  -webkit-overflow-scrolling: touch;
}

.level-card {
  flex: 0 0 110px;
  min-width: 110px;
  height: 110px;
}

.level-card--completed {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  border-color: #4ade80;
  opacity: 0.8;
}

.level-card--completed:hover {
  transform: scale(1.05);
  opacity: 1;
}

.level-card--available {
  background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
  border-color: #fbbf24;
  box-shadow: 0 0 20px rgba(245, 87, 108, 0.5);
  font-weight: 600;
}

.level-card--available:hover {
  transform: scale(1.08);
  box-shadow: 0 0 30px rgba(245, 87, 108, 0.8);
}

.level-card--locked {
  background: linear-gradient(135deg, #6b7280 0%, #4b5563 100%);
  border-color: #374151;
  opacity: 0.5;
  cursor: not-allowed;
}

.level-number {
  font-size: 24px;
  font-weight: bold;
  color: white;
  margin-bottom: 4px;
}

.level-status {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: rgba(255, 255, 255, 0.85);
}

.level-badge {
  position: absolute;
  top: 6px;
  right: 6px;
  font-size: 14px;
  display: inline-block;
}

.level-badge--completed {
  color: #4ade80;
}

.level-badge--locked {
  color: #ef4444;
}

.level-carousel-wrapper { display:flex; align-items:center; gap:8px; width:100%; }
.level-carousel { display:flex; gap:12px; overflow-x:auto; padding:12px; scroll-behavior:smooth; -webkit-overflow-scrolling:touch; }
.level-card { flex:0 0 110px; min-width:110px; height:110px; border-radius:8px; padding:10px; position:relative; display:flex; flex-direction:column; align-items:center; justify-content:center; color:#fff; cursor:pointer; transition:transform .15s ease, box-shadow .15s ease; }
.level-card.pending { opacity:0.6; pointer-events:none; }
.level-card--completed { background:linear-gradient(135deg,#667eea,#764ba2); box-shadow:0 4px 10px rgba(0,0,0,.12); }
.level-card--available { background:linear-gradient(135deg,#f093fb,#f5576c); box-shadow:0 6px 18px rgba(245,87,108,.18); }
.level-card--locked { background:#374151; opacity:.5; cursor:not-allowed; }
.level-number{ font-size:22px; font-weight:700; }
.level-badge{ position:absolute; top:8px; right:8px; font-size:14px; }
.carousel-btn{ background:#111827; color:#fff; border:none; padding:8px 10px; border-radius:6px; cursor:pointer; }
.carousel-btn:active{ transform:scale(.98); }
.level-message{ margin-top:8px; height:20px; font-weight:600; }
.level-message.success{ color:#16a34a; }
.level-message.error{ color:#ef4444; }

@media (max-width: 760px) {
  .menu-shell {
    grid-template-columns: 1fr;
  }

  .menu-panel--primary {
    min-height: unset;
  }
}

@media (max-width: 500px) {
  .menu-topbar {
    padding-inline: 18px;
  }

  .menu-shell {
    width: min(100% - 20px, 1100px);
  }

  .menu-panel {
    padding: 22px 18px;
  }

  .menu-actions {
    flex-direction: column;
  }

  .menu-action {
    width: 100%;
  }

  .stat-grid {
    grid-template-columns: 1fr;
  }
}
/* ---------------------------------------------------------------
   Leaderboard — loading/empty/error states + current-player row
   ----------------------------------------------------------------*/
.leaderboard-loading,
.leaderboard-empty,
.leaderboard-error {
  margin: 0;
  padding: 10px 0;
  font-size: 0.85rem;
  color: rgba(32, 42, 31, 0.6);
}

.leaderboard-error {
  color: var(--error);
}

.leaderboard-list li.is-you {
  background: rgba(185, 146, 46, 0.12);
  border-left: 2px solid var(--gold);
  padding-left: 8px;
  margin-left: -10px;
}

.leaderboard-list li.is-you strong {
  color: var(--pine-dark);
}

.leaderboard-you-divider {
  border: none;
  border-top: 1px dashed rgba(166, 156, 124, 0.9);
  margin: 4px 0;
  padding: 0;
}

/* ---------------------------------------------------------------
   Modal (Field Guide launcher — #39)
   Mounted into #modal-root, above every view. The backdrop is --ink
   (#202a1f) at 0.8 opacity; the card holds the 'large' Field Guide, whose
   own 6px pine frame and page colors come from game.css (#40).
   ----------------------------------------------------------------*/
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: grid;
  place-items: center;
  padding: 28px;
  background: rgba(32, 42, 31, 0.8);
  overscroll-behavior: contain;
}

.modal-card {
  position: relative;
  width: min(980px, 100%);
}

.modal-close {
  position: absolute;
  top: -14px;
  right: -14px;
  z-index: 1;
  width: 34px;
  height: 34px;
  padding: 0;
  color: var(--pine-dark);
  background: var(--card);
  border: 2px solid var(--pine);
  border-radius: 50%;
  font: inherit;
  font-size: 1.3rem;
  line-height: 1;
  cursor: pointer;
}

.modal-close:hover {
  background: var(--paper);
}

.modal-close:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 2px;
}

/* ---------------------------------------------------------------
   Photo Credits modal (components/creditsModal.js — #43)
   Reuses .modal-backdrop/.modal-card/.modal-close above; sized much
   narrower than the Field Guide card since it's just a scrolling list.
   ----------------------------------------------------------------*/
.modal-card--credits {
  width: min(560px, 100%);
}

.credits-panel {
  max-height: min(640px, 80vh);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  color: var(--ink);
  background: var(--card);
  border: 6px solid var(--pine);
  border-radius: 6px;
  box-shadow: 0 18px 34px -22px rgba(32, 42, 31, 0.65);
}

.credits-body {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
}

.credits-header {
  flex: none;
  padding: 22px 26px 16px;
  border-bottom: 1px solid var(--rule);
}

.credits-title {
  margin: 0 0 8px;
  font-family: 'Fraunces', Georgia, serif;
  font-size: 1.5rem;
  color: var(--ink);
}

.credits-general {
  margin: 0;
  color: rgba(32, 42, 31, 0.75);
  font-size: 0.92rem;
  line-height: 1.5;
}

.credits-general a,
.credits-author {
  color: var(--pine-dark);
  text-decoration-color: rgba(51, 80, 62, 0.5);
}

.credits-general a:hover,
.credits-author:hover {
  text-decoration-color: currentColor;
}

.credits-status {
  margin: 0;
  padding: 22px 26px;
  color: rgba(32, 42, 31, 0.7);
}

.credits-list {
  flex: 1 1 auto;
  min-height: 0;
  margin: 0;
  padding: 6px 26px 22px;
  list-style: none;
}

.credits-item {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  padding: 10px 0;
  border-bottom: 1px dashed rgba(166, 156, 124, 0.9);
}

.credits-item:last-child {
  border-bottom: none;
}

.credits-bird-name {
  font-weight: 600;
}

.credits-author {
  flex: none;
  font-size: 0.92rem;
  text-align: right;
}

@media (max-width: 500px) {
  .menu-topbar {
    flex-wrap: wrap;
    gap: 10px;
  }
}