/*
    Hestia's Construction Blueprint for Style
    -------------------------------------------
    File: characters.css
    Role: To breathe life and warmth into the "Lounge".
    Concept: An interactive picture book where visitors can meet the family.
*/

/* --- [I] The Entrance: A Warm Welcome --- */
.lounge-entrance {
    position: relative;
    height: 50vh;
    display: flex;
    justify-content: center;
    align-items: center;
    text-align: center;
    color: white;
}
.entrance-background {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: url('../images/common/all_characters.png'); 
    background-size: cover;
    background-position: center;
    filter: brightness(0.7) blur(3px); /* メッセージを際立たせる */
    z-index: -1;
}
.entrance-message h1 {
    font-family: var(--font-family-title);
    font-size: 4rem;
    text-shadow: 0 4px 10px rgba(0,0,0,0.5);
}
.entrance-message p {
    font-size: 1.2rem;
    text-shadow: 0 2px 5px rgba(0,0,0,0.5);
}

/* --- [II] The Doors to Another World: Interactive Doors --- */
.door-to-rooms {
    padding: 4rem 2rem;
    background-color: var(--color-background);
}
.doors-container {
    display: flex;
    justify-content: center;
    align-items: flex-start;
    gap: 2rem;
    margin-top: 3rem;
    flex-wrap: wrap;
}
.door-unit {
    perspective: 1000px;
}
.door-frame {
    width: 220px;
    height: 350px;
    border: 10px solid #8d6e63;
    border-radius: 5px;
    position: relative;
    cursor: pointer;
    /* Hestia's Correction: ここに「壁の額縁」を追加し、先生が隠れられるようにします */
    overflow: hidden; 
}
.door-body {
    width: 100%;
    height: 100%;
    position: absolute;
    transform-origin: left;
    transition: transform 1s cubic-bezier(0.7, 0, 0.3, 1);
    transform-style: preserve-3d;
    background-color: #a1887f;
}
.door-unit:hover .door-body {
    transform: rotateY(-30deg);
}

