/* --- 共通設定 --- */
body.room-page {
    margin: 0; overflow: hidden; background: #333;
    font-family: 'M PLUS Rounded 1c', sans-serif;
}

#hallway-container {
    max-width: 1000px; margin: 50px auto; text-align: center;
}
.hallway-title { color: #555; margin-bottom: 40px; }

/* --- 廊下 (Doors) --- */
.doors-wrapper {
    display: flex; justify-content: center; gap: 50px; perspective: 1000px;
}

.door-frame {
    position: relative; 
    width: 220px; /* 160px -> 220px に拡大 */
    height: 320px; /* 高さも少しバランス調整 */
    background: #f0f0f0; border: 12px solid #d2b48c; border-bottom: none;
    display: block; text-decoration: none; transform-style: preserve-3d;
    transition: transform 0.3s;
}

.door-frame:hover { transform: scale(1.05); }

.door-plate {
    position: absolute; top: -30px; left: 50%; transform: translateX(-50%);
    padding: 5px 15px; color: #fff; font-weight: bold; border-radius: 5px;
    font-family: 'Barlow', sans-serif; box-shadow: 0 2px 5px rgba(0,0,0,0.2);
}

.door {
    position: absolute; top: 0; left: 0; width: 100%; height: 100%;
    background: #8b4513; transform-origin: left;
    transition: transform 0.5s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 2; border: 1px solid rgba(0,0,0,0.1);
}
.door-frame:hover .door:not(.locked) { transform: rotateY(-110deg); }

.door-knob {
    position: absolute; top: 50%; right: 15px; width: 12px; height: 12px;
    background: gold; border-radius: 50%; box-shadow: 1px 1px 2px rgba(0,0,0,0.3);
}
.door-window {
    position: absolute; top: 30px; left: 50%; transform: translateX(-50%);
    width: 100px; height: 100px; background: rgba(200,230,255,0.8);
    border: 5px solid rgba(0,0,0,0.2);
}
.door-window.round { border-radius: 50%; height: 80px; }

.char-preview {
    position: absolute; bottom: 0; left: 0; width: 100%; height: 100%;
    display: flex; align-items: flex-end; justify-content: center;
    z-index: 1; background: #fff; /* 部屋の中 */
}
.char-preview img { width: 80%; transition: transform 0.3s; }
.door-frame:hover .char-preview img { transform: scale(1.1); }

/* --- 部屋共通 (Stage) --- */
.back-btn {
    position: absolute; top: 20px; left: 20px; z-index: 100;
    background: rgba(255,255,255,0.8); padding: 10px 20px; border-radius: 30px;
    text-decoration: none; color: #333; font-weight: bold;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

#room-stage {
    position: relative; width: 100vw; height: 100vh;
    overflow: hidden; perspective: 1500px;
}

.wall {
    position: absolute; top: 0; left: 0; width: 100%; height: 70%;
    background: #e0f7fa; /* ちさまる部屋の壁 */
    box-shadow: inset 0 -50px 100px rgba(0,0,0,0.05);
}
.floor {
    position: absolute; bottom: 0; left: 0; width: 100%; height: 30%;
    background: #deb887;
}

.room-owner {
    position: absolute; bottom: 15%; left: 50%; transform: translateX(-50%);
    width: 200px; z-index: 10; cursor: pointer; transition: transform 0.2s;
}
.room-owner:hover { transform: translateX(-50%) scale(1.05); }
.room-owner img { width: 100%; filter: drop-shadow(0 5px 10px rgba(0,0,0,0.2)); }

.balloon {
    position: absolute; top: -80px; left: 50%; transform: translateX(-50%) scale(0);
    background: #fff; padding: 15px; border-radius: 20px;
    white-space: nowrap; font-weight: bold; color: #333;
    box-shadow: 0 5px 15px rgba(0,0,0,0.1); transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}
.balloon::after {
    content: ''; position: absolute; bottom: -10px; left: 50%; transform: translateX(-50%);
    border-width: 10px 10px 0; border-style: solid; border-color: #fff transparent transparent;
}
.room-owner:hover .balloon { transform: translateX(-50%) scale(1); }

/* --- ちさまるの部屋 --- */
.chisa-room .wall { background: #e0f2f7; }
.poster {
    position: absolute; top: 100px; right: 100px; width: 120px; height: 160px;
    background: #fff; border: 5px solid #eee; box-shadow: 2px 2px 5px rgba(0,0,0,0.1);
    background-image: linear-gradient(45deg, #ff9eb5 25%, transparent 25%), linear-gradient(-45deg, #ff9eb5 25%, transparent 25%);
    background-size: 20px 20px;
}
.shelf {
    position: absolute; bottom: 50px; left: 100px; width: 200px; height: 10px;
    background: #8b4513; border-radius: 5px;
}
.shelf .item { position: absolute; bottom: 10px; }
.book { width: 20px; height: 50px; background: #333; color: white; font-size: 10px; writing-mode: vertical-rl; display: flex; align-items: center; justify-content: center; left: 10px; border-radius: 2px; }
.book:nth-child(2) { left: 35px; background: #555; height: 45px; }
.kanpan-can { width: 40px; height: 50px; background: silver; right: 20px; border-radius: 5px; }

.window {
    position: absolute; top: 50px; left: 30%; width: 200px; height: 150px;
    background: #87ceeb; border: 10px solid #fff; overflow: hidden;
}
.curtain {
    position: absolute; top: 0; width: 50%; height: 100%; background: rgba(255,255,255,0.5);
    border-right: 1px solid #ddd;
}

.bed {
    position: absolute; bottom: 20%; right: 10%; width: 250px; height: 120px;
    background: #f5f5f5; border-radius: 10px; z-index: 5;
    box-shadow: 5px 5px 15px rgba(0,0,0,0.1);
}
.pillow { position: absolute; left: 10px; top: 10px; width: 60px; height: 40px; background: #fff; border-radius: 5px; }
.blanket { position: absolute; right: 0; bottom: 0; width: 180px; height: 100%; background: #ffb7c5; border-radius: 10px; }

.backpack {
    position: absolute; bottom: 15%; left: 20%; width: 80px; height: 100px;
    background: red; border-radius: 20px 20px 5px 5px; z-index: 8;
    cursor: pointer; transition: transform 0.2s;
}
.backpack:hover { transform: scale(1.1) rotate(-5deg); }
.bp-pocket { position: absolute; bottom: 10px; left: 10px; width: 60px; height: 40px; background: darkred; border-radius: 5px; }

.lantern {
    position: absolute; top: 300px; left: 150px; width: 40px; height: 60px;
    background: #222; border-radius: 5px; z-index: 6;
}
.lantern::after {
    content: ''; position: absolute; top: 10px; left: 5px; width: 30px; height: 40px;
    background: #ffffcc; opacity: 0.3; transition: opacity 0.3s;
}

.light-switch {
    position: absolute; top: 300px; right: 20px; width: 40px; height: 40px;
    background: #ddd; border-radius: 5px; cursor: pointer; border: 1px solid #999;
}
.light-switch::after { content: ''; position: absolute; top: 10px; left: 10px; width: 20px; height: 20px; background: #fff; border-radius: 2px; box-shadow: 1px 1px 2px rgba(0,0,0,0.2); }

/* 暗闇モード */
.darkness-overlay {
    position: absolute; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,50,0.9); pointer-events: none; opacity: 0;
    transition: opacity 0.5s; z-index: 20;
}
body.dark-mode .darkness-overlay { opacity: 1; }
body.dark-mode .lantern { z-index: 21; } /* ランタンだけ手前に */
body.dark-mode .lantern::after { opacity: 1; box-shadow: 0 0 50px 20px #ffffcc; background: #fff; }

/* --- キッチン --- */
.kitchen-room .wall { background: #fff; background-image: linear-gradient(#ccc 1px, transparent 1px), linear-gradient(90deg, #ccc 1px, transparent 1px); background-size: 50px 50px; }
.kitchen-room .floor { background: #d2691e; background-image: repeating-linear-gradient(45deg, transparent, transparent 10px, rgba(0,0,0,0.05) 10px, rgba(0,0,0,0.05) 20px); }

.kitchen-counter {
    position: absolute; bottom: 25%; left: 0; width: 70%; height: 150px;
    background: #f0f0f0; border-top: 10px solid #ddd; z-index: 5;
}
.sink { position: absolute; left: 50px; width: 150px; height: 100px; background: #ccc; border-radius: 0 0 10px 10px; top: 0; }
.faucet { position: absolute; top: -40px; left: 60px; width: 10px; height: 40px; background: silver; border-radius: 5px 5px 0 0; }
.faucet::before { content: ''; position: absolute; top: 5px; right: -20px; width: 30px; height: 10px; background: silver; transform: rotate(15deg); }

.stove { position: absolute; right: 100px; top: 0; width: 150px; height: 20px; background: #333; }
.pot {
    position: absolute; bottom: 10px; left: 40px; width: 80px; height: 60px;
    background: orange; border-radius: 5px 5px 20px 20px; cursor: pointer;
}
.pot-lid { position: absolute; top: -10px; left: -5px; width: 90px; height: 15px; background: darkorange; border-radius: 50%; }
.steam {
    position: absolute; top: -50px; left: 20px; width: 40px; height: 40px;
    background: rgba(255,255,255,0.5); border-radius: 50%; filter: blur(10px);
    opacity: 0; transition: opacity 0.3s;
}
.pot.cooking .steam { animation: steamRise 1s infinite; opacity: 1; }
@keyframes steamRise { 0% { transform: translateY(0) scale(1); opacity: 0.5; } 100% { transform: translateY(-30px) scale(1.5); opacity: 0; } }

.fridge-large {
    position: absolute; bottom: 25%; right: 5%; width: 180px; height: 350px;
    background: #fff; border: 2px solid #eee; border-radius: 10px; z-index: 4;
}
.fridge-door-upper { height: 60%; border-bottom: 2px solid #ddd; }
.memo-paper {
    position: absolute; top: 50px; left: 20px; width: 40px; height: 50px;
    background: yellow; font-size: 8px; padding: 5px; transform: rotate(-5deg);
    box-shadow: 1px 1px 2px rgba(0,0,0,0.2);
}
/* --- (既存のCSSはそのまま維持) --- */

/* --- 廊下の追加ドアスタイル --- */
.server-lights {
    position: absolute; top: 20px; left: 20px; display: flex; flex-direction: column; gap: 5px;
}
.server-lights span { width: 5px; height: 5px; background: #00ff00; border-radius: 50%; animation: blink 1s infinite alternate; }
.server-lights span:nth-child(2) { animation-delay: 0.2s; }
.server-lights span:nth-child(3) { animation-delay: 0.4s; }

.dog-flap {
    position: absolute; bottom: 0; left: 50%; transform: translateX(-50%);
    width: 60px; height: 80px; background: #5c4033; border-radius: 30px 30px 0 0; border: 2px solid #3e2723;
}

/* --- モーダル (リュック中身など) --- */
.modal {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.8); display: flex; justify-content: center; align-items: center;
    z-index: 1000; opacity: 1; transition: opacity 0.3s;
}
.modal.hidden { opacity: 0; pointer-events: none; }
.modal-content {
    background: #fff; padding: 20px; border-radius: 15px; max-width: 90%; width: 400px; text-align: center;
    border: 5px solid #87ceeb;
}
.inventory-grid {
    display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 20px 0;
}
.inv-item {
    background: #f0f8ff; padding: 10px; border-radius: 5px; font-weight: bold; font-size: 0.9rem;
}
.close-btn {
    background: #ff69b4; color: white; border: none; padding: 10px 30px;
    border-radius: 20px; font-weight: bold; cursor: pointer; font-size: 1.1rem;
}

/* --- サーバー室 (Server Room) --- */
.server-room { background: #000; font-family: 'Courier New', monospace; }
.cyber-grid {
    position: absolute; width: 200%; height: 200%; top: -50%; left: -50%;
    background-image: linear-gradient(rgba(0, 255, 255, 0.1) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0, 255, 255, 0.1) 1px, transparent 1px);
    background-size: 50px 50px; transform: perspective(500px) rotateX(60deg);
    animation: gridScroll 10s linear infinite;
}
@keyframes gridScroll { 0% { transform: perspective(500px) rotateX(60deg) translateY(0); } 100% { transform: perspective(500px) rotateX(60deg) translateY(50px); } }

.server-rack {
    position: absolute; bottom: 20%; width: 100px; height: 300px;
    background: #111; border: 2px solid #00ffff; box-shadow: 0 0 15px rgba(0,255,255,0.3);
}
.server-rack.left { left: 10%; }
.server-rack.right { right: 10%; border-color: #ff00ff; }
.rack-light {
    width: 80%; height: 5px; background: #00ffff; margin: 10px auto;
    box-shadow: 0 0 5px #00ffff; animation: blink 0.5s infinite alternate;
}

.main-terminal {
    position: absolute; bottom: 30%; left: 50%; transform: translateX(-50%);
    width: 300px; height: 200px; background: rgba(0, 20, 40, 0.9);
    border: 3px solid #00ffff; border-radius: 10px; padding: 10px; cursor: pointer;
}
.cmd-line { display: block; color: #00ffff; font-size: 12px; margin-bottom: 5px; }
.float-anim { animation: float 3s ease-in-out infinite; }
/* --- 修正: Pingのサイズ --- */
.floating-ping {
    position: absolute; 
    width: 60px; /* 60px -> 40px に縮小 */
    animation: float 4s infinite reverse;
    z-index: 5;
}
.floating-ping img {
    width: 100%;
    height: auto;
    display: block;
}
.p1 { top: 20%; left: 20%; }
.p2 { top: 30%; right: 30%; }

/* --- お庭 (Garden) --- */
.garden-room { background: #87ceeb; }
.sky-bg { position: absolute; top: 0; left: 0; width: 100%; height: 60%; background: linear-gradient(#87ceeb, #e0f7fa); }
.cloud {
    position: absolute; background: #fff; border-radius: 50px; opacity: 0.8;
    animation: cloudMove 20s linear infinite;
}
.cloud::after { content: ''; position: absolute; background: #fff; width: 50%; height: 100%; top: -50%; left: 20%; border-radius: 50%; }
.c1 { width: 100px; height: 40px; top: 50px; left: -100px; }
.c2 { width: 150px; height: 60px; top: 100px; left: -150px; animation-duration: 30s; animation-delay: 5s; }
@keyframes cloudMove { 100% { transform: translateX(120vw); } }

.grass-floor {
    position: absolute; bottom: 0; width: 100%; height: 40%; background: #4caf50;
    border-top: 10px solid #388e3c;
}

.dog-house {
    position: absolute; bottom: 30%; left: 10%; width: 150px; height: 150px;
    background: #d2691e;
}
.dh-roof {
    position: absolute; top: -50px; left: -10px; width: 170px; height: 60px;
    background: #8b0000; clip-path: polygon(50% 0, 0 100%, 100% 100%);
}
.dh-entrance {
    position: absolute; bottom: 0; left: 50%; transform: translateX(-50%);
    width: 60px; height: 80px; background: #3e2723; border-radius: 30px 30px 0 0;
}
.dh-plate {
    position: absolute; top: 10px; left: 50%; transform: translateX(-50%);
    background: #fff; padding: 2px 10px; font-weight: bold; border: 1px solid #000;
}

.dig-spot {
    position: absolute; width: 60px; height: 30px; background: #5d4037;
    border-radius: 50%; cursor: pointer; transition: transform 0.1s;
}
.dig-spot:hover { transform: scale(1.1); }
.dig-spot.dug { background: #3e2723; cursor: default; }
.digging { animation: shake 0.2s infinite; }
.dig-item {
    position: absolute; top: -30px; left: 50%; transform: translateX(-50%);
    font-size: 30px; animation: popUp 0.5s ease-out;
}
@keyframes popUp { 0% { transform: translateX(-50%) translateY(20px) scale(0); } 100% { transform: translateX(-50%) translateY(0) scale(1); } }


/* --- 新規: フォリオ先生の書斎 --- */
.library-room .wall { 
    background: #5c4033; /* ダークウッド */
    background-image: linear-gradient(#4a3025 1px, transparent 1px);
    background-size: 100% 50px;
}
.library-room .floor { 
    background: #3e2723; 
    background-image: repeating-linear-gradient(45deg, rgba(255,255,255,0.03) 0, rgba(255,255,255,0.03) 1px, transparent 1px, transparent 10px);
}

.bookshelf-large {
    position: absolute; bottom: 0; width: 150px; height: 80%;
    background: #2e1d15; border: 5px solid #1a100c;
    display: flex; flex-direction: column; justify-content: space-around;
    padding: 10px; box-sizing: border-box;
}
.bookshelf-large.left { left: 50px; }
.bookshelf-large.right { right: 50px; }

.book-row { width: 100%; height: 80%; display: flex; align-items: flex-end; gap: 2px; }
.book-obj {
    width: 15px; height: 80%; background: #8b0000; border-radius: 2px;
    cursor: pointer; transition: transform 0.2s;
}
.book-obj:hover { transform: translateY(-5px); background: #ff0000; }
.book-obj:nth-child(2n) { height: 90%; background: #006400; }
.book-obj:nth-child(3n) { height: 70%; background: #00008b; }

.desk {
    position: absolute; bottom: 15%; left: 50%; transform: translateX(-50%);
    width: 300px; height: 120px; background: #8b4513; border-radius: 5px;
    box-shadow: 0 10px 20px rgba(0,0,0,0.3); z-index: 5;
}
.coffee-cup {
    position: absolute; top: -20px; right: 30px; width: 20px; height: 15px;
    background: #fff; border-radius: 0 0 10px 10px;
}
.coffee-steam {
    position: absolute; top: -30px; right: 30px; width: 20px; height: 20px;
    background: rgba(255,255,255,0.3); filter: blur(5px); border-radius: 50%;
    animation: steamRise 2s infinite;
}

/* --- 新規: わかまるのプレイルーム --- */
.play-room .wall { background: #e8f5e9; border-bottom: 10px solid #a5d6a7; }
.play-room .floor { background: #fffde7; }

.toy-box {
    position: absolute; bottom: 20%; left: 10%; width: 120px; height: 80px;
    background: #ffecb3; border: 5px solid #ffca28; border-radius: 10px;
}
.blocks {
    position: absolute; bottom: 10px; left: 50%; width: 30px; height: 30px;
    background: red; box-shadow: 10px -10px blue, -5px 15px yellow;
}

.slide-gym {
    position: absolute; bottom: 20%; right: 10%; width: 200px; height: 150px;
    z-index: 5;
}
.slide-slope {
    position: absolute; right: 0; bottom: 0; width: 150px; height: 10px;
    background: #ff7043; transform: rotate(-25deg); transform-origin: right bottom;
}
.slide-ladder {
    position: absolute; right: 0; bottom: 0; width: 10px; height: 100px;
    background: #8d6e63;
}

.scattered-toy {
    position: absolute; width: 30px; height: 30px; cursor: pointer;
    transition: transform 0.3s, opacity 0.3s;
}
.scattered-toy:hover { transform: scale(1.2); }
.scattered-toy.cleaned { transform: scale(0) rotate(180deg); opacity: 0; }

/* --- 新規: コレクトのラボ --- */
.lab-room { background: #001122; overflow: hidden; }
.holo-grid {
    position: absolute; top: 0; left: 0; width: 100%; height: 100%;
    background-image: linear-gradient(rgba(0, 255, 255, 0.05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0, 255, 255, 0.05) 1px, transparent 1px);
    background-size: 30px 30px;
}

.holo-screen {
    position: absolute; top: 20%; left: 50%; transform: translateX(-50%);
    width: 400px; height: 200px; border: 2px solid #00ffff;
    background: rgba(0, 255, 255, 0.1); border-radius: 10px;
    box-shadow: 0 0 20px rgba(0, 255, 255, 0.2);
    display: flex; align-items: center; justify-content: center;
    overflow: hidden; cursor: pointer;
}
.graph-line {
    width: 100%; height: 2px; background: #00ffff;
    position: absolute; left: 0; top: 50%;
    box-shadow: 0 0 10px #00ffff;
}
.holo-screen.analyzing .graph-line {
    animation: waveGraph 2s infinite linear;
}
@keyframes waveGraph {
    0% { transform: scaleY(1); }
    25% { transform: scaleY(5) rotate(5deg); }
    50% { transform: scaleY(1); }
    75% { transform: scaleY(5) rotate(-5deg); }
    100% { transform: scaleY(1); }
}

.lab-desk {
    position: absolute; bottom: 0; left: 0; width: 100%; height: 100px;
    background: #1a233a; border-top: 5px solid #00ffff;
}