/* ================================================================
   EmotiSense Kids - Main Stylesheet
   Design: Child-friendly, ASD-accessible, pastel color palette
   ================================================================ */

/* ----------------------------------------------------------------
   Edge-to-edge (Android 15+): la app dibuja debajo de las barras
   del sistema. Aplicamos padding via safe-area-inset para que el
   contenido respete el status bar y la navigation bar sin llamar
   a las APIs deprecadas de Window.setStatusBarColor().
   ---------------------------------------------------------------- */
html {
    background-color: #7C4DFF; /* color visible detras del status bar */
}
body {
    padding-top: env(safe-area-inset-top, 0px);
    padding-bottom: env(safe-area-inset-bottom, 0px);
    padding-left: env(safe-area-inset-left, 0px);
    padding-right: env(safe-area-inset-right, 0px);
    background-color: #F5F0FF;
}

/* ----------------------------------------------------------------
   CSS Variables - Centralized color and spacing tokens
   ---------------------------------------------------------------- */
:root {
    /* Primary pastel palette */
    --color-primary: #7C4DFF;
    --color-primary-light: #B388FF;
    --color-primary-dark: #6200EA;

    /* Pastel accent colors for each feature */
    --color-communicate: #66BB6A;
    --color-communicate-light: #E8F5E9;
    --color-emotions: #FFD54F;
    --color-emotions-light: #FFF9C4;
    --color-games: #42A5F5;
    --color-games-light: #E3F2FD;
    --color-voice: #AB47BC;
    --color-voice-light: #F3E5F5;
    --color-routine: #FF9800;
    --color-routine-light: #FFF3E0;
    --color-parent: #EF5350;
    --color-parent-light: #FFEBEE;

    /* Neutral palette */
    --color-bg: #F5F0FF;
    --color-surface: #FFFFFF;
    --color-card-bg: #FFFFFF;
    --color-text: #37474F;
    --color-text-light: #78909C;
    --color-border: #E0E0E0;
    --color-success: #66BB6A;
    --color-error: #EF5350;
    --color-warning: #FFA726;

    /* Spacing scale */
    --space-xs: 4px;
    --space-sm: 8px;
    --space-md: 16px;
    --space-lg: 24px;
    --space-xl: 32px;
    --space-xxl: 48px;

    /* Typography */
    --font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    --font-size-sm: 14px;
    --font-size-base: 16px;
    --font-size-lg: 20px;
    --font-size-xl: 24px;
    --font-size-xxl: 32px;
    --font-size-hero: 40px;

    /* Border radius */
    --radius-sm: 8px;
    --radius-md: 16px;
    --radius-lg: 24px;
    --radius-full: 50%;

    /* Shadows */
    --shadow-sm: 0 2px 8px rgba(0,0,0,0.08);
    --shadow-md: 0 4px 16px rgba(0,0,0,0.12);
    --shadow-lg: 0 8px 32px rgba(0,0,0,0.16);

    /* Animation */
    --transition-fast: 0.2s ease;
    --transition-normal: 0.3s ease;
    --transition-slow: 0.5s ease;
}

/* ----------------------------------------------------------------
   Text size overrides for accessibility
   ---------------------------------------------------------------- */
body.text-large {
    --font-size-sm: 16px;
    --font-size-base: 18px;
    --font-size-lg: 22px;
    --font-size-xl: 28px;
    --font-size-xxl: 36px;
}

body.text-extra-large {
    --font-size-sm: 18px;
    --font-size-base: 20px;
    --font-size-lg: 26px;
    --font-size-xl: 32px;
    --font-size-xxl: 40px;
}

/* High contrast mode */
body.high-contrast {
    --color-bg: #FFFFFF;
    --color-text: #000000;
    --color-text-light: #333333;
    --color-border: #000000;
}

/* Reduce motion for accessibility */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        transition-duration: 0.01ms !important;
    }
}

body.no-animations *, body.no-animations *::before, body.no-animations *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
}

/* ----------------------------------------------------------------
   Reset & Base
   ---------------------------------------------------------------- */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

html, body {
    width: 100%;
    height: 100%;
    overflow: hidden;
    font-family: var(--font-family);
    font-size: var(--font-size-base);
    color: var(--color-text);
    background-color: var(--color-bg);
    -webkit-font-smoothing: antialiased;
    -webkit-user-select: none;
    user-select: none;
}

/* ----------------------------------------------------------------
   Screen system - single page app navigation
   ---------------------------------------------------------------- */
.screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: none;
    flex-direction: column;
    overflow-y: auto;
    overflow-x: hidden;
    background-color: var(--color-bg);
    transition: opacity var(--transition-normal), transform var(--transition-normal);
}

.screen.active {
    display: flex;
}

.screen.slide-in {
    animation: slideIn var(--transition-normal) forwards;
}

.screen.slide-out {
    animation: slideOut var(--transition-normal) forwards;
}

@keyframes slideIn {
    from { transform: translateX(100%); opacity: 0; }
    to   { transform: translateX(0); opacity: 1; }
}

@keyframes slideOut {
    from { transform: translateX(0); opacity: 1; }
    to   { transform: translateX(-30%); opacity: 0; }
}

/* ----------------------------------------------------------------
   App Header
   ---------------------------------------------------------------- */
.app-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-md);
    padding-top: calc(var(--space-md) + env(safe-area-inset-top, 0));
    background: var(--color-surface);
    box-shadow: var(--shadow-sm);
    position: sticky;
    top: 0;
    z-index: 100;
    min-height: 56px;
}

.app-title {
    font-size: var(--font-size-lg);
    font-weight: 700;
    color: var(--color-primary);
    flex: 1;
    text-align: center;
}

.screen-title {
    font-size: var(--font-size-lg);
    font-weight: 700;
    color: var(--color-text);
    flex: 1;
    text-align: center;
}

.header-spacer {
    width: 40px;
}

.header-mascot-small {
    width: 36px;
    height: 36px;
}

/* ----------------------------------------------------------------
   Buttons
   ---------------------------------------------------------------- */
.btn-icon {
    width: 40px;
    height: 40px;
    border: none;
    background: none;
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background var(--transition-fast);
}

.btn-icon:active {
    background: rgba(0,0,0,0.08);
}

.btn-primary {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-sm);
    padding: var(--space-md) var(--space-lg);
    background: var(--color-primary);
    color: white;
    border: none;
    border-radius: var(--radius-lg);
    font-size: var(--font-size-lg);
    font-weight: 600;
    cursor: pointer;
    transition: transform var(--transition-fast), box-shadow var(--transition-fast);
    box-shadow: var(--shadow-sm);
}

.btn-primary:active {
    transform: scale(0.95);
}

.btn-secondary {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-sm);
    padding: var(--space-md) var(--space-lg);
    background: var(--color-surface);
    color: var(--color-primary);
    border: 2px solid var(--color-primary-light);
    border-radius: var(--radius-lg);
    font-size: var(--font-size-base);
    font-weight: 600;
    cursor: pointer;
    transition: transform var(--transition-fast);
}

.btn-secondary:active {
    transform: scale(0.95);
}

.btn-danger {
    color: var(--color-error);
    border-color: var(--color-error);
}

.icon {
    width: 24px;
    height: 24px;
    fill: currentColor;
}

/* ----------------------------------------------------------------
   Splash Screen
   ---------------------------------------------------------------- */
#splash-screen {
    background: linear-gradient(135deg, #7C4DFF 0%, #B388FF 50%, #E1BEE7 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.splash-content {
    text-align: center;
    color: white;
}

.splash-logo {
    margin-bottom: var(--space-lg);
}

.mascot-large {
    width: 120px;
    height: 120px;
    background: white;
    border-radius: var(--radius-full);
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--shadow-lg);
    position: relative;
    overflow: hidden;
}

/* Mascot face drawn with CSS */
.mascot-large::before {
    content: '';
    position: absolute;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle at 35% 40%, #5D4037 8px, transparent 8px),
                radial-gradient(circle at 65% 40%, #5D4037 8px, transparent 8px),
                radial-gradient(ellipse at 50% 60%, transparent 10px, transparent 10px);
}

.mascot-large::after {
    content: '';
    position: absolute;
    width: 40px;
    height: 20px;
    border-bottom: 4px solid #5D4037;
    border-radius: 0 0 50% 50%;
    bottom: 32px;
    left: 50%;
    transform: translateX(-50%);
}

.splash-title {
    font-size: var(--font-size-hero);
    font-weight: 800;
    margin-bottom: var(--space-sm);
    text-shadow: 0 2px 8px rgba(0,0,0,0.2);
}

.splash-tagline {
    font-size: var(--font-size-base);
    opacity: 0.9;
    line-height: 1.5;
}

.splash-smr-badge {
    margin-top: var(--space-md);
    font-size: 0.7rem;
    letter-spacing: 2px;
    text-transform: uppercase;
    color: rgba(255,255,255,0.5);
    font-weight: 600;
}

/* Loading dots */
.loading-dots {
    margin-top: var(--space-xl);
    display: flex;
    justify-content: center;
    gap: var(--space-sm);
}

.dot {
    width: 12px;
    height: 12px;
    background: rgba(255,255,255,0.7);
    border-radius: var(--radius-full);
    animation: dotPulse 1.4s infinite ease-in-out;
}

.dot:nth-child(2) { animation-delay: 0.2s; }
.dot:nth-child(3) { animation-delay: 0.4s; }

@keyframes dotPulse {
    0%, 80%, 100% { transform: scale(0.6); opacity: 0.4; }
    40% { transform: scale(1); opacity: 1; }
}

/* ----------------------------------------------------------------
   Home Screen
   ---------------------------------------------------------------- */
.home-grid {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: var(--space-md);
    gap: var(--space-md);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.greeting-area {
    padding: var(--space-sm);
}

.assistant-bubble {
    display: flex;
    align-items: flex-start;
    gap: var(--space-md);
    background: var(--color-surface);
    padding: var(--space-md);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
}

.assistant-avatar {
    width: 48px;
    height: 48px;
    min-width: 48px;
    background: linear-gradient(135deg, var(--color-primary-light), var(--color-voice-light));
    border-radius: var(--radius-full);
    position: relative;
}

/* Simple CSS face for the assistant avatar */
.assistant-avatar::before {
    content: '';
    position: absolute;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle at 35% 40%, #5D4037 4px, transparent 4px),
                radial-gradient(circle at 65% 40%, #5D4037 4px, transparent 4px);
}

.assistant-avatar::after {
    content: '';
    position: absolute;
    width: 20px;
    height: 10px;
    border-bottom: 3px solid #5D4037;
    border-radius: 0 0 50% 50%;
    bottom: 12px;
    left: 50%;
    transform: translateX(-50%);
}

.assistant-message {
    font-size: var(--font-size-lg);
    color: var(--color-text);
    line-height: 1.4;
    padding-top: var(--space-xs);
}

/* Navigation cards grid */
.nav-cards {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: var(--space-md);
    padding-bottom: var(--space-xl);
}

.nav-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-md);
    padding: var(--space-lg);
    background: var(--color-surface);
    border: none;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    cursor: pointer;
    transition: transform var(--transition-fast), box-shadow var(--transition-fast);
}

.nav-card:active {
    transform: scale(0.95);
    box-shadow: var(--shadow-md);
}

.card-communicate { border-bottom: 4px solid var(--color-communicate); }
.card-emotions    { border-bottom: 4px solid var(--color-emotions); }
.card-games       { border-bottom: 4px solid var(--color-games); }
.card-voice       { border-bottom: 4px solid var(--color-voice); }
.card-routine     { border-bottom: 4px solid var(--color-routine); }
.card-calm        { border-bottom: 4px solid var(--color-communicate); }
.card-timer       { border-bottom: 4px solid var(--color-voice); }
.card-learn       { border-bottom: 4px solid #90CAF9; }

.card-icon {
    width: 64px;
    height: 64px;
}

.card-svg {
    width: 100%;
    height: 100%;
}

.card-label {
    font-size: var(--font-size-lg);
    font-weight: 700;
    color: var(--color-text);
}

/* ----------------------------------------------------------------
   Communication Board
   ---------------------------------------------------------------- */
.sentence-strip {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    min-height: 50px;
    margin: var(--space-sm) var(--space-md);
    padding: var(--space-xs) var(--space-md);
    background: var(--color-surface);
    border-radius: var(--radius-md);
    border: 2px dashed var(--color-communicate);
    overflow-x: auto;
    flex-shrink: 0;
}

.sentence-placeholder {
    color: var(--color-text-light);
    font-size: var(--font-size-base);
    width: 100%;
    text-align: center;
}

.sentence-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    padding: var(--space-xs);
    min-width: 60px;
    animation: popIn var(--transition-fast);
}

.sentence-item img,
.sentence-item .pecs-item-icon {
    width: 40px;
    height: 40px;
}

.sentence-item span {
    font-size: var(--font-size-sm);
    color: var(--color-text);
    font-weight: 600;
}

@keyframes popIn {
    from { transform: scale(0); }
    to   { transform: scale(1); }
}

.speak-sentence-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-sm);
    margin: 0 var(--space-md) var(--space-xs);
    padding: var(--space-sm) var(--space-lg);
    background: var(--color-communicate);
    color: white;
    border: none;
    border-radius: var(--radius-lg);
    font-size: var(--font-size-base);
    font-weight: 600;
    cursor: pointer;
    flex-shrink: 0;
}

.speak-sentence-btn:active {
    transform: scale(0.95);
}

/* PECS Category tabs */
.pecs-categories {
    display: flex;
    gap: var(--space-sm);
    padding: 0 var(--space-md);
    overflow-x: auto;
    flex-shrink: 0;
}

.pecs-cat-btn {
    padding: var(--space-sm) var(--space-md);
    border: 2px solid var(--color-border);
    background: var(--color-surface);
    border-radius: var(--radius-lg);
    font-size: var(--font-size-sm);
    font-weight: 600;
    color: var(--color-text-light);
    cursor: pointer;
    white-space: nowrap;
    transition: all var(--transition-fast);
}

.pecs-cat-btn.active {
    background: var(--color-communicate);
    color: white;
    border-color: var(--color-communicate);
}

/* Pictogram grid */
.pecs-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--space-md);
    padding: var(--space-md);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    flex: 1;
}

.pecs-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-sm);
    padding: var(--space-md);
    background: var(--color-surface);
    border: 2px solid var(--color-border);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.pecs-item:active {
    transform: scale(0.92);
    border-color: var(--color-communicate);
    background: var(--color-communicate-light);
}

.pecs-item-icon {
    width: 56px;
    height: 56px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 42px;
    line-height: 1;
}

.pecs-item-label {
    font-size: var(--font-size-sm);
    font-weight: 700;
    color: var(--color-text);
    text-align: center;
}

/* ----------------------------------------------------------------
   Emotion Recognition
   ---------------------------------------------------------------- */
.emotion-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: var(--space-md);
    gap: var(--space-md);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.camera-container {
    width: 100%;
    max-width: 340px;
    aspect-ratio: 4/3;
    border-radius: var(--radius-lg);
    overflow: hidden;
    background: #1a1a2e;
    position: relative;
    margin: 0 auto;
}

.camera-container video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transform: scaleX(-1);
}

.camera-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

.face-guide {
    position: absolute;
    top: 15%;
    left: 20%;
    width: 60%;
    height: 50%;
    border: 3px dashed rgba(255,255,255,0.4);
    border-radius: 50%;
}

.camera-placeholder {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: var(--space-md);
    background: linear-gradient(135deg, var(--color-voice-light), var(--color-emotions-light));
}

.camera-placeholder.hidden { display: none; }

/* Emotion Canvas - AI detection overlay */
#emotion-canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    transform: scaleX(-1);
    pointer-events: none;
    z-index: 1;
}

/* AI Status Indicator */
.ai-status {
    position: absolute;
    top: 8px;
    left: 8px;
    display: flex;
    align-items: center;
    gap: 6px;
    background: rgba(0, 0, 0, 0.6);
    border-radius: 20px;
    padding: 4px 10px;
    z-index: 3;
    font-size: 11px;
    font-weight: 600;
}

.ai-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #666;
    flex-shrink: 0;
}

.ai-dot.ai-loading {
    background: #FF9800;
    animation: ai-pulse 1s ease-in-out infinite;
}

.ai-dot.ai-ready {
    background: #4CAF50;
    box-shadow: 0 0 6px #4CAF50;
}

.ai-dot.ai-error {
    background: #EF5350;
}

@keyframes ai-pulse {
    0%, 100% { opacity: 0.4; }
    50% { opacity: 1; }
}

.ai-label {
    color: white;
    letter-spacing: 0.3px;
}

.ai-status-ready .ai-label { color: #A5D6A7; }
.ai-status-loading .ai-label { color: #FFE082; }
.ai-status-error .ai-label { color: #EF9A9A; }

/* Real-time Emotion Probability Bar */
.realtime-emotion-bar {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(0, 0, 0, 0.7);
    padding: 6px 10px;
    z-index: 3;
    border-radius: 0 0 var(--radius-lg) var(--radius-lg);
}

.realtime-emotion-bar.hidden { display: none; }

.rt-emotion-row {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 2px;
    opacity: 0.6;
    transition: opacity 0.3s;
}

.rt-emotion-row.active {
    opacity: 1;
}

.rt-emoji {
    font-size: 12px;
    flex-shrink: 0;
    width: 16px;
    text-align: center;
}

.rt-bar-bg {
    flex: 1;
    height: 6px;
    background: rgba(255, 255, 255, 0.15);
    border-radius: 3px;
    overflow: hidden;
}

.rt-bar-fill {
    height: 100%;
    border-radius: 3px;
    transition: width 0.3s ease;
    min-width: 0;
}

.rt-pct {
    font-size: 9px;
    color: rgba(255, 255, 255, 0.7);
    width: 28px;
    text-align: right;
    font-weight: 600;
    font-family: monospace;
}

.placeholder-icon {
    width: 80px;
    height: 80px;
}

.camera-placeholder p {
    font-size: var(--font-size-lg);
    color: var(--color-text-light);
    font-weight: 600;
}

.btn-camera {
    width: 100%;
    max-width: 300px;
}

.emotion-result {
    text-align: center;
    padding: var(--space-md);
    width: 100%;
}

.detected-emotion {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-sm);
}

.emotion-emoji {
    font-size: 64px;
    line-height: 1;
}

#emotion-label {
    font-size: var(--font-size-xl);
    font-weight: 700;
    color: var(--color-text);
}

.emotion-response {
    margin-top: var(--space-md);
    padding: var(--space-md);
    background: var(--color-voice-light);
    border-radius: var(--radius-md);
    font-size: var(--font-size-lg);
    color: var(--color-text);
    line-height: 1.5;
    min-height: 0;
}

.emotion-response:empty {
    display: none;
}

/* Emotion picker buttons */
.emotion-picker {
    width: 100%;
    padding-top: var(--space-md);
    border-top: 1px solid var(--color-border);
}

.picker-label {
    text-align: center;
    font-size: var(--font-size-base);
    color: var(--color-text-light);
    margin-bottom: var(--space-md);
}

.emotion-buttons {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--space-sm);
}

.emotion-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-xs);
    padding: var(--space-md);
    background: var(--color-surface);
    border: 2px solid var(--color-border);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.emotion-btn:active {
    transform: scale(0.92);
    border-color: var(--color-primary);
    background: var(--color-primary-light);
}

.emotion-face {
    font-size: 36px;
    line-height: 1;
}

.emotion-btn span:last-child {
    font-size: var(--font-size-sm);
    font-weight: 600;
    color: var(--color-text);
}

/* ----------------------------------------------------------------
   Games
   ---------------------------------------------------------------- */
.games-menu {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: var(--space-md);
    padding: var(--space-md);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    flex: 1;
}

.game-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-sm);
    padding: var(--space-lg);
    background: var(--color-surface);
    border: none;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    cursor: pointer;
    transition: transform var(--transition-fast);
}

.game-card:active {
    transform: scale(0.95);
}

.game-card-icon {
    font-size: 48px;
}

.game-card h3 {
    font-size: var(--font-size-base);
    font-weight: 700;
    color: var(--color-text);
}

.game-card p {
    font-size: var(--font-size-sm);
    color: var(--color-text-light);
}

.game-difficulty {
    display: flex;
    gap: 2px;
}

.diff-star {
    width: 12px;
    height: 12px;
    background: var(--color-border);
    clip-path: polygon(50% 0%, 61% 35%, 98% 35%, 68% 57%, 79% 91%, 50% 70%, 21% 91%, 32% 57%, 2% 35%, 39% 35%);
}

.diff-star.filled {
    background: var(--color-emotions);
}

/* Stars display in header */
.stars-display {
    display: flex;
    align-items: center;
    gap: var(--space-xs);
}

.star-icon { width: 20px; height: 20px; }

#star-count {
    font-size: var(--font-size-base);
    font-weight: 700;
    color: var(--color-text);
}

/* Game area */
.game-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: relative;
    z-index: 2;
    background: var(--color-bg);
}

.game-header {
    display: flex;
    align-items: center;
    padding: var(--space-sm) var(--space-md);
    gap: var(--space-md);
}

.game-progress {
    flex: 1;
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}

.progress-bar {
    flex: 1;
    height: 8px;
    background: var(--color-border);
    border-radius: 4px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: var(--color-games);
    border-radius: 4px;
    transition: width var(--transition-normal);
    width: 0;
}

#game-score {
    font-size: var(--font-size-sm);
    font-weight: 700;
    color: var(--color-text);
    min-width: 20px;
}

.game-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    padding: var(--space-md);
    padding-top: var(--space-lg);
    gap: var(--space-lg);
    overflow-y: auto;
}

/* Game question prompt */
.game-question {
    font-size: var(--font-size-xl);
    font-weight: 700;
    text-align: center;
    color: var(--color-text);
}

/* Game options grid */
.game-options {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: var(--space-md);
    width: 100%;
    max-width: 400px;
}

.game-option {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: var(--space-sm);
    padding: var(--space-lg);
    background: var(--color-surface);
    border: 3px solid var(--color-border);
    border-radius: var(--radius-lg);
    cursor: pointer;
    transition: all var(--transition-fast);
    min-height: 100px;
}

.game-option:active {
    transform: scale(0.95);
}

.game-option.correct {
    border-color: var(--color-success);
    background: #E8F5E9;
    animation: correctPulse 0.5s;
}

.game-option.wrong {
    border-color: var(--color-error);
    background: #FFEBEE;
    animation: shake 0.5s;
}

.game-option-icon {
    font-size: 48px;
    line-height: 1;
}

.game-option-label {
    font-size: var(--font-size-base);
    font-weight: 600;
    color: var(--color-text);
}

@keyframes correctPulse {
    0%, 100% { transform: scale(1); }
    50%      { transform: scale(1.05); }
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25%      { transform: translateX(-8px); }
    75%      { transform: translateX(8px); }
}

/* Routine puzzle game - sortable list */
.game-sortable-list {
    width: 100%;
    max-width: 360px;
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
}

.sortable-item {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    padding: var(--space-md);
    background: var(--color-surface);
    border: 2px solid var(--color-border);
    border-radius: var(--radius-md);
    cursor: grab;
    transition: all var(--transition-fast);
}

.sortable-item.dragging {
    opacity: 0.5;
    border-color: var(--color-primary);
}

.sortable-item.correct-position {
    border-color: var(--color-success);
    background: #E8F5E9;
}

.sortable-item-icon {
    font-size: 28px;
}

.sortable-item-label {
    font-size: var(--font-size-base);
    font-weight: 600;
}

.sortable-handle {
    margin-left: auto;
    color: var(--color-text-light);
    font-size: 20px;
}

/* Game completion overlay */
.game-complete-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 200;
}

.game-complete-overlay.hidden {
    display: none;
}

.complete-card {
    background: var(--color-surface);
    border-radius: var(--radius-lg);
    padding: var(--space-xl);
    text-align: center;
    box-shadow: var(--shadow-lg);
    animation: popIn var(--transition-normal);
    max-width: 320px;
    width: 90%;
}

.complete-stars {
    font-size: 48px;
    margin-bottom: var(--space-md);
}

#complete-title {
    font-size: var(--font-size-xxl);
    font-weight: 800;
    color: var(--color-primary);
    margin-bottom: var(--space-sm);
}

#complete-message {
    font-size: var(--font-size-lg);
    color: var(--color-text-light);
    margin-bottom: var(--space-lg);
}

.complete-actions {
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
}

/* ----------------------------------------------------------------
   Voice Assistant
   ---------------------------------------------------------------- */
.voice-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
}

.voice-assistant-area {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: var(--space-lg);
    gap: var(--space-md);
}

/* Animated assistant character */
.assistant-character {
    position: relative;
}

.assistant-body {
    width: 120px;
    height: 120px;
    background: linear-gradient(135deg, #CE93D8, #B388FF);
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--shadow-md);
    animation: float 3s ease-in-out infinite;
}

@keyframes float {
    0%, 100% { transform: translateY(0); }
    50%      { transform: translateY(-8px); }
}

.assistant-face {
    position: relative;
    width: 80px;
    height: 60px;
}

.assistant-eyes {
    display: flex;
    justify-content: space-between;
    padding: 0 8px;
}

