:root {
    --display-width: 720px;
    --display-height: 1280px;
    --ui-width: 360px;
    --ui-height: 640px;
    --ui-scale: 2;
    --holo-blue: #33b5e5;
    --holo-dark: #1a1a1a;
    --status-bar-height: 24px;
    --nav-bar-height: 48px;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    -webkit-tap-highlight-color: transparent;
    font-family: 'Roboto', sans-serif;
}

/* Local Roboto font faces (packaged with project) */
@font-face {
    font-family: "Roboto";
    font-style: normal;
    font-weight: 100;
    src: url('/Roboto-Thin.ttf') format('truetype');
}
@font-face {
    font-family: "Roboto";
    font-style: italic;
    font-weight: 100;
    src: url('/Roboto-ThinItalic.ttf') format('truetype');
}
@font-face {
    font-family: "Roboto";
    font-style: normal;
    font-weight: 300;
    src: url('/Roboto-Light.ttf') format('truetype');
}
@font-face {
    font-family: "Roboto";
    font-style: italic;
    font-weight: 300;
    src: url('/Roboto-LightItalic.ttf') format('truetype');
}
@font-face {
    font-family: "Roboto";
    font-style: normal;
    font-weight: 400;
    src: url('/Roboto-Regular.ttf') format('truetype');
}
@font-face {
    font-family: "Roboto";
    font-style: italic;
    font-weight: 400;
    src: url('/Roboto-Italic.ttf') format('truetype');
}
@font-face {
    font-family: "Roboto";
    font-style: normal;
    font-weight: 500;
    src: url('/Roboto-Medium.ttf') format('truetype');
}
@font-face {
    font-family: "Roboto";
    font-style: italic;
    font-weight: 500;
    src: url('/Roboto-MediumItalic.ttf') format('truetype');
}
@font-face {
    font-family: "Roboto";
    font-style: normal;
    font-weight: 700;
    src: url('/Roboto-Bold.ttf') format('truetype');
}
@font-face {
    font-family: "Roboto";
    font-style: italic;
    font-weight: 700;
    src: url('/Roboto-BoldItalic.ttf') format('truetype');
}
@font-face {
    font-family: "Roboto Condensed";
    font-style: normal;
    font-weight: 400;
    src: url('/Roboto-Condensed.ttf') format('truetype');
}
@font-face {
    font-family: "Roboto Condensed";
    font-style: italic;
    font-weight: 400;
    src: url('/Roboto-CondensedItalic.ttf') format('truetype');
}
@font-face {
    font-family: "Roboto";
    font-style: normal;
    font-weight: 900;
    src: url('/Roboto-Black.ttf') format('truetype');
}
@font-face {
    font-family: "Roboto";
    font-style: italic;
    font-weight: 900;
    src: url('/Roboto-BlackItalic.ttf') format('truetype');
}
@font-face {
    font-family: "Roboto";
    font-style: italic;
    font-weight: 700;
    src: url('/Roboto-BoldCondensedItalic.ttf') format('truetype');
}
@font-face {
    font-family: "Roboto";
    font-style: normal;
    font-weight: 700;
    src: url('/Roboto-BoldCondensed.ttf') format('truetype');
}

body {
    background: #000;
    height: 100vh;
    overflow: hidden;
    display: flex;
    justify-content: center;
    align-items: center;
}

#device-stage {
    --device-scale: 0.4;
    width: 440px;
    height: 684px;
    position: relative;
    flex: none;
}

#device-canvas {
    width: 1101px;
    height: 1709px;
    position: absolute;
    top: 0;
    left: 0;
    transform: scale(var(--device-scale));
    transform-origin: top left;
}

#phone-container {
    position: absolute;
    left: 191px;
    top: 212px;
    width: var(--display-width);
    height: var(--display-height);
    max-width: none;
    max-height: none;
    background: #000;
    overflow: hidden;
}

#device-frame {
    position: absolute;
    inset: 0;
    width: 1101px;
    height: 1709px;
    pointer-events: none;
    user-select: none;
}

#phone-container.desktop-mode {
    width: var(--display-width) !important;
    height: var(--display-height) !important;
    max-width: none;
    max-height: none;
}

#screen {
    position: absolute;
    top: 0;
    left: 0;
    width: var(--ui-width);
    height: var(--ui-height);
    flex: none;
    transform: scale(var(--ui-scale));
    transform-origin: top left;
    background-image: url('/wp4315058-jelly-bean-wallpapers.jpg');
    background-size: cover;
    background-position: center;
    display: flex;
    flex-direction: column;
    position: relative;
}

/* Status Bar */
#status-bar {
    height: var(--status-bar-height);
    background: #000;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 8px;
    color: var(--holo-blue);
    font-size: 12px;
    z-index: 100;
}

.status-right {
    display: flex;
    align-items: center;
    gap: 6px;
}

.status-icons {
    display: flex;
    align-items: center;
    gap: 4px;
}

.icon-wifi {
    width: 16px;
    height: 16px;
    object-fit: contain;
}

.icon-signal {
    width: 14px;
    height: 16px;
    object-fit: contain;
}

.icon-battery {
    width: 11px;
    height: 16px;
    object-fit: contain;
}

.battery-alert-backdrop {
    position: absolute;
    z-index: 5000;
    inset: 0;
    display: grid;
    place-items: center;
    padding: 20px;
    background: rgba(0,0,0,.56);
    animation: battery-alert-fade-in 180ms ease-out both;
}
.battery-alert-backdrop[hidden] { display: none !important; }
.battery-alert-dialog {
    width: min(100%, 300px);
    overflow: hidden;
    color: #f2f2f2;
    background: #252525;
    box-shadow: 0 8px 28px rgba(0,0,0,.62);
    transform-origin: center;
    animation: battery-alert-zoom-in 220ms cubic-bezier(.2,.85,.25,1) both;
}
.battery-alert-title {
    min-height: 42px;
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 0 14px;
    border-bottom: 2px solid #00bfe9;
    color: #28c8ee;
    font-size: 17px;
    font-weight: 500;
}
.battery-alert-title span:first-child { color: #f5f5f5; font-size: 19px; }
.battery-alert-body { padding: 14px 14px 12px; }
.battery-alert-body p { margin: 0 0 12px; color: #f2f2f2; font-size: 14px; line-height: 1.4; }
.battery-alert-body img { display: block; width: 136px; height: auto; max-height: 42px; object-fit: contain; margin: 2px auto 0; }
.battery-alert-actions { display: grid; grid-template-columns: 1fr 1fr; border-top: 1px solid #484848; }
.battery-alert-actions button {
    min-height: 46px;
    border: 0;
    color: #43c8e8;
    background: transparent;
    font: 14px Roboto, Arial, sans-serif;
}
.battery-alert-actions button + button { border-left: 1px solid #484848; }
.battery-alert-actions button:active { background: rgba(255,255,255,.1); }
.battery-alert-backdrop.is-closing { animation: battery-alert-fade-out 180ms ease-in both; }
.battery-alert-backdrop.is-closing .battery-alert-dialog { animation: battery-alert-zoom-out 180ms ease-in both; }
@keyframes battery-alert-fade-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes battery-alert-fade-out { from { opacity: 1; } to { opacity: 0; } }
@keyframes battery-alert-zoom-in { from { opacity: 0; transform: scale(.72); } to { opacity: 1; transform: scale(1); } }
@keyframes battery-alert-zoom-out { from { opacity: 1; transform: scale(1); } to { opacity: 0; transform: scale(.72); } }

/* Navigation Bar */
#nav-bar {
    height: var(--nav-bar-height);
    background: #000 url('/nav-bar.svg') center / 100% 100% no-repeat;
    display: flex;
    align-items: center;
    position: relative;
    z-index: 100;
}

.nav-button {
    position: absolute;
    height: var(--nav-bar-height);
    background: transparent;
    cursor: pointer;
}

.nav-button:active {
    background-color: rgba(255, 255, 255, 0.1);
}

#nav-back { left: 0; width: 36%; }
#nav-home { left: 32%; width: 36%; }
#nav-recent { left: 60%; width: 36%; }

/* Main Views */
#main-view {
    flex: 1;
    position: relative;
    overflow: hidden;
}

.view {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: none;
}

.view.active {
    display: flex;
    flex-direction: column;
}

/* Home Screen */
#google-search {
    padding: 15px;
    margin-top: 10px;
}

.search-bar {
    background: rgba(255, 255, 255, 0.15);
    height: 44px;
    border-radius: 2px;
    display: flex;
    align-items: center;
    padding: 0 15px;
    backdrop-filter: blur(5px);
}

.g-logo {
    color: #fff;
    font-weight: bold;
    font-size: 18px;
}

.app-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    grid-gap: 10px;
    padding: 20px;
}

.app-icon {
    display: flex;
    flex-direction: column;
    align-items: center;
    cursor: pointer;
    transition: transform 0.1s;
    user-select: none;
}

.app-icon.dragging {
    opacity: 0.5;
    transform: scale(1.1);
}

.app-icon.drag-over {
    background: rgba(51, 181, 229, 0.2);
    border-radius: 8px;
    box-shadow: 0 0 10px var(--holo-blue);
}

.app-icon img {
    width: 56px;
    height: 56px;
    margin-bottom: 5px;
}

.app-icon span {
    color: #fff;
    font-size: 12px;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.8);
    text-align: center;
}

#dock {
    position: absolute;
    bottom: 0;
    width: 100%;
    padding-bottom: 10px;
}

.dock-inner {
    display: flex;
    justify-content: space-evenly;
    align-items: center;
    background: rgba(0,0,0,0.2);
    padding: 10px 0;
}

#drawer-button img {
    width: 50px;
    height: 50px;
}

#drawer-button:active img {
    content: url('/ic_allapps_pressed.png');
}

/* App Drawer */
#app-drawer {
    background: rgba(0, 0, 0, 0.95);
    z-index: 50;
}

.drawer-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    border-bottom: 1px solid #333;
}

.drawer-tabs {
    display: flex;
    gap: 30px;
}

.drawer-tab {
    color: #666;
    font-weight: bold;
    font-size: 14px;
    cursor: pointer;
    transition: color 0.2s;
}

.drawer-tab.active {
    color: #fff;
    position: relative;
}

.drawer-tab.active::after {
    content: '';
    position: absolute;
    bottom: -21px;
    left: 0;
    width: 100%;
    height: 2px;
    background: var(--holo-blue);
}

