/* =============================================================
   Mouse Zoo — Stylesheet
   Shares base structure with the Typing Zoo stylesheet.
   New classes: .animal-card, .kennel-target, .skill-hint
   ============================================================= */

/* ── 1. RESET & BASE ──────────────────────────────────────── */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  width: 100vw;
  height: 100vh;
  overflow: hidden;
  font-family: 'Nunito', system-ui, sans-serif;
  background: #111;
  color: white;
  user-select: none;
  -webkit-user-select: none;
}

button {
  font-family: inherit;
  cursor: pointer;
  border: none;
  outline: none;
}

button:focus-visible {
  outline: 3px solid #fbbf24;
  outline-offset: 3px;
}


/* ── 2. SCREEN SYSTEM ──────────────────────────────────────── */
.screen {
  position: fixed;
  inset: 0;
  display: none;
  flex-direction: column;
  z-index: 10;
}

.screen.active {
  display: flex;
}

.overlay-screen {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.82);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  z-index: 200;
}

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


/* ── 3. START SCREEN ───────────────────────────────────────── */
#screen-start {
  background:
    radial-gradient(ellipse at 20% 80%, rgba(212, 168, 67, 0.25) 0%, transparent 60%),
    radial-gradient(ellipse at 80% 20%, rgba(59, 130, 246, 0.2) 0%, transparent 60%),
    linear-gradient(135deg, #0f172a 0%, #1e1b4b 50%, #0f2027 100%);
  align-items: center;
  justify-content: flex-start;
  overflow-y: auto;
}

.start-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.5rem;
  padding: 2rem 2rem 2.5rem;
  max-width: 700px;
  width: 100%;
  margin: auto 0;
}

.start-title-block {
  text-align: center;
  animation: floatBob 3s ease-in-out infinite;
}

.start-logo {
  font-size: 5rem;
  line-height: 1;
  margin-bottom: 0.25rem;
  filter: drop-shadow(0 4px 12px rgba(0,0,0,0.5));
}

.start-title {
  font-size: clamp(3.5rem, 10vw, 6.5rem);
  font-weight: 900;
  line-height: 1;
  background: linear-gradient(135deg, #fbbf24 0%, #f59e0b 40%, #fde68a 70%, #fbbf24 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  text-shadow: none;
  letter-spacing: -0.04em;
  filter: drop-shadow(0 2px 24px rgba(251, 191, 36, 0.35));
}

.start-sub {
  font-size: 1.15rem;
  font-weight: 700;
  color: rgba(255, 255, 255, 0.75);
  margin-top: 0.5rem;
}

.how-to-card {
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 1.25rem;
  padding: 1.25rem 1.5rem;
  width: 100%;
  backdrop-filter: blur(8px);
}

.how-to-heading {
  font-size: 1.1rem;
  font-weight: 900;
  color: #fbbf24;
  margin-bottom: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.how-to-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.how-to-list li {
  font-size: 1rem;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.85);
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.how-icon {
  font-size: 1.3rem;
  flex-shrink: 0;
}

/* ── Profile Selector ───────────────────────────────────── */
.profile-section {
  width: 100%;
  background: rgba(255, 255, 255, 0.045);
  border: 1px solid rgba(255, 255, 255, 0.11);
  border-radius: 1.25rem;
  padding: 1rem 1.25rem 1.1rem;
}

.profile-section-hd { margin-bottom: 0.75rem; }

.profile-heading {
  font-size: 0.65rem;
  font-weight: 900;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.38);
}

.profile-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
  align-items: flex-start;
}

.profile-chip {
  position: relative;
  display: flex;
  align-items: center;
  gap: 0.35rem;
  min-width: 110px;
  padding: 0.5rem 0.8rem 0.5rem 0.7rem;
  background: rgba(255, 255, 255, 0.06);
  border: 2px solid rgba(255, 255, 255, 0.12);
  border-radius: 10px;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
  user-select: none;
}
.profile-chip:hover {
  background: rgba(255, 255, 255, 0.10);
  border-color: rgba(255, 255, 255, 0.24);
}
.profile-chip:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(251, 191, 36, 0.45);
}
.profile-chip.active {
  background: rgba(251, 191, 36, 0.10);
  border-color: rgba(251, 191, 36, 0.52);
  box-shadow: 0 0 0 1px rgba(251, 191, 36, 0.15);
}

