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

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background: #f5f5f5;
    color: #333;
    line-height: 1.6;
}

.container {
    max-width: 640px;
    margin: 0 auto;
    padding: 20px 16px;
}

h1 {
    font-size: 1.5rem;
    margin-bottom: 20px;
    text-align: center;
}

h2 {
    font-size: 1.1rem;
    margin: 0;
    display: inline;
}

.section { margin-top: 16px; }

#login-section { text-align: center; margin-top: 40px; }
#login-section p { margin-bottom: 20px; color: #666; }

.user-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    font-size: 0.9rem;
    color: #666;
}

.btn-link {
    color: #666;
    text-decoration: underline;
    background: none;
    border: none;
    cursor: pointer;
    font-size: 0.9rem;
}

label {
    display: block;
    margin-top: 16px;
    margin-bottom: 4px;
    font-weight: 600;
    font-size: 0.9rem;
}

select, input[type="text"], input[type="file"] {
    width: 100%;
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 1rem;
    background: #fff;
}

input[type="file"] { padding: 10px; }

.btn {
    display: inline-block;
    padding: 14px 24px;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    text-align: center;
    text-decoration: none;
    width: 100%;
    margin-top: 20px;
}

.btn-primary { background: #2563eb; color: #fff; }
.btn-primary:hover { background: #1d4ed8; }
.btn-primary:disabled { background: #93c5fd; cursor: not-allowed; }
.btn-secondary { background: #e5e7eb; color: #333; }
.btn-secondary:hover { background: #d1d5db; }

#loading { text-align: center; margin-top: 24px; }
.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #e5e7eb;
    border-top: 4px solid #2563eb;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 12px;
}
@keyframes spin { to { transform: rotate(360deg); } }

.result-card {
    background: #fff;
    border-radius: 8px;
    padding: 16px;
    margin-top: 12px;
    border: 1px solid #e5e7eb;
}

.result-card h1, .result-card h2, .result-card h3 {
    text-align: left;
    margin-top: 16px;
    margin-bottom: 8px;
}
.result-card h1:first-child, .result-card h2:first-child, .result-card h3:first-child {
    margin-top: 0;
}

.result-card p { margin-bottom: 8px; }
.result-card ul, .result-card ol { margin-left: 20px; margin-bottom: 8px; }
.result-card table { width: 100%; border-collapse: collapse; margin: 8px 0; }
.result-card th, .result-card td { text-align: left; padding: 6px 8px; border-bottom: 1px solid #eee; font-size: 0.9rem; }

.result-details { margin-top: 16px; }

.result-details summary {
    cursor: pointer;
    padding: 12px 16px;
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    list-style: none;
}
.result-details summary::-webkit-details-marker { display: none; }
.result-details summary::before { content: "▶ "; font-size: 0.8rem; }
.result-details[open] summary::before { content: "▼ "; }

.json-block {
    background: #1e1e1e;
    color: #d4d4d4;
    padding: 12px;
    border-radius: 8px;
    overflow-x: auto;
    font-size: 0.75rem;
    max-height: 400px;
    overflow-y: auto;
    margin-top: 12px;
    white-space: pre-wrap;
    word-break: break-all;
}

.error-card {
    background: #fef2f2;
    border: 1px solid #fecaca;
    border-radius: 8px;
    padding: 16px;
    text-align: center;
}
.error-card p { color: #991b1b; margin-bottom: 12px; }

.toast {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%);
    background: #333;
    color: #fff;
    padding: 12px 24px;
    border-radius: 8px;
    font-size: 0.9rem;
    z-index: 100;
}
