/* シンプルで確実なレイアウト */

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'M PLUS Rounded 1c', 'Noto Sans JP', sans-serif;
    /* style.cssの背景設定を優先 */
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
}

/* モバイルコンテナ - PCでもスマホでも同じ固定サイズ */
.mobile-container {
    width: 375px;
    height: 100vh;
    max-height: 812px;
    background: white;
    position: relative;
    overflow: hidden;  /* 内容がはみ出さないように */
    box-shadow: 0 0 50px rgba(0, 0, 0, 0.2);
    margin: 0 auto; /* 中央揃え */
}

/* ゲームメインエリア */
.game-main {
    width: 100%;
    padding: 15px;
    /* モバイルエリア内は淡い水色 */
    background: #DCF3FC;
    height: 100%;
    box-sizing: border-box;
}

/* 1. 部屋コンテナ */
.room-container {
    width: 345px;
    margin: 0 auto;
    margin-top: 20px; /* 上部に余白を追加 */
    margin-bottom: 15px;
}

/* 部屋の背景 - 1:1 正方形 */
.room-background {
    width: 100%;
    height: 345px !important; /* 幅345px × 1 = 345px (1:1) */
    min-height: 345px !important;
    max-height: 345px !important;
    padding: 20px;
    border-radius: 15px;
    position: relative;
    /* デフォルトの背景画像。json.jsのDEFAULT_BACKGROUND_IDが指す画像と揃えること
       （2026-08-14、デフォルトを提供素材のheya_01youに変更。
         2026-08-25、先方提供の新しい書き出し main/heya01 へ差し替え） */
    background-image: url('../imgs/main/heya01_600_600.png');
    background-size: cover;
    background-position: center;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    overflow: hidden;
    box-sizing: border-box;
    z-index: 100;  /* 編集モード時もオーバーレイの上に表示 */
}

/* 2. セリフ表示欄 */
.character-dialogue {
    width: 345px;
    margin: 0 auto;
    margin-bottom: 15px;
}

.dialogue-content {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 15px; /* 部屋エリアと同じ値に統一 */
    padding: 12px 15px;
    display: flex;
    align-items: center; /* 中央揃えに戻す */
    gap: 10px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    height: 70px; /* 2行分の高さで固定 */
    min-height: 70px;
    box-sizing: border-box;
}

.dialogue-content i {
    color: #0288D1;
    font-size: 1.2rem;
    flex-shrink: 0; /* アイコンのサイズを固定 */
}

#dialogueText {
    color: #333;
    font-size: 0.85rem;
    font-weight: 500;
    flex: 1;
    line-height: 1.6; /* 行間を少し広げる */
    word-wrap: break-word; /* 長い単語も改行 */
    max-width: 100%; /* 最大幅を制限 */
    display: flex;
    align-items: center; /* テキストを中央に配置 */
    min-height: 46px; /* 最小高さを2行分確保 */
}

/* 3. ステータスパネル */
.status-panel {
    width: 345px !important;
    margin: 0 auto;
    margin-bottom: 15px;
    padding: 12px;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 15px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    box-sizing: border-box;
}

.status-panel h3 {
    font-size: 0.9rem;
    color: #333;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.status-bars {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.status-bar {
    display: grid;
    grid-template-columns: 50px 1fr 50px;
    align-items: center;
    gap: 8px;
}

.status-label {
    font-size: 0.75rem;
    color: #666;
}

.progress-bar {
    background: #e0e0e0;
    border-radius: 8px;
    height: 10px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    transition: width 0.3s ease;
}

