
:root {

    --xxxxmetro-accent: #7c3aed;
    --xxxxmetro-blue: #7c3aed;
    --xxxxmetro-light: #f5f3ff;
    --xxxxmetro-dark: #020617;
    --xxxxmetro-accent-rgb: 124, 58, 237;

    --bg-primary: #ffffff;
    --bg-secondary: #f5f3ff;
    --text-primary: #1e1b4b;
    --text-secondary: #4338ca;
    --border-color: #ddd6fe;
    --sidebar-bg: #ffffff;
    --tile-bg: #ffffff;
    --tile-shadow: 0 4px 0px rgba(0,0,0,0.1);
    --tile-hover-shadow: 0 6px 0px rgba(124, 58, 237, 0.2);
    --tile-active-shadow: 0 0px 0px rgba(0,0,0,0);

    --global-blur: 20px;
    --global-glow-opacity: 0.1;
    --global-anim-speed: 0.5s;
}

.dark {

    --bg-primary: #020617;
    --bg-secondary: #000000;
    --text-primary: #f8fafc;
    --text-secondary: #a78bfa;
    --border-color: #1e1b4b;
    --sidebar-bg: #020617;
    --tile-bg: #0f172a;
    --tile-shadow: 0 4px 0px rgba(0,0,0,0.5);
    --tile-hover-shadow: 0 6px 0px rgba(124, 58, 237, 0.3);
    --xxxxmetro-accent: #8b5cf6;
    --xxxxmetro-blue: #8b5cf6;
}

html { font-size: 14px; }
@media (max-width: 640px) { html { font-size: 12px; } }

body { 
    background: var(--bg-secondary); 
    color: var(--text-primary);
    font-family: 'Segoe UI', 'Microsoft YaHei', 'PingFang SC', sans-serif;
    transition: background 0.3s ease, color 0.3s ease;
    overflow-x: hidden;
    margin: 0;
}

.perspective-container { perspective: 1000px; }
.metro-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 1.5rem;
}

.metro-tile {
    background-color: var(--tile-bg);
    border: 2px solid var(--border-color);
    box-shadow: var(--tile-shadow);
    transition: all 0.1s;
    cursor: pointer;
    position: relative;
    overflow: hidden;
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}
.metro-tile:hover {
    border-color: var(--xxxxmetro-accent);
    box-shadow: var(--tile-hover-shadow);
}
.metro-tile:active {
    transform: translateY(2px);
    box-shadow: var(--tile-active-shadow);
}

input[type="range"].metro-range {
    -webkit-appearance: none;
    width: 100%;
    height: 2px;
    background: var(--border-color);
    outline: none;
    margin: 20px 0;
    cursor: pointer;
    transition: background 0.3s;
}
input[type="range"].metro-range:hover {
    background: rgba(var(--xxxxmetro-accent-rgb), 0.3);
}

input[type="range"].metro-range::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 8px;
    height: 20px;
    background: var(--xxxxmetro-accent);
    cursor: pointer;
    border-radius: 0;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
    border: none;
    position: relative;
    z-index: 2;
}

input[type="range"].metro-range:hover::-webkit-slider-thumb {
    width: 12px;
    height: 28px;
    transform: translateY(-2px); 
    box-shadow: 
        0 10px 20px rgba(var(--xxxxmetro-accent-rgb), 0.4), 
        0 0 15px rgba(var(--xxxxmetro-accent-rgb), 0.6);   
    filter: brightness(1.1);
}

input[type="range"].metro-range:active::-webkit-slider-thumb {
    transform: translateY(0) scale(0.9);
    box-shadow: 0 2px 5px rgba(var(--xxxxmetro-accent-rgb), 0.5);
}

input[type="range"].metro-range::-moz-range-thumb {
    width: 8px;
    height: 20px;
    background: var(--xxxxmetro-accent);
    cursor: pointer;
    border-radius: 0;
    border: none;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
}

