/* ========================================
   PINOこどもクリニック - 統一スタイルシート
   ======================================== */

/* CSS Variables - ティール (#008080) ベース */
:root {
    --color-primary: #008080;
    --color-primary-hover: #006666;
    --color-primary-dark: #004d4d;
    --color-bg-primary: #fff;
    --color-bg-secondary: #f5f5f5;
    --color-text-normal: #333;
    --color-text-secondary: rgba(0, 0, 0, 0.5);
    --color-text-on-primary: #fff;
    --color-border: rgba(0, 0, 0, 0.1);
    --color-danger: #C00000;
    --color-warning: #e67e22;
    --color-success: #27ae60;
    --font-family: "ヒラギノ角ゴ ProN", "Hiragino Kaku Gothic ProN", "メイリオ", Meiryo, sans-serif;
    --radius-button: 0.1rem;
    --radius-card: 8px;
    --shadow-card: 0 2px 8px rgba(0, 0, 0, 0.08);
    --max-width: 800px;
}

/* Reset & Base */
*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: 16px;
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-family);
    font-weight: 500;
    line-height: 1.75;
    color: var(--color-text-normal);
    min-height: 100vh;
    position: relative;
}

/* 月替り背景 */
.bg-seasonal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-size: cover;
    background-position: center;
    background-attachment: fixed;
    z-index: -2;
}

/* ダークオーバーレイ */
.bg-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.45);
    z-index: -1;
}

/* ヘッダー */
.app-header {
    /* background: var(--color-primary); override with aurora */
    background: transparent;
    color: var(--color-text-on-primary);
    padding: 1rem 1.5rem;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    overflow: hidden;
    /* Added for aurora containment */
}

.header-container {
    max-width: var(--max-width);
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.header-icon {
    width: 40px;
    height: 40px;
    background: rgba(255, 255, 255, 0.15);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.header-icon svg {
    width: 24px;
    height: 24px;
    fill: var(--color-text-on-primary);
}

.header-title {
    font-size: 1.1rem;
    font-weight: 700;
    margin: 0;
}

.header-subtitle {
    font-size: 0.75rem;
    opacity: 0.8;
    margin: 0;
}

.btn-home {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.5rem 1rem;
    background: rgba(255, 255, 255, 0.15);
    color: var(--color-text-on-primary);
    text-decoration: none;
    border-radius: var(--radius-button);
    font-size: 0.875rem;
    transition: background 0.2s;
}

.btn-home:hover {
    background: rgba(255, 255, 255, 0.25);
}

/* メインコンテンツ */
.main-content {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 2rem 1rem;
}

/* ボタン */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.875rem 1.5rem;
    border: none;
    border-radius: var(--radius-button);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
}

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

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

.btn-secondary {
    background: var(--color-bg-secondary);
    color: var(--color-text-normal);
    border: 1px solid var(--color-border);
}

.btn-secondary:hover {
    background: #e8e8e8;
}

.btn-outline {
    background: transparent;
    color: var(--color-primary);
    border: 2px solid var(--color-primary);
}

.btn-outline:hover {
    background: var(--color-primary);
    color: var(--color-text-on-primary);
}

/* スタート画面 */
.start-screen {
    min-height: 60vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 2rem;
}

.start-card {
    background: var(--color-bg-primary);
    border-radius: var(--radius-card);
    padding: 3rem 2rem;
    box-shadow: var(--shadow-card);
    max-width: 500px;
}

.start-icon {
    width: 80px;
    height: 80px;
    background: var(--color-primary);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1.5rem;
}

.start-icon svg {
    width: 40px;
    height: 40px;
    fill: var(--color-text-on-primary);
}

.start-title {
    font-size: 1.5rem;
    color: var(--color-primary);
    margin-bottom: 1rem;
}

.start-desc {
    color: var(--color-text-secondary);
    margin-bottom: 2rem;
}

/* セクション */
.section {
    display: none;
}

.section.active {
    display: block;
}

/* カード */
.card {
    background: var(--color-bg-primary);
    border-radius: var(--radius-card);
    box-shadow: var(--shadow-card);
    margin-bottom: 1.5rem;
    overflow: hidden;
}

.card-body {
    padding: 1.5rem;
}

/* メニューボタン */
.menu-buttons {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.menu-btn {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    padding: 1.25rem 1.5rem;
    background: var(--color-bg-primary);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-card);
    text-align: left;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: var(--shadow-card);
}

.menu-btn:hover {
    border-color: var(--color-primary);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.menu-btn-title {
    font-weight: 700;
    color: var(--color-primary);
    margin-bottom: 0.25rem;
}

.menu-btn-desc {
    font-size: 0.85rem;
    color: var(--color-text-secondary);
}

/* 質問ボタン */
.question-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.75rem;
}

.question-btn {
    padding: 1rem;
    background: var(--color-bg-primary);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-card);
    font-size: 0.9rem;
    font-weight: 600;
    text-align: left;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: var(--shadow-card);
}

