/* === CSS Variables === */
:root {
    /* Colors */
    --primary-color: #e8e8e8;
    --secondary-color: #a0a0a0;
    --background-dark: #0f0f0f;
    --background-section: rgba(255, 255, 255, 0.03);
    --background-section-hover: rgba(255, 255, 255, 0.05);
    --menu-background: rgba(15, 15, 15, 0.8);
    --menu-background-hover: rgba(255, 255, 255, 0.08);
    --button-background: rgba(255, 255, 255, 0.07);
    --button-background-hover: rgba(255, 255, 255, 0.12);
    --link-color: #6fa8dc;
    --link-color-hover: #8fc1e9;
    --highlight-color: #fcc419;
    --border-color-light: rgba(255, 255, 255, 0.1);
    --border-color-medium: rgba(255, 255, 255, 0.15);
    --shadow-color-soft: rgba(0, 0, 0, 0.3);
    --shadow-color-medium: rgba(0, 0, 0, 0.5);
    --shadow-color-strong: rgba(0, 0, 0, 0.7);
    --scrollbar-track-color: #1a1a1a;
    --scrollbar-thumb-color: #444;
    --scrollbar-thumb-hover-color: #666;

    /* Platform Colors */
    --tiktok-color: #fe2c55;
    --instagram-color: #e4405f;
    --discord-color: #5865f2;
    --youtube-color: #ff0000;
    --line-color: #00b900;
    --web-history-color: #aaaaaa;

    /* Typography */
    --font-primary: 'Poppins', 'Noto Sans TC', sans-serif;
    --font-secondary: 'Poppins', 'Noto Sans TC', sans-serif;
    --font-size-base: 16px;
    --line-height-base: 1.7;

    /* Transitions & Animations */
    --transition-duration-fast: 0.15s;
    --transition-duration-normal: 0.3s;
    --transition-duration-slow: 0.5s;
    --transition-duration-very-slow: 0.8s;
    --easing-cubic: cubic-bezier(0.645, 0.045, 0.355, 1);
    --easing-out-expo: cubic-bezier(0.16, 1, 0.3, 1);

    /* Spacing */
    --space-xs: 0.5rem;
    --space-sm: 1rem;
    --space-md: 1.5rem;
    --space-lg: 2.5rem;
    --space-xl: 4rem;
    --space-xxl: 6rem;

    /* Layout */
    --container-width: 1100px;
    --section-border-radius: 18px;
    --button-border-radius: 10px;
    --scrollbar-width: 10px;
}

/* === Basic Reset & Global Styles === */
*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    scroll-behavior: smooth;
    font-size: var(--font-size-base);
    -webkit-tap-highlight-color: transparent;
    scrollbar-width: thin;
    scrollbar-color: var(--scrollbar-thumb-color) var(--scrollbar-track-color);
}

body {
    font-family: var(--font-primary);
    color: var(--primary-color);
    background-color: var(--background-dark);
    overflow-x: hidden;
    line-height: var(--line-height-base);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Custom Scrollbar (WebKit) */
body::-webkit-scrollbar { width: var(--scrollbar-width); }
body::-webkit-scrollbar-track { background: var(--scrollbar-track-color); border-radius: 5px; }
body::-webkit-scrollbar-thumb { background-color: var(--scrollbar-thumb-color); border-radius: 5px; border: 2px solid var(--scrollbar-track-color); }
body::-webkit-scrollbar-thumb:hover { background-color: var(--scrollbar-thumb-hover-color); }

/* Global Focus-Visible Style for Accessibility */
*:focus-visible {
  outline: 2px dashed var(--highlight-color);
  outline-offset: 3px;
}
*:focus:not(:focus-visible) {
  outline: none;
}

/* === Footer === */
footer {
    text-align: center;
    padding: var(--space-md) 0 var(--space-sm) 0;
    background-color: rgba(0, 0, 0, 0.7);
    color: var(--secondary-color);
    font-size: 0.9rem;
    border-top: 1px solid var(--border-color-light);
    margin-top: auto;
    letter-spacing: 0.3px;
    position: relative;
}

footer p {
    margin: 0.3rem 0;
    text-shadow: 0 1px 1px var(--shadow-color-soft);
}

.back-to-top {
    position: absolute;
    right: var(--space-md);
    bottom: var(--space-md);
    background-color: var(--button-background-hover);
    color: var(--primary-color);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    text-decoration: none;
    font-size: 1.2rem;
    box-shadow: 0 4px 10px var(--shadow-color-medium);
    transition: transform var(--transition-duration-normal) var(--easing-cubic),
                background-color var(--transition-duration-normal) ease,
                opacity var(--transition-duration-normal) ease;
    opacity: 0;
    pointer-events: none;
}

.back-to-top:hover,
.back-to-top:focus-visible {
    transform: translateY(-4px);
    background-color: var(--highlight-color);
    color: var(--background-dark);
}