:root {
    --primary: #6366f1;
    --primary-solid: #6366f1;
    --primary-light: #818cf8;
    --danger: #ef4444;
    --success: #22c55e;
    --warning: #f59e0b;

    --bg-base: #f8fafc;
    --bg-card: rgba(255, 255, 255, 0.75);
    --bg-sidebar: rgba(255, 255, 255, 0.85);
    --bg-hover: rgba(99, 102, 241, 0.08);
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --text-muted: #94a3b8;
    --border-light: rgba(148, 163, 184, 0.25);
    --border-color: rgba(148, 163, 184, 0.35);
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.1);
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --backdrop: blur(20px) saturate(180%);
    --qr-box-bg: #e0e7ff;
    --qr-box-border: #6366f1;
    --qr-close-hover-bg: var(--primary);
    --qr-close-hover-color: #fff;
}

[data-theme="dark"] {
    --bg-base: #0f172a;
    --bg-card: rgba(30, 41, 59, 0.7);
    --bg-sidebar: rgba(15, 23, 42, 0.85);
    --bg-hover: rgba(99, 102, 241, 0.15);
    --text-primary: #f1f5f9;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    --border-light: rgba(148, 163, 184, 0.15);
    --border-color: rgba(148, 163, 184, 0.25);
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.4), 0 2px 4px -2px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.5), 0 4px 6px -4px rgba(0, 0, 0, 0.4);
    --qr-box-bg: #312e81;
    --qr-box-border: #818cf8;
    --qr-close-hover-bg: #c0c0c0;
    --qr-close-hover-color: #17263d;
}

