/* WildCare Wildlife Sanctuary - Realistic Zoo Simulation */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  width: 100%; height: 100%; overflow: hidden;
  font-family: 'Outfit', -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: #1a2816; color: #1c1917;
  user-select: none; -webkit-user-select: none; -webkit-tap-highlight-color: transparent;
}

.zoo-app { width: 100vw; height: 100vh; display: flex; flex-direction: column; }

/* Top bar - Posh subtle botanical slate & warm champagne */
.top-bar {
  height: 58px; flex-shrink: 0; display: flex; align-items: center; gap: 12px; padding: 0 16px;
  background: rgba(24, 31, 25, 0.94); backdrop-filter: blur(14px);
  border-bottom: 1px solid rgba(212, 195, 163, 0.22); z-index: 6;
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.28);
}
.back-btn {
  text-decoration: none; color: #e5dec9; font-weight: 600; font-size: 0.88rem;
  background: rgba(255, 255, 255, 0.06); border: 1px solid rgba(212, 195, 163, 0.24); border-radius: 999px; padding: 6px 14px;
  transition: background 0.15s ease, border-color 0.15s ease;
}
.back-btn:hover { background: rgba(255, 255, 255, 0.12); border-color: rgba(212, 195, 163, 0.42); }
.title { font-size: 1.1rem; font-weight: 700; color: #e7e2d5; white-space: nowrap; letter-spacing: 0.01em; }
.guide-pill {
  flex: 1; text-align: center; background: rgba(255, 255, 255, 0.05); border: 1px solid rgba(212, 195, 163, 0.22); border-radius: 999px;
  padding: 7px 18px; font-weight: 500; font-size: 0.92rem; color: #ece6d8;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.controls { display: flex; align-items: center; gap: 7px; }
.keeper-toggle-btn {
  display: flex; align-items: center; gap: 6px;
  background: rgba(212, 195, 163, 0.1); border: 1px solid rgba(212, 195, 163, 0.3); border-radius: 999px;
  padding: 5px 13px; font-size: 0.84rem; font-weight: 600; color: #e7dec8;
  cursor: pointer; transition: all 0.15s ease;
}
.keeper-toggle-btn:hover { background: rgba(212, 195, 163, 0.18); transform: translateY(-1px); border-color: rgba(212, 195, 163, 0.5); }
.score-pill {
  background: rgba(134, 168, 120, 0.14); border: 1px solid rgba(134, 168, 120, 0.35); color: #cce0c3; border-radius: 999px;
  padding: 5px 13px; font-weight: 700; font-size: 0.84rem; white-space: nowrap;
}
.ctrl-btn {
  width: 36px; height: 36px; border-radius: 50%; border: 1px solid rgba(212, 195, 163, 0.22); background: rgba(255, 255, 255, 0.05);
  font-size: 0.96rem; cursor: pointer; opacity: 0.55; transition: all 0.15s ease; color: #e7e2d5;
}
.ctrl-btn:hover { opacity: 0.85; transform: translateY(-1px); }
.ctrl-btn.active { opacity: 1; background: rgba(134, 168, 120, 0.2); border-color: rgba(134, 168, 120, 0.5); }

/* Stage */
.stage { flex: 1; position: relative; min-height: 0; background: #263e1e; overflow: hidden; }
#zooCanvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; cursor: pointer; }

/* Live Wildlife Habitat Inspector Card */
.habitat-card {
  position: absolute; top: 14px; right: 16px; width: 310px;
  background: rgba(24, 30, 22, 0.86); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  border: 1.5px solid rgba(255, 255, 255, 0.18); border-radius: 20px;
  color: #f8fafc; overflow: hidden; z-index: 4;
  box-shadow: 0 16px 38px rgba(0, 0, 0, 0.42);
  transition: transform 0.25s ease, border-color 0.25s ease;
}
.habitat-card.in-range {
  border-color: rgba(245, 158, 11, 0.85);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.5), 0 0 20px rgba(245, 158, 11, 0.28);
}
.habitat-cam-header {
  display: flex; align-items: center; justify-content: space-between; gap: 6px;
  padding: 6px 10px; background: rgba(15, 23, 15, 0.92);
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
}
.habitat-photo-wrap {
  position: relative; width: 100%; height: 164px; overflow: hidden; background: #111812;
}
.habitat-photo-wrap::after {
  content: ''; position: absolute; inset: 0; pointer-events: none;
  box-shadow: inset 0 -20px 26px rgba(10, 16, 11, 0.42), inset 0 0 0 1px rgba(255, 255, 255, 0.08);
}
.habitat-photo-wrap img {
  width: 100%; height: 100%; object-fit: cover; object-position: center 26%;
  filter: contrast(1.04) saturate(1.05);
  transition: transform 0.6s ease;
}
.habitat-card:hover .habitat-photo-wrap img {
  transform: scale(1.04);
}
.live-cam-badge {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 0.64rem; font-weight: 800; letter-spacing: 0.06em; color: #f1f5f9;
}
.live-dot {
  width: 7px; height: 7px; border-radius: 50%; background: #22c55e;
  box-shadow: 0 0 8px #22c55e; animation: pulseDot 1.6s infinite;
}
@keyframes pulseDot {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.45; transform: scale(0.85); }
}
.habitat-biome-tag {
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.16); border-radius: 6px;
  padding: 1px 7px; font-size: 0.66rem; font-weight: 700; color: #d9f99d;
}
.habitat-info { padding: 12px 14px 14px; }
.habitat-title-row {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; margin-bottom: 6px;
}
.habitat-title-row h3 {
  font-size: 1.06rem; font-weight: 800; color: #ffffff; line-height: 1.15;
}
.scientific-name {
  font-size: 0.74rem; font-style: italic; color: #a7f3d0; opacity: 0.9;
}
.proximity-badge {
  font-size: 0.7rem; font-weight: 800; padding: 3px 8px; border-radius: 999px;
  background: rgba(245, 158, 11, 0.22); color: #fcd34d; border: 1px solid rgba(245, 158, 11, 0.45);
  white-space: nowrap;
}
.proximity-badge.fed {
  background: rgba(16, 185, 129, 0.25); color: #6ee7b7; border-color: rgba(16, 185, 129, 0.5);
}
.habitat-fact {
  font-size: 0.79rem; line-height: 1.38; color: #e2e8f0; margin-bottom: 10px;
}
.habitat-actions {
  display: flex; align-items: center; gap: 6px;
}
.hab-btn {
  font-family: inherit; font-size: 0.8rem; font-weight: 700; border-radius: 10px;
  padding: 7px 10px; cursor: pointer; border: none; transition: all 0.15s ease;
  display: inline-flex; align-items: center; justify-content: center; gap: 5px;
}
.hab-btn.primary {
  flex: 1; background: linear-gradient(135deg, #d97706, #b45309); color: #fff;
  box-shadow: 0 3px 10px rgba(217, 119, 6, 0.35);
}
.hab-btn.primary:hover { filter: brightness(1.1); transform: translateY(-1px); }
.hab-btn.secondary {
  background: rgba(56, 189, 248, 0.18); color: #bae6fd; border: 1px solid rgba(56, 189, 248, 0.38);
}
.hab-btn.secondary:hover { background: rgba(56, 189, 248, 0.3); transform: translateY(-1px); }
.hab-btn.icon-only {
  background: rgba(255, 255, 255, 0.12); color: #fff; border: 1px solid rgba(255, 255, 255, 0.2);
  padding: 7px 9px;
}
.hab-btn.icon-only:hover { background: rgba(255, 255, 255, 0.24); }

.habitat-care-row {
  margin-top: 9px; padding-top: 8px;
  border-top: 1px solid rgba(255, 255, 255, 0.12);
}
.habitat-care-row.fed-highlight {
  background: rgba(16, 185, 129, 0.12);
  margin: 9px -8px -4px; padding: 7px 8px; border-radius: 12px;
  border: 1px solid rgba(16, 185, 129, 0.35);
}
.care-row-label {
  display: block; font-size: 0.67rem; font-weight: 800;
  letter-spacing: 0.04em; text-transform: uppercase;
  color: #a7f3d0; margin-bottom: 5px;
}
.care-btn-group {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 5px;
}
.care-btn {
  font-family: inherit; font-size: 0.72rem; font-weight: 700;
  padding: 5px 4px; border-radius: 8px; cursor: pointer;
  background: rgba(255, 255, 255, 0.11); color: #f8fafc;
  border: 1px solid rgba(255, 255, 255, 0.2);
  transition: transform 0.14s ease, background 0.14s ease, border-color 0.14s ease;
  white-space: nowrap;
}
.care-btn:hover {
  background: rgba(245, 158, 11, 0.28);
  border-color: rgba(245, 158, 11, 0.65);
  transform: translateY(-1px);
}
.care-btn.done {
  background: rgba(16, 185, 129, 0.28);
  border-color: rgba(52, 211, 153, 0.65);
  color: #d1fae5;
}
.care-btn.signature-btn {
  grid-column: 1 / -1;
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.26), rgba(217, 119, 6, 0.18));
  border-color: rgba(251, 191, 36, 0.55);
  color: #fef3c7;
  padding: 6px 8px;
  font-size: 0.76rem;
}
.care-btn.signature-btn:hover {
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.42), rgba(217, 119, 6, 0.32));
  border-color: #fbbf24;
}

