
/* ============================================================
   ANGY DAYS — CSS COMPLETO DOCUMENTADO
   Archivo: styles.css

   GUIA RAPIDA PARA CAMBIAR TAMANOS DE ICONOS:
   Inicio:              .habit-chip img
   Formulario:          .form-habit img
   Calendario:          .calendar-cell .mini-art
   Menu inferior:       .bottom-nav img
   Historial:           .selected-habit-icon
   Estadisticas:        .stat-card img

   IMPORTANTE:
   - Esta hoja conserva las reglas de la version web entregada.
   - Hay ajustes responsive al final del archivo.
   - Si un selector se repite, la ultima regla aplicable prevalece.
   ============================================================ */

/* 01. FUENTES TIPOGRAFICAS */
@import url('https://fonts.googleapis.com/css2?family=DM+Sans:wght@400;500;600;700&family=Playfair+Display:wght@500;600;700&display=swap');

/* 02. PALETA DE COLORES Y VARIABLES GLOBALES */
:root{--lilac:#b99bdc;--lilac-deep:#8d6ab5;--lilac-soft:#eee5f8;--pink:#e9bfd6;--gold:#c8a75a;--ink:#463c50;--muted:#887d91;--paper:#fcfaff;--line:#eee6f2;--shadow:0 16px 45px rgba(109,78,135,.11)}

/* 03. RESETEO, CUERPO Y CONTENEDOR GENERAL */
*{box-sizing:border-box}
html{scroll-behavior:smooth}
body{margin:0;min-height:100vh;background:linear-gradient(145deg,#fbf8ff 0%,#f4edfb 52%,#fff9fc 100%);color:var(--ink);font-family:'DM Sans',sans-serif;overflow-x:hidden}
button,input,textarea,select{font:inherit}
button{cursor:pointer}
#app{position:relative;z-index:2;width:100%;max-width:540px;min-height:100vh;margin:auto;padding:20px 20px 24px}
.screen{min-height:calc(100vh - 120px);animation:appear .42s ease both}
.app-screen:not(#dayform){padding-bottom:calc(112px + env(safe-area-inset-bottom))}
.hidden{display:none!important}

/* 04. ANIMACION DE ENTRADA */
@keyframes appear{from{opacity:0;transform:translateY(9px)}to{opacity:1;transform:none}}

/* 05. BRILLOS AMBIENTALES Y PETALOS */
.ambient{position:fixed;border-radius:50%;filter:blur(70px);pointer-events:none;opacity:.45}
.ambient-a{width:250px;height:250px;background:#e5d4f6;top:-80px;left:-90px}
.ambient-b{width:220px;height:220px;background:#f8dfe9;right:-100px;bottom:8%}
#petals{position:fixed;inset:0;overflow:hidden;pointer-events:none;z-index:1}
#petals i{position:absolute;top:-35px;width:9px;height:13px;border-radius:80% 15% 80% 15%;background:linear-gradient(135deg,#fff,#e6c7e9 65%,#c7a6d9);opacity:.55;animation:fall linear infinite;filter:drop-shadow(0 2px 3px #b69ac633)}
@keyframes fall{to{transform:translate3d(40px,110vh,0) rotate(440deg)}}

/* 06. BIENVENIDA, LOGOTIPO Y BOTON PRINCIPAL */
.welcome-screen{min-height:calc(100svh - 40px);display:flex;align-items:center;justify-content:center;flex-direction:column;text-align:center;padding:20px 12px 30px;position:relative}
.welcome-top{position:absolute;top:20px;left:0;right:0;display:flex;justify-content:space-between;color:#a58bbd;font-size:10px;letter-spacing:.22em}
.gold-spark{color:var(--gold);font-size:25px}
.welcome-art{width:min(76vw,320px);height:min(76vw,320px);position:relative;display:grid;place-items:center;margin:28px 0 5px}
.halo{position:absolute;inset:8%;border-radius:50%;background:radial-gradient(circle,#fff 0%,#f4ebfb 56%,#e7d8f2 100%);box-shadow:inset 0 0 35px #fff,0 20px 55px #c9b0dd35}
.halo:after{content:"";position:absolute;inset:8%;border:1px solid #d8bd83;border-radius:50%;opacity:.5}
.welcome-logo{position:relative;width:61%;height:80%;object-fit:contain;mix-blend-mode:multiply;filter:drop-shadow(0 8px 8px #b69b6530);animation:logoFloat 5s ease-in-out infinite}
@keyframes logoFloat{50%{transform:translateY(-7px)}}
.welcome-brand{font-family:'Playfair Display',serif;font-size:clamp(42px,12vw,58px);letter-spacing:-.04em;color:#72568d}
.welcome-brand em,.brand-name em{font-style:normal;color:var(--gold);font-weight:500;margin-left:8px}
.welcome-line{font-family:'Playfair Display',serif;font-size:clamp(21px,6vw,27px);line-height:1.35;margin:15px 0 8px;color:#574866}
.welcome-sub{font-size:13px;color:#96889e;margin:0 0 30px}
.primary-btn{border:0;border-radius:18px;padding:16px 22px;background:linear-gradient(115deg,#a987cb,#8867ae);color:white;font-weight:700;box-shadow:0 10px 22px #a98acb55;transition:.2s;letter-spacing:.01em}
.primary-btn:hover{transform:translateY(-2px);box-shadow:0 14px 26px #a98acb66}
.primary-btn span{margin-left:12px;color:#f7e6b8}
.welcome-cta{min-width:240px}
.welcome-foot{position:absolute;bottom:10px;font-size:9px;letter-spacing:.18em;color:#aa96bb}
.welcome-foot span{color:var(--gold);margin:0 7px}

/* 07. LOGIN Y CAMPOS DE ACCESO */
.auth-screen{padding:15px 8px 40px;max-width:420px;margin:auto}
.back-link{border:0;background:none;color:#8c70a9;padding:8px 0;font-weight:600}
.auth-brand{display:flex;align-items:center;gap:12px;justify-content:center;margin:30px 0 35px}
.auth-brand img{width:62px;height:62px;object-fit:contain}
.brand-name{font-family:'Playfair Display',serif;font-size:26px;color:#73578d}
.eyebrow,.tiny-caps{font-size:10px;letter-spacing:.17em;color:#a58ab9;font-weight:700}
.auth-screen h1,.page-header h1{font-family:'Playfair Display',serif;font-size:34px;font-weight:600;margin:9px 0}
.muted{color:var(--muted);font-size:13px;line-height:1.6}
.auth-form{margin-top:28px;display:grid;gap:17px}
.auth-form label,.form-card label{display:grid;gap:8px;font-size:13px;font-weight:700;color:#655671}
.auth-form input,.form-card input,.form-card textarea,.form-card select{width:100%;border:1px solid #e8deef;border-radius:14px;padding:14px;background:#fffdfd;color:var(--ink);outline:none;transition:.2s}
.auth-form input:focus,.form-card input:focus,.form-card textarea:focus,.form-card select:focus{border-color:#b99bdc;box-shadow:0 0 0 3px #b99bdc24}
.password-wrap{position:relative}
.password-wrap input{padding-right:55px}
.password-wrap button{position:absolute;right:8px;top:6px;border:0;background:#f2eaf8;border-radius:10px;padding:8px;color:#8569a0}
.full{width:100%}
.auth-foot{text-align:center;color:#8d7e99;font-size:12px;margin-top:23px}
.tiny-note{font-size:10px;color:#a89eae;text-align:center;line-height:1.5}

/* 08. CABECERA DE LAS PANTALLAS */
.topbar{display:flex;justify-content:space-between;align-items:center;padding:10px 0 20px}
.topbar h1{font:600 30px 'Playfair Display',serif;margin:6px 0}
.heart{color:#c28eaf}
.avatar-btn{width:46px;height:46px;border:1px solid #e7d9ee;background:linear-gradient(145deg,#fff,#eee3f8);border-radius:50%;font:600 22px 'Playfair Display';color:var(--gold);box-shadow:var(--shadow)}

/* 09. FRASE DIARIA */
.quote-card{position:relative;overflow:hidden;padding:18px 22px 17px;border-radius:23px;background:linear-gradient(120deg,#f1e8fa,#fff8fc);border:1px solid #fff;box-shadow:var(--shadow);margin:5px 0 16px}
.quote-card:after{content:"";position:absolute;width:120px;height:120px;right:-32px;top:-45px;border:1px solid #d8bd83;border-radius:50%;opacity:.35}
.quote-kicker{font-size:9px;letter-spacing:.16em;color:#a58ab9;font-weight:700}
.quote-card p{font:italic 17px 'Playfair Display',serif;line-height:1.45;margin:8px 20px 0 0;color:#645071}
.quote-star{position:absolute;right:18px;bottom:15px;color:var(--gold);font-size:23px}

/* 10. TARJETA REGISTRAR MI DIA */
.register-card{display:flex;align-items:center;gap:16px;width:100%;padding:13px;border:1px solid #fff;border-radius:23px;background:linear-gradient(110deg,#fff,#f8f1fb);box-shadow:var(--shadow);text-align:left;color:var(--ink)}
.date-tile{width:65px;min-width:65px;height:78px;border-radius:17px;background:linear-gradient(145deg,#a982c4,#815e9f);color:#fff;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:2px;box-shadow:0 7px 14px #a888c044}
.date-tile small{font-size:10px;text-transform:capitalize}
.date-tile b{font:600 28px 'Playfair Display'}
.register-copy{display:grid;gap:5px;flex:1}
.register-copy small{font-size:10px;color:#9a8ca3}
.register-copy strong{font:600 19px 'Playfair Display'}
.arrow{font-size:24px;color:var(--gold);padding:0 7px}

/* 11. HABITOS DE INICIO Y PROGRESO */
.section-block{margin:25px 0}
.section-heading{display:flex;align-items:center;justify-content:space-between;margin-bottom:12px}
.section-heading h2,.form-card h2{font:600 20px 'Playfair Display';margin:3px 0;color:#564664}
.percent{color:#9675b3;font-size:20px}
.progress-track{height:8px;background:#e9dfef;border-radius:99px;overflow:hidden}
.progress-track>div{height:100%;width:0;background:linear-gradient(90deg,#b999dc,#d6b5dc,#d8b963);border-radius:99px;transition:width .5s ease}
.habit-grid{display:grid;grid-template-columns:repeat(4,1fr);gap:9px;margin-top:13px}
.habit-chip{border:1px solid #fff;border-radius:17px;background:linear-gradient(145deg,#fff,#f6effa);padding:12px 4px 10px;display:grid;justify-items:center;gap:6px;box-shadow:0 7px 18px #9f7bb51a;color:#655572;min-width:0}
.habit-chip img{width:35px;height:35px}
.habit-chip b{font-size:10px}
.habit-chip small{font-size:9px;color:#9d8eaa}
.habit-chip.done{border-color:#d8c4e8;background:#f1e8f8}
.habit-chip.done small{color:#8d6ab5;font-weight:700}

/* 12. RESUMEN MI MES */
.month-card{padding:18px;border:1px solid #fff;border-radius:22px;background:#fff9;box-shadow:var(--shadow)}
.text-btn{border:0;background:none;color:#9675b3;font-size:11px;font-weight:700}
.month-stats{display:flex;gap:16px}
.month-stats div{flex:1;padding:13px;border-radius:15px;background:#f7f1fb;display:grid;gap:4px}
.month-stats strong{font:600 27px 'Playfair Display';color:#8869a7}
.month-stats span{font-size:10px;color:#93869c}

/* 13. MENU INFERIOR E ICONOS DE NAVEGACION */
.bottom-nav{position:fixed;z-index:5;bottom:7px;left:50%;transform:translateX(-50%);width:min(540px,100%);padding:9px 12px calc(9px + env(safe-area-inset-bottom));display:flex;align-items:center;justify-content:space-around;background:#fffc;backdrop-filter:blur(18px);border-top:1px solid #eae1f0;box-shadow:0 -8px 30px #8c6ca019}
.bottom-nav button{border:0;background:none;color:#95899d;display:grid;justify-items:center;gap:3px;font-size:9px;min-width:48px}
.bottom-nav button.active{color:#8969a8;font-weight:700}
.bottom-nav img{width:22px;height:22px;opacity:.8}
.bottom-nav button.active img{opacity:1}
.add-nav{width:48px;height:48px;border-radius:50%!important;background:linear-gradient(145deg,#c3a4df,#916db3)!important;color:#fff!important;font-size:29px!important;box-shadow:0 6px 14px #9d7ab844}
.nav-user{width:22px;height:22px;border-radius:50%;background:#eee3f7;color:#9676b2;display:grid;place-items:center;font:14px 'Playfair Display'}

/* 14. CALENDARIO Y CABECERAS DE SECCION */
.page-header{padding:8px 0 17px}
.page-header .back-link{display:block;margin-bottom:14px}
.page-header h1{font-size:31px}
.month-switch{display:flex;justify-content:space-between;align-items:center;padding:12px 15px;background:#fff9;border:1px solid #fff;border-radius:16px;margin:5px 0 10px}
.month-switch button{border:0;background:#f0e7f7;color:#8769a4;border-radius:10px;width:32px;height:32px;font-size:22px}
.month-switch strong{text-transform:capitalize;font:600 17px 'Playfair Display'}
.calendar-legend{display:flex;gap:15px;color:#9a8da3;font-size:10px;padding:7px 2px 12px}
.legend-dot,.legend-gold{display:inline-block;width:7px;height:7px;border-radius:50%;background:#c6a6df;margin-right:5px}
.legend-gold{background:var(--gold)}
.calendar-grid{display:grid;grid-template-columns:repeat(7,minmax(0,1fr));gap:6px}
.weekday{text-align:center;font-size:10px;color:#9b8ca5;padding:6px 0}
.calendar-cell{position:relative;min-height:60px;border:1px solid #fff;border-radius:14px;background:linear-gradient(145deg,#fff,#f7f1fa);box-shadow:0 3px 9px #9e83b311;display:flex;flex-direction:column;align-items:center;justify-content:flex-start;padding:6px 2px 3px;color:#685a73;gap:2px}
.calendar-cell.empty{background:transparent;border:0;box-shadow:none}
.calendar-cell span{font-size:11px}
.calendar-cell .mini-art{width:29px;height:29px}
.calendar-cell.selected{background:linear-gradient(145deg,#b18dcf,#8d69ae);color:white;border-color:#a27cbe;box-shadow:0 5px 13px #8e6bad44}
.calendar-cell.today:after{content:"";position:absolute;bottom:3px;width:4px;height:4px;border-radius:50%;background:var(--gold)}
.selected-day-card{margin:16px 0;padding:18px;border-radius:22px;background:#fff9;border:1px solid #fff;box-shadow:var(--shadow)}
.selected-day-card h2{font:600 20px 'Playfair Display';margin:0 0 12px;text-transform:capitalize}
.selected-day-card p{font-size:12px;line-height:1.55;color:#82758b}
.detail-art{width:42px;height:42px;vertical-align:middle;float:right}
.secondary-btn{border:1px solid #d9c8e7;background:#f5eef9;color:#8464a2;border-radius:13px;padding:12px 16px;font-weight:700;font-size:12px}

/* 15. FORMULARIO DIARIO, HABITOS Y PROGRESO */
.form-card{padding:19px;border-radius:22px;background:#fff9;border:1px solid #fff;box-shadow:var(--shadow);display:grid;gap:16px;margin:8px 0 22px}
.form-card textarea{resize:vertical;min-height:70px;line-height:1.5}
.form-card select{appearance:auto}
.form-card .small{font-size:11px;margin-top:-8px}
.form-divider{height:1px;background:#eee5f2;margin:2px 0}
.form-habits{display:grid;grid-template-columns:repeat(2,1fr);gap:9px}
.form-habit{display:flex;align-items:center;gap:9px;padding:10px;border-radius:15px;background:#f7f1fb;border:1px solid #eee4f3}
.form-habit img{width:36px;height:36px}
.form-habit label{flex:1;font-size:11px!important;display:block!important}
.form-habit input{width:19px;height:19px;accent-color:#9875b8}
.day-progress{background:#f8f2fb;border-radius:14px;padding:12px}
.day-progress>div:first-child{display:flex;justify-content:space-between;font-size:12px;margin-bottom:8px}
.day-progress strong{color:#8e6caf}

/* 16. MI MES, ESTADISTICAS Y PERFIL */
.progress-hero{padding:23px;border-radius:23px;background:linear-gradient(140deg,#eee3f8,#fff8fc);border:1px solid #fff;box-shadow:var(--shadow);text-align:center}
.progress-hero>span{font-size:9px;letter-spacing:.15em;color:#9b85ae}
.progress-hero>strong{display:block;font:600 45px 'Playfair Display';color:#8e6caf;margin:9px}
.progress-hero p{font-size:12px;color:#887b91}
.stats-grid{display:grid;grid-template-columns:repeat(3,1fr);gap:9px;margin:15px 0}
.stat-card{padding:13px 6px;background:#fff9;border:1px solid #fff;border-radius:17px;display:grid;justify-items:center;gap:5px}
.stat-card img{width:34px;height:34px}
.stat-card strong{font:600 22px 'Playfair Display';color:#8e6caf}
.stat-card span{font-size:9px;color:#91839a;text-align:center}
.profile-card{margin-top:15px}
.profile-emblem{width:95px;height:95px;border-radius:50%;margin:0 auto 8px;background:#f1e8f8;display:grid;place-items:center}
.profile-emblem img{width:60%;height:75%;object-fit:contain;mix-blend-mode:multiply}
.danger{color:#b76b82;justify-self:center;padding:8px}

/* 17. MODAL DE FELICITACION Y NOTIFICACIONES */
.modal-backdrop{position:fixed;z-index:20;inset:0;background:#34283f66;backdrop-filter:blur(9px);display:grid;place-items:center;padding:22px;animation:fade .25s ease}
@keyframes fade{from{opacity:0}to{opacity:1}}
.celebration-modal{position:relative;width:min(100%,380px);padding:35px 25px 25px;border-radius:30px;background:linear-gradient(145deg,#fffaff,#f0e6fa);border:1px solid #fff;box-shadow:0 25px 80px #35234355;text-align:center;overflow:hidden;animation:pop .4s cubic-bezier(.2,.8,.2,1)}
@keyframes pop{from{transform:scale(.88) translateY(15px);opacity:0}to{transform:none;opacity:1}}
.celebration-modal:before,.celebration-modal:after{content:"✧";position:absolute;color:#d2b66e;font-size:27px;animation:twinkle 2s ease-in-out infinite}
.celebration-modal:before{left:23px;top:35px}
.celebration-modal:after{right:25px;top:65px;animation-delay:.6s}
@keyframes twinkle{50%{transform:scale(.7) rotate(25deg);opacity:.45}}
.modal-close{position:absolute;right:15px;top:12px;border:0;background:none;color:#a18cac;font-size:25px}
.celebrate-sparkles{color:var(--gold);letter-spacing:10px}
.celebrate-icon{width:70px;height:70px;display:block;margin:10px auto}
.celebration-modal h2{font:600 31px 'Playfair Display';color:#72568d;line-height:1.2;margin:9px}
.celebration-modal p{font-size:13px;color:#897c93;line-height:1.6}
.celebrate-ribbon{display:inline-block;margin:10px auto 20px;padding:8px 20px;border-radius:99px;background:#eadcf4;color:#8e6caf;font-weight:700;letter-spacing:.12em}
.toast{position:fixed;z-index:30;bottom:90px;left:50%;transform:translateX(-50%);padding:12px 18px;border-radius:99px;background:#6e567e;color:#fff;font-size:12px;box-shadow:var(--shadow);white-space:nowrap}

/* 18. AJUSTES RESPONSIVOS Y CONTROL DE DESBORDAMIENTO */
html, body { width:100%; max-width:100%; }
body { overflow-x:clip; }
#app { width:100%; max-width:560px; min-width:0; padding-left:clamp(14px,4vw,22px); padding-right:clamp(14px,4vw,22px); padding-bottom:calc(112px + env(safe-area-inset-bottom)); }
.screen, .app-screen, .form-card, .page-header, .section-block { min-width:0; max-width:100%; }
.form-card { width:100%; }
.form-card > *, .form-card label, .auth-form > *, .auth-form label { min-width:0; max-width:100%; }
.form-card input, .form-card textarea, .form-card select,
.auth-form input, .password-wrap { display:block; width:100%; min-width:0; max-width:100%; box-sizing:border-box; }
.form-card textarea { resize:vertical; overflow-wrap:anywhere; }
.form-card select { text-overflow:ellipsis; }
.form-habits { grid-template-columns:repeat(2,minmax(0,1fr)); min-width:0; }
.form-habit { min-width:0; }
.form-habit label { min-width:0; overflow-wrap:anywhere; }
.form-habit input { flex:0 0 19px; width:19px; min-width:19px; }
.bottom-nav { width:min(560px,100%); padding-left:max(10px,env(safe-area-inset-left)); padding-right:max(10px,env(safe-area-inset-right)); padding-bottom:max(12px,env(safe-area-inset-bottom)); }
.bottom-nav button { min-width:0; flex:1 1 0; }
.bottom-nav img { display:block; width:23px; height:23px; object-fit:contain; }
.bottom-nav .add-nav { flex:0 0 48px; }
.app-screen { padding-bottom:24px; }
.calendar-grid { grid-template-columns:repeat(7,minmax(0,1fr)); gap:clamp(4px,1.5vw,7px); width:100%; }
.calendar-cell { min-width:0; min-height:clamp(52px,13vw,72px); overflow:hidden; }
.calendar-cell .mini-art { width:clamp(25px,7vw,38px); height:clamp(25px,7vw,38px); max-width:100%; object-fit:contain; }
.selected-day-card { min-width:0; overflow-wrap:anywhere; }
.selected-day-card p { min-width:0; }
.detail-art { width:clamp(42px,13vw,64px); height:clamp(42px,13vw,64px); object-fit:contain; }
.workout-preview { display:flex; align-items:center; gap:10px; min-height:0; margin-top:2px; color:#81679A; font-size:12px; }
.workout-preview:empty { display:none; }
.workout-preview img { width:48px; height:48px; object-fit:contain; }
.page-header h1 { overflow-wrap:anywhere; }
.register-card, .quote-card, .month-card, .progress-hero { min-width:0; }
img { max-width:100%; }

/* 19. AJUSTES PARA TELEFONOS */
@media (max-width:480px) {
  #app { padding-top:14px; }
  .topbar h1 { font-size:clamp(25px,7vw,30px); }
  .page-header h1 { font-size:clamp(27px,8vw,34px); line-height:1.15; }
  .page-header .muted { font-size:12px; }
  .form-card { padding:clamp(14px,4vw,19px); border-radius:20px; gap:14px; }
  .form-card label { font-size:12px; }
  .form-card input, .form-card textarea, .form-card select { padding:12px; font-size:14px; }
  .form-habits { gap:8px; }
  .form-habit { padding:8px 7px; gap:7px; }
  .form-habit img { width:34px; height:34px; flex:0 0 34px; }
  .form-habit label { font-size:10px!important; }
  .habit-grid { grid-template-columns:repeat(4,minmax(0,1fr)); }
  .habit-chip img { width:clamp(30px,9vw,39px); height:clamp(30px,9vw,39px); }
  .habit-chip b { font-size:clamp(8px,2.5vw,10px); text-align:center; }
  .calendar-cell { border-radius:12px; padding:5px 1px 3px; }
  .calendar-cell span { font-size:10px; }
  .month-switch { padding:9px 10px; }
  .month-switch strong { font-size:15px; }
  .calendar-legend { flex-wrap:wrap; }
  .bottom-nav { gap:2px; }
  .bottom-nav button { font-size:8px; }
  .bottom-nav img { width:21px; height:21px; }
  .bottom-nav .add-nav { flex-basis:44px; width:44px; height:44px; }
  .welcome-art { width:min(70vw,280px); height:min(70vw,280px); }
}

/* 20. AJUSTES PARA TELEFONOS MUY PEQUENOS */
@media (max-width:360px) {
  #app { padding-left:12px; padding-right:12px; }
  .form-habits { grid-template-columns:1fr; }
  .form-habit { min-height:56px; }
  .calendar-grid { gap:3px; }
  .calendar-cell { min-height:49px; }
  .calendar-cell .mini-art { width:24px; height:24px; }
  .bottom-nav button { font-size:7px; }
  .bottom-nav .add-nav { flex-basis:40px; width:40px; height:40px; }
}

/* 21. AJUSTES PARA TABLETAS */
@media (min-width:700px) {
  #app { max-width:620px; padding-top:28px; }
  .bottom-nav { width:min(600px,calc(100% - 32px)); }
  .form-card { padding:24px; }
  .calendar-cell { min-height:72px; }
}

/* 22. AJUSTES PARA ESCRITORIO */
@media (min-width:1024px) {
  body { background-attachment:fixed; }
  #app { max-width:680px; }
  .bottom-nav { width:min(640px,calc(100% - 48px)); }
}

/* 23. PANTALLA HORIZONTAL */
@media (max-height:560px) and (orientation:landscape) {
  .welcome-screen { min-height:680px; }
  .welcome-art { width:180px; height:180px; margin:12px 0 0; }
  .welcome-line { margin-top:8px; }
  .welcome-sub { margin-bottom:14px; }
}

/* 24. ICONOS DEL HISTORIAL DE DIAS */
.preview-icon { width:48px!important; height:48px!important; object-fit:contain; }
.selected-habits { margin:12px 0; }
.selected-habit-list { display:grid; grid-template-columns:repeat(4,minmax(0,1fr)); gap:7px; margin-top:10px; }
.selected-habit { min-width:0; padding:9px 5px; display:grid; justify-items:center; gap:5px; border-radius:13px; background:#f7f1fb; opacity:.65; }
.selected-habit.is-done { opacity:1; background:#efe5f7; outline:1px solid #ddcbe9; }
.selected-habit-icon { width:36px; height:36px; object-fit:contain; }
.selected-habit small { font-size:9px; text-align:center; overflow-wrap:anywhere; }
.selected-habit.is-done small { color:#80619e; font-weight:700; }
#netlify-badge, .netlify-badge { display:none!important; }
@media(max-width:380px) {
  .selected-habit-list { grid-template-columns:repeat(2,minmax(0,1fr)); }
}

/* 25. AJUSTES DE IMAGENES Y BIENVENIDA */
.welcome-sub{display:flex;align-items:center;flex-direction:column;gap:10px}
.welcome-sub:before{content:"";display:block;width:38px;height:1px;background:linear-gradient(90deg,transparent,#c8a75a,transparent);opacity:.8}
img{max-width:100%;height:auto}
.calendar-cell .mini-art,.habit-chip img,.form-habit img,.stat-card img{object-fit:contain;background:transparent;border:0;box-shadow:none;border-radius:0}
@media(max-width:360px) {
  #app{padding-left:14px;padding-right:14px}
  .bottom-nav{padding-left:6px;padding-right:6px}
  .bottom-nav button{min-width:42px;font-size:8px}
  .habit-grid{gap:6px}
  .habit-chip{padding:10px 4px}
}
@media(min-width:700px) {
  #app{max-width:680px;padding-left:28px;padding-right:28px}
  .bottom-nav{width:min(680px,100%)}
}

/* 26. MICROANIMACIONES Y ESPACIADO */
.form-card input[type="date"]{width:100%;min-height:48px;padding:12px 14px;border:1px solid var(--line);border-radius:14px;background:#fff;color:var(--ink);margin-top:8px}
.app-screen:not(#dayform){padding-bottom:calc(112px + env(safe-area-inset-bottom))}
.bottom-nav{bottom:7px;border:1px solid #eee5f3;border-radius:22px;box-shadow:0 7px 28px rgba(109,78,135,.13)}
.bottom-nav img{object-fit:contain;display:block}
.habit-chip{overflow:visible}
.habit-chip img{display:block;object-fit:contain;max-width:100%;margin-bottom:1px}
.section-block,.quote-card,.register-card,.month-card,.progress-hero,.form-card,.selected-day-card{opacity:1;transform:translateY(0);transition:opacity .45s ease,transform .45s ease,box-shadow .3s ease}
.section-block:not(.is-visible),.quote-card:not(.is-visible),.register-card:not(.is-visible),.month-card:not(.is-visible),.progress-hero:not(.is-visible),.form-card:not(.is-visible),.selected-day-card:not(.is-visible){opacity:.96;transform:translateY(7px)}
.screen-enter{animation:screenEnter .42s cubic-bezier(.2,.7,.2,1) both}
@keyframes screenEnter{from{opacity:.5;transform:translateY(10px)}to{opacity:1;transform:translateY(0)}}
.tap-feedback{animation:tapPulse .28s ease}
@keyframes tapPulse{50%{transform:scale(.975)}}
.progress-track>div,#progressFill,#formProgressFill,#monthProgressFill{transition:width .65s cubic-bezier(.22,.8,.2,1)}
.habit-chip img,.form-habit img,.mini-art,.detail-art{transition:transform .25s ease,filter .25s ease}
.habit-chip:active img{transform:scale(.94)}
@media(prefers-reduced-motion:reduce) {
  *,*::before,*::after{animation-duration:.01ms!important;animation-iteration-count:1!important;scroll-behavior:auto!important;transition-duration:.01ms!important}
}

/* =========================================================
   28. AJUSTE GLOBAL DEFINITIVO DE ESPACIADOS
   Se unifican los márgenes y se elimina el espacio sobrante
   al final de las pantallas. Mantiene el diseño y funciones.
   ========================================================= */

/* Contenedor: no reservar una franja grande al final */
html, body {
  min-height: 100%;
  height: auto;
  overflow-x: hidden;
}

#app {
  min-height: 100vh;
  height: auto;
  padding: 12px 18px 10px !important;
}

/* Las pantallas ocupan el alto de su contenido, no el de la ventana */
.screen {
  min-height: 0 !important;
  height: auto;
}

.app-screen,
.app-screen:not(#dayform) {
  min-height: 0 !important;
  padding-bottom: 78px !important;
}

/* Encabezados de todas las secciones */
.topbar {
  padding: 5px 0 10px;
}

.page-header {
  padding: 5px 0 10px;
}

.page-header h1 {
  margin: 5px 0;
}

/* Espaciado común entre bloques */
.section-block {
  margin: 13px 0;
}

.section-heading {
  margin-bottom: 8px;
}

.quote-card {
  margin: 0 0 11px;
  padding: 14px 17px;
}

.quote-card p {
  margin-top: 6px;
  line-height: 1.4;
}

.register-card {
  min-height: 0;
  margin: 0;
  padding: 11px;
  gap: 12px;
}

.date-tile {
  height: 72px;
}

.register-copy {
  gap: 4px;
}

/* Hábitos de inicio */
.habit-grid {
  gap: 7px;
  margin-top: 9px;
}

.habit-chip {
  min-height: 0;
  padding: 9px 3px 8px;
  gap: 5px;
}

.habit-chip img {
  width: 38px;
  height: 38px;
  margin: 0;
}

.habit-chip b {
  line-height: 1.2;
}

/* Tarjetas de resumen */
.month-card {
  margin: 13px 0;
  padding: 15px;
}

.month-card .section-heading {
  margin-bottom: 10px;
}

.month-stats {
  gap: 11px;
}

.month-stats div {
  padding: 12px;
}

/* Calendario y pantallas secundarias */
.month-switch {
  margin: 8px 0 10px;
}

.calendar-grid {
  margin-top: 8px;
}

.calendar-legend {
  margin: 10px 0;
}

.selected-day-card,
.progress-hero {
  margin: 12px 0;
}

.selected-habits {
  margin: 10px 0;
}

.detail-card,
.stat-card,
.profile-card {
  margin-top: 12px;
  margin-bottom: 12px;
}

/* Formularios: compactos sin reducir controles táctiles */
.form-card {
  margin: 6px 0 12px;
  padding: 16px;
  gap: 12px;
}

.form-card label,
.auth-form label {
  gap: 6px;
}

.auth-form {
  margin-top: 18px;
  gap: 13px;
}

/* Evitar que las animaciones de entrada creen un contenedor para position:fixed.
   Esto mantiene la navegación anclada al borde real de la pantalla. */
.screen {
  animation: none !important;
  transform: none !important;
}

#dashboard {
  transform: none !important;
}

/* Navegación fija: anclada al viewport, no al contenido */
.bottom-nav {
  position: fixed;
  z-index: 50;
  left: 50%;
  bottom: calc(6px + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  width: min(540px, calc(100% - 28px));
  min-height: 68px;
  padding: 7px 9px;
  border: 1px solid #eee5f3;
  border-radius: 22px;
  box-shadow: 0 7px 24px rgba(109,78,135,.12);
}

.bottom-nav button {
  gap: 3px;
}

/* Barra de progreso: el ancho sigue siendo controlado por JavaScript.
   Solo se anima el degradado dentro del porcentaje alcanzado. */
.progress-track {
  height: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: #eadff0;
}

.progress-track > div {
  position: relative;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(
    105deg,
    #a987c8 0%,
    #d69bd5 25%,
    #f0b3d7 45%,
    #d4a9e7 66%,
    #b18bd2 82%,
    #a987c8 100%
  );
  background-size: 260% 100%;
  animation: angyProgressFlow 3.2s linear infinite;
  transition: width .65s cubic-bezier(.22,.8,.2,1);
  box-shadow: 0 0 9px rgba(183,137,207,.25);
}

.progress-track > div::after {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  width: 45%;
  border-radius: inherit;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(255,255,255,.62),
    transparent
  );
  animation: angyProgressShine 2.4s ease-in-out infinite;
  pointer-events: none;
}

@keyframes angyProgressFlow {
  from { background-position: 0% 50%; }
  to { background-position: 260% 50%; }
}

@keyframes angyProgressShine {
  0% { transform: translateX(-130%); opacity: 0; }
  20% { opacity: .8; }
  75% { opacity: .65; }
  100% { transform: translateX(290%); opacity: 0; }
}

/* Teléfonos */
@media (max-width: 480px) {
  #app {
    padding: 9px 14px 8px !important;
  }

  .app-screen,
  .app-screen:not(#dayform) {
    padding-bottom: 76px !important;
  }

  .topbar {
    padding: 4px 0 9px;
  }

  .page-header {
    padding: 4px 0 8px;
  }

  .quote-card {
    margin-bottom: 9px;
    padding: 12px 15px;
  }

  .register-card {
    padding: 10px;
    gap: 10px;
  }

  .date-tile {
    width: 62px;
    min-width: 62px;
    height: 69px;
  }

  .section-block {
    margin: 11px 0;
  }

  .habit-grid {
    gap: 6px;
    margin-top: 8px;
  }

  .habit-chip {
    padding: 8px 2px 7px;
  }

  .habit-chip img {
    width: clamp(29px, 8.5vw, 37px);
    height: clamp(29px, 8.5vw, 37px);
  }

  .month-card {
    margin: 11px 0;
    padding: 13px;
  }

  .month-stats {
    gap: 9px;
  }

  .month-stats div {
    padding: 10px;
  }

  .form-card {
    margin: 5px 0 10px;
    padding: 14px;
    gap: 11px;
  }

  .bottom-nav {
    width: calc(100% - 24px);
    min-height: 66px;
    padding: 6px 7px;
  }
}

@media (max-width: 360px) {
  #app {
    padding-left: 11px !important;
    padding-right: 11px !important;
  }

  .habit-grid {
    gap: 4px;
  }

  .habit-chip b {
    font-size: 8px;
  }

  .bottom-nav {
    width: calc(100% - 18px);
  }
}

/* No forzar animaciones si el usuario pide movimiento reducido */
@media (prefers-reduced-motion: reduce) {
  .progress-track > div,
  .progress-track > div::after {
    animation: none !important;
  }
}


/* =========================================================
   29. RESTAURACIÓN DE ANIMACIONES FLUIDAS Y PÉTALOS
   Mantiene los espaciados compactos y la navegación fija.
   ========================================================= */

/* Entrada suave de cada pantalla sin desplazar el contenedor */
@keyframes appear {
  from {
    opacity: 0;
    filter: blur(3px);
  }
  to {
    opacity: 1;
    filter: blur(0);
  }
}

.screen {
  animation: appear .48s cubic-bezier(.22,.8,.2,1) both !important;
}

/* Pétalos decorativos: movimiento continuo sobre el fondo */
#petals {
  display: block !important;
  position: fixed;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
  z-index: 1;
}

#petals i {
  display: block;
  position: absolute;
  top: -35px;
  width: 9px;
  height: 13px;
  border-radius: 80% 15% 80% 15%;
  background: linear-gradient(135deg,#fff,#e6c7e9 65%,#c7a6d9);
  opacity: .55;
  animation: fall linear infinite !important;
  filter: drop-shadow(0 2px 3px #b69ac633);
  will-change: transform;
}

@keyframes fall {
  0% {
    transform: translate3d(0,-5vh,0) rotate(0deg);
  }
  100% {
    transform: translate3d(40px,110vh,0) rotate(440deg);
  }
}

/* Conservar transiciones delicadas de tarjetas e iconos */
.section-block,
.quote-card,
.register-card,
.month-card,
.progress-hero,
.form-card,
.selected-day-card {
  transition:
    opacity .45s ease,
    transform .45s ease,
    box-shadow .3s ease;
}

.habit-chip img,
.form-habit img,
.mini-art,
.detail-art {
  transition: transform .25s ease, filter .25s ease;
}

/* Degradado animado + reflejo móvil dentro del porcentaje alcanzado */
.progress-track {
  overflow: hidden;
  isolation: isolate;
}

.progress-track > div {
  position: relative;
  overflow: hidden;
  background-size: 260% 100%;
  animation: angyProgressFlow 3.2s linear infinite !important;
}

.progress-track > div::after {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 45%;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(255,255,255,.65),
    transparent
  );
  animation: angyProgressShine 2.4s ease-in-out infinite !important;
  pointer-events: none;
}

/* La barra inferior sigue fija al viewport; no se desplaza con la entrada */
.bottom-nav {
  transform: translateX(-50%) !important;
}

/* Respeto a accesibilidad: se reduce movimiento solo si está solicitado
   expresamente en la configuración del dispositivo. */
@media (prefers-reduced-motion: reduce) {
  .screen {
    animation: none !important;
    filter: none !important;
  }

  #petals i {
    animation: none !important;
  }

  .progress-track > div,
  .progress-track > div::after {
    animation: none !important;
  }
}

/* 31. ACCESO Y RECUPERACION DE CONTRASENA */
.auth-forgot{display:block;margin:8px auto 0;color:#8d6ab5;font-weight:600}
.auth-passkey{margin-top:12px}
#recover .auth-brand,#resetPassword .auth-brand{margin:26px 0 30px}
#recover h1,#resetPassword h1{font-family:'Playfair Display',serif;color:#59476a;font-size:30px;line-height:1.2}
.auth-screen .auth-foot{margin-top:20px;text-align:center}
