/* style.css */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');
@import url("https://fonts.googleapis.com/icon?family=Material+Icons");

:root {
    --background-color: #F7F8FA;
    --sidebar-color: #FFFFFF;
    --main-text-color: #1F2937;
    --subtle-text-color: #6B7280;
    --border-color: #E5E7EB;
    --accent-color: #4F46E5;
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
}

/* --- Homepage Styles --- */
.homepage {
    font-family: 'Inter', sans-serif;
    background-color: #fff;
    color: var(--main-text-color);
    margin: 0;
    padding: 0;
    overflow-x: hidden;
}
.homepage .container {
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 20px;
}
.homepage-header {
    padding: 1.5rem 0;
    border-bottom: 1px solid var(--border-color);
}
.homepage-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.homepage-nav .logo {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--accent-color);
}
.homepage-nav .nav-links a {
    text-decoration: none;
    color: var(--subtle-text-color);
    font-weight: 500;
    margin-left: 2rem;
    transition: color 0.2s;
}
.homepage-nav .nav-links a:hover {
    color: var(--main-text-color);
}
.button {
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    font-weight: 600;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    transition: transform 0.2s, box-shadow 0.2s;
}
.button:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}
.button.button-primary {
    background-color: var(--accent-color);
    color: #fff;
}
.button.button-secondary {
    background-color: #E0E7FF;
    color: var(--accent-color);
}
.hero {
    text-align: center;
    padding: 6rem 0;
}
.hero h1 {
    font-size: 3.5rem;
    font-weight: 700;
    line-height: 1.1;
    margin: 0;
}
.hero .subtitle {
    font-size: 1.25rem;
    color: var(--subtle-text-color);
    max-width: 600px;
    margin: 1.5rem auto 2.5rem;
}
.features {
    padding: 4rem 0;
    background-color: var(--background-color);
}
.features h2 {
    text-align: center;
    font-size: 2.5rem;
    margin-bottom: 3rem;
}
.features-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
}
.feature-item {
    text-align: center;
}
.feature-item i {
    font-size: 2.5rem;
    color: var(--accent-color);
    margin-bottom: 1rem;
}
.feature-item h3 {
    font-size: 1.25rem;
    margin-bottom: 0.5rem;
}
.feature-item p {
    color: var(--subtle-text-color);
    line-height: 1.6;
}
.homepage-footer {
    padding: 2rem 0;
    text-align: center;
    color: var(--subtle-text-color);
    font-size: 0.9rem;
}

/* --- Demo Banner --- */
.demo-banner {
    background-color: #EAB308;
    color: #422006;
    padding: 0.75rem 0;
    font-weight: 500;
}
.demo-banner .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}
.demo-banner p { margin: 0; }
.demo-banner .demo-actions a {
    color: #422006;
    margin-left: 1rem;
    text-decoration: underline;
}
.demo-banner .demo-actions a.button {
    background-color: #fff;
    color: var(--accent-color);
    padding: 0.5rem 1rem;
    border-radius: 6px;
    text-decoration: none;
}

/* --- Main App Styles --- */
html, body:not(.homepage) {
    height: 100%;
    margin: 0;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background-color: var(--background-color);
    color: var(--main-text-color);
}

html, body {
    height: 100%;
    margin: 0;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background-color: var(--background-color);
    color: var(--main-text-color);
}

body {
    overflow: hidden; /* Prevent body scroll, let containers handle it */
}

.app-wrapper { display: flex; width: 100%; height: 100%; }
.sidebar {
    width: 80px; /* Reverted to compact sidebar */
    background-color: var(--sidebar-color);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    align-items: center;
    padding-top: 20px;
    flex-shrink: 0;
}
.sidebar-link {
    display: flex;
    flex-direction: column; /* Reverted to icon over text */
    align-items: center;
    margin-bottom: 15px; /* Adjusted margin */
    padding: 8px;
    width: 100%;
    box-sizing: border-box;
    border-radius: 6px;
    text-decoration: none;
    color: var(--subtle-text-color);
    font-size: 0.75rem;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.2s, color 0.2s;
    /* Kiosk Fixes */
    touch-action: manipulation;
    -webkit-user-drag: none;
    user-select: none;
}
.sidebar-link:hover {
    background-color: #F9FAFB;
}
.sidebar-link i {
    font-size: 1.5rem;
    margin-bottom: 5px; /* Space between icon and text */
}
.sidebar-link.active {
    color: var(--accent-color);
    background-color: #EEF2FF;
    font-weight: 600;
}


