:root {
    --primary: #0d9488;
    --primary-hover: #0f766e;
    --primary-light: #ccfbf1;
    --bg: #f0fdf4;
    --card-bg: #ffffff;
    --text: #1c1e21;
    --text-secondary: #65676b;
    --border: #d1d5db;
    --error: #dc2626;
    --error-bg: #fef2f2;
    --success: #16a34a;
    --radius: 10px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.5;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 2rem 1rem;
}

.container { width: 100%; max-width: 800px; }

header { text-align: center; margin-bottom: 2rem; }
header h1 { font-size: 1.75rem; font-weight: 700; color: var(--primary); }
header p { color: var(--text-secondary); font-size: 0.95rem; margin-top: 0.25rem; }

.card {
    background: var(--card-bg);
    border-radius: var(--radius);
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}

/* Tabs */
.tabs { display: flex; border-bottom: 2px solid var(--border); margin-bottom: 1.25rem; }
.tab {
    padding: 0.5rem 1rem;
    cursor: pointer;
    font-weight: 500;
    color: var(--text-secondary);
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    transition: all 0.2s;
    background: none;
    border-top: none; border-left: none; border-right: none;
    font-size: 0.9rem;
}
.tab.active { color: var(--primary); border-bottom-color: var(--primary); }

.tab-content { display: none; }
.tab-content.active { display: block; }

/* Upload zone */
.upload-zone {
    border: 2px dashed var(--border);
    border-radius: var(--radius);
    padding: 2rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
    color: var(--text-secondary);
}
.upload-zone:hover, .upload-zone.dragover {
    border-color: var(--primary);
    background: var(--primary-light);
}
.upload-zone svg { display: block; margin: 0 auto 0.75rem; }
.upload-zone p { font-size: 0.9rem; }
.upload-zone .browse { color: var(--primary); font-weight: 600; }

.file-info {
    display: none;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    background: var(--primary-light);
    border-radius: var(--radius);
    margin-top: 1rem;
    font-size: 0.85rem;
}
.file-info.visible { display: flex; }
.file-info .name { flex: 1; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-info .remove {
    background: none; border: none; cursor: pointer;
    color: var(--text-secondary); font-size: 1.1rem; padding: 0 0.25rem;
}

textarea {
    width: 100%;
    min-height: 180px;
    padding: 0.75rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-family: 'Courier New', monospace;
    font-size: 0.8rem;
    resize: vertical;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    width: 100%;
    padding: 0.75rem 1.5rem;
    background: var(--primary);
    color: #fff;
    border: none;
    border-radius: var(--radius);
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
    margin-top: 1rem;
}
.btn:hover { background: var(--primary-hover); }
.btn:disabled { opacity: 0.6; cursor: not-allowed; }

.spinner {
    display: none;
    width: 18px; height: 18px;
    border: 2px solid rgba(255,255,255,0.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.error-msg {
    display: none;
    padding: 0.75rem 1rem;
    background: var(--error-bg);
    color: var(--error);
    border-radius: var(--radius);
    font-size: 0.85rem;
    margin-top: 1rem;
}
.error-msg.visible { display: block; }

/* Results */
#results { display: none; }
#results.visible { display: block; }

.summary {
    text-align: center;
    padding: 1rem;
    background: var(--primary-light);
    border-radius: var(--radius);
    margin-bottom: 1.25rem;
    font-size: 0.95rem;
}
.summary strong { color: var(--primary); }

.result-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.result-card {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1rem;
}
.result-card h3 {
    font-size: 0.95rem;
    margin-bottom: 0.25rem;
}
.result-card .meta {
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-bottom: 0.75rem;
}
.result-card .actions { display: flex; gap: 0.5rem; }
.result-card .actions button {
    flex: 1;
    padding: 0.4rem 0.5rem;
    border-radius: 6px;
    font-size: 0.8rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    border: 1px solid var(--border);
    background: var(--card-bg);
    color: var(--text);
}
.result-card .actions button:hover { border-color: var(--primary); color: var(--primary); }
.result-card .actions button.copied {
    background: var(--success);
    color: #fff;
    border-color: var(--success);
}

@media (max-width: 640px) {
    body { padding: 1rem 0.75rem; }
    header h1 { font-size: 1.4rem; }
    .card { padding: 1rem; }
    .result-grid { grid-template-columns: 1fr; }
    .upload-zone { padding: 1.25rem; }
}
