/* 设计基底：暖中性底色 + 单一铜金点缀，无外部字体依赖 */

:root {
    --bg: #0e0e0f;
    --bg-soft: #141414;
    --surface: #1a1a1a;
    --surface-2: #212120;
    --surface-3: #2a2a28;
    --line: rgba(255, 255, 255, .07);
    --line-strong: rgba(255, 255, 255, .15);

    --text: #ece9e4;
    --text-dim: #a09a92;
    --text-faint: #6f6a63;

    /* 拾光 —— 铜金色，取自胶片与暖光 */
    --accent: #d9a55c;
    --accent-light: #ecd0a0;
    --accent-deep: #a96f33;
    --accent-soft: rgba(217, 165, 92, .14);
    --accent-line: rgba(217, 165, 92, .48);
    --accent-veil: rgba(217, 165, 92, .08);
    --accent-select: rgba(217, 165, 92, .3);
    --on-accent: #1c1509;

    --ok: #7fb886;
    --warn: #d9a55c;
    --err: #d9635f;

    --r-sm: 6px;
    --r-md: 10px;
    --r-lg: 14px;
    --r-xl: 20px;

    /* 叠在底色上的那一层：深色主题用白色提亮，亮色主题用墨色压暗。
       各处透明度不同，所以这里只给颜色，用的地方自己写 alpha。 */
    --tint-rgb: 255, 255, 255;
    --scrim-rgb: 14, 14, 15;
    --pop: rgba(30, 30, 29, .98);
    --sunken: rgba(0, 0, 0, .3);
    --veil: rgba(0, 0, 0, .75);

    --shadow-toast: 0 14px 40px rgba(0, 0, 0, .6);
    --shadow-pop: 0 18px 50px rgba(0, 0, 0, .6);
    --shadow-sheet: 0 30px 80px rgba(0, 0, 0, .65);
    --shadow-rail: 0 0 50px rgba(0, 0, 0, .6);
    --shadow-composer: 0 -6px 40px rgba(0, 0, 0, .4);

    --header-h: 62px;
    --font: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB",
        "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
}

/* 亮色：纸一样的白底配墨黑字。铜金在白底上发飘、也压不住重量，
   所以原本铺铜金的地方（主按钮、选中态）在这里换成墨黑铺底、白字。 */
[data-theme="light"] {
    --bg: #fbfaf8;
    --bg-soft: #f4f2ee;
    --surface: #ffffff;
    --surface-2: #f4f2ee;
    --surface-3: #e9e6e0;
    --line: rgba(20, 19, 15, .10);
    --line-strong: rgba(20, 19, 15, .22);

    --text: #14130f;
    --text-dim: #57534b;
    --text-faint: #8b867c;

    --accent: #14130f;
    --accent-light: #3d3931;
    --accent-deep: #000000;
    --accent-soft: rgba(20, 19, 15, .06);
    --accent-line: rgba(20, 19, 15, .30);
    --accent-veil: rgba(20, 19, 15, .05);
    --accent-select: rgba(20, 19, 15, .16);
    --on-accent: #ffffff;

    --ok: #2f7d43;
    --warn: #9a6a12;
    --err: #b93a36;

    --tint-rgb: 20, 19, 15;
    --scrim-rgb: 251, 250, 248;
    --pop: rgba(255, 255, 255, .99);
    --sunken: rgba(20, 19, 15, .04);
    --veil: rgba(20, 19, 15, .42);

    /* 白底上的投影要轻，照搬深色那套会糊成一团脏灰 */
    --shadow-toast: 0 14px 40px rgba(20, 19, 15, .14);
    --shadow-pop: 0 16px 44px rgba(20, 19, 15, .15);
    --shadow-sheet: 0 30px 70px rgba(20, 19, 15, .18);
    --shadow-rail: 0 0 40px rgba(20, 19, 15, .07);
    --shadow-composer: 0 -6px 40px rgba(20, 19, 15, .07);

    color-scheme: light;
}

* {
    box-sizing: border-box;
}

/* 切换配色时，让新的那一帧盖在旧的上面展开；两帧都不要默认的淡入淡出，
   否则中间会透出一层灰。根元素的动画交给脚本逐帧控制。 */
::view-transition-old(root),
::view-transition-new(root) {
    animation: none;
    mix-blend-mode: normal;
}

::view-transition-old(root) {
    z-index: 0;
}

::view-transition-new(root) {
    z-index: 1;
}

html,
body {
    margin: 0;
    padding: 0;
}

