:root {
  --panel: rgba(22, 34, 48, 0.62);
  --panel-solid: #fdf6e6;
  --ink: #2c2a30;
  --yellow: #ffd84a;
  --green: #6fd05a;
  --blue: #4aa8e0;
  --red: #e8604c;
  --cream: #fdf6e6;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  overflow: hidden;
  background: #8fcdf0;
  font-family: "Trebuchet MS", "Arial Rounded MT Bold", "Segoe UI", system-ui, sans-serif;
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
}

#app { position: fixed; inset: 0; }

#scene { display: block; width: 100%; height: 100%; }

.hidden { display: none !important; }

.panel {
  position: absolute;
  background: var(--panel);
  border: 3px solid rgba(255, 255, 255, 0.75);
  border-radius: 18px;
  box-shadow: 0 8px 20px rgba(10, 25, 40, 0.28), inset 0 1px 0 rgba(255, 255, 255, 0.25);
  color: #fff;
  padding: 10px 14px;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

.hud-tl { top: 14px; left: 14px; min-width: 262px; }

.hud-row { display: flex; justify-content: space-between; align-items: center; font-size: 19px; font-weight: bold; text-shadow: 0 2px 0 rgba(0,0,0,0.25); }
.hud-row .score { color: var(--yellow); }

.objective { display: flex; align-items: center; gap: 8px; margin-top: 6px; font-size: 17px; }
.sheepIcon {
  width: 20px; height: 16px; border-radius: 50% 50% 45% 45%;
  background: #fff; border: 2px solid #d8d2c4; position: relative; flex: 0 0 auto;
}
.sheepIcon::after {
  content: ""; position: absolute; right: -6px; top: 4px; width: 9px; height: 8px;
  background: #6f645c; border-radius: 40%;
}

.timeWrap {
  position: relative; height: 18px; margin-top: 8px; border-radius: 10px;
  background: rgba(0, 0, 0, 0.35); overflow: hidden;
  border: 2px solid rgba(255,255,255,0.45);
}
#timeBar {
  height: 100%; width: 100%; background: linear-gradient(180deg, #8ce06a, #4fae3a);
  transition: width 0.2s linear, background 0.3s;
}
#timeBar.warn { background: linear-gradient(180deg, #ffd84a, #e8a02c); }
#timeBar.danger { background: linear-gradient(180deg, #ff8a6a, #d94a34); }
#timeText {
  position: absolute; inset: 0; text-align: center; font-size: 13px; font-weight: bold;
  line-height: 14px; color: #fff; text-shadow: 0 1px 2px rgba(0,0,0,0.5);
}

.hud-tr { top: 14px; right: 14px; padding: 8px; }
#minimap { display: block; width: 180px; height: 180px; border-radius: 12px; background: rgba(120, 180, 110, 0.35); }
.minimap-label { text-align: center; font-size: 11px; letter-spacing: 2px; text-transform: uppercase; opacity: 0.75; margin-top: 2px; }

.hud-bl { bottom: 14px; left: 14px; min-width: 250px; }
.breedRow { display: flex; align-items: center; gap: 8px; font-weight: bold; font-size: 16px; }
.pawIcon {
  width: 16px; height: 16px; border-radius: 50%; background: var(--yellow);
  box-shadow: 0 0 0 3px rgba(255, 216, 74, 0.35);
}
.statRow { display: flex; align-items: center; gap: 8px; margin-top: 7px; font-size: 13px; }
.statLabel { width: 42px; opacity: 0.85; }
.bar { flex: 1; height: 14px; border-radius: 8px; background: rgba(0,0,0,0.35); overflow: hidden; border: 2px solid rgba(255,255,255,0.4); }
#staminaBar { height: 100%; width: 100%; background: linear-gradient(180deg, #7fd6ff, #3f92d8); transition: width 0.12s linear; }
#staminaBar.low { background: linear-gradient(180deg, #ff9a6a, #d9542c); }
#barkState { margin-top: 6px; font-size: 13px; opacity: 0.9; }
#barkState.ready { color: #b6ff9a; }
#barkState.cool { color: #ffd84a; }

.hud-hint {
  position: absolute; bottom: 16px; left: 50%; transform: translateX(-50%);
  font-size: 13px; color: #fff; text-shadow: 0 2px 4px rgba(0,0,0,0.55);
  background: rgba(20, 32, 46, 0.4); padding: 6px 14px; border-radius: 12px;
  white-space: nowrap;
}

#threatBanner {
  position: absolute; top: 96px; left: 50%; transform: translateX(-50%);
  background: linear-gradient(180deg, #ff7a5c, #c9391f);
  color: #fff; font-weight: bold; font-size: 20px;
  padding: 8px 22px; border-radius: 14px; border: 3px solid rgba(255,255,255,0.85);
  box-shadow: 0 6px 16px rgba(120, 20, 10, 0.4);
  animation: pulse 1s infinite alternate;
}
@keyframes pulse { from { transform: translateX(-50%) scale(1); } to { transform: translateX(-50%) scale(1.05); } }