.drawer-market-btn {
    width: 32px;
    height: 32px;
    cursor: pointer;
}

.drawer-market-btn img {
    width: 100%;
    height: 100%;
}

.drawer-pane {
    display: none;
    flex: 1;
    overflow-y: auto;
}

.drawer-pane.active {
    display: block;
}

.widget-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
    padding: 20px;
}

.widget-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    cursor: grab;
}

.widget-item.dragging {
    opacity: 0.6;
    transform: scale(1.03);
}

.widget-item.drag-over {
    outline: 1px dashed var(--holo-blue);
    border-radius: 4px;
    background: rgba(51, 181, 229, 0.08);
}

.widget-preview {
    width: 100%;
    aspect-ratio: 1.5;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid #333;
    margin-bottom: 8px;
}

.widget-item span {
    color: #aaa;
    font-size: 11px;
}

/* Generic App Window Style */
.app-window {
    background: #000;
    z-index: 60;
}

.app-toolbar {
    height: 50px;
    background: #333;
    display: flex;
    align-items: center;
    padding: 0 10px;
}

.browser-toolbar {
    background: #222;
    border-bottom: 2px solid #333;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 0 8px;
}

.browser-nav-btns {
    display: flex;
    color: #888;
    font-size: 24px;
    gap: 10px;
}

.url-bar-container {
    background: #fff;
    flex: 1;
    height: 34px;
    border-radius: 2px;
    display: flex;
    align-items: center;
    padding: 0 8px;
    box-shadow: inset 0 1px 2px rgba(0,0,0,0.2);
}

.url-input {
    border: none;
    background: transparent;
    width: 100%;
    outline: none;
    font-size: 14px;
    color: #333;
}

.browser-refresh {
    width: 16px;
    height: 16px;
    border: 2px solid #666;
    border-top-color: transparent;
    border-radius: 50%;
    margin-left: 5px;
    cursor: pointer;
}

.browser-nav-btns span {
    cursor: pointer;
    padding: 0 4px;
}

.browser-nav-btns span:active {
    color: var(--holo-blue);
}

.browser-tabs-btn {
    width: 28px;
    height: 28px;
    border: 2px solid #888;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #888;
    font-weight: bold;
    font-size: 12px;
}

.app-content {
    flex: 1;
    display: flex;
    flex-direction: column;
}

/* Wallpapers page: scroll the wallpaper grid instead of overflowing the screen */
#app-wallpapers .app-content {
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.placeholder-msg {
    margin: auto;
    color: #555;
}

/* Calculator specific */
#app-calculator {
    background: #111;
}

.calc-display {
    height: 120px;
    background: #222;
    color: #fff;
    display: flex;
    align-items: flex-end;
    justify-content: flex-end;
    padding: 20px;
    font-size: 48px;
    font-weight: 300;
}

.calc-keys {
    flex: 1;
    display: grid;
    grid-template-columns: repeat(4, 1fr);
}

.calc-keys div {
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 24px;
    border: 0.5px solid #222;
}

.calc-keys div.op {
    background: #2c2c2c;
    color: var(--holo-blue);
}

.calc-keys div.eq {
    background: var(--holo-blue);
    color: #fff;
}

/* Market specific */
.market-header {
    background: #222;
    color: #fff;
    padding: 0 15px;
    height: 56px;
    font-weight: 500;
    border-bottom: 2px solid #a4c639;
    text-transform: uppercase;
    letter-spacing: 1px;
    font-size: 14px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.market-header-left {
    display: flex;
    align-items: center;
}

.market-plus-btn {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 30px;
    color: #fff;
    cursor: pointer;
    border-radius: 50%;
    transition: background 0.2s;
}

.market-plus-btn:active {
    background: rgba(255, 255, 255, 0.1);
}

.market-hero {
    height: 150px;
    background: #7cb342;
    margin: 10px;
}

.market-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    padding: 10px;
}

.market-item {
    height: 100px;
    background: #eee;
}

/* Settings specific */
.settings-header {
    background: #333;
    color: #fff;
    padding: 15px;
    font-size: 18px;
}

.settings-list {
    padding: 0;
    /* make the settings list fill available space and scroll when content overflows */
    flex: 1;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.settings-item {
    padding: 15px 20px;
    color: #ccc;
    border-bottom: 1px solid #222;
}

.settings-divider {
    background: #222;
    color: var(--holo-blue);
    padding: 5px 20px;
    font-size: 12px;
    font-weight: bold;
}

.sound-setting-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 16px 20px;
    color: #fff;
    border-bottom: 1px solid #222;
}

.ringtones-entry { cursor: pointer; }
.settings-chevron { color: #888; font-size: 30px; font-weight: 300; line-height: 1; }
.battery-simulation {
    padding: 16px 20px 18px;
    color: #eee;
    border-bottom: 1px solid #222;
}
.battery-simulation > label { display: block; margin-bottom: 12px; }
.battery-simulation-controls { display: flex; align-items: center; gap: 8px; }
.battery-simulation-controls input {
    width: 76px;
    padding: 9px 8px;
    color: #fff;
    background: #222;
    border: 1px solid #555;
    border-radius: 3px;
    font: inherit;
}
.battery-simulation button {
    min-height: 36px;
    padding: 0 14px;
    color: #fff;
    background: #333;
    border: 1px solid #555;
    border-radius: 3px;
    font: inherit;
}
.battery-simulation-controls button { margin-left: auto; }
.battery-simulation .battery-simulation-restore { margin-top: 12px; color: #bbb; }
.battery-simulation .battery-simulation-show-alert { display: block; margin-top: 10px; }
.ringtone-list { background: #111; }
.ringtone-row {
    display: flex;
    width: 100%;
    align-items: center;
    justify-content: space-between;
    min-height: 52px;
    padding: 0 20px;
    color: #ddd;
    background: transparent;
    border: 0;
    border-bottom: 1px solid #222;
    text-align: left;
    font: inherit;
    cursor: pointer;
}
.ringtone-row.is-selected { color: var(--holo-blue); background: rgba(51, 181, 229, .08); }
.ringtone-check { width: 22px; color: var(--holo-blue); font-size: 20px; }

.sound-setting-title {
    font-size: 16px;
}

.sound-setting-description {
    margin-top: 4px;
    color: #999;
    font-size: 13px;
}

.sound-toggle {
    position: relative;
    flex: 0 0 auto;
    width: 44px;
    height: 24px;
    padding: 0;
    border: 0;
    border-radius: 999px;
    background: #555;
    cursor: pointer;
    transition: background .18s ease;
}

.sound-toggle::after {
    content: '';
    position: absolute;
    top: 3px;
    left: 3px;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #fff;
    transition: transform .18s ease;
}

.sound-toggle.is-on {
    background: var(--holo-blue);
}

.sound-toggle.is-on::after {
    transform: translateX(20px);
}

/* Clock App */
#app-clock { background: #000; color: #fff; }
.clock-app-view {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding-top: 60px;
}
.clock-big-time { font-size: 72px; font-weight: 300; }
.clock-date { font-size: 14px; color: var(--holo-blue); letter-spacing: 2px; margin-bottom: 40px; }
.alarm-list { width: 100%; padding: 0 20px; }
.alarm-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 0;
    border-bottom: 1px solid #222;
}
.toggle-on, .toggle-off {
    width: 40px;
    height: 15px;
    border-radius: 10px;
    position: relative;
}
.toggle-on { background: var(--holo-blue); }
.toggle-on::after { content: ''; position: absolute; right: 0; top: -5px; width: 25px; height: 25px; background: #fff; border-radius: 50%; }
.toggle-off { background: #333; }
.toggle-off::after { content: ''; position: absolute; left: 0; top: -5px; width: 25px; height: 25px; background: #666; border-radius: 50%; }

/* Maps App */
#app-maps { background: #eee; }
#map-container { flex: 1; width: 100%; height: 100%; }
.map-search-overlay {
    position: absolute;
    top: 10px;
    left: 10px;
    right: 10px;
    z-index: 1000;
}
.map-search-overlay input {
    width: 100%;
    height: 44px;
    border: none;
    border-radius: 2px;
    padding: 0 15px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
    font-size: 16px;
}

/* AI Creator App */
#app-ai-creator { background: #f1f1f1; }
.ai-creator-content { padding: 20px; color: #333; }
.ai-hero h3 { color: #7cb342; font-weight: 300; font-size: 24px; margin-bottom: 10px; }
.ai-hero p { color: #666; font-size: 14px; margin-bottom: 30px; }
.ai-input-area { display: flex; flex-direction: column; gap: 15px; }
#ai-prompt-input {
    background: #fff;
    border: 1px solid #ccc;
    border-radius: 4px;
    color: #333;
    padding: 15px;
    height: 120px;
    font-size: 16px;
    resize: none;
    outline: none;
    box-shadow: inset 0 1px 3px rgba(0,0,0,0.1);
}
#ai-prompt-input:focus { border-color: #a4c639; }
#ai-generate-btn {
    background: #a4c639;
    color: #fff;
    border: none;
    padding: 15px;
    font-weight: bold;
    font-size: 14px;
    border-radius: 2px;
    cursor: pointer;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}
.ai-status { margin-top: 20px; font-size: 14px; color: #aaa; text-align: center; font-style: italic; }

.generated-toolbar {
    background: #000;
    border-bottom: 1px solid #333;
    display: flex;
    align-items: center;
    gap: 15px;
}
.back-to-home-btn {
    font-size: 24px;
    color: #888;
    cursor: pointer;
    padding: 0 10px;
}
.generated-app-title { font-weight: 400; color: #fff; flex: 1; }

/* Music App */
#app-music { background: #111; }
.music-header { background: #222; }
.music-tabs { display: flex; padding: 0 20px; }
.music-tabs span {
    padding: 15px;
    color: #888;
    font-size: 13px;
    font-weight: bold;
    cursor: pointer;
}
.music-tabs span.active { color: var(--holo-blue); border-bottom: 2px solid var(--holo-blue); }
.music-list { padding: 10px; }
.song-item {
    display: flex;
    align-items: center;
    padding: 12px;
    border-bottom: 1px solid #222;
}
.song-art { width: 48px; height: 48px; background: #333; margin-right: 15px; border-radius: 2px; }
.song-title { color: #fff; font-size: 15px; }
.song-artist { color: #888; font-size: 12px; }

/* Camera App */
.camera-ui {
    flex: 1;
    background: #000;
    display: flex;
    flex-direction: column;
}

.camera-preview-container {
    flex: 1;
    position: relative;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

#camera-video, #camera-last-shot {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.camera-controls {
    height: 100px;
    background: rgba(0,0,0,0.8);
    display: flex;
    align-items: center;
    justify-content: space-around;
    padding: 0 20px;
}

.camera-thumb-preview {
    width: 50px;
    height: 50px;
    background: #222;
    border: 2px solid #fff;
    border-radius: 2px;
    background-size: cover;
}

#camera-shutter {
    width: 70px;
    height: 70px;
    border: 4px solid #fff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.shutter-inner {
    width: 50px;
    height: 50px;
    background: #fff;
    border-radius: 50%;
}

#camera-shutter:active .shutter-inner {
    transform: scale(0.9);
    background: var(--holo-blue);
}

.camera-mode-toggle {
    font-size: 24px;
    color: #fff;
}

/* Email App */
.email-toolbar {
    justify-content: space-between;
}

.email-action-btn {
    font-size: 28px;
    color: var(--holo-blue);
    cursor: pointer;
    padding: 0 10px;
}

.email-view-container {
    flex: 1;
    position: relative;
    background: #fff;
}

.email-list {
    height: 100%;
    overflow-y: auto;
}

.email-item {
    padding: 15px;
    border-bottom: 1px solid #eee;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.email-item-header {
    display: flex;
    justify-content: space-between;
    font-size: 14px;
}

.email-item-from {
    font-weight: bold;
    color: #333;
}

.email-item-time {
    color: #999;
    font-size: 11px;
}

.email-item-body {
    color: #666;
    font-size: 13px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.email-compose-view {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background: #fff;
    z-index: 10;
    display: flex;
    flex-direction: column;
    padding: 15px;
}

.compose-header {
    display: flex;
    align-items: center;
    border-bottom: 1px solid #eee;
    margin-bottom: 15px;
}

#email-to-input {
    flex: 1;
    border: none;
    padding: 10px 0;
    font-size: 16px;
    outline: none;
}

.compose-header {
    position: relative;
}

.email-autocomplete-list {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: #fff;
    border: 1px solid #ddd;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    z-index: 100;
    display: none;
    max-height: 200px;
    overflow-y: auto;
}

.autocomplete-item {
    padding: 10px 15px;
    border-bottom: 1px solid #eee;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 14px;
    color: #333;
}

.autocomplete-item:last-child {
    border-bottom: none;
}

.autocomplete-item:hover {
    background: #f0f7ff;
}

.autocomplete-avatar {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: #ccc;
}

#email-select-user-btn {
    padding: 10px;
    color: var(--holo-blue);
    font-size: 24px;
    cursor: pointer;
}

#email-body-input {
    flex: 1;
    border: none;
    resize: none;
    font-size: 16px;
    outline: none;
}

.compose-footer {
    display: flex;
    gap: 10px;
    padding-top: 10px;
}

.compose-footer button {
    flex: 1;
    padding: 12px;
    border: none;
    font-weight: bold;
    border-radius: 2px;
    cursor: pointer;
}

#email-send-btn { background: var(--holo-blue); color: #fff; }
#email-cancel-btn { background: #eee; color: #666; }

.email-user-picker {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.9);
    z-index: 20;
    color: #fff;
    display: flex;
    flex-direction: column;
    padding: 20px;
}

.picker-header {
    font-size: 18px;
    margin-bottom: 20px;
    color: var(--holo-blue);
}

.picker-list {
    flex: 1;
    overflow-y: auto;
}

.picker-user-item {
    padding: 15px;
    border-bottom: 1px solid #333;
    display: flex;
    align-items: center;
    gap: 12px;
}

.picker-user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: #444;
}

#close-picker-btn {
    margin-top: 10px;
    padding: 10px;
    background: #333;
    border: none;
    color: #fff;
}

/* Desktop Mode Styles */
.desktop-mode #nav-bar, .desktop-mode #status-bar {
    display: none !important;
}

/* TV Mode: fullscreen, large UI for viewing from a distance */
.tv-mode #phone-container, .tv-mode #screen, body.tv-mode #phone-container {
    width: 100vw !important;
    height: 100vh !important;
    max-width: 100vw !important;
    max-height: 100vh !important;
    border-radius: 0 !important;
}
.tv-mode .app-title, .tv-mode .market-header-left div, .tv-mode .now-playing-title {
    font-size: 1.6rem !important;
}
.tv-mode .app-content { font-size: 1.05rem; }

/* Laptop Mode: desktop-focused layout but optimized slightly for laptop proportions
   Navigation mirrors tablet/desktop style: hide mobile nav/status, hide bottom dock,
   and show desktop taskbar so laptop mode uses tablet-like navigation. */
.laptop-mode #phone-container {
    width: 90vw !important;
    height: 80vh !important;
    max-width: none !important;
    max-height: none !important;
    border-radius: 8px !important;
}

/* Hide mobile chrome and bottom dock to match tablet-style navigation */
.laptop-mode #nav-bar,
.laptop-mode #status-bar {
    display: none !important;
}

/* Hide the mobile dock and ensure desktop taskbar is visible */
.laptop-mode #dock {
    display: none !important;
}
.laptop-mode #desktop-taskbar {
    display: flex !important;
}