.main-content { flex-grow: 1; display: flex; flex-direction: column; padding: 0 32px; height: 100%; box-sizing: border-box; overflow-y: auto; }
.app-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 24px 0;
    margin-bottom: 16px;
    flex-shrink: 0;
    border-bottom: 1px solid var(--border-color);
}
.header-left { display: flex; align-items: center; gap: 20px; }
.family-name { font-size: 1.5rem; font-weight: 700; }
#weather-display { display: flex; align-items: center; gap: 8px; font-size: 1.25rem; font-weight: 600; color: var(--subtle-text-color); }
#weather-display img { width: 40px; height: 40px; }
.weather-text { font-size: 1rem; font-weight: 500; }
.user-info { font-size: 0.9em; color: var(--subtle-text-color); }
.user-info a { color: var(--accent-color); text-decoration: none; font-weight: 500; }
.view-container { flex-grow: 1; position: relative; height: 100%; min-height: 0; }
.view { display: none; height: 100%; width: 100%; flex-direction: column; overflow-y: auto; padding-bottom: 32px; }
.view.active { display: flex; }

/* Views that need centered content */
#chores-view, #photos-view, #lists-view, #recipes-view, #rewards-view {
    max-width: 1200px;
    margin: 0 auto;
    width: 100%;
}

#calendar-view { height: 100%; overflow-y: hidden; } /* Calendar manages its own scroll */
#calendar { flex-grow: 1; }
.view-header { margin-bottom: 20px; flex-shrink: 0; }

