* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #4F46E5;
    --primary-light: #EEF2FF;
    --success-color: #10B981;
    --warning-color: #F59E0B;
    --danger-color: #EF4444;
    --bg-color: #F8FAFC;
    --card-bg: #FFFFFF;
    --text-primary: #1E293B;
    --text-secondary: #64748B;
    --border-color: #E2E8F0;
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px 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);
    --shoulder-color: #EF4444;
    --spine-color: #3B82F6;
    --leg-color: #10B981;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    -webkit-tap-highlight-color: transparent;
}

.container {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.header {
    text-align: center;
    padding: 2rem 1rem;
    background: linear-gradient(135deg, var(--primary-color) 0%, #7C3AED 100%);
    color: white;
}

.logo-section {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    margin-bottom: 1rem;
}

.logo-icon {
    font-size: 3rem;
    animation: float 3s ease-in-out infinite;
}

@keyframes float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-5px); }
}

.logo-text {
    text-align: left;
}

.title {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 0.25rem;
}

.subtitle {
    font-size: 1.1rem;
    opacity: 0.9;
}

.disclaimer-banner {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    background: rgba(255, 255, 255, 0.2);
    padding: 0.75rem 1.5rem;
    border-radius: 9999px;
    max-width: 90%;
    margin: 0 auto;
    font-size: 0.9rem;
    flex-wrap: wrap;
}

.disclaimer-icon {
    font-size: 1rem;
}

.main-content {
    flex: 1;
    padding: 2rem 1rem;
    max-width: 1200px;
    margin: 0 auto;
    width: 100%;
}

.upload-section {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 50vh;
}

.upload-area {
    width: 100%;
    max-width: 600px;
    padding: 3rem 2rem;
    background: var(--card-bg);
    border: 2px dashed var(--border-color);
    border-radius: 1rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
}

.upload-area:hover {
    border-color: var(--primary-color);
    background: var(--primary-light);
    transform: translateY(-2px);
}

.upload-area.dragover {
    border-color: var(--primary-color);
    background: var(--primary-light);
    box-shadow: var(--shadow-lg);
}

.upload-icon {
    font-size: 4rem;
    margin-bottom: 1rem;
}

.upload-title {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 1rem;
}

.shooting-guide {
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
    background: #FEF3C7;
    border-radius: 0.75rem;
    padding: 1rem;
    margin-bottom: 1.5rem;
    text-align: left;
}

.guide-icon {
    font-size: 1.25rem;
    flex-shrink: 0;
}

.guide-text {
    color: #92400E;
    font-size: 0.9rem;
    line-height: 1.5;
}

.upload-hint {
    color: var(--text-secondary);
    font-size: 1rem;
    margin-bottom: 0.25rem;
}

.upload-hint.small {
    font-size: 0.875rem;
}

.processing-section {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 50vh;
    gap: 1.5rem;
}

.loading-spinner {
    width: 64px;
    height: 64px;
    border: 4px solid var(--border-color);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.loading-text {
    font-size: 1.25rem;
    font-weight: 500;
    color: var(--text-primary);
}

.progress-bar {
    width: 100%;
    max-width: 400px;
    height: 8px;
    background: var(--border-color);
    border-radius: 9999px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary-color), #7C3AED);
    border-radius: 9999px;
    width: 0%;
    transition: width 0.3s ease;
}

