* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  user-select: none;
}

body, html {
  width: 100%;
  height: 100%;
  overflow: hidden;
  font-family: 'Trebuchet MS', 'Fredoka', 'Segoe UI', system-ui, sans-serif;
  background: #67c5ff;
  color: #243319;
}

#game-container {
  position: relative;
  width: 100vw;
  height: 100vh;
}

#game-canvas {
  display: block;
  width: 100%;
  height: 100%;
}

.hidden {
  display: none !important;
}

/* Top Arcade HUD */
#hud {
  position: absolute;
  top: 14px;
  left: 16px;
  right: 16px;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  pointer-events: none;
  z-index: 20;
  gap: 12px;
}

.hud-left, .hud-right {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.hud-center {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  flex: 1;
  max-width: 440px;
}

.hud-card {
  background: rgba(255, 252, 235, 0.94);
  border: 3px solid #2f4f28;
  border-radius: 16px;
  padding: 6px 14px;
  box-shadow: 0 5px 0 #2f4f28, 0 8px 16px rgba(0, 0, 0, 0.2);
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 96px;
}

.hud-label {
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 0.8px;
  color: #5b7844;
  text-transform: uppercase;
}

.sub-label {
  font-size: 11px;
  font-weight: 700;
  color: #d96b1f;
}

#hud-level, #hud-sheep, #hud-lost, #hud-score, #hud-time {
  font-size: 20px;
  font-weight: 900;
  color: #1f3518;
}
.mini-bar {
  width: 100%;
  height: 7px;
  background: #dce5c9;
  border-radius: 6px;
  overflow: hidden;
  margin-top: 3px;
  border: 1px solid #4c6c39;
}

.mini-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #43c653, #8be836);
  transition: width 0.2s ease;
}

.bark-fill {
  width: 100%;
  background: linear-gradient(90deg, #ff9d2e, #ffdf38);
}

.icon-btn {
  pointer-events: auto;
  width: 44px;
  height: 44px;
  border-radius: 14px;
  border: 3px solid #2f4f28;
  background: #fffceb;
  box-shadow: 0 4px 0 #2f4f28;
  font-size: 20px;
  cursor: pointer;
  transition: transform 0.1s ease;
}

.icon-btn:active {
  transform: translateY(3px);
  box-shadow: 0 1px 0 #2f4f28;
}

.boss-banner {
  width: 100%;
  background: rgba(58, 17, 17, 0.92);
  border: 3px solid #ff5436;
  border-radius: 16px;
  padding: 8px 16px;
  color: #fff3d6;
  text-align: center;
  box-shadow: 0 5px 0 #6b1409;
}

.boss-title {
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.7px;
  margin-bottom: 5px;
}

.boss-bar-bg {
  width: 100%;
  height: 12px;
  background: #2b0909;
  border-radius: 8px;
  border: 2px solid #ffb09c;
  overflow: hidden;
}

.boss-bar-fill {
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, #ff382e, #ffaa2b);
  transition: width 0.2s ease;
}

.event-toast {
  background: #ffea59;
  color: #362204;
  border: 3px solid #362204;
  border-radius: 999px;
  padding: 7px 20px;
  font-weight: 900;
  font-size: 15px;
  box-shadow: 0 4px 0 #362204;
  animation: popBounce 0.25s ease-out;
}

#controls-hint {
  position: absolute;
  bottom: 14px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(31, 53, 24, 0.88);
  color: #fffceb;
  padding: 8px 20px;
  border-radius: 999px;
  border: 2px solid #9be36d;
  display: flex;
  gap: 20px;
  font-size: 13px;
  z-index: 20;
  pointer-events: none;
  white-space: nowrap;
}
/* Floating Speech & Bleat Bubbles */
#bubble-layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 15;
  overflow: hidden;
}

.speech-bubble {
  position: absolute;
  transform: translate(-50%, -100%);
  background: #ffffff;
  color: #213018;
  border: 2.5px solid #213018;
  border-radius: 14px;
  padding: 3px 9px;
  font-size: 13px;
  font-weight: 900;
  box-shadow: 0 3px 0 rgba(0,0,0,0.22);
  white-space: nowrap;
  animation: bubblePop 0.2s ease-out;
}

.speech-bubble.bark {
  background: #ffe03b;
  color: #6b1d05;
  border-color: #6b1d05;
  font-size: 15px;
}

.speech-bubble.scared {
  background: #ff6142;
  color: #fff;
  border-color: #540d03;
}

.speech-bubble.shepherd {
  background: #a4f57f;
  color: #193b0a;
  border-color: #193b0a;
}

/* Modal Screens */
.overlay-screen {
  position: absolute;
  inset: 0;
  background: radial-gradient(circle, rgba(25, 58, 28, 0.45), rgba(11, 28, 14, 0.78));
  backdrop-filter: blur(4px);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 40;
  padding: 18px;
}

