/* 全体のスタイル */
:root {
    --primary-color: #4285f4;
    --secondary-color: #34a853;
    --warning-color: #fbbc05;
    --danger-color: #ea4335;
    --light-color: #f8f9fa;
    --dark-color: #202124;
    --gray-color: #5f6368;
    --light-gray-color: #dadce0;
}

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

body {
    font-family: 'Hiragino Sans', 'Hiragino Kaku Gothic ProN', 'Noto Sans JP', sans-serif;
    line-height: 1.6;
    color: var(--dark-color);
    background-color: var(--light-color);
}

.app-container {
    max-width: 100%;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

header {
    background-color: var(--primary-color);
    color: white;
    text-align: center;
    padding: 1.5rem 1rem;
}

header h1 {
    font-size: 1.8rem;
    margin-bottom: 0.5rem;
}

.subtitle {
    font-size: 1rem;
    opacity: 0.9;
}

main {
    flex: 1;
    padding: 1rem;
    max-width: 800px;
    margin: 0 auto;
    width: 100%;
}

footer {
    text-align: center;
    padding: 1rem;
    background-color: var(--light-gray-color);
    color: var(--gray-color);
    font-size: 0.8rem;
}

/* ボタンスタイル */
.primary-btn, .secondary-btn {
    display: block;
    width: 100%;
    padding: 1rem;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    margin: 1rem 0;
}

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

.secondary-btn {
    background-color: var(--light-gray-color);
    color: var(--dark-color);
}

.primary-btn:hover {
    background-color: #3367d6;
}

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

/* 画面管理 */
.screen {
    display: none;
}

.screen.active {
    display: block;
}

/* ホーム画面 */
.intro-text {
    margin-bottom: 2rem;
}

.intro-text h2 {
    margin-bottom: 1rem;
    color: var(--primary-color);
}

.features-list {
    list-style-type: none;
    margin: 1rem 0;
}

.features-list li {
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--light-gray-color);
}

.features-list li:last-child {
    border-bottom: none;
}

.disclaimer {
    font-size: 0.8rem;
    color: var(--gray-color);
    margin-top: 1rem;
}

/* カメラ画面 */
.camera-container {
    position: relative;
    width: 100%;
    height: 0;
    padding-bottom: 100%; /* 正方形のビューポート */
    background-color: #000;
    overflow: hidden;
    border-radius: 8px;
}

#video, #face-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

#face-overlay {
    z-index: 2;
}

#face-guide {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 3;
    text-align: center;
    color: white;
}

.face-outline {
    width: 200px;
    height: 200px;
    border: 2px dashed white;
    border-radius: 50%;
    margin: 0 auto 1rem;
}

.camera-controls {
    margin-top: 1rem;
    text-align: center;
}

#camera-instruction {
    margin-bottom: 1rem;
}

#countdown {
    font-size: 3rem;
    font-weight: bold;
    color: var(--primary-color);
    margin: 1rem 0;
}

.hidden {
    display: none;
}

/* 分析中画面 */
#analyzing-screen {
    text-align: center;
    padding: 2rem 0;
}

.loader {
    margin: 2rem auto;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 5px solid var(--light-gray-color);
    border-top: 5px solid var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.progress-bar {
    width: 100%;
    height: 10px;
    background-color: var(--light-gray-color);
    border-radius: 5px;
    margin: 2rem 0;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background-color: var(--primary-color);
    width: 0%;
    animation: progress 3s ease-in-out forwards;
}

@keyframes progress {
    0% { width: 0%; }
    100% { width: 100%; }
}

/* 結果画面 */
.results-summary {
    text-align: center;
    margin-bottom: 2rem;
}

.overall-score {
    margin: 1.5rem 0;
}

.score-circle {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    background-color: var(--primary-color);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1rem;
    font-size: 2.5rem;
    font-weight: bold;
}

.detailed-results h3, .advice-section h3 {
    margin-bottom: 1rem;
    color: var(--primary-color);
}

.metrics-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
    margin-bottom: 2rem;
}

.metric-card {
    background-color: white;
    border-radius: 8px;
    padding: 1rem;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

.metric-card h4 {
    font-size: 0.9rem;
    color: var(--gray-color);
    margin-bottom: 0.5rem;
}

.metric-value {
    font-size: 1.2rem;
    font-weight: bold;
    margin-bottom: 0.5rem;
}

.metric-value span {
    font-size: 0.8rem;
    font-weight: normal;
}

.metric-status {
    display: inline-block;
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    font-size: 0.8rem;
}

.metric-status.normal {
    background-color: var(--secondary-color);
    color: white;
}

.metric-status.warning {
    background-color: var(--warning-color);
    color: var(--dark-color);
}

.metric-status.danger {
    background-color: var(--danger-color);
    color: white;
}

.advice-section {
    background-color: white;
    border-radius: 8px;
    padding: 1.5rem;
    margin-bottom: 2rem;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

/* 履歴画面 */
.history-filters {
    margin-bottom: 1.5rem;
}

.history-filters select {
    width: 100%;
    padding: 0.8rem;
    border: 1px solid var(--light-gray-color);
    border-radius: 4px;
    font-size: 1rem;
}

.history-chart {
    margin-bottom: 2rem;
    height: 300px;
}

.history-list {
    margin-bottom: 1.5rem;
}

/* レスポンシブデザイン */
@media (min-width: 768px) {
    header h1 {
        font-size: 2.2rem;
    }
    
    .subtitle {
        font-size: 1.2rem;
    }
    
    .metrics-grid {
        grid-template-columns: repeat(3, 1fr);
    }
    
    .action-buttons {
        display: flex;
        gap: 1rem;
    }
    
    .action-buttons button {
        flex: 1;
    }
}