input[type="range"].metro-range:hover::-moz-range-thumb {
    width: 12px;
    height: 28px;
    transform: translateY(-2px);
    box-shadow: 
        0 10px 20px rgba(var(--xxxxmetro-accent-rgb), 0.4),
        0 0 15px rgba(var(--xxxxmetro-accent-rgb), 0.6);
    filter: brightness(1.1);
}

.sidebar-metro {
    background: var(--bg-primary);
    border-left: 1px solid var(--border-color);
    box-shadow: -10px 0 30px rgba(0,0,0,0.1);
    z-index: 1000;
    position: fixed;
    top: 0; right: 0; bottom: 0;
    width: 450px;
    max-width: 100%;
    display: flex;
    flex-direction: column;
}

.modal-metro-overlay {
    position: fixed; inset: 0; z-index: 2000;
    background: rgba(0,0,0,0.6);
    backdrop-filter: blur(var(--global-blur));
    -webkit-backdrop-filter: blur(var(--global-blur));
    display: flex; align-items: center; justify-content: center; padding: 1rem;
}
.modal-metro {
    background: var(--bg-primary);
    border-top: 8px solid var(--xxxxmetro-accent);
    width: 100%; max-width: 600px;
    box-shadow: 0 40px 100px rgba(0,0,0,0.5);
    position: relative;
    display: flex; flex-direction: column;
    animation: metro-slide-up 0.4s cubic-bezier(0.1, 0.9, 0.2, 1);
}
.modal-close-metro {
    position: absolute;
    top: 1rem;
    right: 1.5rem;
    font-size: 2rem;
    line-height: 1;
    color: #a1a1aa; 
    z-index: 50;
    cursor: pointer;
}
@keyframes metro-slide-up {
    0% { transform: translateY(100px); opacity: 0; }
    100% { transform: translateY(0); opacity: 1; }
}

.modal-header-metro {
    padding: 1.5rem 1.5rem 0.75rem 1.5rem;
    display: flex; justify-content: space-between; items-start;
}
.modal-body-metro {
    padding: 0.75rem 1.5rem 1.5rem 1.5rem;
    overflow-y: auto; max-h-[60vh];
}
.modal-footer-metro {
    padding: 0 1.5rem 1.5rem 1.5rem;
    display: flex; justify-content: flex-end; gap: 1rem;
}

.toast-metro {
    position: fixed; top: 40px; right: 40px; z-index: 5000;
    padding: 1.25rem 2.5rem; background: var(--xxxxmetro-blue); color: white;
    box-shadow: 0 20px 50px rgba(0,0,0,0.3); border-left: 10px solid rgba(255,255,255,0.8);
    display: flex; flex-direction: column; gap: 4px;
    animation: toast-in 0.5s cubic-bezier(0.1, 0.9, 0.2, 1) both;
}
@keyframes toast-in {
    0% { transform: translateX(100px); opacity: 0; }
    100% { transform: translateX(0); opacity: 1; }
}
.toast-out { animation: toast-out 0.4s cubic-bezier(0.7, 0, 0.3, 1) both; }
@keyframes toast-out {
    0% { transform: translateX(0); opacity: 1; }
    100% { transform: translateX(100px); opacity: 0; }
}

.achievement-wrapper {
    position: fixed; bottom: 40px; left: 50%;
    transform: translateX(-50%); z-index: 4000;
    pointer-events: none;
}
.achievement-card {
    background: rgba(15, 15, 15, 0.95);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 100px; padding: 10px 40px 10px 10px;
    display: flex; align-items: center; gap: 20px;
    box-shadow: 0 30px 60px rgba(0,0,0,0.5), 0 0 30px rgba(var(--xxxxmetro-accent-rgb), 0.3);
    min-width: 320px; pointer-events: auto;
    animation: achievement-pop 0.8s cubic-bezier(0.19, 1, 0.22, 1) both;
}
@keyframes achievement-pop {
    0% { transform: translateY(150px) scale(0.7); opacity: 0; }
    100% { transform: translateY(0) scale(1); opacity: 1; }
}
.achievement-out { animation: achievement-out 0.6s cubic-bezier(0.68, -0.55, 0.265, 1.55) both; }
@keyframes achievement-out {
    0% { transform: translateY(0) scale(1); opacity: 1; }
    100% { transform: translateY(150px) scale(0.7); opacity: 0; }
}

