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

:root {
    --primary-color: #4F46E5;
    --primary-hover: #4338CA;
    --secondary-color: #64748B;
    --success-color: #10B981;
    --warning-color: #F59E0B;
    --danger-color: #EF4444;
    --background: #F8FAFC;
    --surface: #FFFFFF;
    --text-primary: #1E293B;
    --text-secondary: #64748B;
    --border-color: #E2E8F0;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 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);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background-color: var(--background);
    color: var(--text-primary);
    line-height: 1.6;
}

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

/* ヘッダー */
header {
    text-align: center;
    margin-bottom: 40px;
    padding: 40px 0;
}

h1 {
    font-size: 3rem;
    font-weight: 800;
    color: var(--primary-color);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
    margin-bottom: 10px;
}

.icon {
    font-size: 3.5rem;
    animation: bounce 2s infinite;
}

@keyframes bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

.subtitle {
    font-size: 1.25rem;
    color: var(--text-secondary);
    font-weight: 500;
}

/* メインコンテンツ */
main {
    background: var(--surface);
    border-radius: 16px;
    padding: 30px;
    box-shadow: var(--shadow-md);
}

/* コントロールパネル */
.control-panel {
    margin-bottom: 30px;
    display: flex;
    flex-direction: column;
    gap: 20px;
    align-items: center;
}

.btn {
    padding: 12px 30px;
    font-size: 1.1rem;
    font-weight: 600;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.btn-primary {
    background-color: var(--primary-color);
    color: white;
}

.btn-primary:hover {
    background-color: var(--primary-hover);
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.btn-secondary {
    background-color: var(--secondary-color);
    color: white;
}

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

/* 設定パネル */
.settings {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
    justify-content: center;
}

.setting-item {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 500;
}

.setting-item input[type="checkbox"] {
    width: 20px;
    height: 20px;
    cursor: pointer;
}

.setting-item select {
    padding: 8px 12px;
    border: 2px solid var(--border-color);
    border-radius: 6px;
    font-size: 1rem;
    background-color: var(--surface);
    cursor: pointer;
    transition: border-color 0.3s;
}

.setting-item select:focus {
    outline: none;
    border-color: var(--primary-color);
}

/* ビデオコンテナ */
.video-container {
    position: relative;
    width: 100%;
    max-width: 640px;
    margin: 0 auto 30px;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: var(--shadow-lg);
}

#videoElement, #canvasElement {
    width: 100%;
    height: auto;
    display: block;
}

#canvasElement {
    position: absolute;
    top: 0;
    left: 0;
}

/* ステータスオーバーレイ */
.status-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: white;
    z-index: 10;
}

.status-icon {
    font-size: 4rem;
    margin-bottom: 20px;
}

.status-text {
    font-size: 1.5rem;
    font-weight: 600;
}

.status-good .status-overlay {
    background: rgba(16, 185, 129, 0.2);
}

.status-warning .status-overlay {
    background: rgba(245, 158, 11, 0.2);
}

.status-bad .status-overlay {
    background: rgba(239, 68, 68, 0.2);
}

/* 統計パネル */
.stats-panel {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.stat-item {
    background: var(--background);
    padding: 20px;
    border-radius: 12px;
    text-align: center;
    transition: transform 0.3s ease;
}

.stat-item:hover {
    transform: translateY(-5px);
}

.stat-label {
    display: block;
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-bottom: 8px;
    font-weight: 500;
}

.stat-value {
    display: block;
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--text-primary);
}

.posture-good {
    color: var(--success-color);
}

.posture-warning {
    color: var(--warning-color);
}

.posture-bad {
    color: var(--danger-color);
}

/* ヒントセクション */
.tips-section {
    background: var(--background);
    padding: 30px;
    border-radius: 12px;
    margin-top: 30px;
}

.tips-section h2 {
    font-size: 1.5rem;
    margin-bottom: 20px;
    color: var(--primary-color);
}

.tips-list {
    list-style: none;
    display: grid;
    gap: 15px;
}

.tips-list li {
    padding-left: 30px;
    position: relative;
    font-size: 1.1rem;
}

.tips-list li::before {
    content: '✅';
    position: absolute;
    left: 0;
    top: 0;
}

/* アラートモーダル */
.alert-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.alert-modal.show {
    opacity: 1;
    visibility: visible;
}

.alert-content {
    background: white;
    padding: 40px;
    border-radius: 16px;
    text-align: center;
    max-width: 400px;
    width: 90%;
    animation: slideIn 0.3s ease;
}

@keyframes slideIn {
    from {
        transform: translateY(-50px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.alert-icon {
    font-size: 4rem;
    display: block;
    margin-bottom: 20px;
}

.alert-content h3 {
    font-size: 1.8rem;
    color: var(--danger-color);
    margin-bottom: 15px;
}

.alert-content p {
    font-size: 1.1rem;
    color: var(--text-secondary);
    margin-bottom: 25px;
}

/* フッター */
footer {
    text-align: center;
    padding: 40px 0;
    color: var(--text-secondary);
}

/* レスポンシブデザイン */
@media (max-width: 768px) {
    h1 {
        font-size: 2rem;
    }
    
    .icon {
        font-size: 2.5rem;
    }
    
    .subtitle {
        font-size: 1rem;
    }
    
    main {
        padding: 20px;
    }
    
    .settings {
        flex-direction: column;
        align-items: center;
    }
    
    .stats-panel {
        grid-template-columns: 1fr 1fr;
    }
    
    .tips-section {
        padding: 20px;
    }
    
    .alert-content {
        padding: 30px 20px;
    }
}

@media (max-width: 480px) {
    .stats-panel {
        grid-template-columns: 1fr;
    }
    
    .btn {
        padding: 10px 20px;
        font-size: 1rem;
    }
    
    .tips-list li {
        font-size: 1rem;
    }
}