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

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background-color: #f5f6f8;
    color: #1a1a1a;
    line-height: 1.6;
    min-height: 100vh;
}

.container {
    max-width: 720px;
    margin: 0 auto;
    padding: 2rem 1rem;
}

.card {
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08), 0 4px 12px rgba(0,0,0,0.04);
    padding: 2rem;
}

h1 {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 0.25rem;
}

.subtitle {
    color: #555;
    font-size: 0.9rem;
    margin-bottom: 1.5rem;
}

.subtitle a {
    color: #2563eb;
    text-decoration: none;
}

.subtitle a:hover {
    text-decoration: underline;
}

.disclaimer {
    background: #fef3c7;
    border: 1px solid #f59e0b;
    border-radius: 8px;
    padding: 0.75rem 1rem;
    font-size: 0.85rem;
    color: #92400e;
    margin-bottom: 1.5rem;
}

.form-group {
    margin-bottom: 1.25rem;
}

label {
    display: block;
    font-weight: 600;
    font-size: 0.875rem;
    margin-bottom: 0.375rem;
    color: #333;
}

select, input[type="text"], input[type="password"], textarea {
    width: 100%;
    padding: 0.625rem 0.75rem;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 0.9rem;
    font-family: inherit;
    background: #fff;
    transition: border-color 0.15s;
}

select:focus, input:focus, textarea:focus {
    outline: none;
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37,99,235,0.1);
}

textarea {
    resize: vertical;
    min-height: 180px;
}

input[type="file"] {
    font-size: 0.85rem;
    margin-bottom: 0.5rem;
}

.hint {
    display: block;
    font-size: 0.78rem;
    color: #6b7280;
    margin-top: 0.25rem;
}

.security-hint {
    color: #059669;
}

.model-custom-input {
    margin-top: 0.5rem;
}

button {
    display: block;
    width: 100%;
    padding: 0.75rem;
    font-size: 0.95rem;
    font-weight: 600;
    font-family: inherit;
    color: #fff;
    background-color: #2563eb;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: background-color 0.15s;
}

button:hover {
    background-color: #1d4ed8;
}

button:disabled {
    background-color: #93c5fd;
    cursor: not-allowed;
}

.btn-secondary {
    background-color: #f3f4f6;
    color: #1a1a1a;
    border: 1px solid #d1d5db;
    flex: 1;
}

.btn-secondary:hover {
    background-color: #e5e7eb;
}

.spinner {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    padding: 1.5rem 0;
    color: #555;
    font-size: 0.9rem;
}

.spinner-ring {
    width: 24px;
    height: 24px;
    border: 3px solid #e5e7eb;
    border-top-color: #2563eb;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.error-message {
    background: #fef2f2;
    border: 1px solid #ef4444;
    border-radius: 8px;
    padding: 0.75rem 1rem;
    color: #991b1b;
    font-size: 0.875rem;
    margin-top: 1rem;
}

#resultSection {
    margin-top: 1.5rem;
}

#jsonOutput {
    background: #f8f9fa;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 1rem;
    font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
    font-size: 0.8rem;
    line-height: 1.5;
    white-space: pre-wrap;
    word-wrap: break-word;
    max-height: 500px;
    overflow-y: auto;
    margin-bottom: 0.75rem;
}

.result-actions {
    display: flex;
    gap: 0.5rem;
}

@media (max-width: 600px) {
    .card {
        padding: 1.25rem;
    }
    .result-actions {
        flex-direction: column;
    }
}
