/* ================================
   RESET & VARIABLES
================================ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
    --space:    #07071a; --purple: #7c3aed; --purple-l: #a78bfa; --purple-ll: #ddd6fe;
    --teal:     #0ea5e9; --teal-l: #7dd3fc; --green: #10b981; --green-l: #6ee7b7;
    --amber:    #f59e0b; --amber-l: #fcd34d; --pink: #ec4899; --white: #eef2ff; --muted: #94a3b8;
    --card-bg:  rgba(255,255,255,0.04); --card-b: rgba(167,139,250,0.18);
    --font-h:   'Fredoka One', cursive; --font-b: 'Nunito', sans-serif;
    --r: 20px; --r-sm: 12px;
}

body.night-mode { --space: #030310; --card-bg: rgba(255,255,255,0.025); --card-b: rgba(96,130,250,0.12); }
html, body { height: 100%; background: var(--space); color: var(--white); font-family: var(--font-b); overflow-x: hidden; -webkit-tap-highlight-color: transparent; transition: background 2s ease; }
#stars { position: fixed; inset: 0; z-index: 0; pointer-events: none; }

/* ================================
   OVERLAYS
================================ */
#celebrationOverlay, #thoughtOverlay { position: fixed; inset: 0; z-index: 100; background: rgba(7,7,26,0.92); display: flex; align-items: center; justify-content: center; backdrop-filter: blur(8px); }
#celebrationOverlay.hidden, #thoughtOverlay.hidden { display: none; }
.celebration-content, .thought-content { display: flex; flex-direction: column; align-items: center; gap: 1.2rem; padding: 2rem 1.5rem; text-align: center; max-width: 340px; animation: celebIn 0.5s cubic-bezier(0.175,0.885,0.32,1.275); }
@keyframes celebIn { from{transform:scale(0.5) translateY(40px);opacity:0} to{transform:scale(1) translateY(0);opacity:1} }
.celebration-alien { font-size: 5rem; animation: celebBounce 0.6s ease-in-out infinite alternate; }
@keyframes celebBounce { from{transform:translateY(0) scale(1)} to{transform:translateY(-15px) scale(1.1)} }
.celebration-text, .thought-text { font-size: 1rem; line-height: 1.65; color: var(--white); font-weight: 700; }
.thought-icon { font-size: 3rem; } .thought-label { font-family: var(--font-h); color: var(--purple-l); font-size: 1.1rem; }

/* ================================
   PAGES
================================ */
.page { position: relative; z-index: 1; min-height: 100vh; }
.page.hidden { display: none; }
.page.active { display: flex; flex-direction: column; }

/* ================================
   LOGIN
================================ */
.login-center { display: flex; flex-direction: column; align-items: center; justify-content: center; min-height: 100vh; padding: 2rem 1.25rem; gap: 1rem; }
.login-alien-wrap { display: flex; flex-direction: column; align-items: center; gap: 0.3rem; }
.alien-name-tag { font-family: var(--font-h); font-size: 2.2rem; color: var(--purple-l); letter-spacing: 3px; text-shadow: 0 0 20px rgba(167,139,250,0.6); }
.alien-planet { font-size: 0.78rem; color: var(--muted); letter-spacing: 1px; }
.login-tagline { text-align: center; }
.login-tagline h1 { font-family: var(--font-h); font-size: 1.3rem; margin-bottom: 0.25rem; }
.login-tagline p  { font-size: 0.9rem; color: var(--muted); }

/* Login tabs */
.login-tabs { display: flex; gap: 0; width: 100%; max-width: 360px; background: rgba(255,255,255,0.04); border-radius: var(--r-sm); overflow: hidden; border: 1px solid var(--card-b); }
.login-tab { flex: 1; background: transparent; border: none; color: var(--muted); font-family: var(--font-h); font-size: 0.92rem; padding: 0.65rem; cursor: pointer; transition: background 0.2s, color 0.2s; }
.login-tab.active { background: rgba(124,58,237,0.3); color: var(--purple-l); }

