/* Interactive Android system layer. This file is intentionally loaded last. */

:root {
    --system-glass: rgba(10, 14, 23, 0.86);
    --system-panel: rgba(18, 24, 37, 0.96);
    --system-line: rgba(255, 255, 255, 0.14);
    --system-blue: #73e7ff;
    --system-green: #72f0ae;
    --system-red: #ff6c7d;
    --screen-dim: 0.08;
}

body::after {
    content: '';
    position: fixed;
    inset: 0;
    z-index: 1500;
    pointer-events: none;
    background: rgba(0, 0, 0, var(--screen-dim));
    transition: background 180ms ease;
}

button,
input {
    font: inherit;
}

.power-copy {
    margin-top: 18px;
    color: rgba(255, 255, 255, 0.62);
    font-family: "Cascadia Mono", Consolas, monospace;
    font-size: 10px;
    letter-spacing: 0.18em;
    text-transform: uppercase;
}

.swipe-affordance {
    position: absolute;
    bottom: 22px;
    left: 50%;
    display: grid;
    justify-items: center;
    gap: 3px;
    transform: translateX(-50%);
    color: #fff;
}

.swipe-chevron {
    font-size: 21px;
    animation: swipeCue 1.8s ease-in-out infinite;
}

.swipe-line,
.shade-handle {
    width: 42px;
    height: 4px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.78);
}

.lock-screen.swiping .time-display,
.lock-screen.swiping .user-profile,
.lock-screen.swiping .swipe-affordance {
    transform: translateY(calc(0px - var(--swipe-distance, 0px)));
    transition: none;
}

.lock-screen.swiping .background-overlay {
    opacity: 0.55;
}

@keyframes swipeCue {
    0%, 100% { opacity: 0.36; transform: translateY(5px); }
    50% { opacity: 1; transform: translateY(-5px); }
}

.android-status-bar {
    cursor: pointer;
}

.android-status-bar::after {
    content: '';
    position: absolute;
    top: 4px;
    left: 50%;
    width: 38px;
    height: 3px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.48);
    transform: translateX(-50%);
    transition: width 180ms ease, background 180ms ease;
}

.android-status-bar:hover::after,
.android-status-bar:focus-visible::after {
    width: 58px;
    background: rgba(115, 231, 255, 0.9);
}

.home-widget {
    position: relative;
    z-index: 12;
    width: min(690px, calc(100% - 40px));
    min-height: 92px;
    margin: clamp(22px, 4vh, 42px) auto 0;
    padding: 18px 86px 18px 22px;
    display: grid;
    gap: 5px;
    overflow: hidden;
    color: #fff;
    text-align: left;
    cursor: pointer;
    border: 1px solid rgba(255, 255, 255, 0.16);
    border-radius: 24px;
    background:
        radial-gradient(circle at 88% 18%, rgba(115, 231, 255, 0.2), transparent 28%),
        linear-gradient(135deg, rgba(10, 15, 25, 0.86), rgba(18, 23, 36, 0.72));
    box-shadow: 0 25px 65px -42px rgba(0, 0, 0, 0.95), inset 0 1px 0 rgba(255, 255, 255, 0.12);
    backdrop-filter: blur(20px) saturate(130%);
}

.home-widget::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(104deg, transparent 34%, rgba(255, 255, 255, 0.11) 49%, transparent 64%);
    transform: translateX(-110%);
    animation: widgetLight 7s ease-in-out infinite;
    pointer-events: none;
}

.widget-kicker,
.system-label {
    color: var(--system-blue);
    font-family: "Cascadia Mono", Consolas, monospace;
    font-size: 9px;
    font-weight: 700;
    letter-spacing: 0.2em;
}

.widget-main {
    font-size: clamp(17px, 2vw, 23px);
    font-weight: 700;
    letter-spacing: -0.02em;
}

.widget-sub {
    color: rgba(255, 255, 255, 0.68);
    font-size: 11px;
}

.signal-bars {
    position: absolute;
    right: 23px;
    top: 50%;
    height: 36px;
    display: flex;
    align-items: center;
    gap: 4px;
    transform: translateY(-50%);
}

.signal-bars i {
    width: 4px;
    height: 12px;
    border-radius: 999px;
    background: var(--system-blue);
    box-shadow: 0 0 12px rgba(115, 231, 255, 0.6);
    animation: signal 1.25s ease-in-out infinite;
}