.question-btn:hover {
    border-color: var(--color-primary);
    background: var(--color-bg-secondary);
}

/* 回答カード */
.answer-card {
    background: var(--color-bg-primary);
    border-radius: var(--radius-card);
    padding: 1.5rem;
    box-shadow: var(--shadow-card);
}

.answer-title {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--color-primary);
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid var(--color-primary);
}

.answer-text {
    color: var(--color-text-normal);
    margin-bottom: 1rem;
}

/* 詳細ボタン */
.details-toggle {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background: var(--color-bg-secondary);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-button);
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s;
}

.details-toggle:hover {
    background: #e8e8e8;
}

.details-content {
    display: none;
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--color-border);
}

.details-content.active {
    display: block;
}

/* データ表示 */
.data-card {
    background: var(--color-bg-secondary);
    border-radius: var(--radius-card);
    padding: 1.25rem;
    margin-bottom: 1rem;
}

.data-title {
    font-weight: 700;
    margin-bottom: 0.75rem;
    color: var(--color-primary);
}

.bar-chart {
    margin: 1rem 0;
}

.bar-item {
    margin-bottom: 0.75rem;
}

.bar-label {
    font-size: 0.85rem;
    margin-bottom: 0.25rem;
}

.bar-container {
    height: 24px;
    background: #e0e0e0;
    border-radius: 4px;
    overflow: hidden;
    display: flex;
    align-items: center;
}

.bar-fill {
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    padding-right: 0.5rem;
    color: #fff;
    font-size: 0.75rem;
    font-weight: 600;
    min-width: fit-content;
}

.bar-fill.danger {
    background: var(--color-danger);
}

.bar-fill.warning {
    background: var(--color-warning);
}

.bar-fill.success {
    background: var(--color-success);
}

.bar-fill.primary {
    background: var(--color-primary);
}

.bar-value {
    margin-left: 0.5rem;
    font-size: 0.85rem;
    font-weight: 600;
}

/* テーブル */
.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

.data-table th,
.data-table td {
    padding: 0.75rem;
    border: 1px solid var(--color-border);
    text-align: left;
}

.data-table th {
    background: var(--color-bg-secondary);
    font-weight: 600;
}

/* チェックリスト */
.checklist {
    list-style: none;
}

.checklist li {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    margin-bottom: 1rem;
    padding: 1rem;
    background: var(--color-bg-secondary);
    border-radius: var(--radius-card);
}

.checklist-number {
    width: 28px;
    height: 28px;
    background: var(--color-primary);
    color: var(--color-text-on-primary);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.85rem;
    flex-shrink: 0;
}

.checklist-title {
    font-weight: 600;
    color: var(--color-primary);
    margin-bottom: 0.25rem;
}

.checklist-desc {
    font-size: 0.9rem;
    color: var(--color-text-secondary);
}

