* { box-sizing: border-box; margin: 0; padding: 0; }
html, body {
  width: 100%; height: 100%; overflow: hidden;
  font-family: 'Outfit', system-ui, -apple-system, sans-serif;
  background: #101914; color: #f6efe0; user-select: none;
  touch-action: none;
}

.dino-app { display: flex; flex-direction: column; width: 100%; height: 100%; }

/* Top Jurassic Amber & Rainforest Header */
.top-bar {
  height: 58px; flex-shrink: 0; display: flex; align-items: center; gap: 10px;
  padding: 0 14px;
  background: linear-gradient(180deg, rgba(20, 29, 22, 0.98), rgba(14, 21, 16, 0.98));
  border-bottom: 1.5px solid rgba(235, 174, 62, 0.34);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.42); z-index: 6;
}
.back-btn {
  text-decoration: none; font-weight: 700; font-size: 0.88rem; color: #f3e4c2;
  background: rgba(255, 255, 255, 0.08); border: 1px solid rgba(235, 174, 62, 0.3);
  padding: 6px 12px; border-radius: 10px; white-space: nowrap; transition: background 0.15s;
}
.back-btn:hover { background: rgba(255, 255, 255, 0.16); }
.title { font-size: 1.06rem; font-weight: 800; color: #fde8b8; white-space: nowrap; letter-spacing: 0.01em; }

.guide-pill {
  flex: 1; min-width: 0; display: flex; align-items: center; justify-content: center;
  background: rgba(235, 174, 62, 0.12); border: 1px solid rgba(235, 174, 62, 0.34);
  border-radius: 999px; padding: 5px 14px; font-size: 0.85rem; font-weight: 600; color: #fbf0d5;
  overflow: hidden;
}
.guide-pill span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.controls { display: flex; align-items: center; gap: 6px; flex-shrink: 0; }
.keeper-toggle-btn {
  display: inline-flex; align-items: center; gap: 6px; padding: 5px 11px;
  background: rgba(186, 128, 36, 0.25); border: 1px solid rgba(242, 186, 84, 0.5);
  color: #fef0ca; border-radius: 999px; font-family: inherit; font-size: 0.82rem; font-weight: 700;
  cursor: pointer; white-space: nowrap; transition: all 0.15s;
}
.keeper-toggle-btn:hover { background: rgba(186, 128, 36, 0.42); }

.discovery-pill {
  display: inline-flex; align-items: center; gap: 5px;
  background: rgba(56, 142, 82, 0.24); border: 1px solid rgba(114, 212, 140, 0.48);
  color: #dcfce7; font-size: 0.82rem; font-weight: 700; padding: 5px 11px;
  border-radius: 999px; white-space: nowrap;
}
.discovery-pill strong { color: #fef08a; font-weight: 800; }

.ctrl-btn {
  width: 34px; height: 34px; border-radius: 9px; border: 1px solid rgba(235, 174, 62, 0.26);
  background: rgba(255, 255, 255, 0.08); color: #f6efe0; cursor: pointer; font-size: 0.95rem;
  display: grid; place-items: center; transition: all 0.15s;
}
.ctrl-btn:hover { background: rgba(255, 255, 255, 0.16); }
.ctrl-btn.active { background: rgba(74, 166, 98, 0.3); border-color: rgba(134, 224, 154, 0.58); }

/* 3D Prehistoric Island Stage */
.stage { position: relative; flex: 1; min-height: 0; overflow: hidden; }
#dinoCanvas { display: block; width: 100%; height: 100%; cursor: pointer; }

/* Top-Left Camera & Park Horn Controls */
.cam-controls {
  position: absolute; top: 14px; left: 14px; z-index: 5;
  display: flex; gap: 6px; padding: 5px;
  background: rgba(18, 26, 20, 0.82); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  border: 1px solid rgba(235, 174, 62, 0.32); border-radius: 14px;
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.36);
}
.cam-btn {
  width: 34px; height: 34px; border-radius: 9px; border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.08); color: #fbf3e0; cursor: pointer; font-size: 1rem;
  display: grid; place-items: center; transition: all 0.14s;
}
.cam-btn:hover { background: rgba(235, 174, 62, 0.28); border-color: rgba(235, 174, 62, 0.65); transform: translateY(-1px); }