/* User Progress Bar Styles */
.user-progress-bar-container { display: flex; flex-wrap: wrap; gap: 16px; margin-bottom: 24px; width: 100%; flex-shrink: 0; background-color: #fff; padding: 16px; border-radius: 12px; border: 1px solid var(--border-color); box-shadow: var(--shadow-sm); }
.user-progress-item { flex: 1 1 250px; } /* FIX: Changed flex property for better wrapping */
.user-progress-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.user-progress-name { font-weight: 600; font-size: 0.9rem; display: flex; align-items: center; gap: 8px; }
.user-progress-header .user-avatar { width: 24px; height: 24px; font-size: 0.8rem; }
.user-progress-fraction { font-size: 0.8rem; font-weight: 500; color: var(--subtle-text-color); }
.progress-track { width: 100%; height: 6px; background-color: #F3F4F6; border-radius: 99px; overflow: hidden; }
.progress-fill { height: 100%; background-color: var(--accent-color); border-radius: 99px; width: 0%; transition: width 0.3s ease-in-out; }

/* Calendar Customization */
:root { --fc-border-color: var(--border-color); --fc-event-bg-color: var(--accent-color); --fc-event-border-color: var(--accent-color); --fc-event-text-color: #ffffff; --fc-today-bg-color: rgba(79, 70, 229, 0.05); }
#calendar .fc-event, #mobile-calendar-view .fc-event { border: none !important; padding: 4px 8px !important; font-size: 0.8rem; font-weight: 500; cursor: pointer; }
#calendar .fc-day-today, #mobile-calendar-view .fc-day-today { background-color: var(--fc-today-bg-color) !important; }
#calendar .fc-toolbar-title, #mobile-calendar-view .fc-toolbar-title { font-size: 1.25rem !important; font-weight: 600; }
#calendar .fc-button, #mobile-calendar-view .fc-button { background-color: var(--sidebar-color) !important; color: var(--main-text-color) !important; border: 1px solid var(--border-color) !important; box-shadow: none !important; }
#calendar .fc-button-primary:not(:disabled).fc-button-active, #mobile-calendar-view .fc-button-primary:not(:disabled).fc-button-active { background-color: var(--accent-color) !important; color: white !important; }
#mobile-calendar-view .fc-header-toolbar { flex-wrap: wrap; font-size: 0.8rem; } /* Better toolbar for mobile */


/* Other View Styles... */
#chores-view.active { display: grid; grid-template-columns: repeat(auto-fill, minmax(350px, 1fr)); gap: 20px; align-content: start; } /* FIX: Changed to grid */
#lists-view.active, #recipes-view.active { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 20px; align-content: start; }
#photos-view #photo-grid-container { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 16px; } /* FIX: Moved grid style to correct container */
#rewards-view.active { display: flex; flex-direction: column; gap: 24px; }
#meals-view.active { display: grid; grid-template-columns: repeat(7, 1fr); gap: 16px; align-content: start; }
#settings-view.active { display: flex; flex-direction: column; gap: 24px; max-width: 800px; margin: 0 auto; }


.chore-column { background-color: #FFFFFF; border-radius: 16px; padding: 16px; box-shadow: var(--shadow-md); border: none; min-width: 300px; }
.chore-column-header { display: flex; align-items: center; padding-bottom: 12px; margin-bottom: 12px; border-bottom: 1px solid var(--border-color); }
.user-avatar { width: 32px; height: 32px; border-radius: 50%; color: white; display: flex; align-items: center; justify-content: center; font-weight: 600; margin-right: 12px; }
.user-name { font-weight: 600; font-size: 1.1rem; flex-grow: 1; }
.user-points { font-size: 1rem; font-weight: 700; color: var(--accent-color); }
.chore-card { background-color: #F9FAFB; border-radius: 8px; padding: 12px; margin-bottom: 10px; display: flex; align-items: center; border: 1px solid #F3F4F6; cursor: pointer; position: relative; flex-wrap: wrap; transition: transform 0.2s, box-shadow 0.2s; }
.chore-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.chore-card.complete { opacity: 0.6; }
.chore-card.complete .chore-description { text-decoration: line-through; }
.chore-checkbox { width: 20px; height: 20px; border-radius: 50%; border: 2px solid var(--border-color); margin-right: 12px; flex-shrink: 0; display: flex; align-items: center; justify-content: center; color: white; font-size: 0.8rem; transition: background-color 0.2s; }
.chore-card.complete .chore-checkbox { background-color: #22C55E; border-color: #22C55E; }
.chore-description { font-weight: 500; flex-grow: 1; margin-right: 10px; }
.chore-points { font-weight: 600; font-size: 0.8rem; padding: 4px 8px; border-radius: 99px; background-color: #E0E7FF; color: #4338CA; }
.chore-card.complete .chore-points { background-color: #DCFCE7; color: #166534; }
.chore-frequency-badge { font-size: 0.7rem; font-weight: 600; padding: 2px 6px; border-radius: 4px; background-color: #F3F4F6; color: var(--subtle-text-color); text-transform: uppercase; margin-top: 4px; flex-basis: 100%; }
.claim-button { background-color: #22C55E; color: white; border: none; padding: 6px 12px; border-radius: 6px; cursor: pointer; font-weight: 500; margin-left: auto; }

.reward-card, .list-card, .settings-card, .recipe-card { transition: transform 0.2s, box-shadow 0.2s; cursor: pointer; }
.reward-card:hover, .list-card:hover, .settings-card:hover, .recipe-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }


.reward-card { background-color: #fff; border: 1px solid var(--border-color); border-radius: 8px; padding: 16px; display: flex; justify-content: space-between; align-items: center; }
.reward-title { font-weight: 600; flex-grow: 1; }
.reward-cost { display: flex; align-items: center; gap: 12px; }
.reward-points { font-weight: 700; color: var(--accent-color); }
.redeem-button { background-color: var(--accent-color); color: white; border: none; padding: 8px 16px; border-radius: 6px; cursor: pointer; font-weight: 500; }
.redeem-button:disabled { background-color: #9CA3AF; cursor: not-allowed; }

.history-section { margin-top: 20px; }
.history-section h2 { font-size: 1.2rem; padding-bottom: 12px; border-bottom: 1px solid var(--border-color); margin-bottom: 20px; }
.history-table { width: 100%; border-collapse: collapse; background-color: #fff; border-radius: 8px; overflow: hidden; border: 1px solid var(--border-color); }
.history-table th, .history-table td { padding: 12px 16px; text-align: left; border-bottom: 1px solid var(--border-color); }
.history-table thead { background-color: #F9FAFB; }
.history-table th { font-size: 0.85rem; font-weight: 600; color: var(--subtle-text-color); text-transform: uppercase; }
.history-table tbody tr:last-child td { border-bottom: none; }

.photo-item { position: relative; border-radius: 8px; overflow: hidden; box-shadow: var(--shadow-sm); background-color: #fff; border: 1px solid var(--border-color); }
.photo-item img { width: 100%; height: 200px; object-fit: cover; display: block; }
.photo-item .caption { padding: 12px; font-size: 0.9rem; color: var(--subtle-text-color); }
.photo-delete-btn {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 30px;
    height: 30px;
    background-color: rgba(0, 0, 0, 0.5);
    color: white;
    border: none;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.2s;
}
.photo-item:hover .photo-delete-btn {
    opacity: 1;
}

.meal-day-column { background-color: #FFFFFF; border-radius: 12px; padding: 12px; box-shadow: var(--shadow-sm); border: 1px solid var(--border-color); }
.meal-day-header { font-weight: 600; text-align: center; padding-bottom: 8px; margin-bottom: 8px; border-bottom: 1px solid var(--border-color); }
.meal-type-section { margin-bottom: 12px; }
.meal-type-title { font-size: 0.8rem; font-weight: 600; color: var(--subtle-text-color); margin-bottom: 8px; }
.meal-item { font-size: 0.9rem; background-color: #F9FAFB; padding: 8px; border-radius: 6px; margin-bottom: 6px; cursor: pointer; display: flex; align-items: center; gap: 6px; }
.meal-item .fa-book-open { color: var(--subtle-text-color); font-size: 0.8rem; }
.meal-item-placeholder { height: 35px; }

.list-card { background-color: #fff; border-radius: 12px; border: 1px solid var(--border-color); padding: 16px; }
.list-header { display: flex; justify-content: space-between; align-items: center; border-bottom: 1px solid var(--border-color); padding-bottom: 12px; margin-bottom: 12px; }
.list-title { font-size: 1.1rem; font-weight: 600; }
.add-item-to-list-btn { background: none; border: none; color: var(--accent-color); cursor: pointer; font-size: 1.2rem; }
.list-item { display: flex; align-items: center; padding: 8px 0; }
.list-item-checkbox { width: 20px; height: 20px; margin-right: 12px; accent-color: var(--accent-color); }
.list-item-description { flex-grow: 1; }
.list-item.checked .list-item-description { text-decoration: line-through; color: var(--subtle-text-color); }

.settings-card { background-color: #fff; border: 1px solid var(--border-color); border-radius: 12px; padding: 24px; }
.settings-card h2 { margin-top: 0; padding-bottom: 12px; border-bottom: 1px solid var(--border-color); margin-bottom: 20px; font-size: 1.2rem; }
.settings-form { display: flex; flex-direction: column; gap: 16px; }
.form-group { display: flex; flex-direction: column; gap: 6px; }
.form-group label { font-weight: 500; font-size: 0.9rem; }
.form-group input[type="text"], .form-group input[type="password"], .form-group input[type="color"], .form-group select { padding: 10px; border-radius: 6px; border: 1px solid #CFD8E1; font-size: 1rem; font-family: inherit; }
.form-group input[type="color"] { height: 45px; padding: 5px; }
.settings-form button { align-self: flex-start; background-color: var(--accent-color); color: white; border: none; padding: 10px 20px; border-radius: 6px; cursor: pointer; font-weight: 500; font-size: 1rem; margin-top: 10px; }
.family-info-display p { margin: 0 0 10px 0; }
.family-info-display strong { font-weight: 600; background-color: #F3F4F6; padding: 4px 8px; border-radius: 6px; font-family: monospace; }

.recipe-card { background-color: #fff; border-radius: 12px; border: 1px solid var(--border-color); padding: 16px; cursor: pointer; }
.recipe-card:hover { box-shadow: var(--shadow-md); }
.recipe-card h3 { margin-top: 0; font-size: 1.1rem; }
.recipe-card p { font-size: 0.9rem; color: var(--subtle-text-color); display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
#recipe-details-content h2 { margin-top: 0; }
#recipe-details-content h3 { font-size: 1.1rem; border-bottom: 1px solid var(--border-color); padding-bottom: 8px; margin-bottom: 12px;}
#recipe-details-content ul, #recipe-details-content ol { padding-left: 20px; }
#recipe-details-content li { margin-bottom: 8px; }
.recipe-time-info { display: flex; gap: 20px; margin: 16px 0; font-size: 0.9rem; }
.time-inputs { display: flex; gap: 10px; }
.time-inputs input { width: 100%; }
.dynamic-list { margin-top: 16px; }
.dynamic-list h3 { font-size: 1rem; margin-bottom: 8px; }
.dynamic-list > div { display: flex; flex-direction: column; gap: 8px; }
.dynamic-list button { margin-top: 8px; align-self: flex-start; padding: 6px 12px; font-size: 0.9rem; background-color: #F3F4F6; border: 1px solid var(--border-color); color: var(--main-text-color); }

/* FAB & Modal Styles */
.fab { position: fixed; bottom: 30px; right: 30px; width: 60px; height: 60px; background-color: var(--accent-color); color: white; border: none; border-radius: 50%; box-shadow: 0 4px 12px rgba(0,0,0,0.15); font-size: 1.5rem; display: none; align-items: center; justify-content: center; cursor: pointer; z-index: 1000; }
.fab.active { display: flex; }
.fab-mobile { display: none; } /* Hidden by default */

.modal { display: none; position: fixed; z-index: 1001; left: 0; top: 0; width: 100%; height: 100%; overflow: auto; background-color: rgba(0,0,0,0.4); }
.modal-content { background-color: #fefefe; margin: 10% auto; padding: 20px; border: 1px solid #888; width: 80%; max-width: 600px; border-radius: 8px; position: relative; }
.close-button { color: #aaa; float: right; font-size: 28px; font-weight: bold; cursor: pointer; }
#modal-body h2 { margin-top: 0; }
#modal-body form { display: flex; flex-direction: column; gap: 15px; }
#modal-body form input, #modal-body form select, #modal-body form button, #modal-body form textarea { padding: 12px; font-size: 1em; border-radius: 5px; border: 1px solid #ccc; font-family: inherit; }
#modal-body form textarea { resize: vertical; min-height: 60px; }
#modal-body form button { background-color: var(--accent-color); color: white; border: none; cursor: pointer; }
.modal-footer { display: flex; justify-content: space-between; align-items: center; margin-top: 10px; }
.delete-button { background-color: #EF4444; color: white; border: none; padding: 10px 20px; border-radius: 6px; cursor: pointer; font-weight: 500; }
.delete-button:hover { background-color: #DC2626; }

/* --- Screensaver Styles --- */
#screensaver-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: #000; /* Fallback background */
    z-index: 9999;
    opacity: 0;
    transition: opacity 0.5s ease-in-out;
    color: #fff;
    font-family: 'Inter', sans-serif;
}

#screensaver-overlay.active {
    display: flex;
    opacity: 1;
}

#screensaver-photo {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: contain; /* This will show the full photo, letterboxed if needed */
    z-index: -1; /* Place it behind the text content */
}

#screensaver-caption {
    position: absolute;
    bottom: 40px;
    left: 50%;
    transform: translateX(-50%);
    background-color: rgba(0,0,0,0.5);
    padding: 8px 20px;
    border-radius: 20px;
    font-size: 1.1rem;
    text-shadow: 1px 1px 2px #000;
}

#screensaver-datetime {
    position: absolute;
    top: 40px;
    left: 40px;
    text-align: left;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.6);
}

#screensaver-time {
    font-size: 6rem;
    font-weight: 700;
    letter-spacing: -3px;
    line-height: 1;
}

#screensaver-date {
    font-size: 1.75rem;
    font-weight: 500;
    margin-left: 4px;
}

#screensaver-weather {
    position: absolute;
    bottom: 40px;
    left: 40px;
    background-color: rgba(0,0,0,0.4);
    padding: 20px;
    border-radius: 16px;
    width: 320px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
    backdrop-filter: blur(5px);
}

#screensaver-events {
    position: absolute;
    top: 40px;
    right: 40px;
    bottom: 40px;
    width: 350px;
    background-color: rgba(0,0,0,0.4);
    padding: 20px;
    border-radius: 16px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
    backdrop-filter: blur(5px);
    overflow-y: auto;
}
#screensaver-week-events {
    margin-top: 24px;
}

#screensaver-weather h2, #screensaver-events h2, #screensaver-week-events h3 {
    margin-top: 0;
    font-size: 1.3rem;
    border-bottom: 1px solid rgba(255,255,255,0.3);
    padding-bottom: 10px;
    margin-bottom: 15px;
    font-weight: 600;
}

#screensaver-week-events h3 {
    font-size: 1.1rem;
    color: rgba(255,255,255,0.85);
}


.weather-forecast {
    display: flex;
    align-items: center;
    font-size: 1.1rem;
    margin-bottom: 12px;
}

.weather-forecast:last-child {
    margin-bottom: 0;
}

.weather-forecast img {
    width: 50px;
    height: 50px;
    margin-right: 15px;
}

.screensaver-event-item {
    font-size: 1.1rem;
    margin-bottom: 12px;
    font-weight: 500;
    line-height: 1.4;
    padding-left: 10px;
    border-left: 3px solid rgba(255,255,255,0.4);
}

.screensaver-event-item .time {
    font-weight: 700;
    display: block;
    color: rgba(255,255,255,0.8);
    font-size: 0.9rem;
    margin-bottom: 2px;
}

/* --- Mobile View Styles --- */
.mobile-view-wrapper { display: none; } /* Hidden by default */

@media (max-width: 1024px) {
  body { background-color: #F0F2F5; }
  .app-wrapper { display: none; }
  .fab { display: none !important; } /* Hide all FABs on mobile */
  .mobile-view-wrapper {
    display: flex;
    flex-direction: column;
    height: 100%;
    box-sizing: border-box;
  }
  .mobile-header {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    gap: 1rem;
    text-align: center;
    padding: 1rem;
    background-color: #fff;
    border-bottom: 1px solid var(--border-color);
  }
  .mobile-header h1 { font-size: 1.25rem; margin: 0; flex-grow: 1; }
  
  .mobile-back-btn {
    background: none;
    border: none;
    font-size: 1.25rem;
    color: #333;
    padding: 0.5rem;
    cursor: pointer;
    visibility: hidden;
  }

  .mobile-page {
      display: none;
      flex-direction: column;
      overflow-y: auto;
      flex-grow: 1;
  }
  .mobile-page.active {
      display: flex;
  }

  #mobile-dashboard {
      padding: 0;
  }

  .mobile-welcome-header {
      background: linear-gradient(135deg, var(--accent-color) 0%, #818cf8 100%);
      color: white;
      padding: 2rem 1.5rem;
      border-radius: 0 0 24px 24px;
  }
  .mobile-welcome-header h1 {
      font-size: 1.75rem;
      font-weight: 700;
      margin: 0;
  }
  .mobile-welcome-header p {
      margin: 0.25rem 0 0;
      font-size: 1rem;
      opacity: 0.9;
  }

  .mobile-view-wrapper[data-active-page="mobile-dashboard"] .mobile-header {
      display: none;
  }
  .mobile-view-wrapper:not([data-active-page="mobile-dashboard"]) .mobile-back-btn {
      visibility: visible;
  }


  .mobile-events { padding: 1.5rem; }
  .mobile-events h2 { font-size: 1.1rem; font-weight: 600; color: #333; margin: 0 0 1rem 0; }
  #mobile-events-list .event-item {
    background-color: #fff;
    border-radius: 12px;
    padding: 1rem;
    margin-top: 0.75rem;
    font-weight: 500;
    box-shadow: var(--shadow-sm);
    border-left: 4px solid var(--accent-color);
  }
  #mobile-events-list .event-item.empty {
      text-align: center;
      color: var(--subtle-text-color);
      border: none;
      background-color: transparent;
      box-shadow: none;
  }

  .mobile-functions-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    padding: 0 1.5rem 1.5rem 1.5rem;
  }
  .mobile-card {
    background-color: #ffffff;
    border-radius: 16px;
    padding: 1.25rem;
    text-align: left;
    text-decoration: none;
    color: var(--main-text-color);
    border: none;
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
  }
  .mobile-card i {
    font-size: 1.5rem;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
  }
  /* Card Icon Colors */
  .mobile-card.calendar i { background-color: #EF4444; }
  .mobile-card.chores i { background-color: #F97316; }
  .mobile-card.rewards i { background-color: #EAB308; }
  .mobile-card.meals i { background-color: #22C55E; }
  .mobile-card.photos i { background-color: #3B82F6; }
  .mobile-card.settings i { background-color: #6B7280; }

  .mobile-card span { display: block; font-size: 1.1rem; font-weight: 600; margin-top: 0.75rem; }
  .mobile-card small { color: var(--subtle-text-color); font-size: 0.85rem; }

  .fab-mobile {
    display: flex;
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 56px;
    height: 56px;
    background-color: var(--accent-color);
    color: white;
    border: none;
    border-radius: 50%;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    font-size: 1.5rem;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 1000;
  }
  .fab-mobile.hidden {
      display: none;
  }

  /* Specific mobile page styles */
  #mobile-chores-view, #mobile-photos-view, #mobile-rewards-view, #mobile-lists-view, #mobile-recipes-view, #mobile-settings-view {
      padding: 1rem;
  }
  #mobile-chores-view .chore-column {
      width: 100%;
      box-sizing: border-box;
      flex: none;
      margin-bottom: 1rem;
  }
  #mobile-photos-view #mobile-photo-grid-container {
      display: grid;
      grid-template-columns: 1fr 1fr;
      gap: 1rem;
  }
  #mobile-photos-view .photo-item img {
      height: 120px;
  }
  #mobile-rewards-view .reward-card, #mobile-lists-view .list-card, #mobile-recipes-view .recipe-card {
      margin-bottom: 1rem;
  }
  #mobile-meals-view .meal-day-column {
      margin-bottom: 1.5rem;
  }
  #mobile-settings-view .settings-card {
      margin-bottom: 1.5rem;
  }
  .history-table td, .history-table th {
      padding: 8px;
      font-size: 0.9rem;
  }
}

/* --- Kiosk/Touchscreen Fixes --- */
.main-content, .view {
    /* Prioritizes vertical scrolling on touch devices */
    touch-action: pan-y;
    /* Disables the text highlighting/selection behavior */
    -webkit-user-select: none; /* For Safari/Chrome */
    -moz-user-select: none;    /* For Firefox */
    -ms-user-select: none;     /* For Internet Explorer/Edge */
    user-select: none;         /* Standard */
}

/* --- Keyboard Toggle Button --- */
.keyboard-toggle {
    position: fixed;
    bottom: 20px;
    left: 20px;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background-color: #4F46E5;
    color: white;
    border: none;
    font-size: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 1001; /* Ensure it's above other content */
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
}

.keyboard-toggle.hidden {
    display: none;
}

/* --- On-Screen Keyboard --- */
.keyboard {
    position: fixed;
    left: 0;
    bottom: 0;
    width: 100%;
    padding: 5px 0;
    background: #E5E7EB; /* A light grey background */
    box-shadow: 0 0 50px rgba(0, 0, 0, 0.5);
    user-select: none;
    transition: bottom 0.4s;
    z-index: 1002; /* Higher than the toggle button */
}

/* This is the missing style that hides the keyboard */
.keyboard--hidden {
    bottom: -100%; /* Moves the keyboard completely off-screen */
}

.keyboard__keys {
    text-align: center;
}

.keyboard__key {
    height: 45px;
    width: 6%;
    margin: 3px;
    border-radius: 4px;
    border: none;
    background: rgba(255, 255, 255, 1);
    color: var(--main-text-color);
    font-size: 1.2rem;
    outline: none;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    vertical-align: top;
    transition: background-color 0.2s;
}

.keyboard__key:active {
    background: rgba(255, 255, 255, 0.7);
}

.keyboard__key--wide { width: 12%; }
.keyboard__key--extra-wide { width: 36%; }
.keyboard__key--dark { background: #6B7280; color: white; }
.keyboard__key--activatable::after {
    content: '';
    position: absolute;
    top: 5px;
    right: 5px;
    width: 8px;
    height: 8px;
    background: rgba(0, 0, 0, 0.4);
    border-radius: 50%;
    opacity: 0;
    transition: opacity 0.2s;
}

.keyboard__key--active::after {
    opacity: 1;
}