:root {
  --cream: #FFF4E3;
  --cream-dim: #EDE6D6;
  --ink: #5a4632;
  --sage: #6B8E6B;
  --pink: #E8A9B0;
  --wood: #8A5A36;
  --sun: #FFD9A0;
  --card-bg: rgba(255, 244, 227, 0.92);
}

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

html, body {
  width: 100%; height: 100%;
  overflow: hidden;
  background: #f3e7d3;
  font-family: 'Nunito', sans-serif;
  color: var(--ink);
}

#game-container, #game-container canvas {
  position: fixed; inset: 0;
  width: 100%; height: 100%;
  display: block;
}

.hud-card {
  position: fixed;
  background: var(--card-bg);
  border: 2px solid rgba(138, 90, 54, 0.35);
  border-radius: 14px;
  padding: 10px 14px;
  box-shadow: 0 4px 18px rgba(138, 90, 54, 0.18);
  backdrop-filter: blur(3px);
  z-index: 10;
  user-select: none;
}

#hud-logo { top: 14px; left: 14px; max-width: 300px; }
.logo-title {
  font-family: 'Caveat', cursive;
  font-size: 30px; font-weight: 700;
  color: var(--wood);
  line-height: 1;
}
.logo-title .paw { font-size: 24px; }
.logo-sub {
  font-family: 'Caveat', cursive;
  font-size: 17px; color: #8a6f52;
  margin-top: 2px;
}

#hud-level {
  bottom: 14px; left: 50%;
  transform: translateX(-50%);
  font-family: 'Caveat', cursive;
  font-size: 24px; font-weight: 700;
  color: var(--wood);
  padding: 6px 26px;
}

#hud-quest { top: 14px; right: 14px; min-width: 230px; }
.quest-title {
  font-family: 'Caveat', cursive;
  font-size: 24px; font-weight: 700;
  color: var(--wood);
  margin-bottom: 4px;
}
#quest-list { list-style: none; }
.quest-item {
  font-size: 14px; font-weight: 600;
  padding: 2px 0;
  transition: color 0.4s;
}
.quest-item .box { color: var(--sage); font-weight: 800; margin-right: 6px; }
.quest-item.done { color: var(--sage); text-decoration: line-through; }
.quest-item.done .box { color: var(--sage); }
.quest-item.active { color: var(--wood); }

#hud-controls {
  bottom: 14px; left: 14px;
  font-size: 14px; font-weight: 600;
  display: flex; flex-direction: column; gap: 5px;
}

#hud-flavor {
  bottom: 14px; right: 14px;
  font-family: 'Caveat', cursive; font-size: 19px; color: #8a6f52;
}
.key {
  display: inline-block;
  min-width: 26px; text-align: center;
  background: #fff; border: 1.5px solid var(--wood);
  border-bottom-width: 3px; border-radius: 6px;
  padding: 1px 6px; margin-right: 3px;
  font-weight: 800; font-size: 12px; color: var(--wood);
}
.key.wide { padding: 1px 10px; }

#toast {
  position: fixed;
  bottom: 88px; left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: rgba(90, 70, 50, 0.92);
  color: var(--cream);
  font-family: 'Caveat', cursive; font-size: 22px;
  padding: 8px 22px; border-radius: 999px;
  opacity: 0; transition: opacity 0.35s, transform 0.35s;
  z-index: 20; pointer-events: none;
  white-space: nowrap;
}
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
#toast.hidden { opacity: 0; }

#win-screen {
  position: fixed; inset: 0;
  display: flex; align-items: center; justify-content: center;
  background: rgba(90, 70, 50, 0.45);
  z-index: 30;
}
#win-screen.hidden { display: none; }
.win-card {
  background: var(--cream);
  border: 3px solid var(--pink);
  border-radius: 20px;
  padding: 30px 52px; text-align: center;
  box-shadow: 0 12px 48px rgba(0,0,0,0.25);
  animation: winpop 0.5s ease-out;
}
@keyframes winpop {
  from { transform: scale(0.85); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}
.win-title { font-family: 'Caveat', cursive; font-size: 46px; color: var(--wood); }
.win-art { font-size: 40px; margin: 6px 0; }
.win-sub { font-size: 16px; margin-top: 6px; line-height: 1.5; }
.win-hint { margin-top: 14px; font-size: 14px; }

#loading {
  position: fixed; inset: 0;
  display: flex; align-items: center; justify-content: center;
  background: #f3e7d3;
  font-family: 'Caveat', cursive; font-size: 30px; color: var(--wood);
  z-index: 50; transition: opacity 0.5s;
}
#loading.gone { opacity: 0; pointer-events: none; }