.profile-chip-body {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1;
  min-width: 0;
}
.profile-chip-name {
  font-size: 0.9rem;
  font-weight: 800;
  color: rgba(255, 255, 255, 0.90);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 120px;
}
.profile-chip.active .profile-chip-name { color: #fbbf24; }

.profile-chip-stats {
  font-size: 0.6rem;
  font-weight: 700;
  color: rgba(255, 255, 255, 0.40);
}
.profile-chip.active .profile-chip-stats { color: rgba(251, 191, 36, 0.60); }

.profile-chip-delete {
  position: absolute;
  top: -7px;
  right: -7px;
  width: 18px;
  height: 18px;
  background: rgba(30, 30, 50, 0.95);
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 50%;
  color: rgba(255, 255, 255, 0.45);
  font-size: 0.7rem;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 0;
  opacity: 0;
  transition: opacity 0.15s ease, background 0.12s ease, color 0.12s ease;
}
.profile-chip:hover .profile-chip-delete { opacity: 1; }
.profile-chip-delete:hover {
  background: rgba(220, 38, 38, 0.85);
  border-color: rgba(220, 38, 38, 0.6);
  color: white;
}

.profile-chip-add {
  min-width: 72px;
  padding: 0.5rem 0.75rem;
  background: transparent;
  border: 2px dashed rgba(255, 255, 255, 0.18);
  border-radius: 10px;
  color: rgba(255, 255, 255, 0.35);
  font-family: inherit;
  font-size: 0.8rem;
  font-weight: 700;
  cursor: pointer;
  transition: border-color 0.15s ease, color 0.15s ease, background 0.15s ease;
  align-self: stretch;
  display: flex;
  align-items: center;
  justify-content: center;
}
.profile-chip-add:hover {
  border-color: rgba(255, 255, 255, 0.38);
  color: rgba(255, 255, 255, 0.65);
  background: rgba(255, 255, 255, 0.04);
}

.new-profile-form {
  margin-top: 0.8rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.new-profile-form.hidden { display: none !important; }

.new-profile-form input {
  padding: 0.55rem 0.8rem;
  background: rgba(255, 255, 255, 0.07);
  border: 2px solid rgba(255, 255, 255, 0.17);
  border-radius: 8px;
  color: white;
  font-family: inherit;
  font-size: 1rem;
  font-weight: 700;
  outline: none;
  transition: border-color 0.15s ease;
  width: 100%;
  box-sizing: border-box;
}
.new-profile-form input::placeholder {
  color: rgba(255, 255, 255, 0.28);
  font-weight: 400;
}
.new-profile-form input:focus { border-color: rgba(251, 191, 36, 0.55); }

.new-profile-btns {
  display: flex;
  gap: 0.5rem;
}

.profile-error {
  margin-top: 0.2rem;
  font-size: 0.75rem;
  font-weight: 700;
  color: #f87171;
}
.profile-error.hidden { display: none; }

#btn-start:disabled {
  opacity: 0.32;
  cursor: not-allowed;
  pointer-events: none;
}

.profile-chip-share {
  position: absolute;
  top: -7px;
  left: -7px;
  width: 18px;
  height: 18px;
  background: rgba(30, 30, 50, 0.95);
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 50%;
  color: rgba(255, 255, 255, 0.45);
  font-size: 0.6rem;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 0;
  opacity: 0;
  transition: opacity 0.15s ease, background 0.12s ease, color 0.12s ease;
}
.profile-chip:hover .profile-chip-share { opacity: 1; }
.profile-chip-share:hover {
  background: rgba(16, 185, 129, 0.85);
  border-color: rgba(16, 185, 129, 0.6);
  color: white;
}

.code-panel {
  margin-top: 0.8rem;
  padding: 0.9rem 1rem;
  background: rgba(16, 185, 129, 0.07);
  border: 1px solid rgba(16, 185, 129, 0.28);
  border-radius: 10px;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.code-panel.hidden { display: none; }

.code-panel-hd {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.code-panel-title {
  font-size: 0.65rem;
  font-weight: 900;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  color: rgba(52, 211, 153, 0.85);
}

.code-panel-for {
  font-size: 0.75rem;
  font-weight: 800;
  color: rgba(255, 255, 255, 0.5);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.code-display {
  font-family: 'Courier New', 'Consolas', monospace;
  font-size: 1.3rem;
  font-weight: 700;
  letter-spacing: 0.18em;
  color: #fbbf24;
  background: rgba(0, 0, 0, 0.28);
  border-radius: 7px;
  padding: 0.55rem 0.75rem;
  text-align: center;
  user-select: all;
  -webkit-user-select: all;
  cursor: text;
  word-break: break-all;
}

.code-hint {
  font-size: 0.7rem;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.32);
  text-align: center;
}

.code-actions {
  display: flex;
  gap: 0.45rem;
}

.btn-copy-code {
  flex: 1;
  padding: 0.45rem 0.75rem;
  background: rgba(16, 185, 129, 0.15);
  border: 1px solid rgba(16, 185, 129, 0.38);
  border-radius: 7px;
  color: #6ee7b7;
  font-family: inherit;
  font-size: 0.8rem;
  font-weight: 800;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}
.btn-copy-code:hover { background: rgba(16, 185, 129, 0.3); color: white; }

.btn-close-code {
  padding: 0.45rem 0.65rem;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 7px;
  color: rgba(255, 255, 255, 0.35);
  font-family: inherit;
  font-size: 0.8rem;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}
.btn-close-code:hover { background: rgba(255, 255, 255, 0.09); color: rgba(255, 255, 255, 0.65); }

.code-restore-section {
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  padding-top: 0.65rem;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.code-restore-label {
  font-size: 0.62rem;
  font-weight: 900;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.32);
}

.code-restore-input-row {
  display: flex;
  gap: 0.4rem;
}

.code-restore-input-row input {
  flex: 1;
  padding: 0.45rem 0.65rem;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 7px;
  color: white;
  font-family: 'Courier New', 'Consolas', monospace;
  font-size: 0.9rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  outline: none;
  transition: border-color 0.15s ease;
}
.code-restore-input-row input::placeholder {
  color: rgba(255, 255, 255, 0.2);
  font-weight: 400;
  text-transform: none;
  letter-spacing: 0;
}
.code-restore-input-row input:focus { border-color: rgba(251, 191, 36, 0.5); }

.btn-restore-existing {
  padding: 0.45rem 0.75rem;
  background: rgba(251, 191, 36, 0.12);
  border: 1px solid rgba(251, 191, 36, 0.32);
  border-radius: 7px;
  color: #fbbf24;
  font-family: inherit;
  font-size: 0.8rem;
  font-weight: 800;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s ease, color 0.15s ease;
}
.btn-restore-existing:hover { background: rgba(251, 191, 36, 0.25); color: white; }

.restore-existing-error {
  font-size: 0.72rem;
  font-weight: 700;
  color: #f87171;
}
.restore-existing-error.hidden { display: none; }

.restore-code-row {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.restore-code-label {
  font-size: 0.62rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.28);
}

#restore-code-input {
  font-family: 'Courier New', 'Consolas', monospace !important;
  font-size: 0.95rem !important;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.save-display {
  display: flex;
  gap: 1.5rem;
  align-items: center;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 0.75rem;
  padding: 0.45rem 1.2rem;
  font-size: 0.88rem;
  font-weight: 700;
  color: rgba(255, 255, 255, 0.55);
}
.save-display.hidden { display: none; }
#btn-continue.hidden { display: none; }
.save-item strong    { color: #fbbf24; font-weight: 900; }

.kofi-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.55rem 1.25rem;
  background: rgba(74, 222, 128, 0.10);
  border: 1px solid rgba(74, 222, 128, 0.30);
  border-radius: 50px;
  color: rgba(255, 255, 255, 0.55);
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 700;
  text-decoration: none;
  transition: background 0.18s ease, border-color 0.18s ease, color 0.18s ease;
  user-select: none;
}
.kofi-btn:hover {
  background: rgba(74, 222, 128, 0.22);
  border-color: rgba(74, 222, 128, 0.60);
  color: rgba(255, 255, 255, 0.90);
}
.kofi-cup {
  width: 20px;
  height: 20px;
  object-fit: contain;
  flex-shrink: 0;
}

/* ── Level progress grid ─────────────────────────────────── */
#level-progress-grid          { width: 100%; }
#level-progress-grid.hidden   { display: none; }

.progress-grid {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.11);
  border-radius: 1.25rem;
  padding: 1rem 1.25rem;
  backdrop-filter: blur(8px);
}

.prog-heading {
  font-size: 0.65rem;
  font-weight: 900;
  color: rgba(255, 255, 255, 0.3);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  margin-bottom: 0.1rem;
}

.prog-theme-row {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.prog-theme-header {
  display: flex;
  align-items: center;
  gap: 0.45rem;
}

.prog-theme-emoji { font-size: 0.9rem; }

.prog-theme-name {
  flex: 1;
  font-size: 0.75rem;
  font-weight: 800;
  color: rgba(255, 255, 255, 0.6);
  white-space: nowrap;
}

.prog-theme-frac {
  font-size: 0.65rem;
  font-weight: 700;
  color: rgba(255, 255, 255, 0.32);
}
.prog-theme-frac.all-done { color: #4ade80; }

.prog-dots {
  display: flex;
  gap: 0.35rem;
}

.prog-dot {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  padding: 5px 3px;
  border-radius: 8px;
  border: 2px solid;
  min-width: 0;
  cursor: default;
  transition: opacity 0.2s ease;
}

.prog-dot.done {
  border-color: rgba(74, 222, 128, 0.4);
  background: rgba(74, 222, 128, 0.08);
}
.prog-dot.current {
  border-color: rgba(251, 191, 36, 0.6);
  background: rgba(251, 191, 36, 0.10);
  animation: currentGlow 2s ease-in-out infinite;
}
.prog-dot.locked {
  border-color: rgba(255, 255, 255, 0.08);
  background: transparent;
  opacity: 0.38;
}

.prog-dot-num {
  font-size: 0.78rem;
  font-weight: 900;
  color: white;
  line-height: 1;
}
.prog-dot.locked .prog-dot-num { color: rgba(255, 255, 255, 0.4); }

.prog-dot-sub {
  font-size: 0.58rem;
  font-weight: 700;
  line-height: 1;
  color: rgba(255, 255, 255, 0.55);
}
.prog-dot.done    .prog-dot-sub { color: rgba(255, 255, 255, 0.75); }
.prog-dot.current .prog-dot-sub { color: #fbbf24; font-size: 0.72rem; }
.prog-dot.locked  .prog-dot-sub { color: rgba(255, 255, 255, 0.2); }

.prog-dot.clickable {
  cursor: pointer;
  transition: opacity 0.2s ease, transform 0.15s ease, box-shadow 0.15s ease, filter 0.15s ease;
}
.prog-dot.clickable:hover,
.prog-dot.clickable:focus-visible {
  transform: scale(1.14);
  filter: brightness(1.3);
  outline: none;
}
.prog-dot.clickable:hover       { box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.22); }
.prog-dot.clickable:focus-visible { box-shadow: 0 0 0 3px rgba(251, 191, 36, 0.65); }


/* ── 4. GAME SCREEN LAYOUT ──────────────────────────────── */
#screen-game { display: none; }

#screen-game.active {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: center;
  background: #0b0b14;
}

#game-canvas {
  position: relative;
  width: 100%;
  max-width: 1280px;
  height: 100%;
  max-height: 600px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
}

#game-canvas.screen-shake {
  animation: screenShake 0.45s cubic-bezier(0.36, 0.07, 0.19, 0.97) both;
}


/* ── 5. HUD BAR ─────────────────────────────────────────── */
#hud {
  height: 60px;
  flex-shrink: 0;
  background: rgba(0, 0, 0, 0.78);
  backdrop-filter: blur(8px);
  border-bottom: 2px solid rgba(255, 255, 255, 0.08);
  display: flex;
  align-items: center;
  padding: 0 1.2rem;
  gap: 1rem;
  z-index: 50;
}

