:root {
    --text: #202020;
    --text-h: #08060d;
    --bg: #fff;
    --border: #e5e4e7;
    --code-bg: #f4f3ec;
    --accent: #aa3bff;
    --accent-bg: rgba(170, 59, 255, 0.1);
    --accent-border: rgba(170, 59, 255, 0.5);
    --social-bg: rgba(244, 243, 236, 0.5);
    --shadow: rgba(0, 0, 0, 0.1) 0 10px 15px -3px, rgba(0, 0, 0, 0.05) 0 4px 6px -2px;

    --sans: system-ui, 'Segoe UI', Roboto, sans-serif;
    --heading: system-ui, 'Segoe UI', Roboto, sans-serif;
    --mono: ui-monospace, Consolas, monospace;
    --el-color-primary: #8e4bd9 !important;

    font: 18px/145% var(--sans);
    letter-spacing: 0.18px;
    color-scheme: light dark;
    color: var(--text);
    background: var(--bg);
    font-synthesis: none;
    text-rendering: optimizeLegibility;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;

    @media (max-width: 1024px) {
        font-size: 16px;
    }
}
* {
    margin: 0;
    padding: 0;
}

h1,
h2 {
    font-family: var(--heading);
    font-weight: 500;
    color: var(--text-h);
}

h1 {
    font-size: 56px;
    letter-spacing: -1.68px;
    margin: 32px 0;
    @media (max-width: 1024px) {
        font-size: 36px;
        margin: 20px 0;
    }
}
h2 {
    font-size: 24px;
    line-height: 118%;
    letter-spacing: -0.24px;
    margin: 0 0 8px;
    @media (max-width: 1024px) {
        font-size: 20px;
    }
}

@font-face {
    font-family: 'alimama';
    font-weight: 700;
    src:
        url('/font/alimama.woff2') format('woff2'),
        url('/font/alimama.woff') format('woff');
    font-variation-settings: normal;
    font-display: swap;
}

@font-face {
    font-family: 'fangyuan';
    src: url('/font/fangyuan.ttf') format('truetype');
    font-weight: 700;
}

.alimama {
    font-family: 'alimama';
    font-variation-settings: normal; /* Chrome 140 以下版本需要 */
}

img {
    -webkit-user-drag: none;
    pointer-events: none; /* 如果图片不需要点击 */
}

#app_loading {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.5);
    backdrop-filter: blur(10px);
    display: flex;
    justify-content: center;
    align-items: center;
    flex-direction: column;
    z-index: 99999;
    gap: 20px;
}

/* From Uiverse.io by SelfMadeSystem */
/* Inspired by: m3.material.io/components/progress-indicators/overview */

.loader {
    width: 48px;
    /* Subpixels get cut off */
    overflow: visible;
    transform: rotate(-90deg);
    transform-origin: center;

    --active: #7627a3;
    --track: #f2d4fe;

    --duration: 8s;

    animation: spin 2s linear infinite;
}

@keyframes spin {
    0% {
        rotate: 0deg;
    }

    100% {
        rotate: 360deg;
    }
}

.active {
    stroke: var(--active);
    stroke-linecap: round;
    stroke-dashoffset: 360;
    animation: active-animation var(--duration) ease-in-out infinite;
}

@keyframes active-animation {
    0% {
        stroke-dasharray: 0 0 0 360 0 360;
    }
    12.5% {
        stroke-dasharray: 0 0 270 90 270 90;
    }
    25% {
        stroke-dasharray: 0 270 0 360 0 360;
    }
    37.5% {
        stroke-dasharray: 0 270 270 90 270 90;
    }
    50% {
        stroke-dasharray: 0 540 0 360 0 360;
    }
    50.001% {
        stroke-dasharray: 0 180 0 360 0 360;
    }
    62.5% {
        stroke-dasharray: 0 180 270 90 270 90;
    }
    75% {
        stroke-dasharray: 0 450 0 360 0 360;
    }
    87.5% {
        stroke-dasharray: 0 450 270 90 270 90;
    }
    87.501% {
        stroke-dasharray: 0 90 270 90 270 90;
    }
    100% {
        stroke-dasharray: 0 360 1 360 0 360;
    }
}

.track {
    stroke: var(--track);
    stroke-linecap: round;
    stroke-dashoffset: 360;
    animation: track-animation var(--duration) ease-in-out infinite;
}

@keyframes track-animation {
    0% {
        stroke-dasharray: 0 20 320 40 320 40;
    }
    12.5% {
        stroke-dasharray: 0 290 50 310 50 310;
    }
    25% {
        stroke-dasharray: 0 290 320 40 320 40;
    }
    37.5% {
        stroke-dasharray: 0 560 50 310 50 310;
    }
    37.501% {
        stroke-dasharray: 0 200 50 310 50 310;
    }
    50% {
        stroke-dasharray: 0 200 320 40 320 40;
    }
    62.5% {
        stroke-dasharray: 0 470 50 310 50 310;
    }
    62.501% {
        stroke-dasharray: 0 110 50 310 50 310;
    }
    75% {
        stroke-dasharray: 0 110 320 40 320 40;
    }
    87.5% {
        stroke-dasharray: 0 380 50 310 50 310;
    }
    100% {
        stroke-dasharray: 0 380 320 40 320 40;
    }
}

html,
body {
    margin: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
}

body {
    position: fixed;
    inset: 0;
    width: 100vw;
    height: 100vh;
    height: 100dvh;
    overscroll-behavior: none;
    touch-action: none;
    -webkit-user-select: none;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}

#screen {
    position: fixed;
    inset: 0;
    width: 100vw;
    height: 100vh;
    height: 100dvh;
    overflow: hidden;
}

/* 与 autofit 一致：自左上角缩放铺满 #screen，内部为统一逻辑坐标系 */
#autofit-stage {
    position: absolute;
    left: 0;
    top: 0;
    box-sizing: border-box;
    /* 避免大屏 :root 18px 与移动端 16px 混用导致块级比例不一致 */
    font-size: 16px;
}

/* 让 loading 和 app 都铺满容器 */
#app,
#app_loading {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
}

/* loading 居中 */
#app_loading {
    z-index: 9999;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
}

/* 手机竖屏：页面内容整体横过来 */
@media (max-width: 768px) and (orientation: portrait) {
    #screen {
        left: 100vw;
        top: 0;
        width: 100dvh;
        height: 100vw;
        transform: rotate(90deg);
        transform-origin: 0 0;
    }
}

/* 手机横屏：正常显示 */
@media (max-width: 768px) and (orientation: landscape) {
    #screen {
        left: 0;
        top: 0;
        width: 100vw;
        height: 100dvh;
        transform: none;
    }
}