.toggle-metro {
    position: relative;
    display: inline-block;
    width: 44px; height: 20px;
}
.toggle-metro input { opacity: 0; width: 0; height: 0; }
.toggle-metro-slider {
    position: absolute; cursor: pointer; top: 0; left: 0; right: 0; bottom: 0;
    background-color: transparent; border: 2px solid var(--border-color);
    transition: .2s;
}
.toggle-metro-slider:before {
    position: absolute; content: ""; height: 12px; width: 12px;
    left: 2px; bottom: 2px; background-color: var(--border-color); transition: .2s;
}
input:checked + .toggle-metro-slider {
    background-color: var(--xxxxmetro-accent); border-color: var(--xxxxmetro-accent);
}
input:checked + .toggle-metro-slider:before {
    transform: translateX(24px); background-color: white;
}

.fade-enter-active, .fade-leave-active { transition: opacity 0.3s ease; }
.fade-enter, .fade-leave-to { opacity: 0; }

.slide-right-enter-active, .slide-right-leave-active { transition: transform 0.5s cubic-bezier(0.1, 0.9, 0.2, 1); }
.slide-right-enter, .slide-right-leave-to { transform: translateX(100%); }

.metro-transition-container {
    position: fixed;
    top: 0; left: 0; width: 100vw; height: 100vh;
    z-index: 999999;
    pointer-events: none;
    perspective: 2000px;
    display: none;
}
.metro-transition-container.active { display: block; pointer-events: all; }

.transition-tile-clone {
    position: absolute;
    transform-style: preserve-3d;
    transition: none;
    z-index: 100;
}

.transition-tile-clone .side {
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    backface-visibility: hidden;
    overflow: hidden;
}

.transition-tile-clone .front-side {
    background: var(--xxxxmetro-accent);
    z-index: 2;
}

.transition-tile-clone .back-side {
    background: var(--bg-primary);
    transform: rotateY(180deg);
    z-index: 1;
}

@keyframes metro-pc-flip-expand {
    0% { 
        transform: translate3d(var(--tx), var(--ty), 0) rotateY(0deg);
        width: var(--tw); height: var(--th);
    }
    100% {
        transform: translate3d(0, 0, 0) rotateY(180deg);
        width: 100vw; height: 100vh;
    }
}

@keyframes metro-pc-flip-shrink {
    0% { 
        transform: translate3d(0, 0, 0) rotateY(180deg);
        width: 100vw; 
        height: 100vh;
        opacity: 1;
    }
    100% {
        transform: translate3d(var(--tx), var(--ty), 0) rotateY(0deg);
        width: var(--tw); 
        height: var(--th);
        opacity: 1;
    }
}

.transition-tile-clone.pc-run { 
    animation: metro-pc-flip-expand 0.8s cubic-bezier(0.4, 0, 0.2, 1) forwards; 
}
.transition-tile-clone.pc-back { 
    animation: metro-pc-flip-shrink 0.8s cubic-bezier(0.4, 0, 0.2, 1) forwards; 
}

.loading-overlay {
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.2);
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s;
    z-index: 10;
}
.loading .loading-overlay { opacity: 1; }

.metro-dots {
    display: flex;
    gap: 4px;
}
.metro-dot {
    width: 6px; height: 6px;
    background: white;
    animation: metro-dot-pulse 1.5s infinite;
}
.metro-dot:nth-child(2) { animation-delay: 0.2s; }
.metro-dot:nth-child(3) { animation-delay: 0.4s; }

@keyframes metro-dot-pulse {
    0%, 100% { transform: scale(1); opacity: 0.3; }
    50% { transform: scale(1.5); opacity: 1; }
}

.metro-tile-placeholder {
    visibility: hidden !important;
}