.hud-cell {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 72px;
}

.hud-label {
  font-size: 0.58rem;
  font-weight: 900;
  color: rgba(255, 255, 255, 0.4);
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.hud-value {
  font-size: 1.35rem;
  font-weight: 900;
  line-height: 1;
}

.hud-yellow { color: #fbbf24; }
.hud-green  { color: #4ade80; font-size: 0.95rem; white-space: nowrap; }
.hud-blue   { color: #60a5fa; }
.hud-purple { color: #c084fc; }

.btn-hud-icon {
  background: none;
  border: none;
  font-size: 1.25rem;
  line-height: 1;
  padding: 4px 8px;
  border-radius: 6px;
  color: white;
  opacity: 0.65;
  flex-shrink: 0;
  cursor: pointer;
  transition: opacity 0.15s ease, background 0.15s ease;
}
.btn-hud-icon:hover { opacity: 1; background: rgba(255, 255, 255, 0.10); }

.hud-brand {
  font-size: 1.05rem;
  font-weight: 900;
  letter-spacing: -0.03em;
  background: linear-gradient(135deg, #fbbf24, #f59e0b, #fde68a);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  white-space: nowrap;
  user-select: none;
  flex-shrink: 0;
  margin-right: 0.25rem;
}

.btn-mute {
  background: none;
  border: none;
  font-size: 1.2rem;
  line-height: 1;
  padding: 4px 7px;
  border-radius: 6px;
  color: white;
  opacity: 0.6;
  flex-shrink: 0;
  transition: opacity 0.15s ease, background 0.15s ease;
}
.btn-mute:hover { opacity: 1; background: rgba(255, 255, 255, 0.10); }
.btn-mute.muted { opacity: 0.3; }

.hud-center {
  flex: 1;
  display: flex;
  justify-content: center;
}

.timer-wrap {
  position: relative;
  width: 260px;
  height: 26px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 13px;
  overflow: hidden;
  border: 2px solid rgba(255, 255, 255, 0.15);
}

.timer-bar {
  height: 100%;
  width: 100%;
  background: linear-gradient(90deg, #22c55e, #86efac);
  border-radius: 11px;
  transition: width 0.45s linear, background-color 0.5s ease;
}

.timer-bar.warn   { background: linear-gradient(90deg, #f59e0b, #fde68a); }
.timer-bar.danger { background: linear-gradient(90deg, #ef4444, #fca5a5); animation: timerPulse 0.5s ease-in-out infinite; }

.timer-txt {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.82rem;
  font-weight: 900;
  color: white;
  text-shadow: 0 1px 4px rgba(0,0,0,0.6);
  pointer-events: none;
}


/* ── 5b. GAME MENU PANEL ────────────────────────────────── */
#game-menu-backdrop {
  display: none;
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  z-index: 199;
}
#game-menu-backdrop.open { display: block; }

#game-menu {
  position: absolute;
  top: 0;
  left: 0;
  width: 300px;
  height: 100%;
  background: rgba(10, 10, 22, 0.98);
  border-right: 2px solid rgba(255, 255, 255, 0.10);
  z-index: 200;
  display: flex;
  flex-direction: column;
  transform: translateX(-100%);
  transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}
#game-menu.open { transform: translateX(0); }

.game-menu-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1rem 0.8rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.09);
  flex-shrink: 0;
}
.game-menu-title {
  font-size: 0.95rem;
  font-weight: 900;
  color: rgba(255, 255, 255, 0.85);
  letter-spacing: 0.05em;
}
#btn-menu-close {
  background: none;
  border: none;
  color: rgba(255, 255, 255, 0.45);
  font-size: 1rem;
  padding: 4px 8px;
  border-radius: 6px;
  cursor: pointer;
  transition: color 0.15s ease, background 0.15s ease;
}
#btn-menu-close:hover { color: white; background: rgba(255, 255, 255, 0.10); }

.game-menu-actions {
  padding: 0.75rem 0.9rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.07);
  flex-shrink: 0;
}
#btn-menu-home {
  width: 100%;
  padding: 0.55rem 0.9rem;
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid rgba(255, 255, 255, 0.13);
  border-radius: 8px;
  color: white;
  font-family: inherit;
  font-size: 0.88rem;
  font-weight: 700;
  text-align: left;
  cursor: pointer;
  transition: background 0.15s ease;
}
#btn-menu-home:hover { background: rgba(255, 255, 255, 0.13); }

.game-menu-levels-label {
  padding: 0.65rem 0.9rem 0.25rem;
  font-size: 0.58rem;
  font-weight: 900;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.30);
  flex-shrink: 0;
}

#game-menu-levels {
  flex: 1;
  overflow-y: auto;
  padding-bottom: 0.5rem;
}
#game-menu-levels::-webkit-scrollbar       { width: 4px; }
#game-menu-levels::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.12); border-radius: 2px; }

.menu-theme-block { padding: 0.3rem 0 0.2rem; }
.menu-theme-block + .menu-theme-block { border-top: 1px solid rgba(255,255,255,0.06); }

.menu-theme-name {
  padding: 0.25rem 0.9rem 0.15rem;
  font-size: 0.6rem;
  font-weight: 900;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.32);
}
.menu-theme-block.locked .menu-theme-name { opacity: 0.5; }

.menu-level-row {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.38rem 0.9rem;
  transition: background 0.1s ease;
}
.menu-level-row.clickable { cursor: pointer; }
.menu-level-row.clickable:hover    { background: rgba(255, 255, 255, 0.07); }
.menu-level-row.clickable:focus-visible {
  outline: none;
  background: rgba(251, 191, 36, 0.10);
}
.menu-level-row.locked { opacity: 0.28; }

.menu-level-num {
  width: 22px;
  height: 22px;
  border-radius: 5px;
  background: rgba(255, 255, 255, 0.09);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.62rem;
  font-weight: 900;
  color: rgba(255, 255, 255, 0.55);
  flex-shrink: 0;
}
.menu-level-row.done    .menu-level-num { background: rgba(74, 222, 128, 0.18); color: #4ade80; }
.menu-level-row.current .menu-level-num { background: rgba(251, 191, 36, 0.18); color: #fbbf24; }

.menu-level-focus {
  flex: 1;
  font-size: 0.76rem;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.65);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.menu-level-row.current .menu-level-focus { color: #fbbf24; font-weight: 700; }
.menu-level-row.locked  .menu-level-focus { color: rgba(255, 255, 255, 0.3); }

.menu-level-badge {
  font-size: 0.63rem;
  font-weight: 700;
  color: rgba(255, 255, 255, 0.35);
  white-space: nowrap;
  flex-shrink: 0;
}
.menu-level-row.done    .menu-level-badge { color: #4ade80; }
.menu-level-row.current .menu-level-badge { color: #fbbf24; }


/* ── 6. GAME VIEWPORT ───────────────────────────────────── */
#viewport {
  flex: 1;
  position: relative;
  overflow: hidden;
  min-height: 0;
  cursor: default;
}

.bg-layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

#bg-sky {
  background: linear-gradient(180deg, #5ba3d9 0%, #87ceeb 45%, #d4e8b0 75%, #e8d5a0 100%);
  z-index: 0;
}

#bg-hills {
  bottom: 0;
  top: auto;
  height: 42%;
  background: linear-gradient(180deg, rgba(120,180,80,0.6) 0%, transparent 100%);
  z-index: 1;
}

#bg-ground {
  bottom: 0;
  top: auto;
  height: 80px;
  background: linear-gradient(180deg, #8B7D2A 0%, #5C4A0A 100%);
  z-index: 2;
}

#bg-ground::before {
  content: '';
  position: absolute;
  top: -8px;
  left: 0;
  right: 0;
  height: 14px;
  background: linear-gradient(180deg, #5a9e30, #3d7320);
  border-radius: 2px 2px 0 0;
}

#deco-layer {
  z-index: 3;
  pointer-events: none;
}


/* ── 7. ANIMAL LAYER & CARDS ────────────────────────────── */
#animal-layer, #kennel-layer {
  position: absolute;
  inset: 0;
  z-index: 8;
}

/* Feed burst particles */
.burst-particle {
  position: absolute;
  font-size: 1.15rem;
  pointer-events: none;
  z-index: 45;
  animation: burstOut 0.65s ease-out forwards;
}

/* ── Animal card ────────────────────────────────────────── */
.animal-card {
  position: absolute;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  cursor: grab;
  will-change: transform;
  z-index: 10;
  user-select: none;
  -webkit-user-select: none;
  touch-action: none;
}

.animal-card.grabbed {
  cursor: grabbing;
  transform: scale(1.12);
  filter: drop-shadow(0 8px 20px rgba(0,0,0,0.5));
  z-index: 20;
}

/* L1-5 click mode: selected state */
.animal-card.selected {
  filter: drop-shadow(0 0 12px rgba(251, 191, 36, 0.8));
}

.animal-card.placed {
  pointer-events: none;
  animation: animalPlaced 0.65s cubic-bezier(0.34,1.56,0.64,1) forwards;
}

.animal-card.escaped {
  pointer-events: none;
  animation: animalEscaped 0.5s ease-in forwards;
}

.animal-emoji-wrap {
  font-size: 3rem;
  line-height: 1;
  filter: drop-shadow(0 3px 6px rgba(0,0,0,0.35));
}

.animal-label {
  font-size: 0.75rem;
  font-weight: 900;
  color: white;
  background: rgba(0,0,0,0.55);
  border-radius: 20px;
  padding: 2px 8px;
  white-space: nowrap;
  pointer-events: none;
}


/* ── Kennel target ──────────────────────────────────────── */
.kennel-target {
  position: absolute;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  border-radius: 50%;
  border: 3px solid rgba(255, 255, 255, 0.35);
  background: rgba(255, 255, 255, 0.06);
  backdrop-filter: blur(4px);
  cursor: default;
  transition: border-color 0.2s ease, background 0.2s ease, transform 0.15s ease;
  z-index: 5;
  pointer-events: all;
  user-select: none;
}

.kennel-target .kennel-emoji {
  font-size: 2rem;
  line-height: 1;
  pointer-events: none;
}

.kennel-target .kennel-label {
  font-size: 0.62rem;
  font-weight: 900;
  color: rgba(255,255,255,0.55);
  white-space: nowrap;
  pointer-events: none;
}

/* Gate indicator */
.gate-indicator {
  position: absolute;
  top: -10px;
  right: -4px;
  font-size: 0.9rem;
  line-height: 1;
  pointer-events: none;
}

/* Kennel states */
.kennel-target.open {
  border-color: rgba(74, 222, 128, 0.8);
  background: rgba(74, 222, 128, 0.10);
  animation: kennelOpenPulse 1.5s ease-in-out infinite;
}

.kennel-target.closed {
  border-color: rgba(239, 68, 68, 0.55);
  background: rgba(239, 68, 68, 0.06);
  cursor: pointer;
}

.kennel-target.nearby {
  border-color: rgba(251, 191, 36, 0.85);
  background: rgba(251, 191, 36, 0.12);
  transform: scale(1.08);
  box-shadow: 0 0 16px rgba(251, 191, 36, 0.35);
}

.kennel-target.filled {
  border-color: rgba(74, 222, 128, 0.45);
  background: rgba(74, 222, 128, 0.12);
  opacity: 0.55;
}

/* Wrong-kennel flash */
.kennel-target.wrong-flash {
  animation: kennelWrongFlash 0.4s ease-out forwards !important;
}


/* ── 8. STREAK BADGE ────────────────────────────────────── */
#streak-badge {
  position: absolute;
  top: 10px;
  left: 10px;
  background: rgba(0, 0, 0, 0.60);
  border: 2px solid rgba(251, 191, 36, 0.50);
  border-radius: 20px;
  padding: 5px 14px;
  font-size: 1rem;
  font-weight: 900;
  color: #fbbf24;
  z-index: 30;
  white-space: nowrap;
  pointer-events: none;
  animation: streakPulse 1.2s ease-in-out infinite;
}

#streak-badge.hidden { display: none; }

#streak-badge.streak-hot {
  color: #ef4444;
  border-color: rgba(239, 68, 68, 0.55);
  text-shadow: 0 0 10px rgba(239, 68, 68, 0.5);
}


