:root {
    --tablet-900: 18 18 22;
    --tablet-800: 26 26 36;
    --tablet-700: 37 37 51;
    --tablet-600: 50 50 70;
    --theme-wallpaper: linear-gradient(135deg, #0f172a 0%, #1e1b4b 50%, #311042 100%);
    --theme-border: 255 255 255;
    --theme-border-alpha: 0.08;
    --theme-primary-200: 221 214 254;
    --theme-primary-300: 196 181 253;
    --theme-primary-400: 167 139 250;
    --theme-primary-500: 139 92 246;
    --theme-primary-600: 124 58 237;
    --theme-primary-700: 109 40 217;
    --theme-primary-900: 76 29 149;
    --theme-secondary-300: 249 168 212;
    --theme-secondary-400: 244 114 182;
    --theme-secondary-500: 236 72 153;
    --theme-secondary-600: 219 39 119;
    --theme-secondary-700: 190 24 93;
    --theme-secondary-900: 131 24 67;
    --theme-tertiary-300: 103 232 249;
    --theme-tertiary-400: 34 211 238;
    --theme-tertiary-500: 6 182 212;
    --theme-tertiary-600: 8 145 178;
    --theme-success-400: 52 211 153;
    --theme-success-500: 16 185 129;
    --theme-success-600: 5 150 105;
    --theme-warm-300: 252 211 77;
    --theme-warm-400: 251 191 36;
    --theme-warm-500: 245 158 11;
    --theme-warm-600: 217 119 6;
    --theme-danger-300: 253 164 175;
    --theme-danger-400: 251 113 133;
    --theme-danger-500: 244 63 94;
    --theme-danger-600: 225 29 72;
}
html[data-theme="cyberpunk-neon"] {
    --tablet-900: 6 9 19;
    --tablet-800: 13 18 32;
    --tablet-700: 24 31 49;
    --tablet-600: 39 49 72;
    --theme-wallpaper: linear-gradient(135deg, #050713 0%, #101628 52%, #24102f 100%);
    --theme-border: 82 220 240;
    --theme-border-alpha: 0.16;
    --theme-primary-200: 165 243 252;
    --theme-primary-300: 103 232 249;
    --theme-primary-400: 34 211 238;
    --theme-primary-500: 0 232 255;
    --theme-primary-600: 6 182 212;
    --theme-primary-700: 8 145 178;
    --theme-primary-900: 8 47 73;
    --theme-secondary-300: 249 168 212;
    --theme-secondary-400: 244 114 182;
    --theme-secondary-500: 255 43 214;
    --theme-secondary-600: 219 39 119;
    --theme-secondary-700: 190 24 93;
    --theme-secondary-900: 83 17 75;
    --theme-tertiary-300: 190 242 100;
    --theme-tertiary-400: 163 230 53;
    --theme-tertiary-500: 132 204 22;
    --theme-tertiary-600: 101 163 13;
    --theme-success-400: 110 231 183;
    --theme-success-500: 52 211 153;
    --theme-success-600: 5 150 105;
    --theme-warm-300: 253 224 71;
    --theme-warm-400: 250 204 21;
    --theme-warm-500: 234 179 8;
    --theme-warm-600: 202 138 4;
    --theme-danger-300: 253 164 175;
    --theme-danger-400: 251 113 133;
    --theme-danger-500: 244 63 94;
    --theme-danger-600: 225 29 72;
}
html[data-theme="midnight-coffee"] {
    --tablet-900: 17 15 14;
    --tablet-800: 29 24 21;
    --tablet-700: 45 36 30;
    --tablet-600: 62 49 40;
    --theme-wallpaper: linear-gradient(135deg, #100f0e 0%, #251d19 54%, #2c1820 100%);
    --theme-border: 226 190 145;
    --theme-border-alpha: 0.13;
    --theme-primary-200: 254 243 199;
    --theme-primary-300: 253 230 138;
    --theme-primary-400: 251 191 36;
    --theme-primary-500: 217 119 6;
    --theme-primary-600: 180 83 9;
    --theme-primary-700: 146 64 14;
    --theme-primary-900: 68 35 15;
    --theme-secondary-300: 254 215 170;
    --theme-secondary-400: 253 186 116;
    --theme-secondary-500: 234 136 79;
    --theme-secondary-600: 194 105 61;
    --theme-secondary-700: 154 75 48;
    --theme-secondary-900: 74 35 28;
    --theme-tertiary-300: 186 230 219;
    --theme-tertiary-400: 134 197 177;
    --theme-tertiary-500: 91 158 139;
    --theme-tertiary-600: 61 122 106;
    --theme-success-400: 134 197 177;
    --theme-success-500: 91 158 139;
    --theme-success-600: 61 122 106;
    --theme-warm-300: 254 243 199;
    --theme-warm-400: 253 230 138;
    --theme-warm-500: 234 179 8;
    --theme-warm-600: 180 83 9;
    --theme-danger-300: 253 164 175;
    --theme-danger-400: 251 113 133;
    --theme-danger-500: 220 70 78;
    --theme-danger-600: 185 45 55;
}
html[data-theme="lavender-dream"] {
    --tablet-900: 20 18 32;
    --tablet-800: 31 27 48;
    --tablet-700: 47 41 68;
    --tablet-600: 65 55 91;
    --theme-wallpaper: linear-gradient(135deg, #131321 0%, #28213f 52%, #382344 100%);
    --theme-border: 202 190 240;
    --theme-border-alpha: 0.14;
    --theme-primary-200: 237 233 254;
    --theme-primary-300: 221 214 254;
    --theme-primary-400: 196 181 253;
    --theme-primary-500: 167 139 250;
    --theme-primary-600: 139 92 246;
    --theme-primary-700: 124 58 237;
    --theme-primary-900: 76 29 149;
    --theme-secondary-300: 252 207 232;
    --theme-secondary-400: 249 168 212;
    --theme-secondary-500: 232 121 190;
    --theme-secondary-600: 199 84 153;
    --theme-secondary-700: 157 55 120;
    --theme-secondary-900: 75 31 72;
    --theme-tertiary-300: 186 230 253;
    --theme-tertiary-400: 125 211 252;
    --theme-tertiary-500: 56 189 248;
    --theme-tertiary-600: 14 165 233;
    --theme-success-400: 110 231 183;
    --theme-success-500: 52 211 153;
    --theme-success-600: 5 150 105;
    --theme-warm-300: 253 224 71;
    --theme-warm-400: 250 204 21;
    --theme-warm-500: 234 179 8;
    --theme-warm-600: 202 138 4;
    --theme-danger-300: 253 164 175;
    --theme-danger-400: 251 113 133;
    --theme-danger-500: 244 63 94;
    --theme-danger-600: 225 29 72;
}
html[data-theme="light"] {
    --tablet-900: 246 248 250;
    --tablet-800: 255 255 255;
    --tablet-700: 231 237 242;
    --tablet-600: 215 224 232;
    --theme-wallpaper: linear-gradient(135deg, #e6f5ef 0%, #f0f4fa 52%, #f9ece9 100%);
    --theme-border: 39 57 73;
    --theme-border-alpha: 0.12;
    --theme-primary-200: 204 240 229;
    --theme-primary-300: 125 194 174;
    --theme-primary-400: 54 153 132;
    --theme-primary-500: 23 130 109;
    --theme-primary-600: 16 108 93;
    --theme-primary-700: 13 84 74;
    --theme-primary-900: 8 51 47;
    --theme-secondary-300: 247 190 203;
    --theme-secondary-400: 222 126 149;
    --theme-secondary-500: 194 82 111;
    --theme-secondary-600: 163 56 86;
    --theme-secondary-700: 132 42 70;
    --theme-secondary-900: 77 27 45;
    --theme-tertiary-300: 188 220 244;
    --theme-tertiary-400: 112 174 211;
    --theme-tertiary-500: 54 132 180;
    --theme-tertiary-600: 37 105 148;
    --theme-success-400: 77 160 112;
    --theme-success-500: 43 129 83;
    --theme-success-600: 31 103 67;
    --theme-warm-300: 248 215 158;
    --theme-warm-400: 220 164 72;
    --theme-warm-500: 176 115 32;
    --theme-warm-600: 143 86 22;
    --theme-danger-300: 244 176 186;
    --theme-danger-400: 211 104 118;
    --theme-danger-500: 181 65 82;
    --theme-danger-600: 149 47 64;
}
html[data-theme="light"] .text-white { color: #1d2939; }
html[data-theme="light"] .text-slate-100 { color: #26364a; }
html[data-theme="light"] .text-slate-200 { color: #34445a; }
html[data-theme="light"] .text-slate-300 { color: #47586d; }
html[data-theme="light"] .text-slate-400 { color: #63748a; }
html[data-theme="light"] .text-slate-500 { color: #748399; }
html[data-theme="light"] .text-slate-600 { color: #617086; }
html[data-theme="light"] .text-violet-200,
html[data-theme="light"] [class~="text-violet-200/80"] { color: #625079; }
html[data-theme="light"] [class~="text-violet-300"],
html[data-theme="light"] [class~="text-violet-400"],
html[data-theme="light"] [class~="text-purple-300"],
html[data-theme="light"] [class~="text-purple-400"],
html[data-theme="light"] [class~="text-fuchsia-300"],
html[data-theme="light"] [class~="text-fuchsia-400"] { color: #674d85; }
html[data-theme="light"] [class~="text-cyan-100"],
html[data-theme="light"] [class~="text-cyan-200"],
html[data-theme="light"] [class~="text-cyan-300"],
html[data-theme="light"] [class~="text-cyan-400"],
html[data-theme="light"] [class~="text-sky-100"],
html[data-theme="light"] [class~="text-sky-200"],
html[data-theme="light"] [class~="text-sky-300"],
html[data-theme="light"] [class~="text-sky-400"],
html[data-theme="light"] [class~="text-blue-100"],
html[data-theme="light"] [class~="text-blue-200"],
html[data-theme="light"] [class~="text-blue-300"],
html[data-theme="light"] [class~="text-blue-400"],
html[data-theme="light"] [class~="text-teal-100"],
html[data-theme="light"] [class~="text-teal-200"],
html[data-theme="light"] [class~="text-teal-300"],
html[data-theme="light"] [class~="text-teal-400"] { color: #255d78; }
html[data-theme="light"] [class~="text-emerald-100"],
html[data-theme="light"] [class~="text-emerald-200"],
html[data-theme="light"] [class~="text-emerald-300"],
html[data-theme="light"] [class~="text-emerald-400"],
html[data-theme="light"] [class~="text-lime-100"],
html[data-theme="light"] [class~="text-lime-200"],
html[data-theme="light"] [class~="text-lime-300"],
html[data-theme="light"] [class~="text-lime-400"],
html[data-theme="light"] [class~="text-green-100"],
html[data-theme="light"] [class~="text-green-200"],
html[data-theme="light"] [class~="text-green-300"],
html[data-theme="light"] [class~="text-green-400"] { color: #286343; }
html[data-theme="light"] [class~="text-amber-100"],
html[data-theme="light"] [class~="text-amber-200"],
html[data-theme="light"] [class~="text-amber-300"],
html[data-theme="light"] [class~="text-amber-400"],
html[data-theme="light"] [class~="text-yellow-100"],
html[data-theme="light"] [class~="text-yellow-200"],
html[data-theme="light"] [class~="text-yellow-300"],
html[data-theme="light"] [class~="text-yellow-400"],
html[data-theme="light"] [class~="text-orange-100"],
html[data-theme="light"] [class~="text-orange-200"],
html[data-theme="light"] [class~="text-orange-300"],
html[data-theme="light"] [class~="text-orange-400"] { color: #80521d; }
html[data-theme="light"] [class~="text-rose-100"],
html[data-theme="light"] [class~="text-rose-200"],
html[data-theme="light"] [class~="text-rose-300"],
html[data-theme="light"] [class~="text-rose-400"],
html[data-theme="light"] [class~="text-pink-100"],
html[data-theme="light"] [class~="text-pink-200"],
html[data-theme="light"] [class~="text-pink-300"],
html[data-theme="light"] [class~="text-pink-400"],
html[data-theme="light"] [class~="text-red-100"],
html[data-theme="light"] [class~="text-red-200"],
html[data-theme="light"] [class~="text-red-300"],
html[data-theme="light"] [class~="text-red-400"] { color: #913f51; }
html[data-theme="light"] [class~="bg-tablet-900"] { background-color: rgb(246 248 250); }
html[data-theme="light"] [class~="bg-tablet-900/90"] { background-color: rgb(246 248 250 / 0.9); }
html[data-theme="light"] [class~="bg-tablet-900/80"] { background-color: rgb(246 248 250 / 0.8); }
html[data-theme="light"] [class~="bg-tablet-900/70"] { background-color: rgb(246 248 250 / 0.7); }
html[data-theme="light"] [class~="bg-tablet-800"] { background-color: rgb(255 255 255); }
html[data-theme="light"] [class~="bg-tablet-800/90"] { background-color: rgb(255 255 255 / 0.9); }
html[data-theme="light"] [class~="bg-tablet-800/80"] { background-color: rgb(255 255 255 / 0.8); }
html[data-theme="light"] [class~="bg-tablet-800/60"] { background-color: rgb(255 255 255 / 0.6); }
html[data-theme="light"] [class~="bg-tablet-700"] { background-color: rgb(231 237 242); }
html[data-theme="light"] [class~="bg-tablet-600"] { background-color: rgb(215 224 232); }
html[data-theme="light"] .text-white[class*="bg-gradient-to"],
html[data-theme="light"] button.text-white[class*="bg-"]:not([class*="bg-white/"]) { color: #fff; }
html[data-theme="light"] .bg-white\/5 { background-color: rgb(35 52 70 / 0.045); }
html[data-theme="light"] .bg-white\/10 { background-color: rgb(35 52 70 / 0.075); }
html[data-theme="light"] .bg-white\/20 { background-color: rgb(35 52 70 / 0.12); }
html[data-theme="light"] .bg-white\/30 { background-color: rgb(35 52 70 / 0.18); }
html[data-theme="light"] .border-white\/5 { border-color: rgb(35 52 70 / 0.09); }
html[data-theme="light"] .border-white\/10 { border-color: rgb(35 52 70 / 0.14); }
html[data-theme="light"] .border-white\/15 { border-color: rgb(35 52 70 / 0.19); }
html[data-theme="light"] .border-white\/20 { border-color: rgb(35 52 70 / 0.24); }
html[data-theme="light"] #home-screen > div:first-child {
    background: linear-gradient(110deg, rgb(31 129 105 / 0.11), rgb(74 102 171 / 0.07), transparent);
    border-color: rgb(31 129 105 / 0.18);
}
html[data-theme="light"] .theme-option { color: #334155; border-color: rgb(35 52 70 / 0.16); background: rgb(35 52 70 / 0.035); }
html[data-theme="light"] .theme-option:hover { background: rgb(35 52 70 / 0.08); }
html[data-theme="light"] .theme-option[aria-pressed="true"] { background: rgb(35 52 70 / 0.07); }
body {
    font-family: 'Inter', sans-serif;
    background: var(--theme-wallpaper);
    min-height: 100vh;
    overflow: hidden;
    user-select: none;
}
/* Custom scrollbar for tablet apps */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}
::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 9999px;
}
::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 9999px;
}
::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.4);
}
.glass-panel {
    background: rgb(var(--tablet-800) / 0.75);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgb(var(--theme-border) / var(--theme-border-alpha));
}
.app-icon {
    transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1), background-color 0.2s;
}
.app-icon[hidden] { display: none; }
.app-icon:hover {
    transform: scale(1.08) translateY(-4px);
}
.app-icon:active {
    transform: scale(0.95);
}
#app-grid.is-reordering > .app-icon { touch-action: none; }
.home-app-placeholder { visibility: hidden; }
.app-icon.home-app-dragging { opacity: 0.9; z-index: 50; cursor: grabbing; }
.home-app-drop-target {
    border-color: rgb(var(--theme-tertiary-400) / 0.75) !important;
    background-color: rgb(var(--theme-tertiary-500) / 0.12) !important;
}
.project-tracker-drop-active {
    border-color: rgb(var(--theme-tertiary-400) / 0.65) !important;
    background-color: rgb(var(--theme-tertiary-500) / 0.1) !important;
}
.project-tracker-task-card { cursor: grab; touch-action: pan-y; }
.project-tracker-task-card:active { cursor: grabbing; }
.project-tracker-task-card.project-tracker-touch-dragging { opacity: 0.45; touch-action: none; }
#home-screen { justify-content: flex-start; }
#app-grid {
    flex: 1 1 auto;
    min-height: 0;
    margin-top: 0;
    margin-bottom: 0;
    align-content: start;
    align-items: start;
    touch-action: pan-y;
}
@media (max-height: 760px) {
    #home-screen { padding: 16px 24px; }
    #home-screen > div:first-child { padding: 12px; margin-bottom: 8px; }
    #app-grid { gap: 8px 16px; }
    #app-grid > .app-icon { padding: 8px; }
    #app-grid > .app-icon > div:first-child,
    #app-grid > .app-icon > span:first-child { width: 48px; height: 48px; }
    #app-grid > .app-icon .mt-2 { margin-top: 4px; }
    #home-page-controls { gap: 12px; padding-block: 4px; }
    #home-page-controls > button { width: 32px; height: 32px; }
    #home-screen > div.flex.justify-center.mt-auto { padding-top: 4px; }
    #home-screen > div.flex.justify-center.mt-auto > .glass-panel { padding-top: 8px; padding-bottom: 8px; }
    #home-screen > div.flex.justify-center.mt-auto > .glass-panel > button { width: 40px; height: 40px; }
}
@media (max-width: 640px) {
    body { padding: 0 !important; }
    #tablet-frame { width: 100vw; height: 100dvh; border-width: 0; border-radius: 0; box-shadow: none; }
    #status-bar { display: none; }
    .app-window { top: 0 !important; min-width: 0; max-width: 100%; overflow-x: hidden; }
    .app-window > * { min-width: 0; max-width: 100%; }
    .app-window > div:first-child {
        height: auto !important;
        min-height: 56px;
        padding: 10px 12px;
        flex-wrap: wrap;
        gap: 8px;
    }
    .app-window > div:first-child > div:first-child { min-width: 0; }
    .app-window [class*="overflow-x-auto"],
    .app-window [class*="overflow-x-scroll"],
    .app-window [class*="overflow-y-auto"],
    .app-window [class*="overflow-auto"] { overflow-x: hidden !important; }
    #window-todo > div.flex-1 { padding: 12px; }
    #window-todo > div.flex-1 > form {
        display: grid;
        grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
        gap: 8px;
    }
    #window-todo > div.flex-1 > form > input { grid-column: 1 / -1; min-width: 0; }
    #window-todo > div.flex-1 > form > :not([hidden]) { margin: 0; min-width: 0; }
    #calendar-view-container { overflow-x: hidden; overflow-y: auto; }
    #briefing-hourly-forecast { overflow: visible; }
    #briefing-hourly-list {
        display: grid !important;
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }
    #briefing-hourly-list > div { width: auto; min-width: 0; }
    #window-calendar .calendar-month-grid { width: 100%; min-width: 0; }
    .calendar-week-selector {
        display: grid;
        grid-template-columns: repeat(7, minmax(0, 1fr));
        gap: 4px;
    }
    .calendar-week-selector-day {
        display: flex;
        min-width: 0;
        min-height: 48px;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 2px;
        border: 1px solid rgba(255, 255, 255, 0.08);
        border-radius: 8px;
        background: rgba(255, 255, 255, 0.04);
        color: rgb(148 163 184);
        font-size: 10px;
    }
    .calendar-week-selector-day strong { color: rgb(226 232 240); font-size: 13px; }
    .calendar-week-selector-day[aria-pressed="true"] {
        border-color: rgb(var(--theme-primary-400));
        background: rgb(var(--theme-primary-500) / 0.2);
        color: rgb(var(--theme-primary-200));
    }
    .calendar-week-selector-day[aria-pressed="true"] strong { color: white; }
    #home-screen { padding: 12px; }
    #home-screen > div:first-child { padding: 6px 8px; margin-bottom: 4px; }
    #home-screen > div:first-child h1 { margin-bottom: 0; font-size: 18px; line-height: 1.2; }
    #home-screen > div:first-child > div:first-child > p { display: none; }
    #home-screen > div:first-child > div:last-child { margin-top: 4px; padding: 4px 8px; }
    #app-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: 10px 8px;
        padding: 0;
        align-content: center;
        align-items: center;
    }
    #app-grid > .app-icon { padding: 8px; }
    #app-grid > .app-icon > div:first-child,
    #app-grid > .app-icon > span:first-child { width: 68px; height: 68px; }
    #app-grid > .app-icon .mt-2 { margin-top: 4px; font-size: 11px; line-height: 1.1; }
    #home-page-controls { gap: 8px; padding-block: 2px; }
    #home-page-controls > button { width: 28px; height: 28px; }
    #home-screen > div.flex.justify-center.mt-auto { padding-top: 0; }
    #home-screen > div.flex.justify-center.mt-auto > .glass-panel { gap: 8px; padding: 4px 8px; }
    #home-screen > div.flex.justify-center.mt-auto > .glass-panel > * { margin-left: 0 !important; }
    #home-screen > div.flex.justify-center.mt-auto > .glass-panel > #recent-apps-dock,
    #home-screen > div.flex.justify-center.mt-auto > .glass-panel > #recent-apps-dock + div { display: none; }
    #home-screen > div.flex.justify-center.mt-auto > .glass-panel > button { width: 32px; height: 32px; }
}
@media (max-width: 640px) and (max-height: 500px) {
    #app-grid { grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 4px; }
    #app-grid > .app-icon { padding: 0; }
    #app-grid > .app-icon > div:first-child,
    #app-grid > .app-icon > span:first-child { width: 32px; height: 32px; }
    #app-grid > .app-icon .mt-2 { margin-top: 2px; font-size: 9px; line-height: 1.1; }
    #home-page-controls { gap: 6px; padding-block: 0; }
    #home-page-controls > button { width: 26px; height: 26px; }
    #home-screen > div.flex.justify-center.mt-auto > .glass-panel { padding: 2px 6px; }
    #home-screen > div.flex.justify-center.mt-auto > .glass-panel > button { width: 28px; height: 28px; }
}
.theme-option {
    --preview-surface: #15151c;
    --preview-primary: #8b5cf6;
    --preview-secondary: #ec4899;
    --preview-tertiary: #06b6d4;
    position: relative;
    display: flex;
    min-width: 0;
    min-height: 78px;
    flex-direction: column;
    justify-content: center;
    gap: 6px;
    padding: 8px 3px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.03);
    color: white;
    transition: border-color 0.2s, background-color 0.2s;
}
.theme-option[data-theme-option="cyberpunk-neon"] {
    --preview-surface: #070b17;
    --preview-primary: #00e8ff;
    --preview-secondary: #ff2bd6;
    --preview-tertiary: #84cc16;
}
.theme-option[data-theme-option="midnight-coffee"] {
    --preview-surface: #11100f;
    --preview-primary: #d97706;
    --preview-secondary: #ea884f;
    --preview-tertiary: #5b9e8b;
}
.theme-option[data-theme-option="lavender-dream"] {
    --preview-surface: #141220;
    --preview-primary: #a78bfa;
    --preview-secondary: #e879be;
    --preview-tertiary: #38bdf8;
}
.theme-option[data-theme-option="light"] {
    --preview-surface: #f4f8f8;
    --preview-primary: #17826d;
    --preview-secondary: #c2526f;
    --preview-tertiary: #3684b4;
}
.theme-option:hover {
    background: rgba(255, 255, 255, 0.07);
}
.theme-option[aria-pressed="true"] {
    border-color: var(--preview-primary);
    background: rgba(255, 255, 255, 0.08);
    box-shadow: 0 0 0 1px var(--preview-primary);
}
.theme-option:focus-visible {
    outline: 2px solid var(--preview-primary);
    outline-offset: 2px;
}
.theme-option-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 96px), 1fr));
    gap: 8px;
    align-items: stretch;
}
.theme-preview {
    display: flex;
    width: 100%;
    height: 25px;
    gap: 3px;
    padding: 4px;
    border-radius: 5px;
    background: var(--preview-surface);
}
.theme-preview span {
    flex: 1;
    border-radius: 2px;
}
.theme-preview span:nth-child(1) { background: var(--preview-primary); }
.theme-preview span:nth-child(2) { background: var(--preview-secondary); }
.theme-preview span:nth-child(3) { background: var(--preview-tertiary); }
.theme-option-label {
    min-height: 2.4em;
    font-size: 11px;
    font-weight: 600;
    line-height: 1.2;
    text-align: center;
    overflow-wrap: anywhere;
}
@media (max-width: 480px) {
    .theme-option {
        min-height: 74px;
        padding: 6px 2px;
    }
    .theme-option-label {
        font-size: 9px;
    }
    .theme-preview {
        height: 20px;
    }
}
#home-screen.has-custom-wallpaper {
    background-color: rgb(var(--tablet-900));
    background-image: linear-gradient(rgb(var(--tablet-900) / 0.42), rgb(var(--tablet-900) / 0.56)), var(--custom-wallpaper);
    background-position: center;
    background-repeat: no-repeat;
    background-size: cover;
}
#wallpaper-preview {
    background: linear-gradient(135deg, rgb(var(--tablet-800)), rgb(var(--tablet-900)));
    background-position: center;
    background-repeat: no-repeat;
    background-size: cover;
}
#wallpaper-preview.has-custom-wallpaper {
    background-image: linear-gradient(rgb(var(--tablet-900) / 0.2), rgb(var(--tablet-900) / 0.3)), var(--custom-wallpaper-preview);
}
#pet-container {
    transition-property: left, top;
    transition-timing-function: linear;
}
.settings-grid {
    columns: 1;
    column-gap: 1rem;
}
.settings-grid > * {
    break-inside: avoid;
    margin-bottom: 1rem;
}
@media (min-width: 768px) {
    .settings-grid { columns: 2; }
}
.wordle-board {
    --wordle-tile-size: clamp(36px, 5.3vh, 46px);
    display: grid;
    gap: 5px;
    width: fit-content;
    margin: 0 auto 14px;
}
.wordle-row {
    display: grid;
    grid-template-columns: repeat(5, var(--wordle-tile-size));
    gap: 5px;
}
.wordle-tile {
    display: grid;
    width: var(--wordle-tile-size);
    height: var(--wordle-tile-size);
    place-items: center;
    border: 2px solid #3a3a3c;
    color: white;
    font-size: clamp(19px, 3vh, 26px);
    font-weight: 700;
    line-height: 1;
}
.wordle-tile-filled { border-color: #565758; }
.wordle-tile[data-state="correct"],
.wordle-key[data-state="correct"] { background: #538d4e; border-color: #538d4e; }
.wordle-tile[data-state="present"],
.wordle-key[data-state="present"] { background: #b59f3b; border-color: #b59f3b; }
.wordle-tile[data-state="absent"],
.wordle-key[data-state="absent"] { background: #3a3a3c; border-color: #3a3a3c; }
.wordle-tile-locked { animation: wordleFlip 360ms ease both; animation-delay: var(--wordle-delay, 0ms); }
.wordle-keyboard { width: min(100%, 520px); margin: 0 auto; user-select: none; }
.wordle-keyboard-row { display: flex; justify-content: center; gap: 5px; margin-top: 6px; }
.wordle-keyboard-row:nth-child(2) { padding-inline: 4%; }
.wordle-key {
    display: flex;
    flex: 1 1 0;
    align-items: center;
    justify-content: center;
    min-width: 0;
    max-width: 52px;
    height: clamp(38px, 4.8vh, 46px);
    border: 0;
    border-radius: 5px;
    background: #818384;
    color: white;
    font-size: 14px;
    font-weight: 700;
    touch-action: manipulation;
}
.wordle-key:hover:not(:disabled) { filter: brightness(1.12); }
.wordle-key-wide { flex: 1.5 1 0; max-width: 78px; font-size: 11px; }
.wordle-key:disabled { cursor: default; }
@keyframes wordleFlip {
    50% { transform: rotateX(90deg); }
    100% { transform: rotateX(0); }
}
@media (prefers-reduced-motion: reduce) {
    .wordle-tile-locked { animation: none; }
}
.verbal-memory-stage {
    display: flex;
    min-height: clamp(150px, 29vh, 250px);
    align-items: center;
    justify-content: center;
    border-block: 1px solid rgba(255, 255, 255, 0.08);
}
#verbal-memory-word {
    color: rgb(248 250 252);
    font-size: clamp(40px, 7vh, 64px);
    font-weight: 700;
    line-height: 1.1;
    text-align: center;
}
.verbal-memory-choice {
    min-height: 56px;
    flex: 1 1 0;
}
@media (max-height: 700px) {
    .verbal-memory-stage { min-height: 140px; }
}
#pet-bubble {
    position: absolute;
    left: 0;
    bottom: calc(100% + 10px);
    width: max-content;
    max-width: min(220px, calc(100vw - 32px));
    pointer-events: none;
    opacity: 0;
    visibility: hidden;
    transform: translateY(4px);
    transition: opacity 180ms ease, transform 180ms ease, visibility 0s linear 180ms;
}
#pet-bubble.pet-message-visible {
    opacity: 0.95;
    visibility: visible;
    transform: translateY(0);
    transition: opacity 180ms ease, transform 180ms ease, visibility 0s;
}
#pet-bubble-arrow {
    left: 24px;
    right: auto;
}
#pet-container.pet-bubble-right #pet-bubble {
    left: auto;
    right: 0;
}
#pet-container.pet-bubble-right #pet-bubble-arrow {
    left: auto;
    right: 24px;
}
#pet-sprite-box {
    background: transparent;
    border: 0;
    padding: 0;
    image-rendering: pixelated;
    touch-action: none;
    user-select: none;
    cursor: grab;
}
#pet-container.pet-grabbed #pet-sprite-box { cursor: grabbing; }
#pet-container.pet-grabbed #pet-cat-art {
    animation: petGrab 420ms ease-in-out infinite alternate;
}
#pet-container.pet-thrown #pet-cat-art {
    animation: petThrown 180ms ease-in-out infinite alternate;
}
#pet-cat-art {
    width: 64px;
    height: 64px;
    overflow: visible;
    shape-rendering: crispEdges;
    image-rendering: pixelated;
    transform-origin: center bottom;
    animation: none;
}
#pet-container.pet-moving #pet-cat-art {
    animation: petWalk 280ms steps(2, end) infinite;
}
#pet-container.pet-moving #pet-cat-art .cat-tail {
    animation: petTail 900ms steps(2, end) infinite;
}
#pet-cat-art .cat-sprite {
    transform-origin: 50% 50%;
}
#pet-container.pet-facing-left #pet-cat-art .cat-sprite {
    transform: scaleX(-1);
}
#pet-cat-art .cat-tail {
    transform-box: fill-box;
    transform-origin: 50% 70%;
    animation: none;
}
#pet-mouse {
    position: absolute;
    bottom: 14px;
    left: 16px;
    z-index: 29;
    width: 32px;
    height: 28px;
    opacity: 0;
    pointer-events: none;
    transform: translateY(4px) scale(0.7);
    transition: opacity 160ms ease, transform 160ms ease;
}
#pet-mouse.pet-mouse-visible {
    opacity: 1;
    transform: translateY(0) scale(1);
    animation: petMouseScurry 180ms steps(2, end) infinite;
}
#pet-mouse.pet-mouse-eaten {
    animation: petMouseEaten 480ms ease-in forwards;
}
@keyframes petWalk {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-3px); }
}
@keyframes petMouseScurry {
    0%, 100% { translate: 0 0; }
    50% { translate: 0 -2px; }
}
@keyframes petMouseEaten {
    to { opacity: 0; transform: translateY(3px) scale(0.4); }
}
@keyframes petTail {
    0%, 100% { transform: rotate(0deg); }
    50% { transform: rotate(12deg); }
}
@keyframes petGrab {
    from { transform: rotate(-7deg) scale(1.08) translateY(-2px); }
    to { transform: rotate(7deg) scale(1.08) translateY(-4px); }
}
@keyframes petThrown {
    from { transform: rotate(-18deg); }
    to { transform: rotate(18deg); }
}
@media (prefers-reduced-motion: reduce) {
    #pet-container { transition-duration: 0ms !important; }
    #pet-cat-art, #pet-cat-art .cat-tail { animation: none !important; }
    #pet-mouse { transition-duration: 0ms !important; animation: none !important; }
}
@keyframes pulseGlow {
    0%, 100% { box-shadow: 0 0 15px rgba(139, 92, 246, 0.4); }
    50% { box-shadow: 0 0 30px rgba(139, 92, 246, 0.8); }
}
.pet-glow {
    animation: pulseGlow 3s infinite;
}
/* Window open/close transitions */
.app-window {
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    transform-origin: center;
}
.window-hidden {
    opacity: 0;
    transform: scale(0.9) translateY(20px);
    pointer-events: none;
    visibility: hidden;
}
.calendar-view-button {
    min-width: 52px;
    padding: 6px 10px;
    border-radius: 8px;
    color: rgb(203 213 225);
    font-size: 12px;
    font-weight: 600;
    transition: background-color 0.15s, color 0.15s;
}
.calendar-view-button:hover { background: rgba(255, 255, 255, 0.08); }
.calendar-view-button-active { background: rgb(var(--theme-primary-600)); color: white; }
.calendar-month-grid {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    gap: 5px;
    min-width: 620px;
}
.calendar-category-legend-item {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: rgb(203 213 225);
    font-size: 11px;
}
.calendar-month-heading {
    padding: 5px 3px;
    color: rgb(148 163 184);
    font-size: 11px;
    font-weight: 700;
    text-align: center;
}
.calendar-month-cell {
    position: relative;
    min-width: 0;
    padding: 6px;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.035);
}
.calendar-month-cell-outside { background: rgba(255, 255, 255, 0.015); opacity: 0.45; }
.calendar-month-cell-today { border-color: rgb(var(--theme-primary-500) / 0.65); background: rgb(var(--theme-primary-500) / 0.12); }
.calendar-month-add-area {
    position: absolute;
    inset: 0;
    z-index: 0;
    width: 100%;
    height: 100%;
    border: 0;
    border-radius: inherit;
    background: transparent;
    cursor: pointer;
}
.calendar-month-add-area:focus-visible {
    outline: 2px solid rgb(var(--theme-primary-300));
    outline-offset: -3px;
}
.calendar-month-cell > :not(.calendar-month-add-area) {
    position: relative;
    z-index: 1;
}
.calendar-month-date {
    width: 28px;
    height: 28px;
    margin-bottom: 4px;
    border-radius: 8px;
    color: rgb(226 232 240);
    font-size: 12px;
    font-weight: 700;
    text-align: center;
}
.calendar-month-date:hover { background: rgba(255, 255, 255, 0.1); }
.calendar-month-cell-today .calendar-month-date { color: rgb(var(--theme-primary-300)); }
.calendar-month-event {
    min-width: 0;
    margin-top: 3px;
    border-left: 3px solid var(--event-color, #64748b);
    border-radius: 3px;
    background: color-mix(in srgb, var(--event-color, #64748b) 20%, transparent);
}
.calendar-month-event-title {
    display: block;
    width: 100%;
    overflow: hidden;
    padding: 3px 5px;
    color: rgb(241 245 249);
    font-size: 10px;
    line-height: 1.25;
    text-align: left;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.calendar-timeline {
    display: grid;
    gap: 1px;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.09);
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.09);
}
.calendar-timeline-day { width: 100%; }
.calendar-timeline-week { width: max(100%, 860px); }
.calendar-timeline-corner,
.calendar-timeline-heading,
.calendar-time-column { background: rgb(var(--tablet-900)); }
.calendar-timeline-heading {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    color: rgb(203 213 225);
    font-size: 11px;
}
.calendar-timeline-heading strong { color: white; font-size: 13px; }
.calendar-timeline-heading-today strong { color: rgb(var(--theme-primary-300)); }
.calendar-timeline-heading-week-today {
    background: rgb(var(--theme-primary-500) / 0.2);
    box-shadow: inset 0 -3px 0 rgb(var(--theme-primary-400));
    color: rgb(var(--theme-primary-200));
}
.calendar-timeline-heading-week-today strong { color: white; }
.calendar-time-label {
    padding: 0 5px;
    color: rgb(148 163 184);
    font-size: 10px;
    text-align: right;
    transform: translateY(-7px);
}
.calendar-time-column {
    display: grid;
    position: relative;
    gap: 0;
    min-width: 0;
}
.calendar-time-slot {
    min-width: 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.055);
    background: rgba(255, 255, 255, 0.012);
}
.calendar-time-column-today .calendar-time-slot {
    border-bottom-color: rgb(var(--theme-primary-400) / 0.14);
    background: rgb(var(--theme-primary-500) / 0.1);
}
.calendar-time-column-today .calendar-time-slot:hover { background: rgb(var(--theme-primary-500) / 0.24); }
.calendar-time-slot:hover { background: rgba(255, 255, 255, 0.07); }
.calendar-timeline-event {
    z-index: 2;
    min-width: 0;
    overflow: hidden;
    padding: 3px 5px;
    border-left: 3px solid var(--event-color, #64748b);
    border-radius: 5px;
    background: color-mix(in srgb, var(--event-color, #64748b) 27%, rgb(var(--tablet-800)));
    color: white;
    font-size: 11px;
    line-height: 1.2;
    cursor: pointer;
}
.calendar-timeline-event-roomy {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 3px;
    padding: 8px 10px;
}
.calendar-timeline-event-title { font-size: 11px; }
.calendar-timeline-event-time { font-size: 10px; }
.calendar-timeline-event-roomy .calendar-timeline-event-title { font-size: 16px; line-height: 1.25; }
.calendar-timeline-event-roomy .calendar-timeline-event-time { font-size: 12px; }
.calendar-timeline-event:hover { filter: brightness(1.2); }
.calendar-timeline-event:focus-visible,
.calendar-month-date:focus-visible,
.calendar-timeline-heading:focus-visible { outline: 2px solid rgb(var(--theme-primary-300)); outline-offset: -2px; }
.window-visible {
    opacity: 1;
    transform: scale(1) translateY(0);
    pointer-events: auto;
    visibility: visible;
}
#pet-xp-progress-bar { width: 0; }
#pet-hunger-fill,
#pet-happiness-fill,
#pet-hygiene-fill,
#pet-energy-fill { width: 80%; }
.apa-hanging-indent { text-indent: -2rem; }
html:fullscreen body {
    padding: 0;
}
html:fullscreen #tablet-frame {
    width: 100vw;
    height: 100vh;
    border-width: 0;
    border-radius: 0;
}
