/* ===== リセット & 基本設定 ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #06C755; /* LINE Green */
    --secondary-color: #00B900;
    --text-dark: #333333;
    --text-light: #666666;
    --bg-light: #F7F7F7;
    --border-color: #E0E0E0;
    --warning-color: #FF6B6B;
    --success-color: #4CAF50;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    line-height: 1.6;
    color: var(--text-dark);
    background-color: var(--bg-light);
    overflow-x: hidden;
}

/* ===== 画面管理 ===== */
.screen {
    display: none !important;
    position: relative;
    min-height: 100vh;
    padding: 20px;
    animation: fadeIn 0.3s ease-in;
}

.screen.active {
    display: block !important;
    z-index: 10;
}

/* セーフガード: activeクラスがない画面は絶対に非表示 */
.screen:not(.active) {
    display: none !important;
    visibility: hidden !important;
    opacity: 0 !important;
    pointer-events: none !important;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ===== ローディング画面 ===== */
#loading {
    display: none !important;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    background: white;
    z-index: 9999;
}

#loading.active {
    display: flex !important;
}

.loader {
    width: 50px;
    height: 50px;
    border: 4px solid var(--border-color);
    border-top: 4px solid var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

#loading p {
    margin-top: 20px;
    color: var(--text-light);
}

/* ===== エラー画面 ===== */
#error {
    display: none !important;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    justify-content: center;
    align-items: center;
    background: white;
    z-index: 9999;
}

#error.active {
    display: flex !important;
}

.error-content {
    background: white;
    padding: 30px;
    border-radius: 12px;
    text-align: center;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.error-content h2 {
    color: var(--warning-color);
    margin-bottom: 15px;
}

.error-content button {
    margin-top: 20px;
    padding: 12px 30px;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    cursor: pointer;
}

/* ===== ヘッダー ===== */
.header {
    text-align: center;
    margin-bottom: 30px;
}

.header h1 {
    font-size: 24px;
    color: var(--primary-color);
    margin-bottom: 8px;
}

.header h2 {
    font-size: 18px;
    color: var(--text-dark);
    font-weight: normal;
}

/* ===== コンテンツ領域 ===== */
.content {
    max-width: 600px;
    margin: 0 auto;
}

/* ===== ボックススタイル ===== */
.intro-box,
.result-box,
.cta-box,
.notice-box {
    background: white;
    padding: 20px;
    border-radius: 12px;
    margin-bottom: 20px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.intro-text {
    font-size: 16px;
    line-height: 1.8;
    margin-bottom: 20px;
}

.feature-list {
    list-style: none;
    margin-bottom: 20px;
}

.feature-list li {
    padding: 8px 0;
    font-size: 15px;
    color: var(--text-dark);
}

/* ===== 注意事項 ===== */
.notice-box {
    border-left: 4px solid var(--warning-color);
}

.notice-box h3 {
    font-size: 16px;
    margin-bottom: 10px;
    color: var(--warning-color);
}

.notice-text {
    font-size: 14px;
    line-height: 1.8;
    margin-bottom: 10px;
}

.safety-details {
    margin-top: 15px;
    cursor: pointer;
}

.safety-details summary {
    font-weight: bold;
    color: var(--primary-color);
    padding: 10px;
    background: var(--bg-light);
    border-radius: 6px;
    user-select: none;
}

.safety-content {
    padding: 15px;
    font-size: 14px;
}

.safety-content ul {
    margin: 10px 0;
    padding-left: 20px;
}

.safety-content li {
    margin: 5px 0;
}

/* ===== ボタン ===== */
.primary-btn,
.secondary-btn {
    display: block;
    width: 100%;
    padding: 16px;
    font-size: 16px;
    font-weight: bold;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: center;
    text-decoration: none;
}

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

.primary-btn:hover {
    background: var(--secondary-color);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(6, 199, 85, 0.3);
}

.secondary-btn {
    background: white;
    color: var(--primary-color);
    border: 2px solid var(--primary-color);
    margin-top: 15px;
}

.secondary-btn:hover {
    background: var(--bg-light);
}

/* ===== 進捗バー ===== */
.progress-bar {
    width: 100%;
    height: 6px;
    background: var(--border-color);
    border-radius: 3px;
    overflow: hidden;
    margin-bottom: 30px;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--secondary-color), var(--primary-color));
    transition: width 0.3s ease;
    width: 0%;
}

