/* =========================================================
   基础设计系统 · 拟态毛玻璃（Neumorphism × Glassmorphism）
   ========================================================= */

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

:root {
    /* 色板 */
    --ink:        #1b2237;
    --ink-2:      #37405c;
    --ink-3:      #5b6484;
    --muted:      #7c85a2;
    --line:       rgba(255, 255, 255, .75);
    --line-soft:  rgba(140, 156, 190, .18);

    --brand:      #5b6bff;
    --brand-2:    #8b5cf6;
    --brand-soft: rgba(91, 107, 255, .12);
    --mint:       #10b9a3;
    --sky:        #2ea8f0;
    --amber:      #f0a03a;
    --rose:       #ef5570;

    --glass:      rgba(255, 255, 255, .55);
    --glass-2:    rgba(255, 255, 255, .74);
    --glass-3:    rgba(255, 255, 255, .38);

    /* 阴影 */
    --shadow-lg:  0 26px 60px rgba(64, 82, 128, .14), 0 4px 12px rgba(64, 82, 128, .05);
    --shadow-sm:  0 12px 26px rgba(64, 82, 128, .10);
    --shadow-xs:  0 6px 14px rgba(64, 82, 128, .08);
    --neu:        8px 8px 20px rgba(158, 173, 199, .45), -8px -8px 20px rgba(255, 255, 255, .95);
    --neu-sm:     5px 5px 12px rgba(158, 173, 199, .40), -5px -5px 12px rgba(255, 255, 255, .92);
    --neu-in:     inset 4px 4px 10px rgba(158, 173, 199, .42), inset -4px -4px 10px rgba(255, 255, 255, .95);
    --neu-in-sm:  inset 2px 2px 6px rgba(158, 173, 199, .40), inset -2px -2px 6px rgba(255, 255, 255, .95);

    /* 圆角与字体 */
    --r-xl: 30px;
    --r-lg: 24px;
    --r-md: 17px;
    --r-sm: 12px;

    --font: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
            "Hiragino Sans GB", "Microsoft YaHei", "Source Han Sans SC", sans-serif;
    --mono: "SFMono-Regular", "JetBrains Mono", Consolas, "Liberation Mono", monospace;
}

html { -webkit-text-size-adjust: 100%; }

