/* ============================================================
   ShengQF - 怪物射击游戏  样式表 v2.0
   ============================================================ */

/* ---------- Reset & Base ---------- */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    width: 100%;
    height: 100%;
    overflow: hidden;
    background: #1a1a2e;
    font-family: 'Segoe UI', 'Microsoft YaHei', sans-serif;
    color: #eee;
    user-select: none;
    -webkit-user-select: none;
}

/* ---------- Canvas ---------- */
#gameCanvas {
    display: block;
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    cursor: crosshair;
}

/* ============================================================
   左侧菜单按钮 & 侧边栏
   ============================================================ */
/* 菜单按钮 */
.menu-toggle-btn {
    position: absolute;
    top: 12px;
    left: 12px;
    z-index: 60;
    background: rgba(0, 0, 0, 0.75);
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 10px;
    padding: 8px 14px;
    font-size: 15px;
    font-weight: 700;
    color: #fff;
    cursor: pointer;
    backdrop-filter: blur(6px);
    transition: all 0.25s;
    user-select: none;
    -webkit-user-select: none;
}
.menu-toggle-btn:hover {
    background: rgba(255, 255, 255, 0.15);
    border-color: rgba(255, 255, 255, 0.5);
}
.menu-toggle-btn.active {
    background: rgba(34, 197, 94, 0.25);
    border-color: #22c55e;
}

/* 左侧菜单面板 */
.side-menu {
    position: absolute;
    top: 0;
    left: 0;
    width: 200px;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    border-right: 2px solid rgba(255, 255, 255, 0.15);
    z-index: 55;
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 56px 10px 16px;
    backdrop-filter: blur(8px);
    transform: translateX(-100%);
    transition: transform 0.3s ease;
}
.side-menu.open {
    transform: translateX(0);
}

.menu-item {
    background: rgba(255, 255, 255, 0.06);
    border: 2px solid rgba(255, 255, 255, 0.15);
    border-radius: 10px;
    padding: 8px 12px;
    font-size: 14px;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: all 0.2s;
    pointer-events: none;
}

.menu-icon { font-size: 16px; flex-shrink: 0; }