.signal-bars i:nth-child(2) { animation-delay: -0.2s; }
.signal-bars i:nth-child(3) { animation-delay: -0.4s; }
.signal-bars i:nth-child(4) { animation-delay: -0.6s; }
.signal-bars i:nth-child(5) { animation-delay: -0.8s; }

@keyframes signal {
    0%, 100% { height: 10px; opacity: 0.48; }
    50% { height: 34px; opacity: 1; }
}

@keyframes widgetLight {
    0%, 56% { transform: translateX(-110%); }
    82%, 100% { transform: translateX(110%); }
}

.app-grid {
    padding-top: clamp(28px, 5vh, 52px) !important;
}

.system-icon-bg {
    background: linear-gradient(145deg, #343b49, #121722 72%) !important;
}

.device-side-key {
    position: fixed;
    right: 0;
    top: 37%;
    z-index: 620;
    width: 8px;
    height: 82px;
    padding: 0;
    border: 0;
    border-radius: 7px 0 0 7px;
    background: linear-gradient(180deg, #8893a8, #343a46);
    box-shadow: -5px 0 18px rgba(0, 0, 0, 0.42);
    cursor: pointer;
    opacity: 0;
    visibility: hidden;
    transform: translateX(100%);
    transition: width 180ms ease, opacity 240ms ease, transform 240ms ease;
}

.device-side-key:hover,
.device-side-key:focus-visible {
    width: 14px;
    outline: 2px solid var(--system-blue);
    outline-offset: 3px;
}

body.device-active .device-side-key {
    opacity: 1;
    visibility: visible;
    transform: none;
}

body.device-locked .device-side-key {
    opacity: 0.74;
}

.notification-shade,
.recents-screen {
    position: fixed;
    inset: 0;
    color: #f7f4ed;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.notification-shade {
    z-index: 920;
    padding: 14px clamp(18px, 5vw, 70px) 46px;
    overflow-y: auto;
    background:
        radial-gradient(circle at 14% 0%, rgba(49, 118, 163, 0.34), transparent 35%),
        linear-gradient(180deg, rgba(7, 10, 17, 0.98), rgba(12, 16, 26, 0.96));
    backdrop-filter: blur(28px) saturate(125%);
    transform: translateY(-104%);
    transition: transform 0.56s cubic-bezier(0.16, 0.84, 0.24, 1), opacity 0.28s ease, visibility 0.56s;
}

.notification-shade.open {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transform: none;
}

.shade-handle {
    margin: 0 auto 20px;
    opacity: 0.55;
}

.shade-header,
.recents-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: min(860px, 100%);
    margin: 0 auto;
}

.shade-header > div {
    display: grid;
    gap: 3px;
}

.shade-time {
    font-size: clamp(40px, 7vw, 76px);
    font-weight: 250;
    letter-spacing: -0.06em;
    line-height: 0.95;
}

.shade-date {
    color: rgba(255, 255, 255, 0.62);
    font-size: 12px;
}

.shade-close {
    width: 44px;
    height: 44px;
    color: #fff;
    font-size: 28px;
    border: 1px solid var(--system-line);
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.07);
    cursor: pointer;
}

.quick-settings {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
    width: min(860px, 100%);
    margin: 28px auto 16px;
}

.quick-toggle {
    min-height: 74px;
    display: grid;
    place-items: center;
    gap: 6px;
    color: rgba(255, 255, 255, 0.72);
    border: 1px solid var(--system-line);
    border-radius: 20px;
    background: rgba(255, 255, 255, 0.06);
    cursor: pointer;
    transition: transform 160ms ease, color 160ms ease, background 160ms ease;
}

.quick-toggle span { font-size: 20px; }
.quick-toggle:hover { transform: translateY(-2px); }
.quick-toggle.active {
    color: #061018;
    background: linear-gradient(135deg, #8cecff, #6bbcff);
    border-color: transparent;
}

.brightness-control {
    width: min(860px, 100%);
    margin: 0 auto 28px;
    padding: 13px 17px;
    display: flex;
    align-items: center;
    gap: 14px;
    border: 1px solid var(--system-line);
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.07);
}

.brightness-control input {
    width: 100%;
    accent-color: var(--system-blue);
}

.notification-list {
    width: min(860px, 100%);
    margin: 0 auto;
}

.notification-list .system-label { display: block; margin: 0 0 12px 4px; }

