/* ------------------------------------------------------------------
   基础层：设计变量、重置样式、按钮、表单控件、提示条
   仅使用系统字体与系统配色，深浅色随系统自动切换
   ------------------------------------------------------------------ */

:root {
    color-scheme: light dark;

    --bg: #fbfbfd;
    --surface: #ffffff;
    --surface-2: #f5f5f7;
    --module-bg: #f5f5f7;
    --text: #1d1d1f;
    --text-2: #6e6e73;
    --text-3: #86868b;
    --border: rgba(0, 0, 0, 0.08);
    --border-strong: rgba(0, 0, 0, 0.14);
    --accent: #0071e3;
    --accent-hover: #0077ed;
    --accent-soft: rgba(0, 113, 227, 0.12);
    --danger: #d70015;
    --warn: #a15400;
    --ok: #1c7d3f;
    --header-bg: rgba(251, 251, 253, 0.72);

    --radius-lg: 20px;
    --radius: 14px;
    --radius-sm: 10px;

    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.04), 0 6px 20px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 2px 6px rgba(0, 0, 0, 0.05), 0 18px 44px rgba(0, 0, 0, 0.10);
    --shadow-lg: 0 30px 80px rgba(0, 0, 0, 0.22);

    --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Helvetica Neue", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
    --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
}

@media (prefers-color-scheme: dark) {
    :root {
        --bg: #000000;
        --surface: #1c1c1e;
        --surface-2: #2c2c2e;
        --module-bg: #131315;
        --text: #f5f5f7;
        --text-2: #a1a1a6;
        --text-3: #8e8e93;
        --border: rgba(255, 255, 255, 0.10);
        --border-strong: rgba(255, 255, 255, 0.20);
        --accent: #0a84ff;
        --accent-hover: #2b95ff;
        --accent-soft: rgba(10, 132, 255, 0.18);
        --danger: #ff6961;
        --warn: #ffb340;
        --ok: #5ddc7a;
        --header-bg: rgba(0, 0, 0, 0.68);
        --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.5);
        --shadow-md: 0 18px 44px rgba(0, 0, 0, 0.6);
        --shadow-lg: 0 30px 80px rgba(0, 0, 0, 0.8);
    }
}

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

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

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: var(--font);
    font-size: 16px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

h1, h2, h3, h4, p { margin: 0; }
ul, ol { margin: 0; padding: 0; list-style: none; }
img { display: block; max-width: 100%; }
a { color: inherit; }
button, input, select, textarea { font-family: inherit; font-size: inherit; color: inherit; }

.container {
    width: 100%;
    max-width: 1080px;
    margin: 0 auto;
    padding: 0 24px;
}

.icon { flex: none; }

.dot {
    display: inline-block;
    width: 3px;
    height: 3px;
    border-radius: 50%;
    background: currentColor;
    opacity: 0.55;
    vertical-align: middle;
}

.badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 999px;
    background: var(--surface-2);
    color: var(--text-2);
    font-size: 11px;
    font-weight: 500;
    line-height: 1.6;
    white-space: nowrap;
}

/* ------------------------------------------------------------------ 按钮 */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    height: 38px;
    padding: 0 18px;
    border: 1px solid transparent;
    border-radius: 980px;
    background: transparent;
    color: var(--text);
    font-size: 14px;
    font-weight: 500;
    text-decoration: none;
    white-space: nowrap;
    cursor: pointer;
    transition: background 0.18s ease, border-color 0.18s ease, color 0.18s ease, opacity 0.18s ease, transform 0.18s ease;
}

.btn:active { transform: scale(0.975); }
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-hover); }
.btn-ghost { border-color: var(--border-strong); color: var(--text); }
.btn-ghost:hover { background: var(--surface-2); }
.btn-danger { border-color: rgba(215, 0, 21, 0.3); color: var(--danger); }
.btn-danger:hover { background: rgba(215, 0, 21, 0.08); }
.btn-small { height: 32px; padding: 0 14px; font-size: 13px; }
.btn-block { width: 100%; }

.icon-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border: 1px solid transparent;
    border-radius: 9px;
    background: transparent;
    color: var(--text-3);
    text-decoration: none;
    cursor: pointer;
    transition: background 0.18s ease, color 0.18s ease;
}

.icon-btn:hover { background: var(--surface-2); color: var(--text); }
.icon-btn-danger:hover { background: rgba(215, 0, 21, 0.1); color: var(--danger); }

.link-btn {
    padding: 0;
    border: 0;
    background: none;
    color: var(--text-2);
    font-size: 13px;
    cursor: pointer;
    transition: color 0.18s ease;
}

.link-btn:hover { color: var(--text); }

/* -------------------------------------------------------------- 表单控件 */

.field { display: block; margin-bottom: 18px; }

.field-label {
    display: block;
    margin-bottom: 8px;
    font-size: 13px;
    font-weight: 500;
}

.field-optional {
    margin-left: 6px;
    color: var(--text-3);
    font-size: 11px;
    font-weight: 400;
}

.field-hint {
    display: block;
    margin-top: 7px;
    color: var(--text-3);
    font-size: 12px;
    line-height: 1.5;
}

.field-hint a { color: var(--accent); text-decoration: none; }
.field-hint a:hover { text-decoration: underline; }

.input {
    width: 100%;
    height: 42px;
    padding: 0 14px;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm);
    background: var(--surface);
    color: var(--text);
    font-size: 15px;
    transition: border-color 0.18s ease, box-shadow 0.18s ease;
}

.input::placeholder { color: var(--text-3); }

.input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 4px var(--accent-soft);
}

.textarea {
    height: auto;
    padding: 11px 14px;
    line-height: 1.6;
    resize: vertical;
}

.select {
    appearance: none;
    -webkit-appearance: none;
    padding-right: 38px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2386868b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 16px 16px;
}

/* 苹果风格的开关 */
.switch {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 18px;
    cursor: pointer;
}

.switch input {
    position: absolute;
    width: 1px;
    height: 1px;
    opacity: 0;
    pointer-events: none;
}

.switch-track {
    position: relative;
    flex: none;
    width: 46px;
    height: 28px;
    margin-top: 1px;
    border-radius: 999px;
    background: rgba(120, 120, 128, 0.24);
    transition: background 0.25s ease;
}

.switch input:checked + .switch-track { background: #34c759; }
.switch input:focus-visible + .switch-track { box-shadow: 0 0 0 4px var(--accent-soft); }

.switch-thumb {
    position: absolute;
    top: 2px;
    left: 2px;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25);
    transition: transform 0.25s cubic-bezier(0.3, 0.8, 0.3, 1);
}

.switch input:checked + .switch-track .switch-thumb { transform: translateX(18px); }

.switch-text {
    font-size: 14px;
    line-height: 1.4;
}

.switch-text .field-hint { margin-top: 4px; }

/* ------------------------------------------------------------------ 提示条 */

.alert {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    margin-bottom: 16px;
    padding: 13px 16px;
    border: 1px solid transparent;
    border-radius: var(--radius);
    font-size: 14px;
    line-height: 1.55;
}

.alert .icon { margin-top: 2px; }
.alert a { color: inherit; text-decoration: underline; text-underline-offset: 2px; }
.alert-success { border-color: rgba(52, 199, 89, 0.28); background: rgba(52, 199, 89, 0.10); color: var(--ok); }
.alert-error { border-color: rgba(215, 0, 21, 0.24); background: rgba(215, 0, 21, 0.08); color: var(--danger); }
.alert-warn { border-color: rgba(255, 159, 10, 0.30); background: rgba(255, 159, 10, 0.12); color: var(--warn); }

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