/* ========================================
   お悩み相談（Consultation）画面
   ======================================== */

/* --- テスト注釈 --- */
.test-notice {
    color: #E6B422;
    font-size: 0.85rem;
    text-align: center;
    opacity: 0.85;
}

/* --- 共通レイアウト --- */
.consultation-screen {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* --- CG背景 --- */
.consultation-bg {
    position: absolute;
    top: 0; left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
}
.consultation-bg img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.consultation-bg-overlay {
    position: absolute;
    top: 0; left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(180deg,
        rgba(0, 0, 0, 0.1) 0%,
        rgba(0, 0, 0, 0.3) 50%,
        rgba(0, 0, 0, 0.7) 100%
    );
}

/* =========================================
   入力画面
   ========================================= */
.consultation-input-container {
    position: relative;
    z-index: 10;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-end;
    height: 100%;
    padding: 20px;
    padding-bottom: calc(30px + env(safe-area-inset-bottom, 0px));
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.consultation-intro-text {
    background: rgba(0, 0, 0, 0.65);
    border: 1px solid rgba(212, 175, 55, 0.4);
    border-radius: 12px;
    padding: 16px 24px;
    margin-bottom: 16px;
    text-align: center;
    max-width: 600px;
    width: 100%;
}
.consultation-intro-text h2 {
    color: #D4AF37;
    font-size: 1.3rem;
    margin: 0 0 8px 0;
    font-family: 'Noto Serif JP', serif;
}
.consultation-intro-text p {
    color: #e0d5c0;
    font-size: 0.9rem;
    margin: 0;
    line-height: 1.6;
}

/* フォーム */
.consultation-form {
    background: rgba(0, 0, 0, 0.7);
    border: 1px solid rgba(212, 175, 55, 0.3);
    border-radius: 12px;
    padding: 20px;
    max-width: 600px;
    width: 100%;
    backdrop-filter: blur(8px);
}

.consultation-form-group {
    margin-bottom: 14px;
}
.consultation-form-group label {
    display: block;
    color: #D4AF37;
    font-size: 0.85rem;
    margin-bottom: 6px;
    font-family: 'Noto Serif JP', serif;
}
.consultation-form-group input,
.consultation-form-group textarea {
    width: 100%;
    padding: 10px 14px;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(212, 175, 55, 0.3);
    border-radius: 8px;
    color: #fff;
    font-size: 1rem;
    font-family: 'Noto Serif JP', serif;
    outline: none;
    transition: border-color 0.3s;
    box-sizing: border-box;
}
.consultation-form-group input:focus,
.consultation-form-group textarea:focus {
    border-color: #D4AF37;
    box-shadow: 0 0 10px rgba(212, 175, 55, 0.2);
}
/* 生年月日 年/月/日 分割入力 */
.birthdate-inputs {
    display: flex;
    align-items: center;
    gap: 4px;
}
.birthdate-inputs input {
    text-align: center;
    letter-spacing: 0.1em;
}
.birthdate-inputs input#consult-birth-year {
    flex: 2;
}
.birthdate-inputs input#consult-birth-month,
.birthdate-inputs input#consult-birth-day {
    flex: 1;
}
.birthdate-sep {
    color: rgba(212, 175, 55, 0.5);
    font-size: 1.1rem;
    flex-shrink: 0;
}

.consultation-form-group textarea {
    resize: vertical;
    min-height: 80px;
    max-height: 150px;
    line-height: 1.5;
}

.consultation-form-row {
    display: flex;
    gap: 12px;
}
.consultation-form-row .consultation-form-group {
    flex: 1;
}

.btn-consultation-submit {
    display: block;
    width: 100%;
    padding: 14px;
    margin-top: 8px;
    background: linear-gradient(135deg, #D4AF37, #F0D060);
    color: #1a0a2e;
    border: none;
    border-radius: 8px;
    font-size: 1.1rem;
    font-weight: bold;
    font-family: 'Noto Serif JP', serif;
    cursor: pointer;
    transition: all 0.3s;
}
.btn-consultation-submit:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 20px rgba(212, 175, 55, 0.5);
}
.btn-consultation-submit:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.btn-consultation-back {
    display: block;
    width: 100%;
    padding: 10px;
    margin-top: 8px;
    background: transparent;
    color: #e0d5c0;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    font-size: 0.9rem;
    font-family: 'Noto Serif JP', serif;
    cursor: pointer;
    transition: all 0.3s;
}
.btn-consultation-back:hover {
    background: rgba(255, 255, 255, 0.1);
}

/* =========================================
   待機画面
   ========================================= */
/* 待機画面は共通の loading-scene クラスを使用（animations.css） */

/* =========================================
   結果画面
   ========================================= */
.consultation-result-container {
    position: relative;
    z-index: 10;
    display: flex;
    flex-direction: column;
    height: 100%;
}