body {
    margin: 0;
    min-height: 100vh;
    font-family: var(--font);
    font-size: 15px;
    line-height: 1.65;
    color: var(--ink);
    background:
        radial-gradient(1100px 620px at 8% -12%, #dfe6ff 0%, rgba(223, 230, 255, 0) 62%),
        radial-gradient(900px 540px at 96% 4%, #ece0ff 0%, rgba(236, 224, 255, 0) 58%),
        radial-gradient(1000px 720px at 60% 112%, #d8f4ef 0%, rgba(216, 244, 239, 0) 60%),
        #eef1f8;
    background-attachment: fixed;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

h1, h2, h3, h4 { margin: 0; font-weight: 700; letter-spacing: -.01em; color: var(--ink); }
p { margin: 0; }
a { color: inherit; text-decoration: none; }
img, svg { display: block; }
button { font-family: inherit; }
[hidden] { display: none !important; }
::selection { background: rgba(91, 107, 255, .2); }

/* 背景光斑 */
.aurora {
    position: fixed;
    inset: 0;
    z-index: 0;
    overflow: hidden;
    pointer-events: none;
}
.aurora span {
    position: absolute;
    border-radius: 50%;
    filter: blur(72px);
    opacity: .6;
    animation: drift 22s ease-in-out infinite;
}
.aurora span:nth-child(1) { width: 460px; height: 460px; top: -150px; left: -110px; background: #b9c8ff; }
.aurora span:nth-child(2) { width: 380px; height: 380px; top: 8%; right: -120px; background: #dcc7ff; animation-delay: -6s; }
.aurora span:nth-child(3) { width: 420px; height: 420px; bottom: -170px; left: 32%; background: #b6ecdf; animation-delay: -11s; }
.aurora span:nth-child(4) { width: 260px; height: 260px; top: 48%; left: 6%; background: #ffd9e6; opacity: .42; animation-delay: -15s; }

@keyframes drift {
    0%, 100% { transform: translate3d(0, 0, 0) scale(1); }
    50%      { transform: translate3d(26px, 34px, 0) scale(1.07); }
}

/* 玻璃面板 */
.glass {
    position: relative;
    background: linear-gradient(150deg, rgba(255, 255, 255, .80) 0%, rgba(255, 255, 255, .44) 100%);
    border: 1px solid var(--line);
    border-radius: var(--r-lg);
    box-shadow: var(--shadow-lg), inset 0 1px 0 rgba(255, 255, 255, .9);
    -webkit-backdrop-filter: blur(22px) saturate(180%);
    backdrop-filter: blur(22px) saturate(180%);
}
.glass-soft {
    background: linear-gradient(150deg, rgba(255, 255, 255, .58), rgba(255, 255, 255, .30));
    border: 1px solid rgba(255, 255, 255, .62);
    border-radius: var(--r-md);
    -webkit-backdrop-filter: blur(16px) saturate(160%);
    backdrop-filter: blur(16px) saturate(160%);
    box-shadow: var(--shadow-xs), inset 0 1px 0 rgba(255, 255, 255, .8);
}

/* 按钮 */
.btn {
    --btn-bg: transparent;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 11px 20px;
    border: 0;
    border-radius: 15px;
    font-size: 14px;
    font-weight: 600;
    line-height: 1.2;
    color: var(--ink-2);
    background: var(--btn-bg);
    cursor: pointer;
    white-space: nowrap;
    transition: transform .22s cubic-bezier(.34, 1.4, .64, 1), box-shadow .24s ease, background .24s ease, color .2s;
}
.btn svg { flex: none; }
.btn:active { transform: translateY(1px) scale(.995); }
.btn:focus-visible { outline: 2px solid rgba(91, 107, 255, .55); outline-offset: 3px; }

.btn-primary {
    color: #fff;
    background: linear-gradient(135deg, #6b7bff 0%, #8b5cf6 100%);
    box-shadow: 0 14px 26px rgba(94, 108, 255, .34), inset 0 1px 0 rgba(255, 255, 255, .35);
}
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 18px 34px rgba(94, 108, 255, .42), inset 0 1px 0 rgba(255, 255, 255, .4); }

.btn-neu {
    background: linear-gradient(145deg, #f7f9fe, #e5eaf5);
    box-shadow: var(--neu-sm), inset 0 1px 0 rgba(255, 255, 255, .85);
}
.btn-neu:hover { transform: translateY(-1px); box-shadow: var(--neu); }
.btn-neu:active { box-shadow: var(--neu-in-sm); }

.btn-ghost {
    background: rgba(255, 255, 255, .42);
    border: 1px solid rgba(255, 255, 255, .7);
    box-shadow: var(--shadow-xs);
}
.btn-ghost:hover { background: rgba(255, 255, 255, .68); }

.btn-danger {
    color: #fff;
    background: linear-gradient(135deg, #f2687f, #e0425f);
    box-shadow: 0 12px 24px rgba(230, 72, 100, .30);
}
.btn-danger:hover { transform: translateY(-2px); }

.btn-sm { padding: 8px 14px; font-size: 13px; border-radius: 12px; }
.btn-block { width: 100%; }
.btn[disabled] { opacity: .55; cursor: not-allowed; transform: none !important; }

.icon-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 42px;
    height: 42px;
    padding: 0;
    border: 1px solid rgba(255, 255, 255, .7);
    border-radius: 14px;
    color: var(--ink-3);
    background: linear-gradient(145deg, #f8fafe, #e8edf7);
    box-shadow: var(--neu-sm);
    cursor: pointer;
    transition: all .22s ease;
}
.icon-btn:hover { color: var(--brand); transform: translateY(-2px); box-shadow: var(--neu); }
.icon-btn:active { box-shadow: var(--neu-in-sm); }

/* 表单 */
.field { display: flex; flex-direction: column; gap: 8px; }
.field > label,
.field-label {
    font-size: 13px;
    font-weight: 600;
    color: var(--ink-2);
    letter-spacing: .01em;
}
.field .hint { font-size: 12px; color: var(--muted); line-height: 1.5; }

.input, .select, .textarea {
    width: 100%;
    padding: 12px 15px;
    font-family: inherit;
    font-size: 14px;
    color: var(--ink);
    background: rgba(245, 248, 253, .92);
    border: 1px solid rgba(255, 255, 255, .9);
    border-radius: 13px;
    box-shadow: var(--neu-in-sm);
    transition: box-shadow .2s ease, border-color .2s ease;
    outline: none;
}
.input::placeholder, .textarea::placeholder { color: #a3abc4; }
.input:focus, .select:focus, .textarea:focus {
    border-color: rgba(91, 107, 255, .45);
    box-shadow: var(--neu-in-sm), 0 0 0 4px rgba(91, 107, 255, .13);
}
.textarea { min-height: 92px; resize: vertical; line-height: 1.6; }
.select {
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%237c85a2' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9.5 6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
    padding-right: 40px;
}

/* 徽标 / 标签 */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 11.5px;
    font-weight: 700;
    letter-spacing: .02em;
    line-height: 1.5;
}
.badge-brand { color: #4b56d8; background: rgba(91, 107, 255, .13); }
.badge-mint  { color: #0a8a79; background: rgba(16, 185, 163, .14); }
.badge-amber { color: #a86a10; background: rgba(240, 160, 58, .17); }
.badge-rose  { color: #c32d4a; background: rgba(239, 85, 112, .14); }
.badge-gray  { color: #6b7391; background: rgba(140, 156, 190, .16); }

.dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--mint);
    box-shadow: 0 0 0 3px rgba(16, 185, 163, .18);
}
.dot.off { background: #b6bdd1; box-shadow: 0 0 0 3px rgba(182, 189, 209, .2); }

/* 信号格 */
.signal { display: inline-flex; align-items: flex-end; gap: 3px; height: 15px; }
.signal i {
    width: 4px;
    border-radius: 3px;
    background: rgba(140, 156, 190, .35);
    transition: background .3s ease;
}
.signal i:nth-child(1) { height: 5px; }
.signal i:nth-child(2) { height: 8px; }
.signal i:nth-child(3) { height: 11px; }
.signal i:nth-child(4) { height: 15px; }
.signal[data-level="1"] i:nth-child(-n+1) { background: var(--rose); }
.signal[data-level="2"] i:nth-child(-n+2) { background: var(--amber); }
.signal[data-level="3"] i:nth-child(-n+3) { background: #46b98a; }
.signal[data-level="4"] i { background: var(--mint); }

/* 开关 */
.switch {
    position: relative;
    display: inline-flex;
    align-items: center;
    width: 52px;
    height: 30px;
    flex: none;
    cursor: pointer;
}
.switch input { position: absolute; opacity: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.switch span {
    position: relative;
    width: 100%;
    height: 100%;
    border-radius: 999px;
    background: #dfe4f0;
    box-shadow: var(--neu-in-sm);
    transition: background .26s ease;
}
.switch span::after {
    content: "";
    position: absolute;
    top: 4px;
    left: 4px;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 3px 8px rgba(64, 82, 128, .24);
    transition: transform .26s cubic-bezier(.34, 1.4, .64, 1);
}
.switch input:checked + span { background: linear-gradient(135deg, #6b7bff, #8b5cf6); }
.switch input:checked + span::after { transform: translateX(22px); }
.switch input:focus-visible + span { outline: 2px solid rgba(91, 107, 255, .5); outline-offset: 3px; }

/* 通用小工具 */
.row { display: flex; align-items: center; gap: 12px; }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.wrap { flex-wrap: wrap; }
.grow { flex: 1 1 auto; min-width: 0; }
.muted { color: var(--muted); }
.tiny { font-size: 12px; }
.mono { font-family: var(--mono); font-size: 12.5px; letter-spacing: -.01em; }
.divider { height: 1px; background: linear-gradient(90deg, transparent, rgba(140, 156, 190, .28), transparent); }
.sr-only {
    position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
    overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* 滚动条 */
* { scrollbar-width: thin; scrollbar-color: rgba(140, 156, 190, .45) transparent; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: rgba(140, 156, 190, .38); border-radius: 99px; border: 3px solid transparent; background-clip: content-box; }
::-webkit-scrollbar-thumb:hover { background: rgba(120, 136, 172, .55); background-clip: content-box; }

/* 入场动画 */
@keyframes rise {
    from { opacity: 0; transform: translateY(14px); }
    to { opacity: 1; transform: translateY(0); }
}
.rise { animation: rise .55s cubic-bezier(.22, .9, .28, 1) both; }

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation-duration: .001ms !important; transition-duration: .001ms !important; }
}
