/* ==================== 场景化房间 ==================== */

.room-header h3 { margin: 0; }

.room-canvas {
    width: 100%;
    max-width: 900px;       /* 硬上限，防止无限拉伸；实际尺寸由 Konva fitStage 控制 */
    aspect-ratio: 1280 / 719;
    margin: 0 auto;
    border: 1px solid rgba(130, 87, 45, 0.14);
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: 0 12px 30px rgba(100, 67, 36, 0.16);
    background: #f6ead2;
}

.room-action-bar {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    max-width: 900px;
    margin: var(--space-md) auto 0;
    padding: var(--space-md) var(--space-lg);
    background: var(--surface);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    flex-wrap: wrap;
}
.room-action-bar #roomActionMsg {
    flex: 1;
    font-size: var(--text-sm);
    color: var(--text-secondary);
    min-width: 150px;
}
.room-action-bar #roomActionBtns {
    display: flex;
    gap: var(--space-sm);
    flex-wrap: wrap;
}

/* 种子袋素材：房间背包与商店共用，加载失败时显示原 emoji */
.seed-art {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 76px;
    height: 76px;
}
.seed-art img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    filter: drop-shadow(0 4px 4px rgba(85, 57, 28, 0.16));
}
.seed-art-fallback { display: none; }
.seed-art.is-fallback img { display: none; }
.seed-art.is-fallback .seed-art-fallback { display: block; }

/* 桌面端：房间在左、奖杯在右，两列等高；操作栏独立于布局之外 */
.room-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 300px;
    gap: var(--space-lg);
    align-items: stretch;
}
.room-scene-col {
    width: 100%;
    min-width: 0;
}
.room-items-panel {
    position: relative;
    min-width: 0;
    min-height: 0;
}
/* 奖杯数量不撑高房间，超出时在面板内部滚动 */
.room-items-panel > .room-items-section {
    position: absolute;
    inset: 0;
    overflow-y: auto;
    overscroll-behavior: contain;
}
.room-items-section {
    margin: 0;
    padding: 14px;
    background: #fcfaf5;
    border: 1px solid #eee5d6;
    border-radius: var(--radius-md);
}
.room-items-section-title {
    font-weight: 600;
    font-size: 0.9rem;
    margin-bottom: var(--space-sm);
    color: var(--text-secondary);
}
.room-items-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(92px, 1fr));
    gap: var(--space-sm);
}
/* 物品面板卡片微调 */
.room-items-grid .inv-card {
    width: 100%;
    padding: 8px 6px;
    cursor: pointer;
    transition: transform 0.15s, box-shadow 0.15s;
}
.room-items-grid button.inv-card {
    appearance: none;
    background: var(--surface);
    color: inherit;
    font: inherit;
}
.room-items-grid .inv-card:focus-visible {
    outline: 3px solid #42b883;
    outline-offset: 3px;
}
.room-items-grid .inv-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow);
}
.room-items-grid .inv-sprite {
    min-height: 62px;
    font-size: 1.6rem;
}
.room-items-grid .seed-art {
    width: 60px;
    height: 60px;
}
.room-items-grid .inv-name {
    font-size: 0.78rem;
}

/* 下方种子商店与背包并排，均固定三列；5 个种子自然排成两行 */
.room-seed-panels {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: var(--space-lg);
    align-items: start;
}
.room-seed-panels > .card {
    min-width: 0;
    margin-bottom: 0;
}
#gameTabRoom #shopGrid,
#gameTabRoom #roomSeedGrid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: var(--space-sm);
    justify-content: stretch;
    width: 100%;
}
#gameTabRoom #shopGrid > .inv-card,
#gameTabRoom #roomSeedGrid > .inv-card {
    width: 100%;
    min-width: 0;
}

/* 种植等待态：选了花盆等点种子 → 种子卡呼吸高亮；选了种子 → 选中描边 */
.room-items-grid .inv-card.seed-pick-hint {
    outline: 2px dashed #42d392;
    outline-offset: 2px;
    animation: seedPulse 1.2s ease-in-out infinite;
    cursor: pointer;
}
.room-items-grid .inv-card.seed-picked {
    outline: 2px solid #42d392;
    outline-offset: 2px;
    background: #e6f9f1;
}
@keyframes seedPulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(66, 211, 146, 0.35); }
    50% { box-shadow: 0 0 0 6px rgba(66, 211, 146, 0); }
}
@media (prefers-reduced-motion: reduce) {
    .room-items-grid .inv-card { transition: none; }
    .room-items-grid .inv-card.seed-pick-hint { animation: none; }
}

/* 平板及以下：房间/奖杯、商店/背包分别改为上下排列 */
@media (max-width: 900px) {
    .room-layout,
    .room-seed-panels {
        grid-template-columns: minmax(0, 1fr);
    }
    .room-items-panel {
        position: static;
    }
    .room-items-panel > .room-items-section {
        position: static;
        inset: auto;
        overflow: visible;
        overscroll-behavior: auto;
    }
}

/* 手机端：动作栏堆叠 */
@media (max-width: 480px) {
    .room-action-bar {
        flex-direction: column;
        align-items: stretch;
    }
    .room-action-bar #roomActionMsg {
        min-width: 0;
    }
    .room-action-bar #roomActionBtns {
        justify-content: flex-end;
    }
    .room-action-bar #roomActionBtns .btn-small {
        flex: 1;
        justify-content: center;
    }
    #gameTabRoom #shopGrid > .inv-card,
    #gameTabRoom #roomSeedGrid > .inv-card {
        padding: 6px 4px;
    }
    #gameTabRoom #shopGrid .seed-art,
    #gameTabRoom #roomSeedGrid .seed-art {
        width: 48px;
        height: 48px;
    }
}
