:root {
  --bg: #1a1a2e;
  --device: #2d2d44;
  --screen: #9bbc0f;      /* verde gameboy */
  --screen-dark: #0f380f;
  --accent: #ffd166;
  --bar-bg: rgba(15, 56, 15, 0.25);
}

* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }

html, body {
  height: 100%;
  background: radial-gradient(circle at 50% 30%, #25254a, var(--bg));
  font-family: "Press Start 2P", monospace;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  user-select: none;
  -webkit-user-select: none;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
}

#device {
  width: min(94vw, 380px);
  background: var(--device);
  border-radius: 36px;
  padding: 18px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.5), inset 0 2px 4px rgba(255,255,255,0.06);
  display: flex;
  flex-direction: column;
  gap: 14px;
}

#brand {
  text-align: center;
  letter-spacing: 3px;
  font-size: 12px;
  font-weight: bold;
  color: var(--accent);
  opacity: 0.8;
}

#screen {
  background: var(--screen);
  border-radius: 16px;
  padding: 14px;
  box-shadow: inset 0 0 0 4px #1f2d1f, inset 0 0 24px rgba(15,56,15,0.4);
  color: var(--screen-dark);
  position: relative;
  min-height: 280px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

#weather {
  position: absolute;
  top: 12px;
  right: 14px;
  font-size: 18px;
  opacity: 0.7;
}

#stage {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  min-height: 170px;
}

#churro {
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  width: 160px;
  height: 160px;
  filter: drop-shadow(0 6px 0 rgba(15,56,15,0.2));
}

.bob { animation: bob 2.4s ease-in-out infinite; }
@keyframes bob {
  0%,100% { transform: translateY(0); }
  50% { transform: translateY(-6px); }
}
.wiggle { animation: wiggle 0.5s ease-in-out; }
@keyframes wiggle {
  0%,100% { transform: rotate(0); }
  25% { transform: rotate(-6deg); }
  75% { transform: rotate(6deg); }
}

#zzz {
  position: absolute;
  bottom: 50%;
  right: 20%;
  font-size: 14px;
  letter-spacing: 2px;
  animation: floatUp 2.5s ease-out infinite;
  transform-origin: left bottom;
}
@keyframes floatUp {
  0%   { transform: translate(0, 0) scale(0.5); opacity: 0; }
  15%  { opacity: 1; }
  100% { transform: translate(22px, -50px) scale(1.4); opacity: 0; }
}

#bubble {
  position: absolute;
  top: 4px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--screen-dark);
  color: var(--screen);
  padding: 4px 10px;
  border-radius: 10px;
  font-size: 12px;
  font-weight: bold;
  white-space: nowrap;
  animation: pop 0.3s ease;
}
@keyframes pop {
  from { transform: translateX(-50%) scale(0.6); opacity: 0; }
  to   { transform: translateX(-50%) scale(1); opacity: 1; }
}

#mood {
  text-align: center;
  font-size: 13px;
  font-weight: bold;
  min-height: 16px;
}

#stats { display: flex; flex-direction: column; gap: 7px; }
.stat { display: flex; align-items: center; gap: 8px; }
.stat .icon { font-size: 16px; width: 20px; text-align: center; }
.bar {
  flex: 1;
  height: 12px;
  background: var(--bar-bg);
  border: 2px solid var(--screen-dark);
  border-radius: 7px;
  overflow: hidden;
}
.fill {
  height: 100%;
  width: 100%;
  background: var(--screen-dark);
  transition: width 0.4s ease, background 0.4s ease;
}
.fill.low { background: #b23a2e; }
.fill.mid { background: #c98a1a; }

#buttons {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
}
#buttons button {
  font-family: "Press Start 2P", monospace;
  background: var(--accent);
  border: none;
  border-radius: 14px;
  padding: 10px 4px;
  font-size: 26px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  color: #5a3e00;
  box-shadow: 0 4px 0 #c79b3e;
  transition: transform 0.08s, box-shadow 0.08s;
}
#buttons button small { font-size: 8px; line-height: 1.6; }
#buttons button:active {
  transform: translateY(3px);
  box-shadow: 0 1px 0 #c79b3e;
}
#buttons button:disabled { opacity: 0.45; box-shadow: 0 4px 0 #c79b3e; }

#btn-profile {
  font-family: "Press Start 2P", monospace;
  background: none;
  border: 2px solid rgba(255,255,255,0.12);
  border-radius: 12px;
  padding: 6px 14px;
  font-size: 16px;
  color: rgba(255,255,255,0.45);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 auto;
}
#btn-profile small { font-size: 7px; font-family: "Press Start 2P", monospace; }
#btn-profile:active { opacity: 0.6; }

#profile {
  position: absolute;
  inset: 0;
  background: var(--screen);
  border-radius: 16px;
  padding: 14px;
  color: var(--screen-dark);
  display: flex;
  flex-direction: column;
  gap: 10px;
  z-index: 10;
  animation: slideUp 0.22s ease;
}
@keyframes slideUp {
  from { transform: translateY(8px); opacity: 0; }
  to   { transform: translateY(0);   opacity: 1; }
}
@keyframes slideDown {
  from { transform: translateY(0);   opacity: 1; }
  to   { transform: translateY(8px); opacity: 0; }
}
#profile.closing { animation: slideDown 0.22s ease forwards; }
#profile-close {
  background: none;
  border: none;
  color: var(--screen-dark);
  font-size: 20px;
  cursor: pointer;
  align-self: flex-start;
  padding: 0;
  line-height: 1;
}
#profile-title {
  text-align: center;
  font-size: 14px;
  font-weight: bold;
  letter-spacing: 3px;
  margin-top: 4px;
}
.profile-rows { display: flex; flex-direction: column; gap: 0; flex: 1; justify-content: center; }
.profile-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 10px 0;
  font-size: 8px;
  border-bottom: 1px solid rgba(15,56,15,0.25);
  gap: 8px;
}
.plabel { opacity: 0.55; white-space: nowrap; }

.hidden { display: none !important; }
