/* 基础样式与重置 */
@font-face {
    font-family: 'mplus_hzk_12';
    src: url('fonts/mplus_hzk_12.ttf') format('truetype');
    font-weight: normal;
    font-style: normal;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'mplus_hzk_12', 'Press Start 2P', cursive;
}

body {
    background-color: #0a0a0a;
    color: #fff;
    overflow: hidden;
    height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
}

/* 游戏容器 */
#game-container {
    position: relative;
    width: 800px;
    height: 600px;
    border: 4px solid #333;
    background-color: #1a1a1a;
    overflow: hidden;
}

/* 屏幕通用样式 */
.screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    padding: 1.5rem;
    transition: opacity 0.5s ease;
}

.hidden {
    display: none;
}

/* 像素风格标题 */
.pixel-title {
    font-size: 1.8rem;
    text-align: center;
    margin-bottom: 1.5rem;
    margin-top: 0.5rem;
    color: #ff4d4d;
    text-shadow: 2px 2px 0 #000;
    letter-spacing: 2px;
    font-weight: normal;
}

/* 返回按钮样式 */
.back-btn {
    position: absolute;
    top: 0.5rem;
    left: 0.5rem;
    padding: 0.6rem 1rem;
    background-color: #333;
    border: 2px solid #555;
    color: #fff;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

.back-btn:hover {
    background-color: #555;
    border-color: #ff4d4d;
}

/* 章节选择界面样式 */
.chapter-list {
    width: 100%;
    max-width: 600px;
    height: 450px;
    margin: 1rem auto;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    overflow-y: auto;
    padding: 0 10px;
}

/* 自定义滚动条 */
.chapter-list::-webkit-scrollbar {
    width: 8px;
}

.chapter-list::-webkit-scrollbar-track {
    background: #2a2a2a;
    border-radius: 4px;
}

.chapter-list::-webkit-scrollbar-thumb {
    background: #555;
    border-radius: 4px;
}

.chapter-list::-webkit-scrollbar-thumb:hover {
    background: #ff4d4d;
}

.chapter-item {
    background-color: #2a2a2a;
    padding: 1.5rem;
    border: 2px solid #555;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.chapter-item.available {
    border-color: #ff4d4d;
}

.chapter-item.available:hover {
    transform: scale(1.02);
    background-color: #333;
}

.chapter-item.locked {
    opacity: 0.7;
    cursor: not-allowed;
    border-color: #444;
}

.chapter-item .lock-icon {
    display: inline-block;
    margin-left: 0.5rem;
    color: #555;
}

.chapter-item h2 {
    color: #ff9999;
    margin-bottom: 0.5rem;
}

.chapter-item p {
    color: #999;
}

/* 开始界面样式 */
.start-options {
    max-width: 400px;
    margin: 0 auto;
    background-color: #2a2a2a;
    padding: 2rem;
    border: 2px solid #555;
    border-radius: 8px;
}

.name-input {
    margin-bottom: 1.5rem;
}

.name-input label {
    display: block;
    margin-bottom: 0.5rem;
    color: #ff9999;
}

.name-input input {
    width: 100%;
    padding: 0.8rem;
    background-color: #1a1a1a;
    border: 2px solid #555;
    color: #fff;
    font-size: 1rem;
    border-radius: 4px;
}

.gender-selection {
    margin-bottom: 1.5rem;
}

.gender-selection p {
    margin-bottom: 0.5rem;
    color: #ff9999;
}

.gender-options {
    display: flex;
    gap: 1rem;
}

.gender-btn {
    flex: 1;
    padding: 0.8rem;
    background-color: #333;
    border: 2px solid #555;
    color: #fff;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

.gender-btn:hover {
    background-color: #555;
}

.gender-btn.selected {
    background-color: #ff4d4d;
    border-color: #ff1a1a;
}

.start-btn {
    width: 100%;
    padding: 1rem;
    background-color: #ff4d4d;
    border: none;
    color: white;
    font-size: 1.2rem;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-top: 1rem;
}

.start-btn:disabled {
    background-color: #555;
    cursor: not-allowed;
}

.start-btn:hover:not(:disabled) {
    background-color: #ff1a1a;
    transform: scale(1.05);
}

.game-description {
    margin-top: 2rem;
    text-align: center;
    color: #999;
    line-height: 1.6;
}

/* 特殊性别弹窗样式 */
.special-gender-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.8);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.special-gender-content {
    background-color: #2a2a2a;
    border: 2px solid #555;
    border-radius: 8px;
    padding: 2rem;
    max-width: 400px;
    text-align: center;
}

.special-gender-title {
    color: #ff4d4d;
    font-size: 1.5rem;
    margin-bottom: 1rem;
    text-shadow: 2px 2px 0 #000;
}

.special-gender-options {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin: 1.5rem 0;
}

.special-gender-btn {
    padding: 0.8rem;
    background-color: #333;
    border: 2px solid #555;
    color: #fff;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

.special-gender-btn:hover {
    background-color: #555;
    border-color: #ff4d4d;
}

.special-gender-btn.selected {
    background-color: #ff4d4d;
    border-color: #ff4d4d;
    color: #fff;
}

.special-gender-close {
    margin-top: 1rem;
    padding: 0.5rem 1rem;
    background-color: #555;
    border: none;
    color: #fff;
    cursor: pointer;
    transition: all 0.3s ease;
}

.special-gender-close:hover {
    background-color: #777;
}

/* 结算界面样式 */
.result-info {
    max-width: 400px;
    margin: 2rem auto;
    background-color: #2a2a2a;
    padding: 1.5rem;
    border: 2px solid #555;
    border-radius: 8px;
    text-align: center;
}

.result-info p {
    margin-bottom: 1rem;
    color: #ff9999;
    font-size: 1.2rem;
}

.result-info span {
    color: #fff;
}

.result-actions {
    max-width: 400px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

/* 游戏界面样式 */
#game-header {
    display: flex;
    justify-content: space-between;
    padding: 0.5rem;
    background-color: #222;
    border-bottom: 2px solid #444;
}

#game-container-inner {
    display: flex;
    height: calc(100% - 180px);
}

#game-map {
    flex: 3;
    background-color: #111;
    position: relative;
    overflow: hidden;
}

