@charset "UTF-8";

/* --- ゲーム全体レイアウト --- */
.backpack-game-wrapper {
    width: 100%;
    height: 100vh;
    padding-top: var(--header-height);
    background-color: #f0f4f8;
}

.game-container {
    display: flex;
    max-width: 1200px;
    height: calc(100vh - var(--header-height));
    margin: 0 auto;
    background: #fff;
    box-shadow: 0 0 40px rgba(0,0,0,0.1);
}

/* 左側：リュック表示 */
.backpack-view {
    flex: 1;
    position: relative;
    display: flex;
    flex-direction: column;
    padding: 2rem;
    background: #fdfdfd;
}

.canvas-area {
    width: 400px;
    height: 500px;
    margin: 0 auto;
    background: #fafafa;
    border: 12px solid #6d4c41; /* リュックのふち */
    border-radius: 20px 20px 60px 60px;
    position: relative;
    overflow: hidden;
    box-shadow: inset 0 0 20px rgba(0,0,0,0.1);
}

/* ステータスHUD */
.game-status-hud {
    margin-bottom: 1.5rem;
}
.weight-bar-bg {
    width: 100%; height: 12px; background: #eee; border-radius: 6px; overflow: hidden; margin: 0.5rem 0;
}
.weight-bar-fill {
    height: 100%; width: 0%; background: #2ecc71; transition: width 0.3s;
}
.weight-bar-fill.danger { background: #e74c3c; }

/* 右側：アイテム選択パネル */
.item-control-panel {
    width: 380px;
    background: #f8fafc;
    border-left: 1px solid #e2e8f0;
    display: flex;
    flex-direction: column;
}
.item-scroll-list {
    flex: 1;
    overflow-y: auto;
    padding: 1.5rem;
}
.item-group-label {
    font-size: 0.8rem; font-weight: bold; color: #94a3b8; margin: 1.5rem 0 0.5rem;
}
.item-node {
    width: 100%; padding: 1rem; margin-bottom: 0.5rem;
    background: #fff; border: 1px solid #e2e8f0; border-radius: 8px;
    text-align: left; cursor: pointer; display: flex; align-items: center; gap: 1rem;
    transition: all 0.2s; font-size: 1rem; font-weight: bold;
}
.item-node:hover { border-color: var(--color-primary); background: #f0f9ff; }
.item-node span { font-size: 1.5rem; }

.panel-footer { padding: 1.5rem; background: #fff; border-top: 1px solid #e2e8f0; }

/* 会話エリア（下部固定風） */
.game-dialogue-area {
    margin-top: 2rem;
    min-height: 120px;
}

/* リザルト */
.result-overlay {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.85); z-index: 2000;
    display: none; align-items: center; justify-content: center;
}
.result-card {
    background: #fff; padding: 3rem; border-radius: 24px; text-align: center; max-width: 500px; width: 90%;
}
.result-stats { display: flex; justify-content: space-around; margin: 2rem 0; background: #f1f5f9; padding: 1.5rem; border-radius: 12px; }
.stat .label { display: block; font-size: 0.8rem; color: #64748b; }
.stat span:last-child { font-size: 1.8rem; font-weight: bold; color: var(--color-primary); }

@media (max-width: 900px) {
    .game-container { flex-direction: column; height: auto; }
    .item-control-panel { width: 100%; height: 400px; }
    .canvas-area { width: 100%; max-width: 320px; height: 400px; }
}

/* ...（前回の分を継承しつつ以下を修正） ... */

.canvas-area {
    width: 400px; height: 500px; margin: 0 auto;
    background: #fff;
    border: 10px solid #5d4037;
    border-radius: 20px 20px 50px 50px;
    position: relative;
    box-shadow: inset 0 -20px 40px rgba(0,0,0,0.1);
}

.backpack-opening-label {
    position: absolute; top: 10px; left: 50%; transform: translateX(-50%);
    font-size: 0.7rem; font-weight: bold; color: #aaa; border: 1px dashed #ccc;
    padding: 2px 10px; border-radius: 10px;
}

.weight-status {
    display: flex; justify-content: space-between; align-items: baseline;
}
.hud-value { font-size: 2rem; font-weight: 900; color: var(--color-primary); }
.hud-count { font-size: 1rem; color: #94a3b8; font-family: monospace; }

.game-dialogue-area {
    margin-top: 1.5rem; height: 180px; overflow-y: auto;
    display: flex; flex-direction: column; gap: 10px;
    padding-right: 5px;
}

/* スクロールバー装飾 */
.game-dialogue-area::-webkit-scrollbar { width: 5px; }
.game-dialogue-area::-webkit-scrollbar-thumb { background: #ddd; border-radius: 5px; }

.dialogue-turn {
    animation: slideIn 0.3s ease-out;
    margin-bottom: 0; padding: 0.8rem; background: #fff;
}
@keyframes slideIn { from { opacity: 0; transform: translateX(-10px); } to { opacity: 1; transform: translateX(0); } }