/* キャラ名バッジ */
.consultation-char-badge {
    position: absolute;
    top: 16px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 20;
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(0, 0, 0, 0.7);
    border: 1px solid var(--consult-char-color, #D4AF37);
    border-radius: 20px;
    padding: 6px 18px;
    backdrop-filter: blur(8px);
}
.consultation-char-badge .char-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--consult-char-color, #D4AF37);
    box-shadow: 0 0 8px var(--consult-char-color, #D4AF37);
}
.consultation-char-badge .char-name {
    color: #fff;
    font-size: 0.95rem;
    font-family: 'Noto Serif JP', serif;
}

/* テキストウィンドウ */
.consultation-textbox {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 15;
    background: rgba(0, 0, 0, 0.75);
    border-top: 1px solid rgba(212, 175, 55, 0.3);
    padding: 20px 24px;
    padding-bottom: calc(20px + env(safe-area-inset-bottom, 0px));
    min-height: 40%;
    max-height: 55%;
    display: flex;
    flex-direction: column;
    backdrop-filter: blur(8px);
}

.consultation-result-text {
    color: #e0d5c0;
    font-size: 0.95rem;
    line-height: 1.8;
    font-family: 'Noto Serif JP', serif;
    flex: 1;
    overflow-y: auto;
    padding-right: 8px;
    white-space: pre-wrap;
}
.consultation-result-text::-webkit-scrollbar {
    width: 4px;
}
.consultation-result-text::-webkit-scrollbar-thumb {
    background: rgba(212, 175, 55, 0.3);
    border-radius: 2px;
}

/* ナビボタン */
.consultation-nav-buttons {
    display: flex;
    gap: 10px;
    margin-top: 14px;
    flex-shrink: 0;
}
.consultation-nav-buttons button {
    flex: 1;
    padding: 12px;
    border-radius: 8px;
    font-size: 0.9rem;
    font-family: 'Noto Serif JP', serif;
    cursor: pointer;
    transition: all 0.3s;
}

.btn-next-miko {
    background: linear-gradient(135deg, var(--consult-next-color, #6B3FA0), var(--consult-next-color-light, #8B6EC0));
    color: #fff;
    border: none;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
}
.btn-next-miko:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.4);
}

.btn-consultation-home,
.btn-consultation-retry {
    background: rgba(255, 255, 255, 0.08);
    color: #e0d5c0;
    border: 1px solid rgba(255, 255, 255, 0.2);
}
.btn-consultation-home:hover,
.btn-consultation-retry:hover {
    background: rgba(255, 255, 255, 0.15);
}

/* CG切り替えフェード */
.consultation-bg.fade-out {
    animation: consultFadeOut 0.5s ease forwards;
}
.consultation-bg.fade-in {
    animation: consultFadeIn 0.5s ease forwards;
}
@keyframes consultFadeOut {
    from { opacity: 1; }
    to { opacity: 0; }
}
@keyframes consultFadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* 進行インジケーター */
.consultation-progress-dots {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-bottom: 10px;
    flex-shrink: 0;
}
.progress-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    transition: all 0.3s;
}
.progress-dot.active {
    background: var(--consult-char-color, #D4AF37);
    box-shadow: 0 0 8px var(--consult-char-color, #D4AF37);
}
.progress-dot.done {
    background: rgba(212, 175, 55, 0.6);
}

/* =========================================
   レスポンシブ
   ========================================= */
@media (max-width: 600px) {
    .consultation-form {
        padding: 16px;
    }
    .consultation-form-row {
        flex-direction: column;
        gap: 0;
    }
    .consultation-intro-text h2 {
        font-size: 1.1rem;
    }
    .consultation-loading-number {
        font-size: 42px;
    }
    .consultation-textbox {
        padding: 16px;
        padding-bottom: calc(16px + env(safe-area-inset-bottom, 0px));
        min-height: 45%;
        max-height: 70%;
    }
    .consultation-result-text {
        font-size: 0.88rem;
        line-height: 1.6;
    }
    .consultation-nav-buttons {
        flex-direction: column;
        gap: 8px;
    }
}

@media (max-width: 480px) {
    .consultation-input-container {
        padding: 12px;
        padding-bottom: calc(20px + env(safe-area-inset-bottom, 0px));
    }
    .consultation-intro-text {
        padding: 12px 16px;
        margin-bottom: 12px;
    }
    .consultation-intro-text h2 {
        font-size: 1rem;
    }
    .consultation-intro-text p {
        font-size: 0.8rem;
    }
    .consultation-form {
        padding: 14px;
    }
    .consultation-form-group label {
        font-size: 0.8rem;
    }
    .consultation-form-group input,
    .consultation-form-group textarea {
        padding: 8px 10px;
        font-size: 0.9rem;
    }
    .consultation-form-group textarea {
        min-height: 60px;
        max-height: 120px;
    }
    .btn-consultation-submit {
        padding: 12px;
        font-size: 1rem;
    }
    .consultation-textbox {
        padding: 14px;
        padding-bottom: calc(14px + env(safe-area-inset-bottom, 0px));
        min-height: 50%;
        max-height: 75%;
    }
    .consultation-result-text {
        font-size: 0.85rem;
        line-height: 1.5;
    }
    .consultation-char-badge {
        padding: 4px 12px;
        top: 10px;
    }
    .consultation-char-badge .char-name {
        font-size: 0.85rem;
    }
}

/* 横向き・低い画面高さ */
@media (max-height: 600px) {
    .consultation-textbox {
        min-height: 50%;
        max-height: 80%;
    }
}
