/* 全局样式 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Microsoft YaHei', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #333;
    min-height: 100vh;
    overflow-x: hidden;
}

.game-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* 顶部状态栏 */
.status-bar {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-radius: 15px;
    padding: 20px;
    margin-bottom: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.clock-section, .status-section {
    flex: 1;
}

.clock-section h3, .status-section h3 {
    color: #4a5568;
    font-size: 1.1rem;
    margin-bottom: 10px;
    font-weight: 600;
}

.clock-display {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.clock-display span {
    font-size: 1.2rem;
    font-weight: 600;
    color: #2d3748;
}

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

.status-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    column-gap: 24px;  /* 增大两列之间的间距，避免重叠 */
    row-gap: 12px;
}

.tag-row {
    display: flex;
    align-items: center;
    gap: 8px;
}

.tag-label {
    font-weight: 600;
    color: #4a5568;
    min-width: 60px;
}

.tag-list {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.rebirth-btn {
    padding: 6px 12px;
    background: #805ad5;
    color: #fff;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
}
.rebirth-btn:hover { background: #6b46c1; }

/* 重生按钮禁用态（置灰） */
.rebirth-btn.disabled,
.rebirth-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    background: #a0aec0; /* 灰紫色 */
    color: #f7fafc;
}
.rebirth-btn.disabled:hover,
.rebirth-btn:disabled:hover {
    background: #a0aec0;
}

.tag-chip {
    padding: 4px 8px;
    background: #f7fafc;
    border: 1px solid #e2e8f0;
    border-radius: 14px;
    font-size: 12px;
    color: #2d3748;
    transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease;
    cursor: default;
}

.tag-chip:hover {
    background: #ebf8ff;        /* 浅蓝背景 */
    border-color: #90cdf4;      /* 边框高亮 */
    color: #2b6cb0;             /* 文字变色 */
}

.status-item {
    display: grid;
    grid-template-columns: 80px 1fr max-content; /* 值列使用自适应宽度 */
    align-items: center;
    column-gap: 10px;
}

.status-label {
    font-weight: 600;
    color: #4a5568;
    min-width: 60px;
}

.status-bar-item {
    flex: 1;
    height: 12px;
    background: #e2e8f0;
    border-radius: 6px;
    overflow: hidden;
    position: relative;
}

.status-value {
    font-weight: 600;
    color: #2d3748;
    text-align: right;
    min-width: 72px;         /* 确保如 100/120 有足够空间 */
    white-space: nowrap;     /* 防止换行导致布局错乱 */
}

.status-fill {
    height: 100%;
    border-radius: 6px;
    transition: width 0.3s ease;
}

.hp-fill { background: linear-gradient(90deg, #48bb78, #38a169); }
.san-fill { background: linear-gradient(90deg, #4299e1, #3182ce); }
.hunger-fill { background: linear-gradient(90deg, #ed8936, #dd6b20); }
.sleep-fill { background: linear-gradient(90deg, #9f7aea, #805ad5); }

/* 主要内容区域 */
.main-content {
    display: grid;
    grid-template-columns: 1fr 2fr 1fr;
    gap: 20px;
    flex: 1;
}

/* 区域信息 */
.area-section {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-radius: 15px;
    padding: 20px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.area-section h3 {
    color: #4a5568;
    font-size: 1.3rem;
    margin-bottom: 15px;
    font-weight: 600;
    text-align: center;
}

.area-display {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.current-area h4, .area-description h4, .available-actions h4 {
    color: #2d3748;
    font-size: 1rem;
    margin-bottom: 8px;
    font-weight: 600;
}

.current-area p, .area-description p {
    color: #4a5568;
    line-height: 1.6;
}

.available-actions ul {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.available-actions li {
    padding: 8px 12px;
    background: #f7fafc;
    border-radius: 8px;
    color: #4a5568;
    cursor: pointer;
    transition: all 0.2s ease;
    border: 1px solid #e2e8f0;
}

.available-actions li:hover {
    background: #edf2f7;
    transform: translateY(-1px);
}

/* 邻近区域-不可前往样式 */
.available-actions li.action-disabled {
    opacity: 0.6;
    cursor: not-allowed;
    background: #f9fafb;
}
.available-actions li.action-disabled:hover {
    background: #f9fafb;
    transform: none;
}

/* 交互区域 */
.interaction-section {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-radius: 15px;
    padding: 20px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    display: flex;
    flex-direction: column;
}

.interaction-section h3 {
    color: #4a5568;
    font-size: 1.3rem;
    margin-bottom: 15px;
    font-weight: 600;
    text-align: center;
}

.interaction-display {
    display: flex;
    flex-direction: column;
    gap: 20px;
    flex: 1;
}

.chat-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.chat-container {
    display: flex;
    gap: 15px;
    flex: 1;
}

.interactive-people {
    width: 150px;
    background: #f7fafc;
    border-radius: 10px;
    padding: 15px;
    border: 1px solid #e2e8f0;
}

.interactive-people h4 {
    color: #2d3748;
    font-size: 1rem;
    margin-bottom: 10px;
    font-weight: 600;
}

#people-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.person-item {
    padding: 8px 12px;
    background: white;
    border-radius: 6px;
    color: #4a5568;
    cursor: pointer;
    transition: all 0.2s ease;
    border: 1px solid #e2e8f0;
    font-size: 0.9rem;
}

.person-item:hover {
    background: #edf2f7;
    transform: translateY(-1px);
}

.person-item.selected {
    background: #ebf8ff;
    border-color: #4299e1;
    color: #2b6cb0;
    position: relative;
}

.person-item.selected::after {
    content: '✓';
    position: absolute;
    top: 2px;
    right: 6px;
    font-size: 12px;
    font-weight: bold;
    color: #4299e1;
}

.clear-btn {
    width: 100%;
    margin-top: 10px;
    padding: 6px 12px;
    background: #f56565;
    color: white;
    border: none;
    border-radius: 4px;
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.clear-btn:hover {
    background: #e53e3e;
    transform: translateY(-1px);
}

.chat-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 15px;
}



.chat-messages {
    flex: 1;
    background: #f7fafc;
    border-radius: 10px;
    padding: 15px;
    max-height: 300px;
    overflow-y: auto;
    border: 1px solid #e2e8f0;
}

.message {
    margin-bottom: 10px;
    padding: 8px 12px;
    border-radius: 8px;
    background: white;
    border: 1px solid #e2e8f0;
}

.system-message {
    background: #ebf8ff;
    border-color: #bee3f8;
}

.self-message {
    background: #f0fff4;
    border-color: #9ae6b4;
}

.npc-message {
    background: #fef5e7;
    border-color: #f6ad55;
}

.player-message {
    background: #f7fafc;
    border-color: #e2e8f0;
}

.message-time {
    color: #718096;
    font-size: 0.9rem;
    margin-right: 8px;
}

.message-content {
    color: #2d3748;
}

.input-area {
    display: flex;
    gap: 10px;
}

.input-area input {
    flex: 1;
    padding: 12px 15px;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    font-size: 1rem;
    transition: border-color 0.2s ease;
}

.input-area input:focus {
    outline: none;
    border-color: #4299e1;
}

.input-area button {
    padding: 12px 20px;
    background: linear-gradient(135deg, #4299e1, #3182ce);
    color: white;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.input-area button:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(66, 153, 225, 0.3);
}

.quick-actions h4 {
    color: #2d3748;
    font-size: 1rem;
    margin-bottom: 10px;
    font-weight: 600;
}

.action-buttons {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
}

.action-btn {
    padding: 10px 15px;
    background: #f7fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    color: #4a5568;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.action-btn:hover {
    background: #edf2f7;
    transform: translateY(-1px);
}

/* 禁用态：战斗或死亡期间的可视化灰显 */
.action-btn.disabled,
.action-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    background: #f9fafb;
    color: #a0aec0;
    border-color: #e2e8f0;
    box-shadow: none;
    transform: none;
    pointer-events: none;
}
.action-btn.disabled:hover,
.action-btn:disabled:hover {
    background: #f9fafb;
    transform: none;
}

/* 背包区域 */
.inventory-section {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-radius: 15px;
    padding: 20px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.inventory-toolbar {
    display: flex;
    gap: 10px;
    margin-top: 12px;
    justify-content: flex-end;
}

.inventory-section h3 {
    color: #4a5568;
    font-size: 1.3rem;
    margin-bottom: 15px;
    font-weight: 600;
    text-align: center;
}

.inventory-display {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.inventory-stats {
    text-align: center;
    color: #4a5568;
    font-weight: 600;
    padding: 8px;
    background: #f7fafc;
    border-radius: 8px;
    border: 1px solid #e2e8f0;
}

.inventory-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
    padding: 15px;
    background: #f7fafc;
    border-radius: 10px;
    border: 1px solid #e2e8f0;
    min-height: 200px;
}

.inventory-slot {
    width: 50px;
    height: 50px;
    border: 2px dashed #cbd5e0;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    background: white;
}

.inventory-slot:hover {
    border-color: #4299e1;
    background: #ebf8ff;
}

.inventory-slot.filled {
    border-style: solid;
    border-color: #48bb78;
    background: #f0fff4;
}

/* 背包物品格：较小字号显示物品ID */
.inventory-grid .bag-item {
    font-size: 11px;
    line-height: 1.2;
    padding: 2px;
    text-align: center;
    word-break: break-all;
}

.inventory-slot.selected {
    border-color: #4299e1;
    background: #ebf8ff;
    box-shadow: 0 0 0 2px rgba(66, 153, 225, 0.3);
}

.selected-item {
    padding: 15px;
    background: #f7fafc;
    border-radius: 10px;
    border: 1px solid #e2e8f0;
}

.selected-item h4 {
    color: #2d3748;
    font-size: 1rem;
    margin-bottom: 10px;
    font-weight: 600;
}

.selected-item p {
    color: #718096;
    font-style: italic;
}

/* 响应式设计 */
@media (max-width: 1200px) {
    .main-content {
        grid-template-columns: 1fr 1.5fr 1fr;
    }
}

@media (max-width: 900px) {
    .main-content {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    .status-bar {
        flex-direction: column;
        gap: 20px;
    }
    
    .inventory-grid {
        grid-template-columns: repeat(6, 1fr);
    }
}

@media (max-width: 600px) {
    .game-container {
        padding: 10px;
    }
    
    .status-bar, .area-section, .interaction-section, .inventory-section {
        padding: 15px;
    }
    
    .action-buttons {
        grid-template-columns: 1fr;
    }
    
    .inventory-grid {
        grid-template-columns: repeat(4, 1fr);
    }
    
    .input-area {
        flex-direction: column;
    }
    
    .input-area button {
        width: 100%;
    }
    
    .chat-container {
        flex-direction: column;
    }
    
    .interactive-people {
        width: 100%;
        margin-bottom: 10px;
    }
    

}