/* In laptop mode prefer tablet/phone-style navigation: apps open full-screen (non-windowed).
   Override windowed styling so .app-window behaves like a regular full app pane instead of a movable window. */
.laptop-mode .app-window {
    position: relative !important;
    top: 0 !important;
    left: 0 !important;
    width: 100% !important;
    height: calc(100% - 0px) !important;
    min-width: unset;
    min-height: unset;
    max-width: 100%;
    max-height: 100%;
    display: none; /* controlled by .active below */
    flex-direction: column;
    box-shadow: none;
    border: none;
    border-radius: 0;
    overflow: hidden;
    transform: none !important;
    opacity: 1 !important;
}

/* When an app-window is activated in laptop-mode, present it full-screen (like phone/tablet apps) */
.laptop-mode .app-window.active {
    display: flex !important;
    z-index: 500;
}

/* Ensure the app-drawer is also a positioned window/panel in laptop mode (not full-screen) */
.laptop-mode #app-drawer {
    position: absolute;
    bottom: 48px;
    left: 0;
    width: 320px;
    height: 400px;
    z-index: 2000;
    border-top-right-radius: 8px;
    box-shadow: 0 0 20px rgba(0,0,0,0.5);
    border: 1px solid #333;
    transform: translateY(10px);
    opacity: 0;
    display: none;
}

/* When active, drawer should behave like desktop-mode panel */
.laptop-mode #app-drawer.active {
    display: flex;
    opacity: 1;
    transform: translateY(0);
}

/* In laptop and desktop modes swap BACK and HOME icon positions so the layout shows HOME where BACK used to be.
   This affects both the bottom navigation buttons and the desktop taskbar icons to keep behavior consistent. */
.laptop-mode #nav-back { background-position: center; }
.laptop-mode #nav-home { background-position: left; }
.laptop-mode #nav-recent { background-position: right; }

.laptop-mode #taskbar-back { background-position: center; }
.laptop-mode #taskbar-home { background-position: left; }
.laptop-mode #taskbar-recent { background-position: right; }

/* Apply same swap for full desktop-mode so taskbar / nav icons remain consistent when using desktop UI */
.desktop-mode #nav-back { background-position: center; }
.desktop-mode #nav-home { background-position: left; }
.desktop-mode #nav-recent { background-position: right; }

.desktop-mode #taskbar-back { background-position: center; }
.desktop-mode #taskbar-home { background-position: left; }
.desktop-mode #taskbar-recent { background-position: right; }

/* Flip Phone Mode: tall narrow form factor with compact chrome */
.flip-mode #phone-container {
    width: 360px !important;
    height: 760px !important;
    max-width: 360px !important;
    max-height: 760px !important;
    border-radius: 18px !important;
    transform-origin: center top;
    box-shadow: 0 18px 48px rgba(0,0,0,0.5);
}
.flip-mode #dock { display: none !important; }
.flip-mode .nav-button { width: 44px; height: var(--nav-bar-height); }

/* Small visual hinge cue for flip-mode (non-interactive) */
.flip-mode #screen::after {
    content: '';
    position: absolute;
    left: 50%;
    top: 6px;
    transform: translateX(-50%);
    width: 56px;
    height: 6px;
    background: linear-gradient(90deg, rgba(255,255,255,0.04), rgba(255,255,255,0.02));
    border-radius: 6px;
    pointer-events: none;
}

.desktop-mode #home-screen {
    display: flex !important;
    opacity: 1 !important;
    transform: none !important;
    pointer-events: auto !important;
    z-index: 5;
}

.desktop-mode #app-drawer {
    position: absolute !important;
    bottom: 48px;
    left: 0;
    width: 320px;
    height: 400px;
    z-index: 2000;
    border-top-right-radius: 8px;
    box-shadow: 0 0 20px rgba(0,0,0,0.5);
    border: 1px solid #333;
    transform: translateY(10px);
    opacity: 0;
    display: none;
}

/* Hide the bottom dock when in desktop (horizontal) mode so its apps are shown on the taskbar instead */
.desktop-mode #dock {
    display: none !important;
}

.desktop-mode #app-drawer.active {
    display: flex;
    opacity: 1;
    transform: translateY(0);
}

#desktop-taskbar {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 48px;
    background: #000;
    border-top: 1px solid #333;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 10px;
    z-index: 1000;
}

.taskbar-left, .taskbar-right {
    display: flex;
    align-items: center;
    gap: 15px;
}

.taskbar-center {
    flex: 1;
    display: flex;
    justify-content: center;
    gap: 10px;
    overflow-x: auto;
}

.taskbar-icon {
    width: 32px;
    height: 32px;
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
    opacity: 0.8;
}

#taskbar-back { background-image: url('/images.png'); background-size: 300%; background-position: left; }
#taskbar-home { background-image: url('/images.png'); background-size: 300%; background-position: center; }
#taskbar-recent { background-image: url('/images.png'); background-size: 300%; background-position: right; }
#taskbar-drawer { background-image: url('/Drawer.png'); background-size: contain; }

.taskbar-app-item {
    width: 36px;
    height: 36px;
    padding: 4px;
    border-bottom: 2px solid transparent;
}