.progress-text {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.result-section {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.result-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
}

.result-title {
    font-size: 1.75rem;
    font-weight: 600;
    color: var(--text-primary);
}

.header-buttons {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.restart-btn {
    padding: 0.75rem 1.5rem;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 0.5rem;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.restart-btn:hover {
    background: #4338CA;
    transform: translateY(-1px);
}

.history-btn {
    padding: 0.75rem 1.5rem;
    background: var(--card-bg);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.history-btn:hover {
    background: var(--primary-light);
    border-color: var(--primary-color);
}

.status-card {
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--card-bg);
    border-radius: 1rem;
    padding: 2rem;
    box-shadow: var(--shadow);
}

.status-content {
    text-align: center;
}

.status-badge {
    display: inline-block;
    padding: 0.5rem 1.5rem;
    border-radius: 9999px;
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.status-badge.evaluating {
    background: #E0E7FF;
    color: #4338CA;
}

.status-badge.good {
    background: #D1FAE5;
    color: #065F46;
}

.status-badge.normal {
    background: #FEF3C7;
    color: #92400E;
}

.status-badge.warning {
    background: #FEE2E2;
    color: #991B1B;
}

.status-badge.error {
    background: #F3F4F6;
    color: #6B7280;
}

.status-text {
    font-size: 1rem;
    color: var(--text-secondary);
}

.result-content {
    display: grid;
    grid-template-columns: 1fr;
    gap: 2rem;
}

@media (min-width: 900px) {
    .result-content {
        grid-template-columns: 1fr 1fr;
    }
}

.image-container {
    background: var(--card-bg);
    border-radius: 1rem;
    padding: 1.5rem;
    box-shadow: var(--shadow);
    display: flex;
    justify-content: center;
    align-items: center;
    border: 1px solid var(--border-color);
    position: relative;
    overflow: hidden;
}

.image-container::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, var(--primary-color), #7C3AED);
}

#result-canvas {
    display: block;
    max-width: 100%;
    height: auto;
    border-radius: 0.75rem;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

.analysis-cards {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.summary-card {
    background: var(--card-bg);
    border-radius: 1rem;
    padding: 1.5rem;
    box-shadow: var(--shadow);
    border-left: 4px solid var(--primary-color);
}

.summary-icon {
    font-size: 2rem;
    margin-bottom: 0.5rem;
}

.summary-card h3 {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

.summary-card p {
    color: var(--text-secondary);
    font-size: 0.95rem;
}

.issues-container {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.overall-suggestions {
    margin-top: 1rem;
}

.issue-card {
    background: var(--card-bg);
    border-radius: 1rem;
    padding: 1.75rem;
    box-shadow: var(--shadow);
    border-left: 4px solid var(--warning-color);
    border-bottom: 1px solid var(--border-color);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.issue-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.overall-suggestions-card {
    background: linear-gradient(135deg, #EEF2FF 0%, #F3E8FF 100%);
    border-radius: 1rem;
    padding: 1.75rem;
    border: 1px solid #E0E7FF;
    margin-top: 1.5rem;
}

.issue-card.success {
    border-left-color: var(--success-color);
}

.issue-card.warning {
    border-left-color: var(--warning-color);
}

.issue-card.danger {
    border-left-color: var(--danger-color);
}

.issue-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1rem;
    flex-wrap: wrap;
}

.issue-icon {
    font-size: 1.25rem;
}

.issue-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-primary);
    flex: 1;
}

.issue-value-badge {
    display: inline-block;
    background: var(--bg-color);
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.8rem;
    font-weight: 600;
    white-space: nowrap;
}

.issue-value-badge.warning {
    background: #FEF3C7;
    color: #92400E;
}

.issue-value-badge.success {
    background: #D1FAE5;
    color: #065F46;
}

.issue-description {
    color: var(--text-secondary);
    font-size: 0.95rem;
    margin-bottom: 1.25rem;
    line-height: 1.6;
}

.issue-suggestions {
    background: var(--bg-color);
    border-radius: 0.75rem;
    padding: 1.25rem;
}

.issue-suggestions h4 {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.75rem;
}

.issue-suggestions ul {
    list-style: none;
    padding-left: 0;
}

.issue-suggestions li {
    padding-left: 1.25rem;
    position: relative;
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-bottom: 0.5rem;
    line-height: 1.5;
}

.issue-suggestions li:last-child {
    margin-bottom: 0;
}

.issue-suggestions li::before {
    content: '✓';
    position: absolute;
    left: 0;
    color: var(--success-color);
    font-weight: bold;
}

.suggestions-icon {
    font-size: 2rem;
    margin-bottom: 0.5rem;
}

.overall-suggestions-card h3 {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 1rem;
}

.overall-suggestions-card ul {
    list-style: none;
    padding-left: 0;
}

.overall-suggestions-card li {
    padding-left: 1.5rem;
    position: relative;
    color: var(--text-secondary);
    font-size: 0.95rem;
    margin-bottom: 0.75rem;
    line-height: 1.6;
}

.overall-suggestions-card li:last-child {
    margin-bottom: 0;
}

.overall-suggestions-card li::before {
    content: '💡';
    position: absolute;
    left: 0;
    font-size: 0.9rem;
}

.footer {
    background: var(--card-bg);
    border-top: 1px solid var(--border-color);
    padding: 2rem 1rem;
    margin-top: auto;
}

.footer-disclaimer {
    max-width: 1200px;
    margin: 0 auto;
    text-align: center;
    color: var(--text-secondary);
    font-size: 0.875rem;
}

.footer-disclaimer p {
    margin-bottom: 0.5rem;
}

.hidden {
    display: none !important;
}

.section-transition {
    animation: fadeInUp 0.5s ease-out;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.issue-card {
    animation: slideIn 0.3s ease-out backwards;
}

.issue-card:nth-child(1) { animation-delay: 0.1s; }
.issue-card:nth-child(2) { animation-delay: 0.2s; }
.issue-card:nth-child(3) { animation-delay: 0.3s; }
.issue-card:nth-child(4) { animation-delay: 0.4s; }
.issue-card:nth-child(5) { animation-delay: 0.5s; }
.issue-card:nth-child(6) { animation-delay: 0.6s; }

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(-20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    padding: 1rem;
}

.modal-content {
    background: var(--card-bg);
    border-radius: 1rem;
    width: 100%;
    max-width: 500px;
    max-height: 80vh;
    overflow: hidden;
    box-shadow: var(--shadow-lg);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem;
    border-bottom: 1px solid var(--border-color);
}

.modal-header h3 {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-primary);
}

.modal-close {
    width: 32px;
    height: 32px;
    border: none;
    background: var(--bg-color);
    border-radius: 50%;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-close:hover {
    background: var(--border-color);
}

.modal-body {
    padding: 1.5rem;
    max-height: 50vh;
    overflow-y: auto;
}

.modal-footer {
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
}

.modal-confirm {
    padding: 0.75rem 1.5rem;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 0.5rem;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
}

.modal-confirm:hover {
    background: #4338CA;
}

.modal-cancel {
    padding: 0.75rem 1.5rem;
    background: var(--bg-color);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
}

.modal-cancel:hover {
    background: var(--border-color);
}

.guide-steps {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.guide-step {
    display: flex;
    gap: 1rem;
}

.step-number {
    width: 32px;
    height: 32px;
    background: var(--primary-color);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    flex-shrink: 0;
}

.step-content h4 {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.25rem;
}

.step-content p {
    font-size: 0.9rem;
    color: var(--text-secondary);
    line-height: 1.5;
}

.history-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.history-item {
    background: var(--bg-color);
    border-radius: 0.75rem;
    padding: 1rem 1.25rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.history-item-date {
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.history-item-status {
    font-size: 0.95rem;
    font-weight: 600;
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
}

.history-item-status.良好 {
    background: #D1FAE5;
    color: #065F46;
}

.history-item-status.正常 {
    background: #FEF3C7;
    color: #92400E;
}

.history-item-status.需改善 {
    background: #FEE2E2;
    color: #991B1B;
}

.history-item-status.未知 {
    background: #F3F4F6;
    color: #6B7280;
}

.empty-history {
    text-align: center;
    color: var(--text-secondary);
    padding: 2rem;
}

.history-modal-content {
    max-width: 600px;
}

@keyframes pulse-border {
    0%, 100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.7); }
    50% { box-shadow: 0 0 0 10px rgba(239, 68, 68, 0); }
}

.pulse-animation {
    animation: pulse-border 2s infinite;
}

@media (max-width: 768px) {
    .title {
        font-size: 1.75rem;
    }

    .subtitle {
        font-size: 0.95rem;
    }

    .disclaimer-banner {
        font-size: 0.8rem;
        padding: 0.5rem 1rem;
    }

    .upload-area {
        padding: 2rem 1rem;
    }

    .upload-title {
        font-size: 1.25rem;
    }

    .shooting-guide {
        flex-direction: column;
        align-items: flex-start;
    }

    .guide-icon {
        font-size: 1.5rem;
    }

    .guide-text {
        font-size: 0.85rem;
    }

    .result-title {
        font-size: 1.5rem;
    }

    .header-buttons {
        width: 100%;
        justify-content: flex-end;
    }

    .restart-btn, .history-btn {
        padding: 0.6rem 1rem;
        font-size: 0.9rem;
    }

    .status-card {
        padding: 1.5rem 1rem;
    }

    .status-badge {
        font-size: 1.1rem;
        padding: 0.4rem 1rem;
    }

    .status-text {
        font-size: 0.9rem;
    }

    .modal-content {
        max-width: 100%;
        margin: 0.5rem;
    }

    .modal-header, .modal-body, .modal-footer {
        padding: 1rem;
    }

    .guide-step {
        flex-direction: column;
    }

    .step-number {
        align-self: flex-start;
    }

    .issue-card {
        padding: 1.25rem;
    }

    .issue-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .issue-value-badge {
        margin-top: 0.5rem;
    }
}

@media (max-width: 480px) {
    .main-content {
        padding: 1rem 0.5rem;
    }

    .upload-area {
        padding: 1.5rem 1rem;
    }

    .upload-icon {
        font-size: 3rem;
    }

    .status-card {
        padding: 1rem;
    }

    .status-badge {
        font-size: 1rem;
    }
}