/* ── 9. SKILL HINT (top-right of viewport) ──────────────── */
.skill-hint {
  position: absolute;
  top: 10px;
  right: 10px;
  background: rgba(0,0,0,0.55);
  border: 1.5px solid rgba(255,255,255,0.18);
  border-radius: 10px;
  padding: 5px 12px;
  font-size: 0.78rem;
  font-weight: 800;
  color: rgba(255,255,255,0.65);
  z-index: 30;
  pointer-events: none;
  white-space: nowrap;
}
.skill-hint.hidden { display: none; }


/* ── 10. LEVEL BANNER ───────────────────────────────────── */
.level-banner {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: rgba(0,0,0,0.75);
  border: 2px solid rgba(255,255,255,0.2);
  border-radius: 1.5rem;
  padding: 1.5rem 3rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.4rem;
  z-index: 100;
  backdrop-filter: blur(12px);
  animation: bannerPop 0.4s cubic-bezier(0.34,1.56,0.64,1);
  pointer-events: none;
}

.level-banner.hidden { display: none; }

#banner-level {
  font-size: 2.5rem;
  font-weight: 900;
  color: #fbbf24;
}

#banner-theme {
  font-size: 1.3rem;
  font-weight: 800;
  color: white;
}

#banner-focus {
  font-size: 0.95rem;
  font-weight: 700;
  color: rgba(255,255,255,0.6);
  text-align: center;
}


