/* =====================================================================
   CANS ONLINE — área de rachas (alumno y familia), estilo Duolingo con colores CANS (26 oct 2026)
   Archivo agregado; lo usa assets/js/views/streaks.js.
   Movimiento reducido: app.css ya acorta todas las animaciones.
   ===================================================================== */
:root {
  --flame: #ff8300;
  --flame-in: #ffc83d;
  --flame-ink: #b35400;
  --ok-ink: #1f7a36;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) { --flame-ink: #ffa94d; --ok-ink: #63d07c; }
}
:root[data-theme="dark"] { --flame-ink: #ffa94d; --ok-ink: #63d07c; }

@keyframes st-rise { from { opacity: 0; transform: translateY(18px); } to { opacity: 1; transform: none; } }
@keyframes st-pop { 0% { opacity: 0; transform: scale(.3); } 70% { opacity: 1; transform: scale(1.12); } 100% { transform: scale(1); } }
@keyframes st-flick { 0%, 100% { transform: scale(1) rotate(-2deg); } 50% { transform: scale(1.06) rotate(2deg); } }
@keyframes st-draw { to { stroke-dashoffset: 0; } }
@keyframes st-spin { to { transform: rotate(360deg); } }
@keyframes st-swap { from { opacity: 0; transform: translateX(14px); } to { opacity: 1; transform: none; } }

.streaks { display: flex; flex-direction: column; gap: 14px; }
.streaks-head h3 { font-size: 18px; font-weight: 800; }
.streak-body.swap { display: flex; flex-direction: column; gap: 14px; animation: st-swap .3s var(--ease) both; }
.streak-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 340px), 1fr)); gap: 16px; align-items: start; }
.rise { animation: st-rise .5s var(--ease) both; animation-delay: calc(var(--i, 0) * 90ms + 60ms); }