.login-card { width: 100%; max-width: 360px; background: var(--card-bg); border: 1px solid var(--card-b); border-radius: var(--r); padding: 1.4rem; display: flex; flex-direction: column; gap: 0.7rem; backdrop-filter: blur(12px); }
.login-card h2 { font-family: var(--font-h); font-size: 1.1rem; color: var(--purple-l); }
.login-card input[type="text"],
.login-card input[type="number"],
.login-card input[type="email"],
.login-card input[type="tel"],
.login-card input[type="date"] {
    width: 100%; background: rgba(255,255,255,0.06); border: 1.5px solid rgba(124,58,237,0.25);
    border-radius: var(--r-sm); color: var(--white); font-family: var(--font-b);
    font-size: 0.95rem; font-weight: 600; padding: 0.65rem 1rem; outline: none;
    transition: border-color 0.2s;
}
.login-card input:focus { border-color: var(--purple-l); background: rgba(255,255,255,0.1); }
.login-card input::placeholder { color: var(--muted); font-weight: 400; }
.login-card input[type="date"]::-webkit-calendar-picker-indicator { filter: invert(0.7); cursor: pointer; }

/* Registration steps */
.reg-step { display: flex; flex-direction: column; gap: 0.65rem; }
.reg-step.hidden { display: none; }
.reg-step.active { display: flex; }

.step-header { display: flex; align-items: center; gap: 0.75rem; }
.step-badge { background: rgba(124,58,237,0.25); border: 1px solid rgba(124,58,237,0.4); border-radius: 20px; padding: 2px 10px; font-size: 0.72rem; font-weight: 800; color: var(--purple-l); letter-spacing: 1px; flex-shrink: 0; }

.field-group { display: flex; flex-direction: column; gap: 0.3rem; }
.field-group label { font-size: 0.78rem; font-weight: 800; color: var(--muted); text-transform: uppercase; letter-spacing: 0.5px; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 0.5rem; }
.field-hint { font-size: 0.72rem; color: var(--muted); font-style: italic; }
.field-hint-box { background: rgba(14,165,233,0.08); border: 1px solid rgba(14,165,233,0.2); border-radius: var(--r-sm); padding: 0.6rem 0.8rem; font-size: 0.8rem; color: var(--teal-l); }

.step-nav { display: flex; gap: 0.5rem; }
.step-nav .btn-primary { flex: 1; }
.btn-back { background: rgba(255,255,255,0.05); border: 1px solid var(--card-b); color: var(--muted); border-radius: var(--r-sm); font-family: var(--font-h); font-size: 0.95rem; padding: 0.75rem 1rem; cursor: pointer; transition: background 0.2s; }
.btn-back:hover { background: rgba(255,255,255,0.1); color: var(--white); }

.parent-link { font-size: 0.82rem; color: var(--muted); text-decoration: none; margin-top: 0.25rem; }
.parent-link:hover { color: var(--purple-l); }