.menu-hp  { border-color: #ef4444; }
.menu-ammo{ border-color: #f59e0b; }
.menu-gold{ border-color: #eab308; }
.menu-kills{ border-color: #a855f7; }
.menu-level{ border-color: #06b6d4; }
.menu-exp{ border-color: #8b5cf6; }

.menu-btn {
    border-color: #22c55e;
    pointer-events: auto;
    cursor: pointer;
}
.menu-btn:hover {
    background: rgba(34, 197, 94, 0.25);
    border-color: #4ade80;
}
.menu-return {
    border-color: #f97316;
}
.menu-return:hover {
    background: rgba(249, 115, 22, 0.25);
    border-color: #fb923c;
}

.menu-sep {
    color: #999;
    font-weight: 400;
    margin: 0 1px;
}

/* HP 低血量闪烁 */
.menu-hp.low {
    animation: hpBlink 0.5s ease-in-out infinite;
    border-color: #ff0000;
    background: rgba(255, 0, 0, 0.3);
}

/* 弹药低警告 */
.menu-ammo.low-ammo {
    animation: ammoBlink 0.6s ease-in-out infinite;
    border-color: #ff4444;
    background: rgba(255, 0, 0, 0.25);
}

@keyframes hpBlink {
    0%, 100% { opacity: 1; }
    50%      { opacity: 0.4; }
}

@keyframes ammoBlink {
    0%, 100% { border-color: #f59e0b; }
    50%      { border-color: #ff4444; }
}

/* ============================================================
   弹药不足提示
   ============================================================ */
#ammoWarning {
    position: absolute;
    bottom: 140px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 20;
    background: rgba(0, 0, 0, 0.8);
    border: 2px solid #f59e0b;
    border-radius: 12px;
    padding: 12px 28px;
    font-size: 18px;
    font-weight: 700;
    color: #fbbf24;
    backdrop-filter: blur(6px);
    animation: ammoWarnPulse 0.7s ease-in-out infinite;
}

@keyframes ammoWarnPulse {
    0%, 100% { transform: translateX(-50%) scale(1); opacity: 1; }
    50%      { transform: translateX(-50%) scale(1.05); opacity: 0.7; }
}

/* ============================================================
   模态弹窗
   ============================================================ */
.modal {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 50;
    background: rgba(0, 0, 0, 0.65);
    backdrop-filter: blur(4px);
}

.modal.hidden {
    display: none;
}

.modal-content {
    background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
    border: 2px solid rgba(255, 255, 255, 0.2);
    border-radius: 20px;
    padding: 28px 36px;
    min-width: 380px;
    max-width: 620px;
    text-align: center;
    box-shadow: 0 20px 60px rgba(0,0,0,0.5);
    position: relative;
    max-height: 92vh;
    overflow-y: auto;
}

.modal-content h1 {
    font-size: 42px;
    margin-bottom: 4px;
    background: linear-gradient(135deg, #f59e0b, #ef4444);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.modal-content h2 {
    font-size: 26px;
    margin-bottom: 8px;
    color: #f1f5f9;
}

.subtitle {
    font-size: 14px;
    color: #94a3b8;
    margin-bottom: 24px;
    letter-spacing: 6px;
}

.shop-subtitle {
    font-size: 14px;
    color: #94a3b8;
    margin-bottom: 16px;
}

/* ============================================================
   九宫格商店
   ============================================================ */
.shop-grid {
    display: grid;
    grid-template-columns: repeat(3, 80px);
    grid-template-rows: repeat(3, 80px);
    gap: 10px;
    justify-content: center;
    margin: 0 auto 16px;
}

.shop-cell {
    width: 80px;
    height: 80px;
    background: rgba(255, 255, 255, 0.06);
    border: 2px solid rgba(255, 255, 255, 0.15);
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
    position: relative;
}

.shop-cell:hover {
    border-color: rgba(255, 255, 255, 0.4);
    background: rgba(255, 255, 255, 0.12);
    transform: translateY(-2px);
}

.shop-cell.selected {
    border-color: #22c55e;
    background: rgba(34, 197, 94, 0.15);
    box-shadow: 0 0 12px rgba(34, 197, 94, 0.3);
}

.shop-cell.empty {
    cursor: default;
    background: rgba(255, 255, 255, 0.02);
    border-style: dashed;
}

.shop-cell.empty:hover {
    transform: none;
    border-color: rgba(255, 255, 255, 0.1);
}

.shop-cell-icon { font-size: 28px; line-height: 1; }
.shop-cell-name { font-size: 12px; color: #cbd5e1; margin-top: 4px; font-weight: 600; }

/* ============================================================
   背包 20格 (5×4) 通用
   ============================================================ */
.backpack-grid {
    display: grid;
    grid-template-columns: repeat(6, 72px);
    grid-template-rows: repeat(3, 72px);
    gap: 8px;
    justify-content: center;
    margin: 0 auto 12px;
}

.backpack-cell {
    width: 72px;
    height: 72px;
    background: rgba(255, 255, 255, 0.06);
    border: 2px solid rgba(255, 255, 255, 0.15);
    border-radius: 10px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
    position: relative;
}

.backpack-cell:hover {
    border-color: rgba(255, 255, 255, 0.4);
    background: rgba(255, 255, 255, 0.12);
    transform: translateY(-2px);
}

.backpack-cell.empty {
    cursor: default;
    background: rgba(255, 255, 255, 0.02);
    border-style: dashed;
}

.backpack-cell.empty:hover {
    transform: none;
    border-color: rgba(255, 255, 255, 0.1);
}

/* 消耗品格子特殊样式 */
.backpack-cell.consumable {
    border-color: rgba(245, 158, 11, 0.4);
    background: rgba(245, 158, 11, 0.08);
    cursor: default;
}
.backpack-cell.consumable:hover {
    transform: none;
    border-color: rgba(245, 158, 11, 0.4);
}

.backpack-cell-icon { font-size: 24px; line-height: 1; }
.backpack-cell-name { font-size: 11px; color: #cbd5e1; margin-top: 2px; font-weight: 600; }

/* 数量角标 */
.backpack-cell-qty {
    position: absolute;
    bottom: 3px;
    right: 3px;
    background: #ef4444;
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    min-width: 18px;
    height: 18px;
    line-height: 18px;
    text-align: center;
    border-radius: 9px;
    padding: 0 4px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.3);
}

/* 等级标签 */
.backpack-cell-level {
    position: absolute;
    top: 3px;
    left: 3px;
    background: rgba(0,0,0,0.7);
    color: #fbbf24;
    font-size: 9px;
    font-weight: 700;
    padding: 1px 4px;
    border-radius: 3px;
}

.backpack-cell.level-too-high {
    border-color: #ef4444;
    background: rgba(239, 68, 68, 0.1);
}
.backpack-cell.level-too-high .backpack-cell-level {
    color: #ef4444;
}

/* ============================================================
   合并背包页面布局
   ============================================================ */
.inventory-content {
    max-width: 620px;
}

/* 人物装备 + 属性值 左右并排 */
.inventory-top-row {
    display: flex;
    gap: 20px;
    align-items: stretch;
    margin-bottom: 16px;
}

.inventory-char-section {
    flex-shrink: 0;
    margin-bottom: 0;
    display: flex;
    flex-direction: column;
}

.inventory-attr-section {
    flex: 1;
    min-width: 0;
    margin-bottom: 0;
    display: flex;
    flex-direction: column;
}

/* 属性区标题保留顶部对齐 */
.inventory-attr-section .section-title {
    flex-shrink: 0;
}

.inventory-section {
    margin-bottom: 16px;
}

/* 等级 & 金币 信息条 */
.inventory-info-bar {
    display: flex;
    justify-content: space-around;
    align-items: center;
    padding: 8px 16px;
    margin-bottom: 16px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 10px;
    font-size: 15px;
    color: #cbd5e1;
}

.inventory-info-bar .info-bar-item {
    display: flex;
    align-items: center;
    gap: 6px;
}

.inventory-info-bar strong {
    color: #fbbf24;
    font-size: 17px;
}

.section-title {
    font-size: 16px;
    color: #fbbf24;
    margin-bottom: 10px;
    font-weight: 700;
    text-align: center;
    letter-spacing: 1px;
}

/* ============================================================
   商店物品详情面板
   ============================================================ */
.shop-detail {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 14px;
    padding: 16px 20px;
    margin-bottom: 16px;
    text-align: left;
}

.shop-detail-info {
    display: flex;
    align-items: center;
    margin-bottom: 12px;
    font-size: 15px;
}

.shop-detail-label { color: #94a3b8; font-size: 14px; }
.shop-detail-spacer { flex: 1; }

.shop-detail-qty-row {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
    font-size: 15px;
}

.shop-qty-val {
    font-size: 24px;
    font-weight: 700;
    color: #fbbf24;
    min-width: 50px;
    text-align: center;
}

.shop-qty-slider {
    -webkit-appearance: none;
    appearance: none;
    flex: 1;
    height: 8px;
    border-radius: 4px;
    background: rgba(255, 255, 255, 0.15);
    outline: none;
    cursor: pointer;
}

.shop-qty-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: #f59e0b;
    border: 2px solid #fbbf24;
    cursor: pointer;
    box-shadow: 0 0 8px rgba(245, 158, 11, 0.5);
    transition: transform 0.1s;
}

.shop-qty-slider::-webkit-slider-thumb:hover { transform: scale(1.2); }
.shop-qty-slider::-webkit-slider-thumb:active { transform: scale(1.1); background: #fbbf24; }

.shop-qty-slider::-moz-range-thumb {
    width: 22px; height: 22px;
    border-radius: 50%;
    background: #f59e0b;
    border: 2px solid #fbbf24;
    cursor: pointer;
    box-shadow: 0 0 8px rgba(245, 158, 11, 0.5);
}

.shop-detail-total {
    font-size: 16px;
    margin-bottom: 14px;
    padding: 8px 12px;
    background: rgba(234, 179, 8, 0.1);
    border-radius: 8px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.gold-text { color: #eab308; font-weight: 700; }

/* ---- 死亡 ---- */
.death-content h2 {
    color: #ef4444;
    font-size: 36px;
}

#deathStats {
    font-size: 16px;
    line-height: 2;
    margin: 12px 0 20px;
    color: #cbd5e1;
}

/* ---- 开始菜单 ---- */
.start-content {
    min-width: 420px;
}

.start-controls {
    margin: 16px 0;
    font-size: 16px;
}

.start-controls input {
    margin-left: 8px;
    padding: 8px 14px;
    font-size: 16px;
    border: 2px solid rgba(255,255,255,0.2);
    border-radius: 8px;
    background: rgba(255,255,255,0.08);
    color: #fff;
    outline: none;
    width: 180px;
}

.start-controls input:focus { border-color: #f59e0b; }

.start-tips {
    margin-top: 20px;
    padding: 14px 18px;
    background: rgba(255,255,255,0.04);
    border-radius: 10px;
    font-size: 13px;
    color: #94a3b8;
    text-align: left;
    line-height: 1.8;
}

.start-tips p:first-child {
    color: #e2e8f0;
    margin-bottom: 4px;
}

/* ---- 通用按钮 ---- */
.supply-buttons,
.start-buttons {
    display: flex;
    gap: 14px;
    justify-content: center;
    margin-top: 8px;
}

.btn-primary,
.btn-secondary {
    font-size: 18px;
    font-weight: 700;
    padding: 12px 32px;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.15s;
    letter-spacing: 1px;
}

.btn-primary {
    background: linear-gradient(135deg, #f59e0b, #d97706);
    color: #1a1a2e;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(245, 158, 11, 0.4);
}

.btn-primary:active { transform: scale(0.96); }

.btn-secondary {
    background: rgba(255,255,255,0.1);
    color: #cbd5e1;
    border: 2px solid rgba(255,255,255,0.2);
}

.btn-secondary:hover {
    background: rgba(255,255,255,0.2);
}

/* ---- 背包提示 ---- */
.warehouse-tip {
    font-size: 13px;
    color: #94a3b8;
    margin: 8px 0 0;
}

.warehouse-tip kbd {
    display: inline-block;
    background: rgba(255,255,255,0.15);
    border: 1px solid rgba(255,255,255,0.3);
    border-radius: 4px;
    padding: 2px 8px;
    font-family: inherit;
    font-weight: 700;
    color: #fbbf24;
}

/* ============================================================
   装备 Tooltip（最高 z-index，保证最前置）
   ============================================================ */
.warehouse-tooltip {
    position: fixed;
    z-index: 99999;
    background: rgba(15, 23, 42, 0.97);
    border: 2px solid rgba(245, 158, 11, 0.6);
    border-radius: 10px;
    padding: 10px 14px;
    font-size: 13px;
    color: #e2e8f0;
    white-space: pre-line;
    line-height: 1.7;
    pointer-events: none;
    box-shadow: 0 8px 24px rgba(0,0,0,0.6);
    max-width: 220px;
}

/* ============================================================
   人物界面 (Character Panel)
   ============================================================ */
.character-panel {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
}

.char-equip-wrapper {
    position: relative;
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* 3x3 装备槽网格 */
.char-equip-grid {
    display: grid;
    grid-template-columns: repeat(3, 72px);
    grid-template-rows: repeat(3, 72px);
    gap: 8px;
    position: relative;
    z-index: 2;
}

.char-equip-slot {
    width: 72px;
    height: 72px;
    background: rgba(255,255,255,0.06);
    border: 2px solid rgba(255,255,255,0.2);
    border-radius: 10px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
    position: relative;
}

.char-equip-slot:hover {
    border-color: rgba(255,255,255,0.5);
    background: rgba(255,255,255,0.12);
}

.char-equip-slot.filled {
    border-color: #22c55e;
    background: rgba(34, 197, 94, 0.15);
    box-shadow: 0 0 10px rgba(34, 197, 94, 0.2);
}

.char-equip-slot.empty-slot {
    border-style: dashed;
    border-color: rgba(255,255,255,0.1);
}

.char-equip-icon { font-size: 30px; line-height: 1; }

.char-equip-slot.empty-slot .char-equip-icon { opacity: 0.3; }

.char-equip-lv {
    font-size: 9px;
    font-weight: 700;
    color: #fbbf24;
    background: rgba(0,0,0,0.6);
    padding: 1px 4px;
    border-radius: 3px;
    margin-top: 1px;
}

/* 中间卡通人物 */
.char-figure {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    pointer-events: none;
}

.char-figure-head {
    width: 32px;
    height: 32px;
    background: #fbbf24;
    border-radius: 50%;
    border: 2px solid #d97706;
    position: relative;
    z-index: 3;
}

.char-figure-body {
    width: 36px;
    height: 28px;
    background: #3b82f6;
    border-radius: 6px;
    margin-top: -4px;
    border: 1px solid #2563eb;
    position: relative;
    z-index: 2;
}

.char-figure-legs {
    display: flex;
    gap: 4px;
    margin-top: -2px;
    position: relative;
    z-index: 1;
}

.char-figure-leg {
    width: 10px;
    height: 20px;
    background: #1e3a5f;
    border-radius: 3px;
}

/* ============================================================
   属性值面板
   ============================================================ */
.attr-section {
    width: 100%;
    margin-top: 8px;
}

.attr-section h3 {
    font-size: 18px;
    color: #f1f5f9;
    margin-bottom: 10px;
}

.attr-panel {
    display: flex;
    flex-direction: column;
    gap: 6px;
    background: rgba(255,255,255,0.04);
    border-radius: 10px;
    padding: 10px 14px;
    border: 1px solid rgba(255,255,255,0.1);
    max-width: 280px;
    margin: 0 auto;
}

.attr-row {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    color: #cbd5e1;
    padding: 3px 0;
    border-bottom: 1px solid rgba(255,255,255,0.04);
}

.attr-row:last-child { border-bottom: none; }

/* 带进度条的行允许换行 */
.attr-row-bar {
    flex-wrap: wrap;
}

.attr-icon {
    font-size: 16px;
    width: 22px;
    text-align: center;
}

.attr-label {
    font-weight: 600;
    color: #94a3b8;
    min-width: 36px;
}

.attr-val {
    font-size: 15px;
    font-weight: 700;
    color: #fbbf24;
    min-width: 70px;
    text-align: right;
}

.attr-bonus {
    font-size: 12px;
    font-weight: 600;
    color: #4ade80;
}

/* ========== 属性进度条 ========== */
.attr-bar-bg {
    width: 100%;
    height: 8px;
    background: rgba(255,255,255,0.08);
    border-radius: 4px;
    margin: 4px auto 0;
    overflow: hidden;
}

.attr-bar-fill {
    height: 100%;
    border-radius: 4px;
    transition: width 0.35s ease;
}

.attr-bar-hp {
    background: linear-gradient(90deg, #ef4444, #f87171);
    box-shadow: 0 0 6px rgba(239, 68, 68, 0.4);
}

.attr-bar-atk {
    background: linear-gradient(90deg, #f97316, #fb923c);
    box-shadow: 0 0 6px rgba(249, 115, 22, 0.4);
}

.attr-bar-def {
    background: linear-gradient(90deg, #3b82f6, #60a5fa);
    box-shadow: 0 0 6px rgba(59, 130, 246, 0.4);
}

.attr-bar-spd {
    background: linear-gradient(90deg, #22c55e, #4ade80);
    box-shadow: 0 0 6px rgba(34, 197, 94, 0.4);
}

.attr-bar-exp {
    background: linear-gradient(90deg, #8b5cf6, #a78bfa);
    box-shadow: 0 0 6px rgba(139, 92, 246, 0.4);
}

.attr-tip {
    font-size: 12px;
    color: #64748b;
    text-align: center;
    margin-top: 8px;
}

/* ============================================================
   交互提示
   ============================================================ */
#interactHint {
    position: absolute;
    bottom: 80px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0,0,0,0.75);
    border: 2px solid #22c55e;
    border-radius: 10px;
    padding: 10px 24px;
    font-size: 18px;
    font-weight: 700;
    color: #4ade80;
    z-index: 15;
    backdrop-filter: blur(6px);
    animation: hintFloat 1.5s ease-in-out infinite;
}

@keyframes hintFloat {
    0%, 100% { transform: translateX(-50%) translateY(0); }
    50%      { transform: translateX(-50%) translateY(-8px); }
}

/* ============================================================
   状态消息
   ============================================================ */
#statusMessage {
    position: absolute;
    top: 120px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0,0,0,0.8);
    border-radius: 10px;
    padding: 10px 24px;
    font-size: 16px;
    font-weight: 600;
    z-index: 100;
    pointer-events: none;
    animation: msgFade 2s forwards;
}

#statusMessage.success { border: 2px solid #22c55e; color: #4ade80; }
#statusMessage.warning { border: 2px solid #f59e0b; color: #fbbf24; }
#statusMessage.error   { border: 2px solid #ef4444; color: #f87171; }

@keyframes msgFade {
    0%   { opacity: 0; transform: translateX(-50%) translateY(10px); }
    15%  { opacity: 1; transform: translateX(-50%) translateY(0); }
    80%  { opacity: 1; }
    100% { opacity: 0; }
}

/* ============================================================
   移动端响应式适配
   ============================================================ */

/* ---- 平板及以下 (≤768px) ---- */
@media (max-width: 768px) {
    /* 菜单按钮缩小 */
    .menu-toggle-btn {
        top: 8px;
        left: 8px;
        padding: 6px 10px;
        font-size: 13px;
        border-radius: 8px;
    }

    /* 侧边菜单变窄 */
    .side-menu {
        width: 170px;
        padding: 48px 8px 12px;
        gap: 4px;
    }
    .menu-item {
        padding: 6px 10px;
        font-size: 12px;
        gap: 4px;
        border-radius: 8px;
    }
    .menu-icon { font-size: 14px; }

    /* 模态弹窗通用 */
    .modal-content {
        min-width: auto;
        max-width: 95vw;
        padding: 16px 14px;
        border-radius: 14px;
        max-height: 90vh;
    }
    .modal-content h2 { font-size: 20px; }
    .modal-content h1 { font-size: 30px; }

    /* 开始菜单 */
    .start-content {
        min-width: auto;
        width: 92vw;
    }
    .start-controls input {
        width: 140px;
        font-size: 14px;
    }
    .start-tips {
        font-size: 11px;
        padding: 10px 12px;
        line-height: 1.6;
    }

    /* 九宫格商店 */
    .shop-grid {
        grid-template-columns: repeat(3, 60px);
        grid-template-rows: repeat(3, 60px);
        gap: 6px;
    }
    .shop-cell {
        width: 60px;
        height: 60px;
        border-radius: 10px;
    }
    .shop-cell-icon { font-size: 22px; }
    .shop-cell-name { font-size: 10px; }

    .shop-detail {
        padding: 10px 12px;
        font-size: 13px;
    }
    .shop-qty-val { font-size: 20px; min-width: 40px; }

    /* 按钮 */
    .btn-primary, .btn-secondary {
        font-size: 15px;
        padding: 10px 20px;
        border-radius: 10px;
    }

    /* ---- 背包/仓库模态窗响应式 ---- */
    .inventory-content {
        max-width: 95vw;
        padding: 12px 10px !important;
    }

    /* 人物+属性：从左右并排改为上下堆叠 */
    .inventory-top-row {
        flex-direction: column;
        gap: 10px;
        margin-bottom: 10px;
    }

    .inventory-char-section {
        align-items: center;
    }

    .inventory-attr-section {
        width: 100%;
    }

    /* 3x3 装备槽缩小 */
    .char-equip-grid {
        grid-template-columns: repeat(3, 54px);
        grid-template-rows: repeat(3, 54px);
        gap: 5px;
    }
    .char-equip-slot {
        width: 54px;
        height: 54px;
        border-radius: 8px;
    }
    .char-equip-icon { font-size: 24px; }
    .char-equip-lv { font-size: 8px; }

    /* 卡通人物缩小 */
    .char-figure-head {
        width: 24px;
        height: 24px;
    }
    .char-figure-body {
        width: 28px;
        height: 22px;
    }
    .char-figure-leg {
        width: 8px;
        height: 16px;
    }

    /* 属性面板 */
    .attr-panel {
        max-width: 100%;
        padding: 8px 10px;
        gap: 3px;
    }
    .attr-row {
        font-size: 12px;
        gap: 4px;
    }
    .attr-icon { font-size: 13px; width: 18px; }
    .attr-label { min-width: 28px; font-size: 12px; }
    .attr-val { font-size: 13px; min-width: 55px; }
    .attr-bonus { font-size: 10px; }
    .attr-bar-bg { height: 6px; }

    /* 信息条 */
    .inventory-info-bar {
        font-size: 13px;
        padding: 6px 10px;
        margin-bottom: 10px;
    }
    .inventory-info-bar strong { font-size: 14px; }

    /* 背包网格缩小 (6x3 → 每格缩小) */
    .backpack-grid {
        grid-template-columns: repeat(6, 48px);
        grid-template-rows: repeat(3, 48px);
        gap: 4px;
    }
    .backpack-cell {
        width: 48px;
        height: 48px;
        border-radius: 8px;
    }
    .backpack-cell-icon { font-size: 18px; }
    .backpack-cell-name { font-size: 9px; }
    .backpack-cell-qty {
        font-size: 9px;
        min-width: 14px;
        height: 14px;
        line-height: 14px;
        border-radius: 7px;
        padding: 0 3px;
    }
    .backpack-cell-level { font-size: 7px; }

    .warehouse-tip {
        font-size: 10px;
        line-height: 1.4;
    }
    .warehouse-tip kbd {
        padding: 1px 5px;
        font-size: 10px;
    }

    /* 装备tooltip */
    .warehouse-tooltip {
        max-width: 180px;
        font-size: 11px;
        padding: 8px 10px;
    }

    .section-title { font-size: 14px; }

    /* 弹药警告 */
    #ammoWarning {
        bottom: 100px;
        font-size: 14px;
        padding: 8px 18px;
    }

    /* 交互提示 */
    #interactHint {
        bottom: 60px;
        font-size: 14px;
        padding: 8px 16px;
    }

    /* 状态消息 */
    #statusMessage {
        top: 60px;
        font-size: 13px;
        padding: 8px 16px;
    }

    /* 死亡弹窗 */
    .death-content h2 { font-size: 26px; }
    #deathStats { font-size: 14px; line-height: 1.6; }
}

/* ---- 小屏手机 (≤480px) ---- */
@media (max-width: 480px) {
    .menu-toggle-btn {
        top: 6px;
        left: 6px;
        padding: 5px 8px;
        font-size: 12px;
        border-radius: 7px;
    }

    .side-menu {
        width: 150px;
        padding: 42px 6px 10px;
        gap: 3px;
    }
    .menu-item {
        padding: 5px 8px;
        font-size: 11px;
        gap: 3px;
        border-radius: 7px;
    }
    .menu-icon { font-size: 13px; }

    .modal-content {
        padding: 12px 8px;
        border-radius: 12px;
    }
    .modal-content h2 { font-size: 18px; }
    .modal-content h1 { font-size: 26px; }

    .start-content {
        width: 96vw;
    }
    .start-controls {
        font-size: 14px;
    }
    .start-controls input {
        width: 110px;
        font-size: 13px;
        padding: 6px 10px;
    }
    .start-tips {
        font-size: 10px;
        padding: 8px 10px;
    }

    /* 九宫格商店进一步缩小 */
    .shop-grid {
        grid-template-columns: repeat(3, 48px);
        grid-template-rows: repeat(3, 48px);
        gap: 4px;
    }
    .shop-cell {
        width: 48px;
        height: 48px;
        border-radius: 8px;
    }
    .shop-cell-icon { font-size: 18px; }
    .shop-cell-name { font-size: 9px; }

    .btn-primary, .btn-secondary {
        font-size: 13px;
        padding: 8px 16px;
    }

    /* 装备槽进一步缩小 */
    .char-equip-grid {
        grid-template-columns: repeat(3, 44px);
        grid-template-rows: repeat(3, 44px);
        gap: 4px;
    }
    .char-equip-slot {
        width: 44px;
        height: 44px;
    }
    .char-equip-icon { font-size: 20px; }

    .char-figure-head { width: 20px; height: 20px; }
    .char-figure-body { width: 24px; height: 18px; }
    .char-figure-leg { width: 7px; height: 12px; }

    /* 属性面板 */
    .attr-panel {
        padding: 6px 8px;
        gap: 2px;
    }
    .attr-row { font-size: 11px; }
    .attr-val { font-size: 11px; min-width: 45px; }
    .attr-bar-bg { height: 5px; }

    /* 背包网格进一步缩小 */
    .backpack-grid {
        grid-template-columns: repeat(6, 38px);
        grid-template-rows: repeat(3, 38px);
        gap: 3px;
    }
    .backpack-cell {
        width: 38px;
        height: 38px;
        border-radius: 6px;
    }
    .backpack-cell-icon { font-size: 15px; }
    .backpack-cell-name { font-size: 8px; }

    /* 弹药警告 */
    #ammoWarning {
        bottom: 80px;
        font-size: 12px;
        padding: 6px 14px;
    }

    /* 交互提示 */
    #interactHint {
        bottom: 50px;
        font-size: 12px;
        padding: 6px 12px;
    }

    .supply-buttons, .start-buttons {
        gap: 8px;
    }
}

/* ---- 横屏手机高度限制 ---- */
@media (max-height: 500px) {
    .modal-content {
        max-height: 96vh;
        padding: 10px 12px;
    }
    .inventory-top-row {
        flex-direction: row;
        gap: 8px;
    }
    .backpack-grid {
        grid-template-columns: repeat(6, 36px);
        grid-template-rows: repeat(3, 36px);
        gap: 2px;
    }
    .backpack-cell {
        width: 36px;
        height: 36px;
    }
    .char-equip-grid {
        grid-template-columns: repeat(3, 38px);
        grid-template-rows: repeat(3, 38px);
        gap: 3px;
    }
    .char-equip-slot {
        width: 38px;
        height: 38px;
    }
    .side-menu {
        padding-top: 40px;
        gap: 2px;
    }
    .menu-item {
        padding: 4px 8px;
        font-size: 11px;
    }
}

/* ============================================================
   通用隐藏
   ============================================================ */
.hidden {
    display: none !important;
}