::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}
::-webkit-scrollbar-track {
    background: var(--bg-secondary);
}
::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 0;
    border: 2px solid var(--bg-secondary); 
    transition: background 0.2s;
}
::-webkit-scrollbar-thumb:hover {
    background: var(--xxxxmetro-accent);
}

::-webkit-scrollbar-thumb:active {
    background: var(--xxxxmetro-blue);
}

.metro-scroll-wrapper {
    position: relative;
    display: flex;
    flex-direction: column;
}

.metro-external-track-x {
    height: 4px;
    background: rgba(var(--xxxxmetro-accent-rgb), 0.1);
    position: relative;
    margin-top: 8px;
    cursor: pointer;
    transition: all 0.3s;
}
.metro-external-track-x:hover { height: 6px; background: rgba(var(--xxxxmetro-accent-rgb), 0.2); }

.metro-external-track-y {
    width: 4px;
    background: rgba(var(--xxxxmetro-accent-rgb), 0.1);
    position: absolute;
    right: -12px;
    top: 0;
    bottom: 0;
    cursor: pointer;
    transition: all 0.3s;
}
.metro-external-track-y:hover { width: 6px; background: rgba(var(--xxxxmetro-accent-rgb), 0.2); }

.metro-external-thumb {
    position: absolute;
    background: var(--border-color);
    cursor: pointer;
    transition: transform 0.2s cubic-bezier(0.4, 0, 0.2, 1), background 0.2s, box-shadow 0.2s;
    will-change: transform, left, top;
}

.metro-external-track-x .metro-external-thumb {
    top: 50%;
    transform: translateY(-50%);
    height: 100%;
    min-width: 40px;
}

.metro-external-track-y .metro-external-thumb {
    left: 50%;
    transform: translateX(-50%);
    width: 100%;
    min-height: 40px;
}

.metro-external-track-x .metro-external-thumb:hover, 
.metro-external-track-x .metro-external-thumb.dragging {
    background: var(--xxxxmetro-accent) !important;
    height: 12px;
    transform: translateY(-50%) scale(1.02);
    box-shadow: 0 8px 15px rgba(0,0,0,0.3), 0 0 15px rgba(var(--xxxxmetro-accent-rgb), 0.6);
    z-index: 10;
}

.metro-external-track-y .metro-external-thumb:hover, 
.metro-external-track-y .metro-external-thumb.dragging {
    background: var(--xxxxmetro-accent) !important;
    width: 12px;
    transform: translateX(-50%) scale(1.02);
    box-shadow: 8px 0 15px rgba(0,0,0,0.3), 0 0 15px rgba(var(--xxxxmetro-accent-rgb), 0.6);
    z-index: 10;
}