.btn-primary { background: linear-gradient(135deg, var(--purple), #4338ca); color: white; border: none; border-radius: var(--r-sm); font-family: var(--font-h); font-size: 1rem; padding: 0.75rem 1.5rem; cursor: pointer; box-shadow: 0 4px 20px rgba(124,58,237,0.45); transition: transform 0.15s, box-shadow 0.15s; }
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 6px 28px rgba(124,58,237,0.65); }
.btn-primary:active { transform: scale(0.97); }
.btn-secondary { background: linear-gradient(135deg, #0e7490, var(--teal)); color: white; border: none; border-radius: var(--r-sm); font-family: var(--font-h); font-size: 1rem; padding: 0.75rem 1.5rem; cursor: pointer; transition: transform 0.15s; }
.btn-secondary:hover { transform: translateY(-2px); }
.error-msg   { color: #f87171; font-size: 0.82rem; min-height: 1rem; }
.success-msg { color: var(--green-l); font-size: 0.82rem; min-height: 1rem; }

/* ================================
   ALIEN BODY
================================ */
.alien-body { position: relative; width: 100px; height: 112px; margin: 0 auto; transition: transform 0.8s ease, filter 0.8s ease; }
.alien-body::before { content: ''; position: absolute; left: 50%; top: 18px; transform: translateX(-50%); width: 80px; height: 92px; background: radial-gradient(ellipse at 35% 30%, #9f7aea, #6d28d9 55%, #3b0764); border-radius: 50% 50% 44% 44%; box-shadow: 0 0 30px rgba(124,58,237,0.55), inset 0 -12px 22px rgba(0,0,0,0.35); transition: background 0.8s ease, box-shadow 0.8s ease; }
.alien-body::after { content: ''; position: absolute; left: 50%; top: 0; transform: translateX(-50%); width: 58px; height: 38px; background: radial-gradient(ellipse, #7c3aed, #5b21b6); border-radius: 50% 50% 0 0; box-shadow: 0 0 18px rgba(124,58,237,0.35); transition: background 0.8s ease; }

.alien-body.stage-1 { transform: scale(0.78); filter: blur(0.5px) brightness(0.85); }
.alien-body.stage-1::before { background: radial-gradient(ellipse at 35% 30%, #7c5cc4, #4c1d95 55%, #2e1065); }
.alien-body.stage-2 { transform: scale(0.88); filter: brightness(0.92); }
.alien-body.stage-3 { transform: scale(1); filter: none; }
.alien-body.stage-4 { transform: scale(1.08); filter: brightness(1.1); }
.alien-body.stage-4::before { background: radial-gradient(ellipse at 35% 30%, #a78bfa, #7c3aed 50%, #4c1d95); box-shadow: 0 0 45px rgba(167,139,250,0.7), inset 0 -12px 22px rgba(0,0,0,0.2); }
.alien-body.stage-5 { transform: scale(1.18); filter: brightness(1.2); }
.alien-body.stage-5::before { background: radial-gradient(ellipse at 35% 30%, #fde68a, #f59e0b 40%, #b45309); box-shadow: 0 0 60px rgba(245,158,11,0.8), inset 0 -12px 22px rgba(0,0,0,0.15); }
.alien-body.stage-5::after { background: radial-gradient(ellipse, #fcd34d, #d97706); }
.alien-body.stage-5 .alien-glow { animation: enlightenedGlow 2s ease-in-out infinite; }
@keyframes enlightenedGlow { 0%,100%{box-shadow:0 0 60px rgba(245,158,11,0.6)} 50%{box-shadow:0 0 100px rgba(245,158,11,0.9)} }
.alien-body.stage-5 .pupil { background: radial-gradient(circle at 35% 35%, #fde68a, #d97706); }

.alien-antenna { position: absolute; left: 50%; top: -18px; transform: translateX(-50%); width: 3px; height: 20px; background: var(--purple-l); border-radius: 2px; z-index: 2; }
.alien-antenna::after { content: ''; position: absolute; left: 50%; top: -7px; transform: translateX(-50%); width: 10px; height: 10px; background: var(--amber); border-radius: 50%; box-shadow: 0 0 10px var(--amber); animation: antennaPulse 2.2s ease-in-out infinite; }
@keyframes antennaPulse { 0%,100%{transform:translateX(-50%) scale(1)} 50%{box-shadow:0 0 20px var(--amber),0 0 35px rgba(245,158,11,0.35);transform:translateX(-50%) scale(1.25)} }

.alien-eyes { position: absolute; top: 32px; left: 50%; transform: translateX(-50%); display: flex; gap: 18px; z-index: 3; }
.eye { width: 22px; height: 22px; background: #0f172a; border-radius: 50%; border: 2px solid rgba(167,139,250,0.45); display: flex; align-items: center; justify-content: center; overflow: hidden; }
.pupil { width: 11px; height: 11px; background: radial-gradient(circle at 35% 35%, #a78bfa, #6d28d9); border-radius: 50%; animation: blink 4.5s ease-in-out infinite; position: relative; }
.pupil::after { content: ''; position: absolute; top: 2px; left: 2px; width: 3px; height: 3px; background: white; border-radius: 50%; }
@keyframes blink { 0%,88%,100%{transform:scaleY(1)} 92%{transform:scaleY(0.06)} }

.alien-mouth { position: absolute; left: 50%; transform: translateX(-50%); z-index: 3; }
.alien-mouth.smile  { top: 62px; width: 28px; height: 14px; border: 3px solid var(--green-l); border-top: none; border-radius: 0 0 28px 28px; }
.alien-mouth.sad    { top: 68px; width: 28px; height: 14px; border: 3px solid #60a5fa; border-bottom: none; border-radius: 28px 28px 0 0; }
.alien-mouth.open   { top: 60px; width: 24px; height: 16px; background: #1e1b4b; border: 3px solid var(--amber); border-radius: 50%; }
.alien-mouth.wonder { top: 58px; width: 20px; height: 20px; background: #1e1b4b; border: 3px solid var(--purple-l); border-radius: 50%; }
.alien-mouth.neutral{ top: 66px; width: 22px; height: 3px; background: var(--muted); border-radius: 2px; }

.alien-glow { position: absolute; left: 50%; top: 18px; transform: translateX(-50%); width: 80px; height: 92px; border-radius: 50% 50% 44% 44%; pointer-events: none; z-index: 1; animation: glowPulse 3.5s ease-in-out infinite; }
@keyframes glowPulse { 0%,100%{box-shadow:0 0 30px rgba(124,58,237,0.3)} 50%{box-shadow:0 0 65px rgba(124,58,237,0.6)} }

.alien-body.idle        { animation: float 3.2s ease-in-out infinite; }
.alien-body.excited     { animation: excitedBounce 0.65s ease-in-out infinite; }
.alien-body.sad-anim    { animation: sadSway 2.8s ease-in-out infinite; }
.alien-body.wonder-anim { animation: wonderPulse 2s ease-in-out infinite; }
.alien-body.talking .alien-mouth { animation: talkMouth 0.38s ease-in-out infinite; }
@keyframes float        { 0%,100%{transform:translateY(0)} 50%{transform:translateY(-12px)} }
@keyframes excitedBounce{ 0%,100%{transform:translateY(0) rotate(0deg)} 25%{transform:translateY(-18px) rotate(-4deg)} 75%{transform:translateY(-8px) rotate(4deg)} }
@keyframes sadSway      { 0%,100%{transform:translateY(0) rotate(-2deg)} 50%{transform:translateY(5px) rotate(2deg)} }
@keyframes wonderPulse  { 0%,100%{transform:translateY(0) scale(1)} 50%{transform:translateY(-10px) scale(1.04)} }
@keyframes talkMouth    { 0%,100%{transform:translateX(-50%) scaleY(1)} 50%{transform:translateX(-50%) scaleY(0.4)} }

/* ================================
   DASHBOARD
================================ */
#dashboardPage { display: flex; flex-direction: column; height: 100vh; overflow: hidden; }

.topbar { display: flex; align-items: center; justify-content: space-between; padding: 0.5rem 0.7rem; background: rgba(7,7,26,0.85); backdrop-filter: blur(12px); border-bottom: 1px solid var(--card-b); flex-shrink: 0; z-index: 10; gap: 0.4rem; }
.zylo-badge { font-family: var(--font-h); font-size: 1.1rem; color: var(--purple-l); letter-spacing: 2px; }
.topbar-stats { display: flex; gap: 0.3rem; flex: 1; justify-content: center; }
.stat-pill { display: flex; align-items: center; gap: 3px; padding: 3px 7px; border-radius: 20px; font-family: var(--font-h); font-size: 0.78rem; }
.stat-pill.energy    { background: rgba(245,158,11,0.12); border: 1px solid rgba(245,158,11,0.3); color: var(--amber-l); }
.stat-pill.memory    { background: rgba(167,139,250,0.12); border: 1px solid rgba(167,139,250,0.3); color: var(--purple-ll); }
.stat-pill.friend    { background: rgba(236,72,153,0.12); border: 1px solid rgba(236,72,153,0.3); color: #f9a8d4; }
.topbar-nav { display: flex; gap: 0.25rem; }
.nav-btn { width: 30px; height: 30px; border-radius: 8px; border: 1px solid var(--card-b); background: transparent; cursor: pointer; font-size: 0.95rem; display: flex; align-items: center; justify-content: center; transition: background 0.2s; }
.nav-btn.active { background: rgba(124,58,237,0.3); border-color: var(--purple-l); }
.btn-logout { background: rgba(255,255,255,0.04); border: 1px solid rgba(255,255,255,0.08); color: var(--muted); border-radius: 8px; width: 28px; height: 28px; cursor: pointer; font-size: 0.78rem; display: flex; align-items: center; justify-content: center; }
.btn-logout:hover { background: rgba(239,68,68,0.18); color: #f87171; }

.info-bar { display: flex; align-items: center; gap: 0.5rem; padding: 0.28rem 0.75rem; background: rgba(124,58,237,0.07); border-bottom: 1px solid rgba(124,58,237,0.1); font-size: 0.78rem; color: var(--purple-l); font-weight: 700; flex-shrink: 0; }
.info-bar-right { margin-left: auto; display: flex; align-items: center; gap: 0.5rem; }
.time-label { font-size: 0.7rem; color: var(--muted); font-weight: 400; }
.weather-badge { background: rgba(14,165,233,0.12); border: 1px solid rgba(14,165,233,0.25); color: var(--teal-l); border-radius: 12px; padding: 2px 8px; font-size: 0.72rem; font-weight: 700; }
.weather-badge.hidden { display: none; }

.bars-wrap { padding: 0.3rem 0.75rem; flex-shrink: 0; background: rgba(7,7,26,0.5); display: flex; flex-direction: column; gap: 4px; }
.bar-row { display: flex; align-items: center; gap: 0.5rem; }
.bar-label { font-size: 0.62rem; color: var(--muted); font-weight: 700; text-transform: uppercase; letter-spacing: 0.5px; width: 42px; flex-shrink: 0; }
.bar-track { flex: 1; height: 5px; background: rgba(167,139,250,0.1); border-radius: 10px; overflow: hidden; }
.bar-fill { height: 100%; border-radius: 10px; transition: width 1.2s ease; }
.memory-fill { background: linear-gradient(90deg, var(--purple), var(--teal)); box-shadow: 0 0 6px rgba(124,58,237,0.5); }
.friend-fill  { background: linear-gradient(90deg, #ec4899, var(--purple)); box-shadow: 0 0 6px rgba(236,72,153,0.4); }
.memory-fill.complete { background: linear-gradient(90deg, var(--amber), #fde68a, var(--amber)); animation: shimmerBar 2s ease-in-out infinite; }
@keyframes shimmerBar { 0%,100%{filter:brightness(1)} 50%{filter:brightness(1.4)} }
.bar-pct { font-size: 0.65rem; color: var(--muted); font-weight: 700; width: 28px; text-align: right; flex-shrink: 0; }

.tab-content { flex: 1; display: flex; flex-direction: column; overflow: hidden; }
.tab-content.hidden { display: none; }

.alien-zone { flex-shrink: 0; display: flex; flex-direction: column; align-items: center; padding: 0.55rem 1rem 0.3rem; }
.alien-scene { position: relative; display: flex; align-items: flex-end; justify-content: center; height: 132px; width: 100%; }
.planet-surface { position: absolute; bottom: 0; left: 50%; transform: translateX(-50%); width: 150px; height: 18px; background: radial-gradient(ellipse, rgba(124,58,237,0.2), transparent 70%); border-top: 1px solid rgba(124,58,237,0.15); border-radius: 50%; }
#mainAlien { position: relative; z-index: 2; }
.emotion-bubble { position: absolute; top: 4px; right: calc(50% - 88px); background: rgba(255,255,255,0.06); border: 1.5px solid var(--card-b); border-radius: 14px 14px 14px 0; padding: 5px 10px; font-size: 1.3rem; opacity: 0; transform: scale(0.5) translateY(8px); transition: opacity 0.3s, transform 0.3s; pointer-events: none; }
.emotion-bubble.visible { opacity: 1; transform: scale(1) translateY(0); }
.status-bar { margin-top: 0.25rem; text-align: center; }
.status-label { font-size: 0.78rem; color: var(--purple-l); font-weight: 700; }

.challenge-banner { margin: 0 0.75rem 0.3rem; background: rgba(245,158,11,0.1); border: 1px solid rgba(245,158,11,0.3); border-radius: var(--r-sm); padding: 0.4rem 0.75rem; display: flex; align-items: center; gap: 0.5rem; font-size: 0.8rem; font-weight: 700; color: var(--amber-l); animation: challengeSlide 0.4s ease-out; }
.challenge-banner.hidden { display: none; }
@keyframes challengeSlide { from{transform:translateY(-10px);opacity:0} to{transform:translateY(0);opacity:1} }

.chat-zone { flex: 1; display: flex; flex-direction: column; overflow: hidden; padding: 0 0.75rem 0.65rem; gap: 0.4rem; }
.chat-messages { flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 0.42rem; padding: 0.25rem 0; scrollbar-width: none; }
.chat-messages::-webkit-scrollbar { display: none; }
.chat-msg { display: flex; gap: 0.4rem; animation: msgIn 0.28s ease-out; }
@keyframes msgIn { from{opacity:0;transform:translateY(8px)} to{opacity:1;transform:translateY(0)} }
.chat-msg.user-msg  { justify-content: flex-end; }
.chat-msg.alien-msg { justify-content: flex-start; align-items: flex-end; }
.msg-avatar { width: 25px; height: 25px; border-radius: 50%; background: linear-gradient(135deg, var(--purple), #4338ca); display: flex; align-items: center; justify-content: center; font-family: var(--font-h); font-size: 0.72rem; color: white; flex-shrink: 0; }
.msg-bubble { max-width: 78%; padding: 0.5rem 0.85rem; border-radius: 18px; font-size: 0.87rem; line-height: 1.5; font-weight: 600; }
.user-msg .msg-bubble { background: linear-gradient(135deg, var(--purple), #4338ca); border-radius: 18px 18px 4px 18px; color: white; }
.alien-msg .msg-bubble { background: rgba(255,255,255,0.06); border: 1px solid var(--card-b); border-radius: 4px 18px 18px 18px; color: var(--white); }
.msg-milestone .msg-bubble { background: linear-gradient(135deg, rgba(245,158,11,0.15), rgba(124,58,237,0.15)); border-color: rgba(245,158,11,0.4); }

.memory-unlock  { text-align: center; font-size: 0.72rem; color: var(--purple-l); padding: 3px 10px; background: rgba(124,58,237,0.1); border: 1px solid rgba(124,58,237,0.2); border-radius: 20px; margin: 0 auto; animation: unlockPop 0.4s ease-out; }
.challenge-done { text-align: center; font-size: 0.72rem; color: var(--green-l); padding: 3px 10px; background: rgba(16,185,129,0.1); border: 1px solid rgba(16,185,129,0.25); border-radius: 20px; margin: 0 auto; }
.moment-saved   { text-align: center; font-size: 0.72rem; color: var(--amber-l); padding: 3px 10px; background: rgba(245,158,11,0.1); border: 1px solid rgba(245,158,11,0.25); border-radius: 20px; margin: 0 auto; }
@keyframes unlockPop { 0%{transform:scale(0.8);opacity:0} 70%{transform:scale(1.05)} 100%{transform:scale(1);opacity:1} }

.typing-bubble .msg-bubble { padding: 0.65rem 1rem; }
.typing-dots { display: flex; gap: 5px; align-items: center; }
.typing-dots span { width: 7px; height: 7px; border-radius: 50%; background: var(--purple-l); animation: typingDot 1.2s ease-in-out infinite; }
.typing-dots span:nth-child(2){animation-delay:0.2s} .typing-dots span:nth-child(3){animation-delay:0.4s}
@keyframes typingDot { 0%,80%,100%{transform:scale(0.7);opacity:0.4} 40%{transform:scale(1.15);opacity:1} }

.chat-actions { display: flex; gap: 0.35rem; }
.btn-action { background: rgba(124,58,237,0.1); border: 1px solid rgba(124,58,237,0.25); color: var(--purple-l); border-radius: 20px; padding: 4px 10px; font-family: var(--font-h); font-size: 0.8rem; cursor: pointer; transition: background 0.2s; }
.btn-action:hover { background: rgba(124,58,237,0.25); }
.sound-btn.active { background: rgba(16,185,129,0.15); border-color: rgba(16,185,129,0.35); color: var(--green-l); }

.chat-input-row { display: flex; gap: 0.4rem; align-items: center; }
#chatInput { flex: 1; background: rgba(255,255,255,0.06); border: 1.5px solid rgba(124,58,237,0.25); border-radius: 24px; color: var(--white); font-family: var(--font-b); font-size: 0.88rem; font-weight: 600; padding: 0.58rem 1rem; outline: none; transition: border-color 0.2s; }
#chatInput:focus { border-color: var(--purple-l); }
#chatInput::placeholder { color: var(--muted); font-weight: 400; }
.btn-send { width: 40px; height: 40px; border-radius: 50%; background: linear-gradient(135deg, var(--purple), #4338ca); border: none; cursor: pointer; display: flex; align-items: center; justify-content: center; flex-shrink: 0; box-shadow: 0 4px 16px rgba(124,58,237,0.5); transition: transform 0.15s; }
.btn-send:hover { transform: scale(1.08); } .btn-send:active { transform: scale(0.95); } .btn-send:disabled { opacity: 0.45; cursor: not-allowed; transform: none; }
.btn-voice { width: 40px; height: 40px; border-radius: 50%; background: rgba(14,165,233,0.12); border: 1.5px solid rgba(14,165,233,0.35); cursor: pointer; font-size: 1.05rem; flex-shrink: 0; }
.btn-voice:hover { background: rgba(14,165,233,0.25); }
.btn-voice.recording { background: rgba(239,68,68,0.2); border-color: rgba(239,68,68,0.5); animation: recordPulse 1s ease-in-out infinite; }
@keyframes recordPulse { 0%,100%{box-shadow:0 0 0 0 rgba(239,68,68,0.4)} 50%{box-shadow:0 0 0 8px rgba(239,68,68,0)} }
.voice-status { text-align: center; font-size: 0.72rem; color: var(--teal-l); min-height: 0.85rem; font-weight: 600; }

/* GAMES */
.games-wrap { flex: 1; overflow-y: auto; padding: 1rem 0.85rem; display: flex; flex-direction: column; gap: 0.9rem; scrollbar-width: none; }
.games-wrap::-webkit-scrollbar { display: none; }
.games-header { text-align: center; }
.games-header h2 { font-family: var(--font-h); font-size: 1.4rem; color: var(--purple-l); }
.games-header p  { font-size: 0.85rem; color: var(--muted); margin-top: 0.2rem; }
.games-grid { display: grid; grid-template-columns: repeat(2,1fr); gap: 0.6rem; }
.game-card { background: var(--card-bg); border: 1px solid var(--card-b); border-radius: var(--r-sm); padding: 0.9rem 0.8rem; cursor: pointer; text-align: center; transition: background 0.2s, transform 0.15s; display: flex; flex-direction: column; gap: 0.25rem; }
.game-card:hover { background: rgba(124,58,237,0.12); border-color: var(--purple-l); transform: translateY(-2px); }
.game-emoji { font-size: 1.8rem; } .game-name { font-family: var(--font-h); font-size: 0.88rem; } .game-desc { font-size: 0.73rem; color: var(--muted); line-height: 1.35; }
.game-result { display: flex; flex-direction: column; gap: 0.7rem; } .game-result.hidden { display: none; }

/* JOURNAL */
.journal-wrap { flex: 1; overflow-y: auto; padding: 0.85rem; display: flex; flex-direction: column; gap: 0.8rem; scrollbar-width: none; }
.journal-wrap::-webkit-scrollbar { display: none; }
.journal-header { text-align: center; }
.journal-header h2 { font-family: var(--font-h); font-size: 1.4rem; color: var(--purple-l); }
.journal-header p  { font-size: 0.82rem; color: var(--muted); margin-top: 0.2rem; }
.journal-stats { display: grid; grid-template-columns: repeat(3,1fr); gap: 0.5rem; }
.jstat { background: var(--card-bg); border: 1px solid var(--card-b); border-radius: var(--r-sm); padding: 0.7rem; text-align: center; }
.jstat-val { font-family: var(--font-h); font-size: 1.6rem; color: var(--purple-l); }
.jstat-label { font-size: 0.68rem; color: var(--muted); margin-top: 0.15rem; text-transform: uppercase; letter-spacing: 0.5px; }
.friendship-card { background: linear-gradient(135deg, rgba(236,72,153,0.08), rgba(124,58,237,0.08)); border: 1px solid rgba(236,72,153,0.2); border-radius: var(--r-sm); padding: 0.85rem 1rem; display: flex; align-items: center; gap: 0.75rem; }
.friendship-emoji { font-size: 2.2rem; }
.friendship-info { flex: 1; }
.friendship-level { font-family: var(--font-h); font-size: 1rem; color: #f9a8d4; }
.friendship-score { font-size: 0.75rem; color: var(--muted); margin-top: 2px; }
.friendship-streak { font-size: 0.75rem; color: var(--amber-l); font-weight: 700; }
.section-title { font-family: var(--font-h); font-size: 0.9rem; color: var(--purple-l); }
.milestones-list { display: flex; flex-direction: column; gap: 0.32rem; }
.milestone-item { display: flex; align-items: center; gap: 0.55rem; background: rgba(245,158,11,0.07); border: 1px solid rgba(245,158,11,0.2); border-radius: var(--r-sm); padding: 0.5rem 0.75rem; font-size: 0.8rem; font-weight: 700; color: var(--amber-l); }
.milestone-icon { font-size: 1rem; flex-shrink: 0; }
.milestone-date { font-size: 0.65rem; color: var(--muted); font-weight: 400; margin-left: auto; }
.moments-list { display: flex; flex-direction: column; gap: 0.35rem; }
.moment-card { background: rgba(245,158,11,0.05); border: 1px solid rgba(245,158,11,0.12); border-radius: var(--r-sm); padding: 0.6rem 0.75rem; }
.moment-user  { font-size: 0.77rem; color: var(--muted); margin-bottom: 0.2rem; font-style: italic; }
.moment-reply { font-size: 0.82rem; color: var(--white); font-weight: 600; line-height: 1.4; }
.moment-date  { font-size: 0.65rem; color: var(--muted); margin-top: 0.2rem; }
.fragments-grid { display: grid; grid-template-columns: repeat(2,1fr); gap: 0.45rem; }
.fragment-card { background: var(--card-bg); border: 1px solid var(--card-b); border-radius: var(--r-sm); padding: 0.6rem; animation: fragmentIn 0.4s ease-out; }
@keyframes fragmentIn { from{opacity:0;transform:scale(0.9)} to{opacity:1;transform:scale(1)} }
.fragment-key   { font-size: 0.68rem; color: var(--purple-l); text-transform: uppercase; letter-spacing: 0.5px; font-weight: 800; margin-bottom: 0.2rem; }
.fragment-value { font-size: 0.82rem; color: var(--white); font-weight: 600; line-height: 1.35; }
.fragment-empty { grid-column: 1/-1; text-align: center; color: var(--muted); font-size: 0.83rem; padding: 1.5rem; line-height: 1.6; }

/* ================================
   HOMEWORK TAB
================================ */
.homework-wrap {
    flex: 1; overflow-y: auto; padding: 0.85rem;
    display: flex; flex-direction: column; gap: 0.75rem;
    scrollbar-width: none;
}
.homework-wrap::-webkit-scrollbar { display: none; }

.homework-header { text-align: center; }
.homework-header h2 { font-family: var(--font-h); font-size: 1.4rem; color: var(--purple-l); }
.homework-header p  { font-size: 0.82rem; color: var(--muted); margin-top: 0.2rem; }

/* Grille matières */
.subject-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.45rem;
}

.subject-card {
    background: var(--card-bg);
    border: 1.5px solid var(--card-b);
    border-radius: var(--r-sm);
    padding: 0.6rem 0.4rem;
    cursor: pointer;
    text-align: center;
    transition: background 0.2s, border-color 0.2s, transform 0.15s;
    display: flex; flex-direction: column; gap: 0.2rem;
}
.subject-card:hover { background: rgba(124,58,237,0.1); transform: translateY(-1px); }
.subject-card.active {
    background: rgba(124,58,237,0.2);
    border-color: var(--purple-l);
    box-shadow: 0 0 10px rgba(124,58,237,0.25);
}
.subject-emoji { font-size: 1.4rem; }
.subject-name  { font-size: 0.65rem; font-weight: 800; color: var(--white); text-transform: uppercase; letter-spacing: 0.3px; }

/* Bannière matière active */
.hw-subject-banner {
    display: flex; align-items: center; gap: 0.6rem;
    background: rgba(124,58,237,0.1);
    border: 1px solid rgba(124,58,237,0.25);
    border-radius: var(--r-sm);
    padding: 0.5rem 0.85rem;
    font-family: var(--font-h); font-size: 1rem; color: var(--purple-l);
}
.hw-tip {
    margin-left: auto;
    font-size: 0.68rem;
    color: var(--muted);
    font-family: var(--font-b);
    font-weight: 400;
}

/* Messages devoirs */
.hw-messages {
    flex: 1;
    min-height: 140px;
    max-height: 220px;
    overflow-y: auto;
    display: flex; flex-direction: column; gap: 0.42rem;
    padding: 0.25rem 0;
    scrollbar-width: none;
    background: rgba(255,255,255,0.02);
    border: 1px solid var(--card-b);
    border-radius: var(--r-sm);
    padding: 0.5rem;
}
.hw-messages::-webkit-scrollbar { display: none; }

/* Input devoirs — textarea */
.hw-input-row {
    display: flex; gap: 0.4rem; align-items: flex-end;
}

#hwInput {
    flex: 1;
    background: rgba(255,255,255,0.06);
    border: 1.5px solid rgba(124,58,237,0.25);
    border-radius: var(--r-sm);
    color: var(--white);
    font-family: var(--font-b);
    font-size: 0.88rem;
    font-weight: 600;
    padding: 0.6rem 1rem;
    outline: none;
    resize: none;
    line-height: 1.5;
    transition: border-color 0.2s;
}
#hwInput:focus { border-color: var(--purple-l); }
#hwInput::placeholder { color: var(--muted); font-weight: 400; }

.hw-tip-bottom {
    text-align: center;
    font-size: 0.68rem;
    color: var(--muted);
}

/* Badge bravo */
.hw-bravo {
    text-align: center;
    font-size: 0.78rem;
    color: var(--green-l);
    padding: 4px 12px;
    background: rgba(16,185,129,0.1);
    border: 1px solid rgba(16,185,129,0.25);
    border-radius: 20px;
    margin: 0 auto;
    animation: unlockPop 0.4s ease-out;
}