.health-bar {
    background: linear-gradient(90deg, #10b981, #34d399);
}

.exp-bar {
    background: linear-gradient(90deg, #3b82f6, #60a5fa);
}

.hunger-bar {
    background: linear-gradient(90deg, #fbbf24, #fcd34d);
}

.status-value {
    font-size: 0.7rem;
    color: #666;
    text-align: right;
}

/* 4. アクションコントロール */
.action-controls {
    width: 345px;
    margin: 0 auto;
    margin-bottom: 15px;
    padding: 0;
    display: flex;
    gap: 10px;
    justify-content: space-between; /* ボタンを均等に配置 */
    box-sizing: border-box;
}

.control-btn {
    flex: 1;
    padding: 10px 8px;
    /* ★2026-09-17 No.172：background は style.css が後勝ちのため削除（二重定義の解消） */
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    flex-direction: row;  /* 横並びに変更 */
    align-items: center;
    justify-content: center;
    gap: 4px;  /* アイコンと文字の間隔 */
    transition: all 0.3s;
    min-width: 0;  /* flexboxでの最小幅をリセット */
}

.control-btn i {
    font-size: 1.1rem;
}

.control-btn span {
    font-size: 0.85rem;  /* 文字サイズ統一 */
    white-space: nowrap;  /* 文字が改行されないように */
}

.control-btn:active {
    transform: translateY(0);
}

.control-btn.active {
    /* ★2026-09-17 No.172：background は style.css が後勝ちのため削除（二重定義の解消） */
}

/* メニュートグル - 他のボタンと同じデザイン */

/* メニューオーバーレイ */
.menu-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: none;
    z-index: 1999;
}

.menu-overlay.active {
    display: block;
}

/* ポップアップメニュー - 下からスライド */
.popup-menu {
    position: absolute !important;
    bottom: 0 !important;
    left: 0 !important;
    right: 0 !important;
    width: 100% !important;
    height: auto !important;
    background: transparent !important;
    display: none !important;
    z-index: 2000 !important;
}

.popup-menu.active {
    display: block !important;
}

.popup-menu-content {
    background: white !important;
    border-radius: 20px 20px 0 0 !important;
    padding: 20px !important;
    padding-bottom: 30px !important;
    width: 100% !important;
    height: auto !important;
    max-height: 50vh !important;
    overflow-y: auto !important;
    animation: slideUp 0.3s ease-out !important;
    position: relative !important;
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.15) !important;
    box-sizing: border-box !important;
}

@keyframes slideUp {
    from {
        transform: translateY(100%);
    }
    to {
        transform: translateY(0);
    }
}

.popup-menu h3 {
    color: #333;
    font-size: 1.1rem;
    margin-bottom: 15px;
    text-align: center;
}

.menu-buttons {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.menu-section {
    margin-bottom: 15px;
    display: flex;
    gap: 10px;
}

.menu-section h4 {
    font-size: 0.9rem;
    color: #666;
    margin-bottom: 8px;
}

.menu-btn {
    flex: 1;
    padding: 12px;
    /* ★2026-09-17 No.172：background は style.css が後勝ちのため削除（二重定義の解消） */
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    flex-direction: row;  /* 横並びに変更 */
    align-items: center;
    justify-content: center;
    gap: 8px;  /* アイコンと文字の間隔 */
    transition: all 0.3s;
    box-shadow: 0 2px 8px rgba(2, 136, 209, 0.3);
}

.menu-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(2, 136, 209, 0.4);
}

.menu-btn:active {
    transform: translateY(0);
}

.menu-btn i {
    font-size: 1.2rem;
}

.menu-btn span {
    font-size: 0.9rem;  /* 文字サイズ統一 */
}

.action-btn {
    width: 100%;
    padding: 12px;
    background: linear-gradient(135deg, #4FC3F7, #0288D1);
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 0.9rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.3s;
}

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

/* 家具メニューモーダル */
.furniture-menu {
    width: 375px !important;
    max-width: 375px !important;
    padding: 20px !important;
}

.furniture-menu h3 {
    color: #333;
    font-size: 1.1rem;
    text-align: center;
    margin-bottom: 15px;
}

.furniture-menu .menu-buttons {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.furniture-menu .menu-btn {
    width: 100%;
    padding: 15px;
    font-size: 1rem;
}

.close-menu-btn {
    position: absolute;
    right: 10px;
    top: 10px;
    width: 30px;
    height: 30px;
    border: none;
    /* ★2026-09-17 No.172：background は style.css が後勝ちのため削除（二重定義の解消） */
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s;
}

.close-menu-btn:hover {
    /* ★2026-09-17 No.172：background は style.css が後勝ちのため削除（二重定義の解消） */
}

.close-menu-btn i {
    color: #6b7280;
    font-size: 1rem;
}

.popup-menu-header {
    position: relative;
    margin-bottom: 10px;
    height: 30px; /* ×ボタンの高さ分のスペースを確保 */
}

/* キャラクター */
.character-container {
    position: absolute;
    bottom: 40px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 10;
}

.character-gif {
    width: 100px;
    height: 100px;
    object-fit: contain;
}

.character-shadow {
    position: absolute;
    bottom: -10px;
    left: 50%;
    transform: translateX(-50%);
    width: 60px;
    height: 15px;
    background: radial-gradient(ellipse, rgba(0, 0, 0, 0.3), transparent);
    border-radius: 50%;
}

/* 家具 */
.furniture-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

.furniture-item {
    position: absolute;
    cursor: move;
    pointer-events: auto;
}

/* ★2026-09-10（S12①・カテゴリ決定3）：.window-furniture の初期位置は廃止した。
   家具カテゴリがテナント登録制になったため、初期位置はカテゴリに依存しない共通ルール
   （index.html の defaultFurnitureStyle()）で決める。index.css の同種の指定も削除済み */

.window {
    width: 80px;
    height: 100px;
    background: linear-gradient(to bottom, #87CEEB, #E0F6FF);
    border: 4px solid #8B4513;
    border-radius: 8px 8px 0 0;
    box-shadow: inset 0 0 20px rgba(255, 255, 255, 0.5);
}

/* PCとスマホで同じデザインを維持 - メディアクエリ削除 */