.eye {
    width: 16px;
    height: 16px;
    background: white;
    border-radius: var(--radius-full);
    position: relative;
}

.eye::after {
    content: '';
    position: absolute;
    width: 8px;
    height: 8px;
    background: #37474F;
    border-radius: var(--radius-full);
    top: 4px;
    left: 4px;
    animation: eyeLook 4s ease-in-out infinite;
}

@keyframes eyeLook {
    0%, 40%, 100% { transform: translateX(0); }
    20%           { transform: translateX(3px); }
    60%           { transform: translateX(-3px); }
}

.assistant-mouth {
    width: 30px;
    height: 15px;
    border-bottom: 4px solid white;
    border-radius: 0 0 50% 50%;
    margin: 8px auto 0;
    transition: all var(--transition-normal);
}

.assistant-mouth.speaking {
    animation: mouthMove 0.3s infinite alternate;
}

@keyframes mouthMove {
    from { height: 8px; width: 24px; }
    to   { height: 18px; width: 30px; }
}

.assistant-mouth.sad {
    border-bottom: none;
    border-top: 4px solid white;
    border-radius: 50% 50% 0 0;
}

/* Speech bubble - compact prompt only (responses go to chat history) */
.assistant-speech-bubble {
    background: var(--color-surface);
    padding: var(--space-sm) var(--space-md);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    max-width: 280px;
    text-align: center;
    position: relative;
}

.assistant-speech-bubble::before {
    content: '';
    position: absolute;
    top: -8px;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 0;
    border-left: 8px solid transparent;
    border-right: 8px solid transparent;
    border-bottom: 8px solid var(--color-surface);
}

#assistant-text {
    font-size: var(--font-size-lg);
    color: var(--color-text);
    line-height: 1.4;
}

/* Chat history */
.chat-history {
    flex: 1;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding: var(--space-md);
    display: flex;
    flex-direction: column;
    gap: var(--space-md);
}

.chat-msg {
    max-width: 80%;
    padding: var(--space-md);
    border-radius: var(--radius-md);
    font-size: var(--font-size-base);
    line-height: 1.4;
    animation: popIn var(--transition-fast);
}

.chat-msg.user {
    align-self: flex-end;
    background: var(--color-primary);
    color: white;
    border-bottom-right-radius: var(--space-xs);
}

.chat-msg.assistant {
    align-self: flex-start;
    background: var(--color-surface);
    color: var(--color-text);
    border-bottom-left-radius: var(--space-xs);
    box-shadow: var(--shadow-sm);
}

/* Thinking animation */
.chat-msg.thinking {
    opacity: 0.7;
}

.thinking-dots span {
    display: inline-block;
    animation: thinkingBounce 1.4s infinite ease-in-out;
    font-size: 24px;
    font-weight: bold;
    color: var(--color-primary);
}

.thinking-dots span:nth-child(1) { animation-delay: 0s; }
.thinking-dots span:nth-child(2) { animation-delay: 0.2s; }
.thinking-dots span:nth-child(3) { animation-delay: 0.4s; }

@keyframes thinkingBounce {
    0%, 80%, 100% { transform: translateY(0); }
    40% { transform: translateY(-8px); }
}

/* Mic button */
.voice-input-area {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: var(--space-lg);
    gap: var(--space-sm);
}

.mic-button {
    width: 80px;
    height: 80px;
    border-radius: var(--radius-full);
    background: linear-gradient(135deg, #AB47BC, #CE93D8);
    border: none;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    box-shadow: 0 0 15px rgba(171, 71, 188, 0.5);
    transition: transform var(--transition-fast);
    z-index: 1;
}

/* Glowing ring animation - attracts children to tap */
.mic-button::before {
    content: '';
    position: absolute;
    width: 100%;
    height: 100%;
    border-radius: var(--radius-full);
    border: 3px solid rgba(206, 147, 216, 0.6);
    animation: mic-glow-ring 2s ease-in-out infinite;
    pointer-events: none;
}

.mic-button::after {
    content: '';
    position: absolute;
    width: 100%;
    height: 100%;
    border-radius: var(--radius-full);
    border: 2px solid rgba(206, 147, 216, 0.4);
    animation: mic-glow-ring 2s ease-in-out infinite 0.6s;
    pointer-events: none;
}

/* Breathing glow effect on the button itself */
.mic-button.glow {
    animation: mic-breathe 2.5s ease-in-out infinite;
}

@keyframes mic-breathe {
    0%, 100% {
        box-shadow: 0 0 15px rgba(171, 71, 188, 0.4),
                    0 0 30px rgba(206, 147, 216, 0.2);
        transform: scale(1);
    }
    50% {
        box-shadow: 0 0 25px rgba(171, 71, 188, 0.7),
                    0 0 50px rgba(206, 147, 216, 0.4),
                    0 0 70px rgba(186, 104, 200, 0.2);
        transform: scale(1.08);
    }
}

@keyframes mic-glow-ring {
    0% {
        transform: scale(1);
        opacity: 0.8;
    }
    100% {
        transform: scale(1.8);
        opacity: 0;
    }
}

.mic-button:active {
    transform: scale(0.9) !important;
    animation: none !important;
}

.mic-button.recording {
    background: linear-gradient(135deg, #EF5350, #F48FB1);
    animation: mic-recording-pulse 1.2s infinite !important;
}

.mic-button.recording::before,
.mic-button.recording::after {
    border-color: rgba(239, 83, 80, 0.5);
}

@keyframes mic-recording-pulse {
    0%, 100% {
        box-shadow: 0 0 15px rgba(239, 83, 80, 0.4);
        transform: scale(1);
    }
    50% {
        box-shadow: 0 0 30px rgba(239, 83, 80, 0.7),
                    0 0 50px rgba(244, 143, 177, 0.3);
        transform: scale(1.05);
    }
}

.mic-icon {
    width: 32px;
    height: 32px;
}

.mic-ripple {
    position: absolute;
    width: 100%;
    height: 100%;
    border-radius: var(--radius-full);
    border: 3px solid var(--color-voice);
    opacity: 0;
}

.mic-ripple.active {
    animation: ripple 1s infinite;
}

@keyframes ripple {
    from { transform: scale(1); opacity: 0.6; }
    to   { transform: scale(1.6); opacity: 0; }
}

/* Conversation active: mic button shows Milo is processing/speaking */
.mic-button.milo-speaking {
    background: linear-gradient(135deg, #66BB6A, #A5D6A7);
    animation: mic-speaking-pulse 1.5s ease-in-out infinite !important;
}

.mic-button.milo-speaking::before,
.mic-button.milo-speaking::after {
    border-color: rgba(102, 187, 106, 0.5);
}

@keyframes mic-speaking-pulse {
    0%, 100% {
        box-shadow: 0 0 15px rgba(102, 187, 106, 0.3);
        transform: scale(1);
    }
    50% {
        box-shadow: 0 0 25px rgba(102, 187, 106, 0.6);
        transform: scale(1.03);
    }
}

.mic-hint {
    font-size: var(--font-size-sm);
    color: var(--color-voice);
    font-weight: 600;
    animation: mic-hint-fade 2.5s ease-in-out infinite;
}

@keyframes mic-hint-fade {
    0%, 100% { opacity: 0.6; }
    50%      { opacity: 1; }
}

/* Chat text input area (accessibility fallback) */
.chat-input-area {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    padding: var(--space-sm) var(--space-md);
    background: var(--color-card-bg);
    border-top: 1px solid var(--color-border);
}

.chat-text-input {
    flex: 1;
    padding: 10px 14px;
    border: 2px solid var(--color-border);
    border-radius: var(--radius-lg);
    font-size: var(--font-size-base);
    background: var(--color-bg);
    color: var(--color-text);
    outline: none;
    transition: border-color 0.2s;
}

.chat-text-input:focus {
    border-color: var(--color-voice);
}

.chat-send-btn {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: none;
    background: var(--color-voice);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex-shrink: 0;
    transition: background 0.2s, transform 0.1s;
}

.chat-send-btn:active {
    transform: scale(0.93);
    background: var(--color-primary-dark);
}

.chat-send-btn .icon {
    width: 22px;
    height: 22px;
    fill: currentColor;
}

/* ----------------------------------------------------------------
   Daily Routine
   ---------------------------------------------------------------- */
.routine-content {
    flex: 1;
    padding: var(--space-md);
    overflow-y: auto;
}

.time-indicator {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    padding: var(--space-md);
    background: var(--color-routine-light);
    border-radius: var(--radius-md);
    margin-bottom: var(--space-lg);
}

.time-icon {
    width: 40px;
    height: 40px;
    font-size: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
}

#time-label {
    font-size: var(--font-size-lg);
    font-weight: 700;
    color: var(--color-text);
}

/* Routine list */
.routine-list {
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
}

.routine-step {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    padding: var(--space-md);
    background: var(--color-surface);
    border-radius: var(--radius-md);
    border-left: 4px solid var(--color-border);
    box-shadow: var(--shadow-sm);
    transition: all var(--transition-fast);
    cursor: pointer;
}

.routine-step.completed {
    border-left-color: var(--color-success);
    opacity: 0.7;
}

.routine-step.current {
    border-left-color: var(--color-routine);
    background: var(--color-routine-light);
}

.routine-step-icon {
    width: 48px;
    height: 48px;
    font-size: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.routine-step-info {
    flex: 1;
}

.routine-step-name {
    font-size: var(--font-size-base);
    font-weight: 700;
    color: var(--color-text);
}

.routine-step-time {
    font-size: var(--font-size-sm);
    color: var(--color-text-light);
}

.routine-step-check {
    width: 32px;
    height: 32px;
    border-radius: var(--radius-full);
    border: 3px solid var(--color-border);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: all var(--transition-fast);
}

.routine-step.completed .routine-step-check {
    background: var(--color-success);
    border-color: var(--color-success);
}

.routine-step.completed .routine-step-check::after {
    content: '';
    width: 10px;
    height: 6px;
    border-bottom: 3px solid white;
    border-left: 3px solid white;
    transform: rotate(-45deg);
    margin-bottom: 2px;
}

/* Delete button for edit mode */
.routine-step-delete {
    width: 32px;
    height: 32px;
    border: none;
    background: var(--color-error);
    color: white;
    border-radius: var(--radius-full);
    font-size: 18px;
    display: none;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex-shrink: 0;
}

.routine-list.editing .routine-step-delete {
    display: flex;
}

.routine-list.editing .routine-step-check {
    display: none;
}

/* Add step button */
.btn-add-step {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-sm);
    width: 100%;
    padding: var(--space-md);
    margin-top: var(--space-md);
    background: none;
    border: 2px dashed var(--color-border);
    border-radius: var(--radius-md);
    color: var(--color-text-light);
    font-size: var(--font-size-base);
    font-weight: 600;
    cursor: pointer;
}

.btn-add-step.hidden { display: none; }

/* ----------------------------------------------------------------
   PIN Entry Screen
   ---------------------------------------------------------------- */
.pin-entry {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: var(--space-lg);
    gap: var(--space-md);
}

.pin-lock-icon {
    margin-bottom: var(--space-sm);
}

.lock-svg {
    width: 64px;
    height: 64px;
}

/* Auth back button (register screen, parent gate) */
.auth-back-btn {
    position: absolute;
    top: 16px;
    left: 16px;
    background: rgba(124, 77, 255, 0.1);
    border: none;
    border-radius: 50%;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 10;
    transition: background 0.2s;
}
.auth-back-btn:active {
    background: rgba(124, 77, 255, 0.25);
}

/* Parent gate now uses auth-pin-* classes for unified design */
/* Back button on parent gate PIN screen */
.pin-back-btn {
    position: absolute;
    top: 16px;
    left: 16px;
    background: rgba(124, 77, 255, 0.1);
    border: none;
    border-radius: 50%;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 10;
    transition: background 0.2s;
}
.pin-back-btn:active {
    background: rgba(124, 77, 255, 0.25);
}

#parent-gate-screen .auth-container {
    position: relative;
    justify-content: flex-start;
    padding-top: 32px;
}

#parent-gate-screen .auth-error {
    color: var(--color-error);
    font-size: var(--font-size-sm);
    font-weight: 600;
    text-align: center;
}
#parent-gate-screen .auth-error.hidden { display: none; }

/* ----------------------------------------------------------------
   Parent Dashboard - Professional UI
   ---------------------------------------------------------------- */
.parent-screen { background: #F8F9FA; overflow: hidden !important; }
.parent-header { background: linear-gradient(135deg, #1A237E, #283593) !important; }
.parent-header .screen-title { color: white !important; }
.parent-header .btn-icon { color: white; }
.parent-header .icon { fill: white; }

/* Child profile banner */
.pd-child-banner {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 16px 20px;
    background: linear-gradient(135deg, #283593, #3949AB);
    border-radius: 16px;
    margin-bottom: var(--space-md);
    box-shadow: 0 4px 16px rgba(26,35,126,0.25);
}

.pd-child-avatar {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: rgba(255,255,255,0.2);
    color: white;
    font-size: 22px;
    font-weight: 800;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid rgba(255,255,255,0.4);
}

.pd-child-name {
    font-size: 20px;
    font-weight: 800;
    color: white;
    margin: 0;
}

.pd-child-mode {
    font-size: 12px;
    color: rgba(255,255,255,0.7);
    font-weight: 600;
}

/* Quick stats row */
.pd-quick-stats {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
    margin-bottom: var(--space-md);
}

.pd-qstat {
    background: white;
    border-radius: 14px;
    padding: 12px 6px;
    text-align: center;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}

.pd-qstat-icon { font-size: 20px; margin-bottom: 4px; }
.pd-qstat-value {
    font-size: 22px;
    font-weight: 800;
    color: #1A237E;
    line-height: 1;
}
.pd-qstat-label {
    font-size: 10px;
    color: #78909C;
    font-weight: 600;
    margin-top: 2px;
}

/* Sections */
.pd-section {
    margin-bottom: var(--space-lg);
}

.pd-section-title {
    font-size: 15px;
    font-weight: 800;
    color: #1A237E;
    margin-bottom: var(--space-sm);
    padding-left: 4px;
}

/* Card styling */
.pd-card {
    border-left: 4px solid #3949AB;
}

.pd-card-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: var(--space-sm);
}

.pd-card-icon { font-size: 20px; line-height: 1; }

.pd-card-header h4 {
    font-size: 14px;
    font-weight: 700;
    color: var(--color-text);
    margin: 0;
}

/* Actions section */
.pd-actions {
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
    margin-top: var(--space-md);
    padding-bottom: 60px;
}

.dashboard-content {
    flex: 1;
    min-height: 0;
    padding: var(--space-md);
    padding-bottom: 40px;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.date-nav {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-lg);
    margin-bottom: var(--space-md);
    background: white;
    padding: 8px 16px;
    border-radius: 12px;
    box-shadow: 0 2px 6px rgba(0,0,0,0.04);
}

.date-label {
    font-size: var(--font-size-lg);
    font-weight: 700;
    color: var(--color-text);
    min-width: 120px;
    text-align: center;
}

.dashboard-cards {
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
    margin-bottom: var(--space-lg);
}

.dash-card {
    background: var(--color-surface);
    border-radius: var(--radius-md);
    padding: var(--space-lg);
    box-shadow: var(--shadow-sm);
}

.dash-card h3 {
    font-size: var(--font-size-sm);
    font-weight: 600;
    color: var(--color-text-light);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: var(--space-md);
}

.dash-stat {
    font-size: var(--font-size-hero);
    font-weight: 800;
    color: var(--color-primary);
}

.dash-tags {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-sm);
}

.tag {
    padding: var(--space-xs) var(--space-md);
    background: var(--color-primary-light);
    color: var(--color-primary-dark);
    border-radius: var(--radius-lg);
    font-size: var(--font-size-sm);
    font-weight: 600;
}

/* Emotion chart - simple bar chart */
.emotion-chart {
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
}

.emotion-bar-row {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}

.emotion-bar-label {
    width: 70px;
    font-size: var(--font-size-sm);
    font-weight: 600;
    color: var(--color-text);
}

.emotion-bar-track {
    flex: 1;
    height: 12px;
    background: var(--color-border);
    border-radius: 6px;
    overflow: hidden;
}

.emotion-bar-fill {
    height: 100%;
    border-radius: 6px;
    transition: width var(--transition-slow);
}

.emotion-bar-count {
    width: 24px;
    font-size: var(--font-size-sm);
    color: var(--color-text-light);
    text-align: right;
}

/* Game stats */
.game-stats {
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
}

.game-stat-row {
    display: flex;
    justify-content: space-between;
    padding: var(--space-sm) 0;
    border-bottom: 1px solid var(--color-border);
}

.game-stat-row:last-child {
    border-bottom: none;
}

.game-stat-row span:first-child {
    color: var(--color-text-light);
}

.game-stat-row span:last-child {
    font-weight: 700;
    color: var(--color-text);
}

/* Routine progress */
.routine-progress-bar {
    height: 12px;
    background: var(--color-border);
    border-radius: 6px;
    overflow: hidden;
    margin-bottom: var(--space-sm);
}

.routine-progress-fill {
    height: 100%;
    background: var(--color-routine);
    border-radius: 6px;
    transition: width var(--transition-slow);
    width: 0;
}

.routine-progress-label {
    font-size: var(--font-size-sm);
    color: var(--color-text-light);
    font-weight: 600;
}

/* Communication log */
.comm-log {
    max-height: 200px;
    overflow-y: auto;
}

.comm-log-entry {
    display: flex;
    justify-content: space-between;
    padding: var(--space-sm) 0;
    border-bottom: 1px solid var(--color-border);
    font-size: var(--font-size-sm);
}

.comm-log-entry:last-child {
    border-bottom: none;
}

.no-data {
    color: var(--color-text-light);
    font-size: var(--font-size-sm);
    text-align: center;
    padding: var(--space-md);
}

.btn-export {
    width: 100%;
    margin-bottom: var(--space-xl);
}

/* ----------------------------------------------------------------
   Settings
   ---------------------------------------------------------------- */
.settings-content {
    flex: 1;
    padding: var(--space-md);
    overflow-y: auto;
}

.settings-group {
    margin-bottom: var(--space-lg);
}

.settings-group-title {
    font-size: var(--font-size-sm);
    font-weight: 600;
    color: var(--color-text-light);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: var(--space-md);
    padding-bottom: var(--space-sm);
    border-bottom: 1px solid var(--color-border);
}

.setting-item {
    margin-bottom: var(--space-md);
}

.setting-item label {
    display: block;
    font-size: var(--font-size-base);
    font-weight: 600;
    color: var(--color-text);
    margin-bottom: var(--space-xs);
}

.toggle-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.toggle-item label:first-child {
    margin-bottom: 0;
}

.input-field {
    width: 100%;
    padding: var(--space-md);
    border: 2px solid var(--color-border);
    border-radius: var(--radius-md);
    font-size: var(--font-size-base);
    font-family: var(--font-family);
    color: var(--color-text);
    background: var(--color-surface);
    transition: border-color var(--transition-fast);
}

.input-field:focus {
    outline: none;
    border-color: var(--color-primary);
}

/* Toggle switch */
.toggle {
    position: relative;
    width: 52px;
    height: 28px;
    display: inline-block;
}

.toggle input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--color-border);
    border-radius: 28px;
    cursor: pointer;
    transition: background var(--transition-fast);
}

.toggle-slider::before {
    content: '';
    position: absolute;
    width: 22px;
    height: 22px;
    border-radius: var(--radius-full);
    background: white;
    top: 3px;
    left: 3px;
    transition: transform var(--transition-fast);
    box-shadow: var(--shadow-sm);
}

.toggle input:checked + .toggle-slider {
    background: var(--color-primary);
}

.toggle input:checked + .toggle-slider::before {
    transform: translateX(24px);
}

/* Range slider */
.range-slider {
    width: 100%;
    height: 6px;
    -webkit-appearance: none;
    appearance: none;
    background: var(--color-border);
    border-radius: 3px;
    outline: none;
}

.range-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 24px;
    height: 24px;
    background: var(--color-primary);
    border-radius: var(--radius-full);
    cursor: pointer;
    box-shadow: var(--shadow-sm);
}

.app-info {
    text-align: center;
    padding: var(--space-lg);
    color: var(--color-text-light);
    font-size: var(--font-size-sm);
}

.tagline-small {
    margin-top: var(--space-xs);
    font-style: italic;
}

/* ----------------------------------------------------------------
   Modal
   ---------------------------------------------------------------- */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 300;
    padding: var(--space-lg);
}

.modal.hidden { display: none; }

.modal-content {
    background: var(--color-surface);
    border-radius: var(--radius-lg);
    padding: var(--space-lg);
    width: 100%;
    max-width: 360px;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
    animation: popIn var(--transition-normal);
}

.modal-content h2 {
    font-size: var(--font-size-xl);
    margin-bottom: var(--space-lg);
    text-align: center;
    color: var(--color-text);
}

.modal-actions {
    display: flex;
    gap: var(--space-md);
    margin-top: var(--space-lg);
}

.modal-actions button {
    flex: 1;
}

/* Step icons grid in modal */
.step-icons-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: var(--space-sm);
    margin-bottom: var(--space-md);
}

.step-icon-option {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 56px;
    height: 56px;
    font-size: 32px;
    background: var(--color-surface);
    border: 2px solid var(--color-border);
    border-radius: var(--radius-md);
    cursor: pointer;
    margin: 0 auto;
    transition: all var(--transition-fast);
}

.step-icon-option.selected {
    border-color: var(--color-primary);
    background: var(--color-primary-light);
}

/* PIN change fields */
.pin-change-fields {
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
}

.pin-change-fields label {
    font-size: var(--font-size-sm);
    font-weight: 600;
    color: var(--color-text);
}

.pin-change-error {
    color: var(--color-error);
    font-size: var(--font-size-sm);
    text-align: center;
    margin-top: var(--space-sm);
}

.pin-change-error.hidden { display: none; }

/* ----------------------------------------------------------------
   Floating Assistant
   ---------------------------------------------------------------- */
.floating-assistant {
    position: fixed;
    bottom: var(--space-lg);
    right: var(--space-lg);
    width: 56px;
    height: 56px;
    border-radius: var(--radius-full);
    background: linear-gradient(135deg, #CE93D8, #B388FF);
    box-shadow: var(--shadow-md);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 50;
    animation: float 3s ease-in-out infinite;
}

.floating-assistant.hidden { display: none; }

.float-assistant-avatar {
    width: 100%;
    height: 100%;
    border-radius: var(--radius-full);
    position: relative;
}

.float-assistant-avatar::before {
    content: '';
    position: absolute;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle at 35% 40%, white 3px, transparent 3px),
                radial-gradient(circle at 65% 40%, white 3px, transparent 3px);
}

.float-assistant-avatar::after {
    content: '';
    position: absolute;
    width: 16px;
    height: 8px;
    border-bottom: 3px solid white;
    border-radius: 0 0 50% 50%;
    bottom: 16px;
    left: 50%;
    transform: translateX(-50%);
}

/* ----------------------------------------------------------------
   Reward Animation Overlay
   ---------------------------------------------------------------- */
.reward-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 500;
    pointer-events: none;
}

.reward-overlay.hidden { display: none; }

.reward-content {
    text-align: center;
    position: relative;
}

.reward-stars-burst {
    position: relative;
    width: 200px;
    height: 200px;
    margin: 0 auto;
}

.reward-star {
    position: absolute;
    font-size: 32px;
    animation: starBurst 1s ease-out forwards;
}

@keyframes starBurst {
    0%   { transform: translate(0, 0) scale(0); opacity: 1; }
    100% { opacity: 0; }
}

.reward-message {
    font-size: var(--font-size-xxl);
    font-weight: 800;
    color: var(--color-primary);
    text-shadow: 0 2px 8px rgba(0,0,0,0.1);
    animation: rewardPop 0.6s ease-out;
}

@keyframes rewardPop {
    0%   { transform: scale(0); opacity: 0; }
    50%  { transform: scale(1.2); }
    100% { transform: scale(1); opacity: 1; }
}

/* ----------------------------------------------------------------
   Utility Classes
   ---------------------------------------------------------------- */
.hidden { display: none !important; }

/* Scrollbar styling for webkit browsers */
::-webkit-scrollbar { width: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--color-border); border-radius: 2px; }

/* ================================================================
   MILO CHARACTER - Animated Assistant (formerly Luna)
   ================================================================ */

/* Milo base structure */
.milo-character {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    position: relative;
}