/* Jurassic Paleo Field Guide Inspector Card */
.dino-card {
  position: absolute; top: 14px; right: 14px; width: 298px; z-index: 5;
  background: rgba(18, 26, 20, 0.92); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  border: 1.5px solid rgba(235, 174, 62, 0.38); border-radius: 20px; overflow: hidden;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.5);
  transition: transform 0.24s ease, border-color 0.24s ease, box-shadow 0.24s ease;
}
.dino-card.close-up {
  border-color: #f5b942;
  box-shadow: 0 18px 46px rgba(0, 0, 0, 0.58), 0 0 0 2px rgba(245, 185, 66, 0.24);
}

.dino-card-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 7px 12px; background: rgba(12, 18, 13, 0.94);
  border-bottom: 1px solid rgba(235, 174, 62, 0.18);
}
.era-badge { font-size: 0.69rem; font-weight: 700; color: #f6dba0; letter-spacing: 0.03em; }
.diet-badge {
  font-size: 0.68rem; font-weight: 800; padding: 2px 8px; border-radius: 999px;
  border: 1px solid transparent; white-space: nowrap;
}
.diet-badge.carnivore { background: rgba(220, 68, 55, 0.24); color: #fecaca; border-color: rgba(248, 113, 113, 0.5); }
.diet-badge.herbivore { background: rgba(64, 172, 88, 0.24); color: #bbf7d0; border-color: rgba(74, 222, 128, 0.5); }
.diet-badge.piscivore { background: rgba(56, 168, 224, 0.24); color: #bae6fd; border-color: rgba(56, 189, 248, 0.5); }

.dino-photo-wrap { position: relative; width: 100%; height: 152px; overflow: hidden; background: #0e1410; }
.dino-photo-wrap::after {
  content: ''; position: absolute; inset: 0; pointer-events: none;
  box-shadow: inset 0 -24px 28px rgba(12, 18, 13, 0.68);
}
.dino-photo-wrap img {
  width: 100%; height: 100%; object-fit: cover; object-position: center 32%;
  filter: contrast(1.05) saturate(1.08); transition: transform 0.55s ease;
}
.dino-card:hover .dino-photo-wrap img { transform: scale(1.04); }

.dino-size-pill {
  position: absolute; bottom: 8px; left: 10px; z-index: 2;
  background: rgba(16, 24, 18, 0.86); border: 1px solid rgba(235, 174, 62, 0.45);
  color: #fde68a; font-size: 0.68rem; font-weight: 700; padding: 3px 9px; border-radius: 999px;
}

.dino-info { padding: 11px 13px 13px; }
.dino-name-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; margin-bottom: 6px; }
.dino-name-row h2 { font-size: 1.12rem; font-weight: 800; color: #fffaf0; line-height: 1.15; }
.dino-pronounce {
  font-size: 0.78rem; font-weight: 700; color: #fbbf24; margin-top: 2px; letter-spacing: 0.01em;
}
.say-name-btn {
  width: 36px; height: 36px; flex-shrink: 0; border-radius: 10px;
  border: 1px solid rgba(245, 185, 66, 0.5); background: rgba(245, 185, 66, 0.18);
  color: #fef3c7; font-size: 1rem; cursor: pointer; display: grid; place-items: center;
  transition: all 0.14s ease;
}
.say-name-btn:hover { background: rgba(245, 185, 66, 0.35); transform: scale(1.06); }

.dino-fact { font-size: 0.77rem; line-height: 1.38; color: #dde7df; margin-bottom: 10px; }

.dino-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.dino-btn {
  font-family: inherit; font-size: 0.80rem; font-weight: 700; padding: 8px 9px;
  border-radius: 10px; cursor: pointer; border: 1px solid transparent; color: #fff;
  display: inline-flex; align-items: center; justify-content: center; gap: 5px;
  transition: all 0.14s ease;
}
.dino-btn:hover { filter: brightness(1.1); transform: translateY(-1px); }
.dino-btn.feed-btn {
  grid-column: 1 / -1; padding: 9px 10px; font-size: 0.85rem;
  background: linear-gradient(135deg, #c97724, #9e4d12);
  border-color: rgba(253, 211, 134, 0.45);
  box-shadow: 0 4px 14px rgba(180, 96, 22, 0.35);
}
.dino-btn.feed-btn.fed {
  background: linear-gradient(135deg, #2d8a52, #1f6b3e);
  border-color: rgba(154, 236, 180, 0.45);
}
.dino-btn.roar-btn {
  background: linear-gradient(135deg, #b83b2e, #8a261c);
  border-color: rgba(252, 165, 165, 0.38);
}
.dino-btn.greet-btn {
  background: rgba(255, 255, 255, 0.11);
  border-color: rgba(235, 174, 62, 0.36); color: #fef3c7;
}

/* Floating Discovery Toast */
.dino-toast {
  position: absolute; top: 18px; left: 50%; transform: translateX(-50%) translateY(-18px);
  background: linear-gradient(135deg, rgba(32, 54, 34, 0.96), rgba(18, 34, 22, 0.96));
  border: 1.5px solid #f5b942; color: #fef3c7; font-size: 1.02rem; font-weight: 800;
  padding: 9px 22px; border-radius: 999px; box-shadow: 0 12px 32px rgba(0, 0, 0, 0.5);
  opacity: 0; pointer-events: none; z-index: 8; transition: opacity 0.24s ease, transform 0.28s ease;
}
.dino-toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* Cinematic Jurassic Welcome Overlay */
.start-overlay {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  background: rgba(10, 16, 12, 0.78); backdrop-filter: blur(11px); -webkit-backdrop-filter: blur(11px); z-index: 10;
}
.start-overlay.hidden { display: none; }
.start-card {
  background: linear-gradient(165deg, rgba(25, 36, 27, 0.98) 0%, rgba(15, 22, 17, 0.99) 100%);
  border: 1.5px solid rgba(235, 174, 62, 0.4); border-radius: 26px; padding: 22px 30px;
  text-align: center; max-width: 660px; width: 93%;
  box-shadow: 0 28px 72px rgba(0, 0, 0, 0.72), inset 0 1px 0 rgba(255, 255, 255, 0.06);
}
.start-photo-strip {
  display: grid; grid-template-columns: repeat(8, 1fr); gap: 6px; margin-bottom: 12px;
}
.start-photo-strip img {
  width: 100%; height: 54px; border-radius: 10px; object-fit: cover; object-position: center 28%;
  border: 1.5px solid rgba(235, 174, 62, 0.48); box-shadow: 0 6px 14px rgba(0, 0, 0, 0.4);
}
.jurassic-crest {
  display: inline-block; padding: 3px 12px; margin-bottom: 6px; border-radius: 999px;
  background: rgba(186, 52, 34, 0.28); border: 1px solid rgba(245, 185, 66, 0.55);
  color: #fde08d; font-size: 0.72rem; font-weight: 800; letter-spacing: 0.12em;
}
.start-card h2 { font-size: 1.72rem; color: #fff8e6; margin-bottom: 3px; font-weight: 800; }
.start-subtitle {
  font-size: 0.82rem; font-weight: 700; color: #e2bd72; letter-spacing: 0.04em;
  text-transform: uppercase; margin-bottom: 11px;
}

.keeper-select-row {
  display: flex; flex-direction: column; align-items: center; gap: 9px;
  margin: 6px 0 13px; padding: 12px 16px; background: rgba(255, 255, 255, 0.04);
  border-radius: 16px; border: 1px solid rgba(235, 174, 62, 0.22);
}
.select-label {
  font-size: 0.75rem; font-weight: 700; color: #cfc6b2; text-transform: uppercase; letter-spacing: 0.08em;
}
.keeper-options { display: flex; gap: 12px; justify-content: center; width: 100%; max-width: 450px; }
.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(235, 174, 62, 0.24);
  background: rgba(255, 255, 255, 0.04); cursor: pointer; font-family: inherit; transition: all 0.15s 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.92rem; color: #f6efe0; display: block; font-weight: 700; }
.keeper-opt .opt-text small { font-size: 0.74rem; font-weight: 500; color: #b5ad9c; }
.keeper-opt:hover { transform: translateY(-1px); border-color: rgba(235, 174, 62, 0.55); }
.keeper-opt.active {
  border-color: #f0b243; background: rgba(212, 134, 34, 0.24);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.32);
}

.keeper-name-row { display: flex; align-items: center; gap: 10px; width: 100%; max-width: 450px; margin-top: 2px; }
.keeper-name-label { font-size: 0.84rem; font-weight: 700; color: #f3e4c2; white-space: nowrap; }
.keeper-name-input {
  flex: 1; font-family: inherit; font-size: 0.95rem; font-weight: 600; color: #fffbf0;
  background: rgba(12, 18, 13, 0.8); border: 1.5px solid rgba(235, 174, 62, 0.4);
  border-radius: 11px; padding: 8px 13px; outline: none; transition: all 0.2s ease;
}
.keeper-name-input::placeholder { color: #8f9688; font-weight: 500; }
.keeper-name-input:focus {
  border-color: #f5b942; background: rgba(14, 22, 16, 0.95);
  box-shadow: 0 0 0 3px rgba(245, 185, 66, 0.24);
}
.keeper-name-hint { font-size: 0.76rem; color: #b7e0a8; font-weight: 500; line-height: 1.35; }

.start-keys { font-size: 0.81rem; font-weight: 600; color: #c4bea8; margin-bottom: 14px; }
.kbd {
  display: inline-block; min-width: 26px; padding: 2px 7px; margin: 0 2px; border-radius: 6px;
  background: rgba(255, 255, 255, 0.08); border: 1px solid rgba(235, 174, 62, 0.3);
  box-shadow: 0 2px 0 rgba(0, 0, 0, 0.4); font-size: 0.77rem; color: #f5eedf;
}
.kbd.wide { padding: 2px 9px; }

.start-btn {
  font-family: inherit; font-size: 1.06rem; font-weight: 800; color: #fff8eb; cursor: pointer;
  background: linear-gradient(135deg, #c44329, #8f2616);
  border: 1.5px solid rgba(248, 198, 108, 0.52); border-radius: 14px;
  padding: 12px 28px; box-shadow: 0 8px 24px rgba(0, 0, 0, 0.48); transition: all 0.15s ease;
}
.start-btn small { font-size: 0.78rem; font-weight: 500; opacity: 0.88; }
.start-btn:hover { transform: translateY(-2px); filter: brightness(1.08); }
.loading-note { margin-top: 8px; font-size: 0.78rem; color: #a4ab9c; }
.loading-note.error { color: #f87171; font-weight: 700; }

/* Bottom Dinosaur Field Guide Bar */
.dino-bar {
  height: 78px; flex-shrink: 0; display: flex; align-items: center; justify-content: flex-start; gap: 8px;
  padding: 0 12px; background: rgba(16, 24, 18, 0.97);
  border-top: 1.5px solid rgba(235, 174, 62, 0.28); z-index: 6; overflow-x: auto; scrollbar-width: none;
}
.dino-bar::-webkit-scrollbar { display: none; }

.dino-chip {
  display: inline-flex; align-items: center; gap: 8px; padding: 6px 10px 6px 7px;
  min-width: 158px; flex: 1 0 158px; max-width: 212px;
  border-radius: 14px; border: 1.5px solid rgba(235, 174, 62, 0.24);
  background: rgba(255, 255, 255, 0.045); color: #f4ece0; font-family: inherit;
  cursor: pointer; transition: all 0.15s ease;
}
.dino-chip:hover {
  transform: translateY(-2px); border-color: rgba(245, 185, 66, 0.6);
  background: rgba(255, 255, 255, 0.09);
}
.dino-chip.active {
  border-color: #f5b942; background: rgba(245, 185, 66, 0.16);
  box-shadow: 0 4px 16px rgba(245, 185, 66, 0.24);
}
.dino-chip.fed { border-color: #4ade80; background: rgba(34, 197, 94, 0.14); }
.dino-chip-photo {
  width: 46px; height: 46px; border-radius: 11px; object-fit: cover; flex-shrink: 0;
  border: 1.5px solid rgba(235, 174, 62, 0.42); background: #141d16;
}
.dino-chip-meta { display: flex; flex-direction: column; text-align: left; gap: 2px; min-width: 0; }
.dino-chip-name { font-size: 0.80rem; font-weight: 800; color: #fff9eb; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dino-chip-sub { font-size: 0.67rem; font-weight: 600; color: #c7dbc5; white-space: nowrap; }
.dino-chip.fed .dino-chip-sub { color: #86efac; }

@media (max-width: 1080px) {
  .title { display: none; }
  .dino-card { width: 258px; }
  .dino-photo-wrap { height: 120px; }
}
@media (max-width: 720px) {
  .dino-card { width: 215px; top: 8px; right: 8px; }
  .dino-photo-wrap { height: 92px; }
  .dino-fact { display: none; }
  .start-photo-strip { grid-template-columns: repeat(4, 1fr); }
}
