:root {
    /* === [全局變數] UI 設定 === */
    --glass-radius: 2.5rem; 
    --glass-padding: 8px;
    --base-blur: 3px; 
    
    /* 動畫過渡時間 */
    --transition-speed: 0.5s;
}

body {
    font-family: 'Noto Sans TC', sans-serif;
    background-color: #f8fafc; /* 淺色模式底色：極淡灰藍 */
    color: #1e293b; /* 淺色模式文字 */
    overflow-x: hidden;
    margin: 0;
    transition: background-color var(--transition-speed) ease, color var(--transition-speed) ease;
}

/* 深色模式覆蓋 */
html.dark body {
    background-color: #000;
    color: #fff;
}

/* =========================================
   [獨立背景系統]
   ========================================= */

#universe-canvas {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    z-index: -20;
    background: transparent;    
    pointer-events: none;
    transition: opacity var(--transition-speed) ease;
}

.blob-container {
    position: fixed;
    inset: 0;
    z-index: -21; /* 在 Canvas 之下 */
    overflow: hidden;
    pointer-events: none;
}

.blob {
    position: absolute;
    border-radius: 50%;
    filter: blur(140px);
    animation: blob-move 60s infinite alternate ease-in-out; /* 放慢背景流動速度 */
    transition: background-color 1s ease, opacity 1s ease;
}

/* 深色模式背景光暈 */
html.dark .blob-1 { background: #312e81; width: 1000px; height: 1000px; top: -20%; left: -10%; opacity: 0.2; }
html.dark .blob-2 { background: #4c0519; width: 900px; height: 900px; bottom: -10%; right: -5%; opacity: 0.2; }

/* 淺色模式背景光暈 */
html:not(.dark) .blob-1 { background: #e0e7ff; width: 1000px; height: 1000px; top: -20%; left: -10%; opacity: 0.6; } /* 降低不透明度 */
html:not(.dark) .blob-2 { background: #ffe4e6; width: 900px; height: 900px; bottom: -10%; right: -5%; opacity: 0.6; }

@keyframes blob-move {
    0% { transform: translate(0, 0) scale(1); }
    100% { transform: translate(50px, 25px) scale(1.05); } /* 減緩移動幅度 */
}

/* 底部版權浮水印 */
.bg-watermark {
    position: fixed;
    bottom: 30px;
    left: 0;
    right: 0;
    text-align: center;
    z-index: -10;
    writing-mode: horizontal-tb; 
    text-transform: uppercase;
    letter-spacing: 0.8em;
    font-size: 10px;
    font-weight: 700;
    opacity: 0; 
    transform: translateY(20px);
    pointer-events: none;
    color: rgba(30, 41, 59, 0.4);
    user-select: none;
    transition: all 1.2s cubic-bezier(0.2, 1, 0.3, 1), color var(--transition-speed) ease;
}

html.dark .bg-watermark {
    color: rgba(255, 255, 255, 0.4);
}

.bg-watermark.visible {
    opacity: 0.5;
    transform: translateY(0);
}

/* =========================================
   [UI 介面系統]
   ========================================= */

/* Liquid Glass 物理核心 */
.glass-layer {
    border-radius: var(--glass-radius);
    
    /* 淺色模式玻璃 */
    background: rgba(255, 255, 255, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.9);
    box-shadow: 0 4px 30px rgba(148, 163, 184, 0.1);
    
    backdrop-filter: blur(var(--base-blur));
    -webkit-backdrop-filter: blur(var(--base-blur));
    
    transition: 
        background var(--transition-speed) ease, 
        border-color var(--transition-speed) ease, 
        box-shadow var(--transition-speed) ease;
    position: relative;
}

/* 深色模式玻璃 */
html.dark .glass-layer {
    background: rgba(255, 255, 255, 0.002);
    border: 1px solid rgba(255, 255, 255, 0.35);
    box-shadow: none;
}

/* 導光條效果 (Rim Light) */
.glass-layer::before {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: inherit;
    padding: 1px;
    background: linear-gradient(135deg, rgba(255,255,255,0.8), transparent 45%, rgba(255,255,255,0.1) 100%);
    -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    mask-composite: exclude;
    pointer-events: none;
    z-index: 1;
    opacity: 0.6;
    transition: opacity var(--transition-speed) ease;
}

html.dark .glass-layer::before {
    background: linear-gradient(135deg, rgba(255,255,255,0.5), transparent 45%, rgba(255,255,255,0.05) 100%);
    opacity: 1;
}

/* 移除強制位移，解決購物車卡死與閃現問題 */
html:not(.dark) .glass-layer:hover { background: rgba(255, 255, 255, 0.7); box-shadow: 0 8px 30px rgba(0, 0, 0, 0.08); }
html.dark .glass-layer:hover { background: rgba(255, 255, 255, 0.03); border-color: rgba(255, 255, 255, 0.6); box-shadow: 0 0 30px rgba(255, 255, 255, 0.05); }

/* 內嵌插槽 */
.glass-inset-slot {
    border-radius: calc(var(--glass-radius) - var(--glass-padding));
    
    /* 淺色模式插槽 */
    background: rgba(0, 0, 0, 0.03);
    box-shadow: inset 0 2px 10px rgba(0, 0, 0, 0.05);
    
    overflow: hidden;
    width: 100%;
    height: 100%;
    position: relative;
    transition: background var(--transition-speed) ease, box-shadow var(--transition-speed) ease;
}

html.dark .glass-inset-slot {
    background: rgba(0, 0, 0, 0.5); 
    box-shadow: 
        inset 0 10px 30px rgba(0, 0, 0, 0.9),
        inset 0 0 0 1px rgba(255, 255, 255, 0.03);
}

.text-glow {
    text-shadow: none;
    transition: text-shadow var(--transition-speed) ease;
}

html.dark .text-glow {
    text-shadow: 0 0 25px rgba(255, 255, 255, 0.3);
}

.theme-toggle-btn {
    position: relative;
    overflow: hidden;
}

.theme-icon {
    transition: transform 0.5s cubic-bezier(0.68, -0.55, 0.27, 1.55), opacity 0.5s ease;
}

html.dark .icon-sun { opacity: 0; transform: rotate(90deg) scale(0.5); position: absolute; }
html:not(.dark) .icon-sun { opacity: 1; transform: rotate(0) scale(1); }

html.dark .icon-moon { opacity: 1; transform: rotate(0) scale(1); }
html:not(.dark) .icon-moon { opacity: 0; transform: rotate(-90deg) scale(0.5); position: absolute; }

/* Aspect Ratio Fallback */
.aspect-card {
    position: relative;
    width: 100%;
    padding-bottom: 125%; /* 4:5 aspect ratio */
}
.aspect-card > div {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}