/* ===== クイズ画面 ===== */
.quiz-header {
    text-align: center;
    margin-bottom: 20px;
}

.question-number {
    display: inline-block;
    padding: 8px 16px;
    background: var(--primary-color);
    color: white;
    border-radius: 20px;
    font-size: 14px;
    font-weight: bold;
}

.question-content {
    max-width: 600px;
    margin: 0 auto;
}

.question-text {
    font-size: 18px;
    font-weight: bold;
    margin-bottom: 25px;
    padding: 20px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    line-height: 1.6;
}

/* ===== 選択肢 ===== */
.options {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.option-btn {
    padding: 18px 20px;
    background: white;
    border: 2px solid var(--border-color);
    border-radius: 10px;
    font-size: 15px;
    text-align: left;
    cursor: pointer;
    transition: all 0.2s ease;
    line-height: 1.6;
}

.option-btn:hover {
    border-color: var(--primary-color);
    background: #F0FFF4;
    transform: translateX(5px);
}

.option-btn:active {
    transform: scale(0.98);
}

.option-label {
    display: inline-block;
    width: 30px;
    height: 30px;
    line-height: 30px;
    text-align: center;
    background: var(--primary-color);
    color: white;
    border-radius: 50%;
    margin-right: 12px;
    font-weight: bold;
    font-size: 14px;
}

/* ===== 結果画面 ===== */
.result-box h3 {
    font-size: 18px;
    margin-bottom: 15px;
    color: var(--primary-color);
    border-bottom: 2px solid var(--primary-color);
    padding-bottom: 8px;
}

.constitution-types {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.constitution-tag {
    display: inline-block;
    padding: 12px 20px;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
    border-radius: 8px;
    font-weight: bold;
    font-size: 16px;
}

.constitution-tag.sub {
    background: linear-gradient(135deg, #90EE90, var(--primary-color));
    font-size: 14px;
}

.reasoning-list,
.selfcare-list {
    list-style: none;
    padding-left: 0;
}

.reasoning-list li,
.selfcare-list li {
    padding: 12px 0;
    padding-left: 25px;
    position: relative;
    line-height: 1.8;
    border-bottom: 1px solid var(--bg-light);
}

.reasoning-list li:before {
    content: "→";
    position: absolute;
    left: 0;
    color: var(--primary-color);
    font-weight: bold;
}

.selfcare-list li:before {
    content: "✓";
    position: absolute;
    left: 0;
    color: var(--success-color);
    font-weight: bold;
}

/* ===== CTA（行動喚起）ボックス ===== */
.cta-box {
    background: linear-gradient(135deg, #E8F5E9, #F1F8E9);
    border: 2px solid var(--primary-color);
}

.cta-box h3 {
    color: var(--primary-color);
    border-bottom: none;
}

.cta-details {
    margin: 15px 0 20px;
}

.cta-details p {
    font-size: 16px;
    font-weight: bold;
    margin-bottom: 10px;
}

.cta-details ul {
    list-style: none;
    padding-left: 0;
}

.cta-details li {
    padding: 5px 0;
    padding-left: 20px;
    position: relative;
}

.cta-details li:before {
    content: "•";
    position: absolute;
    left: 0;
    color: var(--primary-color);
    font-weight: bold;
}

.cta-note {
    margin-top: 15px;
    padding: 10px;
    background: rgba(255, 255, 255, 0.7);
    border-radius: 8px;
    font-size: 14px;
    color: #555;
    line-height: 1.5;
}

/* ===== ハイライトボックス ===== */
.highlight {
    background: #FFF9E6;
    border-left: 4px solid var(--primary-color);
}

/* ===== フッターメッセージ ===== */
.footer-message {
    text-align: center;
    margin: 30px 0;
    padding: 20px;
    background: white;
    border-radius: 12px;
}

.footer-message p {
    margin: 8px 0;
    color: var(--text-light);
}

.signature {
    font-weight: bold;
    color: var(--primary-color);
    margin-top: 15px !important;
}

/* ===== レスポンシブ対応 ===== */
@media (max-width: 480px) {
    .screen {
        padding: 15px;
    }

    .header h1 {
        font-size: 20px;
    }

    .header h2 {
        font-size: 16px;
    }

    .question-text {
        font-size: 16px;
        padding: 15px;
    }

    .option-btn {
        font-size: 14px;
        padding: 15px;
    }

    .intro-box,
    .result-box,
    .cta-box,
    .notice-box {
        padding: 15px;
    }
}
