/* ════════════════════════════════════════════════════════════════════
   diario.css — la recompensa diaria y su cofre de fuego (js/diario.js)
   El lobby es oscuro siempre (escenario de noche): los colores del cofre
   y de la flama son los del chip de racha del HUD.
   ════════════════════════════════════════════════════════════════════ */

/* ── El cofre del HUD ── */
.lb-diario {
  position: relative; display: inline-flex; align-items: center; gap: 8px;
  padding: 4px 14px 4px 6px; border-radius: 999px; cursor: pointer; font-family: inherit;
  color: #FFD9A8; background: rgba(255, 138, 0, .14); border: 1px solid rgba(255, 138, 0, .4);
  backdrop-filter: blur(8px); transition: background .18s ease, border-color .18s ease, transform .2s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.lb-diario[hidden] { display: none; }
.lb-diario:hover { background: rgba(255, 138, 0, .24); border-color: rgba(255, 179, 92, .7); transform: translateY(-1px); }
.lb-diario:focus-visible { outline: 2px solid #FFB35C; outline-offset: 2px; }
.lb-diario .dr-cofre--hud { width: 38px; height: 38px; margin: -6px 0 -4px; overflow: visible; }
.lb-diario-txt { display: grid; gap: 1px; text-align: left; line-height: 1.05; }
.lb-diario-txt small { font-size: 10px; font-weight: 800; letter-spacing: 1.2px; text-transform: uppercase; color: rgba(255, 217, 168, .75); }
.lb-diario-txt b { font-size: 15px; font-weight: 900; color: #5BE39C; font-variant-numeric: tabular-nums; }
.lb-diario-barra { display: flex; gap: 2px; margin-top: 2px; }
.lb-diario-barra i { width: 6px; height: 4px; border-radius: 2px; background: rgba(255, 255, 255, .18); }
.lb-diario-barra i.is-cobrado { background: #FF8A00; }
.lb-diario-barra i.is-hoy { background: #FFD25C; box-shadow: 0 0 6px #FF8A00; }
.lb-diario-barra i.is-cofre { width: 9px; }
.lb-diario-punto {
  position: absolute; top: -2px; right: -2px; width: 12px; height: 12px; border-radius: 50%;
  background: #FF5A00; border: 2px solid #1A0F2E; box-shadow: 0 0 10px #FF8A00;
}
/* Con algo por cobrar, la flama baila y el cofre brilla. */
.lb-diario.is-listo { box-shadow: 0 0 0 0 rgba(255, 138, 0, .55); animation: dr-latido 2.4s ease-in-out infinite; }
.dr-flama { transform-origin: 60px 78px; }
.dr-cofre { overflow: visible; }
.lb-diario.is-listo .dr-flama, .dr-casilla.is-hoy .dr-flama, .dr-cab .dr-flama, .dr-escena .dr-flama { animation: dr-flama 1.1s ease-in-out infinite alternate; }
@keyframes dr-flama { from { transform: scale(.94, .9); } to { transform: scale(1.04, 1.08) skewX(-2deg); } }
@keyframes dr-latido { 0%, 100% { box-shadow: 0 0 0 0 rgba(255, 138, 0, .5); } 50% { box-shadow: 0 0 0 7px rgba(255, 138, 0, 0); } }

/* El globo de «lo que te espera», al entrar. */
.lb-diario-globo {
  position: absolute; top: calc(100% + 8px); left: 0; z-index: 5; max-width: 240px; padding: 8px 12px; border-radius: 12px;
  font-size: 12.5px; font-weight: 800; color: #FFE6C4; background: rgba(30, 16, 46, .92); border: 1px solid rgba(255, 138, 0, .45);
  box-shadow: 0 8px 22px rgba(0, 0, 0, .35); animation: dr-sube .45s cubic-bezier(0.22, 1, 0.36, 1) both;
}
.lb-diario-globo[hidden] { display: none; }
.lb-diario-globo.is-fuera { opacity: 0; transform: translateY(-4px); transition: opacity .35s ease, transform .35s ease; }
.lb-hud { flex-wrap: nowrap; }

/* El contador de monedas salta al recibir. */
.lb-chip.is-sube { animation: dr-bump .5s cubic-bezier(0.34, 1.56, 0.64, 1); }
@keyframes dr-bump { 40% { transform: scale(1.14); } }

/* ── La hoja ── */
.dr-velo {
  position: fixed; inset: 0; z-index: 2000; display: grid; place-items: center; padding: 20px;
  background: rgba(10, 4, 20, .74); animation: dr-velo .3s ease both;
}
/* Mientras vuelan las monedas, el HUD se ve: el contador sube a la vista. */
.dr-velo.is-volando { background: rgba(10, 4, 20, .3); transition: background .3s ease; }
.dr-velo.is-cerrando { animation: dr-velo .3s ease reverse both; }
.dr-velo.is-cerrando .dr-hoja { animation: dr-sale .3s cubic-bezier(0.55, 0, 0.85, 0.4) both; }
@keyframes dr-velo { from { opacity: 0; } }
@keyframes dr-sale { to { opacity: 0; transform: translateY(16px) scale(.97); } }
.dr-hoja {
  position: relative; width: min(560px, 100%); padding: 22px; border-radius: 26px; overflow: hidden;
  color: #F6EEFF; background: radial-gradient(120% 70% at 50% 0%, rgba(255, 138, 0, .22), transparent 60%), linear-gradient(180deg, #2A1748, #1A0F2E);
  border: 1px solid rgba(255, 138, 0, .35); box-shadow: 0 30px 70px rgba(0, 0, 0, .5);
  animation: dr-entra .5s cubic-bezier(0.22, 1, 0.36, 1) both;
}
@keyframes dr-entra { from { opacity: 0; transform: translateY(24px) scale(.96); } }
@keyframes dr-sube { from { opacity: 0; transform: translateY(8px); } }
.dr-cab { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; }
.dr-cab h2 { margin: 0; font-size: 22px; font-weight: 900; letter-spacing: .2px; }
.dr-cab p { margin: 3px 0 0; font-size: 13px; color: rgba(246, 238, 255, .7); }
.dr-cab > div { flex: 1; min-width: 0; }
.dr-x { align-self: flex-start; width: 38px; height: 38px; border-radius: 50%; border: 1px solid rgba(255, 255, 255, .16); background: rgba(255, 255, 255, .06); color: #fff; font-size: 16px; cursor: pointer; }
.dr-x:hover { background: rgba(255, 255, 255, .14); }

.dr-casillas { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.dr-casilla {
  position: relative; display: grid; justify-items: center; align-content: center; gap: 4px; min-height: 112px; padding: 10px 6px;
  border-radius: 16px; background: rgba(255, 255, 255, .06); border: 1px solid rgba(255, 255, 255, .1);
  animation: dr-sube .45s cubic-bezier(0.22, 1, 0.36, 1) both;
}
.dr-casilla:nth-child(2) { animation-delay: .05s; } .dr-casilla:nth-child(3) { animation-delay: .1s; }
.dr-casilla:nth-child(4) { animation-delay: .15s; } .dr-casilla:nth-child(5) { animation-delay: .2s; }
.dr-casilla:nth-child(6) { animation-delay: .25s; } .dr-casilla:nth-child(7) { animation-delay: .3s; }
.dr-dia { font-size: 11px; font-weight: 900; letter-spacing: 1.2px; text-transform: uppercase; color: rgba(246, 238, 255, .7); }
/* Las monedas son VERDES, como en el HUD; el dorado y el naranja son de la
   racha (el cofre y su fuego): «la racha te da monedas». */
.dr-moneda { font-size: 34px; color: #5BE39C; filter: drop-shadow(0 3px 6px rgba(0, 0, 0, .3)); }
.dr-cuanto { display: block; text-align: center; line-height: 1.15; font-size: 15px; font-weight: 900; font-variant-numeric: tabular-nums; }
.dr-cuanto i { color: #5BE39C; font-size: 14px; }
.dr-quiza { font-size: 11px; font-weight: 700; color: rgba(255, 217, 168, .8); }
.dr-casilla.is-cobrado { opacity: .55; }
.dr-casilla.is-cobrado .dr-moneda, .dr-casilla.is-cobrado .dr-cofre { filter: grayscale(.5); }
.dr-palomita {
  position: absolute; top: -7px; right: -7px; width: 22px; height: 22px; border: 2px solid #1A0F2E; border-radius: 50%; display: grid; place-items: center;
  font-size: 12px; color: #0E2A1A; background: #5BE39C;
}
.dr-casilla.is-cobrado .dr-palomita { opacity: 1; }
.dr-casilla.is-futuro { opacity: .7; }
.dr-casilla.is-futuro .dr-moneda { color: rgba(91, 227, 156, .5); }
/* Hoy: resaltada y con su fuego. */
.dr-casilla.is-hoy {
  background: linear-gradient(180deg, rgba(255, 138, 0, .3), rgba(255, 90, 0, .12)); border-color: #FF8A00;
  box-shadow: 0 0 0 1px rgba(255, 179, 92, .5), 0 0 26px rgba(255, 138, 0, .45); transform: translateY(-3px);
}
.dr-casilla.is-hoy { padding-top: 18px; }
.dr-casilla.is-hoy .dr-dia { color: #FFD9A8; }
.dr-fuego {
  position: absolute; top: -12px; left: 50%; transform: translateX(-50%); width: 26px; height: 26px; border-radius: 50%;
  display: grid; place-items: center; font-size: 15px; color: #fff; background: linear-gradient(180deg, #FFB300, #FF5A00);
  box-shadow: 0 0 14px #FF8A00; animation: dr-flama-chica 1s ease-in-out infinite alternate;
}
@keyframes dr-flama-chica { to { box-shadow: 0 0 22px #FF5A00; } }
.dr-casilla.is-cobrando { animation: dr-cobra .6s cubic-bezier(0.34, 1.56, 0.64, 1); }
@keyframes dr-cobra { 40% { transform: scale(1.12); } }
/* El día 7: el cofre de fuego, a lo ancho. */
.dr-casilla--cofre {
  grid-column: span 2; background: radial-gradient(90% 90% at 50% 70%, rgba(255, 90, 0, .28), rgba(255, 255, 255, .04));
  border-color: rgba(255, 138, 0, .5);
}
.dr-casilla--cofre .dr-cofre--casilla { width: 74px; height: 74px; overflow: visible; }
.dr-casilla--cofre .dr-cuanto { color: #FFB35C; }

.dr-pie { display: flex; flex-direction: column; align-items: center; gap: 10px; margin-top: 18px; text-align: center; }
.dr-pie-t:empty { display: none; }
.dr-pie-t { font-size: 13.5px; font-weight: 800; color: #FFD9A8; }
.dr-cobrar {
  display: inline-flex; align-items: center; gap: 8px; min-height: 50px; padding: 0 26px; border: 0; border-radius: 999px; cursor: pointer;
  font-family: inherit; font-size: 17px; font-weight: 900; letter-spacing: .6px; color: #2A1300;
  background: linear-gradient(180deg, #FFC24D, #FF8A00); box-shadow: 0 8px 22px rgba(255, 138, 0, .45), inset 0 -3px 0 rgba(0, 0, 0, .15);
  transition: transform .2s cubic-bezier(0.34, 1.56, 0.64, 1), filter .2s ease;
}
.dr-cobrar:hover:not(:disabled) { transform: translateY(-2px); filter: brightness(1.05); }
.dr-cobrar:disabled { cursor: default; color: rgba(246, 238, 255, .75); background: rgba(255, 255, 255, .08); box-shadow: none; font-size: 14px; }
.dr-demo { margin: 12px 0 0; font-size: 12px; color: #FFE27A; }

/* Las monedas que vuelan al HUD. */
.dr-vuela { position: fixed; top: 0; left: 0; z-index: 2100; font-size: 24px; color: #5BE39C; pointer-events: none; filter: drop-shadow(0 2px 6px rgba(34, 197, 94, .7)); }

/* ── La apertura del cofre (día 7) ── */
.dr-escena {
  position: absolute; inset: 0; z-index: 2; display: grid; place-items: center; align-content: center; gap: 10px; padding: 20px; text-align: center;
  background: radial-gradient(70% 55% at 50% 40%, rgba(255, 110, 0, .42), transparent 70%), #1A0F2E;
  animation: dr-velo .35s ease both;
}
.dr-escena[hidden] { display: none; }
.dr-escena-cofre { position: relative; width: 180px; height: 180px; }
@media (max-width: 899px) { .dr-escena-cofre { width: 150px; height: 150px; } }
.dr-cofre--grande { width: 100%; height: 100%; overflow: visible; }
.dr-cofre--grande .dr-tapa { transform-origin: 16px 60px; transition: transform .6s cubic-bezier(0.34, 1.56, 0.64, 1); }
.dr-escena.is-temblando .dr-escena-cofre { animation: dr-tiembla .12s linear infinite; }
@keyframes dr-tiembla { 0% { transform: rotate(-3deg); } 50% { transform: rotate(3deg) translateY(-2px); } 100% { transform: rotate(-3deg); } }
.dr-escena .dr-flama { transform-origin: 60px 78px; }
.dr-escena.is-abierto .dr-tapa { transform: translate(-6px, -14px) rotate(-28deg); }
.dr-escena.is-abierto .dr-flama { animation: dr-estalla .7s cubic-bezier(0.22, 1, 0.36, 1) both, dr-flama 1.1s .7s ease-in-out infinite alternate; }
@keyframes dr-estalla { 0% { transform: scale(.6); } 60% { transform: scale(1.5, 1.7); } 100% { transform: scale(1.1, 1.2); } }
.dr-chispas { position: absolute; left: 50%; top: 40%; }
.dr-chispas i { position: absolute; width: 8px; height: 8px; border-radius: 50%; background: #FFD25C; box-shadow: 0 0 10px #FF8A00; opacity: 0; }
.dr-escena.is-abierto .dr-chispas i { animation: dr-chispa .9s cubic-bezier(0.22, 1, 0.36, 1) both; }
.dr-chispas i:nth-child(1) { --x: -90px; --y: -70px; } .dr-chispas i:nth-child(2) { --x: 90px; --y: -60px; }
.dr-chispas i:nth-child(3) { --x: -60px; --y: -110px; } .dr-chispas i:nth-child(4) { --x: 60px; --y: -115px; }
.dr-chispas i:nth-child(5) { --x: 0; --y: -130px; } .dr-chispas i:nth-child(6) { --x: -110px; --y: -20px; }
.dr-chispas i:nth-child(7) { --x: 110px; --y: -25px; } .dr-chispas i:nth-child(8) { --x: -30px; --y: -90px; }
.dr-chispas i:nth-child(9) { --x: 30px; --y: -95px; } .dr-chispas i:nth-child(10) { --x: -80px; --y: 10px; }
.dr-chispas i:nth-child(11) { --x: 80px; --y: 5px; } .dr-chispas i:nth-child(12) { --x: 10px; --y: -60px; }
.dr-chispas i:nth-child(even) { animation-delay: .08s; background: #FF8A00; }
@keyframes dr-chispa { 0% { opacity: 1; transform: translate(0, 0) scale(1.2); } 100% { opacity: 0; transform: translate(var(--x), var(--y)) scale(.3); } }
.dr-premio { display: grid; justify-items: center; gap: 10px; opacity: 0; transform: translateY(12px); }
.dr-escena.is-abierto .dr-premio { opacity: 1; transform: none; transition: opacity .45s .35s ease, transform .5s .35s cubic-bezier(0.22, 1, 0.36, 1); }
.dr-premio-n { display: inline-flex; align-items: center; gap: 8px; font-size: 30px; font-weight: 900; color: #5BE39C; text-shadow: 0 2px 14px rgba(34, 197, 94, .55); }
.dr-premio-prenda { display: grid; justify-items: center; gap: 6px; }
.dr-premio-prenda p { margin: 0; font-size: 15px; font-weight: 800; }
.dr-premio-pio { width: 110px; height: 110px; }
.dr-vestir, .dr-seguir {
  display: inline-flex; align-items: center; gap: 6px; min-height: 42px; padding: 0 18px; border-radius: 999px; font-family: inherit;
  font-size: 14px; font-weight: 900; text-decoration: none; cursor: pointer;
}
.dr-vestir { color: #fff; background: rgba(139, 92, 246, .3); border: 1px solid rgba(196, 166, 255, .55); }
.dr-seguir { color: #2A1300; border: 0; background: linear-gradient(180deg, #FFC24D, #FF8A00); }

/* ── El teléfono: el cofre en la esquina izquierda del HUD, la hoja sube ── */
@media (max-width: 899px) {
  .lb-hud { left: 12px; }
  .lb-hud .lb-chip { white-space: nowrap; }
  .lb-diario { margin-right: auto; padding: 3px 10px 3px 4px; gap: 5px; }
  .lb-diario .dr-cofre--hud { width: 32px; height: 32px; }
  .lb-diario-txt small { font-size: 9px; letter-spacing: .8px; }
  .lb-diario-txt b { font-size: 13px; }
  .lb-diario-barra i { width: 4px; }
  .lb-diario-barra i.is-cofre { width: 6px; }
  .lb-diario-globo { top: calc(100% + 6px); max-width: 200px; font-size: 12px; }
  .dr-velo { place-items: end stretch; padding: 0; }
  .dr-hoja {
    width: 100%; max-height: 92svh; overflow-y: auto; padding: 18px 14px calc(18px + env(safe-area-inset-bottom));
    border-radius: 24px 24px 0 0; border-bottom: 0; animation-name: dr-sube-hoja;
  }
  .dr-velo.is-cerrando .dr-hoja { animation-name: dr-baja-hoja; }
  .dr-cab h2 { font-size: 19px; }
  .dr-casillas { gap: 8px; }
  .dr-casilla { min-height: 96px; padding: 8px 4px; border-radius: 14px; }
  .dr-moneda { font-size: 28px; }
  .dr-cuanto { font-size: 13px; }
  .dr-casilla--cofre .dr-cofre--casilla { width: 60px; height: 60px; }
  .dr-pie { flex-direction: column; align-items: stretch; text-align: center; gap: 10px; }
  .dr-cobrar { justify-content: center; }
}
@keyframes dr-sube-hoja { from { transform: translateY(100%); } }
@keyframes dr-baja-hoja { to { transform: translateY(100%); } }
@media (max-width: 380px) {
  .lb-diario-txt small { display: none; }
  .dr-casilla { min-height: 88px; }
  .dr-dia { font-size: 10px; letter-spacing: .6px; }
}

@media (prefers-reduced-motion: reduce) {
  .lb-diario, .lb-diario.is-listo, .dr-flama, .dr-velo, .dr-velo.is-cerrando, .dr-hoja, .dr-casilla, .dr-fuego,
  .dr-escena, .dr-escena .dr-flama, .dr-escena-cofre, .dr-chispas i, .lb-chip.is-sube, .lb-diario-globo { animation: none !important; transition: none !important; }
  .dr-escena.is-abierto .dr-premio { opacity: 1; transform: none; }
  .dr-escena.is-abierto .dr-tapa { transform: translate(-6px, -14px) rotate(-28deg); }
}