.milo-body {
    border-radius: 50%;
    background: linear-gradient(135deg, #FFFFFF 0%, #F3E5F5 100%);
    box-shadow: 0 4px 20px rgba(156, 39, 176, 0.15),
                inset 0 -4px 8px rgba(206, 147, 216, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    animation: miloFloat 3s ease-in-out infinite;
    border: 3px solid rgba(206, 147, 216, 0.3);
}

.milo-face {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6%;
    width: 100%;
    height: 100%;
    justify-content: center;
    position: relative;
}

/* Miloeyes */
.milo-eyes {
    display: flex;
    gap: 28%;
    align-items: center;
    justify-content: center;
    width: 100%;
}

.milo-eye {
    position: relative;
    background: #4A148C;
    border-radius: 50%;
    overflow: hidden;
}

.milo-pupil {
    position: absolute;
    background: #FFFFFF;
    border-radius: 50%;
    top: 15%;
    right: 15%;
    width: 35%;
    height: 35%;
    animation: miloPupilLook 6s ease-in-out infinite;
}

.milo-eyelid {
    position: absolute;
    top: -100%;
    left: -5%;
    width: 110%;
    height: 100%;
    background: linear-gradient(135deg, #FFFFFF 0%, #F3E5F5 100%);
    border-radius: 0 0 50% 50%;
    animation: miloBlink 4s ease-in-out infinite;
}

/* Milocheeks */
.milo-cheeks {
    display: flex;
    justify-content: space-between;
    width: 80%;
    position: absolute;
    bottom: 35%;
}

.milo-cheek {
    border-radius: 50%;
    background: rgba(244, 143, 177, 0.35);
}

/* Milomouth */
.milo-mouth {
    width: 30%;
    height: 12%;
    border-radius: 0 0 50% 50%;
    background: #E91E63;
    position: relative;
    transition: all 0.3s ease;
}

.milo-mouth.smile {
    border-radius: 0 0 50% 50%;
}

.milo-mouth.speaking {
    animation: miloTalk 0.3s ease-in-out infinite alternate;
}

.milo-mouth.sad {
    border-radius: 50% 50% 0 0;
    background: #90CAF9;
}

/* Milohands */
.milo-hand {
    position: absolute;
    width: 18%;
    height: 18%;
    background: linear-gradient(135deg, #FFFFFF 0%, #F3E5F5 100%);
    border-radius: 50%;
    border: 2px solid rgba(206, 147, 216, 0.3);
    top: 60%;
}

.milo-hand.left {
    left: -8%;
    animation: miloWaveLeft 5s ease-in-out infinite;
}

.milo-hand.right {
    right: -8%;
    animation: miloWaveRight 5s ease-in-out infinite;
}

/* Size variants */
.milo-large .milo-body { width: 120px; height: 120px; }
.milo-large .milo-eye { width: 18px; height: 18px; }
.milo-large .milo-cheek { width: 16px; height: 10px; }
.milo-large .milo-mouth { width: 32px; height: 14px; }

.milo-small .milo-body { width: 56px; height: 56px; }
.milo-small .milo-eye { width: 9px; height: 9px; }
.milo-small .milo-cheek { width: 8px; height: 5px; }
.milo-small .milo-mouth { width: 16px; height: 7px; }

.milo-tiny .milo-body { width: 36px; height: 36px; }
.milo-tiny .milo-eye { width: 6px; height: 6px; }
.milo-tiny .milo-cheeks { display: none; }
.milo-tiny .milo-mouth { width: 10px; height: 5px; }
.milo-tiny .milo-eyelid { animation-duration: 6s; }

.milo-voice .milo-body { width: 100px; height: 100px; }
.milo-voice .milo-eye { width: 16px; height: 16px; }
.milo-voice .milo-cheek { width: 14px; height: 9px; }
.milo-voice .milo-mouth { width: 28px; height: 12px; }
.milo-voice { position: relative; }

/* ---- Luna Keyframe Animations ---- */

/* Gentle floating */
@keyframes miloFloat {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-6px); }
}

/* Blink animation */
@keyframes miloBlink {
    0%, 90%, 100% { top: -100%; }
    93%, 97% { top: 0; }
}

/* Pupil looking around */
@keyframes miloPupilLook {
    0%, 40% { transform: translate(0, 0); }
    45% { transform: translate(-30%, 10%); }
    55% { transform: translate(20%, -10%); }
    65%, 100% { transform: translate(0, 0); }
}

/* Talking mouth */
@keyframes miloTalk {
    0% { height: 8%; border-radius: 50%; }
    100% { height: 16%; border-radius: 0 0 50% 50%; }
}

/* Wave left hand */
@keyframes miloWaveLeft {
    0%, 80%, 100% { transform: rotate(0deg); }
    85% { transform: rotate(-15deg) translateY(-4px); }
    90% { transform: rotate(10deg); }
    95% { transform: rotate(-10deg) translateY(-2px); }
}

/* Wave right hand */
@keyframes miloWaveRight {
    0%, 60%, 100% { transform: rotate(0deg); }
    65% { transform: rotate(20deg) translateY(-6px); }
    70% { transform: rotate(-10deg); }
    75% { transform: rotate(15deg) translateY(-3px); }
    80% { transform: rotate(0deg); }
}

/* Splash screen Milo entrance */
#splash-milo .milo-body {
    animation: miloFloat 3s ease-in-out infinite, miloSplashEntry 0.8s ease-out;
}

@keyframes miloSplashEntry {
    0% { transform: scale(0) rotate(-20deg); opacity: 0; }
    60% { transform: scale(1.15) rotate(5deg); opacity: 1; }
    100% { transform: scale(1) rotate(0deg); opacity: 1; }
}

/* Home Milo wiggle on appear */
#home-milo .milo-body {
    animation: miloFloat 3s ease-in-out infinite, miloWiggle 0.6s ease-out;
}

@keyframes miloWiggle {
    0% { transform: rotate(-5deg); }
    25% { transform: rotate(5deg); }
    50% { transform: rotate(-3deg); }
    75% { transform: rotate(2deg); }
    100% { transform: rotate(0deg); }
}

/* Reduce motion for accessibility */
.no-animations .milo-body,
.no-animations .milo-pupil,
.no-animations .milo-eyelid,
.no-animations .milo-hand {
    animation: none !important;
}

/* Remove old mascot styles - replaced by Milo */
.mascot-large,
.header-mascot-small,
.assistant-avatar,
.assistant-face,
.assistant-eyes,
.assistant-body,
.eye,
.float-assistant-avatar {
    /* Keep for backwards compat but hide */
}

/* ================================================================
   ONBOARDING SCREEN
   ================================================================ */

#onboarding-screen {
    background: linear-gradient(180deg, #F5F0FF 0%, #E8EAF6 100%);
    z-index: 900;
}

.onboarding-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    padding: var(--space-lg);
    position: relative;
    overflow: hidden;
}

.onboarding-skip {
    position: absolute;
    top: calc(var(--space-md) + env(safe-area-inset-top, 0));
    right: var(--space-md);
    background: none;
    border: none;
    color: var(--color-text-light);
    font-size: var(--font-size-base);
    font-weight: 600;
    cursor: pointer;
    padding: var(--space-sm) var(--space-md);
    z-index: 10;
}

.onboarding-slides {
    position: relative;
    width: 100%;
    flex: 1;
    overflow: hidden;
}

.onboarding-slide {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: var(--space-md);
    padding: var(--space-md);
    transition: transform 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.onboarding-illustration {
    width: 100%;
    max-width: 280px;
    margin-bottom: var(--space-sm);
}

.onboarding-svg {
    width: 100%;
    height: auto;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
}

.onboarding-title {
    font-size: var(--font-size-xl);
    font-weight: 800;
    color: var(--color-primary);
    text-align: center;
}

.onboarding-desc {
    font-size: var(--font-size-base);
    color: var(--color-text-light);
    text-align: center;
    line-height: 1.5;
    max-width: 300px;
}

.onboarding-dots {
    display: flex;
    gap: var(--space-sm);
    margin: var(--space-lg) 0;
}

.onboarding-dot {
    width: 10px;
    height: 10px;
    border-radius: var(--radius-full);
    background: var(--color-border);
    transition: all var(--transition-fast);
    cursor: pointer;
}

.onboarding-dot.active {
    background: var(--color-primary);
    width: 28px;
    border-radius: 5px;
}

.onboarding-next-btn {
    width: 100%;
    max-width: 280px;
    margin-bottom: var(--space-lg);
}

.onboarding-start-btn {
    width: 100%;
    max-width: 280px;
    margin-top: var(--space-md);
    font-size: var(--font-size-xl);
    padding: var(--space-lg) var(--space-xl);
    background: linear-gradient(135deg, var(--color-primary), var(--color-primary-dark));
    box-shadow: 0 6px 20px rgba(124, 77, 255, 0.35);
}

.onboarding-sync-actions {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-sm);
    width: 100%;
    max-width: 280px;
    margin-top: var(--space-md);
}

.onboarding-sync-login-btn {
    width: 100%;
    font-size: var(--font-size-lg);
    padding: var(--space-md) var(--space-xl);
    background: linear-gradient(135deg, var(--color-primary), var(--color-primary-dark));
    box-shadow: 0 4px 14px rgba(124, 77, 255, 0.3);
}

.onboarding-sync-skip-btn {
    width: 100%;
    font-size: var(--font-size-base);
    padding: var(--space-sm) var(--space-xl);
    background: transparent;
    color: var(--color-text-light);
    border: 2px solid var(--color-border);
    border-radius: var(--radius-lg);
    animation: startBtnPulse 2s ease-in-out infinite;
}

@keyframes startBtnPulse {
    0%, 100% { transform: scale(1); box-shadow: 0 6px 20px rgba(124, 77, 255, 0.35); }
    50% { transform: scale(1.03); box-shadow: 0 8px 28px rgba(124, 77, 255, 0.5); }
}

/* ================================================================
   PARENT CODE MODAL (guest users)
   ================================================================ */
.parent-code-modal {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    padding: var(--space-md);
    backdrop-filter: blur(4px);
}

.parent-code-card {
    background: white;
    border-radius: var(--radius-xl);
    padding: var(--space-xl) var(--space-lg);
    max-width: 380px;
    width: 100%;
    text-align: center;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: codeModalIn 0.4s ease-out;
    max-height: 90vh;
    overflow-y: auto;
}

@keyframes codeModalIn {
    from { opacity: 0; transform: scale(0.9) translateY(20px); }
    to { opacity: 1; transform: scale(1) translateY(0); }
}

.parent-code-icon {
    margin-bottom: var(--space-md);
}

.parent-code-title {
    font-size: var(--font-size-xl);
    font-weight: 800;
    color: var(--color-primary);
    margin-bottom: var(--space-sm);
}

.parent-code-desc {
    font-size: var(--font-size-sm);
    color: var(--color-text-light);
    line-height: 1.5;
    margin-bottom: var(--space-lg);
}

.parent-code-display {
    background: linear-gradient(135deg, #EDE7F6, #E8EAF6);
    border: 3px dashed var(--color-primary);
    border-radius: var(--radius-lg);
    padding: var(--space-md) var(--space-lg);
    margin-bottom: var(--space-lg);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-sm);
}

.parent-code-text {
    font-size: 28px;
    font-weight: 900;
    color: var(--color-primary);
    letter-spacing: 3px;
    font-family: 'Courier New', monospace;
}

.parent-code-copy {
    background: none;
    border: none;
    font-size: 22px;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: var(--radius-md);
    transition: background var(--transition-fast);
}

.parent-code-copy:active {
    background: rgba(124, 77, 255, 0.15);
}

.parent-code-instructions {
    text-align: left;
    margin-bottom: var(--space-lg);
}

.parent-code-step {
    display: flex;
    align-items: flex-start;
    gap: var(--space-sm);
    margin-bottom: var(--space-sm);
    font-size: var(--font-size-sm);
    color: var(--color-text);
    line-height: 1.4;
}

.parent-code-step-num {
    background: var(--color-primary);
    color: white;
    width: 22px;
    height: 22px;
    min-width: 22px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 700;
    margin-top: 1px;
}

.parent-code-warning {
    font-size: var(--font-size-xs);
    color: #FF6F00;
    background: #FFF8E1;
    border-radius: var(--radius-md);
    padding: var(--space-sm) var(--space-md);
    margin-bottom: var(--space-lg);
    line-height: 1.4;
}

.parent-code-qr-wrap {
    text-align: center;
    margin: var(--space-md) 0;
}

.parent-code-qr-wrap canvas {
    border-radius: var(--radius-md);
    box-shadow: 0 2px 8px rgba(0,0,0,0.10);
    background: #fff;
}

.parent-code-qr-label {
    font-size: var(--font-size-sm);
    color: var(--text-secondary);
    margin-top: var(--space-xs);
}

.parent-code-continue {
    width: 100%;
    font-size: var(--font-size-lg);
    padding: var(--space-md) var(--space-xl);
}

/* ================================================================
   SECTION ILLUSTRATIONS
   ================================================================ */

.section-illustration {
    padding: 0 var(--space-md);
    margin-bottom: var(--space-sm);
}

.section-svg {
    width: 100%;
    max-height: 50px;
    border-radius: var(--radius-md);
}

/* ================================================================
   3D CARD EFFECTS - Game cards
   ================================================================ */

.game-card-3d {
    perspective: 600px;
    transform-style: preserve-3d;
    transition: transform 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94), box-shadow 0.4s ease;
    border-bottom: 4px solid var(--color-games);
}

.game-card-3d:active {
    transform: rotateY(8deg) rotateX(4deg) scale(0.95);
    box-shadow: -6px 6px 20px rgba(0,0,0,0.15);
}

/* ================================================================
   MEMORY CARD FLIP GAME
   ================================================================ */

.memory-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--space-sm);
    width: 100%;
    max-width: 340px;
    perspective: 1000px;
}

.memory-card {
    aspect-ratio: 1;
    cursor: pointer;
    perspective: 600px;
}

.memory-card-inner {
    position: relative;
    width: 100%;
    height: 100%;
    transition: transform 0.5s cubic-bezier(0.4, 0, 0.2, 1);
    transform-style: preserve-3d;
    border-radius: var(--radius-md);
}

.memory-card.flipped .memory-card-inner,
.memory-card.matched .memory-card-inner {
    transform: rotateY(180deg);
}

.memory-card-front,
.memory-card-back {
    position: absolute;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
}

.memory-card-front {
    background: linear-gradient(135deg, var(--color-games), #1E88E5);
    color: white;
    font-size: var(--font-size-xxl);
    box-shadow: var(--shadow-sm);
    border: 3px solid rgba(255,255,255,0.3);
}

.memory-card-back {
    background: var(--color-surface);
    transform: rotateY(180deg);
    font-size: 36px;
    border: 3px solid var(--color-games);
    box-shadow: var(--shadow-sm);
}

.memory-card.matched .memory-card-back {
    border-color: var(--color-success);
    background: #E8F5E9;
    animation: matchedBounce 0.4s ease;
}

@keyframes matchedBounce {
    0%, 100% { transform: rotateY(180deg) scale(1); }
    50% { transform: rotateY(180deg) scale(1.1); }
}

.memory-score {
    font-size: var(--font-size-lg);
    font-weight: 700;
    color: var(--color-text);
    text-align: center;
    padding: var(--space-md);
}

.memory-score span {
    color: var(--color-primary);
    font-size: var(--font-size-xl);
}

/* ================================================================
   ENHANCED MILO CHARACTER - More personality
   ================================================================ */

/* Add a subtle glow to Milo */
.milo-body {
    box-shadow: 0 4px 20px rgba(156, 39, 176, 0.15),
                inset 0 -4px 8px rgba(206, 147, 216, 0.2),
                0 0 30px rgba(179, 136, 255, 0.08);
}

/* Hat/accessory for Milo - star on top */
.milo-large .milo-body::before {
    content: '⭐';
    position: absolute;
    top: -14px;
    font-size: 22px;
    z-index: 5;
    animation: starBob 2s ease-in-out infinite;
}

@keyframes starBob {
    0%, 100% { transform: translateY(0) rotate(0deg); }
    50% { transform: translateY(-4px) rotate(10deg); }
}

/* Blush effect on hover for interactivity */
.milo-cheek {
    transition: opacity 0.3s ease;
}

.milo-character:hover .milo-cheek {
    opacity: 0.8;
    background: rgba(244, 143, 177, 0.55);
}

/* Milo gradient enhancement - more colorful body */
.milo-body {
    background: linear-gradient(135deg, #FFFFFF 0%, #F3E5F5 40%, #E8EAF6 100%);
}

/* ================================================================
   CALM DOWN SCREEN
   ================================================================ */

.calm-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: var(--space-md);
    gap: var(--space-md);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

/* Activity tabs */
.calm-activities {
    display: flex;
    gap: var(--space-sm);
    width: 100%;
    justify-content: center;
}

.calm-activity-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: var(--space-sm) var(--space-md);
    border: 2px solid var(--color-border);
    border-radius: var(--radius-md);
    background: var(--color-surface);
    font-size: var(--font-size-sm);
    font-weight: 600;
    color: var(--color-text);
    cursor: pointer;
    transition: all var(--transition-fast);
    flex: 1;
    max-width: 120px;
}

.calm-activity-btn.active {
    border-color: var(--color-primary);
    background: #F3E8FF;
    color: var(--color-primary);
}

.calm-activity-icon {
    font-size: 28px;
}

/* Breathing circle */
.calm-exercise {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-md);
    width: 100%;
}

.breathing-circle-container {
    position: relative;
    width: 200px;
    height: 200px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.breathing-circle {
    width: 160px;
    height: 160px;
    border-radius: 50%;
    background: linear-gradient(135deg, #E8F5E9, #C8E6C9);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: transform 4s ease-in-out, background 4s ease-in-out;
    z-index: 2;
    box-shadow: 0 4px 20px rgba(102, 187, 106, 0.3);
}

.breathing-inner-circle {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: var(--space-sm);
}

.breathing-text {
    font-size: var(--font-size-lg);
    font-weight: 700;
    color: var(--color-primary-dark);
}

.breathing-ring {
    position: absolute;
    top: 0;
    left: 0;
    width: 200px;
    height: 200px;
    border-radius: 50%;
    border: 3px solid rgba(124, 77, 255, 0.2);
    z-index: 1;
}

/* Breathing animation states */
.breathing-circle.breathing-inhale {
    transform: scale(1.3);
    background: linear-gradient(135deg, #C8E6C9, #A5D6A7);
}

.breathing-circle.breathing-hold {
    transform: scale(1.3);
    background: linear-gradient(135deg, #BBDEFB, #90CAF9);
    transition: background 2s ease-in-out;
}

.breathing-circle.breathing-exhale {
    transform: scale(1);
    background: linear-gradient(135deg, #F3E5F5, #CE93D8);
}

.breathing-counter {
    font-size: var(--font-size-sm);
    color: var(--color-text-light);
    min-height: 20px;
}

.calm-instruction {
    font-size: var(--font-size-sm);
    color: var(--color-text-light);
    text-align: center;
    max-width: 300px;
    line-height: 1.5;
}

.calm-start-btn {
    min-width: 140px;
}

.calm-start-btn.hidden {
    display: none;
}

/* Body scan */
.body-scan-figure {
    width: 200px;
    max-height: 320px;
    margin: 0 auto;
}

.body-svg {
    width: 100%;
    height: auto;
}

.body-part {
    cursor: pointer;
    transition: opacity var(--transition-fast);
}

.body-part:hover {
    opacity: 0.8;
}

.body-highlight {
    pointer-events: none;
    transition: all 0.3s ease;
}

.body-highlight.body-pulse {
    animation: bodyPulse 1.5s ease-in-out;
}

@keyframes bodyPulse {
    0% { opacity: 0; r: 20; }
    30% { opacity: 1; }
    100% { opacity: 0; }
}

.body-scan-feedback {
    min-height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: var(--font-size-base);
    font-weight: 600;
    color: var(--color-primary);
    text-align: center;
    padding: var(--space-sm) var(--space-md);
    background: #F3E8FF;
    border-radius: var(--radius-md);
    opacity: 0;
    transition: opacity var(--transition-normal);
    width: 100%;
    max-width: 300px;
}

.body-scan-feedback.show {
    opacity: 1;
}

/* Safe place */
.safe-place-scenes {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-md);
    width: 100%;
    max-width: 320px;
}

.safe-place-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-sm);
    padding: var(--space-lg);
    border: 2px solid var(--color-border);
    border-radius: var(--radius-lg);
    background: var(--color-surface);
    font-size: var(--font-size-base);
    font-weight: 600;
    color: var(--color-text);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.safe-place-card:active {
    transform: scale(0.96);
}

.safe-place-icon {
    font-size: 48px;
}

.safe-place-view {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-md);
    width: 100%;
}

.safe-place-animation {
    width: 100%;
    max-width: 320px;
    height: 200px;
    border-radius: var(--radius-lg);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.safe-place-emoji {
    font-size: 80px;
    animation: safeFloat 3s ease-in-out infinite;
}

@keyframes safeFloat {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-12px); }
}

/* ================================================================
   VISUAL TIMER SCREEN
   ================================================================ */

.timer-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: var(--space-sm) var(--space-md);
    gap: var(--space-md);
}

.timer-display {
    position: relative;
    width: 180px;
    height: 180px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.timer-svg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

.timer-center {
    position: relative;
    z-index: 2;
    text-align: center;
}

.timer-time {
    font-size: 36px;
    font-weight: 700;
    color: var(--color-primary);
    font-variant-numeric: tabular-nums;
}

.timer-label {
    font-size: var(--font-size-sm);
    color: var(--color-text-light);
}

.timer-emoji {
    position: absolute;
    bottom: 8px;
    right: 8px;
    font-size: 32px;
    z-index: 2;
}

/* Presets */
.timer-presets {
    display: flex;
    gap: var(--space-sm);
    flex-wrap: wrap;
    justify-content: center;
}

.timer-preset {
    padding: var(--space-sm) var(--space-md);
    border: 2px solid var(--color-border);
    border-radius: var(--radius-lg);
    background: var(--color-surface);
    font-size: var(--font-size-sm);
    font-weight: 600;
    color: var(--color-text);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.timer-preset.active {
    border-color: var(--color-primary);
    background: #F3E8FF;
    color: var(--color-primary);
}

/* Context labels */
.timer-contexts {
    display: flex;
    gap: var(--space-sm);
    flex-wrap: wrap;
    justify-content: center;
}

.timer-context {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: var(--space-sm) var(--space-md);
    border: 2px solid var(--color-border);
    border-radius: var(--radius-lg);
    background: var(--color-surface);
    font-size: var(--font-size-sm);
    color: var(--color-text);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.timer-context.active {
    border-color: var(--color-primary);
    background: #F3E8FF;
}

/* Timer actions */
.timer-actions {
    display: flex;
    gap: var(--space-md);
    justify-content: center;
}

.timer-start-btn {
    min-width: 120px;
}

.timer-reset-btn {
    min-width: 100px;
}

/* ================================================================
   PARENT DASHBOARD ENHANCEMENTS
   ================================================================ */

.dash-card-wide {
    grid-column: 1 / -1;
}

/* Weekly trends bar chart */
.weekly-bars {
    display: flex;
    align-items: flex-end;
    gap: var(--space-xs);
    height: 100px;
    padding: var(--space-sm) 0;
}

.weekly-bar-col {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    height: 100%;
    justify-content: flex-end;
}

.weekly-bar {
    width: 100%;
    max-width: 32px;
    background: linear-gradient(180deg, var(--color-primary), var(--color-primary-light));
    border-radius: 4px 4px 0 0;
    min-height: 4px;
    transition: height var(--transition-normal);
}

.weekly-bar-label {
    font-size: 11px;
    color: var(--color-text-light);
    font-weight: 600;
}

.weekly-summary {
    display: flex;
    justify-content: space-around;
    padding-top: var(--space-sm);
    border-top: 1px solid var(--color-border);
    margin-top: var(--space-sm);
    font-size: var(--font-size-sm);
    color: var(--color-text-light);
}

/* Behavioral insights */
.insights-list {
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
}

.insight-item {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    padding: var(--space-sm) var(--space-md);
    background: var(--color-bg);
    border-radius: var(--radius-sm);
    font-size: var(--font-size-sm);
    line-height: 1.4;
}

.insight-icon {
    font-size: 20px;
    flex-shrink: 0;
}

/* ================================================================
   PROFILE SWITCHER
   ================================================================ */

.profile-switcher {
    width: 100%;
}

.profile-list {
    display: flex;
    gap: var(--space-sm);
    overflow-x: auto;
    padding: var(--space-xs) 0;
    -webkit-overflow-scrolling: touch;
}

.profile-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: var(--space-sm) var(--space-md);
    border: 2px solid var(--color-border);
    border-radius: var(--radius-md);
    background: var(--color-surface);
    cursor: pointer;
    transition: all var(--transition-fast);
    min-width: 80px;
    position: relative;
}

.profile-item.active {
    border-color: var(--color-primary);
    background: #F3E8FF;
}

.profile-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--color-primary-light), var(--color-primary));
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: var(--font-size-lg);
    font-weight: 700;
}

.profile-name {
    font-size: var(--font-size-sm);
    font-weight: 600;
    color: var(--color-text);
    max-width: 80px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.profile-active-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    width: 20px;
    height: 20px;
    background: var(--color-success);
    color: white;
    border-radius: 50%;
    font-size: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.profile-item-row {
    display: flex;
    align-items: center;
    gap: 4px;
    position: relative;
}

.profile-delete-btn {
    width: 24px;
    height: 24px;
    border: none;
    background: var(--color-error);
    color: white;
    border-radius: 50%;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    position: absolute;
    top: -6px;
    right: -6px;
    z-index: 2;
    opacity: 0.8;
    transition: opacity var(--transition-fast);
    line-height: 1;
    padding: 0;
}

.profile-delete-btn:hover,
.profile-delete-btn:active {
    opacity: 1;
}

.profile-add-btn {
    margin-top: var(--space-sm);
    width: 100%;
}

/* ----------------------------------------------------------------
   Emotion Journal
   ---------------------------------------------------------------- */
.card-journal { border-bottom: 4px solid var(--color-emotions); }

.journal-content {
    padding: var(--space-md);
    display: flex;
    flex-direction: column;
    gap: var(--space-md);
    max-height: calc(100vh - 60px);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.journal-prompt {
    text-align: center;
}

.journal-question {
    font-size: 20px;
    font-weight: 700;
    color: var(--color-text);
}

.journal-mood-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: var(--space-sm);
}

.journal-mood-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: var(--space-sm) var(--space-xs);
    border: 3px solid transparent;
    border-radius: 16px;
    background: var(--color-surface);
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
    cursor: pointer;
    transition: transform 0.15s, border-color 0.15s, box-shadow 0.15s;
}