.dark .metro-external-thumb { background: #334155; }
.metro-external-thumb:not(:hover):not(.dragging) { opacity: 0.6; }

* {
    scrollbar-width: thin;
    scrollbar-color: var(--border-color) transparent;
}

.btn-metro {
    position: relative; padding: 0.8rem 2rem;
    background: var(--xxxxmetro-accent); color: white;
    font-weight: 900; text-transform: uppercase; letter-spacing: 0.15em;
    transition: all 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    border: none; box-shadow: 0 4px 0 #4c1d95; cursor: pointer;
    font-size: 0.75rem; display: inline-flex; align-items: center; justify-content: center;
}
.btn-metro:hover { box-shadow: 0 7px 0 #4c1d95; filter: brightness(1.1); }
.btn-metro:active { transform: translateY(2px); box-shadow: 0 0px 0 #4c1d95; }

.shine-effect { position: relative; overflow: hidden; }
.shine-effect::after {
    content: ''; position: absolute; top: -50%; left: -50%; width: 200%; height: 200%;
    background: linear-gradient(to right, transparent, rgba(255,255,255,0.4), transparent);
    transform: rotate(45deg); animation: shine 3s infinite; pointer-events: none;
}
@keyframes shine { 0% { transform: translateX(-100%) rotate(45deg); } 100% { transform: translateX(200%) rotate(45deg); } }

.bg-metro-gradient { background: linear-gradient(135deg, #7c3aed 0%, #a78bfa 100%); }

.metro-tile-badge {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: var(--xxxxmetro-accent);
    color: white;
    font-size: 10px;
    font-weight: 900;
    padding: 2px 6px;
    min-width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 5;
}

.metro-tile-icon-container {
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}
.metro-tile:hover .metro-tile-icon-container {
    transform: translateY(-8px) scale(1.1);
}

.tile-border-glow {
    border: 2px solid transparent;
    background-clip: padding-box;
    position: relative;
}
.tile-border-glow::before {
    content: '';
    position: absolute;
    top: -2px; bottom: -2px; left: -2px; right: -2px;
    background: linear-gradient(45deg, var(--xxxxmetro-accent), transparent, var(--xxxxmetro-blue));
    z-index: -1;
    opacity: 0;
    transition: opacity 0.3s;
}
.tile-border-glow:hover::before {
    opacity: 1;
}

.metro-tile-live {
    padding: 0;
    overflow: hidden;
    position: relative;
    perspective: 1000px;
}

.live-tile-content {
    width: 100%;
    height: 100%;
    position: absolute;
    top: 0;
    left: 0;
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    transition: all 0.6s cubic-bezier(0.1, 0.9, 0.2, 1);
    backface-visibility: hidden;
    background-color: var(--tile-bg);
}

.live-tile-flip-up .front { transform: rotateX(0deg); z-index: 2; }
.live-tile-flip-up .back { transform: rotateX(-180deg); z-index: 1; }
.live-tile-flip-up.flipped .front { transform: rotateX(180deg); }
.live-tile-flip-up.flipped .back { transform: rotateX(0deg); z-index: 2; }

.live-tile-flip-left .front { transform: rotateY(0deg); z-index: 2; }
.live-tile-flip-left .back { transform: rotateY(-180deg); z-index: 1; }
.live-tile-flip-left.flipped .front { transform: rotateY(180deg); }
.live-tile-flip-left.flipped .back { transform: rotateY(0deg); z-index: 2; }

.live-tile-slide-up .front { transform: translateY(0); z-index: 2; }
.live-tile-slide-up .back { transform: translateY(100%); z-index: 1; }
.live-tile-slide-up.flipped .front { transform: translateY(-100%); }
.live-tile-slide-up.flipped .back { transform: translateY(0); z-index: 2; }

.live-tile-slide-left .front { transform: translateX(0); z-index: 2; }
.live-tile-slide-left .back { transform: translateX(100%); z-index: 1; }
.live-tile-slide-left.flipped .front { transform: translateX(-100%); }
.live-tile-slide-left.flipped .back { transform: translateX(0); z-index: 2; }

.live-tile-fade .front { opacity: 1; z-index: 2; }
.live-tile-fade .back { opacity: 0; z-index: 1; }
.live-tile-fade.flipped .front { opacity: 0; z-index: 1; }
.live-tile-fade.flipped .back { opacity: 1; z-index: 2; }

.live-tile-zoom-flip .front { transform: scale(1); opacity: 1; z-index: 2; }
.live-tile-zoom-flip .back { transform: scale(1.5); opacity: 0; z-index: 1; }
.live-tile-zoom-flip.flipped .front { transform: scale(0.5); opacity: 0; }
.live-tile-zoom-flip.flipped .back { transform: scale(1); opacity: 1; z-index: 2; }

.live-tile-blinds .live-tile-content { transition: all 0.8s cubic-bezier(0.4, 0, 0.2, 1); }
.live-tile-blinds .front { clip-path: inset(0 0 0 0); }
.live-tile-blinds .back { clip-path: inset(0 100% 0 0); }
.live-tile-blinds.flipped .front { clip-path: inset(0 0 0 100%); }
.live-tile-blinds.flipped .back { clip-path: inset(0 0 0 0); }

.news-tile-container {
    height: 100%;
    display: flex;
    flex-direction: column;
    transition: transform 0.8s cubic-bezier(0.1, 0.9, 0.2, 1);
}
.news-item {
    height: 100%;
    flex-shrink: 0;
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    justify-content: center;
}