body {
    background: var(--bg);
    color: var(--text);
    font-family: var(--font);
    font-size: 14px;
    line-height: 1.65;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

a {
    color: inherit;
    text-decoration: none;
}

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

button {
    cursor: pointer;
    background: none;
    border: none;
    padding: 0;
}

img,
video {
    display: block;
    max-width: 100%;
}

::selection {
    background: var(--accent-select);
}

::-webkit-scrollbar {
    width: 9px;
    height: 9px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: rgba(var(--tint-rgb), .1);
    border-radius: 5px;
    border: 2px solid transparent;
    background-clip: padding-box;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(var(--tint-rgb), .2);
    background-clip: padding-box;
}

.icon {
    width: 18px;
    height: 18px;
    flex: none;
    stroke: currentColor;
    fill: none;
    stroke-width: 1.6;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.icon-sm {
    width: 15px;
    height: 15px;
}

.icon-lg {
    width: 22px;
    height: 22px;
}

/* ---------- 持续流动的渐变文字 ---------- */

.grad-flow {
    background-image: linear-gradient(100deg,
            #ecd0a0 0%, #fff4e0 12%, #d9a55c 26%, #a96f33 38%,
            #e0b070 52%, #fff4e0 64%, #d9a55c 78%, #a96f33 90%, #ecd0a0 100%);
    background-size: 300% 100%;
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    animation: grad-flow 9s linear infinite;
}

/* 切换按钮上的图标表示"现在是什么"：深色显示月亮，浅色显示太阳。
   两个图标叠在同一个格子里，切换的只是显示哪一个，按钮尺寸不会跳。 */
.brand-mark .ico-sun {
    display: none;
}

[data-theme="light"] .brand-mark .ico-moon {
    display: none;
}

[data-theme="light"] .brand-mark .ico-sun {
    display: block;
}

/* 白底上那套暖金整个浮不起来，换成墨色流动，保留一样的呼吸感 */
[data-theme="light"] .grad-flow {
    background-image: linear-gradient(100deg,
            #14130f 0%, #857c6d 12%, #14130f 26%, #000000 38%,
            #4c4740 52%, #9a917f 64%, #14130f 78%, #000000 90%, #14130f 100%);
}

@keyframes grad-flow {
    from {
        background-position: 0% 50%;
    }

    to {
        background-position: 300% 50%;
    }
}

/* ---------- 通用按钮 ---------- */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    height: 40px;
    padding: 0 20px;
    border-radius: var(--r-sm);
    font-size: 14px;
    font-weight: 600;
    white-space: nowrap;
    transition: transform .12s ease, background .2s ease, border-color .2s ease, color .2s ease, opacity .2s ease;
}

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

.btn:disabled {
    opacity: .4;
    cursor: not-allowed;
}

.btn-primary {
    background: var(--accent);
    color: var(--on-accent);
}

.btn-primary:hover:not(:disabled) {
    background: var(--accent-light);
}

.btn-ghost {
    background: transparent;
    border: 1px solid var(--line-strong);
    color: var(--text);
}

.btn-ghost:hover:not(:disabled) {
    background: rgba(var(--tint-rgb), .06);
    border-color: rgba(var(--tint-rgb), .28);
}

.btn-sm {
    height: 32px;
    padding: 0 14px;
    font-size: 13px;
}

/* ---------- 全局提示 ---------- */

#toasts {
    position: fixed;
    top: 18px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 999;
    display: flex;
    flex-direction: column;
    gap: 8px;
    align-items: center;
    pointer-events: none;
}

.toast {
    display: flex;
    align-items: center;
    gap: 9px;
    max-width: min(90vw, 520px);
    padding: 10px 18px;
    border-radius: var(--r-sm);
    background: #232322;
    border: 1px solid var(--line-strong);
    box-shadow: var(--shadow-toast);
    font-size: 13px;
    animation: toast-in .2s ease;
}

.toast.err {
    border-left: 3px solid var(--err);
    color: #f3cfcd;
}

.toast.ok {
    border-left: 3px solid var(--ok);
    color: #d3e8d5;
}

/* 提示条自己是深色块，亮色下要整块翻过来 */
[data-theme="light"] .toast {
    background: #ffffff;
    color: var(--text);
}

[data-theme="light"] .toast.err {
    color: #8c2b28;
}

[data-theme="light"] .toast.ok {
    color: #245c31;
}

@keyframes toast-in {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
}

/* ---------- 滚动进场 ---------- */

.reveal {
    opacity: 0;
    transform: translateY(22px);
    transition: opacity .7s cubic-bezier(.2, .7, .3, 1), transform .7s cubic-bezier(.2, .7, .3, 1);
}

.reveal.in {
    opacity: 1;
    transform: none;
}

@media (prefers-reduced-motion: reduce) {

    .reveal,
    .reveal.in {
        opacity: 1;
        transform: none;
        transition: none;
    }

    .grad-flow {
        animation: none;
    }
}