/* 比較カード */
.comparison-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
    margin-top: 1rem;
}

.comparison-card {
    padding: 1.25rem;
    border-radius: var(--radius-card);
}

.comparison-card.healthy {
    background: #e8f5e9;
    border: 1px solid #a5d6a7;
}

.comparison-card.vaccine {
    background: #e3f2fd;
    border: 1px solid #90caf9;
}

.comparison-title {
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.comparison-card.healthy .comparison-title {
    color: var(--color-success);
}

.comparison-card.vaccine .comparison-title {
    color: var(--color-primary);
}

/* ハイライトボックス */
.highlight-box {
    background: #e8f5e9;
    border-left: 4px solid var(--color-success);
    padding: 1rem 1.25rem;
    border-radius: 0 var(--radius-card) var(--radius-card) 0;
    margin: 1rem 0;
}

.highlight-box p {
    margin: 0;
}

/* 動画プレースホルダー */
.video-placeholder {
    background: #222;
    border-radius: var(--radius-card);
    padding: 2rem;
    text-align: center;
    color: #fff;
    margin-top: 1rem;
}

.video-placeholder h4 {
    margin-bottom: 0.5rem;
}

.video-placeholder a {
    color: #90caf9;
}

/* 戻るボタン */
.back-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.75rem 1.25rem;
    background: var(--color-bg-secondary);
    color: var(--color-text-normal);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-button);
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s;
    margin-top: 1.5rem;
}

.back-btn:hover {
    background: #e8e8e8;
}

/* ソース表示 */
.source-note {
    font-size: 0.75rem;
    color: var(--color-text-secondary);
    text-align: right;
    margin-top: 0.75rem;
}

/* フッター */
.app-footer {
    background: #222;
    color: rgba(255, 255, 255, 0.7);
    text-align: center;
    padding: 1.5rem;
    font-size: 0.85rem;
}

/* ユーティリティ */
.hidden {
    display: none !important;
}

.text-center {
    text-align: center;
}

.mb-1 {
    margin-bottom: 1rem;
}

.mb-2 {
    margin-bottom: 1.5rem;
}

/* Chart.js wrapper */
.chart-wrapper {
    max-width: 400px;
    margin: 1rem auto;
}

/* レスポンシブ */
@media (max-width: 640px) {
    html {
        font-size: 14px;
    }

    .header-container {
        flex-wrap: wrap;
    }

    .btn-home {
        order: -1;
        width: 100%;
        justify-content: center;
    }

    .question-grid {
        grid-template-columns: 1fr;
    }

    .comparison-grid {
        grid-template-columns: 1fr;
    }

    .start-card {
        padding: 2rem 1.5rem;
    }
}

/* Aurora Background */
.aurora {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    background: #000;
    z-index: -1;
}

.layer {
    position: absolute;
    width: 200%;
    height: 200%;
    top: -50%;
    left: -50%;
    opacity: 0.5;
    filter: blur(80px);
    animation: aurora-move 20s infinite linear;
}

.layer1 {
    background: conic-gradient(from 0deg, #00f0ff, #0066ff, #8600ff, #00ff99, #00f0ff);
    mix-blend-mode: screen;
}

.layer2 {
    background: conic-gradient(from 120deg, #ff00ff, #00bbff, #00ff88, #ff00c8, #ff00ff);
    animation-duration: 35s;
    mix-blend-mode: screen;
}

.layer3 {
    background: conic-gradient(from 250deg, #00ffbf, #0088ff, #cc00ff, #00ffaa, #00ffbf);
    animation-duration: 50s;
    mix-blend-mode: screen;
}

@keyframes aurora-move {
    0% {
        transform: rotate(0deg) translateX(-10%) translateY(-10%);
    }

    50% {
        transform: rotate(180deg) translateX(10%) translateY(10%);
    }

    100% {
        transform: rotate(360deg) translateX(-10%) translateY(-10%);
    }
}