/* ─── Result panel (explicaciones / victoria / derrota) ─── */
/* Base = mobile: ancho fluido, altura automática */
#result-panel {
  display: none;
  position: fixed;
  left: 50%;
  bottom: 8px;
  transform: translate(-50%, 60px);
  opacity: 0;
  width: calc(100vw - 16px);
  max-width: 608px;
  height: auto;
  min-height: 80px;
  z-index: 400;
  pointer-events: none;
  transition: transform .4s cubic-bezier(.34, 1.56, .64, 1), opacity .25s ease;
  background-image: url('../assets/SproutLands-UI/Sprite sheets/Dialouge UI/Premade dialog box  big.png');
  background-size: 100% 100%;
  background-repeat: no-repeat;
  image-rendering: pixelated;
}
#result-panel.visible {
  display: block;
  transform: translate(-50%, 0);
  opacity: 1;
  pointer-events: auto;
}

/* ─── Minimizar / expandir ─── */
.result-minimize {
  position: absolute;
  top: 8px;
  right: 12px;
  width: 24px;
  height: 24px;
  background-color: rgba(255, 255, 255, .35);
  border: 1px solid rgba(90, 58, 26, .4);
  border-radius: 4px;
  cursor: pointer;
  font-family: 'SproutPixel', monospace;
  font-size: 14px;
  line-height: 1;
  color: var(--sprout-dark);
  padding: 0;
  z-index: 10;
  transition: background-color .15s ease, transform .1s ease;
}
.result-minimize:hover {
  background-color: rgba(255, 235, 180, .65);
}
.result-minimize:active {
  transform: translateY(1px) scale(.97);
}

#result-panel.minimized {
  width: auto;
  min-width: 0;
  height: auto;
  min-height: 0;
  background: none;
  border-radius: 0;
  left: auto;
  right: 12px;
  bottom: 12px;
  transform: none;
}
#result-panel.minimized .result-portrait,
#result-panel.minimized .result-bubble,
#result-panel.minimized #path-buttons {
  display: none !important;
}
#result-panel.minimized .result-minimize {
  position: static;
  width: auto;
  min-width: 32px;
  padding: 8px 12px;
  background-color: rgba(62, 39, 17, .85);
  color: white;
  box-shadow: 0 4px 12px rgba(0,0,0,0.5);
}

/* ─── Portrait (emote animado) ─── */
/* Base = mobile compact portrait */
/* Spritesheet Teemo: 160×480, frames 32×32. Escala ×1.5 → 240×720, frames 48×48. */
.result-portrait {
  position: absolute;
  top: 16px;
  left: 12px;
  width: 48px;
  height: 48px;
  background-image: url('../assets/SproutLands-UI/Sprite sheets/Dialouge UI/Emotes/Teemo Basic emote animations sprite sheet.png');
  background-size: 240px 720px;
  background-repeat: no-repeat;
  background-position: 0 0;
  image-rendering: pixelated;
}

/* Neutral (idle) — frame fijo, sin animacion. */
.result-portrait.idle {
  background-position: 0 0;
}

/* Animacion feliz: cicla 2 frames (col 0 y col 1 de la fila 0). */
/* Base = mobile: frames 48px (background-size 240×720, escala ×1.5) */
@keyframes result-happy {
  0%, 49%   { background-position: 0 0; }
  50%, 100% { background-position: -48px 0; }
}
.result-portrait.win {
  animation: result-happy 0.9s steps(1, end) infinite;
}

/* Animacion triste: 2 frames con lagrima (fila 5, ×1.5 escala → y=-240). */
@keyframes result-sad {
  0%, 49%   { background-position: 0 -240px; }
  50%, 100% { background-position: -48px -240px; }
}
.result-portrait.lose {
  animation: result-sad 1.1s steps(1, end) infinite;
}

/* ─── Bubble (mensaje + botones) ─── */
/* Base = mobile compact */
.result-bubble {
  position: absolute;
  top: 16px;
  left: 72px;
  right: 16px;
  bottom: 16px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 6px;
  padding: 4px 8px;
}

.result-message {
  font-family: 'SproutPixel', monospace;
  font-size: 12px;
  line-height: 1.25;
  color: var(--sprout-dark);
  text-shadow: 0 1px 0 rgba(255, 255, 255, .35);
  text-align: left;
}
.result-message.win  { color: #2e6032; }
.result-message.lose { color: #8c2a2a; }

.result-actions {
  display: flex;
  gap: 8px;
  align-self: flex-start;
}
.result-actions:empty { display: none; }
.result-actions button {
  background-color: rgba(255, 255, 255, .3);
  border: 1px solid rgba(90, 58, 26, .4);
  cursor: pointer;
  font-family: 'SproutPixel', monospace;
  font-size: 10px;
  color: var(--sprout-dark);
  padding: 3px 8px;
  border-radius: 4px;
  transition: background-color .15s ease, transform .1s ease, filter .15s ease;
}
.result-actions button:hover {
  background-color: rgba(255, 235, 180, .65);
  filter: brightness(1.08);
}
.result-actions button:active {
  transform: translateY(1px) scale(.97);
}

/* ─── Tablet+ (≥768px): tamaño fijo original ─── */
@media (min-width: 768px) {
  #result-panel {
    width: 608px;
    height: 128px;
    min-height: auto;
    background-size: 608px 128px;
    bottom: 20px;
  }
  .result-portrait {
    top: 32px;
    left: 32px;
    width: 64px;
    height: 64px;
    background-size: 320px 960px;
  }
  .result-bubble {
    top: 24px;
    left: 116px;
    right: 44px;
    bottom: 24px;
    padding: 6px 16px;
    gap: 10px;
  }
  .result-message {
    font-size: 15px;
  }
  .result-actions button {
    font-size: 11px;
    padding: 4px 12px;
  }
  /* Desktop: frames 64px (background-size 320×960, escala ×2) */
  @keyframes result-happy {
    0%, 49%   { background-position: 0 0; }
    50%, 100% { background-position: -64px 0; }
  }
  @keyframes result-sad {
    0%, 49%   { background-position: 0 -320px; }
    50%, 100% { background-position: -64px -320px; }
  }
}