:root {
    --bg-color: #050511;
    --text-primary: #ffffff;
    --text-secondary: #a0a0b0;
    --accent-primary: #ccff00;
    /* Stabilo Yellow / Rossi Yellow */
    --accent-secondary: #d4ff00;
    --glass-bg: rgba(255, 255, 255, 0.03);
    --glass-border: rgba(255, 255, 255, 0.1);
    --font-main: 'Outfit', sans-serif;
    --transition-speed: 0.3s;
    --btn-text-color: #000000;
    /* Default (Dark Mode) text is black on yellow bg */
}

body.light-mode {
    --bg-color: #f0f0f5;
    --text-primary: #1a1a1a;
    --text-secondary: #555555;
    --glass-bg: rgba(255, 255, 255, 0.5);
    /* More opaque for light mode to show glass effect */
    --glass-border: rgba(0, 0, 0, 0.1);
    /* Keep accents same or adjust if needed */

    /* Light Mode Overrides for VR46 Style */
    --accent-primary: #000000;
    /* Primary buttons become Black */
    --accent-secondary: #ccff00;
    /* Secondary accents remain Neon Yellow */
    --btn-text-color: #ccff00;
    /* Text on buttons becomes Neon Yellow */
}

/* Theme Toggle */
.theme-toggle {
    position: fixed;
    top: 20px;
    right: 20px;
    background: transparent;
    border: none;
    color: var(--text-primary);
    /* Default icon color */
    font-size: 1.5rem;
    cursor: pointer;
    z-index: 100;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.theme-toggle:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--accent-secondary);
}

/* Toggle in Light Mode: VR46 Style (Black Circle, Yellow Icon) */
body.light-mode .theme-toggle {
    background: #000000;
    color: var(--accent-secondary);
    /* Yellow Icon */
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

body.light-mode .theme-toggle:hover {
    transform: scale(1.1);
    background: #000000;
    /* Keep black */
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: var(--font-main);
}

body {
    background-color: var(--bg-color);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    padding: 2rem;
}

/* Dynamic Background */
.background-glow {
    position: fixed;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle at center, rgba(204, 255, 0, 0.15) 0%, rgba(5, 5, 17, 0) 50%);
    z-index: -1;
    animation: pulse 10s infinite alternate;
}

@keyframes pulse {
    0% {
        transform: scale(1);
        opacity: 0.5;
    }

    100% {
        transform: scale(1.1);
        opacity: 0.8;
    }
}

.container {
    width: 100%;
    max-width: 600px;
    display: flex;
    flex-direction: column;
    gap: 2rem;
    align-items: center;
}

header {
    text-align: center;
    margin-bottom: 1rem;
}