/* Selector de hijo (familia) */
.streak-kids { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 200px), 1fr)); gap: 10px; }
.streak-kid { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 16px; border: 2px solid var(--border); border-bottom-width: 5px; background: var(--bg-elev); color: var(--text); cursor: pointer; text-align: left; font: inherit; transition: transform .1s ease-out, border-color .2s, background-color .2s; }
.streak-kid:active { transform: translateY(3px); }
.streak-kid.on { border-color: var(--brand-ring); background: var(--brand-soft); }
.streak-kid .avatar { box-shadow: 0 0 0 3px var(--bg-elev), 0 0 0 5px var(--sec, var(--border-strong)); }
.streak-kid-text { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.streak-kid-text strong { font-size: 16px; font-weight: 800; }
.streak-kid-text small { font-size: 12px; color: var(--text-2); font-weight: 600; }
.streak-kid-count { display: inline-flex; align-items: center; gap: 2px; font-weight: 900; font-size: 18px; color: var(--flame-ink); }

/* Estado de hoy (familia) */
.streak-status { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 16px; font-weight: 700; font-size: 15px; }
.streak-status.pending { background: var(--warn-soft); color: var(--warn); }
.streak-status.pending .dot { fill: var(--flame); }
.streak-status.ok { background: var(--ok-soft); color: var(--ok); }
.streak-status.ok .dot { fill: #1f8a3e; }
.streak-status svg { flex: 0 0 auto; }

/* Tarjeta de racha */
.streak-card { background: var(--bg-elev); border: 2px solid var(--border); border-bottom-width: 5px; border-radius: 22px; padding: 18px; display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.streak-card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.streak-app { display: flex; align-items: center; gap: 10px; min-width: 0; }
.streak-app strong { font-size: 17px; font-weight: 800; }
.streak-app-cover { width: 40px; height: 40px; border-radius: 12px; object-fit: cover; flex: 0 0 auto; }
.streak-pill { font-size: 12.5px; font-weight: 800; padding: 5px 10px; border-radius: 999px; white-space: nowrap; }
.streak-pill.pending { background: var(--warn-soft); color: var(--warn); }
.streak-pill.ok { background: var(--ok-soft); color: var(--ok); }

.streak-main { display: flex; align-items: center; gap: 12px; }
.streak-main-text { display: flex; flex-direction: column; }
.streak-num { font-size: 52px; font-weight: 900; line-height: 1; color: var(--flame-ink); font-variant-numeric: tabular-nums; }
.streak-label { font-size: 17px; font-weight: 800; }
.streak-main-text small { font-size: 13px; color: var(--text-2); font-weight: 600; }

.streak-flame .flame-out { fill: var(--flame); }
.streak-flame .flame-in { fill: var(--flame-in); }
.streak-flame.cold .flame-out { fill: var(--border-strong); }
.streak-flame.cold .flame-in { fill: var(--bg-sunken); }
.streak-flame.big:not(.cold), .cel-flame { transform-origin: 50% 90%; animation: st-flick 1.6s ease-in-out infinite; }

/* Semana */
.streak-week { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; background: var(--bg-sunken); border-radius: 16px; padding: 12px 6px; }
.streak-day { display: flex; flex-direction: column; align-items: center; gap: 6px; font-size: 12px; font-weight: 800; color: var(--text-2); }
.streak-dot { width: 32px; height: 32px; border-radius: 50%; box-sizing: border-box; display: grid; place-items: center; background: var(--border); animation: st-pop .45s var(--ease) both; animation-delay: calc(var(--d, 0) * 70ms + 350ms); }
.streak-dot.done { background: var(--flame); }
.streak-dot.today { background: var(--warn-soft); border: 3px dashed var(--flame); animation: st-pop .45s var(--ease) both, st-spin 6s linear 1s infinite; animation-delay: calc(var(--d, 0) * 70ms + 350ms), 1s; }
.streak-dot.missed { background: var(--border); opacity: .55; }
.streak-dot.rest, .streak-dot.future { background: var(--border); }

/* Botón 3D: se hunde al tocarlo */
.btn3d { display: flex; align-items: center; justify-content: center; min-height: 50px; margin-bottom: 5px; border: 0; border-radius: 16px; background: #0c3292; color: #fff; font: inherit; font-size: 16px; font-weight: 900; letter-spacing: .05em; text-transform: uppercase; text-decoration: none; cursor: pointer; box-shadow: 0 5px 0 #071e5c; transition: transform .1s ease-out, box-shadow .1s ease-out; }
.btn3d:hover { color: #fff; }
.btn3d:active { transform: translateY(5px); box-shadow: 0 0 0 #071e5c; }
.btn3d.orange { background: var(--flame); color: #2b1500; box-shadow: 0 5px 0 #b35400; }
.btn3d.orange:active { box-shadow: 0 0 0 #b35400; }

/* Línea de avance */
.streak-progress { display: flex; flex-direction: column; gap: 6px; }
.streak-progress h4, .streak-recent h4 { font-size: 15px; font-weight: 800; }
.streak-progress svg { width: 100%; height: auto; }
.streak-progress .grid { stroke: var(--border); stroke-width: 2; }
.streak-line { fill: none; stroke: var(--brand-solid); stroke-width: 4; stroke-linecap: round; stroke-linejoin: round; }
.streak-line.draw { stroke-dasharray: 600; stroke-dashoffset: 600; animation: st-draw 1s cubic-bezier(.65, 0, .35, 1) .5s forwards; }
.streak-progress .last { fill: var(--flame); stroke: var(--bg-elev); stroke-width: 3; }
.streak-progress .last.pop { transform-box: fill-box; transform-origin: center; animation: st-pop .4s var(--ease) 1.4s both; }
.streak-status .mark.draw { stroke-dasharray: 30; stroke-dashoffset: 30; animation: st-draw .4s ease-out .2s forwards; }

/* Números del mes y últimos avances */
.streak-stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.streak-stat { border: 2px solid var(--border); border-radius: 14px; padding: 10px; display: flex; flex-direction: column; }
.streak-stat strong { font-size: 21px; font-weight: 900; }
.streak-stat small { font-size: 12px; font-weight: 700; color: var(--text-2); }
.streak-recent { display: flex; flex-direction: column; }
.streak-row { display: flex; align-items: center; gap: 10px; padding: 9px 0; border-top: 2px solid var(--border); }
.streak-row-text { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.streak-row-text strong { font-size: 14.5px; font-weight: 800; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.streak-row-text small { font-size: 12.5px; font-weight: 600; color: var(--text-2); }
.streak-score { font-weight: 900; color: var(--ok-ink); }

.streak-soon { border: 2px dashed var(--border-strong); border-radius: 22px; padding: 16px; display: flex; flex-direction: column; gap: 2px; }
.streak-soon strong { font-weight: 800; }
.streak-soon small { font-size: 13px; color: var(--text-2); font-weight: 600; }

/* ------------------------------------------------------------ festejo de racha cumplida */
@keyframes cel-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes cel-out { to { opacity: 0; } }
@keyframes cel-roll { 0%, 35% { transform: translateY(0); } 100% { transform: translateY(-96px); } }
@keyframes cel-confetti { 0% { opacity: 1; transform: translate(0, 0) rotate(0); } 100% { opacity: 0; transform: translate(var(--dx), var(--dy)) rotate(var(--rot)); } }
@keyframes cel-ring { 0% { box-shadow: 0 0 0 0 rgba(255, 131, 0, .7); } 100% { box-shadow: 0 0 0 16px rgba(255, 131, 0, 0); } }
.cel-overlay { position: fixed; inset: 0; z-index: 2100; background: #0c3292; color: #fff; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 18px; padding: 32px 20px; overflow: hidden; animation: cel-in .25s ease both; }
.cel-overlay.out { animation: cel-out .25s ease both; }
.cel-center { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.cel-flame { animation: st-pop .7s var(--ease) both, st-flick 1.6s ease-in-out .7s infinite; }
.cel-odometer { height: 96px; overflow: hidden; font-size: 96px; font-weight: 900; line-height: 96px; color: #ffb23d; text-align: center; font-variant-numeric: tabular-nums; }
.cel-track { display: flex; flex-direction: column; animation: cel-roll 1.1s cubic-bezier(.65, 0, .35, 1) .4s both; }
.cel-title { font-size: 26px; font-weight: 900; animation: st-rise .5s var(--ease) .6s both; }
.cel-card { width: min(420px, 100%); background: var(--bg-elev); color: var(--text); border-radius: 22px; padding: 16px 12px; display: flex; flex-direction: column; gap: 12px; text-align: center; font-weight: 600; color: var(--text-2); animation: st-rise .5s var(--ease) .6s both; }
.cel-card .streak-week { background: transparent; padding: 0; }
.cel-today { animation: st-pop .6s var(--ease) 1.4s both, cel-ring .7s ease-out 1.5s both; }
.cel-overlay .btn3d { width: min(420px, 100%); animation: st-rise .5s var(--ease) 1s both; }
.cel-confetti { position: absolute; left: 50%; top: 34%; width: 10px; height: 14px; border-radius: 3px; opacity: 0; animation: cel-confetti 1.3s cubic-bezier(.22, 1, .36, 1) both; pointer-events: none; }
@media (prefers-reduced-motion: reduce) {
  .cel-track { transform: translateY(-96px); }
}
