:root {
  --gold: #ffd25e;
  --ink: #26303b;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: #b9e5f6;
  color: #fff;
  font-family: "Segoe UI", "Trebuchet MS", system-ui, sans-serif;
}

#game-canvas {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  display: block;
}

#overlay-root {
  position: fixed;
  inset: 0;
  pointer-events: none;
}

.overlay-section {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.overlay-section.hidden {
  display: none;
}

.start-header {
  position: absolute;
  top: 4vh;
  left: 0;
  right: 0;
  text-align: center;
}

.game-title {
  margin: 0;
  font-size: clamp(2.2rem, 6vw, 4.5rem);
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  text-shadow: 0 3px 0 rgba(38, 48, 59, 0.35), 0 8px 24px rgba(38, 48, 59, 0.35);
}

.start-subtitle {
  margin: 0.6rem 0 0;
  font-size: clamp(1rem, 2.2vw, 1.4rem);
  font-weight: 600;
  text-shadow: 0 2px 8px rgba(38, 48, 59, 0.45);
}

.dog-cards {
  position: absolute;
  inset: 0;
  display: flex;
}

.dog-card {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  gap: 0.2rem;
  padding: 0 2rem calc(14vh + 4.5rem);
  border: none;
  background: transparent;
  color: #fff;
  font: inherit;
  cursor: pointer;
  pointer-events: auto;
  transition: background 150ms ease;
}

.dog-card:hover {
  background: linear-gradient(to top, rgba(255, 255, 255, 0.12), transparent 45%);
}

.dog-card.selected {
  background: linear-gradient(to top, rgba(255, 210, 94, 0.28), transparent 55%);
  box-shadow: inset 0 0 0 4px rgba(255, 210, 94, 0.9);
}

.dog-tagline {
  font-size: 1rem;
  font-weight: 600;
  opacity: 0.85;
  text-shadow: 0 2px 6px rgba(38, 48, 59, 0.5);
}

.dog-name {
  font-size: clamp(1.6rem, 3.4vw, 2.4rem);
  font-weight: 800;
  text-shadow: 0 2px 0 rgba(38, 48, 59, 0.35), 0 6px 18px rgba(38, 48, 59, 0.4);
}

.dog-card.selected .dog-name {
  color: var(--gold);
}

.start-bar {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 4.5vh;
  display: flex;
  justify-content: center;
  pointer-events: none;
}

#start-button {
  pointer-events: auto;
  border: none;
  border-radius: 999px;
  padding: 0.9rem 3rem;
  background: var(--gold);
  color: var(--ink);
  font-size: 1.3rem;
  font-weight: 800;
  letter-spacing: 0.02em;
  cursor: pointer;
  box-shadow: 0 6px 0 #d9a83c, 0 12px 24px rgba(38, 48, 59, 0.35);
  transition: transform 120ms ease, box-shadow 120ms ease;
}

#start-button:hover {
  transform: translateY(-2px);
}

#start-button:active {
  transform: translateY(2px);
  box-shadow: 0 2px 0 #d9a83c, 0 6px 14px rgba(38, 48, 59, 0.3);
}

.hud-strip {
  position: relative;
  top: 0;
  left: 0;
  right: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.8rem 1.4rem;
  background: rgba(38, 48, 59, 0.55);
}

.hud-dog-name {
  font-size: 1.25rem;
  font-weight: 800;
  letter-spacing: 0.03em;
}

#back-to-start {
  pointer-events: auto;
  border: 2px solid rgba(255, 255, 255, 0.85);
  border-radius: 999px;
  padding: 0.5rem 1.4rem;
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  transition: background 120ms ease;
}

#back-to-start:hover {
  background: rgba(255, 255, 255, 0.28);
}

#fps-counter {
  position: absolute;
  top: calc(100% + 0.5rem);
  right: 1.4rem;
  padding: 0.45rem 0.9rem;
  border-radius: 999px;
  background: rgba(38, 48, 59, 0.55);
  color: #fff;
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  pointer-events: none;
  white-space: nowrap;
}

#lock-hint {
  position: absolute;
  bottom: 4.5vh;
  left: 17.5rem;
  right: 1.4rem;
  margin: 0 auto;
  width: fit-content;
  padding: 0.5rem 1.2rem;
  border-radius: 999px;
  background: rgba(38, 48, 59, 0.55);
  font-weight: 600;
  letter-spacing: 0.02em;
  pointer-events: none;
  white-space: nowrap;
}

#lock-hint.hidden {
  display: none;
}

#greet-prompt {
  position: absolute;
  bottom: 13vh;
  left: 50%;
  transform: translateX(-50%);
  padding: 0.5rem 1.3rem;
  border-radius: 999px;
  background: rgba(255, 210, 94, 0.94);
  color: var(--ink);
  font-weight: 800;
  letter-spacing: 0.02em;
  box-shadow: 0 4px 12px rgba(38, 48, 59, 0.35);
  pointer-events: none;
  white-space: nowrap;
}

#greet-prompt.hidden {
  display: none;
}

#energy-meter,
#mood-meter {
  position: absolute;
  left: 1.4rem;
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.45rem 0.9rem;
  border-radius: 999px;
  background: rgba(38, 48, 59, 0.55);
  pointer-events: none;
}

#energy-meter {
  bottom: 3.9rem;
}

#mood-meter {
  bottom: 1.6rem;
}

.meter-label {
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.meter-track {
  display: block;
  width: 150px;
  height: 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.18);
  overflow: hidden;
}

#mood-fill {
  display: block;
  width: 55%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #ffd25e, #ffb347);
  transition: width 180ms ease;
}

#energy-fill {
  display: block;
  width: 90%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #6ec6ff, #4a90d9);
  transition: width 180ms ease;
}

#charge-bar {
  position: absolute;
  left: 50%;
  top: 56%;
  transform: translateX(-50%);
  width: 170px;
  height: 9px;
  padding: 2px;
  border-radius: 999px;
  background: rgba(38, 48, 59, 0.55);
  pointer-events: none;
}

#charge-bar.hidden {
  display: none;
}

#charge-fill {
  display: block;
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #ffd25e, #ff8a3c);
}

#bark-bubble {
  position: absolute;
  left: 0;
  top: 0;
  padding: 0.35rem 0.85rem;
  border-radius: 14px;
  background: #fff;
  color: var(--ink);
  font-size: 1.15rem;
  font-weight: 800;
  letter-spacing: 0.02em;
  box-shadow: 0 4px 12px rgba(38, 48, 59, 0.35);
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, -135%) scale(0.4);
}

#bark-bubble::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: -7px;
  width: 12px;
  height: 12px;
  background: #fff;
  transform: translateX(-50%) rotate(45deg);
}

#bark-bubble.pop {
  animation: bark-pop 0.55s ease-out forwards;
}

@keyframes bark-pop {
  0% {
    opacity: 0;
    transform: translate(-50%, -135%) scale(0.4);
  }
  15% {
    opacity: 1;
    transform: translate(-50%, -135%) scale(1.15);
  }
  30% {
    opacity: 1;
    transform: translate(-50%, -135%) scale(1);
  }
  75% {
    opacity: 1;
    transform: translate(-50%, -145%) scale(1);
  }
  100% {
    opacity: 0;
    transform: translate(-50%, -160%) scale(1);
  }
}