.journal-mood-btn:active {
    transform: scale(0.93);
}

.journal-mood-btn.selected {
    border-color: var(--mood-color);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--mood-color) 25%, transparent);
    transform: scale(1.05);
}

.journal-mood-emoji {
    font-size: 32px;
    line-height: 1;
}

.journal-mood-label {
    font-size: 11px;
    font-weight: 600;
    color: var(--color-text-light);
}

.journal-mood-btn.selected .journal-mood-label {
    color: var(--color-text);
}

.journal-note-section {
    display: flex;
    flex-direction: column;
    gap: var(--space-xs);
}

.journal-note-label {
    font-size: var(--font-size-sm);
    color: var(--color-text-light);
    font-weight: 600;
}

.journal-note-input {
    width: 100%;
    padding: var(--space-sm) var(--space-md);
    border: 2px solid var(--color-border);
    border-radius: 12px;
    font-family: var(--font-family);
    font-size: var(--font-size-base);
    resize: none;
    box-sizing: border-box;
    transition: border-color 0.2s;
}

.journal-note-input:focus {
    outline: none;
    border-color: var(--color-emotions);
}

.journal-save-btn {
    width: 100%;
    font-size: 18px;
    padding: 14px;
    border-radius: 16px;
    background: var(--color-emotions);
}

.journal-save-btn.disabled {
    opacity: 0.4;
    pointer-events: none;
}

/* Journal Calendar */
.journal-calendar {
    background: var(--color-surface);
    border-radius: 16px;
    padding: var(--space-md);
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}

.journal-cal-header {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    text-align: center;
    margin-bottom: var(--space-xs);
}

.journal-cal-day-name {
    font-size: 11px;
    font-weight: 700;
    color: var(--color-text-light);
    text-transform: uppercase;
}

.journal-cal-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 2px;
}

.journal-cal-cell {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 4px 0;
    border-radius: 8px;
}

.journal-cal-cell.today {
    background: var(--color-emotions-light);
}

.journal-cal-cell.empty {
    visibility: hidden;
}

.journal-cal-date {
    font-size: 11px;
    font-weight: 600;
    color: var(--color-text-light);
}

.journal-cal-emoji {
    font-size: 18px;
    line-height: 1;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
}

.journal-cal-emoji.empty-mood {
    font-size: 24px;
    color: var(--color-border);
}

/* Recent entries */
.journal-recent {
    margin-top: var(--space-sm);
}

.journal-recent-title {
    font-size: var(--font-size-sm);
    font-weight: 700;
    color: var(--color-text-light);
    margin-bottom: var(--space-sm);
}

.journal-entry-card {
    background: var(--color-surface);
    border-radius: 12px;
    padding: var(--space-sm) var(--space-md);
    margin-bottom: var(--space-sm);
    box-shadow: 0 1px 4px rgba(0,0,0,0.05);
}

.journal-entry-header {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}

.journal-entry-emoji {
    font-size: 20px;
}

.journal-entry-mood {
    font-weight: 700;
    font-size: var(--font-size-sm);
    color: var(--color-text);
    flex: 1;
}

.journal-entry-date,
.journal-entry-time {
    font-size: 12px;
    color: var(--color-text-light);
}

.journal-entry-note {
    margin: 4px 0 0;
    font-size: var(--font-size-sm);
    color: var(--color-text-light);
    line-height: 1.4;
}

/* ----------------------------------------------------------------
   Emotion Regulation Strategies
   ---------------------------------------------------------------- */
.emotion-strategies {
    padding: 0 var(--space-md) var(--space-md);
}

.strat-title {
    font-size: var(--font-size-sm);
    font-weight: 700;
    color: var(--color-text-light);
    margin-bottom: var(--space-sm);
}

.strat-list {
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
}

.strat-card {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    padding: var(--space-sm) var(--space-md);
    background: var(--color-surface);
    border: 2px solid var(--color-border);
    border-radius: 14px;
    cursor: pointer;
    transition: transform 0.1s, border-color 0.15s;
    text-align: left;
}

.strat-card:active {
    transform: scale(0.97);
}

.strat-card[data-strat-action] {
    border-color: var(--color-communicate);
}

.strat-card[data-strat-action]:active {
    background: var(--color-communicate-light);
}

.strat-emoji {
    font-size: 28px;
    flex-shrink: 0;
}

.strat-label {
    flex: 1;
    font-size: var(--font-size-base);
    font-weight: 600;
    color: var(--color-text);
}

.strat-go {
    font-size: 20px;
    color: var(--color-communicate);
    font-weight: 800;
}

/* ----------------------------------------------------------------
   First/Then Board
   ---------------------------------------------------------------- */
.card-firstthen { border-bottom: 4px solid var(--color-games); }

.ft-content {
    flex: 1;
    padding: var(--space-md);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-lg);
    position: relative;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.ft-board {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    width: 100%;
}

.ft-slot {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-sm);
}

.ft-slot-header {
    font-size: 18px;
    font-weight: 800;
    letter-spacing: 1px;
    text-transform: uppercase;
    padding: 4px 16px;
    border-radius: 20px;
}

.ft-first-header {
    background: #E3F2FD;
    color: #1565C0;
}

.ft-then-header {
    background: #E8F5E9;
    color: #2E7D32;
}

.ft-card {
    width: 100%;
    aspect-ratio: 1;
    max-width: 160px;
    border-radius: 20px;
    border: 3px dashed var(--color-border);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: transform 0.15s, border-color 0.2s, box-shadow 0.2s;
    background: var(--color-surface);
    position: relative;
}

.ft-card:active {
    transform: scale(0.95);
}

.ft-card.has-activity {
    border-style: solid;
    border-color: #42A5F5;
    box-shadow: 0 4px 16px rgba(66,165,245,0.15);
}

#ft-then-card.has-activity {
    border-color: #66BB6A;
    box-shadow: 0 4px 16px rgba(102,187,106,0.15);
}

.ft-card.done {
    opacity: 0.5;
    border-color: var(--color-success);
}

.ft-card.ft-unlocked {
    opacity: 1;
    border-color: var(--color-success);
    animation: ftPulse 1s ease-in-out infinite;
}

@keyframes ftPulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(102,187,106,0.3); }
    50% { box-shadow: 0 0 0 12px rgba(102,187,106,0); }
}

.ft-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

.ft-empty-icon {
    font-size: 36px;
    color: var(--color-border);
    font-weight: 300;
}

.ft-empty-label {
    font-size: var(--font-size-sm);
    color: var(--color-text-light);
}

.ft-card-emoji {
    font-size: 48px;
    line-height: 1;
}

.ft-card-label {
    font-size: 14px;
    font-weight: 700;
    color: var(--color-text);
    margin-top: 4px;
    text-align: center;
}

.ft-done-check {
    position: absolute;
    top: -8px;
    right: -8px;
    width: 28px;
    height: 28px;
    background: var(--color-success);
    color: white;
    border-radius: 50%;
    font-size: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
}

.ft-arrow {
    flex-shrink: 0;
    padding-top: 28px;
}

.ft-done-btn {
    width: 80%;
    max-width: 280px;
    font-size: 22px;
    padding: 16px;
    border-radius: 20px;
    background: var(--color-success);
}

/* Activity Picker */
.ft-picker {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.3);
    z-index: 100;
    display: flex;
    align-items: flex-end;
    padding: var(--space-md);
}

.ft-picker.hidden {
    display: none;
}

.ft-picker-grid {
    background: var(--color-surface);
    border-radius: 20px 20px 0 0;
    padding: var(--space-md);
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: var(--space-sm);
    max-height: 60vh;
    overflow-y: auto;
    width: 100%;
}

.ft-picker-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: var(--space-sm);
    border: 2px solid var(--color-border);
    border-radius: 12px;
    background: var(--color-surface);
    cursor: pointer;
    transition: transform 0.1s;
}

.ft-picker-item:active {
    transform: scale(0.9);
    border-color: var(--color-primary);
}

.ft-picker-emoji {
    font-size: 28px;
}

.ft-picker-label {
    font-size: 10px;
    font-weight: 600;
    color: var(--color-text);
    text-align: center;
    line-height: 1.2;
}

/* ----------------------------------------------------------------
   Sensory Preferences
   ---------------------------------------------------------------- */
.settings-group-desc {
    font-size: var(--font-size-sm);
    color: var(--color-text-light);
    margin: -4px 0 var(--space-sm);
}

.range-value {
    font-size: var(--font-size-sm);
    font-weight: 600;
    color: var(--color-primary);
    min-width: 36px;
    text-align: right;
}

/* Visual Soft mode - muted pastel colors */
.visual-soft {
    --color-primary: #9575CD;
    --color-primary-light: #D1C4E9;
    --color-communicate: #81C784;
    --color-communicate-light: #E8F5E9;
    --color-emotions: #FFE082;
    --color-emotions-light: #FFF8E1;
    --color-games: #64B5F6;
    --color-games-light: #E3F2FD;
    --color-voice: #BA68C8;
    --color-voice-light: #F3E5F5;
    --color-routine: #FFB74D;
    --color-routine-light: #FFF3E0;
    --color-parent: #E57373;
    --color-parent-light: #FFEBEE;
    filter: saturate(0.7);
}

/* Visual Minimal mode - very low saturation */
.visual-minimal {
    --color-primary: #9E9E9E;
    --color-primary-light: #E0E0E0;
    --color-communicate: #A5D6A7;
    --color-emotions: #E0E0E0;
    --color-games: #B0BEC5;
    --color-voice: #CE93D8;
    --color-routine: #BCAAA4;
    --color-parent: #EF9A9A;
    filter: saturate(0.35);
}

/* Reduced motion */
.reduce-motion,
.reduce-motion * {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
}

.reduce-motion .breathing-circle {
    animation: none !important;
}

.reduce-motion .slide-in,
.reduce-motion .slide-out {
    animation: none !important;
}

/* ----------------------------------------------------------------
   Session Time Display
   ---------------------------------------------------------------- */
.session-total {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-bottom: var(--space-md);
}

.session-total-time {
    font-size: 28px;
    font-weight: 800;
    color: var(--color-primary);
}

.session-total-label {
    font-size: var(--font-size-sm);
    color: var(--color-text-light);
}