#toastWrap {
  position: absolute; top: 150px; left: 50%; transform: translateX(-50%);
  display: flex; flex-direction: column; gap: 6px; align-items: center; pointer-events: none;
}
.toast {
  background: rgba(20, 32, 46, 0.72); color: #fff; padding: 7px 16px; border-radius: 12px;
  font-size: 15px; border: 2px solid rgba(255,255,255,0.5);
  animation: toastIn 0.25s ease-out;
}
@keyframes toastIn { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: none; } }

.overlay {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  background: rgba(14, 26, 40, 0.55);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
  z-index: 20;
}

.card, .menuCard {
  background: var(--cream);
  border: 5px solid #fff;
  border-radius: 26px;
  box-shadow: 0 18px 40px rgba(8, 20, 34, 0.45);
  padding: 24px 30px;
  max-width: 720px;
  text-align: center;
  color: var(--ink);
  animation: cardIn 0.28s ease-out;
}
@keyframes cardIn { from { opacity: 0; transform: scale(0.94) translateY(10px); } to { opacity: 1; transform: none; } }

.card.small { max-width: 320px; }
.menuCard { max-width: 860px; }

h1 {
  margin: 0 0 2px;
  font-size: 46px;
  letter-spacing: 3px;
  color: #3f8f3a;
  text-shadow: 0 3px 0 #fff, 0 6px 0 rgba(0,0,0,0.12);
}
h2 { margin: 6px 0 10px; font-size: 26px; color: #3a4a5a; }
.tagline { margin: 0 0 14px; font-size: 16px; color: #6a7a86; }
.sub { font-size: 16px; color: #5a6a76; margin: 4px 0 10px; }
.hint { font-size: 16px; color: #4a5a66; background: #fff8dc; border: 3px dashed #e8d48a; border-radius: 16px; padding: 12px 16px; margin: 10px 0; line-height: 1.45; }
.kicker { font-size: 14px; letter-spacing: 3px; text-transform: uppercase; color: #c98a2a; font-weight: bold; }
.tiny { font-size: 13px; color: #8a96a0; margin-top: 12px; }

#breedGrid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin: 10px 0 18px; }
@media (max-width: 780px) { #breedGrid { grid-template-columns: repeat(2, 1fr); } h1 { font-size: 34px; } }

.breedCard {
  background: #fff;
  border: 4px solid #e6dfd0;
  border-radius: 18px;
  padding: 12px 14px;
  cursor: pointer;
  text-align: left;
  transition: transform 0.12s, border-color 0.12s, box-shadow 0.12s;
}
.breedCard:hover { transform: translateY(-3px); border-color: #ffd84a; }
.breedCard.selected { border-color: #6fd05a; box-shadow: 0 0 0 4px rgba(111, 208, 90, 0.25); transform: translateY(-3px); }
.breedCard h3 { margin: 0 0 2px; font-size: 18px; }
.breedCard .tag { font-size: 12px; color: #c98a2a; font-weight: bold; text-transform: uppercase; letter-spacing: 1px; }
.breedCard p { font-size: 13px; color: #5a6a76; margin: 6px 0 8px; line-height: 1.35; }
.breedCard .miniStat { display: flex; align-items: center; gap: 6px; font-size: 11px; color: #6a7a86; }
.breedCard .miniBar { flex: 1; height: 8px; background: #ece6da; border-radius: 5px; overflow: hidden; }
.breedCard .miniBar > i { display: block; height: 100%; background: linear-gradient(90deg, #8ce06a, #4fae3a); }

.menuButtons { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }

button {
  font-family: inherit;
  font-size: 17px;
  font-weight: bold;
  padding: 11px 24px;
  border-radius: 16px;
  border: 4px solid #fff;
  background: #e8e0d0;
  color: #3a4a5a;
  cursor: pointer;
  box-shadow: 0 5px 0 rgba(0,0,0,0.14);
  transition: transform 0.1s, box-shadow 0.1s, background 0.15s;
}
button:hover { transform: translateY(-2px); box-shadow: 0 7px 0 rgba(0,0,0,0.16); }
button:active { transform: translateY(2px); box-shadow: 0 2px 0 rgba(0,0,0,0.16); }
button.primary { background: linear-gradient(180deg, #8ce06a, #52b03c); color: #fff; text-shadow: 0 2px 0 rgba(0,0,0,0.18); }
button.primary:hover { background: linear-gradient(180deg, #9aeb76, #5cbd44); }

.controlsList { text-align: left; font-size: 15px; line-height: 1.6; margin: 6px 0 14px; padding-left: 20px; color: #4a5a66; }

.stats { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 20px; margin: 14px 0 18px; font-size: 16px; }
.stats div { display: flex; justify-content: space-between; border-bottom: 2px dotted #ded6c6; padding-bottom: 4px; }
.stats b { color: #3f8f3a; }

.introCard { max-width: 620px; }
.meta { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; margin: 12px 0 4px; }
.meta span {
  background: #fff; border: 3px solid #e6dfd0; border-radius: 12px; padding: 5px 12px;
  font-size: 14px; font-weight: bold; color: #4a5a66;
}

.spinner {
  width: 34px; height: 34px; margin: 6px auto 10px;
  border: 5px solid #e6dfd0; border-top-color: #52b03c; border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