/* 各キャラクターの扉のデザイン */
.chisamaru-door { border-color: #bcaaa4; } /* 柔らかな木 */
.chisamaru-door .door-body { background-color: #d7ccc8; }
.correct-door { border-color: #607d8b; } /* 知的な金属 */
.correct-door .door-body { background: linear-gradient(135deg, #b0bec5, #eceff1); }
.connect-door { border-color: #ffb74d; } /* エネルギーの枠 */
.connect-door .door-body { background: radial-gradient(circle, #ffe082, #ffca28); }
.folio-door { border-color: #5d4037; } /* 重厚なマホガニー */
.folio-door .door-body { background-color: #795548; }

.character-name {
    font-family: var(--font-family-title);
    font-size: 1.8rem;
    color: white;
    text-shadow: 0 2px 4px rgba(0,0,0,0.6);
    writing-mode: vertical-rl; /* 縦書きで趣を */
    position: absolute;
    left: 20px;
    top: 50%;
    transform: translateY(-50%);
}

.peeking-character {
    position: absolute;
    right: -30px;
    bottom: 20px;
    /* Hestia's Correction: 魂の比率を、ここにも、適用いたします */
    height: 100px; /* ちさまる基準 */
    transition: transform 0.5s ease-out;
    transform: translateX(120px); /* 最初は、完全に、隠れていただきます */
}
.door-unit:hover .peeking-character {
    transform: translateX(0);
}

/* --- [III] The Rooms: A Space for Each Soul --- */
.rooms-container {
    padding: 4rem 2rem;
    background-color: #fff;
    /* この中の設計は、JSで部屋が生成された後、さらに豪華に作り込んでいきます */
}
/* style.css と characters.css の両方、または共通のCSS設計書に追記 */

/* --- キャラクターの“魂の比率”を定義 --- */
.welcome-character#chara-chisamaru,
.peeking-character[src*="chisamaru"] {
    height: 100px; /* ちさまるを基準サイズとする */
}

.welcome-character#chara-correct,
.welcome-character#chara-connect,
.peeking-character[src*="correct"],
.peeking-character[src*="connect"] {
    height: 120px; /* コレクトとコネクトは、ちさまるより少し大きく */
}

.welcome-character#chara-folio,
.peeking-character[src*="folio"] {
    height: 160px; /* フォリオ先生は、皆を優しく見守る、最大の存在感 */
}


/* (前略：.lounge-entrance, .door-to-rooms の設計は変更なし) */

/* --- [III] The Rooms: A Space for Each Soul (Complete Version) --- */
.rooms-container {
    padding: 0 2rem 4rem 2rem;
    display: none; /* 初期状態では隠しておく */
}
.character-room {
    max-width: 1000px;
    margin: 2rem auto 0;
    padding: 2rem 3rem;
    border-radius: 15px;
    position: relative;
    /* 豪華な登場アニメーション */
    animation: room-appear 0.8s 0.2s forwards cubic-bezier(0.2, 0.8, 0.2, 1);
    opacity: 0;
    transform: scale(0.9);
}
@keyframes room-appear {
    to { opacity: 1; transform: scale(1); }
}

/* 部屋を閉じる豪華なアニメーション */
.character-room.closing {
    animation: room-disappear 0.5s forwards cubic-bezier(0.8, 0.2, 0.8, 0.2);
}
@keyframes room-disappear {
    from { opacity: 1; transform: scale(1); }
    to { opacity: 0; transform: scale(0.9); }
}

.close-room-btn {
    position: absolute;
    top: 15px;
    right: 15px;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: none;
    background-color: rgba(0,0,0,0.1);
    font-size: 1.5rem;
    color: white;
    cursor: pointer;
    transition: transform 0.3s, background-color 0.3s;
}
.close-room-btn:hover {
    transform: rotate(90deg);
    background-color: rgba(0,0,0,0.3);
}

.room-header { display: flex; gap: 2rem; align-items: center; margin-bottom: 2rem; }
.room-portrait { width: 200px; border-radius: 50%; }
.character-room-name { font-family: var(--font-family-title); font-size: 2.5rem; margin: 0; }
.character-type { font-size: 1.1rem; color: #555; }
.character-mission { margin-top: 1rem; padding-left: 1rem; border-left: 3px solid; }
.character-mission h3 { font-size: 1rem; margin: 0; }

/* --- 四者四様の“魂の色”を定義 --- */
.room-chisamaru { background: #fffde7; border: 5px solid #ffe0b2; }
.room-chisamaru .character-room-name { color: #ff8f00; }
.room-chisamaru .character-mission { border-color: #ffca28; }

.room-correct { background: #eceff1; border: 5px solid #b0bec5; }
.room-correct .character-room-name { color: #455a64; }
.room-correct .character-mission { border-color: #78909c; }

.room-connect { background: #fff3e0; border: 5px solid #ffcc80; }
.room-connect .character-room-name { color: #fb8c00; }
.room-connect .character-mission { border-color: #ffa726; }

.room-folio { background: #fbe9e7; border: 5px solid #ffccbc; }
.room-folio .character-room-name { color: #d84315; }
.room-folio .character-mission { border-color: #ff8a65; }


/* --- アルバム（インタラクティブ・ギャラリー）の豪華な設計 --- */
.room-gallery { text-align: center; }
.room-gallery h3 { font-family: var(--font-family-title); font-size: 1.8rem; }
.album-container { position: relative; max-width: 600px; margin: 1rem auto; }
.album-main-photo {
    background-color: #eee;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 10px 30px rgba(0,0,0,0.1);
}
.album-main-photo img {
    width: 100%;
    display: block;
    transition: opacity 0.3s ease-in-out;
}
.album-main-photo img.fading {
    opacity: 0;
}
.album-arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background-color: rgba(255, 255, 255, 0.7);
    border: none;
    border-radius: 50%;
    width: 50px;
    height: 50px;
    font-size: 1.5rem;
    cursor: pointer;
    transition: transform 0.3s, background-color 0.3s;
    box-shadow: 0 4px 10px rgba(0,0,0,0.1);
}
.album-arrow:hover { background-color: white; transform: translateY(-50%) scale(1.1); }
.album-arrow.prev { left: -25px; }
.album-arrow.next { right: -25px; }

/* (前略：.lounge-entrance, .door-to-rooms, .character-room の基本設計は変更なし) */

/* --- [IV] The Soul's Record: Room Details Design --- */
.room-details {
    margin-top: 3rem;
    border-top: 1px solid rgba(0,0,0,0.1);
    padding-top: 2rem;
}
.room-details.two-columns {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
    align-items: start;
}
.detail-section.full-width {
    grid-column: 1 / -1; /* 2カラムレイアウトでも、このセクションは横幅いっぱいに広がる */
}
.detail-section h3 {
    font-family: var(--font-family-title);
    padding-bottom: 0.5rem;
    border-bottom: 2px solid;
    font-size: 1.3rem;
}
.detail-section p, .detail-section ul {
    font-size: 1rem;
    line-height: 1.8;
}
.detail-section ul {
    list-style: none;
    padding: 0;
}
.detail-section li {
    padding-left: 1.5em;
    text-indent: -1.5em;
    margin-bottom: 0.5em;
}
.detail-section li::before {
    content: '▶';
    margin-right: 0.5em;
    font-size: 0.8em;
}

/* 各部屋の“魂の色”を、詳細エリアにも反映させる */
.room-chisamaru .detail-section h3 { border-color: #ffca28; color: #ff8f00; }
.room-chisamaru .detail-section li::before { color: #ffca28; }

.room-correct .detail-section h3 { border-color: #78909c; color: #455a64; }
.room-correct .detail-section li::before { color: #78909c; }

.room-connect .detail-section h3 { border-color: #ffa726; color: #fb8c00; }
.room-connect .detail-section li::before { color: #ffa726; }

.room-folio .detail-section h3 { border-color: #ff8a65; color: #d84315; }
.room-folio .detail-section li::before { color: #ff8a65; }

.log-entry {
    background-color: rgba(0,0,0,0.03);
    border-left: 5px solid;
    padding: 1rem 1.5rem;
    margin-top: 1.5rem;
    border-radius: 0 8px 8px 0;
}
.log-entry h4 {
    margin: 0 0 0.5rem 0;
    font-family: var(--font-family-title);
}
.log-entry p {
    margin: 0;
}
.room-correct .log-entry { border-color: #78909c; }
.room-connect .log-entry { border-color: #ffa726; }
.room-folio .log-entry { border-color: #ff8a65; }

/* 仲間たち紹介の、グリッドレイアウト */
.relation-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
}
.relation-grid h4 {
    margin: 0 0 0.5rem 0;
    font-family: var(--font-family-title);
    color: #ff8f00;
}
.relation-grid p {
    margin: 0;
}