/* ── 11. OVERLAY CARDS ──────────────────────────────────── */
.overlay-card {
  background: rgba(255,255,255,0.07);
  border: 1px solid rgba(255,255,255,0.18);
  border-radius: 2rem;
  padding: 2.5rem 3rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.25rem;
  max-width: 540px;
  width: 90%;
  backdrop-filter: blur(20px);
  animation: cardRise 0.35s cubic-bezier(0.34,1.56,0.64,1);
}

.overlay-icon {
  font-size: 4.5rem;
  line-height: 1;
}

.anim-bounce { animation: floatBob 1.8s ease-in-out infinite; }

.overlay-title {
  font-size: 2.2rem;
  font-weight: 900;
  color: white;
  text-align: center;
  line-height: 1.15;
}

.overlay-sub {
  font-size: 1rem;
  font-weight: 600;
  color: rgba(255,255,255,0.6);
  text-align: center;
}

.stats-row {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
  justify-content: center;
}

.stat-box {
  background: rgba(255,255,255,0.07);
  border-radius: 1rem;
  padding: 0.8rem 1.2rem;
  text-align: center;
  min-width: 88px;
}

.stat-val {
  font-size: 1.9rem;
  font-weight: 900;
  color: #fbbf24;
}

.stat-lbl {
  font-size: 0.65rem;
  font-weight: 800;
  color: rgba(255,255,255,0.45);
  text-transform: uppercase;
  letter-spacing: 0.09em;
  margin-top: 3px;
}

