:root {
    --primary-color: #2563eb;
    --primary-hover: #1d4ed8;
    --success-color: #059669;
    --error-color: #dc2626;
    --warning-color: #d97706;
    --bg-color: #f8fafc;
    --card-bg: #ffffff;
    --text-primary: #0f172a;
    --text-secondary: #64748b;
    --border-color: #e2e8f0;
    --shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --footer-bg: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}
* { box-sizing: border-box; }
body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    color: var(--text-primary);
    margin: 0;
    padding: 20px;
    line-height: 1.6;
    min-height: 100vh;
}
.container { max-width: 900px; margin: 0 auto; }
h1 {
    text-align: center;
    color: var(--primary-color);
    margin-bottom: 10px;
    font-size: 2.5em;
    text-shadow: 0 2px 4px rgba(0,0,0,0.1);
}
.subtitle {
    text-align: center;
    color: var(--text-secondary);
    margin-bottom: 40px;
    font-size: 1.1em;
    background: rgba(255,255,255,0.7);
    padding: 10px 20px;
    border-radius: 20px;
    display: inline-block;
}
nav {
    display: flex;
    justify-content: center;
    margin-bottom: 30px;
    background: rgba(255,255,255,0.9);
    padding: 15px;
    border-radius: 20px;
    box-shadow: var(--shadow-lg);
    backdrop-filter: blur(10px);
}
nav button {
    padding: 12px 24px;
    margin: 0 5px;
    background: transparent;
    color: var(--text-secondary);
    border: 2px solid var(--border-color);
    border-radius: 50px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 500;
    position: relative;
    overflow: hidden;
}
nav button::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.4), transparent);
    transition: left 0.5s;
}
nav button:hover::before { left: 100%; }
nav button.active {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
}
nav button:hover:not(.active) {
    background: rgba(37, 99, 235, 0.1);
    border-color: var(--primary-color);
    transform: translateY(-2px);
}
.page {
    display: none;
    padding: 30px;
    background: rgba(255,255,255,0.95);
    border-radius: 20px;
    box-shadow: var(--shadow-lg);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255,255,255,0.2);
}
.page.active { display: block; }
.section { margin-bottom: 25px; }
h2 {
    color: var(--text-primary);
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1.8em;
}
.file-input-wrapper {
    position: relative;
    display: inline-block;
    width: 100%;
    margin-bottom: 15px;
}
input[type="file"] {
    width: 100%;
    padding: 15px;
    border: 2px dashed var(--border-color);
    border-radius: 12px;
    background: rgba(248, 250, 252, 0.8);
    transition: all 0.3s ease;
    font-size: 1em;
    cursor: pointer;
}
input[type="file"]:hover {
    border-color: var(--primary-color);
    background: rgba(37, 99, 235, 0.05);
    transform: scale(1.02);
}
input[type="file"]:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}
textarea {
    width: 100%;
    padding: 15px;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    resize: vertical;
    min-height: 100px;
    font-family: 'Courier New', monospace;
    background: rgba(248, 250, 252, 0.8);
    transition: all 0.3s ease;
    font-size: 0.95em;
}
textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
    background: white;
}
.btn {
    padding: 14px 28px;
    background: linear-gradient(135deg, var(--primary-color), var(--primary-hover));
    color: white;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    margin: 5px;
    box-shadow: var(--shadow);
    text-decoration: none;
    position: relative;
    overflow: hidden;
}
.btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
    transition: left 0.5s;
}
.btn:hover::before { left: 100%; }
.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(37, 99, 235, 0.3);
}
.btn:disabled {
    background: #9ca3af;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}
.btn-success {
    background: linear-gradient(135deg, var(--success-color), #047857);
}
.btn-success:hover {
    box-shadow: 0 8px 25px rgba(5, 150, 105, 0.3);
}
.btn-warning {
    background: linear-gradient(135deg, var(--warning-color), #b45309);
}
.btn-warning:hover {
    box-shadow: 0 8px 25px rgba(217, 119, 6, 0.3);
}
.preview {
    text-align: center;
    margin: 25px 0;
    padding: 20px;
    background: rgba(248, 250, 252, 0.5);
    border-radius: 12px;
}
.preview img {
    max-width: 100%;
    max-height: 400px;
    border-radius: 12px;
    box-shadow: var(--shadow-lg);
    transition: transform 0.3s ease;
}
.preview img:hover { transform: scale(1.02); }
.result {
    margin-top: 25px;
    padding: 25px;
    border-radius: 12px;
    animation: fadeIn 0.5s ease;
}
@keyframes fadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }
.success {
    background: linear-gradient(135deg, #ecfdf5, #d1fae5);
    border: 1px solid #a7f3d0;
    color: var(--success-color);
}
.error {
    background: linear-gradient(135deg, #fef2f2, #fee2e2);
    border: 1px solid #fecaca;
    color: var(--error-color);
}
.key-section {
    background: linear-gradient(135deg, #f0f9ff, #e0f2fe);
    border: 1px solid #bae6fd;
    padding: 20px;
    border-radius: 12px;
    margin: 15px 0;
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.05);
}
.key-section strong {
    color: var(--text-primary);
    display: block;
    margin-bottom: 12px;
    font-size: 1.1em;
}
.key-section small {
    color: var(--text-secondary);
    display: block;
    margin-top: 8px;
}
.download-links {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
    margin-top: 20px;
    justify-content: center;
}
.spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}
@keyframes spin { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }
.loading { display: none; margin-left: 10px; }
.loading.active { display: inline-block; }
footer {
    text-align: center;
    margin-top: 50px;
    padding: 20px;
    background: var(--footer-bg);
    color: white;
    border-radius: 20px 20px 0 0;
    box-shadow: var(--shadow-lg);
    font-size: 0.95em;
    position: relative;
    overflow: hidden;
}
footer::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -50%;
    width: 100%;
    height: 100%;
    background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"><defs><pattern id="grain" width="100" height="100" patternUnits="userSpaceOnUse"><circle cx="25" cy="25" r="1" fill="white" opacity="0.1"/><circle cx="75" cy="75" r="1" fill="white" opacity="0.1"/></pattern></defs><rect width="100" height="100" fill="url(%23grain)"/></svg>') repeat;
    opacity: 0.1;
}
footer p {
    position: relative;
    z-index: 1;
    margin: 0;
    font-style: italic;
}
@media (max-width: 768px) {
    body { padding: 10px; }
    .container { padding: 0; }
    nav { flex-direction: column; gap: 10px; }
    nav button { margin: 0; width: 100%; }
    .download-links { flex-direction: column; align-items: center; }
    .page { padding: 20px; margin: 10px; }
    h1 { font-size: 2em; }
}
