:root {
  color-scheme: dark;
  --game-width: 1320px;
  --game-height: 860px;
  --game-scale: 1;
  --bg: #e7f7d1;
  --panel: #fff8d9;
  --panel-2: #c9ec84;
  --line: rgba(54, 84, 42, 0.22);
  --text: #20351f;
  --muted: #60764c;
  --pink: #ff6cab;
  --cyan: #47bfe5;
  --gold: #ffc83d;
  --green: #58c55d;
  --danger: #ff5c6c;
  --soil: #85613b;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  display: grid;
  place-items: center;
  min-height: 100svh;
  overflow: hidden;
  touch-action: manipulation;
  color: var(--text);
  font-family: "Nunito", Inter, ui-sans-serif, system-ui, sans-serif;
  background:
    radial-gradient(circle at 14% 16%, rgba(255, 230, 82, 0.8) 0 46px, transparent 48px),
    radial-gradient(circle at 84% 18%, rgba(255, 255, 255, 0.72) 0 34px, transparent 36px),
    radial-gradient(circle at 89% 14%, rgba(255, 255, 255, 0.64) 0 22px, transparent 24px),
    linear-gradient(180deg, #9ce6ff 0%, #caf3b0 47%, #85c765 100%);
}

body::before,
body::after {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: -1;
  height: 34vh;
  pointer-events: none;
  content: "";
}

body::before {
  background:
    radial-gradient(ellipse at 9% 100%, #3d873c 0 90px, transparent 92px),
    radial-gradient(ellipse at 22% 100%, #2f7738 0 124px, transparent 126px),
    radial-gradient(ellipse at 42% 100%, #438e3d 0 110px, transparent 112px),
    radial-gradient(ellipse at 66% 100%, #2f7738 0 140px, transparent 142px),
    radial-gradient(ellipse at 88% 100%, #438e3d 0 105px, transparent 107px);
}

body::after {
  height: 17vh;
  background: linear-gradient(180deg, transparent, rgba(71, 135, 54, 0.7));
}

button {
  font: inherit;
}

.game-shell {
  width: var(--game-width);
  margin: 0;
  padding: 18px 0;
  transform: scale(var(--game-scale));
  transform-origin: top left;
}

.game-shell.is-prestart {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

/* ── Start screen ────────────────────────────────────────────────────────── */

.start-screen {
  position: absolute;
  inset: 0 auto auto 0;
  z-index: 40;
  display: grid;
  place-items: center;
  width: var(--game-width);
  height: var(--game-height);
  padding: 40px;
  background:
    linear-gradient(180deg, rgba(6, 16, 8, 0.62), rgba(10, 28, 12, 0.55)),
    url("assets/background-zoom-2.png") center / cover no-repeat;
  transform: scale(var(--game-scale));
  transform-origin: top left;
}

.start-screen.hidden {
  display: none;
}

.start-card {
  display: grid;
  gap: 16px;
  width: min(480px, calc(100% - 48px));
  padding: 32px;
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 24px;
  text-align: center;
  background: rgba(20, 40, 20, 0.85);
  box-shadow: 0 32px 80px rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  color: rgba(255, 255, 255, 0.9);
  font-family: "Nunito", sans-serif;
}

/* Logo */
.start-logo {
  display: flex;
  justify-content: center;
  width: 100%;
}

.start-logo-img {
  width: 100%;
  max-width: 380px;
  height: auto;
  object-fit: contain;
  filter: drop-shadow(0 4px 16px rgba(0,0,0,0.6));
}

/* Username input */
.start-username-form {
  display: grid;
  width: 100%;
}

.start-username-form input {
  min-height: 48px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-radius: 12px;
  padding: 0 16px;
  color: #fff;
  font-family: "Nunito", sans-serif;
  font-size: 1rem;
  font-weight: 700;
  background: rgba(255, 255, 255, 0.1);
  outline: 0;
  transition: border-color 0.2s;
}

.start-username-form input::placeholder {
  color: rgba(255, 255, 255, 0.45);
}

.start-username-form input:focus {
  border-color: rgba(255, 215, 0, 0.7);
}

#startAuthMessage {
  width: 100%;
  color: rgba(255, 255, 255, 0.6);
  font-family: "Nunito", sans-serif;
  font-size: 0.8rem;
  font-weight: 600;
}

#startAuthMessage.error {
  color: #ff7070;
}

/* Play as Guest button */
.start-guest-btn {
  min-height: 46px;
  border: none;
  border-radius: 12px;
  color: #fff;
  font-family: "Nunito", sans-serif;
  font-size: 0.95rem;
  font-weight: 800;
  background: #4CAF50;
  box-shadow: 0 4px 14px rgba(76, 175, 80, 0.4);
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s;
}

.start-guest-btn:hover {
  transform: scale(1.03);
  box-shadow: 0 6px 20px rgba(76, 175, 80, 0.55);
}

/* Tabs */
.start-tabs {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  width: 100%;
}

.start-tab {
  min-height: 38px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 8px;
  color: rgba(255, 255, 255, 0.6);
  font-family: "Nunito", sans-serif;
  font-size: 0.8rem;
  font-weight: 700;
  background: transparent;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

.start-tab.active {
  background: #FFD700;
  border-color: #FFD700;
  color: #1a1a1a;
}

.start-tab:not(.active):hover {
  background: rgba(255, 255, 255, 0.1);
  color: rgba(255, 255, 255, 0.9);
}

/* Tab panels */
.start-tab-panel {
  display: none;
  width: 100%;
  min-height: 72px;
  padding: 12px 14px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 10px;
  color: rgba(255, 255, 255, 0.85);
  font-family: "Nunito", sans-serif;
  font-size: 0.85rem;
  font-weight: 600;
  line-height: 1.45;
  text-align: left;
  background: rgba(255, 255, 255, 0.07);
}

.start-tab-panel.active {
  display: block;
}

/* START button */
.start-play-btn {
  width: 100%;
  min-height: 62px;
  border: none;
  border-radius: 14px;
  color: #1a1a1a;
  font-family: "Fredoka One", cursive;
  font-size: 1.6rem;
  letter-spacing: 0.04em;
  background: linear-gradient(135deg, #FFD700, #FFA500);
  box-shadow: 0 4px 15px rgba(255, 165, 0, 0.4);
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s;
}

.start-play-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(255, 165, 0, 0.55);
}

.game-viewport {
  position: relative;
  width: calc(var(--game-width) * var(--game-scale));
  height: calc(var(--game-height) * var(--game-scale));
  max-width: 100vw;
  max-height: 100svh;
  overflow: visible;
}

.rotate-hint {
  position: fixed;
  left: 50%;
  bottom: 10px;
  z-index: 30;
  display: none;
  gap: 2px;
  width: min(320px, calc(100vw - 28px));
  padding: 8px 12px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 8px;
  color: #1f351e;
  text-align: center;
  background: rgba(255, 248, 217, 0.9);
  box-shadow: 0 14px 34px rgba(25, 32, 18, 0.18);
  transform: translateX(-50%);
  pointer-events: none;
}

.rotate-hint strong,
.rotate-hint span {
  display: block;
}

.rotate-hint strong {
  font-size: 0.9rem;
  line-height: 1.1;
}

.rotate-hint span {
  font-size: 0.74rem;
  line-height: 1.2;
}

.topbar,
.play-area {
  border: 1px solid var(--line);
  background: rgba(255, 248, 217, 0.88);
  box-shadow: 0 22px 50px rgba(53, 99, 40, 0.24);
  backdrop-filter: blur(18px);
}

.topbar {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 18px;
  align-items: center;
  padding: 18px;
  border-radius: 8px 8px 0 0;
}

.eyebrow {
  margin: 0 0 4px;
  color: #24733d;
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1 {
  margin: 0;
  font-size: clamp(2rem, 6vw, 4.9rem);
  line-height: 0.92;
  letter-spacing: 0;
  color: #20461d;
  text-shadow: 0 4px 0 rgba(255, 255, 255, 0.55);
}

.stats {
  display: grid;
  grid-template-columns: repeat(4, 82px);
  gap: 8px;
}

.stat {
  min-height: 64px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.48);
}

.stat span {
  display: block;
  color: var(--muted);
  font-size: 0.76rem;
}

.stat strong {
  display: block;
  margin-top: 2px;
  font-size: 1.55rem;
}

.primary-btn {
  min-width: 112px;
  min-height: 46px;
  border: 0;
  border-radius: 8px;
  color: #20351f;
  font-weight: 900;
  background: linear-gradient(135deg, #ffe47a, #ffab4d);
  cursor: pointer;
}

.primary-btn.paused {
  color: #fff8d9;
  background: linear-gradient(135deg, #447d54, #214b2a);
}

.player-panel {
  display: grid;
  gap: 5px;
  min-height: 64px;
  padding: 8px;
  border: 1px solid rgba(54, 84, 42, 0.2);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.42);
}

.player-actions,
.username-form {
  display: grid;
  grid-template-columns: 1fr auto auto auto;
  gap: 5px;
  align-items: center;
}

.player-actions strong {
  min-width: 0;
  overflow: hidden;
  color: #244b21;
  font-size: 0.78rem;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.player-actions button,
.username-form button,
.leaderboard-head button {
  min-height: 24px;
  border: 1px solid rgba(54, 84, 42, 0.2);
  border-radius: 7px;
  color: #20351f;
  font-size: 0.68rem;
  font-weight: 800;
  background: rgba(255, 248, 217, 0.78);
  cursor: pointer;
}

.username-form {
  grid-template-columns: 1fr auto;
}

.username-form input {
  min-width: 0;
  height: 28px;
  border: 1px solid rgba(54, 84, 42, 0.24);
  border-radius: 7px;
  padding: 0 8px;
  color: #20351f;
  background: rgba(255, 255, 255, 0.72);
  outline: 0;
}

.player-panel small {
  overflow: hidden;
  color: var(--muted);
  font-size: 0.68rem;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.player-panel small.error {
  color: #b62f36;
  font-weight: 800;
}

.play-area {
  display: block;
  padding: 16px;
  border-top: 0;
  border-radius: 0 0 8px 8px;
}

.deck {
  position: absolute;
  left: 1.2%;
  top: 3.6%;
  z-index: 9;
  display: grid;
  grid-template-columns: 1fr;
  align-content: start;
  gap: 6px;
  width: min(132px, 11.6%);
  max-height: 93%;
  padding: 6px;
  border: 1px solid rgba(255, 255, 255, 0.36);
  border-radius: 8px;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.24), rgba(228, 255, 221, 0.1));
  box-shadow: 0 16px 32px rgba(25, 32, 18, 0.18), inset 0 1px 0 rgba(255, 255, 255, 0.45);
  backdrop-filter: blur(10px) saturate(1.18);
  overflow-y: auto;
  scrollbar-width: thin;
}

.leaderboard-panel {
  position: absolute;
  right: 1.2%;
  top: 3.6%;
  z-index: 11;
  width: min(190px, 16.5%);
  max-height: 232px;
  padding: 8px;
  border: 1px solid rgba(255, 255, 255, 0.34);
  border-radius: 8px;
  color: #f7ffe9;
  background: linear-gradient(135deg, rgba(24, 39, 31, 0.46), rgba(255, 255, 255, 0.12));
  box-shadow: 0 14px 30px rgba(17, 31, 18, 0.16), inset 0 1px 0 rgba(255, 255, 255, 0.3);
  backdrop-filter: blur(10px) saturate(1.1);
}

.leaderboard-head {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 6px;
  align-items: center;
}

.leaderboard-head strong {
  font-size: 0.82rem;
}

.leaderboard-panel ol {
  display: grid;
  gap: 5px;
  max-height: 178px;
  margin: 8px 0 0;
  padding: 0;
  overflow: auto;
  list-style: none;
  scrollbar-width: thin;
}

.leaderboard-panel li {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 6px;
  align-items: baseline;
  padding-bottom: 4px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.14);
  font-size: 0.72rem;
}

.leaderboard-panel span {
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.leaderboard-panel em {
  color: #ffe47a;
  font-style: normal;
  font-weight: 900;
}

.start-auth-modal {
  position: absolute;
  left: 50%;
  top: 50%;
  z-index: 26;
  display: none;
  width: min(380px, 36%);
  padding: 18px;
  border: 1px solid rgba(255, 255, 255, 0.36);
  border-radius: 8px;
  color: #20351f;
  text-align: center;
  background: rgba(255, 248, 217, 0.94);
  box-shadow: 0 22px 48px rgba(17, 31, 18, 0.28);
  transform: translate(-50%, -50%);
  backdrop-filter: blur(14px);
}

.start-auth-modal.visible {
  display: grid;
  gap: 10px;
}

.start-auth-modal::before {
  position: fixed;
  inset: -100vmax;
  z-index: -1;
  background: rgba(13, 30, 12, 0.44);
  content: "";
}

.start-auth-modal strong {
  color: #b62f36;
  font-size: 1.75rem;
  line-height: 1;
}

.start-auth-modal span,
.start-auth-modal small {
  color: var(--muted);
}

.start-auth-modal small.error {
  color: #b62f36;
  font-weight: 800;
}

.start-auth-modal .start-auth-actions,
.start-auth-modal .start-username-form {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.start-auth-modal .start-username-form {
  grid-template-columns: 1fr auto;
}

.start-auth-modal .start-auth-actions button,
.start-auth-modal .start-username-form button {
  min-height: 38px;
  border: 0;
  border-radius: 8px;
  color: #20351f;
  font-weight: 900;
  background: linear-gradient(135deg, #ffe47a, #ffab4d);
  cursor: pointer;
}

.start-auth-modal .start-username-form input {
  min-width: 0;
  border: 1px solid rgba(54, 84, 42, 0.24);
  border-radius: 8px;
  padding: 0 10px;
  color: #20351f;
  background: rgba(255, 255, 255, 0.78);
  outline: 0;
}

.game-over-leaderboard {
  display: grid;
  gap: 6px;
  width: min(440px, 92%);
  margin-top: 10px;
  padding: 10px;
  border: 1px solid rgba(182, 47, 54, 0.2);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.6);
}

.game-over-leaderboard b {
  color: #20351f;
  font-size: 0.9rem;
}

/* Shared leaderboard list style — used in game-over and start screen */
.lb-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-height: 180px;
  margin: 0;
  padding: 0;
  overflow-y: auto;
  list-style: none;
  scrollbar-width: thin;
  scrollbar-color: rgba(82,125,55,0.3) transparent;
}

.lb-list li {
  display: grid;
  grid-template-columns: 22px 1fr auto auto;
  align-items: center;
  gap: 6px;
  padding: 4px 6px;
  border-radius: 5px;
  font-size: 0.72rem;
  background: rgba(255,255,255,0.35);
}

.lb-list li:nth-child(1) { background: rgba(255, 215, 0, 0.25); }
.lb-list li:nth-child(2) { background: rgba(192, 192, 192, 0.22); }
.lb-list li:nth-child(3) { background: rgba(205, 127, 50, 0.20); }

.lb-rank {
  font-weight: 900;
  color: #60764c;
  text-align: right;
}

.lb-name {
  font-weight: 800;
  color: #1a3318;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.lb-wave {
  font-size: 0.65rem;
  font-weight: 700;
  color: #60764c;
  white-space: nowrap;
}

.lb-score {
  font-weight: 900;
  color: #b62f36;
  white-space: nowrap;
}

.game-over-leaderboard ol,
#gameOverLeaderboardList,
#startLeaderboardList {
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-height: 180px;
  margin: 0;
  padding: 0;
  overflow-y: auto;
  list-style: none;
  scrollbar-width: thin;
  scrollbar-color: rgba(82,125,55,0.3) transparent;
}

#gameOverLeaderboardList li,
#startLeaderboardList li {
  display: grid;
  grid-template-columns: 22px 1fr auto auto;
  align-items: center;
  gap: 6px;
  padding: 4px 6px;
  border-radius: 5px;
  font-size: 0.72rem;
  color: #1a3318;
  background: rgba(255,255,255,0.35);
}

#gameOverLeaderboardList li:nth-child(1),
#startLeaderboardList li:nth-child(1) { background: rgba(255, 215, 0, 0.28); }
#gameOverLeaderboardList li:nth-child(2),
#startLeaderboardList li:nth-child(2) { background: rgba(192, 192, 192, 0.24); }
#gameOverLeaderboardList li:nth-child(3),
#startLeaderboardList li:nth-child(3) { background: rgba(205, 127, 50, 0.22); }

#gameOverLeaderboardList .lb-rank,
#startLeaderboardList .lb-rank { font-weight: 900; color: #60764c; text-align: right; }

#gameOverLeaderboardList .lb-name,
#startLeaderboardList .lb-name { font-weight: 800; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }

#gameOverLeaderboardList .lb-wave,
#startLeaderboardList .lb-wave { font-size: 0.65rem; font-weight: 700; color: #60764c; }

#gameOverLeaderboardList .lb-score,
#startLeaderboardList .lb-score { font-weight: 900; color: #b62f36; }

.lb-loading { color: #60764c; font-size: 0.72rem; padding: 4px 6px; }

/* Start screen leaderboard panel */
.start-tab-panel[data-start-panel="leaderboard"] {
  padding: 8px;
  background: rgba(255,255,255,0.05);
  border-color: rgba(255,255,255,0.12);
}

#startLeaderboardList .lb-name { color: rgba(255,255,255,0.9); }
#startLeaderboardList .lb-rank { color: rgba(255,215,0,0.8); }
#startLeaderboardList .lb-wave { color: rgba(255,255,255,0.55); }
#startLeaderboardList .lb-score { color: #FFD700; }
#startLeaderboardList li { background: rgba(255,255,255,0.08); color: rgba(255,255,255,0.9); }
#startLeaderboardList li:nth-child(1) { background: rgba(255,215,0,0.18); }
#startLeaderboardList li:nth-child(2) { background: rgba(192,192,192,0.14); }
#startLeaderboardList li:nth-child(3) { background: rgba(205,127,50,0.14); }
.lb-loading { color: rgba(255,255,255,0.5); }

.card {
  position: relative;
  display: grid;
  grid-template-columns: 32px 1fr;
  gap: 6px;
  align-items: center;
  width: 100%;
  min-height: 50px;
  padding: 6px;
  border: 1px solid rgba(255, 255, 255, 0.28);
  border-radius: 8px;
  color: #f7ffe9;
  text-align: left;
  background: rgba(27, 42, 27, 0.34);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.22), 0 8px 18px rgba(17, 31, 18, 0.14);
  backdrop-filter: blur(8px);
  cursor: pointer;
}

.card.selected {
  border-color: rgba(255, 233, 112, 0.92);
  background: rgba(52, 94, 45, 0.5);
  box-shadow: 0 0 0 2px rgba(255, 224, 83, 0.28), 0 10px 22px rgba(54, 108, 39, 0.24);
}

.card:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.card.locked {
  position: relative;
}

.card.locked::after {
  position: absolute;
  right: 6px;
  bottom: 5px;
  padding: 1px 5px;
  border-radius: 999px;
  color: #fff8d9;
  font-size: 0.56rem;
  font-weight: 900;
  background: rgba(45, 54, 35, 0.72);
  content: "LOCK";
}

.tool-card {
  background: rgba(136, 102, 52, 0.46);
}

.tool-card.selected {
  border-color: rgba(255, 202, 117, 0.9);
  box-shadow: 0 0 0 2px rgba(172, 113, 45, 0.25), 0 10px 20px rgba(88, 56, 24, 0.2);
}

.card strong,
.card small {
  display: block;
}

.card small {
  margin-top: 3px;
  color: rgba(242, 255, 222, 0.72);
  font-size: 0.62rem;
  line-height: 1.15;
}

.card strong {
  font-size: 0.78rem;
  line-height: 1.05;
}

.board-wrap {
  position: relative;
  display: block;
  overflow: hidden;
  min-width: 0;
  min-height: 520px;
  aspect-ratio: 2750 / 1473;
  isolation: isolate;
  border: 2px solid rgba(76, 122, 53, 0.46);
  border-radius: 8px;
  background: #8fc76b;
}

.board-wrap::before {
  position: absolute;
  inset: 0;
  z-index: 0;
  background:
    linear-gradient(90deg, rgba(31, 54, 21, 0.08), rgba(255, 255, 255, 0.02)),
    url("assets/background-zoom-2.png") center / 100% 100% no-repeat;
  content: "";
}

.bg-layer {
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  opacity: 0;
  transition: opacity 1800ms ease;
}

.bg-evening {
  background: url("assets/background-evening.png") center / 100% 100% no-repeat;
}

.bg-night {
  background: url("assets/background-night.png") center / 100% 100% no-repeat;
}

.board-wrap.evening .bg-evening,
.board-wrap.night .bg-night {
  opacity: 1;
}

.board-wrap.raining {
  box-shadow: inset 0 0 0 999px rgba(32, 55, 54, 0.12), 0 22px 50px rgba(53, 99, 40, 0.24);
}

.porch {
  position: absolute;
  left: 12.8%;
  top: 10.183%;
  width: 9%;
  height: 89.817%;
  z-index: 1;
  overflow: hidden;
  background: transparent;
  pointer-events: none;
}

.porch::before {
  position: absolute;
  inset: 0 0 auto;
  height: 18px;
  background: linear-gradient(180deg, rgba(63, 52, 38, 0.28), transparent);
  content: "";
}

.porch::after {
  position: absolute;
  inset: auto 0 0;
  height: 18px;
  background: linear-gradient(0deg, rgba(63, 52, 38, 0.24), transparent);
  content: "";
}

.board {
  position: absolute;
  left: 22.182%;
  top: 10.183%;
  width: 69.455%;
  height: 82.145%;
  z-index: 1;
  display: grid;
  grid-template-columns: repeat(9, 1fr);
  grid-template-rows: repeat(5, 1fr);
  min-height: 0;
  overflow: visible;
  background: transparent;
}

.entry-yard {
  position: absolute;
  left: 91.636%;
  top: 10.183%;
  width: 8.364%;
  height: 82.145%;
  z-index: 1;
  pointer-events: none;
}

.cell {
  position: relative;
  appearance: none;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: crosshair;
}

.cell:focus,
.cell:focus-visible,
.cell:hover {
  outline: 0;
  background: transparent;
}

.message {
  position: absolute;
  z-index: 8;
  left: 50%;
  bottom: -8px;
  width: max-content;
  max-width: min(620px, 52%);
  padding: 8px 16px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 8px;
  color: #1f351e;
  font-size: 1.04rem;
  line-height: 1.2;
  background: rgba(255, 248, 217, 0.86);
  transform: translateX(-50%);
  pointer-events: none;
  white-space: normal;
}

.phase-toast {
  position: absolute;
  left: 50%;
  top: 16px;
  z-index: 10;
  display: grid;
  gap: 3px;
  min-width: min(360px, 76%);
  padding: 12px 16px;
  border: 1px solid rgba(255, 255, 255, 0.62);
  border-radius: 8px;
  color: #f4ffe8;
  text-align: center;
  background: rgba(25, 43, 31, 0.82);
  box-shadow: 0 14px 28px rgba(20, 29, 19, 0.28);
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, -10px);
  transition: opacity 240ms ease, transform 240ms ease;
}

.phase-toast.visible {
  opacity: 1;
  transform: translate(-50%, 0);
}

.phase-toast strong,
.phase-toast span {
  display: block;
}

.phase-toast strong {
  font-size: 1.08rem;
}

.phase-toast span {
  font-size: 0.88rem;
}

.pause-modal,
.game-over-modal,
.unlock-modal {
  position: absolute;
  left: 50%;
  top: 50%;
  z-index: 20;
  display: grid;
  gap: 8px;
  min-width: min(360px, 74%);
  padding: 28px 30px;
  border: 3px solid rgba(255, 255, 255, 0.88);
  border-radius: 8px;
  color: #fff8d9;
  text-align: center;
  background: rgba(81, 10, 12, 0.86);
  box-shadow: 0 20px 55px rgba(29, 7, 6, 0.5);
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, -50%) scale(0.92);
  transition: opacity 180ms ease, transform 180ms ease;
}

.pause-modal {
  color: #20351f;
  background: rgba(255, 248, 217, 0.9);
  box-shadow: 0 20px 55px rgba(29, 42, 16, 0.34);
}

.pause-modal::before {
  position: fixed;
  inset: -100vmax;
  z-index: -1;
  background: rgba(13, 30, 12, 0.42);
  content: "";
}

.pause-modal.visible,
.game-over-modal.visible,
.unlock-modal.visible {
  opacity: 1;
  pointer-events: auto;
  transform: translate(-50%, -50%) scale(1);
}

.unlock-modal {
  min-width: min(430px, 78%);
  padding: 22px 24px 20px;
  color: #f6ffe8;
  background: rgba(21, 47, 29, 0.9);
  box-shadow: 0 24px 58px rgba(12, 21, 14, 0.52);
}

.unlock-modal::before {
  position: fixed;
  inset: -100vmax;
  z-index: -1;
  background: rgba(13, 30, 12, 0.48);
  content: "";
}

.unlock-modal img {
  justify-self: center;
  width: 104px;
  height: 124px;
  object-fit: contain;
  filter: drop-shadow(0 10px 16px rgba(0, 0, 0, 0.32));
}

.unlock-kicker {
  color: #ffe66e;
  font-size: 0.78rem;
  font-weight: 950;
  letter-spacing: 0;
  text-transform: uppercase;
}

.unlock-modal strong {
  color: #fff8c7;
  font-size: clamp(1.8rem, 4vw, 3rem);
  line-height: 0.95;
}

.unlock-modal p {
  margin: 0;
  color: rgba(246, 255, 232, 0.86);
  font-weight: 750;
  line-height: 1.35;
}

.unlock-modal button {
  justify-self: center;
  min-width: 132px;
  min-height: 42px;
  border: 0;
  border-radius: 8px;
  color: #253413;
  font-weight: 950;
  background: linear-gradient(135deg, #fff177, #9ee96b);
  cursor: pointer;
}

.pause-modal strong {
  color: #20461d;
  font-size: clamp(2rem, 6vw, 4rem);
  line-height: 0.9;
  letter-spacing: 0;
}

.game-over-modal strong {
  color: #ff3131;
  font-size: clamp(2.2rem, 7vw, 5rem);
  line-height: 0.9;
  letter-spacing: 0;
  text-shadow: 0 4px 0 #260607, 0 0 20px rgba(255, 74, 74, 0.5);
}

.pause-modal span,
.game-over-modal span {
  font-weight: 800;
}

.parrot,
.sunflower,
.zombie,
.mower,
.projectile,
.laser,
.sun-token {
  position: absolute;
  z-index: 3;
}

.mower {
  z-index: 4;
  width: min(86px, 10%);
  aspect-ratio: 1552 / 1110;
  transform: translate(-50%, -50%);
  filter: drop-shadow(0 8px 8px rgba(61, 54, 33, 0.28));
  pointer-events: none;
  animation: engineIdle 220ms ease-in-out infinite;
}

.mower.used {
  opacity: 0.18;
}

.mower img {
  position: relative;
  z-index: 2;
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.mower-smoke {
  position: absolute;
  left: -12px;
  top: 52%;
  z-index: 1;
  width: 18px;
  height: 12px;
  border-radius: 999px;
  background:
    radial-gradient(circle at 25% 60%, rgba(224, 224, 210, 0.75) 0 5px, transparent 6px),
    radial-gradient(circle at 62% 35%, rgba(210, 210, 198, 0.58) 0 4px, transparent 5px);
  opacity: 0;
  transform: translateY(-50%) scale(0.65);
  pointer-events: none;
}

.mower.launched .mower-smoke {
  opacity: 1;
  animation: mowerSmoke 460ms ease-out infinite;
}

.parrot {
  width: min(96px, 12%);
  aspect-ratio: 6 / 7;
  transform: translate(-50%, -50%);
  filter: drop-shadow(0 8px 12px rgba(0, 0, 0, 0.32));
  animation: unitIdle 1.8s ease-in-out infinite;
}

.parrot img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  pointer-events: none;
  user-select: none;
}

.parrot.flower {
  width: min(54px, 6.75%);
  aspect-ratio: 1214 / 1800;
  animation: flowerIdle 2.2s ease-in-out infinite;
}

.parrot.grim {
  width: min(78px, 9.75%);
  aspect-ratio: 1435 / 1795;
  animation: grimIdle 1.8s ease-in-out infinite;
}

.parrot.rock {
  width: min(90px, 11.25%);
  aspect-ratio: 460 / 442;
  animation: unitIdle 2s ease-in-out infinite;
}

.parrot.hypno {
  width: min(92px, 11.5%);
  aspect-ratio: 1600 / 1800;
  animation: hypnoIdle 2.1s ease-in-out infinite;
}

.parrot.hypno.hypno-cast {
  filter: drop-shadow(0 8px 12px rgba(0, 0, 0, 0.32)) drop-shadow(0 0 14px rgba(44, 255, 169, 0.72));
}

.grim-timer {
  position: absolute;
  left: 50%;
  top: -14px;
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border: 2px solid rgba(255, 255, 255, 0.9);
  border-radius: 50%;
  color: #fff8d9;
  font-size: 0.84rem;
  font-weight: 950;
  background: rgba(52, 15, 58, 0.88);
  box-shadow: 0 8px 18px rgba(15, 6, 18, 0.36);
  transform: translateX(-50%);
}

.unit-hp {
  position: absolute;
  left: 18px;
  right: 18px;
  bottom: -4px;
  height: 3px;
  border-radius: 8px;
  background: rgba(39, 48, 27, 0.22);
  overflow: hidden;
  opacity: 0;
  transition: opacity 320ms ease;
}

.unit-hp.hp-visible {
  opacity: 1;
}

.unit-hp span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: #46d85f;
}

.sunflower {
  width: min(96px, 12%);
  aspect-ratio: 1;
  transform: translate(-50%, -50%);
  filter: drop-shadow(0 9px 10px rgba(61, 96, 31, 0.3));
}

.sunflower img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  pointer-events: none;
  user-select: none;
}

.sunflower-base {
  clip-path: inset(72% 0 0 0);
}

.sunflower-top {
  clip-path: inset(0 0 21% 0);
  transform-origin: 50% 100%;
  animation: sunflowerSway 2.35s ease-in-out infinite;
}

.parrot .body,
.mini-parrot::before {
  position: absolute;
  inset: 11px 5px 3px;
  border-radius: 52% 52% 46% 46%;
  background: #ff58b8;
  content: "";
}

.parrot .wing {
  position: absolute;
  right: 2px;
  bottom: 12px;
  width: 24px;
  height: 30px;
  border-radius: 80% 30% 70% 40%;
  background: rgba(255, 255, 255, 0.24);
}

.parrot .eye {
  position: absolute;
  top: 24px;
  width: 12px;
  height: 13px;
  border-radius: 50%;
  background: #fff;
}

.parrot .eye.left {
  left: 18px;
}

.parrot .eye.right {
  left: 32px;
}

.parrot .eye::after {
  position: absolute;
  inset: 4px;
  border-radius: 50%;
  background: #151019;
  content: "";
}

.parrot .beak {
  position: absolute;
  left: 35px;
  top: 37px;
  width: 18px;
  height: 12px;
  clip-path: polygon(0 0, 100% 45%, 0 100%);
  background: #823cff;
}

.hat {
  position: absolute;
  z-index: 2;
}

.artist .hat {
  left: 12px;
  top: 4px;
  width: 34px;
  height: 12px;
  border-radius: 50% 50% 40% 40%;
  background: repeating-linear-gradient(90deg, #44e8ff 0 7px, #6bff9b 7px 14px);
}

.vr .hat {
  left: 8px;
  top: 21px;
  width: 42px;
  height: 18px;
  border: 2px solid #2d133f;
  border-radius: 9px;
  background: linear-gradient(135deg, #2df7ff, #ff4fca);
}

.royal .hat {
  left: 13px;
  top: 5px;
  width: 34px;
  height: 20px;
  clip-path: polygon(0 100%, 0 30%, 22% 62%, 50% 0, 78% 62%, 100% 30%, 100% 100%);
  background: var(--gold);
}

.coder .hat {
  left: 11px;
  top: 13px;
  width: 36px;
  height: 14px;
  border-radius: 7px;
  background: #101018;
  box-shadow: inset 0 0 0 2px #fff;
}

.mini-parrot {
  position: relative;
  display: block;
  width: 42px;
  height: 44px;
}

.mini-unit {
  display: grid;
  place-items: center;
  width: 32px;
  height: 34px;
  overflow: hidden;
}

.mini-unit img {
  width: 40px;
  height: 40px;
  object-fit: contain;
  filter: drop-shadow(0 3px 3px rgba(12, 20, 10, 0.34));
}

.shovel-icon img {
  width: 46px;
  height: 46px;
  transform: rotate(-18deg);
}

.mini-parrot::after {
  position: absolute;
  right: 2px;
  top: 25px;
  width: 13px;
  height: 9px;
  clip-path: polygon(0 0, 100% 45%, 0 100%);
  background: #823cff;
  content: "";
}

.zombie {
  width: min(92px, 11.5%);
  aspect-ratio: 39 / 47;
  transform: translate(-50%, -50%);
  filter: drop-shadow(0 8px 14px rgba(0, 0, 0, 0.36));
  pointer-events: none;
}

.zombie.lv2 {
  width: min(122px, 14%);
  aspect-ratio: 593 / 480;
}

.zombie.lv2.enraged {
  filter: drop-shadow(0 8px 14px rgba(0, 0, 0, 0.36)) drop-shadow(0 0 10px rgba(255, 69, 44, 0.55));
}

.zombie.stunned .zombie-sprite {
  filter: saturate(0.86) brightness(1.16) drop-shadow(0 0 8px rgba(128, 238, 255, 0.72));
}

.zombie.hypnotized {
  filter: drop-shadow(0 8px 14px rgba(0, 0, 0, 0.36)) drop-shadow(0 0 13px rgba(44, 255, 169, 0.7));
}

.zombie.hypnotized::after {
  position: absolute;
  left: 50%;
  top: -20px;
  z-index: 5;
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border: 2px solid rgba(42, 255, 166, 0.86);
  border-radius: 50%;
  color: #1fffa0;
  font-size: 1.25rem;
  font-weight: 950;
  line-height: 1;
  text-shadow: 0 0 8px rgba(31, 255, 160, 0.9);
  background:
    radial-gradient(circle, transparent 0 4px, currentColor 5px 6px, transparent 7px 9px, currentColor 10px 11px, transparent 12px);
  content: "";
  transform: translateX(-50%);
  animation: hypnoSpin 900ms linear infinite;
}

.zombie::before {
  content: none;
}

.zombie::after {
  content: none;
}

.zombie-sprite {
  position: absolute;
  inset: 0;
  background-image: url("assets/opt/zombies/cat-zombie-walk-sheet.png");
  background-repeat: no-repeat;
  background-size: 800% 100%;
  background-position: 0 0;
  transform-origin: 50% 82%;
}

.zombie .hp {
  position: absolute;
  left: 22px;
  right: 22px;
  bottom: 4px;
  height: 3px;
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.3);
  opacity: 0;
  overflow: hidden;
  transition: opacity 320ms ease;
}

.zombie .hp.hp-visible {
  opacity: 1;
}

.zombie .hp span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--danger);
}

.projectile {
  width: 22px;
  height: 8px;
  transform: translate(-50%, -50%);
  border-radius: 8px;
  background: var(--gold);
  box-shadow: 0 0 16px currentColor;
  animation: projectileSpin 420ms linear infinite;
}

.projectile.pencil {
  width: 28px;
  height: 7px;
  background: linear-gradient(90deg, #f6d36b 0 66%, #f4f0e8 66% 82%, #241321 82%);
}

.projectile.pizza {
  width: 25px;
  height: 22px;
  border-radius: 70% 30% 45% 45%;
  clip-path: polygon(4% 12%, 100% 50%, 8% 96%);
  background:
    radial-gradient(circle at 52% 50%, #d84032 0 3px, transparent 4px),
    radial-gradient(circle at 34% 64%, #4aa54d 0 3px, transparent 4px),
    linear-gradient(90deg, #ffd071, #f59635);
}

.projectile.shuriken {
  width: 24px;
  height: 24px;
  clip-path: polygon(50% 0, 62% 35%, 100% 50%, 62% 65%, 50% 100%, 38% 65%, 0 50%, 38% 35%);
  background: #d7dde2;
}

.projectile.crown {
  width: 26px;
  height: 18px;
  clip-path: polygon(0 100%, 0 36%, 24% 58%, 50% 0, 76% 58%, 100% 36%, 100% 100%);
  background: var(--gold);
}

.projectile.crown::after {
  position: absolute;
  inset: -10px;
  border-radius: 50%;
  border: 2px solid rgba(255, 211, 92, 0.45);
  content: "";
}

.projectile.bolt {
  width: 16px;
  height: 24px;
  clip-path: polygon(45% 0, 100% 0, 60% 38%, 100% 38%, 25% 100%, 42% 54%, 0 54%);
  background: var(--green);
}

.laser {
  height: 5px;
  transform: translateY(-50%);
  border-radius: 999px;
  background: var(--cyan);
  box-shadow: 0 0 18px var(--cyan);
  pointer-events: none;
}

.sonic-wave,
.grim-burst,
.poison-zone {
  position: absolute;
  z-index: 2;
  pointer-events: none;
}

.sonic-wave {
  border: 3px solid rgba(137, 239, 255, 0.82);
  border-radius: 50%;
  box-shadow: 0 0 20px rgba(137, 239, 255, 0.42), inset 0 0 20px rgba(137, 239, 255, 0.18);
  opacity: 0;
  transform: translate(-50%, -50%) scale(0.1);
  animation: sonicPulse 760ms ease-out forwards;
}

.grim-burst {
  border-radius: 50%;
  background:
    radial-gradient(circle, rgba(255, 251, 202, 0.92) 0 12%, rgba(255, 65, 146, 0.58) 24%, rgba(94, 28, 120, 0.25) 54%, rgba(94, 28, 120, 0) 72%);
  opacity: 0;
  transform: translate(-50%, -50%) scale(0.32);
  animation: grimBurst 700ms ease-out forwards;
}

.poison-zone {
  border: 2px solid rgba(147, 255, 118, 0.28);
  border-radius: 18px;
  background:
    radial-gradient(circle at 30% 34%, rgba(188, 255, 93, 0.26), transparent 31%),
    radial-gradient(circle at 70% 66%, rgba(99, 42, 128, 0.28), transparent 34%),
    rgba(68, 152, 78, 0.12);
  filter: blur(0.2px);
  animation: poisonPulse 1.3s ease-in-out infinite;
}

.raindrop {
  position: absolute;
  z-index: 7;
  width: 2px;
  border-radius: 999px;
  background: linear-gradient(180deg, rgba(228, 250, 255, 0.92), rgba(122, 202, 240, 0.28));
  box-shadow: 0 0 5px rgba(172, 226, 255, 0.42);
  pointer-events: none;
  transform: rotate(16deg);
}

.sun-token {
  z-index: 6;
  width: 48px;
  height: 48px;
  border: 0;
  border-radius: 50%;
  color: #5a3700;
  font-weight: 900;
  background:
    radial-gradient(circle, #fff7a8 0 30%, #ffd14b 31% 61%, #ff9f2e 62% 100%);
  box-shadow: 0 5px 0 rgba(147, 90, 0, 0.26), 0 0 22px rgba(255, 216, 74, 0.7);
  cursor: pointer;
  transform: translate(-50%, -50%);
  animation: sunPulse 1.2s ease-in-out infinite;
}

.sun-token::before {
  position: absolute;
  inset: -9px;
  z-index: -1;
  border-radius: inherit;
  background: repeating-conic-gradient(#ffd14b 0 10deg, transparent 10deg 20deg);
  content: "";
}

.sun-token.rain-discount {
  color: #2f5570;
  background:
    radial-gradient(circle, #ebfbff 0 30%, #cceeff 31% 61%, #8fd6ff 62% 100%);
  box-shadow: 0 5px 0 rgba(46, 104, 132, 0.22), 0 0 18px rgba(151, 220, 255, 0.62);
}

.sun-token.rain-discount::before {
  background: repeating-conic-gradient(#c9efff 0 10deg, transparent 10deg 20deg);
}

.hit {
  animation: hit 160ms ease-out;
}

@keyframes hit {
  50% {
    filter: brightness(2) drop-shadow(0 0 14px #fff);
  }
}

@keyframes bob {
  50% {
    transform: translateY(-4px) rotate(3deg);
  }
}

@keyframes sunPulse {
  50% {
    transform: translate(-50%, -50%) scale(1.08);
  }
}

@keyframes unitIdle {
  50% {
    transform: translate(-50%, calc(-50% - 4px)) rotate(-1deg);
  }
}

@keyframes sunflowerSway {
  0%,
  100% {
    transform: translateX(0) skewX(0deg);
  }

  28% {
    transform: translateX(-3px) skewX(-1.8deg);
  }

  68% {
    transform: translateX(3px) skewX(1.8deg);
  }
}

@keyframes flowerIdle {
  0%,
  100% {
    transform: translate(-50%, -50%) rotate(-1deg);
  }

  50% {
    transform: translate(-50%, calc(-50% - 3px)) rotate(1.2deg);
  }
}

@keyframes grimIdle {
  50% {
    transform: translate(-50%, calc(-50% - 2px)) rotate(-2deg);
  }
}

@keyframes hypnoIdle {
  0%,
  100% {
    transform: translate(-50%, -50%) rotate(-1deg);
  }

  50% {
    transform: translate(-50%, calc(-50% - 3px)) rotate(1deg);
  }
}

@keyframes hypnoSpin {
  to {
    transform: translateX(-50%) rotate(360deg);
  }
}

@keyframes sonicPulse {
  15% {
    opacity: 0.9;
  }

  100% {
    opacity: 0;
    transform: translate(-50%, -50%) scale(1);
  }
}

@keyframes grimBurst {
  12% {
    opacity: 1;
  }

  100% {
    opacity: 0;
    transform: translate(-50%, -50%) scale(1.1);
  }
}

@keyframes poisonPulse {
  50% {
    opacity: 0.66;
    transform: scale(1.02);
  }
}

@keyframes engineIdle {
  50% {
    transform: translate(calc(-50% + 1px), -50%);
  }
}

@keyframes mowerSmoke {
  0% {
    opacity: 0;
    transform: translate(0, -50%) scale(0.45);
  }

  35% {
    opacity: 0.72;
  }

  100% {
    opacity: 0;
    transform: translate(-22px, calc(-50% - 6px)) scale(1.35);
  }
}

@keyframes projectileSpin {
  to {
    filter: hue-rotate(18deg);
  }
}

@media (max-width: 820px) {
  body {
    place-items: start center;
  }

  .game-shell {
    padding: 8px 0;
  }

  .topbar {
    grid-template-columns: 1fr auto auto;
    gap: 8px;
    padding: 8px 10px;
  }

  .start-screen {
    padding: 20px;
  }

  .start-card {
    width: min(500px, calc(100% - 28px));
    padding: 18px;
    gap: 10px;
  }

  .start-logo strong {
    font-size: 3.1rem;
  }

  .start-login-actions button,
  .start-play-btn {
    min-height: 42px;
  }

  .eyebrow {
    margin-bottom: 1px;
    font-size: 0.64rem;
  }

  h1 {
    font-size: 3rem;
    line-height: 0.88;
  }

  .stats {
    grid-template-columns: repeat(4, 58px);
    gap: 5px;
  }

  .stat {
    min-height: 46px;
    padding: 6px;
  }

  .stat span {
    font-size: 0.62rem;
  }

  .stat strong {
    font-size: 1.2rem;
  }

  .primary-btn {
    min-width: 82px;
    min-height: 38px;
  }

  .player-panel {
    min-height: 46px;
    padding: 5px;
  }

  .start-auth-modal {
    width: min(340px, 42%);
    padding: 12px;
  }

  .start-auth-modal strong {
    font-size: 1.35rem;
  }

  .start-auth-actions button,
  .start-username-form button {
    min-height: 30px;
    font-size: 0.72rem;
  }

  .start-username-form input {
    font-size: 0.72rem;
  }

  .player-actions strong,
  .player-panel small {
    font-size: 0.58rem;
  }

  .player-actions button,
  .username-form button,
  .leaderboard-head button {
    min-height: 20px;
    font-size: 0.56rem;
  }

  .username-form input {
    height: 22px;
    padding: 0 5px;
    font-size: 0.62rem;
  }

  .play-area {
    padding: 8px;
  }

}

@media (max-width: 560px) {
  .rotate-hint {
    display: grid;
  }
}

@media (max-height: 520px) and (orientation: landscape) {
  .game-shell {
    padding: 4px 0;
  }

  .topbar {
    gap: 7px;
    padding: 6px 8px;
  }

  .eyebrow {
    display: none;
  }

  h1 {
    font-size: 2.55rem;
  }

  .stats {
    grid-template-columns: repeat(4, 54px);
  }

  .stat {
    min-height: 40px;
    padding: 5px;
  }

  .stat span {
    font-size: 0.58rem;
  }

  .stat strong {
    margin-top: 0;
    font-size: 1.08rem;
  }

  .primary-btn {
    min-width: 76px;
    min-height: 34px;
  }

  .player-panel {
    min-height: 40px;
  }

  .start-auth-modal {
    width: min(320px, 44%);
    padding: 10px;
  }

  .game-over-leaderboard ol {
    grid-template-columns: 1fr 1fr;
    max-height: 112px;
  }

  .play-area {
    padding: 6px;
  }

  .message {
    bottom: -6px;
    padding: 6px 12px;
    font-size: 0.94rem;
  }

  .rotate-hint {
    display: none;
  }
}

/* ── Music toggle button ─────────────────────────────────────────────────── */
.music-toggle-btn {
  position: fixed;
  top: 10px;
  right: 14px;
  z-index: 9999;
  width: 40px;
  height: 40px;
  border: none;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.45);
  color: #fff;
  font-size: 1.2rem;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s, opacity 0.2s;
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

.music-toggle-btn:hover {
  background: rgba(0, 0, 0, 0.65);
}

.music-toggle-btn.muted {
  opacity: 0.55;
}

@media (max-width: 560px) {
  .music-toggle-btn {
    top: 6px;
    right: 8px;
    width: 34px;
    height: 34px;
    font-size: 1rem;
  }
}

/* ── Parrot info overlay ─────────────────────────────────────────────────── */

.parrot-info-overlay {
  position: absolute;
  inset: 0;
  z-index: 10;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 28px 32px 24px;
  background: rgba(10, 24, 12, 0.72);
  backdrop-filter: blur(18px) saturate(1.2);
  -webkit-backdrop-filter: blur(18px) saturate(1.2);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.22s ease;
}

.parrot-info-overlay.visible {
  opacity: 1;
  pointer-events: auto;
}

.parrot-info-back {
  position: absolute;
  top: 20px;
  left: 24px;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 7px 16px;
  border: 1px solid rgba(255,255,255,0.28);
  border-radius: 8px;
  color: #e8f5d8;
  font-size: 0.82rem;
  font-weight: 800;
  background: rgba(255,255,255,0.10);
  backdrop-filter: blur(8px);
  cursor: pointer;
  transition: background 0.15s;
}

.parrot-info-back:hover {
  background: rgba(255,255,255,0.20);
}

.parrot-info-title {
  margin: 0 0 20px;
  color: #e8f5d8;
  font-size: 1.15rem;
  font-weight: 900;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  text-shadow: 0 2px 8px rgba(0,0,0,0.4);
}

/* 10 cards: 5 top row, 5 bottom row */
.parrot-cards-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 14px;
  width: 100%;
}

/* All cards span 1 column naturally — no overrides needed */
.parrot-card:nth-child(-n+5) { grid-column: unset; }
.parrot-card:nth-child(6)    { grid-column: unset; }
.parrot-card:nth-child(7)    { grid-column: unset; }
.parrot-card:nth-child(8)    { grid-column: unset; }
.parrot-card:nth-child(9)    { grid-column: unset; }

.parrot-card {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 24px 16px 18px;
  border: 1px solid rgba(255, 255, 255, 0.55);
  border-radius: 18px;
  text-align: center;
  background: rgba(255, 252, 230, 0.82);
  backdrop-filter: blur(16px) saturate(1.5);
  -webkit-backdrop-filter: blur(16px) saturate(1.5);
  box-shadow:
    0 6px 28px rgba(10, 30, 10, 0.28),
    inset 0 1px 0 rgba(255,255,255,0.90);
  transition: background 0.18s, transform 0.18s, box-shadow 0.18s;
}

.parrot-card:hover {
  background: rgba(255, 255, 245, 0.95);
  transform: translateY(-4px);
  box-shadow:
    0 12px 36px rgba(10, 30, 10, 0.34),
    inset 0 1px 0 rgba(255,255,255,1);
}

/* Locked parrots slightly dimmed */
.parrot-card--locked {
  opacity: 0.80;
}

.parrot-card--locked::after {
  content: "🔒";
  position: absolute;
  top: 9px;
  right: 11px;
  font-size: 0.7rem;
}

.parrot-card img {
  width: 88px;
  height: 88px;
  object-fit: contain;
  filter: drop-shadow(0 4px 8px rgba(0,0,0,0.22));
}

.parrot-card strong {
  font-size: 0.92rem;
  font-weight: 900;
  color: #1a3318;
  letter-spacing: 0.02em;
  line-height: 1;
}

.parrot-card p {
  margin: 0;
  font-size: 0.72rem;
  font-weight: 600;
  color: #3d5c35;
  line-height: 1.4;
  flex: 1;
}

.parrot-card-stats {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 5px;
  margin: 0;
  padding: 0;
  list-style: none;
  width: 100%;
}

.parrot-card-stats li {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 3px 8px;
  border: 1px solid rgba(82, 125, 55, 0.25);
  border-radius: 6px;
  background: rgba(255, 220, 60, 0.30);
  min-width: 36px;
}

.parrot-card-stats em {
  font-style: normal;
  font-size: 0.52rem;
  font-weight: 800;
  color: #60764c;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  line-height: 1;
}

.parrot-card-stats b {
  font-size: 0.72rem;
  font-weight: 900;
  color: #1a3318;
  line-height: 1.2;
}

/* ── Card placement cooldown ─────────────────────────────────────────────── */
.card.on-cooldown {
  opacity: 0.45;
  cursor: not-allowed;
  pointer-events: none;
}

.card-cooldown {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  border-radius: inherit;
  background: rgba(6, 14, 6, 0.62);
  pointer-events: none;
  z-index: 2;
  backdrop-filter: blur(2px);
}

/* Circular SVG ring */
.card-cooldown svg {
  width: 36px;
  height: 36px;
  transform: rotate(-90deg);
}

.card-cooldown .cd-track {
  fill: none;
  stroke: rgba(255,255,255,0.15);
  stroke-width: 3;
}

.card-cooldown .cd-ring {
  fill: none;
  stroke: #ffe87a;
  stroke-width: 3;
  stroke-linecap: round;
  transition: stroke-dashoffset 0.25s linear;
}

/* Number inside the ring */
.card-cooldown .cd-label {
  position: absolute;
  font-size: 0.78rem;
  font-weight: 900;
  color: #fff;
  line-height: 1;
  /* vertically centered inside the svg */
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  pointer-events: none;
}

/* wrapper so label sits on top of svg */
.card-cooldown-ring {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}