.session-breakdown {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.session-bar-row {
    display: grid;
    grid-template-columns: 24px 70px 1fr 50px;
    align-items: center;
    gap: 6px;
}

.session-bar-icon {
    font-size: 16px;
    text-align: center;
}

.session-bar-label {
    font-size: 12px;
    font-weight: 600;
    color: var(--color-text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.session-bar-track {
    height: 8px;
    background: var(--color-border);
    border-radius: 4px;
    overflow: hidden;
}

.session-bar-fill {
    height: 100%;
    background: var(--color-primary-light);
    border-radius: 4px;
    transition: width 0.3s ease;
}

.session-bar-time {
    font-size: 11px;
    font-weight: 600;
    color: var(--color-text-light);
    text-align: right;
}

/* ================================================================
   SETUP SCREEN (First-time parent configuration)
   ================================================================ */
.setup-content {
    padding: var(--space-md);
    display: flex;
    flex-direction: column;
    gap: var(--space-md);
    max-height: calc(100vh - 60px);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.setup-dots {
    display: flex;
    justify-content: center;
    gap: 8px;
}

.setup-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--color-border);
    transition: background 0.3s, transform 0.3s;
}

.setup-dot.active {
    background: var(--color-primary);
    transform: scale(1.3);
}

.setup-step {
    display: none;
    flex-direction: column;
    align-items: center;
    gap: var(--space-md);
    animation: setupFadeIn 0.4s ease;
}

.setup-step.active {
    display: flex;
}

@keyframes setupFadeIn {
    from { opacity: 0; transform: translateX(30px); }
    to { opacity: 1; transform: translateX(0); }
}

.setup-step-icon {
    font-size: 48px;
    line-height: 1;
}

.setup-step-title {
    font-size: 22px;
    font-weight: 800;
    color: var(--color-text);
    text-align: center;
}

.setup-step-desc {
    font-size: 14px;
    color: var(--color-text-light);
    text-align: center;
    max-width: 340px;
    line-height: 1.5;
}

/* Setup form */
.setup-form {
    width: 100%;
    max-width: 360px;
    display: flex;
    flex-direction: column;
    gap: var(--space-md);
}

.setup-field {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.setup-label {
    font-size: 13px;
    font-weight: 700;
    color: var(--color-text);
}

.setup-input,
.setup-select {
    padding: 12px 16px;
    border: 2px solid var(--color-border);
    border-radius: 12px;
    font-size: 16px;
    background: var(--color-surface);
    color: var(--color-text);
    transition: border-color 0.2s;
    -webkit-appearance: none;
}

.setup-input:focus,
.setup-select:focus {
    border-color: var(--color-primary);
    outline: none;
}

.setup-hint {
    font-size: 11px;
    color: var(--color-text-light);
    margin-top: 2px;
}

/* Setup info cards */
.setup-info-cards {
    width: 100%;
    max-width: 400px;
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
}

.setup-info-card {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 14px 16px;
    background: var(--color-surface);
    border-radius: 14px;
    border: 1px solid var(--color-border);
    box-shadow: 0 2px 6px rgba(0,0,0,0.04);
}

.setup-info-icon {
    font-size: 28px;
    line-height: 1;
    flex-shrink: 0;
}

.setup-info-text h4 {
    font-size: 14px;
    font-weight: 700;
    color: var(--color-text);
    margin-bottom: 2px;
}

.setup-info-text p {
    font-size: 12px;
    color: var(--color-text-light);
    line-height: 1.4;
}

/* Remote tip box */
.setup-remote-tip {
    width: 100%;
    max-width: 400px;
    background: linear-gradient(135deg, #EDE7F6, #E8EAF6);
    border: 2px solid var(--color-primary);
    border-radius: 14px;
    padding: 16px;
    text-align: center;
}

.setup-remote-tip p {
    font-size: 13px;
    color: var(--color-text);
    line-height: 1.5;
}

.setup-remote-tip strong {
    color: var(--color-primary);
}

/* Setup navigation */
.setup-nav {
    display: flex;
    justify-content: space-between;
    gap: var(--space-md);
    padding: var(--space-md) var(--space-lg);
    width: 100%;
    max-width: 400px;
    margin: 0 auto;
    position: sticky;
    bottom: 0;
    background: linear-gradient(to top, var(--color-background) 70%, transparent);
    padding-top: var(--space-xl);
    z-index: 10;
}

.setup-optional-badge {
    font-size: var(--font-size-xs);
    font-weight: 400;
    color: var(--color-text-light);
    font-style: italic;
}

.setup-nav-btn {
    padding: 14px 28px;
    border-radius: 14px;
    font-size: 16px;
    font-weight: 700;
    border: none;
    cursor: pointer;
    transition: transform 0.15s, box-shadow 0.15s;
}

.setup-nav-btn:active { transform: scale(0.95); }

.setup-prev {
    background: var(--color-border);
    color: var(--color-text);
}

.setup-next {
    background: var(--color-primary);
    color: white;
    box-shadow: 0 4px 12px rgba(124, 77, 255, 0.3);
    flex: 1;
}

/* ----------------------------------------------------------------
   Reward Shop
   ---------------------------------------------------------------- */
/* ================================================================
   LA TIENDA DE LUNA (Store)
   ================================================================ */
.card-store { border-bottom: 4px solid #FF9800; }

/* Luna Coins Badge (header + store) */
.luna-coins-header,
.luna-coins-badge {
    display: flex;
    align-items: center;
    gap: 4px;
    background: linear-gradient(135deg, #FFF8E1, #FFE082);
    padding: 4px 12px;
    border-radius: 20px;
    font-weight: 800;
    font-size: 15px;
    color: #E65100;
    box-shadow: 0 2px 8px rgba(255,152,0,0.2);
}

.luna-coin-icon { font-size: 16px; line-height: 1; }
.luna-coin-count { min-width: 16px; text-align: center; }

/* Store content layout */
.store-content {
    padding: var(--space-md);
    display: flex;
    flex-direction: column;
    gap: var(--space-md);
    max-height: calc(100vh - 60px);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

/* Luna preview in store */
.store-luna-preview {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: var(--space-md) 0;
}

.store-luna-preview .milo-character {
    position: relative;
}

.store-luna-label {
    font-size: 14px;
    font-weight: 600;
    color: var(--color-text-light);
    text-align: center;
    transition: color 0.3s;
}

.store-label-shake {
    color: #E65100;
    animation: storeLabelShake 0.4s ease;
}

@keyframes storeLabelShake {
    0%, 100% { transform: translateX(0); }
    20% { transform: translateX(-6px); }
    40% { transform: translateX(6px); }
    60% { transform: translateX(-4px); }
    80% { transform: translateX(4px); }
}

/* Luna accessory layer */
.luna-accessory-layer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 5;
}

.luna-acc-svg {
    position: absolute;
}

.luna-acc-cap {
    width: 70%;
    left: 15%;
    top: -18%;
}

.luna-acc-sunglasses {
    width: 80%;
    left: 10%;
    top: 28%;
}

.luna-acc-cape {
    width: 80%;
    left: 10%;
    top: 70%;
}

/* Tiny milo accessories scale */
.milo-tiny .luna-acc-cap { top: -22%; }
.milo-tiny .luna-acc-sunglasses { top: 25%; width: 85%; left: 7%; }
.milo-tiny .luna-acc-cape { top: 65%; }

/* Store sections */
.store-section {
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
}

.store-section-title {
    font-size: 16px;
    font-weight: 700;
    color: var(--color-text);
}

/* Store items grid */
.store-items-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: var(--space-sm);
}

.store-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 10px 6px;
    border: 2px solid var(--color-border);
    border-radius: 16px;
    background: var(--color-surface);
    cursor: pointer;
    transition: transform 0.15s, border-color 0.15s, box-shadow 0.15s;
    position: relative;
}

.store-item:active:not(.locked) {
    transform: scale(0.93);
}

.store-item.active {
    border-color: #FF9800;
    background: #FFF3E0;
    box-shadow: 0 2px 12px rgba(255,152,0,0.25);
}

.store-item.owned {
    border-color: var(--color-success);
    background: #F1F8E9;
}

.store-item.locked {
    opacity: 0.4;
    cursor: not-allowed;
}

.store-item-preview {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.store-item-emoji {
    font-size: 28px;
    line-height: 1;
    background: none;
}

.store-item-name {
    font-size: 11px;
    font-weight: 600;
    color: var(--color-text);
    text-align: center;
    line-height: 1.2;
}

.store-item-cost {
    font-size: 12px;
    font-weight: 700;
    color: #E65100;
}

.store-item-status {
    font-size: 11px;
    font-weight: 700;
    color: var(--color-success);
}

.store-item-use {
    color: #1565C0;
}

/* Purchase celebration */
.store-celebration {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    animation: storeOverlayIn 0.3s ease;
}

.store-celebration.hidden { display: none; }

.store-celebration-content {
    background: white;
    border-radius: 24px;
    padding: 32px 40px;
    text-align: center;
    animation: storeCelebBounce 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    box-shadow: 0 8px 40px rgba(0,0,0,0.2);
}

.store-celebration-msg {
    font-size: 20px;
    font-weight: 800;
    color: var(--color-text);
    margin: 0;
}

@keyframes storeOverlayIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes storeCelebBounce {
    0% { transform: scale(0.3); opacity: 0; }
    60% { transform: scale(1.05); }
    100% { transform: scale(1); opacity: 1; }
}

/* Luna celebrating animation */
.luna-celebrating .milo-body {
    animation: lunaCelebrate 0.3s ease infinite alternate !important;
}

@keyframes lunaCelebrate {
    0% { transform: scale(1) rotate(-5deg); }
    100% { transform: scale(1.1) rotate(5deg); }
}

/* Responsive: 3 columns on small screens */
@media (max-width: 374px) {
    .store-items-grid {
        grid-template-columns: repeat(3, 1fr);
    }
    .store-item-preview { width: 40px; height: 40px; }
    .store-item-emoji { font-size: 24px; }
}

/* ================================================================
   MILESTONES & BADGES
   ================================================================ */

.milestones-content {
    padding: 16px;
    padding-bottom: 32px;
    overflow-y: auto;
    flex: 1;
}

.milestones-section {
    margin-top: 20px;
}

.milestones-section-title {
    font-size: 18px;
    font-weight: 700;
    color: var(--color-text);
    margin-bottom: 12px;
}

/* Progress stat cards */
.progress-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
}

.progress-stat-card {
    background: white;
    border-radius: 14px;
    padding: 12px 8px;
    text-align: center;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

.progress-stat-emoji {
    font-size: 24px;
}

.progress-stat-value {
    font-size: 22px;
    font-weight: 800;
    color: var(--color-primary);
}

.progress-stat-label {
    font-size: 11px;
    font-weight: 600;
    color: var(--color-text-light);
}

/* Badge count */
.badge-count {
    text-align: center;
    padding: 8px 0 12px;
    font-size: 16px;
    color: var(--color-text-light);
}

.badge-count-num {
    font-size: 24px;
    font-weight: 800;
    color: #AB47BC;
}

.badge-count-sep {
    font-size: 18px;
    color: var(--color-text-light);
    margin: 0 2px;
}

.badge-count-total {
    font-size: 18px;
    font-weight: 600;
    color: var(--color-text-light);
}

.badge-count-label {
    font-weight: 600;
}

/* Badge grid */
.badge-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
}

.badge-item {
    background: white;
    border-radius: 14px;
    padding: 14px 8px 10px;
    text-align: center;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    opacity: 0.6;
    filter: grayscale(0.5);
    transition: all 0.3s ease;
}

.badge-item.earned {
    opacity: 1;
    filter: none;
    border: 2px solid #AB47BC;
    box-shadow: 0 2px 12px rgba(171,71,188,0.15);
}

.badge-icon {
    font-size: 32px;
    line-height: 1;
}

.badge-label {
    font-size: 11px;
    font-weight: 600;
    color: var(--color-text);
    line-height: 1.2;
}

.badge-item:not(.earned) .badge-label {
    color: var(--color-text-light);
}

.badge-progress {
    width: 100%;
    height: 4px;
    background: #eee;
    border-radius: 2px;
    overflow: hidden;
}

.badge-progress-bar {
    height: 100%;
    background: linear-gradient(90deg, #CE93D8, #AB47BC);
    border-radius: 2px;
    transition: width 0.5s ease;
}

.badge-progress-text {
    font-size: 9px;
    color: var(--color-text-light);
    font-weight: 600;
}

.card-milestones .card-svg { background: #F3E5F5; border-radius: 16px; }

/* ================================================================
   TRANSITION WARNING OVERLAY
   ================================================================ */

.transition-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.5);
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    animation: fadeIn 0.3s ease;
}

.transition-overlay.hidden {
    display: none;
}

.transition-content {
    background: white;
    border-radius: 24px;
    padding: 28px 24px;
    text-align: center;
    max-width: 300px;
    width: 100%;
    box-shadow: 0 8px 32px rgba(0,0,0,0.15);
}

.transition-icon {
    font-size: 48px;
    margin-bottom: 8px;
    animation: pulse 1s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

.transition-message {
    font-size: 18px;
    font-weight: 700;
    color: var(--color-text);
    margin-bottom: 12px;
    line-height: 1.3;
}

.transition-countdown {
    font-size: 48px;
    font-weight: 800;
    color: #FF9800;
    margin: 8px 0;
    font-variant-numeric: tabular-nums;
}

.transition-bar {
    width: 100%;
    height: 8px;
    background: #eee;
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 20px;
}

.transition-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, #FFB74D, #FF9800);
    border-radius: 4px;
    transition: width 1s linear;
    width: 100%;
}

.transition-actions {
    display: flex;
    gap: 12px;
}

.transition-btn {
    flex: 1;
    padding: 12px 16px;
    border-radius: 12px;
    font-size: 16px;
    font-weight: 700;
    border: none;
    cursor: pointer;
}

.transition-btn.btn-secondary {
    background: #f5f5f5;
    color: var(--color-text);
}

.transition-btn.btn-primary {
    background: var(--color-primary);
    color: white;
}

/* ----------------------------------------------------------------
   Notifications Overlay & In-App Alerts
   ---------------------------------------------------------------- */
.notif-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 10000;
    padding: 12px;
    transform: translateY(-100%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    pointer-events: none;
}
.notif-overlay.visible {
    transform: translateY(0);
    pointer-events: auto;
}

.notif-content {
    background: white;
    border-radius: 16px;
    padding: 16px;
    display: flex;
    align-items: flex-start;
    gap: 12px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.15), 0 2px 8px rgba(0,0,0,0.1);
    position: relative;
}

.notif-warning .notif-content { border-left: 4px solid #FF9800; }
.notif-limit .notif-content { border-left: 4px solid var(--color-error); }
.notif-break .notif-content { border-left: 4px solid #2196F3; }
.notif-emotion .notif-content { border-left: 4px solid var(--color-primary); }
.notif-success .notif-content { border-left: 4px solid var(--color-success); }
.notif-info .notif-content { border-left: 4px solid #607D8B; }

.notif-icon {
    font-size: 28px;
    flex-shrink: 0;
    line-height: 1;
}

.notif-text {
    flex: 1;
    min-width: 0;
}

.notif-title {
    font-weight: 700;
    font-size: 15px;
    color: var(--color-text);
    margin-bottom: 4px;
}

.notif-message {
    font-size: 13px;
    color: var(--color-text-light);
    line-height: 1.4;
}

.notif-close {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 24px;
    height: 24px;
    border: none;
    background: transparent;
    font-size: 18px;
    color: var(--color-text-light);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    padding: 0;
}
.notif-close:hover { background: rgba(0,0,0,0.05); }

.notif-actions {
    display: flex;
    gap: 8px;
    padding: 8px 16px 12px;
    background: white;
    border-radius: 0 0 16px 16px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.15);
    margin-top: -8px;
}

.notif-action-btn {
    flex: 1;
    padding: 10px 16px;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 600;
    border: 2px solid #e0e0e0;
    background: white;
    color: var(--color-text);
    cursor: pointer;
    transition: all var(--transition-fast);
}
.notif-action-btn.primary {
    background: var(--color-primary);
    color: white;
    border-color: var(--color-primary);
}
.notif-action-btn:hover { opacity: 0.85; }

/* Time Limit / Schedule Block Overlay */
.time-limit-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, #1a0533 0%, #2d1b69 50%, #1a237e 100%);
    z-index: 10001;
    display: none;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
}
.time-limit-overlay.visible {
    opacity: 1;
}

.time-limit-content {
    text-align: center;
    padding: 40px 32px;
    max-width: 340px;
}

.time-limit-icon {
    font-size: 72px;
    margin-bottom: 24px;
    animation: float 3s ease-in-out infinite;
}

@keyframes float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

.time-limit-title {
    font-size: 28px;
    font-weight: 800;
    color: white;
    margin-bottom: 16px;
}

.time-limit-msg {
    font-size: 16px;
    color: rgba(255,255,255,0.85);
    line-height: 1.5;
    margin-bottom: 12px;
}

.time-limit-sub {
    font-size: 13px;
    color: rgba(255,255,255,0.5);
    margin-bottom: 32px;
}

.time-limit-unlock-btn {
    padding: 14px 32px;
    border-radius: 14px;
    font-size: 16px;
    font-weight: 700;
    border: 2px solid rgba(255,255,255,0.2);
    background: rgba(255,255,255,0.1);
    color: rgba(255,255,255,0.7);
    cursor: pointer;
    transition: all var(--transition-fast);
    backdrop-filter: blur(10px);
}
.time-limit-unlock-btn:hover,
.time-limit-unlock-btn:active {
    background: rgba(255,255,255,0.2);
    color: white;
}

.time-limit-remote-hint {
    font-size: 12px;
    color: rgba(255,255,255,0.45);
    margin-bottom: 24px;
    font-style: italic;
}

.time-limit-stars .twinkle-star {
    position: absolute;
    font-size: 14px;
    animation: twinkle 2s ease-in-out infinite;
}
.twinkle-star:nth-child(2) { animation-delay: 0.5s; }
.twinkle-star:nth-child(3) { animation-delay: 1s; }
.twinkle-star:nth-child(4) { animation-delay: 1.5s; }
@keyframes twinkle {
    0%, 100% { opacity: 0.3; transform: scale(0.8); }
    50% { opacity: 1; transform: scale(1.2); }
}

/* ================================================================
   Milo Sleepy Pre-Warning Overlay
   Appears 5 minutes before lock with a gentle, loving message
   ================================================================ */
.milo-sleepy-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(26, 5, 51, 0.85);
    z-index: 10002;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.4s ease;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}
.milo-sleepy-overlay.visible {
    opacity: 1;
}

.milo-sleepy-content {
    text-align: center;
    padding: 32px 24px;
    max-width: 320px;
    animation: miloSlideUp 0.5s ease-out;
}

@keyframes miloSlideUp {
    from { transform: translateY(40px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

.milo-sleepy-character {
    position: relative;
    margin-bottom: 20px;
}

.milo-sleepy-avatar {
    display: inline-block;
    animation: miloSway 3s ease-in-out infinite;
    filter: drop-shadow(0 4px 20px rgba(124, 77, 255, 0.5));
}

@keyframes miloSway {
    0%, 100% { transform: rotate(-3deg); }
    50% { transform: rotate(3deg); }
}

.milo-zzz {
    position: absolute;
    top: -10px;
    right: 15%;
    font-size: 28px;
    animation: zzzFloat 2s ease-in-out infinite;
}

@keyframes zzzFloat {
    0% { opacity: 0; transform: translateY(0) scale(0.5); }
    50% { opacity: 1; transform: translateY(-15px) scale(1); }
    100% { opacity: 0; transform: translateY(-30px) scale(0.7); }
}

.milo-sleepy-bubble {
    background: rgba(255, 255, 255, 0.12);
    border-radius: 20px;
    padding: 20px 24px;
    margin-bottom: 24px;
    position: relative;
    border: 1px solid rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(10px);
}
.milo-sleepy-bubble::before {
    content: '';
    position: absolute;
    top: -10px;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 0;
    border-left: 10px solid transparent;
    border-right: 10px solid transparent;
    border-bottom: 10px solid rgba(255, 255, 255, 0.12);
}

.milo-sleepy-text {
    color: white;
    font-size: 17px;
    line-height: 1.6;
    font-weight: 600;
    margin: 0;
}

.milo-sleepy-ok-btn {
    padding: 14px 36px;
    border-radius: 50px;
    font-size: 16px;
    font-weight: 700;
    border: none;
    background: linear-gradient(135deg, #7C4DFF, #B388FF);
    color: white;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(124, 77, 255, 0.4);
}
.milo-sleepy-ok-btn:hover,
.milo-sleepy-ok-btn:active {
    transform: scale(1.05);
    box-shadow: 0 6px 20px rgba(124, 77, 255, 0.6);
}

/* ================================================================
   Milo Celebration Overlay (Remote Unlock)
   Happy Milo when parent grants extra time from their phone
   ================================================================ */
.milo-celebration .milo-sleepy-content {
    animation: miloBounceIn 0.6s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes miloBounceIn {
    0% { transform: scale(0.3) translateY(40px); opacity: 0; }
    50% { transform: scale(1.05); }
    100% { transform: scale(1) translateY(0); opacity: 1; }
}

.milo-happy-bounce {
    animation: miloHappyBounce 0.6s ease-in-out infinite !important;
}

@keyframes miloHappyBounce {
    0%, 100% { transform: translateY(0) rotate(0deg); }
    25% { transform: translateY(-8px) rotate(-5deg); }
    75% { transform: translateY(-8px) rotate(5deg); }
}

.milo-celebration-confetti {
    position: absolute;
    top: -15px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 36px;
    animation: confettiPop 1s ease-out;
}

@keyframes confettiPop {
    0% { transform: translateX(-50%) scale(0) rotate(0deg); }
    50% { transform: translateX(-50%) scale(1.3) rotate(180deg); }
    100% { transform: translateX(-50%) scale(1) rotate(360deg); }
}

.milo-celebration-bubble {
    background: rgba(76, 175, 80, 0.2) !important;
    border-color: rgba(76, 175, 80, 0.3) !important;
}

.milo-celebration-btn {
    background: linear-gradient(135deg, #4CAF50, #66BB6A) !important;
    box-shadow: 0 4px 15px rgba(76, 175, 80, 0.4) !important;
}
.milo-celebration-btn:hover,
.milo-celebration-btn:active {
    box-shadow: 0 6px 20px rgba(76, 175, 80, 0.6) !important;
}

/* ================================================================
   Inline PIN Entry (on top of lock screens)
   ================================================================ */
.inline-pin-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(10, 2, 30, 0.92);
    z-index: 10005;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}
.inline-pin-overlay.visible { opacity: 1; }

.inline-pin-content {
    text-align: center;
    padding: 28px 24px;
    max-width: 300px;
    width: 100%;
    animation: miloSlideUp 0.4s ease-out;
}

.inline-pin-title {
    color: white;
    font-size: 20px;
    font-weight: 700;
    margin-bottom: 24px;
}

.inline-pin-dots {
    display: flex;
    justify-content: center;
    gap: 16px;
    margin-bottom: 12px;
}
.inline-pin-dots .pin-dot {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    border: 2px solid rgba(255,255,255,0.4);
    background: transparent;
    transition: all 0.2s ease;
}
.inline-pin-dots .pin-dot.filled {
    background: #7C4DFF;
    border-color: #B388FF;
    box-shadow: 0 0 8px rgba(124, 77, 255, 0.6);
}

.inline-pin-error {
    color: #FF5252;
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 8px;
    min-height: 20px;
}
.inline-pin-error.hidden { visibility: hidden; }

.inline-pin-keypad {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    max-width: 240px;
    margin: 16px auto;
}

.inline-pin-key {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    border: 2px solid rgba(255,255,255,0.2);
    background: rgba(255,255,255,0.08);
    color: white;
    font-size: 24px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.15s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto;
}
.inline-pin-key:hover,
.inline-pin-key:active {
    background: rgba(124, 77, 255, 0.3);
    border-color: #7C4DFF;
    transform: scale(1.08);
}
.inline-pin-empty {
    visibility: hidden;
}
.inline-pin-delete {
    font-size: 20px;
    color: rgba(255,255,255,0.6);
}

.inline-pin-cancel {
    margin-top: 16px;
    padding: 10px 32px;
    border-radius: 50px;
    border: 1px solid rgba(255,255,255,0.2);
    background: transparent;
    color: rgba(255,255,255,0.5);
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s ease;
}
.inline-pin-cancel:hover { color: white; border-color: rgba(255,255,255,0.4); }

/* Notification Settings UI */
.notif-remaining-time {
    text-align: center;
    padding: 16px;
    margin-top: 16px;
    background: linear-gradient(135deg, #E8F5E9, #C8E6C9);
    border-radius: 12px;
    font-size: 15px;
}
.remaining-label {
    color: var(--color-text-light);
}
.remaining-value {
    font-weight: 700;
    color: var(--color-success-dark, #2E7D32);
    font-size: 18px;
    margin-left: 4px;
}

/* Schedule day buttons */
.schedule-days {
    display: flex;
    gap: 6px;
    justify-content: center;
    margin-top: 12px;
}
.schedule-day-btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 2px solid #e0e0e0;
    background: white;
    font-size: 13px;
    font-weight: 700;
    color: var(--color-text-light);
    cursor: pointer;
    transition: all var(--transition-fast);
    display: flex;
    align-items: center;
    justify-content: center;
}
.schedule-day-btn.active {
    background: var(--color-primary);
    color: white;
    border-color: var(--color-primary);
}

.schedule-time-inputs {
    display: flex;
    gap: 16px;
    justify-content: center;
    flex-wrap: wrap;
}
.schedule-time-inputs label {
    font-size: 14px;
    color: var(--color-text-light);
}
.schedule-time-inputs input[type="time"] {
    padding: 8px 12px;
    border: 2px solid #e0e0e0;
    border-radius: 10px;
    font-size: 15px;
    font-weight: 600;
    color: var(--color-text);
    margin-left: 4px;
}

.schedule-times.hidden {
    display: none;
}

.settings-subtitle {
    font-size: 16px;
    font-weight: 700;
    color: var(--color-text);
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 2px solid #f0f0f0;
}

/* ----------------------------------------------------------------
   Firebase Diagnostic
   ---------------------------------------------------------------- */
/* ================================================================
   App Usage Stats (Parent Dashboard - uso_app)
   ================================================================ */
.uso-app-card {
    border: 2px solid #E1BEE7;
    background: linear-gradient(135deg, #F3E5F5, #FCE4EC) !important;
}

.uso-stat-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
    margin-bottom: 20px;
}

.uso-stat-item {
    text-align: center;
    padding: 12px 6px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 2px 6px rgba(0,0,0,0.06);
}

.uso-stat-number {
    font-size: 28px;
    font-weight: 800;
    color: #7C4DFF;
    line-height: 1;
}

.uso-stat-label {
    font-size: 10px;
    color: #666;
    margin-top: 4px;
    line-height: 1.2;
}

.uso-chart-container {
    margin-bottom: 16px;
}
.uso-chart-container h4 {
    font-size: 13px;
    color: #555;
    margin-bottom: 10px;
    font-weight: 600;
}

.uso-chart {
    display: flex;
    align-items: flex-end;
    gap: 6px;
    height: 100px;
    padding: 0 4px;
}

.uso-chart-day {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    height: 100%;
    justify-content: flex-end;
}

.uso-chart-bars {
    display: flex;
    gap: 2px;
    align-items: flex-end;
    height: 80px;
}

.uso-bar {
    width: 8px;
    border-radius: 4px 4px 0 0;
    min-height: 2px;
    transition: height 0.5s ease;
}
.uso-bar-limite { background: #EF5350; }
.uso-bar-bloqueo { background: #FF9800; }
.uso-bar-desbloqueo { background: #4CAF50; }

.uso-chart-day-label {
    font-size: 9px;
    color: #888;
    font-weight: 600;
}

.uso-chart-legend {
    display: flex;
    justify-content: center;
    gap: 16px;
    margin-top: 10px;
}

.uso-legend-item {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 11px;
    color: #666;
}

.uso-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: inline-block;
}
.uso-dot-limite { background: #EF5350; }
.uso-dot-bloqueo { background: #FF9800; }
.uso-dot-desbloqueo { background: #4CAF50; }

.uso-historial {
    max-height: 150px;
    overflow-y: auto;
}

.uso-event {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 0;
    border-bottom: 1px solid rgba(0,0,0,0.06);
    font-size: 12px;
}
.uso-event:last-child { border-bottom: none; }

.uso-event-icon {
    font-size: 16px;
    flex-shrink: 0;
}

.uso-event-text {
    flex: 1;
    color: #444;
}

.uso-event-time {
    color: #999;
    font-size: 11px;
    flex-shrink: 0;
}

.uso-empty {
    text-align: center;
    color: #999;
    font-size: 13px;
    padding: 20px 0;
    font-style: italic;
}

/* ================================================================
   Remote Unlock Section (Parent Dashboard)
   ================================================================ */
.remote-unlock-section {
    background: linear-gradient(135deg, #E8F5E9, #C8E6C9);
    border-radius: 16px;
    padding: 20px;
    margin-top: var(--space-md);
    margin-bottom: var(--space-md);
    border: 2px solid #A5D6A7;
}

.remote-unlock-desc {
    font-size: 13px;
    color: #555;
    margin-bottom: 16px;
    line-height: 1.4;
}

.remote-unlock-buttons {
    display: flex;
    gap: 10px;
    justify-content: center;
    flex-wrap: wrap;
}

.btn-remote-unlock {
    padding: 12px 20px;
    border-radius: 14px;
    font-size: 15px;
    font-weight: 700;
    border: 2px solid #4CAF50;
    background: white;
    color: #2E7D32;
    cursor: pointer;
    transition: all 0.3s ease;
    min-width: 90px;
}
.btn-remote-unlock:hover,
.btn-remote-unlock:active {
    background: #4CAF50;
    color: white;
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(76, 175, 80, 0.4);
}

.remote-unlock-status {
    font-size: 13px;
    color: #2E7D32;
    text-align: center;
    margin-top: 12px;
    min-height: 20px;
    font-weight: 600;
}

.btn-firebase-test,
.btn-smr-sync {
    margin-top: var(--space-sm);
    width: 100%;
    background: linear-gradient(135deg, #5C6BC0, #3949AB) !important;
    color: white !important;
    border-color: #3949AB !important;
    font-weight: 700;
}

.firebase-diagnostic {
    margin-top: var(--space-md);
    background: #1a1a2e;
    border-radius: 16px;
    padding: 20px;
    color: #e0e0e0;
    font-family: 'Courier New', monospace;
    font-size: 13px;
}

.diag-title {
    color: #FF9800;
    font-size: 16px;
    margin-bottom: 4px;
    font-family: inherit;
}

.diag-timestamp {
    color: #666;
    font-size: 11px;
    margin-bottom: 16px;
    padding-bottom: 8px;
    border-bottom: 1px solid #333;
}

.diag-item {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 10px 0;
    border-bottom: 1px solid #2a2a3e;
}

.diag-item:last-of-type {
    border-bottom: none;
}

.diag-icon {
    font-size: 16px;
    flex-shrink: 0;
    margin-top: 1px;
}

.diag-info {
    flex: 1;
    min-width: 0;
}

.diag-name {
    font-weight: 700;
    color: white;
    margin-bottom: 2px;
}

.diag-detail {
    color: #999;
    font-size: 11px;
    word-break: break-word;
    line-height: 1.4;
}

.diag-pass .diag-name { color: #4CAF50; }
.diag-fail .diag-name { color: #EF5350; }
.diag-warn .diag-name { color: #FF9800; }
.diag-running .diag-name { color: #42A5F5; }

.diag-summary {
    margin-top: 16px;
    padding-top: 12px;
    border-top: 2px solid #333;
    color: #ccc;
    font-size: 13px;
}

.diag-success {
    margin-top: 12px;
    padding: 12px;
    background: rgba(76, 175, 80, 0.15);
    border-radius: 10px;
    color: #4CAF50;
    text-align: center;
    font-weight: 700;
    font-size: 14px;
    font-family: inherit;
}

/* ================================================================
   RESPONSIVE DESIGN - Media Queries
   ================================================================ */

/* --- Smooth scrolling for all scrollable containers --- */
.routine-content,
.dashboard-content,
.settings-content,
.milestones-content {
    -webkit-overflow-scrolling: touch;
}

/* --- Small phones (< 360px) --- */
@media (max-width: 359px) {
    :root {
        --font-size-base: 13px;
        --font-size-lg: 16px;
        --font-size-xl: 20px;
        --space-md: 10px;
        --space-lg: 14px;
    }

    .pecs-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 8px;
        padding: 8px;
    }

    .pecs-card {
        padding: 8px 4px;
    }

    .emotion-buttons {
        grid-template-columns: repeat(3, 1fr);
        gap: 8px;
    }

    .games-menu {
        grid-template-columns: repeat(2, 1fr);
        gap: 8px;
    }

    .breathing-circle-container {
        width: 150px;
        height: 150px;
    }

    .timer-display {
        width: 140px;
        height: 140px;
    }

    .milo-character.milo-voice {
        transform: scale(0.8);
    }

    .assistant-speech-bubble {
        max-width: 240px;
    }

    .mic-button {
        width: 64px;
        height: 64px;
    }
}

/* --- Standard phones (360px - 413px) --- */
@media (min-width: 360px) and (max-width: 413px) {
    .pecs-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 10px;
    }

    .games-menu {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* --- Large phones (414px - 767px) --- */
@media (min-width: 414px) and (max-width: 767px) {
    .pecs-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: var(--space-md);
    }

    .home-nav-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* --- Tablets portrait (768px+) --- */
@media (min-width: 768px) {
    :root {
        --font-size-base: 16px;
        --font-size-lg: 20px;
        --font-size-xl: 28px;
    }

    .screen {
        max-width: 600px;
        margin: 0 auto;
        left: 50%;
        transform: translateX(-50%);
        box-shadow: 0 0 30px rgba(0, 0, 0, 0.1);
        border-radius: 20px;
        top: 10px;
        height: calc(100% - 20px);
    }

    /* PIN screens: quitar sombra/borde/margen que crean línea visible */
    #auth-pin-screen,
    #parent-gate-screen {
        max-width: 100%;
        border-radius: 0;
        box-shadow: none;
        top: 0;
        height: 100%;
        left: 0;
        transform: none;
    }

    .screen.slide-in {
        animation: none;
        transform: translateX(-50%);
    }

    .pecs-grid {
        grid-template-columns: repeat(4, 1fr);
    }

    .games-menu {
        grid-template-columns: repeat(3, 1fr);
    }

    .emotion-buttons {
        grid-template-columns: repeat(3, 1fr);
        gap: var(--space-lg);
    }

    .home-nav-grid {
        grid-template-columns: repeat(3, 1fr);
    }

    .breathing-circle-container {
        width: 250px;
        height: 250px;
    }

    .timer-display {
        width: 220px;
        height: 220px;
    }

    .assistant-speech-bubble {
        max-width: 360px;
    }

    .mic-button {
        width: 90px;
        height: 90px;
    }

    .chat-text-input {
        font-size: 16px;
    }
}

/* --- Tablets landscape / Desktop (1024px+) --- */
@media (min-width: 1024px) {
    .screen {
        max-width: 480px;
    }

    .pecs-grid {
        grid-template-columns: repeat(4, 1fr);
    }

    .games-menu {
        grid-template-columns: repeat(3, 1fr);
    }
}

/* --- Landscape orientation on phones --- */
@media (max-height: 500px) and (orientation: landscape) {
    .voice-assistant-area {
        flex-direction: row;
        align-items: center;
        gap: var(--space-md);
    }

    .milo-character.milo-voice {
        transform: scale(0.6);
    }

    .assistant-speech-bubble {
        max-width: 200px;
    }

    .voice-input-area {
        padding: var(--space-sm);
    }

    .mic-button {
        width: 56px;
        height: 56px;
    }

    .breathing-circle-container {
        width: 120px;
        height: 120px;
    }

    .timer-display {
        width: 120px;
        height: 120px;
    }

    .app-header {
        padding: 4px var(--space-md);
    }

    .screen-title {
        font-size: var(--font-size-base);
    }
}

/* --- Ensure all scrollable areas have visible scrollbars on hover (desktop) --- */
@media (hover: hover) {
    .screen::-webkit-scrollbar,
    .home-grid::-webkit-scrollbar,
    .pecs-grid::-webkit-scrollbar,
    .emotion-content::-webkit-scrollbar,
    .games-menu::-webkit-scrollbar,
    .chat-history::-webkit-scrollbar,
    .routine-content::-webkit-scrollbar,
    .dashboard-content::-webkit-scrollbar,
    .settings-content::-webkit-scrollbar,
    .calm-content::-webkit-scrollbar,
    .ft-content::-webkit-scrollbar,
    .journal-content::-webkit-scrollbar,
    .rewards-content::-webkit-scrollbar,
    .milestones-content::-webkit-scrollbar,
    .voice-content::-webkit-scrollbar {
        width: 6px;
    }

    .screen::-webkit-scrollbar-track,
    .home-grid::-webkit-scrollbar-track,
    .pecs-grid::-webkit-scrollbar-track,
    .emotion-content::-webkit-scrollbar-track,
    .games-menu::-webkit-scrollbar-track,
    .chat-history::-webkit-scrollbar-track,
    .routine-content::-webkit-scrollbar-track,
    .dashboard-content::-webkit-scrollbar-track,
    .settings-content::-webkit-scrollbar-track,
    .calm-content::-webkit-scrollbar-track,
    .ft-content::-webkit-scrollbar-track,
    .journal-content::-webkit-scrollbar-track,
    .rewards-content::-webkit-scrollbar-track,
    .milestones-content::-webkit-scrollbar-track,
    .voice-content::-webkit-scrollbar-track {
        background: transparent;
    }

    .screen::-webkit-scrollbar-thumb,
    .home-grid::-webkit-scrollbar-thumb,
    .pecs-grid::-webkit-scrollbar-thumb,
    .emotion-content::-webkit-scrollbar-thumb,
    .games-menu::-webkit-scrollbar-thumb,
    .chat-history::-webkit-scrollbar-thumb,
    .routine-content::-webkit-scrollbar-thumb,
    .dashboard-content::-webkit-scrollbar-thumb,
    .settings-content::-webkit-scrollbar-thumb,
    .calm-content::-webkit-scrollbar-thumb,
    .ft-content::-webkit-scrollbar-thumb,
    .journal-content::-webkit-scrollbar-thumb,
    .rewards-content::-webkit-scrollbar-thumb,
    .milestones-content::-webkit-scrollbar-thumb,
    .voice-content::-webkit-scrollbar-thumb {
        background: rgba(0, 0, 0, 0.15);
        border-radius: 3px;
    }

    .screen::-webkit-scrollbar-thumb:hover,
    .home-grid::-webkit-scrollbar-thumb:hover,
    .pecs-grid::-webkit-scrollbar-thumb:hover,
    .emotion-content::-webkit-scrollbar-thumb:hover,
    .games-menu::-webkit-scrollbar-thumb:hover,
    .chat-history::-webkit-scrollbar-thumb:hover,
    .routine-content::-webkit-scrollbar-thumb:hover,
    .dashboard-content::-webkit-scrollbar-thumb:hover,
    .settings-content::-webkit-scrollbar-thumb:hover,
    .calm-content::-webkit-scrollbar-thumb:hover,
    .ft-content::-webkit-scrollbar-thumb:hover,
    .journal-content::-webkit-scrollbar-thumb:hover,
    .rewards-content::-webkit-scrollbar-thumb:hover,
    .milestones-content::-webkit-scrollbar-thumb:hover,
    .voice-content::-webkit-scrollbar-thumb:hover {
        background: rgba(0, 0, 0, 0.3);
    }
}

/* --- Word wrapping safety for all text --- */
.assistant-speech-bubble,
.chat-msg,
.assistant-bubble,
.pecs-phrase {
    word-wrap: break-word;
    overflow-wrap: break-word;
}

/* ================================================================
   COMPREHENSIVE RESPONSIVE FIXES
   ================================================================ */

/* --- Global: Ensure nothing overflows on any device --- */
.screen {
    overflow-x: hidden;
}

img, svg, video, canvas {
    max-width: 100%;
    height: auto;
}

/* --- Parent Dashboard responsive --- */
@media (max-width: 374px) {
    .pd-quick-stats {
        grid-template-columns: repeat(2, 1fr);
        gap: 6px;
    }
    .pd-qstat-value {
        font-size: 18px;
    }
    .pd-qstat-label {
        font-size: 10px;
    }
    .pd-child-banner {
        padding: 10px;
    }
    .pd-child-name {
        font-size: 16px;
    }
    .pd-section-title {
        font-size: 13px;
    }
    .pd-card-header h4 {
        font-size: 12px;
    }
    .remote-unlock-buttons {
        flex-direction: column;
        gap: 6px;
    }
    .btn-remote-unlock {
        width: 100%;
    }
    .uso-stat-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    .pd-actions {
        gap: 8px;
    }
    .pd-actions button {
        font-size: 12px;
        padding: 10px 12px;
    }
    .qr-promo-content {
        flex-direction: column;
        text-align: center;
    }
    .date-nav {
        gap: 6px;
    }
    .date-label {
        font-size: 13px;
    }
}

@media (min-width: 375px) and (max-width: 413px) {
    .pd-quick-stats {
        grid-template-columns: repeat(4, 1fr);
        gap: 6px;
    }
    .pd-qstat-value {
        font-size: 18px;
    }
    .pd-qstat-label {
        font-size: 10px;
    }
}

/* --- Settings & Notification Settings responsive --- */
@media (max-width: 374px) {
    .settings-content {
        padding: 8px;
    }
    .settings-group {
        padding: 10px;
    }
    .settings-group-title {
        font-size: 13px;
    }
    .setting-item label {
        font-size: 12px;
    }
    .input-field, .toggle {
        font-size: 13px;
    }
    .schedule-days {
        gap: 3px;
    }
    .schedule-day-btn {
        min-width: 32px;
        padding: 6px 4px;
        font-size: 11px;
    }
    .medical-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 4px;
    }
    .medical-add-form .setting-item {
        margin-bottom: 6px;
    }
}

/* --- Emotion Mirror (Learn screen) responsive --- */
@media (max-width: 374px) {
    .emotion-mirror-split {
        grid-template-columns: 1fr;
        gap: 8px;
    }
    .mirror-panel {
        min-height: 140px;
    }
    .emotion-mirror-emoji {
        font-size: 36px;
    }
}

/* --- Guest Conversion Modal responsive --- */
@media (max-width: 374px) {
    .guest-conversion-modal {
        padding: 20px 16px;
    }
    .guest-conv-title {
        font-size: 18px;
    }
    .guest-conv-desc {
        font-size: 12px;
    }
    .guest-conv-feature {
        font-size: 13px;
    }
}

/* --- Nav cards responsive safety --- */
.nav-card {
    min-width: 0;
}

.card-label {
    display: block;
    width: 100%;
    word-wrap: break-word;
}

/* --- Ensure modals are always accessible --- */
.guest-conversion-overlay,
#trialExpiredModal,
#premiumGateModal {
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

/* --- Fix landscape on compact screens --- */
@media (max-height: 500px) and (orientation: landscape) {
    .pd-quick-stats {
        grid-template-columns: repeat(4, 1fr);
    }
    .emotion-mirror-split {
        grid-template-columns: 1fr 1fr;
    }
    .mirror-panel {
        min-height: 100px;
    }
    .guest-conversion-modal {
        max-height: 90vh;
        overflow-y: auto;
    }
    .nav-cards {
        grid-template-columns: repeat(3, 1fr);
    }
}

/* --- Safe area insets for notched devices --- */
@supports (padding: env(safe-area-inset-top)) {
    .app-header {
        padding-top: max(var(--space-sm), env(safe-area-inset-top));
    }
    .screen {
        padding-bottom: env(safe-area-inset-bottom);
    }
}

/* ================================================================
   Premium Upgrade & Trial Reminder Banners
   ================================================================ */
.premium-upgrade-banner {
    background: linear-gradient(135deg, #7C4DFF, #6200EA);
    border-radius: 16px;
    padding: 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: var(--space-md);
    position: relative;
    box-shadow: 0 4px 20px rgba(124, 77, 255, 0.3);
    animation: pubSlideIn 0.5s ease-out;
}

@keyframes pubSlideIn {
    from { transform: translateY(-20px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

.pub-icon {
    font-size: 32px;
    flex-shrink: 0;
}

.pub-content {
    flex: 1;
    min-width: 0;
}

.pub-content h4 {
    color: white;
    font-size: 14px;
    font-weight: 800;
    margin: 0 0 2px;
}

.pub-content p {
    color: rgba(255,255,255,0.85);
    font-size: 11px;
    margin: 0;
    line-height: 1.3;
}

.pub-btn {
    background: white;
    color: #6200EA;
    border: none;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
    white-space: nowrap;
    flex-shrink: 0;
    transition: transform 0.2s;
}

.pub-btn:active {
    transform: scale(0.95);
}

.pub-close {
    position: absolute;
    top: 4px;
    right: 8px;
    background: none;
    border: none;
    color: rgba(255,255,255,0.6);
    font-size: 18px;
    cursor: pointer;
    padding: 4px;
}

.trial-reminder-banner {
    background: linear-gradient(135deg, #FFF8E1, #FFF3E0);
    border: 2px solid #FFB74D;
    border-radius: 12px;
    padding: 10px 14px;
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: var(--space-md);
}

.trial-rem-icon {
    font-size: 24px;
    flex-shrink: 0;
}

.trial-rem-text {
    font-size: 13px;
    color: #E65100;
    font-weight: 600;
}

@media (max-width: 374px) {
    .premium-upgrade-banner {
        flex-wrap: wrap;
        padding: 12px;
        gap: 8px;
    }
    .pub-btn {
        width: 100%;
        text-align: center;
    }
    .pub-icon {
        font-size: 24px;
    }
}

/* ================================================================
   Parent Dashboard - Schedule & Medical Inline Controls
   ================================================================ */
.pd-schedule-controls .setting-item {
    margin-bottom: 8px;
}

.pd-schedule-controls .schedule-days {
    display: flex;
    gap: 4px;
    flex-wrap: wrap;
    margin-top: 6px;
}

.pd-schedule-controls .schedule-day-btn {
    min-width: 36px;
    padding: 8px 6px;
    border-radius: 10px;
    border: 2px solid #E0E0E0;
    background: white;
    font-size: 12px;
    font-weight: 700;
    color: #78909C;
    cursor: pointer;
    transition: all 0.2s;
}

.pd-schedule-controls .schedule-day-btn.active {
    background: linear-gradient(135deg, #7C4DFF, #6200EA);
    color: white;
    border-color: #7C4DFF;
}

.pd-medical-add {
    border-top: 1px solid #E8EAF6;
    padding-top: 8px;
    margin-top: 8px;
}

.pd-medical-add .setting-item {
    margin-bottom: 6px;
}

.medical-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 0;
    border-bottom: 1px solid #F0F0F0;
}

.medical-item:last-child {
    border-bottom: none;
}

.medical-item-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.medical-item-info strong {
    font-size: 13px;
    color: var(--color-text);
}

.medical-date {
    font-size: 11px;
    color: #78909C;
}

.medical-notes {
    font-size: 11px;
    color: #90A4AE;
    font-style: italic;
}

.btn-medical-delete-pd {
    background: none;
    border: none;
    color: #EF5350;
    font-size: 16px;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 8px;
    transition: background 0.2s;
}

.btn-medical-delete-pd:hover,
.btn-medical-delete-pd:active {
    background: #FFEBEE;
}

/* ================================================================
   Triple Tap Target (secret parent access on header logo)
   ================================================================ */
.triple-tap-target {
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
}

/* ================================================================
   Child-Friendly Back Buttons (larger hit target)
   ================================================================ */
.btn-icon.back-btn,
.back-btn-large {
    width: 52px;
    height: 52px;
    min-width: 52px;
    min-height: 52px;
    border-radius: var(--radius-full);
    background: var(--color-surface);
    box-shadow: var(--shadow-sm);
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-icon.back-btn .icon,
.back-btn-large .icon {
    width: 28px;
    height: 28px;
    fill: var(--color-text);
}

.btn-icon.back-btn:active,
.back-btn-large:active {
    transform: scale(0.9);
    background: var(--color-primary-light);
}

/* ================================================================
   Learn Screen – "El Espejo de Luna"
   ================================================================ */
.learn-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: var(--space-md) var(--space-lg);
    gap: var(--space-lg);
    overflow-y: auto;
    flex: 1;
}

.learn-subtitle {
    font-size: var(--font-size-xl);
    font-weight: 700;
    color: var(--color-primary);
    text-align: center;
    margin: 0;
}

/* Split-screen mirror layout */
.emotion-mirror-split {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-md);
    width: 100%;
    max-width: 500px;
}

.mirror-panel {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-lg);
    overflow: hidden;
    aspect-ratio: 3 / 4;
    box-shadow: var(--shadow-md);
    border: 3px solid transparent;
    transition: border-color var(--transition-normal), background-color var(--transition-normal);
}

.mirror-panel-label {
    position: absolute;
    top: var(--space-sm);
    left: 50%;
    transform: translateX(-50%);
    background: rgba(255,255,255,0.85);
    padding: 2px 12px;
    border-radius: 20px;
    font-size: var(--font-size-sm);
    font-weight: 700;
    color: var(--color-primary);
    z-index: 2;
}

/* Luna's side */
.mirror-luna {
    background: #FFF9C4;
    border-color: #FFD54F;
}

.emotion-mirror-emoji {
    font-size: 56px;
    line-height: 1;
    margin-bottom: var(--space-sm);
}

.emotion-mirror-name {
    font-size: var(--font-size-lg);
    font-weight: 700;
    color: var(--color-text);
    margin: 0;
    text-align: center;
}

/* Child's camera side */
.mirror-child {
    background: #1a1a2e;
    border-color: var(--color-primary-light);
}

.mirror-child video {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transform: scaleX(-1);
    z-index: 1;
}

.mirror-child .camera-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 2;
}

.mirror-child .face-guide {
    position: absolute;
    top: 15%;
    left: 15%;
    width: 70%;
    height: 70%;
    border: 2px dashed rgba(255, 255, 255, 0.3);
    border-radius: 50%;
}

.mirror-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: var(--space-sm);
    color: rgba(255,255,255,0.7);
    font-size: var(--font-size-sm);
    text-align: center;
    z-index: 1;
}

.mirror-placeholder .placeholder-icon {
    width: 64px;
    height: 64px;
}

.mirror-placeholder p {
    margin: 0;
    line-height: 1.3;
}

.mirror-child.camera-active .mirror-placeholder {
    display: none;
}

/* AI match feedback: subtle pulse while building up consecutive matches */
.mirror-child.learn-matching {
    border-color: #66BB6A;
    box-shadow: 0 0 0 4px rgba(102, 187, 106, 0.25);
    transition: border-color 200ms ease, box-shadow 200ms ease;
}

/* AI match confirmed: strong green glow + bouncy scale to celebrate */
.mirror-child.learn-matched {
    border-color: #43A047;
    box-shadow: 0 0 0 6px rgba(67, 160, 71, 0.45),
                0 8px 32px rgba(67, 160, 71, 0.35);
    animation: learnMatchPop 600ms ease-out;
}

@keyframes learnMatchPop {
    0%   { transform: scale(1.0); }
    40%  { transform: scale(1.08); }
    100% { transform: scale(1.0); }
}

/* Controls row */
.learn-controls {
    display: flex;
    gap: var(--space-md);
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
}

/* Audio button */
.btn-learn-audio {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    padding: var(--space-sm) var(--space-lg);
    background: var(--color-surface);
    border: 2px solid var(--color-primary-light);
    border-radius: var(--radius-lg);
    color: var(--color-primary);
    font-size: var(--font-size-base);
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-fast);
    box-shadow: var(--shadow-sm);
}

.btn-learn-audio .icon {
    width: 24px;
    height: 24px;
    fill: var(--color-primary);
}

.btn-learn-audio:active {
    transform: scale(0.95);
    background: var(--color-primary-light);
    color: white;
}

.btn-learn-audio:active .icon {
    fill: white;
}

/* Action button */
.btn-learn-action {
    width: 100%;
    max-width: 300px;
    padding: var(--space-md) var(--space-xl);
    font-size: var(--font-size-lg);
    font-weight: 700;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
}

.btn-learn-action.btn-active {
    background: var(--color-error);
}

/* Emotion navigation arrows */
.emotion-nav-arrows {
    display: flex;
    align-items: center;
    gap: var(--space-lg);
}

.emotion-nav-arrows .btn-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-full);
    background: var(--color-surface);
    box-shadow: var(--shadow-sm);
    border: 2px solid var(--color-border);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.emotion-nav-arrows .btn-icon:active {
    transform: scale(0.9);
    background: var(--color-primary-light);
    border-color: var(--color-primary);
}

.emotion-nav-arrows .icon {
    width: 28px;
    height: 28px;
    fill: var(--color-text);
}

.emotion-counter {
    font-size: var(--font-size-base);
    font-weight: 600;
    color: var(--color-text-light);
    min-width: 50px;
    text-align: center;
}

/* Responsive: smaller panels on tiny screens */
@media (max-width: 360px) {
    .emotion-mirror-emoji {
        font-size: 40px;
    }
    .emotion-mirror-name {
        font-size: var(--font-size-base);
    }
    .flashcard {
        width: 220px;
        height: 220px;
    }
    .flashcard-emoji {
        font-size: 4rem;
    }
    .flashcard-word {
        font-size: 1.4rem;
    }
    .mode-card-title {
        font-size: 1.1rem;
    }
    .mode-cards {
        max-width: 280px;
    }
    .autonomy-task-name {
        font-size: 1rem;
    }
}

/* Responsive: Fase 2 modules on tablets */
@media (min-width: 768px) {
    .flashcard {
        width: 320px;
        height: 320px;
    }
    .flashcard-emoji {
        font-size: 7rem;
    }
    .autonomy-board {
        max-width: 560px;
        margin: 0 auto;
    }
    .mode-cards {
        flex-direction: row;
        max-width: 680px;
    }
    .mode-card {
        flex: 1;
    }
    .motor-luna-target {
        width: 100px;
        height: 100px;
    }
}

/* ================================================================
   Lock Screen – "Luna Durmiendo" (Kiosk Mode)
   ================================================================ */
.lock-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 10000;
    background: linear-gradient(135deg, #1a1a3e 0%, #2d1b69 40%, #1a1a3e 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    user-select: none;
    -webkit-user-select: none;
}

.lock-screen.hidden {
    display: none;
}

.lock-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-xl);
    text-align: center;
    padding: var(--space-xl);
}

.luna-sleeping {
    position: relative;
    width: 180px;
    height: 180px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.luna-sleep-body {
    animation: gentleFloat 4s ease-in-out infinite;
}

.luna-sleep-body .milo-eye.closed .milo-eyelid {
    height: 100% !important;
    opacity: 1 !important;
}

.luna-sleep-body .milo-mouth.sleeping {
    width: 12px !important;
    height: 8px !important;
    border-radius: 50% !important;
    background: #e88ca5 !important;
}

@keyframes gentleFloat {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

/* Floating Z's animation */
.luna-zzz {
    position: absolute;
    top: 10px;
    right: -10px;
}

.zzz {
    position: absolute;
    font-size: 20px;
    font-weight: 700;
    color: rgba(255, 255, 255, 0.6);
    animation: floatZzz 3s ease-in-out infinite;
}

.z1 { font-size: 16px; right: 0; animation-delay: 0s; }
.z2 { font-size: 22px; right: -15px; top: -20px; animation-delay: 1s; }
.z3 { font-size: 28px; right: -5px; top: -45px; animation-delay: 2s; }

@keyframes floatZzz {
    0% { opacity: 0; transform: translateY(0) scale(0.5); }
    50% { opacity: 0.8; transform: translateY(-15px) scale(1); }
    100% { opacity: 0; transform: translateY(-30px) scale(0.7); }
}

/* Lock text */
.lock-title {
    font-size: var(--font-size-xxl);
    font-weight: 700;
    color: #E8D5FF;
    margin: 0;
}

.lock-message {
    font-size: var(--font-size-lg);
    color: rgba(255, 255, 255, 0.6);
    margin: 0;
}

/* Hidden unlock area – invisible to child, tappable by parent */
.lock-unlock-area {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 60px;
    height: 60px;
    -webkit-tap-highlight-color: transparent;
    cursor: default;
}

/* ================================================================
   MEDICAL REMINDERS
   ================================================================ */
.medical-list {
    display: flex;
    flex-direction: column;
    gap: var(--space-xs);
    margin: var(--space-sm) 0;
}

.medical-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--surface);
    border-radius: var(--radius-md);
    padding: var(--space-sm) var(--space-md);
    border-left: 4px solid #66BB6A;
}

.medical-item-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.medical-item-info strong {
    font-size: 0.95rem;
}

.medical-date {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.medical-notes {
    font-size: 0.75rem;
    color: var(--text-secondary);
    font-style: italic;
}

.btn-medical-delete {
    background: none;
    border: none;
    color: #EF5350;
    font-size: 1.2rem;
    padding: var(--space-xs);
    cursor: pointer;
    border-radius: 50%;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-medical-delete:active {
    background: rgba(239, 83, 80, 0.15);
}

.medical-add-form {
    margin-top: var(--space-sm);
    padding: var(--space-sm);
    background: var(--surface);
    border-radius: var(--radius-md);
}

.medical-add-form .setting-item {
    margin-bottom: var(--space-xs);
}

.medical-upcoming-item {
    display: flex;
    align-items: flex-start;
    gap: var(--space-sm);
    padding: var(--space-sm) 0;
    border-bottom: 1px solid rgba(0,0,0,0.06);
}

.medical-upcoming-item:last-child {
    border-bottom: none;
}

.medical-upcoming-icon {
    font-size: 1.5rem;
}

.medical-upcoming-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.medical-upcoming-info strong {
    font-size: 0.9rem;
}

.medical-upcoming-info span {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.medical-notes-small {
    font-style: italic;
}

/* ================================================================
   PERMISSIONS CONSENT SCREEN
   ================================================================ */
.permissions-consent-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    min-height: 100vh;
    padding: var(--space-lg) var(--space-md);
    background: linear-gradient(135deg, #F5F0FF 0%, #EDE7F6 100%);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.permissions-consent-header {
    text-align: center;
    margin-bottom: var(--space-lg);
    max-width: 400px;
}

.permissions-consent-icon {
    font-size: 48px;
    margin-bottom: var(--space-sm);
}

.permissions-consent-title {
    font-size: var(--font-size-xl);
    font-weight: 700;
    color: var(--color-primary-dark);
    margin: 0 0 var(--space-sm);
}

.permissions-consent-subtitle {
    font-size: var(--font-size-base);
    color: var(--color-text);
    line-height: 1.5;
    margin: 0;
}

.permissions-consent-cards {
    display: flex;
    flex-direction: column;
    gap: var(--space-md);
    width: 100%;
    max-width: 400px;
    margin-bottom: var(--space-lg);
}

.permission-card {
    display: flex;
    align-items: flex-start;
    gap: var(--space-md);
    background: var(--color-surface);
    border-radius: var(--radius-md);
    padding: var(--space-md);
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}

.permission-card-icon {
    flex-shrink: 0;
    width: 48px;
    height: 48px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
}

.permission-card-info h3 {
    font-size: var(--font-size-base);
    font-weight: 600;
    color: var(--color-text);
    margin: 0 0 4px;
}

.permission-card-info p {
    font-size: var(--font-size-sm);
    color: var(--color-text-light);
    line-height: 1.45;
    margin: 0;
}

.permissions-consent-footer {
    text-align: center;
    width: 100%;
    max-width: 400px;
    padding-bottom: var(--space-xl);
}

.permissions-consent-privacy {
    font-size: 12px;
    color: var(--color-text-light);
    line-height: 1.5;
    margin: 0 0 var(--space-md);
}

.permissions-consent-btn {
    width: 100%;
    padding: 16px 32px;
    border: none;
    border-radius: var(--radius-lg);
    background: linear-gradient(135deg, var(--color-primary), var(--color-primary-dark));
    color: #fff;
    font-size: var(--font-size-lg);
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 4px 16px rgba(124,77,255,0.35);
    transition: transform 0.15s, box-shadow 0.15s;
}

.permissions-consent-btn:active {
    transform: scale(0.97);
    box-shadow: 0 2px 8px rgba(124,77,255,0.25);
}

/* ================================================================
   MODE SELECTOR SCREEN - Professional profile selection
   ================================================================ */
.mode-selector-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: var(--space-md);
    gap: var(--space-md);
    background: #FAFBFF;
    position: relative;
}

/* --- Botón Volver en Mode Selector --- */
.mode-back-btn {
    position: absolute;
    top: 16px;
    left: 16px;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: none;
    background: rgba(124, 77, 255, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 10;
    transition: background 0.2s;
}
.mode-back-btn:active {
    background: rgba(124, 77, 255, 0.25);
}

/* --- Logo area (with hidden triple-tap) --- */
.mode-selector-logo {
    display: flex;
    flex-direction: column;
    align-items: center;
    cursor: default;
    padding: var(--space-sm) 0;
}

.mode-selector-brand {
    font-size: 1.4rem;
    font-weight: 800;
    color: #1a237e;
    margin-top: var(--space-xs);
    letter-spacing: -0.3px;
}

/* --- Header text --- */
.mode-selector-header {
    text-align: center;
    margin: var(--space-sm) 0;
}

.mode-selector-title {
    font-size: 1.5rem;
    font-weight: 800;
    color: #1a237e;
    margin: 0;
}

.mode-selector-desc {
    font-size: 0.9rem;
    color: #546E7A;
    margin-top: 4px;
}

/* --- Profile cards --- */
.mode-cards {
    display: flex;
    flex-direction: column;
    gap: var(--space-md);
    width: 100%;
    max-width: 380px;
}

.mode-card {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    background: #FFFFFF;
    border: 3px solid transparent;
    border-radius: 20px;
    padding: var(--space-md) var(--space-lg);
    text-align: left;
    cursor: pointer;
    transition: transform 0.25s, box-shadow 0.25s, border-color 0.25s;
    box-shadow: 0 2px 12px rgba(0,0,0,0.06);
    min-height: 120px;
}

.mode-card:active {
    transform: scale(0.97);
}

/* Visual icon area */
.mode-card-visual {
    flex-shrink: 0;
}

.mode-card-icon-wrap {
    width: 72px;
    height: 72px;
    border-radius: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.mode-card-icon-explorer {
    background: #EDE7F6;
}

.mode-card-icon-learner {
    background: #FFF8E1;
}

.mode-card-svg {
    width: 56px;
    height: 56px;
}

/* Text area */
.mode-card-text {
    flex: 1;
    min-width: 0;
}

.mode-card-title {
    font-size: 1.15rem;
    font-weight: 800;
    margin: 0 0 2px 0;
}

.mode-card-tagline {
    font-size: 0.85rem;
    color: #546E7A;
    margin: 0 0 var(--space-xs) 0;
    line-height: 1.35;
}

.mode-card-features {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}

.mode-card-tag {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 8px;
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.2px;
}

/* Explorer styling */
.mode-card-explorer {
    border-color: #D1C4E9;
}

.mode-card-explorer:active,
.mode-card-explorer:hover {
    border-color: #7C4DFF;
    box-shadow: 0 4px 20px rgba(124, 77, 255, 0.15);
}

.mode-card-explorer .mode-card-title {
    color: #5E35B1;
}

.mode-card-explorer .mode-card-tag {
    background: #EDE7F6;
    color: #5E35B1;
}

/* Learner styling - larger for accessibility */
.mode-card-learner {
    border-color: #FFE082;
    padding: calc(var(--space-md) * 1.2) var(--space-lg);
    min-height: 140px;
}

.mode-card-learner .mode-card-icon-wrap {
    width: 84px;
    height: 84px;
    border-radius: 22px;
}

.mode-card-learner .mode-card-svg {
    width: 64px;
    height: 64px;
}

.mode-card-learner:active,
.mode-card-learner:hover {
    border-color: #FFB300;
    box-shadow: 0 4px 20px rgba(255, 179, 0, 0.15);
}

.mode-card-learner .mode-card-title {
    color: #E65100;
    font-size: 1.25rem;
}

.mode-card-learner .mode-card-tagline {
    font-size: 0.9rem;
}

.mode-card-learner .mode-card-tag {
    background: #FFF8E1;
    color: #E65100;
    font-size: 0.75rem;
    padding: 3px 10px;
}

/* --- QR Code Section --- */
.mode-qr-section {
    width: 100%;
    max-width: 380px;
}

.mode-qr-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-md);
    background: linear-gradient(135deg, #F3F0FF 0%, #EDE7F6 100%);
    border: 2px solid #D1C4E9;
    border-radius: 16px;
    padding: var(--space-md);
    transition: box-shadow 0.3s;
}

.mode-qr-card:hover {
    box-shadow: 0 4px 20px rgba(124, 77, 255, 0.12);
}

.mode-qr-left {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    flex: 1;
    min-width: 0;
}

.mode-qr-icon-badge {
    flex-shrink: 0;
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: #FFFFFF;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 8px rgba(124, 77, 255, 0.1);
}

.mode-qr-text {
    flex: 1;
    min-width: 0;
}

.mode-qr-title {
    font-size: 0.85rem;
    font-weight: 800;
    color: #1a237e;
    margin: 0 0 2px 0;
}

.mode-qr-desc {
    font-size: 0.7rem;
    color: #546E7A;
    line-height: 1.35;
    margin: 0;
}

.mode-qr-right {
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

.mode-qr-canvas {
    width: 80px;
    height: 80px;
    border-radius: 8px;
    background: #FFFFFF;
    padding: 4px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.mode-qr-url {
    font-size: 0.55rem;
    color: #7C4DFF;
    font-weight: 700;
    letter-spacing: 0.2px;
    margin: 0;
    text-align: center;
}

/* --- Footer / Branding --- */
.mode-selector-footer {
    text-align: center;
    padding: var(--space-xs) 0;
}

.mode-selector-smr {
    font-size: 0.7rem;
    font-weight: 700;
    color: #90A4AE;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    margin: 0;
}

/* --- Setup Phone Field --- */
.setup-phone-wrap {
    display: flex;
    gap: 8px;
    align-items: stretch;
}

.setup-phone-prefix {
    flex-shrink: 0;
    width: 100px;
    padding: 10px 8px;
    border: 2px solid #E0E0E0;
    border-radius: 12px;
    background: #FAFAFA;
    font-size: 0.85rem;
    font-weight: 600;
    color: #37474F;
    cursor: pointer;
    transition: border-color 0.2s;
    -webkit-appearance: none;
    appearance: none;
}

.setup-phone-prefix:focus {
    border-color: #7C4DFF;
    outline: none;
    background: #FFFFFF;
}

.setup-phone-input {
    flex: 1;
    min-width: 0;
}

.setup-label-icon {
    margin-right: 4px;
}

.setup-hint-sms {
    display: flex;
    align-items: flex-start;
    gap: 4px;
    background: #FFF8E1;
    border: 1px solid #FFE082;
    border-radius: 8px;
    padding: 8px 10px;
    margin-top: 6px;
    font-size: 0.72rem;
    color: #E65100;
    line-height: 1.4;
}

.setup-hint-icon {
    flex-shrink: 0;
    font-size: 0.8rem;
}

/* --- Responsive mode selector --- */
@media (max-width: 360px) {
    .mode-selector-brand {
        font-size: 1.2rem;
    }
    .mode-selector-title {
        font-size: 1.3rem;
    }
    .mode-card {
        padding: var(--space-sm) var(--space-md);
        min-height: 100px;
    }
    .mode-card-icon-wrap {
        width: 60px;
        height: 60px;
    }
    .mode-card-learner .mode-card-icon-wrap {
        width: 72px;
        height: 72px;
    }
    .mode-qr-card {
        flex-direction: column;
        text-align: center;
        gap: var(--space-sm);
    }
    .mode-qr-left {
        flex-direction: column;
        align-items: center;
    }
    .mode-qr-canvas {
        width: 70px;
        height: 70px;
    }
}

@media (min-width: 768px) {
    .mode-cards {
        flex-direction: row;
        max-width: 680px;
    }
    .mode-card {
        flex-direction: column;
        text-align: center;
        padding: var(--space-xl) var(--space-lg);
        flex: 1;
    }
    .mode-card-title {
        font-size: 1.4rem;
    }
    .mode-card-icon-wrap {
        width: 96px;
        height: 96px;
    }
    .mode-card-learner .mode-card-icon-wrap {
        width: 110px;
        height: 110px;
    }
    .mode-card-svg {
        width: 72px;
        height: 72px;
    }
    .mode-card-learner .mode-card-svg {
        width: 84px;
        height: 84px;
    }
    .mode-selector-title {
        font-size: 1.8rem;
    }
    .mode-qr-section {
        max-width: 680px;
    }
    .mode-qr-canvas {
        width: 100px;
        height: 100px;
    }
}

/* ================================================================
   MODO APRENDIZ (Síndrome de Down) - Adaptaciones CSS
   Botones +20%, Alto Contraste, Animaciones Lentas
   ================================================================ */

/* Elementos táctiles +20% más grandes (padding/font, no scale para evitar overflow) */
.mode-down-syndrome .nav-card {
    min-height: 130px;
    padding: var(--space-md) var(--space-sm);
    border: 3px solid #1565C0;
    background: #FFFFFF;
    box-shadow: 0 4px 12px rgba(21,101,192,0.15);
}

.mode-down-syndrome .btn-primary,
.mode-down-syndrome .btn-secondary {
    padding: 16px 28px;
    font-size: 1.15rem;
    min-height: 56px;
}

.mode-down-syndrome .card-icon,
.mode-down-syndrome .card-icon-emoji {
    font-size: 2.8rem;
}

.mode-down-syndrome .card-label {
    font-size: 1.15rem;
    font-weight: 800;
    color: #0D47A1;
}

.mode-down-syndrome .card-svg {
    width: 54px;
    height: 54px;
}

/* Alto contraste sin saturar */
.mode-down-syndrome {
    --text-primary: #1a1a2e;
    --text-secondary: #37474F;
    --surface: #FFFFFF;
}

.mode-down-syndrome .screen-title,
.mode-down-syndrome h1,
.mode-down-syndrome h2,
.mode-down-syndrome h3 {
    color: #1a237e;
    font-weight: 800;
}

/* Animaciones más lentas (solo elementos animados, no wildcard) */
.mode-down-syndrome .nav-card,
.mode-down-syndrome .btn-primary,
.mode-down-syndrome .btn-secondary,
.mode-down-syndrome .btn-icon,
.mode-down-syndrome .milo-character,
.mode-down-syndrome .autonomy-task,
.mode-down-syndrome .flashcard,
.mode-down-syndrome .motor-luna-target {
    transition-duration: 0.5s !important;
}

/* Slow down only functional animations, remove decorative ones */
.mode-down-syndrome .loading-dots .dot {
    animation-duration: 2.5s !important;
}

/* Remove decorative floating/bouncing animations */
.mode-down-syndrome .milo-eye .milo-pupil,
.mode-down-syndrome .home-milo-container .milo-character {
    animation: none !important;
}

/* Botones de navegación más grandes y con más contraste */
.mode-down-syndrome .btn-icon.back-btn {
    width: 62px;
    height: 62px;
    background: #1565C0;
    border: 3px solid #0D47A1;
}

.mode-down-syndrome .btn-icon.back-btn svg {
    fill: white;
}

/* Navegación home para Modo Aprendiz: grid 2 columnas */
.mode-down-syndrome .nav-cards {
    grid-template-columns: repeat(2, 1fr);
    gap: var(--space-lg);
    padding: var(--space-md);
}

/* Textos más grandes en modo aprendiz */
.mode-down-syndrome p,
.mode-down-syndrome label,
.mode-down-syndrome span:not(.dot) {
    font-size: 1.05rem;
}

/* Show/hide mode-specific cards */
.ds-only {
    display: none !important;
}

.mode-down-syndrome .ds-only {
    display: flex !important;
}

/* DS-only card styles */
.card-autonomy { background: linear-gradient(135deg, #E8F5E9, #C8E6C9) !important; border-color: #66BB6A !important; }
.card-flashcards { background: linear-gradient(135deg, #E3F2FD, #BBDEFB) !important; border-color: #42A5F5 !important; }
.card-motor { background: linear-gradient(135deg, #FFF8E1, #FFECB3) !important; border-color: #FFB300 !important; }

.card-icon-emoji {
    font-size: 2.2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
}

/* ================================================================
   NUEVOS MÓDULOS FASE 2 - Screens
   ================================================================ */

/* Autonomía Diaria */
.autonomy-board {
    display: flex;
    flex-direction: column;
    gap: var(--space-md);
    padding: var(--space-md);
    flex: 1;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.autonomy-task {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    background: white;
    border-radius: 20px;
    padding: var(--space-md) var(--space-lg);
    border: 3px solid #E0E0E0;
    min-height: 80px;
    cursor: pointer;
    transition: all 0.4s ease;
}

.autonomy-task.completed {
    border-color: #43A047;
    background: #E8F5E9;
}

.autonomy-task-icon {
    font-size: 2.5rem;
    flex-shrink: 0;
}

.autonomy-task-info {
    flex: 1;
}

.autonomy-task-name {
    font-size: 1.2rem;
    font-weight: 700;
    color: #1a237e;
}

.autonomy-task-status {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.autonomy-task-check {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    border: 3px solid #BDBDBD;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    flex-shrink: 0;
    transition: all 0.4s;
}

.autonomy-task.completed .autonomy-task-check {
    background: #43A047;
    border-color: #2E7D32;
    color: white;
}

.autonomy-progress {
    text-align: center;
    padding: var(--space-md);
}

.autonomy-progress-bar {
    height: 16px;
    background: #E0E0E0;
    border-radius: 8px;
    overflow: hidden;
    margin: var(--space-sm) 0;
}

.autonomy-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #66BB6A, #43A047);
    border-radius: 8px;
    transition: width 0.6s ease;
}

/* Confetti overlay */
.confetti-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 9999;
}

.confetti-piece {
    position: absolute;
    width: 10px;
    height: 10px;
    opacity: 0;
    animation: confettiFall 2s ease-out forwards;
}

@keyframes confettiFall {
    0% { transform: translateY(-20px) rotate(0deg); opacity: 1; }
    100% { transform: translateY(100vh) rotate(720deg); opacity: 0; }
}

/* Flashcards / Pronunciación */
.flashcard-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: var(--space-lg);
    gap: var(--space-lg);
}

.flashcard {
    width: 280px;
    height: 280px;
    background: white;
    border-radius: 28px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    box-shadow: 0 8px 32px rgba(0,0,0,0.1);
    border: 4px solid #1565C0;
    cursor: pointer;
    transition: transform 0.4s;
}

.flashcard:active {
    transform: scale(0.95);
}

.flashcard-emoji {
    font-size: 6rem;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 150px;
}

.flashcard-word {
    font-size: 1.8rem;
    font-weight: 800;
    color: #1a237e;
    margin-top: var(--space-sm);
}

.flashcard-nav {
    display: flex;
    gap: var(--space-lg);
    align-items: center;
}

.flashcard-nav-btn {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    border: 3px solid #1565C0;
    background: white;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 1.5rem;
}

.flashcard-counter {
    font-size: 1rem;
    color: var(--text-secondary);
    font-weight: 600;
}

.flashcard-record-section {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-sm);
}

.btn-record {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    background: #EF5350;
    border: 4px solid #C62828;
    color: white;
    font-size: 1.8rem;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: transform 0.3s;
}

.btn-record.recording {
    animation: recordPulse 1s infinite;
    background: #C62828;
}

@keyframes recordPulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

.btn-play-recording {
    width: 52px;
    height: 52px;
    border-radius: 50%;
    background: #43A047;
    border: 3px solid #2E7D32;
    color: white;
    font-size: 1.3rem;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.record-label {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

/* Motor / Toca la Luna */
.motor-game-area {
    position: relative;
    width: 100%;
    height: calc(100vh - 68px);
    margin-top: 68px;
    overflow: hidden;
    background: linear-gradient(180deg, #E8EAF6 0%, #C5CAE9 50%, #9FA8DA 100%);
    touch-action: none;
}

/* Motor game header - always visible over game area */
.motor-header {
    position: absolute;
    z-index: 30;
    width: 100%;
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border-bottom: 2px solid rgba(21, 101, 192, 0.2);
}

.motor-back-btn {
    background: #1565C0 !important;
    border: 3px solid #0D47A1 !important;
    width: 56px !important;
    height: 56px !important;
    border-radius: 50% !important;
    box-shadow: 0 3px 10px rgba(0,0,0,0.2);
}

.motor-back-btn svg {
    fill: white;
}

.motor-title {
    color: #1a237e;
    font-weight: 800;
}

.motor-luna-target {
    position: absolute;
    width: 80px;
    height: 80px;
    cursor: pointer;
    transition: left 2s ease-in-out, top 2s ease-in-out;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: center;
}

.motor-luna-target .milo-character {
    animation: motorFloat 3s ease-in-out infinite;
}

@keyframes motorFloat {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

.motor-score {
    position: absolute;
    top: var(--space-md);
    right: var(--space-md);
    background: rgba(255,255,255,0.9);
    border-radius: 16px;
    padding: var(--space-sm) var(--space-md);
    font-size: 1.2rem;
    font-weight: 800;
    color: #1a237e;
    z-index: 20;
}

.motor-touch-feedback {
    position: absolute;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: rgba(255, 193, 7, 0.4);
    pointer-events: none;
    animation: touchRipple 0.6s ease-out forwards;
}

@keyframes touchRipple {
    0% { transform: scale(0.5); opacity: 1; }
    100% { transform: scale(2); opacity: 0; }
}

/* ================================================================
   REALISM SYSTEM - Photo cards, Step-by-step, Zero Distractions
   ================================================================ */

/* --- Autonomy photo icons --- */
.autonomy-photo {
    width: 56px;
    height: 56px;
    border-radius: 12px;
    object-fit: cover;
    background: #F5F5F5;
}

.autonomy-photo-fallback {
    width: 56px;
    height: 56px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.5rem;
    border-radius: 12px;
    background: #F5F5F5;
}

/* --- Step-by-step view (Pasos Lógicos) --- */
.steps-header {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    padding: var(--space-sm) var(--space-md);
    border-bottom: 2px solid #E0E0E0;
    background: white;
    border-radius: 16px 16px 0 0;
}

.steps-back-btn {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: 2px solid #1565C0;
    background: #E3F2FD;
    color: #1565C0;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex-shrink: 0;
}

.steps-title {
    flex: 1;
    font-size: 1.1rem;
    font-weight: 800;
    color: #1a237e;
    margin: 0;
}

.steps-counter {
    font-size: 0.85rem;
    color: #1565C0;
    font-weight: 700;
    white-space: nowrap;
}

/* Progress dots */
.steps-dots {
    display: flex;
    justify-content: center;
    gap: 12px;
    padding: var(--space-md) 0;
}

.steps-dot {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #E0E0E0;
    border: 2px solid #BDBDBD;
    transition: all 0.3s;
}

.steps-dot.active {
    background: #1565C0;
    border-color: #0D47A1;
    transform: scale(1.3);
}

.steps-dot.done {
    background: #43A047;
    border-color: #2E7D32;
}

/* Step card */
.step-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: var(--space-lg);
    gap: var(--space-md);
    animation: stepFadeIn 0.4s ease-out;
}

@keyframes stepFadeIn {
    from { opacity: 0; transform: translateY(12px); }
    to { opacity: 1; transform: translateY(0); }
}

.step-photo-container {
    width: 220px;
    height: 220px;
    border-radius: 24px;
    overflow: hidden;
    background: #F5F5F5;
    border: 4px solid #1565C0;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 6px 24px rgba(21, 101, 192, 0.15);
}

.step-photo {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.step-photo-fallback {
    font-size: 6rem;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
}

.step-label {
    font-size: 1.4rem;
    font-weight: 800;
    color: #1a237e;
    text-align: center;
}

.step-desc {
    font-size: 1.05rem;
    color: #37474F;
    text-align: center;
    max-width: 280px;
    line-height: 1.5;
}

.step-complete-btn {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    padding: 16px 36px;
    background: #43A047;
    color: white;
    border: 3px solid #2E7D32;
    border-radius: 20px;
    font-size: 1.2rem;
    font-weight: 800;
    cursor: pointer;
    min-height: 56px;
    box-shadow: 0 4px 12px rgba(67, 160, 71, 0.3);
    transition: transform 0.2s;
}

.step-complete-btn:active {
    transform: scale(0.96);
}

.step-complete-icon {
    font-size: 1.4rem;
}

.step-repeat-btn {
    display: flex;
    align-items: center;
    gap: var(--space-xs);
    padding: 10px 20px;
    background: #E3F2FD;
    color: #1565C0;
    border: 2px solid #1565C0;
    border-radius: 14px;
    font-size: 0.95rem;
    font-weight: 700;
    cursor: pointer;
    margin: 0 auto;
}

/* Step celebration (mini, non-distracting) */
.step-celebration {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 9998;
    pointer-events: none;
    animation: stepCelebrateAnim 1.8s ease-out forwards;
}

.step-celebration-icon {
    font-size: 4rem;
}

@keyframes stepCelebrateAnim {
    0% { opacity: 0; transform: translate(-50%, -50%) scale(0.5); }
    30% { opacity: 1; transform: translate(-50%, -50%) scale(1.2); }
    70% { opacity: 1; transform: translate(-50%, -60%) scale(1); }
    100% { opacity: 0; transform: translate(-50%, -80%) scale(0.8); }
}

/* --- Flashcard photo styles --- */
.flashcard-photo {
    width: 150px;
    height: 150px;
    object-fit: contain;
    border-radius: 16px;
}

.flashcard-emoji-fallback {
    font-size: 6rem;
    line-height: 1;
}

/* --- ZERO DISTRACTIONS - Down Syndrome mode --- */
.mode-down-syndrome .motor-luna-target .milo-character {
    animation: none !important;
}

.mode-down-syndrome .motor-game-area {
    background: #F5F5F5;
}

.mode-down-syndrome .confetti-piece {
    animation-duration: 2.5s !important;
}

/* Remove decorative background gradients in DS mode */
.mode-down-syndrome .screen {
    background: #FAFAFA;
}

/* Reduce visual noise: no box shadows on non-interactive elements */
.mode-down-syndrome .autonomy-progress-bar {
    box-shadow: none;
}

/* Step card larger touch targets in DS mode */
.mode-down-syndrome .step-complete-btn {
    padding: 20px 44px;
    font-size: 1.3rem;
    min-height: 64px;
}

.mode-down-syndrome .step-photo-container {
    width: 240px;
    height: 240px;
    border-width: 5px;
}

.mode-down-syndrome .step-label {
    font-size: 1.6rem;
}

.mode-down-syndrome .step-desc {
    font-size: 1.15rem;
}

.mode-down-syndrome .steps-back-btn {
    width: 52px;
    height: 52px;
    background: #1565C0;
    color: white;
    border-color: #0D47A1;
}

/* Flashcard photo larger in DS mode */
.mode-down-syndrome .flashcard {
    width: 300px;
    height: 300px;
}

.mode-down-syndrome .flashcard-photo {
    width: 170px;
    height: 170px;
}

.mode-down-syndrome .flashcard-word {
    font-size: 2rem;
}

/* Responsive for step-by-step */
@media (max-width: 360px) {
    .step-photo-container {
        width: 140px;
        height: 140px;
    }
    .mode-down-syndrome .step-photo-container {
        width: 160px;
        height: 160px;
    }
    .step-card {
        padding: var(--space-sm);
        gap: var(--space-sm);
    }
    .step-label {
        font-size: 1.1rem;
    }
    .step-desc {
        font-size: 0.95rem;
    }
    .step-complete-btn {
        padding: 12px 24px;
        font-size: 1rem;
    }
    .mode-down-syndrome .step-complete-btn {
        padding: 14px 28px;
        font-size: 1.1rem;
        min-height: 52px;
    }
    .steps-header {
        padding: var(--space-xs) var(--space-sm);
    }
    .steps-dots {
        padding: var(--space-sm) 0;
    }
    .mode-down-syndrome .flashcard {
        width: 260px;
        height: 260px;
    }
    .mode-down-syndrome .flashcard-photo {
        width: 130px;
        height: 130px;
    }
}

@media (min-width: 768px) {
    .step-photo-container {
        width: 280px;
        height: 280px;
    }
    .step-label {
        font-size: 1.6rem;
    }
    .step-desc {
        font-size: 1.15rem;
    }
    .flashcard-photo {
        width: 180px;
        height: 180px;
    }
}

/* ================================================================
   SMR Authentication Screens
   ================================================================ */

/* Auth Container */
.auth-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 24px 20px;
    background: linear-gradient(160deg, #F5F0FF 0%, #EDE7F6 40%, #E8EAF6 100%);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

/* PIN screen needs tighter layout to fit keypad on mobile */
#auth-pin-screen .auth-container {
    justify-content: flex-start;
    padding-top: 32px;
}

#auth-pin-screen .auth-header {
    margin-bottom: 12px;
}

#auth-pin-screen .auth-logo svg {
    width: 48px;
    height: 48px;
}

#auth-pin-screen .auth-title {
    font-size: 22px;
}

#auth-pin-screen .auth-subtitle {
    font-size: 13px;
}

#auth-pin-screen .auth-pin-display {
    margin: 12px 0 8px;
}

#auth-pin-screen .auth-footer-text {
    margin-top: 12px;
    font-size: 11px;
}

/* Auth Header */
.auth-header {
    text-align: center;
    margin-bottom: 28px;
}

.auth-logo {
    display: flex;
    justify-content: center;
    margin-bottom: 16px;
}

.smr-logo-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 72px;
    height: 72px;
    border-radius: 20px;
    background: linear-gradient(135deg, #7C4DFF 0%, #6200EA 100%);
    color: white;
    font-size: 24px;
    font-weight: 900;
    letter-spacing: 2px;
    box-shadow: 0 8px 32px rgba(124, 77, 255, 0.35);
}

.auth-pin-lock-icon {
    width: 64px;
    height: 64px;
}

.auth-title {
    font-size: 26px;
    font-weight: 800;
    color: #37474F;
    margin: 0 0 6px;
}

.auth-subtitle {
    font-size: 14px;
    color: #78909C;
    margin: 0;
    line-height: 1.5;
}

/* Auth Form */
.auth-form {
    width: 100%;
    max-width: 360px;
}

.auth-input-group {
    margin-bottom: 16px;
}

.auth-input-group label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: #546E7A;
    margin-bottom: 6px;
}

.auth-input-wrapper {
    display: flex;
    align-items: center;
    background: white;
    border: 2px solid #E0E0E0;
    border-radius: 14px;
    padding: 0 14px;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.auth-input-wrapper:focus-within {
    border-color: #7C4DFF;
    box-shadow: 0 0 0 3px rgba(124, 77, 255, 0.12);
}

.auth-input-icon {
    width: 20px;
    height: 20px;
    fill: #B0BEC5;
    flex-shrink: 0;
    margin-right: 10px;
}

.auth-input-wrapper:focus-within .auth-input-icon {
    fill: #7C4DFF;
}

.auth-input {
    flex: 1;
    border: none;
    outline: none;
    font-size: 15px;
    padding: 14px 0;
    background: transparent;
    color: #37474F;
    font-family: var(--font-family);
}

.auth-input::placeholder {
    color: #B0BEC5;
}

.auth-toggle-pass {
    background: none;
    border: none;
    padding: 4px;
    cursor: pointer;
    display: flex;
    align-items: center;
}

.auth-toggle-pass .eye-icon {
    width: 22px;
    height: 22px;
    fill: #B0BEC5;
}

/* Auth Error */
.auth-error {
    color: #EF5350;
    font-size: 13px;
    text-align: center;
    margin: 8px 0 12px;
    padding: 8px 12px;
    background: #FFEBEE;
    border-radius: 10px;
    animation: authShake 0.4s ease;
}

.auth-forgot-btn {
    background: none;
    border: none;
    color: #5C6BC0;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    padding: 8px 0;
    width: 100%;
    text-align: center;
    margin-top: 4px;
}
.auth-forgot-btn:hover { text-decoration: underline; }

.auth-success {
    color: #2E7D32;
    font-size: 13px;
    text-align: center;
    margin: 8px 0 12px;
    padding: 8px 12px;
    background: #E8F5E9;
    border-radius: 10px;
}
.auth-success.hidden { display: none; }

@keyframes authShake {
    0%, 100% { transform: translateX(0); }
    20% { transform: translateX(-6px); }
    40% { transform: translateX(6px); }
    60% { transform: translateX(-4px); }
    80% { transform: translateX(4px); }
}

/* Auth Buttons */
.auth-btn {
    width: 100%;
    max-width: 360px;
    padding: 15px 24px;
    border-radius: 30px;
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    border: none;
    font-family: var(--font-family);
    transition: transform 0.2s, box-shadow 0.2s, opacity 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.auth-btn:active {
    transform: scale(0.97);
}

.auth-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.auth-btn-primary {
    background: linear-gradient(135deg, #7C4DFF 0%, #6200EA 100%);
    color: white;
    box-shadow: 0 4px 16px rgba(124, 77, 255, 0.35);
}

.auth-btn-primary:hover:not(:disabled) {
    box-shadow: 0 6px 24px rgba(124, 77, 255, 0.45);
}

.auth-btn-secondary {
    background: white;
    color: #7C4DFF;
    border: 2px solid #E0E0E0;
}

.auth-btn-secondary:hover {
    border-color: #7C4DFF;
    background: #F5F0FF;
}

.auth-btn-google {
    background: white;
    color: #3C4043;
    border: 2px solid #DADCE0;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    font-weight: 500;
    margin-bottom: 12px;
}

.auth-btn-google:hover:not(:disabled) {
    border-color: #4285F4;
    background: #F8FAFF;
    box-shadow: 0 2px 8px rgba(66, 133, 244, 0.18);
}

.auth-btn-google .google-g {
    flex-shrink: 0;
}

/* Auth Loader */
.auth-btn-loader {
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255,255,255,0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: authSpin 0.7s linear infinite;
}

@keyframes authSpin {
    to { transform: rotate(360deg); }
}

/* Auth Divider */
.auth-divider {
    display: flex;
    align-items: center;
    width: 100%;
    max-width: 360px;
    margin: 20px 0;
    gap: 12px;
}

.auth-divider::before,
.auth-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: #E0E0E0;
}

.auth-divider span {
    font-size: 13px;
    color: #B0BEC5;
    font-weight: 600;
}

/* Auth Footer */
.auth-footer-text {
    margin-top: 24px;
    font-size: 12px;
    color: #B0BEC5;
}

.auth-footer-text strong {
    color: #7C4DFF;
}

/* ================================================================
   SMR PIN Screen — Estilo Púrpura Premium
   ================================================================ */

/* Fondo gradiente púrpura para pantallas PIN
   NOTA: No usar display:flex aquí — JS controla visibilidad via .screen */
#auth-pin-screen,
#parent-gate-screen {
    background: linear-gradient(135deg, #7C4DFF 0%, #6200EA 50%, #4A148C 100%) !important;
    background-color: #6200EA !important;
    border: none !important;
    box-shadow: none !important;
    outline: none !important;
    /* NO align-items: center aquí — causa que .auth-container no ocupe 100% ancho */
}

#auth-pin-screen .auth-container,
#parent-gate-screen .auth-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 100% !important;
    min-height: 100%;
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
    outline: none !important;
}

/* Textos blancos sobre fondo púrpura */
#auth-pin-screen .auth-title,
#parent-gate-screen .auth-title {
    color: #FFFFFF !important;
    font-size: 22px;
    text-shadow: 0 2px 8px rgba(0,0,0,0.15);
}

#auth-pin-screen .auth-subtitle,
#parent-gate-screen .auth-subtitle {
    color: rgba(255,255,255,0.75) !important;
    font-size: 13px;
}

#auth-pin-screen .auth-footer-text,
#parent-gate-screen .auth-footer-text {
    color: rgba(255,255,255,0.5) !important;
}

#auth-pin-screen .auth-error,
#parent-gate-screen .auth-error {
    color: #FF8A80 !important;
    background: rgba(255,138,128,0.15);
    border-radius: 12px;
    padding: 8px 16px;
}

/* Ícono lock blanco */
#auth-pin-screen .auth-pin-lock-icon path,
#parent-gate-screen .auth-pin-lock-icon path {
    fill: #FFFFFF !important;
}

/* Botón volver blanco */
#parent-gate-screen .pin-back-btn svg path {
    fill: #FFFFFF !important;
}

.auth-pin-display {
    margin: 24px 0 16px;
}

.auth-pin-dots {
    display: flex;
    gap: 18px;
    justify-content: center;
    transition: transform 0.3s;
}

.auth-pin-dots.shake {
    animation: pinShake 0.5s ease;
}

@keyframes pinShake {
    0%, 100% { transform: translateX(0); }
    20% { transform: translateX(-10px); }
    40% { transform: translateX(10px); }
    60% { transform: translateX(-8px); }
    80% { transform: translateX(8px); }
}

.auth-pin-dot {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    border: 3px solid rgba(255,255,255,0.35);
    background: transparent;
    transition: background 0.2s, border-color 0.2s, transform 0.2s;
}

.auth-pin-dot.filled {
    background: #FFFFFF;
    border-color: #FFFFFF;
    transform: scale(1.15);
}

.auth-pin-keypad {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    width: 100%;
    max-width: 280px;
    margin: 10px auto;
}

.auth-pin-key {
    width: 100%;
    aspect-ratio: 1;
    max-height: 72px;
    border-radius: 50%;
    border: 2px solid rgba(255,255,255,0.2);
    background: rgba(255,255,255,0.1);
    font-size: 28px;
    font-weight: 700;
    color: #FFFFFF;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s, transform 0.15s, border-color 0.15s;
    box-shadow: none;
    font-family: var(--font-family);
    -webkit-tap-highlight-color: transparent;
    backdrop-filter: blur(4px);
}

.auth-pin-key:active {
    background: rgba(255,255,255,0.25);
    border-color: rgba(255,255,255,0.5);
    transform: scale(0.93);
}

.auth-pin-empty {
    background: transparent !important;
    border-color: transparent !important;
    pointer-events: none;
}

.auth-pin-delete {
    background: rgba(255,255,255,0.08);
    border-color: rgba(255,255,255,0.15);
}

.auth-pin-delete svg path {
    fill: rgba(255,255,255,0.7) !important;
}

.auth-pin-delete:active {
    background: rgba(255,255,255,0.2);
}

/* Splash SMR badge */
.splash-smr-badge {
    display: inline-block;
    margin-top: 12px;
    padding: 4px 16px;
    border-radius: 20px;
    background: rgba(255,255,255,0.2);
    color: rgba(255,255,255,0.8);
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 2px;
}

/* Play Store badge (web-only, hidden inside the Cordova APK).
   Appears on splash + login so web visitors can download the Android app. */
.play-store-badge {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    margin-top: 14px;
    padding: 10px 18px;
    border-radius: 8px;
    background: #000;
    color: #fff;
    text-decoration: none;
    font-family: 'Roboto', system-ui, -apple-system, sans-serif;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
    box-shadow: 0 4px 14px rgba(0,0,0,0.18);
}
.play-store-badge:hover,
.play-store-badge:focus {
    transform: translateY(-1px);
    box-shadow: 0 6px 18px rgba(0,0,0,0.28);
}

/* Splash Partner Button */
.splash-partner-btn {
    display: block;
    margin-top: 20px;
    padding: 12px 24px;
    border-radius: 12px;
    background: linear-gradient(135deg, #FFD54F 0%, #FFA726 100%);
    color: #4A148C;
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.5px;
    text-decoration: none;
    text-align: center;
    line-height: 1.4;
    box-shadow: 0 4px 16px rgba(255,167,38,0.4);
    animation: partnerPulse 2.5s ease-in-out infinite;
    max-width: 320px;
}

@keyframes partnerPulse {
    0%, 100% { transform: scale(1); box-shadow: 0 4px 16px rgba(255,167,38,0.4); }
    50% { transform: scale(1.03); box-shadow: 0 6px 24px rgba(255,167,38,0.6); }
}

/* Auth Screen Partner Button */
.auth-partner-btn {
    display: block;
    margin: 16px auto 0;
    padding: 10px 20px;
    border-radius: 10px;
    background: linear-gradient(135deg, #FFD54F 0%, #FFA726 100%);
    color: #4A148C;
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 0.3px;
    text-decoration: none;
    text-align: center;
    line-height: 1.4;
    box-shadow: 0 3px 12px rgba(255,167,38,0.35);
    transition: transform 0.2s, box-shadow 0.2s;
    max-width: 280px;
    width: 100%;
}

.auth-partner-btn:active {
    transform: scale(0.97);
    box-shadow: 0 2px 8px rgba(255,167,38,0.3);
}

/* ================================================================
   QR Code - Parent Remote Monitoring
   ================================================================ */

/* QR Promo Card */
.qr-promo-card {
    background: linear-gradient(135deg, #F5F0FF 0%, #EDE7F6 100%);
    border: 2px solid #D1C4E9;
}

.qr-promo-content {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    margin-bottom: 16px;
}

.qr-promo-icon {
    font-size: 36px;
    flex-shrink: 0;
}

.qr-promo-text h4 {
    font-size: 15px;
    font-weight: 700;
    color: #37474F;
    margin-bottom: 4px;
}

.qr-promo-text p {
    font-size: 13px;
    color: #78909C;
    line-height: 1.5;
}

.qr-generate-btn {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 14px;
    border-radius: 14px;
    font-size: 15px;
    font-weight: 700;
    border: none;
    color: white;
    background: linear-gradient(135deg, #7C4DFF 0%, #6200EA 100%);
    box-shadow: 0 4px 16px rgba(124, 77, 255, 0.3);
    cursor: pointer;
    font-family: var(--font-family);
    transition: transform 0.2s;
}

.qr-generate-btn:active {
    transform: scale(0.97);
}

/* QR Modal */
.qr-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    padding: 20px;
    animation: qrFadeIn 0.3s ease;
}

.qr-modal-overlay.hidden {
    display: none;
}

@keyframes qrFadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.qr-modal {
    background: white;
    border-radius: 24px;
    padding: 24px 20px;
    width: 100%;
    max-width: 340px;
    max-height: 90vh;
    overflow-y: auto;
    text-align: center;
    position: relative;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.25);
    animation: qrSlideUp 0.3s ease;
}

@keyframes qrSlideUp {
    from { transform: translateY(30px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

.qr-modal-close {
    position: absolute;
    top: 12px;
    right: 16px;
    background: none;
    border: none;
    font-size: 28px;
    color: #B0BEC5;
    cursor: pointer;
    line-height: 1;
    padding: 4px;
}

.qr-modal-header {
    margin-bottom: 12px;
}

.smr-logo-badge-sm {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    border-radius: 14px;
    background: linear-gradient(135deg, #7C4DFF 0%, #6200EA 100%);
    color: white;
    font-size: 16px;
    font-weight: 900;
    letter-spacing: 1px;
    margin-bottom: 10px;
}

.qr-modal-header h3 {
    font-size: 20px;
    font-weight: 800;
    color: #37474F;
    margin-bottom: 4px;
}

.qr-modal-header p {
    font-size: 13px;
    color: #78909C;
}

/* QR Canvas Container */
.qr-code-container {
    display: flex;
    justify-content: center;
    align-items: center;
    margin: 10px 0;
    padding: 12px;
    background: #FAFAFA;
    border-radius: 16px;
    border: 2px dashed #E0E0E0;
}

.qr-code-container canvas {
    border-radius: 8px;
}

.qr-url-display {
    font-size: 11px;
    color: #B0BEC5;
    word-break: break-all;
    margin-bottom: 16px;
    padding: 0 8px;
}

/* QR Instructions */
.qr-instructions {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 16px;
    text-align: left;
}

.qr-step {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 13px;
    color: #546E7A;
}

.qr-step-num {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: #EDE7F6;
    color: #7C4DFF;
    font-size: 12px;
    font-weight: 700;
    flex-shrink: 0;
}

.qr-copy-btn {
    width: 100%;
    padding: 12px;
    border-radius: 12px;
    font-size: 14px;
    font-weight: 600;
    border: 2px solid #E0E0E0;
    background: white;
    color: #546E7A;
    cursor: pointer;
    font-family: var(--font-family);
    transition: background 0.2s;
}

.qr-copy-btn:active {
    background: #F5F0FF;
}

/* ================================================================
   GUEST MODE STYLES
   ================================================================ */

/* Privacy policy link */
.auth-privacy-link {
    display: inline-block;
    margin-top: 8px;
    font-size: 12px;
    color: #7C4DFF;
    text-decoration: none;
    font-weight: 500;
}

.auth-privacy-link:active {
    text-decoration: underline;
}

.auth-privacy-notice {
    font-size: 11px;
    color: #9E9E9E;
    margin-top: 12px;
    text-align: center;
    line-height: 1.4;
}

.auth-privacy-notice .auth-privacy-link {
    margin-top: 0;
}

/* Trust badges - COPPA & kidSAFE */
.trust-badges {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-top: 12px;
}

.trust-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    background: #F1F8E9;
    border: 1px solid #C5E1A5;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 700;
    color: #33691E;
    letter-spacing: 0.5px;
}

.trust-msg {
    text-align: center;
    font-size: 11px;
    color: #78909C;
    margin: 6px 0 8px;
    line-height: 1.3;
}

.trust-msg-sm {
    text-align: center;
    font-size: 10px;
    color: #90A4AE;
    margin: 4px 0 0;
}

.trust-footer {
    padding: 12px 16px 8px;
    text-align: center;
}

/* Guest explore button on login screen */
.auth-guest-divider {
    margin-top: 16px;
    text-align: center;
}

.auth-guest-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: 1.5px dashed #B39DDB;
    border-radius: 12px;
    padding: 10px 20px;
    font-size: 14px;
    font-weight: 600;
    color: #7C4DFF;
    cursor: pointer;
    font-family: var(--font-family);
    transition: background 0.2s, border-color 0.2s;
    width: 100%;
}

.auth-guest-btn:active {
    background: #F3E5F5;
    border-color: #7C4DFF;
}

/* Guest lock badge styles */

/* Guest conversion overlay/modal */
.guest-conversion-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 9000;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    animation: fadeIn 0.3s ease;
}

.guest-conversion-overlay.hidden {
    display: none !important;
}

.guest-conversion-modal {
    background: white;
    border-radius: 24px;
    padding: 32px 24px;
    max-width: 340px;
    width: 100%;
    text-align: center;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: slideUp 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
    max-height: 90vh;
    overflow-y: auto;
}

.guest-conversion-illustration {
    margin-bottom: 16px;
}

.guest-conv-shield {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: linear-gradient(135deg, #EDE7F6, #E8EAF6);
    box-shadow: 0 4px 16px rgba(124, 77, 255, 0.2);
}

.guest-conv-title {
    font-size: 20px;
    font-weight: 700;
    color: #1A1A2E;
    margin: 0 0 8px;
    font-family: var(--font-family);
}

.guest-conv-desc {
    font-size: 13px;
    color: #78909C;
    line-height: 1.5;
    margin: 0 0 20px;
}

.guest-conv-features {
    text-align: left;
    margin-bottom: 24px;
}

.guest-conv-feature {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 0;
    font-size: 13px;
    color: #37474F;
    font-weight: 500;
}

.guest-conv-check {
    color: #4CAF50;
    font-weight: 700;
    font-size: 16px;
    flex-shrink: 0;
}

.guest-conv-signup-btn {
    margin-bottom: 12px;
}

.guest-conv-later-btn {
    background: none;
    border: none;
    color: #9E9E9E;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    padding: 8px;
    font-family: var(--font-family);
}

.guest-conv-later-btn:active {
    color: #7C4DFF;
}

/* ================================================================
   Email Verification Code Inputs
   ================================================================ */
.email-code-digit {
    width: 44px;
    height: 54px;
    border: 2px solid #D1C4E9;
    border-radius: 12px;
    text-align: center;
    font-size: 24px;
    font-weight: 700;
    color: #6200EA;
    background: #FFFFFF;
    transition: border-color 0.2s, box-shadow 0.2s;
    outline: none;
    -webkit-appearance: none;
    font-family: var(--font-family);
}

.email-code-digit:focus {
    border-color: #7C4DFF;
    box-shadow: 0 0 0 3px rgba(124, 77, 255, 0.2);
}

.email-code-digit.filled {
    border-color: #7C4DFF;
    background: #F3E5F5;
}

.email-code-digit.error {
    border-color: #FF5252;
    animation: shake 0.4s;
}

.auth-btn-ghost {
    background: transparent;
    border: none;
    color: #7C4DFF;
    font-size: 14px;
    cursor: pointer;
    padding: 10px;
    font-family: var(--font-family);
}

.auth-btn-ghost:disabled {
    color: #999;
    cursor: not-allowed;
}

@media (max-width: 320px) {
    .email-code-digit {
        width: 36px;
        height: 46px;
        font-size: 20px;
        border-radius: 8px;
    }
    #email-code-inputs {
        gap: 5px !important;
    }
}

/* Guest padlock overlay on home screen locked items */
.guest-lock-badge {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: linear-gradient(135deg, #FFD700, #FFA000);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    box-shadow: 0 2px 8px rgba(255, 160, 0, 0.4);
    z-index: 5;
    pointer-events: none;
}

/* ================================================================
   RESPONSIVE FIXES — Extra small devices (≤320px)
   iPhone SE 1st gen, Galaxy J1, etc.
   ================================================================ */
@media (max-width: 320px) {
    .auth-container {
        padding: 16px 12px;
    }

    #auth-pin-screen .auth-container,
    #parent-gate-screen .auth-container {
        padding-top: 20px;
    }

    #auth-pin-screen .auth-logo svg {
        width: 36px;
        height: 36px;
    }

    #auth-pin-screen .auth-title {
        font-size: 18px;
    }

    #auth-pin-screen .auth-subtitle {
        font-size: 12px;
    }

    .auth-pin-keypad {
        max-width: 230px;
        gap: 8px;
    }

    .auth-pin-key {
        max-height: 58px;
        font-size: 22px;
    }

    .auth-input {
        padding: 10px 12px;
        font-size: 14px;
    }

    .auth-btn {
        padding: 12px;
        font-size: 14px;
    }

    .smr-logo-badge {
        width: 56px;
        height: 56px;
    }

    .auth-form {
        max-width: 100%;
    }

    .nav-card {
        padding: 10px 6px;
    }

    .nav-card-emoji {
        font-size: 28px;
    }

    .nav-card-label {
        font-size: 11px;
    }
}

/* ================================================================
   Safe area insets for PIN/auth screens (notched phones)
   ================================================================ */
@supports (padding: env(safe-area-inset-top)) {
    #auth-pin-screen .auth-container,
    #parent-gate-screen .auth-container {
        padding-top: calc(20px + env(safe-area-inset-top));
    }

    #auth-login-screen .auth-container,
    #auth-register-screen .auth-container {
        padding-top: calc(24px + env(safe-area-inset-top));
        padding-bottom: calc(24px + env(safe-area-inset-bottom));
    }
}

/* ================================================================
   Landscape fix for PIN keypad
   ================================================================ */
@media (max-height: 500px) and (orientation: landscape) {
    #auth-pin-screen .auth-container,
    #parent-gate-screen .auth-container {
        flex-direction: row;
        flex-wrap: wrap;
        justify-content: center;
        align-items: center;
        gap: 16px;
        padding: 12px 20px;
    }

    #auth-pin-screen .auth-header,
    #parent-gate-screen .auth-header {
        flex: 1 1 40%;
        margin-bottom: 0;
        text-align: left;
    }

    .auth-pin-keypad {
        max-width: 200px;
        gap: 6px;
    }

    .auth-pin-key {
        max-height: 48px;
        font-size: 20px;
    }

    #auth-pin-screen .auth-pin-display {
        margin: 8px 0;
    }

    #auth-pin-screen .auth-footer-text,
    #parent-gate-screen .auth-footer-text {
        display: none;
    }

    .auth-container {
        padding: 12px 16px;
        min-height: auto;
    }
}

/* ================================================================
   MOBILE-FIRST RESPONSIVE OPTIMIZATION (Production 2026)
   Ensures perfect rendering on all devices from 320px to tablets
   ================================================================ */

/* --- Splash Screen: fit all content on any screen --- */
#splash-screen {
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.splash-content {
    padding: 16px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    min-height: 100dvh;
    box-sizing: border-box;
    width: 100%;
    max-width: 480px;
    margin: 0 auto;
}

.splash-logo {
    flex-shrink: 0;
}

.splash-partner-btn {
    max-width: 90%;
    margin-left: auto;
    margin-right: auto;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

/* --- Permissions Consent: scrollable on short screens --- */
.permissions-consent-container {
    min-height: 100vh;
    min-height: 100dvh;
}

/* --- All screens: prevent horizontal overflow --- */
.screen {
    max-width: 100vw;
}

/* --- Home grid: fluid cards --- */
.nav-cards {
    width: 100%;
    box-sizing: border-box;
}

.nav-card {
    min-width: 0;
    overflow: hidden;
}

/* --- Auth screens: prevent overflow on small screens --- */
.auth-container {
    max-width: 100%;
    box-sizing: border-box;
}

/* ================================================================
   Small phones (320px - 374px) - iPhone SE, Galaxy S series mini
   ================================================================ */
@media (max-width: 374px) {
    .splash-content {
        padding: 12px;
    }

    .splash-title {
        font-size: 28px;
    }

    .splash-tagline {
        font-size: 13px;
    }

    .splash-partner-btn {
        font-size: 9px;
        padding: 8px 12px;
    }

    #splash-milo .milo-body,
    .milo-large .milo-body {
        width: 90px;
        height: 90px;
    }

    .milo-large .milo-eye {
        width: 14px;
        height: 14px;
    }

    .milo-large .milo-mouth {
        width: 26px;
        height: 11px;
    }

    .splash-logo {
        margin-bottom: 12px;
    }

    .nav-card {
        padding: 14px 10px;
        gap: 8px;
    }

    .card-icon {
        width: 48px;
        height: 48px;
    }

    .card-label {
        font-size: 15px;
    }

    .app-header {
        padding: 8px 12px;
    }

    .app-title {
        font-size: 16px;
    }

    .greeting-area {
        padding: 4px;
    }

    .assistant-bubble {
        padding: 10px;
        gap: 8px;
    }

    .assistant-message {
        font-size: 14px;
    }

    .permissions-consent-title {
        font-size: 20px;
    }

    .permissions-consent-subtitle {
        font-size: 14px;
    }

    .permission-card {
        padding: 12px;
        gap: 10px;
    }

    .permission-card-icon {
        width: 40px;
        height: 40px;
        font-size: 20px;
    }

    .permissions-consent-btn {
        font-size: 16px;
        padding: 14px 24px;
    }
}

/* ================================================================
   Medium phones (375px - 413px) - iPhone 12/13/14, standard Android
   ================================================================ */
@media (min-width: 375px) and (max-width: 413px) {
    .splash-title {
        font-size: 32px;
    }

    .splash-tagline {
        font-size: 14px;
    }

    #splash-milo .milo-body,
    .milo-large .milo-body {
        width: 100px;
        height: 100px;
    }

    .nav-card {
        padding: 16px 12px;
    }

    .card-icon {
        width: 56px;
        height: 56px;
    }
}

/* ================================================================
   Large phones (414px - 479px) - iPhone Plus/Max, Galaxy S Ultra
   ================================================================ */
@media (min-width: 414px) and (max-width: 479px) {
    .splash-title {
        font-size: 36px;
    }

    #splash-milo .milo-body,
    .milo-large .milo-body {
        width: 110px;
        height: 110px;
    }
}

/* ================================================================
   Short screens / landscape - prevent content clipping
   ================================================================ */
@media (max-height: 600px) {
    .splash-content {
        justify-content: flex-start;
        padding-top: 16px;
        padding-bottom: 16px;
        min-height: auto;
    }

    .splash-logo {
        margin-bottom: 8px;
    }

    #splash-milo .milo-body,
    .milo-large .milo-body {
        width: 72px;
        height: 72px;
    }

    .milo-large .milo-eye {
        width: 12px;
        height: 12px;
    }

    .milo-large .milo-mouth {
        width: 22px;
        height: 10px;
    }

    .splash-title {
        font-size: 26px;
        margin-bottom: 4px;
    }

    .splash-tagline {
        font-size: 12px;
    }

    .splash-smr-badge {
        margin-top: 8px;
    }

    .loading-dots {
        margin-top: 12px;
    }

    .splash-partner-btn {
        margin-top: 10px;
        padding: 8px 14px;
        font-size: 9px;
    }

    .permissions-consent-container {
        padding: 12px;
        min-height: auto;
    }

    .permissions-consent-header {
        margin-bottom: 12px;
    }

    .permissions-consent-icon {
        font-size: 32px;
    }

    .permissions-consent-title {
        font-size: 18px;
    }

    .permission-card {
        padding: 10px;
    }
}

/* ================================================================
   Tablets (480px+) - iPad, Android tablets
   ================================================================ */
@media (min-width: 480px) {
    .splash-content {
        max-width: 440px;
    }

    .nav-cards {
        max-width: 500px;
        margin: 0 auto;
    }

    .home-grid {
        max-width: 540px;
        margin: 0 auto;
        width: 100%;
    }

    .permissions-consent-container {
        max-width: 480px;
        margin: 0 auto;
    }
}

/* ================================================================
   Safe area insets for notch/island phones (iPhone X+, Pixel)
   ================================================================ */
@supports (padding-top: env(safe-area-inset-top)) {
    .app-header {
        padding-top: calc(8px + env(safe-area-inset-top));
    }

    .splash-content {
        padding-top: calc(16px + env(safe-area-inset-top));
        padding-bottom: calc(16px + env(safe-area-inset-bottom));
    }

    .permissions-consent-container {
        padding-top: calc(24px + env(safe-area-inset-top));
        padding-bottom: calc(24px + env(safe-area-inset-bottom));
    }

    #float-milo {
        bottom: calc(20px + env(safe-area-inset-bottom));
    }
}
