:root[data-theme="dark"] {
    --bg-color: #121212;
    --container-bg: #1e1e1e;
    --text-color: #f1f1f1;
    --text-muted: #aaaaaa;
    --primary: #4a90e2;
    --primary-hover: #357abd;
    --border: #333333;
    --modal-bg: #2d2d2d;
}

:root[data-theme="light"] {
    --bg-color: #f9f9f9;
    --container-bg: #ffffff;
    --text-color: #222222;
    --text-muted: #666666;
    --primary: #0066cc;
    --primary-hover: #0052a3;
    --border: #dddddd;
    --modal-bg: #ffffff;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    transition: background 0.3s, color 0.3s;
}

header {
    display: flex;
    justify-content: space-between;
    padding: 1rem 5%;
    align-items: center;
    border-bottom: 1px solid var(--border);
}

header .logo { font-size: 1.2rem; font-weight: bold; }
header button {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-color);
    padding: 5px 10px;
    border-radius: 5px;
    cursor: pointer;
    margin-left: 10px;
}

main.container {
    flex: 1;
    max-width: 600px;
    margin: 2rem auto;
    padding: 2rem;
    background: var(--container-bg);
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.1);
    text-align: center;
    width: 90%;
}

h1 { font-size: 1.8rem; margin-bottom: 0.5rem; }
p { color: var(--text-muted); margin-bottom: 1.5rem; }

.upload-area {
    border: 2px dashed var(--primary);
    padding: 3rem 1rem;
    border-radius: 8px;
    cursor: pointer;
    transition: 0.3s;
    font-weight: bold;
}
.upload-area:hover { background: rgba(74, 144, 226, 0.1); }

#file-list { list-style: none; margin-top: 1rem; text-align: left; }
#file-list li {
    background: var(--bg-color);
    margin: 5px 0; padding: 10px;
    border-radius: 5px; font-size: 0.9rem;
    border: 1px solid var(--border);
}

button#merge-btn {
    background: var(--primary);
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: bold;
    cursor: pointer;
    width: 100%;
    margin-top: 1.5rem;
    transition: 0.3s;
}
button#merge-btn:disabled { background: var(--text-muted); cursor: not-allowed; }
button#merge-btn:hover:not(:disabled) { background: var(--primary-hover); }

/* Footer */
footer {
    text-align: center;
    padding: 2rem 1rem;
    border-top: 1px solid var(--border);
    margin-top: auto;
}
.footer-links a {
    color: var(--text-color);
    text-decoration: none;
    margin: 0 10px;
    font-size: 0.9rem;
}
.footer-links a:hover { color: var(--primary); }
.footer-copy { margin-top: 1rem; font-size: 0.85rem; color: var(--text-muted); line-height: 1.6; }

/* Modal */
.modal-overlay {
    display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.6); z-index: 1000; justify-content: center; align-items: center;
}
.modal-overlay.active { display: flex; }
.modal-content {
    background: var(--modal-bg);
    padding: 2rem; border-radius: 12px; max-width: 500px; width: 90%;
    position: relative; box-shadow: 0 10px 30px rgba(0,0,0,0.3);
}
.modal-content h2 { margin-bottom: 1rem; border-bottom: 1px solid var(--border); padding-bottom: 0.5rem; }
.modal-content p { color: var(--text-color); line-height: 1.6; }
.close-btn { position: absolute; top: 15px; right: 20px; font-size: 1.5rem; cursor: pointer; }
.contact-link { color: var(--primary); font-weight: bold; text-decoration: none; }