.camera-flash {
  position: absolute; inset: 0; background: #ffffff;
  opacity: 0; pointer-events: none; z-index: 8;
  transition: opacity 0.35s ease-out;
}
.camera-flash.active {
  opacity: 0.82; transition: none;
}

/* Start overlay - Posh, subtle dark botanical & warm champagne aesthetic */
.start-overlay {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  background: rgba(14, 19, 15, 0.72); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); z-index: 10;
}
.start-overlay.hidden { display: none; }
.start-card {
  background: linear-gradient(165deg, rgba(31, 40, 33, 0.96) 0%, rgba(22, 29, 24, 0.98) 100%);
  border: 1.5px solid rgba(212, 195, 163, 0.28); border-radius: 26px; padding: 28px 34px;
  text-align: center; max-width: 610px; width: 92%;
  box-shadow: 0 28px 68px rgba(0, 0, 0, 0.65), inset 0 1px 0 rgba(255, 255, 255, 0.06);
}
.start-photo-strip {
  display: grid; grid-template-columns: repeat(7, 50px); justify-content: center; gap: 6px; margin-bottom: 14px;
}
.start-photo-strip img {
  width: 50px; height: 44px; border-radius: 10px; object-fit: cover; object-position: center 24%;
  border: 1.5px solid rgba(212, 195, 163, 0.42); box-shadow: 0 6px 14px rgba(0, 0, 0, 0.38);
  filter: saturate(1.02) contrast(1.04);
  transition: transform 0.2s ease, border-color 0.2s ease;
}
.start-photo-strip img:hover {
  transform: scale(1.08); border-color: #e2c799;
}
.start-card h2 {
  font-size: 1.72rem; color: #f1ece1; margin-bottom: 3px; font-weight: 700; letter-spacing: -0.01em;
}
.start-subtitle {
  font-size: 0.88rem !important; font-weight: 600; color: #c8b08a !important;
  letter-spacing: 0.04em; text-transform: uppercase; margin-bottom: 12px !important;
}