.modal-card {
  background: #fffdf0;
  border: 4px solid #284920;
  border-radius: 28px;
  box-shadow: 0 10px 0 #284920, 0 20px 45px rgba(0, 0, 0, 0.45);
  padding: 24px 28px;
  max-width: 900px;
  width: 100%;
  text-align: center;
  max-height: 94vh;
  overflow-y: auto;
}

.badge-header {
  display: inline-block;
  background: #ffcf33;
  color: #4f2a00;
  border: 2.5px solid #4f2a00;
  border-radius: 999px;
  padding: 4px 16px;
  font-weight: 900;
  font-size: 12px;
  letter-spacing: 1px;
  margin-bottom: 8px;
}

.game-title {
  font-size: 42px;
  font-weight: 900;
  color: #21591f;
  text-shadow: 0 3px 0 #b8f279;
  letter-spacing: 1px;
}

.game-subtitle {
  font-size: 14px;
  color: #455c39;
  max-width: 680px;
  margin: 6px auto 16px;
  line-height: 1.45;
}
.section-heading {
  font-size: 17px;
  font-weight: 900;
  color: #2f4f28;
  margin-bottom: 10px;
}

.breed-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 10px;
  margin-bottom: 16px;
}

.breed-card {
  background: #f4f9e8;
  border: 3px solid #86a873;
  border-radius: 18px;
  padding: 10px 10px;
  cursor: pointer;
  transition: transform 0.12s ease, border-color 0.12s ease, background 0.12s ease;
  text-align: left;
}

.breed-card:hover {
  transform: translateY(-3px);
  border-color: #3d7d2e;
}

.breed-card.selected {
  background: #e6ffcf;
  border-color: #246b17;
  box-shadow: 0 5px 0 #246b17;
  transform: translateY(-3px);
}

.breed-swatch {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 2.5px solid #283d1e;
  margin-bottom: 6px;
}

.breed-name {
  font-size: 14px;
  font-weight: 900;
  color: #1f3815;
}

.breed-role {
  font-size: 11px;
  font-weight: 700;
  color: #c96214;
  margin-bottom: 6px;
}

.breed-stat {
  font-size: 10px;
  font-weight: 800;
  color: #3f5931;
  margin-top: 3px;
}

.stat-meter {
  width: 100%;
  height: 6px;
  background: #d3e0c3;
  border-radius: 4px;
  overflow: hidden;
  margin-top: 2px;
}

.stat-meter-fill {
  height: 100%;
  background: linear-gradient(90deg, #38b849, #f7a623);
}

.level-select-row {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
  font-weight: 800;
  font-size: 14px;
}

.arcade-select {
  padding: 7px 14px;
  border-radius: 12px;
  border: 2.5px solid #284920;
  background: #fff;
  font-weight: 800;
  font-size: 14px;
  color: #1f3815;
  cursor: pointer;
}

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

.primary-btn, .secondary-btn {
  padding: 12px 26px;
  border-radius: 16px;
  border: 3px solid #1f3d14;
  font-size: 17px;
  font-weight: 900;
  cursor: pointer;
  transition: transform 0.1s ease;
}

.primary-btn {
  background: linear-gradient(180deg, #62e346, #2fb327);
  color: #0e2908;
  box-shadow: 0 5px 0 #1f3d14;
}

.secondary-btn {
  background: #f0f5e1;
  color: #263d1b;
  box-shadow: 0 5px 0 #263d1b;
}

.primary-btn:active, .secondary-btn:active {
  transform: translateY(4px);
  box-shadow: 0 1px 0 #1f3d14;
}

.result-title {
  font-size: 32px;
  font-weight: 900;
  color: #1f4f1a;
  margin: 4px 0;
}

.result-desc {
  font-size: 15px;
  color: #49613b;
  margin-bottom: 10px;
}

.stars-row {
  font-size: 34px;
  margin: 8px 0 14px;
  letter-spacing: 6px;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  max-width: 460px;
  margin: 0 auto 20px;
}

.stat-box {
  background: #f2f8e4;
  border: 2.5px solid #6b8f57;
  border-radius: 14px;
  padding: 8px 12px;
  display: flex;
  flex-direction: column;
}

.stat-label {
  font-size: 11px;
  font-weight: 800;
  color: #557046;
}

.stat-val {
  font-size: 20px;
  font-weight: 900;
  color: #1f3815;
}

@keyframes popBounce {
  0% { transform: scale(0.6); opacity: 0; }
  80% { transform: scale(1.06); }
  100% { transform: scale(1); opacity: 1; }
}

@keyframes bubblePop {
  0% { transform: translate(-50%, -80%) scale(0.5); opacity: 0; }
  100% { transform: translate(-50%, -100%) scale(1); opacity: 1; }
}
