:root {
  --grass: #6fbf4a;
  --deep: #234d33;
  --cream: #fff8df;
  --sun: #ffd34d;
  --sky: #9fdcff;
  --ink: #26362b;
}

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

html, body {
  width: 100%; height: 100%; overflow: hidden;
  background: #88c8ed;
  font-family: "Trebuchet MS", "Arial Rounded MT Bold", Verdana, sans-serif;
  color: var(--ink);
  user-select: none;
  -webkit-user-select: none;
}

#app { position: relative; width: 100vw; height: 100vh; }
#game { display: block; width: 100%; height: 100%; }

#vignette {
  position: absolute; inset: 0; pointer-events: none;
  box-shadow: inset 0 0 130px rgba(20, 55, 30, 0.28);
}

.hidden { display: none !important; }

.panel {
  background: linear-gradient(180deg, rgba(255,252,235,0.96), rgba(243,235,205,0.92));
  border: 3px solid #5a8f4e;
  border-radius: 16px;
  padding: 8px 14px;
  box-shadow: 0 5px 0 rgba(40,80,40,0.28), 0 10px 24px rgba(0,0,0,0.16);
}

.tiny { font-size: 11px; font-weight: bold; letter-spacing: 1.4px; color: #6c8d5e; }

.hud-top {
  position: absolute; top: 16px; left: 16px; right: 16px;
  display: flex; justify-content: space-between; align-items: flex-start; gap: 12px;
}
.level-panel { min-width: 170px; }
#levelName { font-size: 20px; font-weight: bold; color: #2f6b3b; text-shadow: 0 2px 0 #d5eab8; }
.flock-panel { min-width: 240px; text-align: center; }
.flock-row { display: flex; justify-content: space-between; gap: 18px; font-size: 20px; font-weight: bold; margin: 2px 0 5px; }
#timer { color: #a06a2c; font-variant-numeric: tabular-nums; }
#timer.urgent { color: #d43f2e; animation: pulse 0.6s infinite alternate; }
.status-panel { min-width: 170px; text-align: right; }
#hearts { font-size: 21px; letter-spacing: 3px; min-height: 26px; }
.bark-label { font-size: 12px; font-weight: bold; margin-top: 3px; }
.bar { height: 11px; border-radius: 8px; background: #cbdcb4; overflow: hidden; border: 2px solid #7ba567; }
.bar > div { height: 100%; width: 0%; border-radius: 6px; background: linear-gradient(180deg, #9ce55f, #4fae37); transition: width 0.18s; }
.bar.small { height: 8px; margin-top: 4px; }
#barkBar { background: linear-gradient(180deg, #ffe57d, #f0a92c); }
.bar.boss { height: 16px; border-color: #6a3232; background: #3b2323; width: 320px; }
#bossBar { background: linear-gradient(180deg, #ff8a6a, #d33b2b); }

#bossWrap {
  position: absolute; top: 104px; left: 50%; transform: translateX(-50%);
  text-align: center; color: #fff1d8; text-shadow: 0 2px 0 #592222, 0 0 12px #000;
}
#bossName { font-weight: bold; letter-spacing: 3px; font-size: 15px; margin-bottom: 5px; }

.hud-bottom { position: absolute; bottom: 16px; left: 16px; right: 16px; display: flex; align-items: flex-end; gap: 14px; }
.map-panel { padding: 6px; line-height: 0; }
#minimap { width: 190px; height: 190px; border-radius: 10px; }
.hint-panel { font-size: 15px; padding: 10px 16px; max-width: 440px; color: #3f6a3d; }
.hint-panel b { color: #c46b21; }

#toast {
  position: absolute; top: 28%; left: 50%; transform: translateX(-50%);
  font-size: 30px; font-weight: bold; color: #fff8d8;
  text-shadow: 0 3px 0 #3b6b33, 0 6px 18px rgba(0,0,0,0.35);
  opacity: 0; pointer-events: none; transition: opacity 0.25s;
  white-space: nowrap;
}
#toast.show { opacity: 1; }

.screen {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  background: radial-gradient(circle at 50% 30%, rgba(255,246,205,0.35), rgba(26,66,42,0.72));
  backdrop-filter: blur(3px);
  z-index: 10;
}

.title-card, .dialog-card {
  background: linear-gradient(180deg, #fffbee 0%, #f3eac8 100%);
  border: 5px solid #4f8b41;
  border-radius: 28px;
  box-shadow: 0 12px 0 #33632e, 0 24px 55px rgba(0,0,0,0.4);
  padding: 20px 28px 18px;
  text-align: center;
  max-width: 760px;
  width: min(94vw, 760px);
  max-height: 96vh;
  overflow-y: auto;
}

.logo-sub { font-size: 12px; letter-spacing: 4px; font-weight: bold; color: #83a56c; }
.logo h1 {
  font-size: clamp(34px, 6vw, 60px); line-height: 1.05; letter-spacing: 2px;
  color: #3f8a3a;
  text-shadow: 0 4px 0 #cbe89b, 0 7px 0 #78a94f, 0 12px 20px rgba(0,0,0,0.18);
  margin: 4px 0 6px;
}
.logo-tag { font-size: 14px; color: #6c845c; margin-bottom: 14px; }
.section-label { font-size: 12px; font-weight: bold; letter-spacing: 3px; color: #8aa472; margin-bottom: 8px; }

.breeds { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; }
.breed {
  border: 3px solid #cbd7ad; border-radius: 14px; background: #fffdf3;
  padding: 9px 6px 8px; cursor: pointer; transition: transform 0.12s, border-color 0.12s;
}
.breed:hover { transform: translateY(-3px); border-color: #8dc466; }
.breed.selected { border-color: #f0a92c; background: #fff5d7; box-shadow: 0 0 0 3px rgba(240,169,44,0.25); }
.breed .dot { width: 34px; height: 34px; border-radius: 50%; margin: 0 auto 5px; border: 2px solid rgba(0,0,0,0.15); }
.breed .bname { font-size: 12px; font-weight: bold; line-height: 1.15; min-height: 28px; }
.breed .bdesc { font-size: 10px; color: #83906f; min-height: 24px; }
.stat { height: 5px; border-radius: 3px; background: #e1e8ce; margin-top: 3px; overflow: hidden; }
.stat i { display: block; height: 100%; background: #6fbb4a; }
.stat.spd i { background: #58a9dd; }
.stat.bark i { background: #ef9d31; }

.controls {
  display: flex; flex-wrap: wrap; justify-content: center; gap: 8px 16px;
  font-size: 12px; color: #6b7f5d; margin: 15px 0;
}
.key {
  display: inline-block; background: #fff; border: 2px solid #9dbb7c;
  border-bottom-width: 4px; border-radius: 7px; padding: 2px 7px;
  font-weight: bold; color: #4a7a3e; margin-right: 3px;
}

.big-btn {
  font-family: inherit; font-size: 18px; font-weight: bold; letter-spacing: 1px;
  color: #fffdf0; background: linear-gradient(180deg, #7ec94e, #4b9c34);
  border: 3px solid #34742a; border-bottom-width: 7px; border-radius: 14px;
  padding: 11px 30px; cursor: pointer; text-shadow: 0 2px 0 #2f6827;
  transition: transform 0.1s, filter 0.1s;
}
.big-btn:hover { filter: brightness(1.08); transform: translateY(-2px); }
.big-btn:active { transform: translateY(3px); border-bottom-width: 3px; }
.big-btn.ghost { background: linear-gradient(180deg, #fdfaf0, #e3d9b8); color: #5e704d; border-color: #9aaf7c; text-shadow: none; }
.foot { font-size: 12px; color: #93a07f; margin-top: 12px; }

.dialog-card { max-width: 500px; width: min(92vw, 500px); padding: 28px 32px; }
#dialogIcon { font-size: 56px; line-height: 1; }
.dialog-card h2 { font-size: 30px; color: #3f8a3a; margin: 8px 0; text-shadow: 0 3px 0 #d3eaa7; }
#dialogText { font-size: 15px; color: #667a56; line-height: 1.5; }
#dialogStats { font-size: 13px; color: #a07434; margin-top: 12px; font-weight: bold; }
.dialog-buttons { display: flex; gap: 12px; justify-content: center; margin-top: 20px; }

@keyframes pulse { from { transform: scale(1); } to { transform: scale(1.12); } }

@media (max-width: 720px) {
  .breeds { grid-template-columns: repeat(3, 1fr); }
  .breed .bdesc { display: none; }
  .hud-top { gap: 6px; }
  .level-panel, .status-panel { min-width: 0; }
  #minimap { width: 130px; height: 130px; }
  .hint-panel { display: none; }
}