.notification-card {
    width: 100%;
    margin-bottom: 10px;
    padding: 17px 19px;
    display: grid;
    gap: 4px;
    color: #f7f4ed;
    text-align: left;
    border: 1px solid var(--system-line);
    border-radius: 20px;
    background: linear-gradient(145deg, rgba(31, 39, 56, 0.96), rgba(17, 22, 32, 0.94));
    cursor: pointer;
}

.notification-card:hover { border-color: rgba(115, 231, 255, 0.45); }
.notification-card > span:last-child { color: rgba(255, 255, 255, 0.62); font-size: 12px; }
.notification-app { color: var(--system-blue); font-size: 10px; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase; }

body.focus-mode .notification-card:nth-of-type(n + 2) {
    display: none;
}

.recents-screen {
    z-index: 880;
    padding: clamp(44px, 8vh, 86px) clamp(20px, 6vw, 84px) 70px;
    overflow-y: auto;
    background:
        radial-gradient(circle at 82% 12%, rgba(115, 100, 255, 0.22), transparent 36%),
        linear-gradient(145deg, #090b12, #121725 62%, #080a10);
    transform: translateY(4vh) scale(0.96);
    transition: transform 0.48s cubic-bezier(0.16, 0.84, 0.24, 1), opacity 0.32s ease, visibility 0.48s;
}

.recents-screen.open {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transform: none;
}

.recents-header h2 {
    margin-top: 6px;
    font-size: clamp(34px, 5vw, 60px);
    letter-spacing: -0.05em;
}

.recents-header button,
#clearRecents {
    padding: 10px 15px;
    color: #fff;
    border: 1px solid var(--system-line);
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.07);
    cursor: pointer;
}

.recent-stack {
    width: min(900px, 100%);
    margin: 30px auto 0;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px;
}