#game-inventory {
    flex: 1;
    background-color: #222;
    border-left: 2px solid #444;
    padding: 0.5rem;
    display: flex;
    flex-direction: column;
}

.inventory-title {
    color: #ff9999;
    font-size: 1rem;
    margin-bottom: 0.5rem;
    text-align: center;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid #444;
}

#inventory-items {
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    padding: 0.5rem;
}

.inventory-item {
    background-color: #333;
    padding: 0.5rem;
    border: 1px solid #555;
    border-radius: 4px;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.inventory-item:hover {
    background-color: #444;
    border-color: #ff4d4d;
}

.inventory-empty {
    color: #777;
    text-align: center;
    padding: 1rem;
    font-size: 0.9rem;
}

/* 确保物品栏文字与像素风格一致 */
.inventory-title, .inventory-item-name, .inventory-empty {
    font-family: 'mplus_hzk_12', monospace;
    letter-spacing: 0;
}

/* 物品栏动画效果 */
.inventory-item {
    transition: all 0.2s ease;
    transform: scale(1);
}

.inventory-item:hover {
    transform: scale(1.03);
    box-shadow: 0 0 5px rgba(255, 77, 77, 0.5);
}

.inventory-item-icon {
    width: 24px;
    height: 24px;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 1.2rem;
}

.inventory-item-name {
    flex: 1;
}

/* 自定义滚动条 */
#inventory-items::-webkit-scrollbar {
    width: 8px;
}

#inventory-items::-webkit-scrollbar-track {
    background: #2a2a2a;
    border-radius: 4px;
}

#inventory-items::-webkit-scrollbar-thumb {
    background: #555;
    border-radius: 4px;
}

#inventory-items::-webkit-scrollbar-thumb:hover {
    background: #ff4d4d;
}

#game-dialogue {
    height: 120px;
    background-color: #222;
    border-top: 2px solid #444;
    padding: 1rem;
}

#dialogue-text {
    margin-bottom: 1rem;
    color: #ddd;
}

#dialogue-choices {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.choice-btn {
    padding: 0.5rem 1rem;
    background-color: #333;
    border: 1px solid #555;
    color: #fff;
    cursor: pointer;
    font-size: 0.9rem;
}

.choice-btn:hover {
    background-color: #555;
}

/* 死亡界面样式 */
#death-screen {
    background-color: rgba(0, 0, 0, 0.9);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

.death-title {
    font-size: 2.5rem;
    color: #ff4d4d;
    margin-bottom: 2rem;
    text-shadow: 4px 4px 0 #000;
}

#death-message {
    font-size: 1.2rem;
    color: #ff9999;
    margin-bottom: 2rem;
    text-align: center;
    max-width: 500px;
}

.restart-btn {
    padding: 1rem 2rem;
    background-color: #ff4d4d;
    border: none;
    color: white;
    font-size: 1.2rem;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
}

.restart-btn:hover {
    background-color: #ff1a1a;
    transform: scale(1.05);
}

/* 像素化效果 */
.pixel-title, .death-title {
    image-rendering: pixelated;
    image-rendering: crisp-edges;
}

.pixel-map {
    font-family: 'Courier New', Courier, monospace;
    color: #fff;
    line-height: 1;
    white-space: pre;
    font-size: 12px;
    letter-spacing: 0;
}

/* 隐藏屏幕 */
.hidden {
    display: none !important;
}

/* 动画效果 */
@keyframes flicker {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.8; }
}

.flicker {
    animation: flicker 0.5s infinite;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
}

.shake {
    animation: shake 0.5s infinite;
}