[data-theme="pink"] {
    --primary: #ec4899;
    --primary-solid: #ec4899;
    --primary-light: #f472b6;
    --bg-base: #fff1f5;
    --bg-card: rgba(255, 255, 255, 0.75);
    --bg-sidebar: rgba(255, 255, 255, 0.85);
    --bg-hover: rgba(236, 72, 153, 0.08);
    --text-primary: #831843;
    --text-secondary: #be185d;
    --text-muted: #f472b6;
    --border-light: rgba(244, 114, 182, 0.25);
    --border-color: rgba(244, 114, 182, 0.35);
    --shadow-sm: 0 1px 2px rgba(236, 72, 153, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(236, 72, 153, 0.1), 0 2px 4px -2px rgba(236, 72, 153, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(236, 72, 153, 0.1), 0 4px 6px -4px rgba(236, 72, 153, 0.1);
    --qr-box-bg: #fce7f3;
    --qr-box-border: #f472b6;
    --qr-close-hover-bg: var(--primary);
    --qr-close-hover-color: #fff;
}

[data-theme="fresh"] {
    --primary: #10b981;
    --primary-solid: #10b981;
    --primary-light: #34d399;
    --bg-base: #f0fdf4;
    --bg-card: rgba(255, 255, 255, 0.75);
    --bg-sidebar: rgba(255, 255, 255, 0.85);
    --bg-hover: rgba(16, 185, 129, 0.08);
    --text-primary: #064e3b;
    --text-secondary: #047857;
    --text-muted: #34d399;
    --border-light: rgba(52, 211, 153, 0.25);
    --border-color: rgba(52, 211, 153, 0.35);
    --shadow-sm: 0 1px 2px rgba(16, 185, 129, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(16, 185, 129, 0.1), 0 2px 4px -2px rgba(16, 185, 129, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(16, 185, 129, 0.1), 0 4px 6px -4px rgba(16, 185, 129, 0.1);
    --qr-box-bg: #d1fae5;
    --qr-box-border: #10b981;
    --qr-close-hover-bg: var(--primary);
    --qr-close-hover-color: #fff;
}

* {
    box-sizing: border-box;
}

html, body {
    margin: 0;
    padding: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif;
    background-color: var(--bg-base);
    color: var(--text-primary);
    min-height: 100vh;
    transition: background-color 0.3s ease, color 0.3s ease;
}

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

button {
    font-family: inherit;
    cursor: pointer;
    border: none;
    outline: none;
}

input, textarea, select {
    font-family: inherit;
    outline: none;
}

.icon {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

.background-layer {
    position: fixed;
    inset: 0;
    z-index: -1;
    pointer-events: none;
    overflow: hidden;
}

.background-layer::before,
.background-layer::after {
    content: '';
    position: absolute;
    border-radius: 50%;
    filter: blur(80px);
    opacity: 0.45;
    animation: float 20s ease-in-out infinite;
}

.background-layer::before {
    width: 600px;
    height: 600px;
    background: radial-gradient(circle, var(--primary-light), transparent 70%);
    top: -200px;
    right: -150px;
}

.background-layer::after {
    width: 500px;
    height: 500px;
    background: radial-gradient(circle, #a78bfa, transparent 70%);
    bottom: -150px;
    left: -100px;
    animation-delay: -10s;
}

@keyframes float {
    0%, 100% { transform: translate(0, 0) scale(1); }
    50% { transform: translate(30px, 40px) scale(1.05); }
}

.btn-primary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px 18px;
    border-radius: var(--radius-md);
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    color: #fff;
    font-size: 14px;
    font-weight: 500;
    box-shadow: var(--shadow-sm);
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.btn-ghost {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px 18px;
    border-radius: var(--radius-md);
    background: var(--bg-card);
    color: var(--text-primary);
    border: 1px solid var(--border-light);
    font-size: 14px;
    font-weight: 500;
    backdrop-filter: var(--backdrop);
    transition: background-color 0.15s ease;
}

.btn-ghost:hover {
    background: var(--bg-hover);
}

.btn-danger {
    background: rgba(239, 68, 68, 0.1);
    color: var(--danger);
    border: 1px solid rgba(239, 68, 68, 0.2);
}

.loading-overlay {
    position: fixed;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 16px;
    background: var(--bg-base);
    z-index: 9999;
    transition: opacity 0.3s ease;
}

.loading-overlay.hidden {
    opacity: 0;
    pointer-events: none;
}

/* 通用隐藏类，各页面样式表可覆盖 */
.hidden {
    display: none !important;
}

/* ===== 通用弹窗 ===== */
.modal {
    position: fixed;
    inset: 0;
    z-index: 200;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, 0.45);
    backdrop-filter: blur(4px);
    animation: fadeIn 0.2s ease;
}

.modal-card {
    position: relative;
    width: 100%;
    max-width: 420px;
    max-height: 90vh;
    overflow-y: auto;
    background: var(--bg-card);
    backdrop-filter: var(--backdrop);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    padding: 24px;
    box-shadow: var(--shadow-lg);
    animation: scaleIn 0.2s ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes scaleIn {
    from { opacity: 0; transform: scale(0.96); }
    to { opacity: 1; transform: scale(1); }
}

.loading-text {
    margin: 0;
    color: var(--text-secondary);
    font-size: 14px;
}

.loading-cancel {
    margin-top: 4px;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--border-light);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}


/* NavHub Frontend Toast - 页面级唯一队列容器 + 条目 */
.toast-stack {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    z-index: 99999;
    pointer-events: none;
    max-width: min(86vw, 420px);
}
.toast-frontend {
    position: relative;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 14px 28px;
    border-radius: 12px;
    font-size: 15px;
    color: #fff;
    opacity: 0;
    transform: translateY(8px) scale(0.96);
    transition: opacity 0.2s ease, transform 0.2s ease, max-height 0.2s ease,
        margin 0.2s ease, padding 0.2s ease;
    pointer-events: none;
    box-shadow: 0 8px 30px rgba(0,0,0,0.2);
    max-width: min(86vw, 420px);
    max-height: 200px;
    overflow: hidden;
    white-space: normal;
    overflow-wrap: anywhere;
    word-break: break-word;
}
.toast-frontend.show {
    opacity: 1;
    transform: translateY(0) scale(1);
}
.toast-frontend.toast-exiting {
    opacity: 0;
    transform: translateY(-6px) scale(0.96);
    max-height: 0;
    margin-top: -10px;
    padding-top: 0;
    padding-bottom: 0;
}
.toast-frontend.toast-success {
    background: linear-gradient(135deg, #43b97f, #38a169);
}
.toast-frontend.toast-error {
    background: linear-gradient(135deg, #e53e3e, #c53030);
}
.toast-frontend.toast-warning {
    background: linear-gradient(135deg, #ed8936, #dd6b20);
}
.toast-frontend .toast-icon {
    font-size: 20px;
    font-weight: bold;
    flex-shrink: 0;
}

/* ===== R200-R3 批3（新指令一/执行令 V7）：单 DOM 双设备面的设备可见性档位类 =====
   背景：tags 聚合页与三份详情页（netdisk/work/article）用同一份 DOM 同时服务 PC 与移动端
   （移动档由媒体查询降级，无第二套模板），而「分组卡片显示内容」的每项开关按 PC/移动 两档独立配置。
   故这些页面上的信息行/简介区块按档位标注下列类名，由媒体查询互斥显隐，实现同项开关两档互不干扰；
   类名与断点成对，取值出口＝constants.js 的 CARD_DEVICE_CLASSES_768 / CARD_DEVICE_CLASSES_AGG
   （禁止各页面散落自造类名或第二套断点）。
   768 档＝详情页既有移动断点（各详情页 matchMedia('(max-width: 768px)') 与内联样式同档）；
   agg 档＝tags 聚合页既有 R104-7 移动断点（900px，单列档）。
   注：此二档类只做「同项在两设备档间互斥显隐」，零默认值语义——两面皆关时调用方须整块不渲染
   （不产空容器），两端皆开时不加类。 */
@media (max-width: 768px) { .nh-dc-pc { display: none !important; } }
@media (min-width: 769px) { .nh-dc-mobile { display: none !important; } }
@media (max-width: 900px) { .nh-dc-pc-agg { display: none !important; } }
@media (min-width: 901px) { .nh-dc-mobile-agg { display: none !important; } }