.recent-card {
    min-height: 190px;
    padding: 22px;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    color: #fff;
    text-align: left;
    border: 1px solid var(--system-line);
    border-radius: 28px;
    background:
        radial-gradient(circle at 74% 18%, rgba(115, 231, 255, 0.2), transparent 34%),
        linear-gradient(145deg, #1b2436, #0c1018 72%);
    box-shadow: 0 28px 70px -45px #000;
    cursor: pointer;
    animation: recentIn 0.5s cubic-bezier(0.16, 0.84, 0.24, 1) both;
}

.recent-card strong { font-size: 25px; }
.recent-card span { margin-bottom: auto; color: var(--system-blue); font-family: monospace; font-size: 10px; letter-spacing: 0.15em; }
.recents-empty { grid-column: 1 / -1; padding: 70px 20px; color: rgba(255, 255, 255, 0.52); text-align: center; border: 1px dashed var(--system-line); border-radius: 28px; }

@keyframes recentIn {
    from { opacity: 0; transform: translateY(24px) scale(0.96); filter: blur(10px); }
    to { opacity: 1; transform: none; filter: none; }
}

.power-menu {
    position: fixed;
    inset: 0;
    z-index: 1100;
    display: grid;
    place-items: center;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.28s ease, visibility 0.28s;
}

.power-menu.open {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

.power-menu-backdrop {
    position: absolute;
    inset: 0;
    border: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(18px);
}

.power-sheet {
    position: relative;
    width: min(660px, calc(100% - 32px));
    padding: clamp(24px, 5vw, 42px);
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: 34px;
    color: #f7f4ed;
    background:
        radial-gradient(circle at 82% 0%, rgba(115, 231, 255, 0.16), transparent 36%),
        linear-gradient(145deg, #171d2a, #090c12 72%);
    box-shadow: 0 50px 120px -45px #000;
    transform: translateY(28px) scale(0.96);
    transition: transform 0.42s cubic-bezier(0.16, 0.84, 0.24, 1);
}

.power-menu.open .power-sheet { transform: none; }
.power-sheet-head h2 { margin: 9px 0 25px; font-size: clamp(28px, 5vw, 48px); letter-spacing: -0.05em; }

.power-actions {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
}

.power-actions button {
    min-height: 148px;
    padding: 18px;
    display: grid;
    align-content: end;
    gap: 5px;
    color: #f7f4ed;
    text-align: left;
    border: 1px solid var(--system-line);
    border-radius: 24px;
    background: rgba(255, 255, 255, 0.055);
    cursor: pointer;
    transition: transform 180ms ease, border-color 180ms ease;
}

.power-actions button:hover { transform: translateY(-4px); border-color: rgba(115, 231, 255, 0.48); }
.power-actions button > span { margin-bottom: auto; font-size: 28px; }
.power-actions button small { color: rgba(255, 255, 255, 0.55); line-height: 1.35; }
.power-actions .danger { background: linear-gradient(145deg, rgba(123, 28, 47, 0.4), rgba(46, 15, 22, 0.64)); }
.power-actions .danger:hover { border-color: rgba(255, 108, 125, 0.7); }

.system-navigation {
    position: fixed;
    left: 50%;
    bottom: 8px;
    z-index: 1000;
    height: 27px;
    display: flex;
    align-items: center;
    gap: clamp(54px, 9vw, 110px);
    opacity: 0;
    visibility: hidden;
    transform: translate(-50%, 16px);
    transition: opacity 240ms ease, transform 240ms ease, visibility 240ms;
}

body.device-active:not(.device-locked) .system-navigation {
    opacity: 1;
    visibility: visible;
    transform: translate(-50%, 0);
}

.system-navigation button {
    width: 42px;
    height: 27px;
    display: grid;
    place-items: center;
    border: 0;
    background: transparent;
    cursor: pointer;
}

.system-navigation button:focus-visible { outline: 2px solid var(--system-blue); border-radius: 8px; }

.home-widget:focus-visible,
.quick-toggle:focus-visible,
.notification-card:focus-visible,
.shade-close:focus-visible,
.recent-card:focus-visible,
#clearRecents:focus-visible,
.power-actions button:focus-visible {
    outline: 2px solid var(--system-blue);
    outline-offset: 3px;
}
.nav-back { width: 12px; height: 12px; border-left: 2px solid #fff; border-bottom: 2px solid #fff; transform: rotate(45deg); }
.nav-home { width: 15px; height: 15px; border: 2px solid #fff; border-radius: 50%; }
.nav-recents { width: 14px; height: 14px; border: 2px solid #fff; border-radius: 3px; }

.android-dock { margin-bottom: 38px !important; }

.system-toast {
    position: fixed;
    left: 50%;
    bottom: 54px;
    z-index: 1250;
    max-width: min(420px, calc(100% - 30px));
    padding: 11px 17px;
    color: #fff;
    font-size: 12px;
    text-align: center;
    border: 1px solid var(--system-line);
    border-radius: 999px;
    background: rgba(9, 13, 21, 0.92);
    box-shadow: 0 18px 50px rgba(0, 0, 0, 0.42);
    opacity: 0;
    pointer-events: none;
    transform: translate(-50%, 12px);
    transition: opacity 180ms ease, transform 180ms ease;
}

.system-toast.show { opacity: 1; transform: translate(-50%, 0); }

body.device-powering-off .container {
    animation: screenOff 0.82s cubic-bezier(0.7, 0, 0.84, 0) both;
}

@keyframes screenOff {
    0% { filter: brightness(1); transform: scale(1); }
    70% { filter: brightness(2.2); transform: scaleY(0.012); }
    100% { filter: brightness(0); transform: scale(0); }
}

body.device-is-off .container { animation: screenOn 0.5s ease both; }

@keyframes screenOn {
    from { opacity: 0; filter: brightness(0); }
    to { opacity: 1; filter: none; }
}

body.reduce-motion *,
body.reduce-motion *::before,
body.reduce-motion *::after {
    animation-play-state: paused !important;
    transition-duration: 0.01ms !important;
}

@media (max-width: 760px) {
    .home-widget {
        min-height: 78px;
        margin-top: 20px;
        padding: 14px 65px 14px 17px;
        border-radius: 20px;
    }

    .widget-main { font-size: 15px; }
    .widget-sub { font-size: 9px; }
    .signal-bars { right: 17px; transform: translateY(-50%) scale(0.82); }
    .app-grid { padding-top: 22px !important; gap: 17px 8px !important; }
    .android-dock { margin-bottom: 34px !important; }
    .quick-settings { grid-template-columns: repeat(2, 1fr); }
    .recent-stack { grid-template-columns: 1fr; }
    .power-actions { grid-template-columns: 1fr; }
    .power-actions button { min-height: 104px; }
    .power-sheet { max-height: calc(100vh - 28px); overflow-y: auto; }
    .device-side-key { top: 31%; }
}

@media (prefers-reduced-motion: reduce) {
    .signal-bars i,
    .home-widget::after,
    .swipe-chevron {
        animation: none !important;
    }
}