header h1 {
    font-size: 3rem;
    font-weight: 700;
    background: linear-gradient(135deg, #fff 0%, var(--accent-secondary) 100%);
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    letter-spacing: -1px;
    margin-bottom: 0.5rem;
}

/* Light Mode Header Override */
body.light-mode header h1 {
    /* Use solid black or simplified gradient for readability */
    background: linear-gradient(135deg, #000 0%, #333 100%);
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

header p {
    color: var(--text-secondary);
    font-weight: 300;
    font-size: 1.1rem;
}

/* Upload Section */
.upload-section {
    width: 100%;
}

.glass-panel {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    backdrop-filter: blur(10px);
    border-radius: 20px;
    padding: 3rem;
    text-align: center;
    cursor: pointer;
    transition: all var(--transition-speed) ease;
    position: relative;
    overflow: hidden;
}

.glass-panel:hover,
.glass-panel.dragover {
    background: rgba(255, 255, 255, 0.08);
    border-color: var(--accent-secondary);
    /* Removed glow/shadow for flat style */
}

body.light-mode .glass-panel:hover {
    background: rgba(0, 0, 0, 0.05);
}

.file-input {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
}

.upload-icon {
    width: 64px;
    height: 64px;
    margin-bottom: 1rem;
    stroke: var(--text-secondary);
    transition: stroke var(--transition-speed);
}

.glass-panel:hover .upload-icon {
    stroke: var(--accent-secondary);
}

/* On Light Mode, secondary accent is the Yellow, which is bad for thin lines on white bg.
   Use Black or Dark Grey for icons on hover in light mode? */
body.light-mode .glass-panel:hover .upload-icon {
    stroke: #000;
}

.upload-content h3 {
    font-size: 1.2rem;
    margin-bottom: 0.5rem;
}

.upload-content p {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

/* Controls */
.controls {
    display: flex;
    gap: 1rem;
    width: 100%;
    justify-content: center;
}

.btn {
    padding: 0.8rem 1.5rem;
    border-radius: 12px;
    border: none;
    font-weight: 600;
    /* Bolder for visibility */
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 1rem;
    transition: transform 0.2s, box-shadow 0.2s;
}

.btn:active {
    transform: scale(0.96);
}

.btn.primary {
    background: var(--accent-primary);
    color: var(--btn-text-color);
    /* Removed box-shadow */
}

.btn.primary:hover {
    /* In Dark Mode: --accent-primary is Yellow. Hover -> Darker Yellow.
       In Light Mode: --accent-primary is Black. Hover -> Dark Grey. */
    filter: brightness(0.9);
    /* Removed box-shadow */
}

/* Specific hover override for Light Mode to maybe show a hint of yellow? 
   Or just keep it simple grey/black */
body.light-mode .btn.primary:hover {
    background: #333;
}

.btn.secondary {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

body.light-mode .btn.secondary {
    background: rgba(0, 0, 0, 0.05);
    border: 1px solid rgba(0, 0, 0, 0.1);
    color: var(--text-primary);
}

.btn.secondary:hover {
    background: rgba(255, 255, 255, 0.15);
}

body.light-mode .btn.secondary:hover {
    background: rgba(0, 0, 0, 0.1);
}

/* Preview Area */
.preview-section {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.slices-container {
    display: flex;
    flex-direction: column;
    width: 100%;
    max-width: 500px;
    transition: gap var(--transition-speed) ease;
}

.slices-container.exploded {
    gap: 10px;
}

.slice-img {
    width: 100%;
    display: block;
    box-shadow: 0 0 0 rgba(0, 0, 0, 0);
    transition: transform var(--transition-speed), box-shadow var(--transition-speed);
}

.slices-container.exploded .slice-img {
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    border-radius: 4px;
}

body.light-mode .slices-container.exploded .slice-img {
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
}

/* Individual Slice Wrapper & Copy Button */
.slice-wrapper {
    position: relative;
    width: 100%;
}

.copy-slice-btn {
    position: absolute;
    right: 15px;
    top: 50%;
    transform: translateY(-50%) scale(0.9);
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(5px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: white;
    /* Always white icon on dark glass */
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    opacity: 0;
    transition: all 0.2s ease;
    z-index: 10;
}

body.light-mode .copy-slice-btn {
    /* In light mode, simple black circle */
    background: rgba(0, 0, 0, 0.8);
    color: var(--accent-secondary);
    /* Yellow icon */
    border: none;
}

.copy-slice-btn:hover {
    background: var(--accent-primary);
    color: black;
    transform: translateY(-50%) scale(1.1);
    /* Removed box-shadow */
}

body.light-mode .copy-slice-btn:hover {
    background: black;
    color: white;
    /* Flip to white on hover? Or keep yellow? */
    /* Let's try: Black Bg -> Yellow Icon is default. Hover -> Yellow Bg -> Black Icon */
    background: var(--accent-secondary);
    color: black;
}

.slice-wrapper:hover .copy-slice-btn {
    opacity: 1;
    transform: translateY(-50%) scale(1);
}

/* Footer */
footer {
    position: fixed;
    bottom: 20px;
    width: 100%;
    text-align: center;
    color: var(--text-secondary);
    display: flex;
    justify-content: center;
    gap: 1.5rem;
    /* Increased gap */
    z-index: 50;
}

footer a {
    color: var(--text-secondary);
    text-decoration: none;
    transition: all 0.2s ease;
    opacity: 0.7;
}

footer a:hover {
    color: var(--accent-secondary);
    /* Yellow hover */
    opacity: 1;
    transform: scale(1.2);
    /* Slight pop */
}

/* Light Mode Footer Override */
body.light-mode footer a {
    color: #000;
    /* Black icons in light mode */
}

body.light-mode footer a:hover {
    color: var(--accent-secondary);
    /* Hover to Yellow even in light mode? Or remain Black? 
                                      VR46: Yellow is the accent. Let's make it Yellow on hover. */
    /* Wait, checking previous logic. */
}

.hidden {
    display: none !important;
}