/* Keeper selection row on start card */
.keeper-select-row {
  display: flex; flex-direction: column; align-items: center; gap: 9px;
  margin: 10px 0 16px; padding: 12px 16px; background: rgba(255, 255, 255, 0.035);
  border-radius: 16px; border: 1px solid rgba(212, 195, 163, 0.16);
}
.select-label {
  font-size: 0.78rem; font-weight: 700; color: #b7b0a2; text-transform: uppercase; letter-spacing: 0.08em;
}
.keeper-options { display: flex; gap: 12px; justify-content: center; width: 100%; max-width: 430px; }
.keeper-opt {
  flex: 1; display: flex; align-items: center; justify-content: center; gap: 10px;
  padding: 9px 14px; border-radius: 13px; border: 1.5px solid rgba(212, 195, 163, 0.18);
  background: rgba(255, 255, 255, 0.04); cursor: pointer; font-family: inherit;
  transition: transform 0.15s ease, border-color 0.2s ease, background 0.2s ease, box-shadow 0.2s ease;
}
.keeper-opt .opt-avatar { font-size: 1.85rem; line-height: 1; }
.keeper-opt .opt-text { text-align: left; line-height: 1.25; }
.keeper-opt .opt-text strong { font-size: 0.94rem; color: #ece6d8; display: block; font-weight: 700; }
.keeper-opt .opt-text small { font-size: 0.75rem; font-weight: 500; color: #a39e93; }
.keeper-opt:hover { transform: translateY(-1px); border-color: rgba(212, 195, 163, 0.42); background: rgba(255, 255, 255, 0.07); }
.keeper-opt.active {
  border-color: #8fa982; background: rgba(143, 169, 130, 0.15);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.28);
}
.keeper-opt.active .opt-text strong { color: #dce8d5; }

.ranger-name-row {
  display: flex; align-items: center; gap: 10px; width: 100%; max-width: 430px; margin-top: 4px;
}
.ranger-name-label {
  font-size: 0.84rem; font-weight: 700; color: #e2d8c5; white-space: nowrap;
}
.ranger-name-input {
  flex: 1; font-family: inherit; font-size: 0.96rem; font-weight: 600; color: #f8f5ee;
  background: rgba(15, 21, 16, 0.72); border: 1.5px solid rgba(212, 195, 163, 0.36);
  border-radius: 11px; padding: 8px 13px; outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}
.ranger-name-input::placeholder { color: #8f8a7e; font-weight: 500; }
.ranger-name-input:focus {
  border-color: #d4b06a; background: rgba(18, 26, 20, 0.92);
  box-shadow: 0 0 0 3px rgba(212, 176, 106, 0.22);
}
.ranger-name-hint {
  font-size: 0.76rem; color: #a7c4a0; font-weight: 500; letter-spacing: 0.01em;
}

.start-card p { font-size: 0.92rem; color: #c7c2b6; line-height: 1.44; margin-bottom: 12px; }
.start-keys { font-size: 0.84rem; font-weight: 600; color: #b5afa2; margin-bottom: 18px; }
.kbd {
  display: inline-block; min-width: 28px; padding: 2px 7px; margin: 0 2px; border-radius: 6px;
  background: rgba(255, 255, 255, 0.08); border: 1px solid rgba(212, 195, 163, 0.25);
  box-shadow: 0 2px 0 rgba(0, 0, 0, 0.35); font-size: 0.8rem; color: #ece6d8;
}
.kbd.wide { padding: 2px 9px; }
.start-btn {
  font-family: inherit; font-size: 1.08rem; font-weight: 700; color: #f4f0e6; cursor: pointer;
  background: linear-gradient(135deg, #3d5a45, #2b4231);
  border: 1px solid rgba(212, 195, 163, 0.36); border-radius: 14px;
  padding: 13px 30px; box-shadow: 0 8px 22px rgba(0, 0, 0, 0.4);
  transition: transform 0.15s ease, filter 0.15s ease, border-color 0.15s ease;
}
.start-btn small { font-size: 0.78rem; font-weight: 500; opacity: 0.82; color: #d6ceb8; }
.start-btn:hover { transform: translateY(-2px); filter: brightness(1.08); border-color: rgba(212, 195, 163, 0.58); }
.loading-note { margin: 10px 0 0 !important; font-size: 0.8rem !important; color: #8c867a !important; }
.loading-note.error { color: #f87171 !important; font-weight: 700; }

/* Bottom animal bar with subtle dark-botanical wildlife portrait chips */
.animal-bar {
  height: 76px; flex-shrink: 0; display: flex; align-items: center; justify-content: flex-start; gap: 7px;
  padding: 0 10px; background: rgba(22, 29, 23, 0.96); border-top: 1px solid rgba(212, 195, 163, 0.22); z-index: 6;
  overflow-x: auto; scrollbar-width: none;
}
.animal-bar::-webkit-scrollbar { display: none; }
.animal-chip {
  position: relative; display: flex; align-items: center; gap: 7px; padding: 5px 8px; min-width: 112px; flex: 1 0 112px; max-width: 158px;
  background: rgba(255, 255, 255, 0.045); border: 1.5px solid rgba(212, 195, 163, 0.18); border-radius: 15px; cursor: pointer;
  font-family: inherit; transition: transform 0.15s ease, border-color 0.2s ease, background 0.2s ease;
}
.animal-chip:hover { transform: translateY(-2px); border-color: rgba(212, 195, 163, 0.42); background: rgba(255, 255, 255, 0.08); }
.animal-chip.current {
  border-color: #c89d54; background: rgba(200, 157, 84, 0.14);
  animation: chipPulse 1.4s ease-in-out infinite alternate;
}
.animal-chip.fed {
  border-color: #6e9975; background: rgba(110, 153, 117, 0.14);
}
.animal-chip.waiting {
  opacity: 0.78;
}
@keyframes chipPulse {
  from { box-shadow: 0 0 0 rgba(200, 157, 84, 0); }
  to { box-shadow: 0 4px 14px rgba(200, 157, 84, 0.28); transform: translateY(-1px); }
}
.chip-photo {
  width: 38px; height: 38px; border-radius: 10px; object-fit: cover; flex-shrink: 0;
  border: 1.5px solid rgba(212, 195, 163, 0.3); background: #262925;
}
.animal-chip.current .chip-photo { border-color: #c89d54; }
.animal-chip.fed .chip-photo { border-color: #6e9975; }
.chip-col { display: flex; flex-direction: column; gap: 4px; flex: 1; min-width: 0; text-align: left; }
.chip-header { display: flex; align-items: center; justify-content: space-between; gap: 4px; }
.chip-name { font-size: 0.76rem; font-weight: 700; color: #ece6d8; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chip-badge { font-size: 0.64rem; font-weight: 700; padding: 1px 5px; border-radius: 6px; white-space: nowrap; }
.chip-badge.fed { background: rgba(110, 153, 117, 0.25); color: #cce3cf; }
.chip-badge.next { background: rgba(200, 157, 84, 0.25); color: #f0d7a8; }
.chip-badge.wait { background: rgba(255, 255, 255, 0.08); color: #b5afa2; }
.chip-meter { height: 6px; background: rgba(255, 255, 255, 0.1); border-radius: 999px; overflow: hidden; }
.chip-fill { height: 100%; border-radius: 999px; background: #6e9975; transition: width 0.3s ease, background 0.3s ease; }

@media (max-width: 1100px) {
  .title { display: none; }
  .animal-chip { min-width: 0; padding: 5px 8px; }
  .chip-photo { width: 36px; height: 36px; }
  .chip-name { font-size: 0.75rem; }
  .habitat-card { width: 250px; }
  .habitat-photo-wrap { height: 120px; }
}
@media (max-width: 720px) {
  .habitat-card { width: 210px; top: 8px; right: 8px; }
  .habitat-photo-wrap { height: 96px; }
  .habitat-fact { display: none; }
  .start-photo-strip img { width: 48px; height: 48px; }
}
