:root {
    --safe-top: env(safe-area-inset-top, 0px);
    --safe-right: env(safe-area-inset-right, 0px);
    --safe-bottom: env(safe-area-inset-bottom, 0px);
    --safe-left: env(safe-area-inset-left, 0px);
    --status-height: 32px;
    --dock-height: 88px;
    --dock-gap: 14px;
    --pagination-space: 18px;
    --page-gap: 20px;
    --ink: #111315;
    --muted: #62686d;
    --surface: rgba(255, 255, 255, 0.34);
    --surface-strong: rgba(255, 255, 255, 0.72);
    --line: rgba(255, 255, 255, 0.88);
    --focus: #2367d1;
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

* {
    margin: 0;
    padding: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    letter-spacing: 0;
    -webkit-tap-highlight-color: transparent;
}

html,
body {
    width: 100%;
    height: 100%;
    min-width: 280px;
    overflow: hidden;
    overscroll-behavior: none;
}

html {
    background: #e9edf1;
}

body {
    color: var(--ink);
    background: linear-gradient(135deg, #e3e8ed 0%, #f6f7f8 58%, #e9eff2 100%);
}

button,
input {
    color: inherit;
    font: inherit;
}

button {
    border: 0;
}

button:not(:disabled) {
    cursor: pointer;
}

button:focus-visible,
input:focus-visible {
    outline: 2px solid var(--focus);
    outline-offset: 3px;
}

[hidden],
.is-hidden {
    display: none !important;
}

.noscript-message {
    position: fixed;
    inset: 0;
    z-index: 10000;
    display: grid;
    place-items: center;
    padding: 24px;
    background: #f4f6f7;
    color: #1f2529;
    text-align: center;
}

.glass-3d {
    background: var(--surface);
    -webkit-backdrop-filter: blur(16px);
    backdrop-filter: blur(16px);
    border-top: 1.5px solid var(--line);
    border-left: 1.5px solid var(--line);
    border-right: 0.5px solid rgba(255, 255, 255, 0.16);
    border-bottom: 0.5px solid rgba(255, 255, 255, 0.16);
    border-radius: 24px;
    box-shadow:
        6px 6px 18px rgba(34, 42, 48, 0.07),
        -2px -2px 10px rgba(255, 255, 255, 0.7) inset,
        4px 4px 10px rgba(42, 50, 56, 0.03) inset;
}

.system-status-bar {
    position: fixed;
    inset: 0 0 auto;
    z-index: 1000;
    width: 100%;
    height: calc(var(--status-height) + var(--safe-top));
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    padding: var(--safe-top) max(24px, var(--safe-right)) 7px max(24px, var(--safe-left));
    color: #24282b;
    font-size: 0.75rem;
    font-weight: 650;
    pointer-events: none;
}

.status-icons {
    display: flex;
    align-items: center;
    gap: 7px;
    min-height: 22px;
    font-size: 0.9rem;
    pointer-events: auto;
}

.status-action {
    width: 28px;
    height: 28px;
    display: grid;
    place-items: center;
    margin-right: 2px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.5);
    color: #1e2428;
    font-size: 1rem;
}

.desktop-container {
    display: flex;
    width: 100%;
    height: 100%;
    padding-top: calc(var(--status-height) + var(--safe-top));
    padding-bottom: calc(var(--dock-height) + var(--dock-gap) * 2 + var(--pagination-space) + var(--safe-bottom));
    overflow-x: auto;
    overflow-y: hidden;
    scroll-behavior: auto;
    scroll-snap-type: x mandatory;
    scrollbar-width: none;
    overscroll-behavior-x: contain;
    touch-action: pan-x pan-y;
    cursor: grab;
    -webkit-overflow-scrolling: touch;
}

.desktop-container::-webkit-scrollbar,
.screen::-webkit-scrollbar {
    display: none;
    width: 0;
    height: 0;
}

.desktop-container.is-dragging {
    cursor: grabbing;
    scroll-snap-type: none;
}

.desktop-container.is-dragging * {
    user-select: none;
}

.screen {
    flex: 0 0 100%;
    width: 100%;
    min-width: 0;
    height: 100%;
    display: flex;
    flex-direction: column;
    gap: var(--page-gap);
    padding: 20px max(20px, var(--safe-right)) 20px max(20px, var(--safe-left));
    overflow-x: hidden;
    overflow-y: auto;
    scroll-snap-align: start;
    scroll-snap-stop: always;
    scrollbar-width: none;
    overscroll-behavior-y: contain;
}

.pagination {
    position: fixed;
    z-index: 90;
    left: 50%;
    bottom: calc(var(--dock-height) + var(--dock-gap) + var(--safe-bottom) + 5px);
    display: flex;
    gap: 8px;
    transform: translateX(-50%);
}

.dot {
    width: 18px;
    height: 18px;
    display: grid;
    place-items: center;
    background: transparent;
    border-radius: 50%;
}

.dot::after {
    content: "";
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: rgba(17, 19, 21, 0.18);
    transition: transform 180ms ease, background-color 180ms ease;
}

.dot.active::after {
    background: var(--ink);
    transform: scale(1.2);
}

.dock-container {
    position: fixed;
    z-index: 100;
    left: 50%;
    bottom: calc(var(--dock-gap) + var(--safe-bottom));
    width: min(calc(100% - max(40px, var(--safe-left) + var(--safe-right))), 620px);
    height: var(--dock-height);
    display: flex;
    align-items: center;
    justify-content: space-around;
    padding: 0 12px;
    border-radius: 28px;
    transform: translateX(-50%);
    touch-action: none;
    cursor: grab;
}

.dock-container.is-dragging {
    cursor: grabbing;
}

.dock-container .app-name {
    display: none;
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        scroll-behavior: auto !important;
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

@media (prefers-contrast: more) {
    .glass-3d {
        border: 1px solid rgba(17, 19, 21, 0.38);
        background: rgba(255, 255, 255, 0.76);
    }
}
