* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Microsoft YaHei', sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 20px;
    color: #333;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    background: white;
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    overflow: hidden;
}

header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 40px;
    text-align: center;
}

header h1 {
    font-size: 2.5em;
    margin-bottom: 10px;
    font-weight: 700;
}

.subtitle {
    font-size: 1.1em;
    opacity: 0.9;
}

main {
    padding: 40px;
}

.upload-section {
    margin-bottom: 30px;
}

.type-select {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 20px;
    padding: 14px 18px;
    border-radius: 14px;
    background: linear-gradient(120deg, rgba(102,126,234,0.08), rgba(118,75,162,0.06));
    border: 1px solid rgba(102, 126, 234, 0.25);
    box-shadow: 0 8px 20px rgba(102, 126, 234, 0.15);
}

.type-label {
    font-weight: 600;
    color: #222;
    font-size: 0.98em;
}

.type-select-input {
    padding: 10px 32px 10px 14px;
    border-radius: 999px;
    border: 1px solid rgba(102, 126, 234, 0.9);
    background: #ffffff;
    font-size: 0.95em;
    cursor: pointer;
    min-width: 210px;
    color: #333;
    appearance: none;
    -moz-appearance: none;
    -webkit-appearance: none;
    background-image: linear-gradient(45deg, transparent 50%, #667eea 50%), linear-gradient(135deg, #667eea 50%, transparent 50%);
    background-position: calc(100% - 18px) 50%, calc(100% - 13px) 50%;
    background-size: 6px 6px, 6px 6px;
    background-repeat: no-repeat;
    box-shadow: 0 4px 10px rgba(102, 126, 234, 0.25);
}

.type-select-native {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    border: 0;
    white-space: nowrap;
}

.type-select-custom {
    position: relative;
    min-width: 210px;
}

.type-trigger {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 10px 14px 10px 14px;
    border-radius: 999px;
    border: 1px solid rgba(102, 126, 234, 0.9);
    background: #ffffff;
    color: #333;
    font-size: 0.95em;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 4px 10px rgba(102, 126, 234, 0.25);
    transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}

.type-trigger::after {
    content: "";
    width: 10px;
    height: 10px;
    margin-left: auto;
    border-right: 2px solid #667eea;
    border-bottom: 2px solid #667eea;
    transform: rotate(45deg);
    opacity: 0.95;
}

.type-select-custom.is-open .type-trigger::after {
    transform: rotate(-135deg);
}

.type-trigger:hover {
    transform: translateY(-1px);
    box-shadow: 0 10px 24px rgba(102, 126, 234, 0.28);
}

.type-trigger:focus-visible {
    outline: 2px solid #667eea;
    outline-offset: 3px;
}

.type-menu {
    position: absolute;
    top: calc(100% + 10px);
    left: 0;
    right: 0;
    padding: 8px;
    margin: 0;
    list-style: none;
    background: rgba(255, 255, 255, 0.98);
    border: 1px solid rgba(102, 126, 234, 0.22);
    border-radius: 16px;
    box-shadow: 0 18px 40px rgba(31, 38, 135, 0.18);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    display: none;
    z-index: 50;
}

.type-select-custom.is-open .type-menu {
    display: block;
}

.type-option {
    padding: 10px 12px;
    border-radius: 12px;
    cursor: pointer;
    font-weight: 600;
    color: #2a2a2a;
    transition: background 0.15s ease, transform 0.15s ease;
}

.type-option:hover {
    background: rgba(102, 126, 234, 0.12);
}

.type-option.is-selected {
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.18), rgba(118, 75, 162, 0.14));
    border: 1px solid rgba(102, 126, 234, 0.22);
}

.type-select-input:focus-visible {
    outline: 2px solid #667eea;
    outline-offset: 2px;
}

@media (max-width: 520px) {
    .type-select {
        flex-direction: column;
        align-items: flex-start;
    }

    .type-select-input,
    .type-select-custom {
        width: 100%;
    }
}

.upload-area {
    border: 3px dashed #667eea;
    border-radius: 12px;
    padding: 60px 20px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    background: #f8f9ff;
}

.upload-area:hover {
    border-color: #764ba2;
    background: #f0f2ff;
    transform: translateY(-2px);
}

.upload-area.dragover {
    border-color: #764ba2;
    background: #e8ebff;
    transform: scale(1.02);
}

.upload-content svg {
    color: #667eea;
    margin-bottom: 20px;
}

.upload-text {
    font-size: 1.2em;
    font-weight: 600;
    color: #333;
    margin-bottom: 8px;
}

.upload-hint {
    font-size: 0.9em;
    color: #666;
}

.preview-section {
    margin-top: 24px;
    padding: 24px;
    background: #f8f9ff;
    border-radius: 14px;
    border: 1px solid rgba(102, 126, 234, 0.12);
}