.unlock-badge {
  background: linear-gradient(135deg, #f59e0b, #d97706);
  border-radius: 1rem;
  padding: 0.7rem 1.5rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  font-size: 1rem;
  font-weight: 700;
  color: white;
}

.unlock-badge.hidden { display: none; }
.unlock-badge strong { font-size: 1.1rem; font-weight: 900; }

#lu-pb {
  font-size: 0.9rem;
  font-weight: 800;
  color: rgba(255, 255, 255, 0.5);
  text-align: center;
}
#lu-pb.hidden { display: none; }
#lu-pb.new-pb { color: #fbbf24; font-size: 1rem; animation: floatBob 1s ease-in-out 2; }

.btn-row {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
  justify-content: center;
}


/* ── 12. BUTTONS ────────────────────────────────────────── */
.btn-primary {
  background: linear-gradient(135deg, #f59e0b, #d97706);
  color: white;
  font-weight: 900;
  border-radius: 1rem;
  padding: 0.65rem 1.6rem;
  font-size: 1rem;
  box-shadow: 0 5px 18px rgba(245,158,11,0.4);
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}

.btn-primary:hover  { transform: translateY(-2px) scale(1.02); box-shadow: 0 8px 24px rgba(245,158,11,0.5); }
.btn-primary:active { transform: translateY(0) scale(0.97); }

.btn-secondary {
  background: rgba(255,255,255,0.1);
  color: white;
  font-weight: 800;
  border-radius: 1rem;
  padding: 0.65rem 1.6rem;
  font-size: 1rem;
  border: 2px solid rgba(255,255,255,0.25);
  transition: background 0.15s ease, transform 0.12s ease;
}

.btn-secondary:hover  { background: rgba(255,255,255,0.2); transform: translateY(-1px); }
.btn-secondary:active { transform: translateY(0); }

.btn-large {
  font-size: 1.3rem;
  padding: 0.85rem 2.2rem;
  border-radius: 1.25rem;
}


/* ── 13. FLOATING SCORE POP ─────────────────────────────── */
.score-pop {
  position: absolute;
  font-size: 1.4rem;
  font-weight: 900;
  color: #4ade80;
  text-shadow: 0 2px 6px rgba(0,0,0,0.5);
  pointer-events: none;
  animation: scorePop 0.9s ease-out forwards;
  z-index: 40;
  white-space: nowrap;
}

.score-pop.penalty { color: #ef4444; }


/* ── 14. COPYRIGHT BAR ──────────────────────────────────── */
#copyright-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  text-align: center;
  font-size: 0.62rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  color: rgba(255, 255, 255, 0.22);
  padding: 0.35rem 1rem;
  z-index: 9999;
  pointer-events: none;
  user-select: none;
}


/* ── 15. ANIMATIONS ─────────────────────────────────────── */
@keyframes floatBob {
  0%, 100% { transform: translateY(0); }
  50%       { transform: translateY(-10px); }
}

@keyframes currentGlow {
  0%, 100% { box-shadow: none; }
  50%       { box-shadow: 0 0 0 3px rgba(251, 191, 36, 0.22); }
}

@keyframes animalPlaced {
  0%   { transform: scale(1);    opacity: 1; }
  30%  { transform: scale(1.25) translateY(-12px); opacity: 1; }
  100% { transform: scale(0.4)  translateY(-60px); opacity: 0; }
}

@keyframes animalEscaped {
  0%   { opacity: 1; transform: translateX(0); }
  100% { opacity: 0; transform: translateX(80px); }
}

@keyframes burstOut {
  0%   { transform: translate(0, 0) scale(1.1); opacity: 1; }
  100% { transform: translate(var(--dx, 0px), var(--dy, -50px)) scale(0.4); opacity: 0; }
}

@keyframes kennelOpenPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(74, 222, 128, 0); }
  50%       { box-shadow: 0 0 0 6px rgba(74, 222, 128, 0.2); }
}

