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

html, body {
  width: 100%; height: 100%;
  overflow: hidden;
  font-family: "Fredoka", system-ui, sans-serif;
  background: #6ec6ff;
  color: #2b3a2e;
  user-select: none;
}

#app { width: 100%; height: 100%; position: relative; }

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

#ui {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.screen {
  position: absolute;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  padding: 16px;
}

.screen.active {
  display: flex;
  pointer-events: auto;
}

.screen.hud {
  display: none;
  pointer-events: none;
  flex-direction: column;
  justify-content: space-between;
  align-items: stretch;
}

.screen.hud.active { display: flex; }

.panel {
  background: rgba(255, 252, 240, 0.94);
  border: 4px solid #5d4037;
  border-radius: 28px;
  box-shadow: 0 12px 0 rgba(0,0,0,0.15), 0 20px 40px rgba(0,0,0,0.2);
  padding: 28px 36px;
  max-width: 520px;
  width: 100%;
  text-align: center;
  pointer-events: auto;
  animation: pop 0.35s ease-out;
}

.panel.wide { max-width: 760px; }

@keyframes pop {
  from { transform: scale(0.9); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

h2 {
  font-size: 2rem;
  color: #33691e;
  margin-bottom: 12px;
  letter-spacing: 0.5px;
}

h2.warn { color: #c62828; }

.logo {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 14px;
}

.logo-baa {
  font-size: 3.2rem;
  font-weight: 700;
  color: #2e7d32;
  text-shadow: 3px 3px 0 #fff59d, 5px 5px 0 rgba(0,0,0,0.12);
  letter-spacing: 1px;
}

.logo-sub {
  font-size: 1.15rem;
  font-weight: 500;
  color: #6d4c41;
  letter-spacing: 3px;
  text-transform: uppercase;
}

.tagline {
  font-size: 1.05rem;
  color: #5d4037;
  margin-bottom: 22px;
}

.keys-hint {
  margin-top: 16px;
  font-size: 0.85rem;
  color: #8d6e63;
}

.btn {
  pointer-events: auto;
  font-family: inherit;
  font-size: 1.1rem;
  font-weight: 600;
  color: #fff;
  background: #43a047;
  border: 3px solid #2e7d32;
  border-radius: 18px;
  padding: 12px 28px;
  margin: 8px;
  cursor: pointer;
  box-shadow: 0 5px 0 #2e7d32;
  transition: transform 0.08s, box-shadow 0.08s;
}

.btn:hover { background: #66bb6a; }
.btn:active {
  transform: translateY(4px);
  box-shadow: 0 1px 0 #2e7d32;
}

.btn.big {
  font-size: 1.3rem;
  padding: 14px 40px;
  background: #f9a825;
  border-color: #f57f17;
  box-shadow: 0 5px 0 #f57f17;
}
.btn.big:hover { background: #fbc02d; }
.btn.big:active { box-shadow: 0 1px 0 #f57f17; }

.row {
  display: flex;
  justify-content: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 10px;
}

.how-list {
  text-align: left;
  margin: 8px 0 20px;
  padding-left: 18px;
  line-height: 1.65;
  color: #4e342e;
  font-size: 0.98rem;
}

.how-list li { margin-bottom: 6px; }

/* Breed cards */
.breed-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 12px;
  margin: 12px 0 20px;
}

.breed-card {
  pointer-events: auto;
  background: #fff;
  border: 3px solid #c5e1a5;
  border-radius: 18px;
  padding: 12px 10px;
  cursor: pointer;
  transition: transform 0.12s, border-color 0.12s, background 0.12s;
}

.breed-card:hover { transform: translateY(-3px); }
.breed-card.selected {
  border-color: #f9a825;
  background: #fff8e1;
  transform: translateY(-3px) scale(1.03);
}

.breed-card .swatch {
  width: 54px; height: 54px;
  margin: 0 auto 8px;
  border-radius: 50%;
  border: 3px solid #5d4037;
  background: #ccc;
}

.breed-card h3 {
  font-size: 1rem;
  color: #33691e;
  margin-bottom: 6px;
}

.breed-card .stats {
  font-size: 0.72rem;
  color: #6d4c41;
  line-height: 1.45;
  text-align: left;
}

.breed-card .stats .bar {
  display: inline-block;
  height: 6px;
  border-radius: 3px;
  background: #aed581;
  vertical-align: middle;
  margin-left: 4px;
}

.breed-card p.blurb {
  font-size: 0.72rem;
  color: #8d6e63;
  margin-top: 6px;
  font-style: italic;
}

/* Level intro */
.level-badge {
  display: inline-block;
  background: #5c6bc0;
  color: #fff;
  font-weight: 600;
  padding: 4px 16px;
  border-radius: 999px;
  margin-bottom: 10px;
  letter-spacing: 1px;
}

.level-desc {
  color: #5d4037;
  margin-bottom: 16px;
  line-height: 1.5;
}

.level-meta, .result-stats {
  display: flex;
  justify-content: center;
  gap: 18px;
  margin-bottom: 18px;
  flex-wrap: wrap;
}

.meta, .result-stats > div {
  background: #f1f8e9;
  border: 2px solid #c5e1a5;
  border-radius: 14px;
  padding: 8px 14px;
  min-width: 86px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.meta span, .result-stats span {
  font-size: 0.7rem;
  color: #7cb342;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.meta b, .result-stats b {
  font-size: 1.15rem;
  color: #33691e;
}

.stars {
  font-size: 2.4rem;
  color: #f9a825;
  letter-spacing: 6px;
  margin-bottom: 6px;
  text-shadow: 2px 2px 0 #fff59d;
}

/* HUD */
.hud-top {
  display: flex;
  justify-content: center;
  gap: 12px;
  padding: 14px;
  flex-wrap: wrap;
}

.hud-card {
  background: rgba(255, 252, 240, 0.9);
  border: 3px solid #5d4037;
  border-radius: 16px;
  padding: 6px 14px;
  min-width: 84px;
  text-align: center;
  box-shadow: 0 4px 0 rgba(0,0,0,0.12);
}

.hud-label {
  display: block;
  font-size: 0.65rem;
  color: #8d6e63;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.hud-value {
  display: block;
  font-size: 1.25rem;
  color: #33691e;
  font-weight: 600;
}

.hud-value.small { font-size: 0.9rem; }

.hud-card.warn .hud-value { color: #e53935; }

.hud-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  gap: 16px;
}

.hud-tip {
  background: rgba(255, 252, 240, 0.85);
  border: 2px solid #a1887f;
  border-radius: 14px;
  padding: 8px 16px;
  font-size: 0.95rem;
  color: #4e342e;
  max-width: 60%;
}

.bark-meter {
  position: relative;
  width: 160px;
  height: 28px;
  background: rgba(60, 40, 20, 0.35);
  border: 3px solid #5d4037;
  border-radius: 14px;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

.bark-meter span {
  position: relative;
  z-index: 1;
  font-size: 0.7rem;
  font-weight: 700;
  color: #fff;
  letter-spacing: 2px;
  text-shadow: 1px 1px 0 #000;
}

.bark-fill {
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 100%;
  background: linear-gradient(90deg, #ffb300, #ff7043);
  transition: width 0.1s linear;
}

/* Toast */
#toast {
  position: absolute;
  left: 50%;
  top: 22%;
  transform: translateX(-50%);
  pointer-events: none;
  font-size: 1.6rem;
  font-weight: 700;
  color: #fff;
  text-shadow: 2px 2px 0 #5d4037, 0 0 12px rgba(0,0,0,0.3);
  opacity: 0;
  transition: opacity 0.25s;
  text-align: center;
  white-space: nowrap;
}

#toast.show { opacity: 1; }

@media (max-width: 600px) {
  .logo-baa { font-size: 2.2rem; }
  .panel { padding: 20px 18px; }
  .hud-tip { display: none; }
}