.taskbar-app-item.active {
    border-bottom-color: var(--holo-blue);
    background: rgba(51, 181, 229, 0.1);
}

.taskbar-app-item img {
    width: 100%;
    height: 100%;
}

.taskbar-status {
    display: flex;
    align-items: center;
    gap: 8px;
    color: #fff;
    font-size: 14px;
}

/* Windowed App Styles */
.desktop-mode .app-window {
    position: absolute !important;
    top: 40px;
    left: 20px;
    /* Responsive windowed app size for desktop: scale with container */
    width: calc(48% - 40px);
    height: calc(68% - 60px);
    min-width: 360px;
    min-height: 320px;
    max-width: calc(100% - 40px);
    max-height: calc(100% - 100px);
    display: none; /* Controlled by script */
    flex-direction: column;
    box-shadow: 0 12px 36px rgba(0,0,0,0.55);
    border: 1px solid #444;
    border-radius: 6px;
    overflow: hidden;
    transform: none !important;
    opacity: 1 !important;
}

.desktop-mode .app-window.active {
    display: flex;
    z-index: 500;
}

.window-title-bar {
    height: 36px;
    background: #222;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 10px;
    cursor: move;
    user-select: none;
    border-bottom: 1px solid #333;
}

.window-title {
    color: #eee;
    font-size: 13px;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Resize handles for desktop windowed apps */
.resize-handle {
    position: absolute;
    width: 12px;
    height: 12px;
    background: transparent;
    z-index: 9999;
    opacity: 0.8;
    filter: drop-shadow(0 1px 1px rgba(0,0,0,0.6));
}
.resize-handle.resize-se {
    right: 6px;
    bottom: 6px;
    cursor: se-resize;
    border-radius: 2px;
    box-shadow: inset 0 0 0 2px rgba(255,255,255,0.06);
}
.resize-handle.resize-e {
    right: 6px;
    bottom: 50%;
    transform: translateY(50%);
    width: 10px;
    height: 28px;
    cursor: e-resize;
}
.resize-handle.resize-s {
    bottom: 6px;
    left: 50%;
    transform: translateX(-50%);
    width: 28px;
    height: 10px;
    cursor: s-resize;
}

.window-title img {
    width: 18px;
    height: 18px;
}

/* Window control buttons styling */
.window-controls .window-btn {
    width: 26px;
    height: 22px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #888;
    font-size: 14px;
    cursor: pointer;
    margin-left: 6px;
    border-radius: 3px;
}
.window-controls .window-btn:hover { background: rgba(255,255,255,0.02); color: #fff; }

/* Minimized window state: hidden from view but stays on taskbar */
.desktop-mode .app-window.minimized {
    display: none !important;
}

/* Maximized window fills most of container while remaining a window */
.desktop-mode .app-window.maximized {
    top: 10px !important;
    left: 10px !important;
    width: calc(100% - 20px) !important;
    height: calc(100% - 80px) !important;
    min-width: unset;
    min-height: unset;
}

/* Fullscreen container state: hide the taskbar and expand fullscreen window */
.desktop-mode.window-fullscreen #desktop-taskbar {
    display: none !important;
}

/* App window in fullscreen state */
.desktop-mode .app-window.fullscreen {
    top: 0 !important;
    left: 0 !important;
    width: 100% !important;
    height: 100% !important;
    border-radius: 0 !important;
    box-shadow: none !important;
}

/* Make sure fullscreen window appears above everything */
.desktop-mode .app-window.fullscreen {
    z-index: 9999 !important;
}

.window-controls {
    display: flex;
    gap: 10px;
}

.window-btn {
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #888;
    font-size: 18px;
    cursor: pointer;
}

.window-btn:hover {
    color: #fff;
}

.window-close:hover {
    color: #ff4444;
}

/* FX File Explorer */
.fx-explorer { height: 100%; position: relative; display: flex; flex-direction: column; background: #f4f4f4; color: #313131; font-family: 'Roboto Condensed', Roboto, sans-serif; overflow: hidden; }
.fx-toolbar { height: 56px; flex: 0 0 56px; display: flex; align-items: center; background: #07998c; color: #fff; padding: 0 10px 0 20px; box-shadow: 0 1px 2px rgba(0,0,0,.22); }
.fx-mark { font-family: Roboto, sans-serif; font-size: 35px; font-style: italic; font-weight: 900; letter-spacing: -6px; margin-right: auto; line-height: 1; }
.fx-icon-button { appearance: none; width: 48px; height: 48px; border: 0; background: transparent; color: #fff; font: 300 33px/1 Roboto, sans-serif; cursor: pointer; border-radius: 50%; }
.fx-icon-button:hover, .fx-icon-button:focus-visible { background: rgba(255,255,255,.16); outline: none; }
.fx-settings { font-size: 25px; }
.fx-menu { font-size: 33px; }
.fx-breadcrumb { height: 40px; flex: 0 0 40px; display: flex; align-items: center; background: #e1e1e1; color: #888; font: 700 17px Roboto, sans-serif; }
.fx-home-crumb { height: 100%; padding: 0 13px; color: #999; background: transparent; border: 0; font: inherit; cursor: pointer; }
.fx-home-crumb span { font-size: 28px; vertical-align: -3px; margin-right: 5px; }
.fx-current-path:not(:empty) { display: flex; align-items: center; height: 100%; padding-left: 23px; border-left: 2px solid #ccc; text-transform: lowercase; }
.fx-current-path:not(:empty)::before { content: '/'; color: #aaa; margin-right: 20px; font-size: 28px; font-weight: 400; }
.fx-search-row { display: flex; align-items: center; padding: 8px 12px; gap: 8px; background: #e1e1e1; border-top: 1px solid #d0d0d0; }
.fx-search-input { flex: 1; height: 34px; padding: 0 10px; border: 1px solid #bbb; border-radius: 2px; background: #fff; color: #333; font: 16px Roboto, sans-serif; }
.fx-search-close { width: 35px; height: 35px; border: 0; background: transparent; color: #666; font-size: 28px; cursor: pointer; }
.fx-content { flex: 1; overflow-y: auto; padding: 24px 15px 18px; }
.fx-grid { display: grid; grid-template-columns: repeat(6, minmax(46px, 1fr)); gap: 23px 9px; }
.fx-item { min-width: 0; display: flex; flex-direction: column; align-items: center; text-align: center; gap: 6px; border: 0; background: transparent; color: #333; cursor: pointer; font: 400 14px/1.2 'Roboto Condensed', Roboto, sans-serif; overflow-wrap: anywhere; }
.fx-item:hover .fx-folder, .fx-item:focus-visible .fx-folder { transform: translateY(-2px); filter: brightness(1.06); }
.fx-item:focus-visible { outline: 2px solid #07998c; outline-offset: 3px; border-radius: 3px; }
.fx-folder { width: 56px; height: 39px; position: relative; border-radius: 3px 5px 5px 5px; background: linear-gradient(135deg, #78929e 0 46%, #67828e 47% 100%); box-shadow: inset 0 1px 0 rgba(255,255,255,.25), 0 1px 1px rgba(0,0,0,.18); transition: .14s ease; }
.fx-folder::before { content: ''; position: absolute; width: 27px; height: 9px; left: 4px; top: -7px; border-radius: 4px 4px 0 0; background: #667f8b; }
.fx-folder-symbol { position: absolute; inset: 0; display: grid; place-items: center; color: #fff; font: 700 22px Roboto, sans-serif; text-shadow: 0 1px 1px rgba(0,0,0,.2); }
.fx-file { width: 40px; height: 50px; position: relative; display: grid; place-items: center; border-radius: 4px; background: #009b89; color: #fff; font: 700 25px/1 Roboto, sans-serif; box-shadow: 0 1px 1px rgba(0,0,0,.2); }
.fx-file::after { content: ''; position: absolute; right: 0; top: 0; width: 13px; height: 13px; background: linear-gradient(135deg, #f4f4f4 0 48%, transparent 50%); border-radius: 0 4px 0 0; }
.fx-note { grid-column: 1 / -1; padding-top: 10px; color: #777; text-align: left; font: italic 17px 'Roboto Condensed', Roboto, sans-serif; }
.fx-toast { position: absolute; left: 50%; bottom: 20px; transform: translate(-50%, 10px); padding: 9px 14px; background: rgba(35,35,35,.92); color: #fff; border-radius: 2px; font: 14px Roboto, sans-serif; opacity: 0; pointer-events: none; transition: .2s ease; white-space: nowrap; }
.fx-toast.show { transform: translate(-50%, 0); opacity: 1; }
.fx-dialog-backdrop { position: absolute; inset: 0; z-index: 3; display: grid; place-items: center; padding: 18px; background: rgba(0,0,0,.62); }
.fx-dialog-backdrop[hidden] { display: none; }
.fx-dialog { width: min(100%, 410px); max-height: min(510px, calc(100% - 24px)); overflow-y: auto; background: #fff; box-shadow: 0 2px 8px rgba(0,0,0,.7); padding: 14px 14px 0; color: #333; font: 15px/1.28 Roboto, sans-serif; }
.fx-dialog h2 { margin: 0 0 14px; font-size: 21px; font-weight: 700; }
.fx-dialog p { margin: 0 0 13px; }
.fx-dialog .fx-warning { margin-top: 18px; color: #990000; font-weight: 700; }
.fx-check { display: flex; align-items: center; gap: 13px; }
.fx-check input { width: 22px; height: 22px; }
.fx-dialog-ok { display: block; width: calc(100% + 28px); height: 50px; margin: 5px -14px 0; border: 0; border-top: 1px solid #ddd; background: #fafafa; color: #444; font: 16px Roboto, sans-serif; cursor: pointer; }
.fx-dialog-ok:hover { background: #f2f2f2; }
@media (max-width: 410px) { .fx-content { padding: 22px 12px 15px; } .fx-grid { grid-template-columns: repeat(5, minmax(45px, 1fr)); gap: 22px 7px; } .fx-item { font-size: 13px; } .fx-folder { width: 52px; height: 36px; } .fx-dialog { font-size: 14px; } .fx-dialog h2 { font-size: 20px; } }

/* Overlay View (Recents) */
.overlay-view {
    background: rgba(0, 0, 0, 0.7);
    z-index: 200;
    backdrop-filter: blur(2px);
}

.recent-apps-list {
    display: flex;
    flex-direction: column;
    padding: 20px;
    gap: 15px;
    overflow-y: auto;
    height: 100%;
}

.recent-app-card {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    animation: slideInRecent 0.3s cubic-bezier(0.1, 0.9, 0.2, 1);
}

.recent-app-thumb {
    width: 180px;
    height: 110px;
    background: #111;
    border: 1px solid #444;
    border-radius: 2px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
}

.recent-app-label {
    display: flex;
    align-items: center;
    gap: 8px;
    color: #fff;
    font-size: 14px;
}

.recent-app-label img {
    width: 24px;
    height: 24px;
}

@keyframes slideInRecent {
    from { transform: translateX(-50px); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

/* Animations & Transitions */
.view {
    transition: transform 0.25s cubic-bezier(0.4, 0.0, 0.2, 1), opacity 0.25s ease;
    transform: scale(0.9);
    opacity: 0;
    pointer-events: none;
}

.view.active {
    opacity: 1;
    transform: scale(1);
    pointer-events: auto;
}

/* Home Screen is special, no zoom when active by default */
#home-screen.view {
    transform: scale(1);
    opacity: 1;
    pointer-events: auto;
}

#home-screen.view:not(.active) {
    transform: scale(1.1);
    opacity: 0;
    pointer-events: none;
}

/* Drawer fades in while shrinking into place; closing reverses the zoom. */
#app-drawer {
    transform: scale(1.12);
    opacity: 0;
    background: rgba(0,0,0,0.96);
    transition: transform 0.25s ease, opacity 0.25s ease;
}

#app-drawer.active {
    transform: scale(1);
    opacity: 1;
}

/* The drawer is display:none until opened, so use a keyframe to make its
   enter zoom reliable when it becomes visible. */
body:not(.laptop-mode):not(.desktop-mode) #app-drawer.active:not(.closing):not(.closing-to-recents) {
    animation: drawerZoomIn 0.25s ease both;
}

@keyframes drawerZoomIn {
    from { transform: scale(1.12); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

#app-drawer.closing {
    transform: scale(1.12);
    opacity: 0;
    pointer-events: none;
}

body:not(.laptop-mode):not(.desktop-mode) #app-drawer.active.closing {
    animation: drawerZoomOut 0.25s ease both;
}

@keyframes drawerZoomOut {
    from { transform: scale(1); opacity: 1; }
    to { transform: scale(1.12); opacity: 0; }
}

#app-drawer.closing-to-recents {
    transform: scale(1);
    opacity: 0;
    pointer-events: none;
}

/* Closing animation */
.view.closing {
    transform: scale(0.85);
    opacity: 0;
}

/* Multitasking view specifics */
#recent-apps-view {
    transform: scale(1.05);
    background: rgba(0,0,0,0.8);
    backdrop-filter: blur(4px);
}

#recent-apps-view.active {
    transform: scale(1);
}

#recent-apps-view.closing {
    opacity: 0;
    transform: scale(1.04);
    pointer-events: none;
}

#recent-apps-view.entering {
    opacity: 0;
    transform: scale(1.05);
}

.recent-apps-list.is-empty {
    display: grid;
    place-items: center;
}

.no-recent-apps {
    color: var(--holo-blue);
    font-weight: 300;
    text-align: center;
}

/* Market Improvements */
.market-scrollable {
    overflow-y: auto;
    background: #f1f1f1;
}

.market-hero {
    background: linear-gradient(135deg, #a4c639, #7cb342);
    color: white;
    padding: 30px 20px;
    font-size: 24px;
    font-weight: 300;
}

.market-list {
    padding: 10px;
}

.market-app-item {
    display: flex;
    align-items: center;
    background: white;
    padding: 12px;
    margin-bottom: 2px;
    box-shadow: 0 1px 2px rgba(0,0,0,0.1);
}

.market-app-item img {
    width: 48px;
    height: 48px;
    margin-right: 15px;
}

.market-app-info {
    flex: 1;
}

.market-app-name {
    font-weight: 500;
    color: #333;
    font-size: 15px;
}

.market-app-desc {
    font-size: 12px;
    color: #888;
}

.install-btn {
    background: #a4c639;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 2px;
    font-size: 12px;
    font-weight: bold;
    cursor: pointer;
}

.install-btn.installed {
    background: #eee;
    color: #999;
}

/* Recent App Card Swiping */
.recent-app-card {
    transition: transform 0.2s ease, opacity 0.2s ease;
    cursor: grab;
}

.recent-app-card:active {
    cursor: grabbing;
}

.swipe-hint {
    font-size: 10px;
    color: #444;
    text-transform: uppercase;
    letter-spacing: 1px;
    opacity: 0.5;
}

/* Folder Styles */
.folder-icon {
    width: 56px;
    height: 56px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 4px;
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    padding: 4px;
    gap: 2px;
}

.folder-icon img {
    width: 100% !important;
    height: 100% !important;
    margin: 0 !important;
}

.folder-view-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.8);
    z-index: 150;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s;
}

.folder-view-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

.folder-container {
    background: #222;
    border: 1px solid #444;
    width: 80%;
    border-radius: 4px;
    padding: 20px;
}

.folder-title {
    color: var(--holo-blue);
    font-size: 18px;
    margin-bottom: 20px;
    border-bottom: 1px solid #333;
    padding-bottom: 10px;
}

.folder-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 15px;
}

/* New Apps Styles */
.app-title {
    color: #fff;
    font-size: 18px;
    font-weight: 400;
}

/* Icon gravity & drag styles
   When the grid has .gravity-enabled, icons become positioned elements
   that can fall and be dragged. */
#home-grid.gravity-enabled, #drawer-grid.gravity-enabled {
    position: relative;
    min-height: 220px; /* ensure space for absolute icons */
}
#home-grid.gravity-enabled .app-icon, #drawer-grid.gravity-enabled .app-icon {
    position: absolute;
    width: 72px;
    text-align: center;
    margin: 0;
    transition: transform 120ms linear;
    touch-action: none;
    will-change: transform, left, top;
    user-select: none;
}
#home-grid.gravity-enabled .app-icon img, #drawer-grid.gravity-enabled .app-icon img {
    width: 56px;
    height: 56px;
    margin-bottom: 6px;
}
#home-grid.gravity-enabled .app-icon span, #drawer-grid.gravity-enabled .app-icon span {
    display: block;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    width: 72px;
    font-size: 11px;
}

/* Visual while dragging */
.app-icon.dragging-pointer {
    transform: scale(1.08) !important;
    z-index: 9999 !important;
    box-shadow: 0 18px 32px rgba(0,0,0,0.45);
    transition: transform 60ms linear;
}

.phone-app {
    position: relative;
    height: 100%;
    min-height: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    color: #f5f7f7;
    background: #061718;
    font-family: Roboto, Arial, sans-serif;
}

.phone-tabs {
    height: 34px;
    flex: 0 0 34px;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    background: #030505;
    border-bottom: 1px solid rgba(255,255,255,.14);
}
.phone-tabs[hidden], .dialer-actions[hidden] { display: none !important; }

.phone-tab {
    position: relative;
    display: grid;
    place-items: center;
    padding: 0;
    color: #f4f4f4;
    background: transparent;
    border: 0;
    border-right: 1px solid rgba(255,255,255,.13);
}

.phone-tab:last-child { border-right: 0; }
.phone-tab svg { width: 23px; height: 23px; fill: currentColor; }
.phone-tab.active::after {
    content: '';
    position: absolute;
    right: 0;
    bottom: 0;
    left: 0;
    height: 4px;
    background: #00d4f5;
}

.phone-panel { flex: 1; min-height: 0; }
.phone-panel[hidden] { display: none !important; }
.phone-dialer-panel.active { display: flex; flex-direction: column; }

.dialer-view {
    height: 100%;
    min-height: 0;
    display: flex;
    flex-direction: column;
    background-color: #052c2d;
    background-image: repeating-linear-gradient(132deg, rgba(158,220,218,.045) 0 1px, transparent 1px 3px), linear-gradient(180deg, #06191a, #075352 100%);
}

.dialer-entry-row {
    flex: 0 0 21%;
    min-height: 50px;
    display: flex;
    align-items: center;
    padding: 0 14px;
    background: repeating-linear-gradient(132deg, rgba(180,228,225,.04) 0 1px, transparent 1px 3px), linear-gradient(180deg, rgba(0,0,0,.45), rgba(0,0,0,.2));
    border-bottom: 1px solid rgba(0,0,0,.22);
}

.dialer-display {
    min-width: 0;
    flex: 1;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: clip;
    color: #f4ffff;
    font-size: 29px;
    letter-spacing: 1px;
    text-align: center;
}

.dialer-delete {
    width: 34px;
    height: 24px;
    flex: 0 0 34px;
    border: 0;
    color: #778283;
    background: #f5f7f5;
    clip-path: polygon(20% 0, 100% 0, 100% 100%, 20% 100%, 0 50%);
    font-size: 17px;
    line-height: 1;
}

.dialer-pad {
    flex: 1;
    min-height: 0;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    grid-template-rows: repeat(4, 1fr);
    padding: 5px 8px;
    background: repeating-linear-gradient(132deg, rgba(183,233,230,.035) 0 1px, transparent 1px 3px), linear-gradient(180deg, rgba(0,0,0,.05), rgba(0,0,0,.13));
}

.dialer-pad button {
    min-width: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    padding: 0;
    border: 0;
    color: #f4f6f4;
    background: transparent;
    font-family: inherit;
    -webkit-tap-highlight-color: transparent;
}

.dialer-pad button:active { background: rgba(0,224,255,.12); }
.dial-digit { color: #00dafa; font-size: 39px; font-weight: 300; line-height: 1; }
.dial-letters { min-width: 37px; align-self: center; margin-top: 18px; padding: 0 2px 3px; border-bottom: 2px solid #00dafa; color: #e4e9e8; font-size: 9px; font-weight: 700; line-height: 1; text-align: center; }
.dial-symbol { color: #f4f6f4; font-size: 30px; font-weight: 700; line-height: 1; }

.dialer-actions {
    height: 68px;
    flex: 0 0 68px;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    align-items: center;
    background: linear-gradient(180deg, rgba(0,0,0,.08), rgba(0,0,0,.16));
    border-top: 1px solid rgba(0,0,0,.2);
}

.phone-action {
    width: 100%;
    height: 100%;
    display: grid;
    place-items: center;
    padding: 0;
    border: 0;
    color: #f4f6f5;
    background: transparent;
}

.phone-action svg { width: 25px; height: 25px; fill: currentColor; }
.phone-call svg { width: 32px; height: 32px; }
.phone-action:active { background: rgba(255,255,255,.1); }

.phone-empty-panel {
    display: grid;
    place-items: center;
    background: linear-gradient(180deg, #061819, #075352);
    color: rgba(238,248,247,.62);
    font-size: 15px;
}

.phone-empty-panel.phone-contacts-panel {
    display: flex;
    flex-direction: column;
    justify-content: stretch;
    align-items: stretch;
    text-align: center;
}

.phone-contact-list { flex: 1; overflow-y: auto; text-align: left; }
.phone-no-contacts { flex: 1; display: grid; place-items: center; }
.phone-no-contacts[hidden] { display: none; }
.phone-contact-row {
    width: 100%;
    min-height: 58px;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 17px;
    border: 0;
    border-bottom: 1px solid rgba(255,255,255,.12);
    color: #f3f7f6;
    background: transparent;
    text-align: left;
}
.phone-contact-avatar { width: 38px; height: 38px; display: grid; place-items: center; border-radius: 50%; background: #087c89; font-size: 18px; }
.phone-contact-copy { display: flex; flex-direction: column; gap: 3px; }
.phone-contact-copy strong { font-size: 14px; font-weight: 400; }
.phone-contact-copy small { color: rgba(240,248,247,.68); font-size: 11px; }

.dialer-actions.contacts-mode .phone-call-icon { display: none; }
.dialer-actions.contacts-mode .phone-add-icon { display: block; }
.phone-add-icon { display: none; }

.phone-search-screen {
    position: absolute;
    z-index: 4;
    inset: 0;
    display: flex;
    flex-direction: column;
    background: linear-gradient(180deg, #061819, #075352);
}
.phone-search-screen[hidden] { display: none !important; }
.phone-search-toolbar {
    height: 52px;
    flex: 0 0 52px;
    display: flex;
    align-items: center;
    gap: 7px;
    padding: 0 8px;
    border-bottom: 3px solid #00dafa;
    background: #040809;
}
.phone-search-toolbar > svg { width: 22px; height: 22px; flex: 0 0 22px; fill: #dce8e8; }
.phone-search-back,
.phone-search-menu { width: 30px; height: 42px; flex: 0 0 30px; padding: 0; border: 0; color: #00cffa; background: transparent; font-size: 30px; line-height: 1; }
.phone-search-input { min-width: 0; flex: 1; height: 38px; border: 0; border-bottom: 2px solid #00cffa; border-radius: 0; outline: 0; color: #f4ffff; background: transparent; font: 16px Roboto, Arial, sans-serif; }
.phone-search-input::placeholder { color: #d6e6e5; opacity: 1; }
.phone-search-menu { color: #d9eeee; font-weight: 700; }
.phone-search-results { flex: 1; overflow-y: auto; }
.phone-search-results[hidden] { display: none; }

.phone-overflow-menu {
    position: absolute;
    z-index: 6;
    right: 8px;
    bottom: 76px;
    width: 190px;
    padding: 4px 0;
    background: #245b5b;
    box-shadow: 0 6px 18px rgba(0,0,0,.45);
}
.phone-overflow-menu[hidden] { display: none; }
.phone-overflow-menu.search-menu { top: 44px; right: 8px; bottom: auto; }
.phone-overflow-menu button {
    width: 100%;
    min-height: 48px;
    padding: 0 15px;
    border: 0;
    border-bottom: 1px solid rgba(255,255,255,.12);
    color: #f5f7f6;
    background: transparent;
    font: 14px Roboto, Arial, sans-serif;
    text-align: left;
}
.phone-overflow-menu button:last-child { border-bottom: 0; }
.phone-overflow-menu button:active, .phone-modal-row:active { background: rgba(255,255,255,.12); }

.phone-modal-backdrop {
    position: absolute;
    z-index: 8;
    inset: 0;
    display: grid;
    place-items: center;
    padding: 20px;
    background: rgba(0,0,0,.62);
}
.phone-modal-backdrop[hidden] { display: none; }
.phone-modal {
    width: min(100%, 340px);
    max-height: calc(100% - 32px);
    overflow: auto;
    padding: 18px 18px 0;
    color: #f5f7f6;
    background: #245b5b;
    box-shadow: 0 10px 30px rgba(0,0,0,.5);
}
.phone-modal h2 { margin: 0 0 16px; font-size: 19px; font-weight: 500; }
.phone-form-field { display: block; margin: 12px 0; color: #d2e5e3; font-size: 12px; }
.phone-form-field input { display: block; width: 100%; margin-top: 5px; padding: 8px 0; border: 0; border-bottom: 1px solid #00dafa; outline: 0; color: white; background: transparent; font: 16px Roboto, Arial, sans-serif; }
.phone-modal-row { width: 100%; min-height: 44px; padding: 0; border: 0; border-bottom: 1px solid rgba(255,255,255,.14); color: #f5f7f6; background: transparent; font: 14px Roboto, Arial, sans-serif; text-align: left; }
.phone-modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin: 18px -18px 0; padding: 8px 12px; border-top: 1px solid rgba(255,255,255,.16); }
.phone-modal-actions button { min-height: 36px; padding: 0 12px; border: 0; color: #b9f5f8; background: transparent; font: 13px Roboto, Arial, sans-serif; text-transform: uppercase; }

.phone-toast {
    position: absolute;
    z-index: 2;
    right: 18px;
    bottom: 78px;
    left: 18px;
    width: max-content;
    max-width: calc(100% - 36px);
    margin: 0 auto;
    padding: 9px 15px;
    border-radius: 3px;
    color: #fff;
    background: rgba(30,36,36,.94);
    box-shadow: 0 2px 8px rgba(0,0,0,.3);
    font-size: 13px;
    opacity: 0;
    pointer-events: none;
    transform: translateY(6px);
    transition: opacity 140ms ease, transform 140ms ease;
}

.phone-toast.show { opacity: 1; transform: translateY(0); }

.people-list, .msg-list {
    flex: 1;
    overflow-y: auto;
}

.people-item, .msg-item {
    display: flex;
    padding: 15px;
    border-bottom: 1px solid #222;
    align-items: center;
}

.people-avatar, .msg-avatar {
    width: 40px;
    height: 40px;
    background: #33b5e5;
    margin-right: 15px;
}

.people-name, .msg-name {
    color: #fff;
    font-size: 16px;
}

.msg-text {
    color: #888;
    font-size: 14px;
}

/* Movie Studio App */
#app-movie-studio {
    background: #111;
}

.movie-studio-toolbar {
    background: #222;
    border-bottom: 1px solid #333;
    justify-content: space-between;
}

#movie-export-btn {
    background: #33b5e5;
    color: white;
    border: none;
    padding: 6px 12px;
    font-size: 12px;
    font-weight: bold;
    border-radius: 2px;
    cursor: pointer;
}

.movie-studio-editor {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.movie-preview-area {
    flex: 1;
    background: #000;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: relative;
    border-bottom: 2px solid #222;
}

#movie-viewer {
    width: 90%;
    aspect-ratio: 16/9;
    background: #0a0a0a;
    border: 1px solid #333;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.movie-viewer-placeholder {
    color: #444;
    font-size: 14px;
    text-transform: uppercase;
}

.movie-playback-controls {
    padding: 10px;
}

#movie-play-pause {
    background: transparent;
    color: #33b5e5;
    border: 1px solid #33b5e5;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    font-size: 18px;
    cursor: pointer;
}

.movie-timeline {
    height: 200px;
    background: #1a1a1a;
    display: flex;
    flex-direction: column;
    border-top: 1px solid #333;
}

.timeline-ruler {
    height: 20px;
    background: #222;
    border-bottom: 1px solid #333;
}

.timeline-tracks {
    flex: 1;
    overflow-x: auto;
    overflow-y: hidden;
    display: flex;
    flex-direction: column;
}

.timeline-track {
    display: flex;
    height: 60px;
    border-bottom: 1px solid #222;
    align-items: center;
}

.track-label {
    width: 50px;
    font-size: 10px;
    color: #666;
    padding-left: 5px;
    flex-shrink: 0;
}

.track-content {
    flex: 1;
    display: flex;
    gap: 2px;
    padding: 5px;
    min-width: 1000px;
}

.movie-clip {
    height: 50px;
    width: 80px;
    background: #333;
    border: 1px solid #444;
    border-radius: 2px;
    position: relative;
    overflow: hidden;
    flex-shrink: 0;
}

.movie-clip img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.movie-clip-close {
    position: absolute;
    top: 2px;
    right: 2px;
    background: rgba(255,0,0,0.7);
    color: white;
    font-size: 8px;
    width: 12px;
    height: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    cursor: pointer;
}

.audio-clip-placeholder {
    height: 30px;
    background: #33b5e5;
    opacity: 0.3;
    border-radius: 2px;
    width: 300px;
    font-size: 10px;
    color: #fff;
    display: flex;
    align-items: center;
    padding-left: 10px;
}

.movie-add-controls {
    padding: 10px;
    background: #111;
    display: flex;
    justify-content: center;
}

#movie-add-media-btn {
    background: #222;
    color: #33b5e5;
    border: 1px solid #33b5e5;
    padding: 8px 20px;
    border-radius: 2px;
    font-size: 12px;
    font-weight: bold;
    cursor: pointer;
}

#movie-add-media-btn:active {
    background: #33b5e5;
    color: white;
}

/* Gallery App */
.gallery-content { padding: 10px; display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.gallery-album { background: #1a1a1a; border: 1px solid #333; }
.album-thumb { height: 120px; background: #33b5e5; }
.album-info { padding: 8px; }
.album-name { color: #fff; font-size: 14px; }
.album-count { color: #888; font-size: 12px; }

/* Music Player */
.music-player-ui { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 20px; }
.now-playing-art { width: 200px; height: 200px; background: #222; border: 4px solid #333; margin-bottom: 30px; }
.now-playing-info { text-align: center; margin-bottom: 40px; }
.now-playing-title { color: #fff; font-size: 20px; margin-bottom: 5px; }
.now-playing-artist { color: var(--holo-blue); font-size: 14px; }
.music-controls { display: flex; gap: 30px; align-items: center; }
.music-controls button { background: none; border: none; color: #fff; font-size: 24px; cursor: pointer; }
.music-controls .play-main { font-size: 48px; color: var(--holo-blue); }

/* Books */
.books-shelf { padding: 20px; display: grid; grid-template-columns: repeat(3, 1fr); gap: 15px; }
.book-item { text-align: center; }
.book-cover { height: 120px; margin-bottom: 5px; box-shadow: 2px 2px 5px rgba(0,0,0,0.5); }

/* Downloads */
.downloads-list { flex: 1; display: flex; align-items: center; justify-content: center; }
.empty-downloads { color: #444; font-size: 14px; }

/* YouTube Android 4.0 Style */
#app-youtube { background: #e2e2e2; }
.yt-header { background: #fdfdfd; height: 48px; display: flex; align-items: center; justify-content: space-between; padding: 0 12px; border-bottom: 1px solid #ccc; }
.yt-logo { font-weight: bold; font-size: 18px; color: #333; letter-spacing: -1px; }
.yt-logo::before { content: ''; display: inline-block; width: 24px; height: 16px; background: #cc0000; vertical-align: middle; margin-right: 4px; border-radius: 4px; }
.yt-tabs { background: #f3f3f3; height: 40px; display: flex; border-bottom: 2px solid #ccc; }
.yt-tab { flex: 1; display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: bold; color: #666; cursor: pointer; }
.yt-tab.active { color: #cc0000; border-bottom: 3px solid #cc0000; }
.yt-content { flex: 1; overflow-y: auto; padding: 8px; }
.yt-video-card { background: #fff; border: 1px solid #ccc; margin-bottom: 8px; }
.yt-thumb { aspect-ratio: 16 / 9; background: #000; }
.yt-thumb video { display: block; width: 100%; height: 100%; object-fit: contain; }
.yt-info { padding: 8px; display: flex; align-items: flex-start; gap: 8px; }
.yt-channel-avatar { width: 32px; height: 32px; flex: 0 0 auto; border-radius: 50%; }
.yt-title { font-size: 14px; color: #333; font-weight: 500; margin-bottom: 4px; }
.yt-meta { font-size: 11px; color: #888; line-height: 1.35; }

/* Export Modal */
.export-container { width: 90%; max-width: 400px; background: #222; border-radius: 4px; border: 1px solid #444; display: flex; flex-direction: column; overflow: hidden; }
.export-header { background: #333; padding: 15px; color: #fff; font-size: 18px; }
#export-player-root { width: 100%; aspect-ratio: 16/9; background: #000; }
.export-footer { padding: 10px; display: flex; justify-content: flex-end; border-top: 1px solid #333; }
#close-export-btn { background: var(--holo-blue); color: #fff; border: none; padding: 8px 16px; border-radius: 2px; cursor: pointer; }

/* Devil Store Modal */
.devil-modal {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0,0,0,0.6);
    z-index: 400;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.18s ease, transform 0.18s ease;
    transform: translateY(6px);
}

.devil-modal.active {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0);
}

.devil-modal-content {
    width: 86%;
    max-width: 360px;
    background: #111;
    border: 1px solid #333;
    border-radius: 6px;
    padding: 18px;
    color: #fff;
    box-shadow: 0 20px 40px rgba(0,0,0,0.6);
    display: flex;
    flex-direction: column;
    gap: 12px;
    text-align: center;
}

.devil-modal-header {
    display: flex;
    align-items: center;
    gap: 12px;
    justify-content: center;
}

.devil-modal-header img {
    width: 42px;
    height: 42px;
    border-radius: 6px;
}

.devil-modal-header h2 {
    font-size: 18px;
    margin: 0;
    color: #ff6666;
    letter-spacing: 0.5px;
}

.devil-modal-body {
    color: #ccc;
    font-size: 14px;
    margin: 0 6px 6px 6px;
}

.devil-modal-actions {
    display: flex;
    gap: 10px;
    justify-content: center;
    margin-top: 6px;
}

.devil-btn {
    padding: 10px 14px;
    border-radius: 4px;
    border: 1px solid #444;
    background: #1a1a1a;
    color: #ddd;
    cursor: pointer;
    font-weight: 600;
}

.devil-btn.primary {
    background: #ff4444;
    color: #fff;
    border-color: #ff4444;
}

.devil-btn:active { transform: translateY(1px); }

/* Red screen fade overlay used for special dialer code */
#red-overlay {
    position: absolute;
    inset: 0;
    background: rgba(255,0,0,0); /* starts transparent */
    transition: background 6s linear;
    pointer-events: none;
    z-index: 10000;
}

/* Smartwatch Mode Styles */
.watch-mode #phone-container,
.watch-mode #screen {
    border-radius: 50%;
    overflow: hidden;
}

/* Watch-mode close button - centered-top on circular face */
#watch-close-btn {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(0,0,0,0.6);
    color: #fff;
    border: 1px solid rgba(255,255,255,0.08);
    display: none; /* hidden by default; only shown in watch-mode */
    align-items: center;
    justify-content: center;
    z-index: 11000;
    font-size: 18px;
    cursor: pointer;
    box-shadow: 0 6px 18px rgba(0,0,0,0.6);
}

/* Watch-mode view apps button (small list icon) */
#watch-apps-btn {
    position: absolute;
    top: 12px;
    left: 12px;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(0,0,0,0.6);
    color: #fff;
    border: 1px solid rgba(255,255,255,0.08);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 11000;
    font-size: 18px;
    cursor: pointer;
    box-shadow: 0 6px 18px rgba(0,0,0,0.6);
}

/* Watch-mode recents button (center-top) */
#watch-recents-btn {
    position: absolute;
    top: 12px;
    left: 50%;
    transform: translateX(-50%);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(0,0,0,0.6);
    color: #fff;
    border: 1px solid rgba(255,255,255,0.08);
    display: none; /* shown only in watch-mode by script or via .watch-mode */
    align-items: center;
    justify-content: center;
    z-index: 11000;
    font-size: 18px;
    cursor: pointer;
    box-shadow: 0 6px 18px rgba(0,0,0,0.6);
}

/* Watch-mode apps overlay (circular-friendly grid) */
.watch-apps-overlay {
    position: absolute;
    inset: 0;
    display: none;
    z-index: 11050;
    align-items: center;
    justify-content: center;
    background: rgba(0,0,0,0.6);
    padding: 18px;
}
.watch-apps-overlay.active {
    display: flex;
}
.watch-apps-panel {
    width: 86%;
    max-width: 320px;
    max-height: 86%;
    background: rgba(10,10,10,0.95);
    border-radius: 12px;
    padding: 12px;
    overflow: auto;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    align-content: start;
}
.watch-apps-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    color: #fff;
    font-size: 11px;
    cursor: pointer;
    padding: 6px;
    border-radius: 8px;
    transition: background 0.12s, transform 0.12s;
}
.watch-apps-item img {
    width: 48px;
    height: 48px;
    border-radius: 6px;
    background: #222;
}
.watch-apps-item:active, .watch-apps-item:hover {
    background: rgba(255,255,255,0.04);
    transform: translateY(-3px);
}

/* Make the button slightly larger on touch devices */
@media (hover: none) {
    #watch-close-btn { width: 46px; height: 46px; font-size: 20px; top: 10px; right: 10px; }
}

/* Outer container adjustments when watch-mode class is applied to body */
.watch-mode #phone-container {
    width: 320px !important;
    height: 320px !important;
    max-width: 320px !important;
    max-height: 320px !important;
    box-shadow: 0 40px 80px rgba(0,0,0,0.6);
    border-radius: 50%;
    transform: scale(1);
    transition: width 0.25s ease, height 0.25s ease, border-radius 0.25s ease;
}

/* Show watch controls only when watch-mode is active */
.watch-mode #watch-close-btn,
.watch-mode #watch-apps-btn {
    display: flex;
}

/* Small selector for watch shape */
#watch-shape-selector {
    position: absolute;
    top: 12px;
    left: 56px;
    display: none;
    gap: 6px;
    z-index: 11010;
}
.watch-mode #watch-shape-selector {
    display: flex;
}
.watch-shape-btn {
    width: 36px;
    height: 36px;
    border-radius: 6px;
    background: rgba(0,0,0,0.6);
    color: #fff;
    border: 1px solid rgba(255,255,255,0.06);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    cursor: pointer;
}
.watch-shape-btn[aria-pressed="true"] {
    background: rgba(255,255,255,0.06);
    box-shadow: 0 6px 16px rgba(0,0,0,0.5);
    color: #a4c639;
}

/* Square watch adjustments when selected */
.watch-mode.watch-shape-square #phone-container,
.watch-mode.watch-shape-square #screen {
    border-radius: 12px;
    overflow: hidden;
}

/* Adjust button positions slightly for square layout */
.watch-mode.watch-shape-square #watch-close-btn { right: 10px; top: 10px; }
.watch-mode.watch-shape-square #watch-apps-btn { left: 10px; top: 10px; }

/* Ensure circular default when not square */
.watch-mode:not(.watch-shape-square) #phone-container,
.watch-mode:not(.watch-shape-square) #screen {
    border-radius: 50%;
}

/* Make screen perfectly circular and center content */
.watch-mode #screen {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

/* Hide desktop-only chrome in watch-mode */
.watch-mode #nav-bar,
.watch-mode #status-bar,
.watch-mode #dock,
.watch-mode .market-header,
.watch-mode .app-toolbar,
.watch-mode .movie-studio-toolbar {
    display: none !important;
}

/* Keep minimal home view visible and centered */
.watch-mode #home-screen {
    padding: 18px;
    display: flex !important;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

/* Reduce app icon sizes for watch face */
.watch-mode .app-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    padding: 8px;
}

.watch-mode .app-icon img {
    width: 44px;
    height: 44px;
}

.watch-mode .app-icon span {
    font-size: 10px;
}

/* Taskbar hidden in watch-mode */
.watch-mode #desktop-taskbar {
    display: none !important;
}

/* Windowed apps should open full circular overlay (simple behavior) */
.watch-mode .app-window {
    position: absolute !important;
    top: 0;
    left: 0;
    width: 100% !important;
    height: 100% !important;
    border-radius: 50%;
    min-width: unset;
    min-height: unset;
    max-width: unset;
    max-height: unset;
    box-shadow: none;
    border: none;
    display: none;
}

.watch-mode .app-window.active {
    display: flex;
}

/* For readability, center typical app content */
.watch-mode .app-content {
    padding: 12px;
    overflow: auto;
    text-align: center;
}

/* Watch-mode specific browser toolbar (compact) */
.watch-browser-toolbar {
    display: none;
    height: 40px;
    background: rgba(0,0,0,0.6);
    align-items: center;
    justify-content: space-between;
    padding: 6px 8px;
    gap: 8px;
    color: #fff;
}
.watch-browser-toolbar .wb-left, .watch-browser-toolbar .wb-right {
    display: flex;
    align-items: center;
    gap: 8px;
}
.watch-browser-toolbar button {
    background: rgba(255,255,255,0.04);
    border: 1px solid rgba(255,255,255,0.06);
    color: #fff;
    padding: 6px 8px;
    border-radius: 6px;
    font-size: 14px;
    cursor: pointer;
}

/* Show the compact toolbar only in watch-mode and hide normal browser toolbar */
.watch-mode .watch-browser-toolbar { display: flex; }
.watch-mode .browser-toolbar { display: none !important; }

/* Make iframe fit nicely inside circular app window on watch */
.watch-mode #browser-iframe {
    border-radius: 8px;
    width: calc(100% - 20px);
    height: calc(100% - 56px);
    margin: 8px 10px 10px 10px;
    border: none;
}

/* Smaller camera shutter and controls */
.watch-mode #camera-shutter { width: 54px; height: 54px; border-width: 3px; }
.watch-mode .shutter-inner { width: 36px; height: 36px; }

/* Ensure overlay modals are centered on circular face */
.watch-mode .devil-modal-content,
.watch-mode .export-container {
    transform: scale(0.92);
}

/* Responsive fallback on very small viewports */
@media (max-width: 360px) {
    .watch-mode #phone-container { width: 280px !important; height: 280px !important; max-width: 280px !important; max-height: 280px !important; }
}

/* Freak Mode - distinctive chilled/freaky UI */
.freak-mode #screen {
    background: linear-gradient(180deg, #03121a 0%, #05202a 100%) !important;
    filter: grayscale(40%) contrast(90%);
}
.freak-mode body, .freak-mode .app-window, .freak-mode .app-content, .freak-mode .view {
    color: #dff6ff !important;
}
.freak-mode .status-right, .freak-mode .nav-button, .freak-mode .dock-inner {
    opacity: 0.9;
}
.freak-mode .app-icon span, .freak-mode .market-app-name {
    color: #c7eef8 !important;
}
.freak-mode .app-icon img, .freak-mode .watch-apps-item img {
    filter: hue-rotate(180deg) saturate(0.6) brightness(0.9);
    border-radius: 6px;
    transition: transform 180ms ease, filter 280ms ease, box-shadow 220ms ease;
    will-change: transform, filter;
    /* slight lift on hover/tap for feedback */
}
.freak-mode .market-hero { background: #07414e !important; }
.freak-mode .devil-modal-content { background: #021216; border-color: #07323a; }
.freak-mode .export-container { background: #021216; border-color: #07323a; }
.freak-mode .music-player-ui .now-playing-art { border-color: #07414e; }

/* Bounce animation for app icons */
.app-icon.bounce {
    animation: appBounce 640ms cubic-bezier(.2,.8,.2,1);
    transform-origin: 50% 50%;
    will-change: transform;
}

@keyframes appBounce {
    0%   { transform: translateY(0) scale(1); }
    20%  { transform: translateY(-12px) scale(1.06); }
    40%  { transform: translateY(0) scale(0.98); }
    60%  { transform: translateY(-6px) scale(1.02); }
    80%  { transform: translateY(0) scale(0.995); }
    100% { transform: translateY(0) scale(1); }
}

/* Temporary "messed" visual applied shortly after enabling Freak Mode */
.freak-mode.freak-mess #screen {
    animation: freakPulse 2.2s ease-in-out infinite;
    filter: hue-rotate(60deg) saturate(1.4) contrast(1.05) brightness(1.02);
}
.freak-mode.freak-mess .app-icon span,
.freak-mode.freak-mess .market-app-name,
.freak-mode.freak-mess .now-playing-title,
.freak-mode.freak-mess .now-playing-artist {
    animation: flickerText 1.6s linear infinite;
    color: #ffddcc !important;
    text-shadow: 0 0 8px rgba(255, 200, 150, 0.12);
}
.freak-mode.freak-mess .app-icon img,
.freak-mode.freak-mess .watch-apps-item img {
    transform: rotate(-2deg) scale(1.02);
    filter: hue-rotate(120deg) saturate(1.2) contrast(1.05);
    transition: transform 0.22s ease, filter 0.25s ease;
    /* add a slow continuous spin in addition to wobble & hue shift */
    animation: iconWobble 1.8s infinite linear, iconHueShift 3.6s infinite linear, iconSpin 6s linear infinite;
    box-shadow: 0 6px 18px rgba(255,200,150,0.06), inset 0 1px 0 rgba(255,255,255,0.02);
    transform-origin: 50% 50%;
    will-change: transform, filter;
}

/* Icon-specific keyframes for wobble and hue cycling */
@keyframes iconWobble {
    0% { transform: rotate(-2deg) scale(1.02); }
    12% { transform: rotate(3deg) scale(1.05); }
    25% { transform: rotate(-4deg) scale(0.98); }
    50% { transform: rotate(2deg) scale(1.03); }
    75% { transform: rotate(-1deg) scale(1.00); }
    100% { transform: rotate(-2deg) scale(1.02); }
}

@keyframes iconHueShift {
    0%   { filter: hue-rotate(120deg) saturate(1.2) contrast(1.05); }
    25%  { filter: hue-rotate(40deg) saturate(1.6) contrast(1.03); }
    50%  { filter: hue-rotate(200deg) saturate(0.9) contrast(1.1); }
    75%  { filter: hue-rotate(300deg) saturate(1.4) contrast(0.98); }
    100% { filter: hue-rotate(120deg) saturate(1.2) contrast(1.05); }
}

/* Slow continuous spin to complement wobble/hue animations */
@keyframes iconSpin {
    0% { transform: rotate(-2deg) scale(1.02); }
    50% { transform: rotate(178deg) scale(1.02); }
    100% { transform: rotate(-2deg) scale(1.02); }
}

/* Subtle keyframe animations for the messed effect */
@keyframes freakPulse {
    0% { transform: translateZ(0) scale(1); filter: hue-rotate(0deg) saturate(1) contrast(0.95); }
    50% { transform: translateZ(0) scale(1.01); filter: hue-rotate(80deg) saturate(1.6) contrast(1.05); }
    100% { transform: translateZ(0) scale(1); filter: hue-rotate(0deg) saturate(1) contrast(0.95); }
}

@keyframes flickerText {
    0% { opacity: 1; text-shadow: 0 0 6px rgba(255,255,255,0.0); transform: translateY(0); }
    30% { opacity: 0.85; text-shadow: 0 0 10px rgba(255,200,120,0.25); transform: translateY(-1px); }
    60% { opacity: 0.9; text-shadow: 0 0 4px rgba(255,120,200,0.08); transform: translateY(0); }
    100% { opacity: 1; text-shadow: 0 0 6px rgba(255,255,255,0.0); transform: translateY(0); }
}

/* Watch-mode: hide UI chrome when user toggles hide option */
.watch-mode.watch-hide-ui #watch-close-btn,
.watch-mode.watch-hide-ui #watch-apps-btn,
.watch-mode.watch-hide-ui #watch-recents-btn,
.watch-mode.watch-hide-ui #watch-shape-selector,
.watch-mode.watch-hide-ui .watch-browser-toolbar,
.watch-mode.watch-hide-ui .watch-apps-overlay,
.watch-mode.watch-hide-ui .watch-apps-panel,
.watch-mode.watch-hide-ui .watch-apps-item,
.watch-mode.watch-hide-ui .watch-apps-overlay.active {
    display: none !important;
    visibility: hidden !important;
}

/* Show the single "Show UI" button when the watch UI is hidden so users can restore it */
#watch-show-ui-btn {
    position: absolute;
    top: 12px;
    left: 50%;
    transform: translateX(-50%);
    width: 46px;
    height: 46px;
    border-radius: 50%;
    background: rgba(0,0,0,0.7);
    color: #fff;
    border: 1px solid rgba(255,255,255,0.06);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 12020;
    font-size: 18px;
    cursor: pointer;
    box-shadow: 0 6px 18px rgba(0,0,0,0.6);
}

/* When UI is hidden show the restore button */
.watch-mode.watch-hide-ui #watch-show-ui-btn {
    display: flex !important;
}

/* Also hide small status indicators and any extra overlays to keep face clean */
.watch-mode.watch-hide-ui .devil-modal,
.watch-mode.watch-hide-ui .devil-modal.active,
.watch-mode.watch-hide-ui .export-container,
.watch-mode.watch-hide-ui #recent-apps-view,
.watch-mode.watch-hide-ui #recent-apps-view.active {
    display: none !important;
    opacity: 0 !important;
    pointer-events: none !important;
}

/* Android boot overlay */
#boot-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #000;
    z-index: 12000;
    pointer-events: none;
    opacity: 0;
    transition: none;
}
#boot-overlay.show {
    pointer-events: auto;
    opacity: 1;
}
#boot-overlay .boot-inner {
    width: min(100%, 420px);
}
#boot-overlay .boot-animation {
    display: block;
    width: 100%;
    max-height: 100%;
    object-fit: contain;
}

/* Fade-out quick helper */
#boot-overlay.fade-out {
    transition: opacity 800ms ease;
    opacity: 0;
    pointer-events: auto;
}

/* Promoted content slots */
.content-frame {
    display: block;
    width: 100%;
    height: 100%;
    border: 0;
    background: transparent;
}
.content {
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    box-sizing: border-box;
}
.content-banner {
    width: 100%;
    height: 84px;
    padding: 6px 12px;
    flex-shrink: 0;
}
.content-square {
    width: 100%;
    max-width: 260px;
    height: 240px;
    margin: 8px auto;
    padding: 8px;
    background: rgba(0, 0, 0, 0.06);
    border-radius: 6px;
}
.content-vertical {
    width: 100%;
    max-width: 220px;
    height: 280px;
    margin: 12px auto;
    padding: 8px;
    background: rgba(0, 0, 0, 0.06);
    border-radius: 6px;
}