@keyframes kennelWrongFlash {
  0%   { border-color: rgba(239,68,68,0.9);  background: rgba(239,68,68,0.20); transform: scale(1.05); }
  40%  { border-color: rgba(239,68,68,0.6);  background: rgba(239,68,68,0.12); transform: scale(1.0);  }
  100% { border-color: rgba(255,255,255,0.35); background: rgba(255,255,255,0.06); transform: scale(1.0); }
}

@keyframes streakPulse {
  0%, 100% { transform: scale(1); }
  50%       { transform: scale(1.05); }
}

@keyframes scorePop {
  0%   { transform: translateY(0)     scale(1);   opacity: 1; }
  60%  { transform: translateY(-45px) scale(1.2); opacity: 1; }
  100% { transform: translateY(-80px) scale(0.9); opacity: 0; }
}

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

@keyframes cardRise {
  0%   { transform: translateY(30px) scale(0.95); opacity: 0; }
  100% { transform: translateY(0)    scale(1);    opacity: 1; }
}

@keyframes timerPulse {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.7; }
}

/* ── START SCREEN NAV BAR ───────────────────────────────────
   Sticky bar at the top of the start screen; holds the TypZoo
   brand wordmark and the hamburger that opens the game menu.
─────────────────────────────────────────────────────────── */
.start-nav {
  position: sticky;
  top: 0;
  z-index: 50;
  flex-shrink: 0;
  width: 100%;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.6rem 1.25rem;
  background: rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.start-nav-brand {
  font-size: 1.05rem;
  font-weight: 900;
  letter-spacing: -0.03em;
  background: linear-gradient(135deg, #fbbf24, #f59e0b, #fde68a);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  text-decoration: none;
  white-space: nowrap;
  user-select: none;
}
.start-nav-brand:hover { filter: brightness(1.15); }


/* ── GAMES SIDE MENU (start screen) ────────────────────────
   Slides in from the left; fixed so it overlays regardless of
   scroll position inside #screen-start.
─────────────────────────────────────────────────────────── */
#start-menu-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  z-index: 299;
}
#start-menu-backdrop.open { display: block; }

#start-game-menu {
  position: fixed;
  top: 0;
  left: 0;
  width: 280px;
  height: 100%;
  background: rgba(10, 10, 22, 0.98);
  border-right: 2px solid rgba(255, 255, 255, 0.10);
  z-index: 300;
  display: flex;
  flex-direction: column;
  transform: translateX(-100%);
  transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  overflow-y: auto;
}
#start-game-menu.open { transform: translateX(0); }