.preview-section h3 {
    margin-bottom: 16px;
    font-size: 1.05em;
    font-weight: 600;
    color: #333;
}

.preview-text {
    margin-bottom: 14px;
    color: #555;
    font-size: 0.95em;
    line-height: 1.4;
}

.image-preview {
    position: relative;
    display: inline-block;
    max-width: 100%;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
}

.image-preview img {
    display: block;
    max-width: 100%;
    max-height: 400px;
    border-radius: 10px;
    vertical-align: middle;
}

.btn-remove {
    position: absolute;
    top: 10px;
    right: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.95);
    border: 1px solid rgba(231, 76, 60, 0.3);
    border-radius: 50%;
    width: 36px;
    height: 36px;
    cursor: pointer;
    font-size: 22px;
    font-weight: 300;
    line-height: 1;
    color: #e74c3c;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    transition: all 0.2s ease;
}

.btn-remove:hover {
    background: #fff;
    border-color: #e74c3c;
    transform: scale(1.08);
    box-shadow: 0 3px 12px rgba(231, 76, 60, 0.25);
}

.action-buttons {
    margin-top: 30px;
    display: flex;
    gap: 15px;
    justify-content: center;
}

.url-upload {
    margin-top: 24px;
    display: flex;
    gap: 12px;
    align-items: center;
    width: 100%;
    max-width: 860px;
    margin-left: auto;
    margin-right: auto;
    padding: 10px 14px;
    border-radius: 999px;
    border: 2px solid #8aa2ff;
    background: #f8f9ff;
}

.url-input {
    flex: 1 1 auto;
    min-width: 0;
    padding: 8px 4px;
    border-radius: 999px;
    border: none;
    background: transparent;
    font-size: 0.98em;
    outline: none;
}

.url-input:focus-visible {
    border: none;
    box-shadow: none;
}

.btn {
    padding: 12px 28px;
    font-size: 1em;
    font-weight: 600;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.25s ease;
}

.btn:focus-visible {
    outline: 2px solid #667eea;
    outline-offset: 2px;
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.btn-primary:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
}

.btn-primary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-secondary {
    background: #6c757d;
    color: white;
}

.btn-secondary:hover {
    background: #5a6268;
    transform: translateY(-2px);
}

.btn-danger {
    background: #e74c3c;
    color: white;
}

.btn-danger:hover {
    background: #c0392b;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(231, 76, 60, 0.4);
}

.btn-remove:focus-visible {
    outline: 2px solid #e74c3c;
    outline-offset: 2px;
}

.loading-section {
    text-align: center;
    padding: 60px 20px;
}

.spinner {
    border: 4px solid #f3f3f3;
    border-top: 4px solid #667eea;
    border-radius: 50%;
    width: 50px;
    height: 50px;
    animation: spin 1s linear infinite;
    margin: 0 auto 20px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.loading-section p {
    color: #666;
    font-size: 1.1em;
}

.loading-hint {
    font-size: 0.9em;
    color: #999;
    margin-top: 10px;
}

.result-section {
    margin-top: 28px;
    padding: 28px 32px;
    background: #f8f9ff;
    border-radius: 14px;
    border: 1px solid rgba(102, 126, 234, 0.12);
}

.result-section h2 {
    margin-bottom: 18px;
    font-size: 1.25em;
    font-weight: 600;
    color: #333;
}

.result-actions {
    margin-bottom: 20px;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
}

.copy-tip {
    font-size: 0.9em;
    color: #27ae60;
    font-weight: 500;
    animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.result-content {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

@media (max-width: 768px) {
    .result-content {
        grid-template-columns: 1fr;
    }
}

.result-table {
    background: white;
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.result-table table {
    width: 100%;
    border-collapse: collapse;
}

.result-table th,
.result-table td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid #eee;
}

.result-table th {
    background: #f8f9ff;
    font-weight: 600;
    color: #667eea;
    width: 30%;
}

.result-table tr:hover {
    background: #f8f9ff;
}

.result-json {
    background: #2d2d2d;
    color: #f8f8f2;
    padding: 20px;
    border-radius: 8px;
    overflow-x: auto;
    font-family: 'Courier New', monospace;
    font-size: 0.9em;
    line-height: 1.6;
    max-height: 500px;
    overflow-y: auto;
}

.error-section {
    margin-top: 24px;
    padding: 18px 20px;
    background: #fef5f5;
    border-radius: 12px;
    border: 1px solid rgba(231, 76, 60, 0.2);
    border-left: 4px solid #e74c3c;
}

.error-message {
    color: #c0392b;
    font-weight: 500;
    font-size: 0.98em;
}

footer {
    background: #f8f9ff;
    padding: 20px;
    text-align: center;
    color: #666;
    font-size: 0.9em;
}