.start-menu-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1rem 0.8rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.09);
  flex-shrink: 0;
}

.start-menu-title {
  font-size: 1rem;
  font-weight: 900;
  letter-spacing: -0.02em;
  background: linear-gradient(135deg, #fbbf24, #f59e0b);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

#btn-start-menu-close {
  background: none;
  border: none;
  color: rgba(255, 255, 255, 0.45);
  font-size: 1rem;
  padding: 4px 8px;
  border-radius: 6px;
  cursor: pointer;
  transition: color 0.15s ease, background 0.15s ease;
}
#btn-start-menu-close:hover { color: white; background: rgba(255, 255, 255, 0.10); }

.start-menu-section-label {
  padding: 0.65rem 0.9rem 0.25rem;
  font-size: 0.58rem;
  font-weight: 900;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.30);
  flex-shrink: 0;
}

.start-menu-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.7rem 0.9rem;
  text-decoration: none;
  color: white;
  cursor: pointer;
  transition: background 0.12s ease;
}
.start-menu-item:hover { background: rgba(255, 255, 255, 0.07); }

.start-menu-item--active {
  background: rgba(251, 191, 36, 0.07);
  cursor: default;
  pointer-events: none;
}
.start-menu-item--active:hover { background: rgba(251, 191, 36, 0.07); }

.start-menu-item-icon {
  font-size: 1.55rem;
  line-height: 1;
  flex-shrink: 0;
  width: 30px;
  text-align: center;
}

.start-menu-item-body {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.start-menu-item-name {
  font-size: 0.9rem;
  font-weight: 800;
  color: rgba(255, 255, 255, 0.9);
}
.start-menu-item--active .start-menu-item-name { color: #fbbf24; }

.start-menu-item-desc {
  font-size: 0.7rem;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.38);
}
.start-menu-item--active .start-menu-item-desc { color: rgba(251, 191, 36, 0.55); }


/* ── END START SCREEN NAV/MENU ──────────────────────────── */

@keyframes screenShake {
  0%, 100% { transform: translateX(0); }
  15%       { transform: translateX(-7px); }
  30%       { transform: translateX(7px); }
  45%       { transform: translateX(-5px); }
  60%       { transform: translateX(5px); }
  75%       { transform: translateX(-2px); }
  90%       { transform: translateX(2px); }
}
