extrasneo111 / style.css
jihaitang's picture
Upload 3 files
c421b53 verified
* {
margin: 0;
padding: 0;
box-sizing: border-box;
user-select: none;
}
body {
font-family: 'ZCOOL XiaoWei', 'Microsoft YaHei', sans-serif;
background-color: #000;
color: #fff;
overflow: hidden;
}
.game-container {
width: 100vw;
height: 100vh;
position: relative;
/* background: ... 由JS动态设置 */
display: flex;
flex-direction: column;
background-size: cover;
background-position: center;
background-repeat: no-repeat;
}
.battle-scene {
flex: 1;
position: relative;
display: flex;
justify-content: space-between;
align-items: flex-end;
padding-bottom: 100px;
}
/* 状态区样式 */
.player-status-area {
position: absolute;
top: 15px;
left: 15px;
background-color: rgba(0, 0, 0, 0.7);
border-radius: 5px;
padding: 10px;
z-index: 5;
border: 1px solid rgba(255, 255, 255, 0.3);
box-shadow: 0 0 10px rgba(0, 0, 0, 0.5);
}
.enemy-status-area {
position: absolute;
top: 15px;
right: 15px;
background-color: rgba(0, 0, 0, 0.7);
border-radius: 5px;
padding: 10px;
z-index: 5;
border: 1px solid rgba(255, 255, 255, 0.3);
box-shadow: 0 0 10px rgba(0, 0, 0, 0.5);
}
.health-container {
display: flex;
align-items: center;
min-width: 200px;
margin-bottom: 5px;
position: relative;
}
.health-bar {
flex: 1;
height: 20px;
background-color: #333;
border-radius: 3px;
overflow: hidden;
margin-right: 60px;
border: 1px solid rgba(255, 255, 255, 0.2);
}
.health-fill {
height: 100%;
background: linear-gradient(to right, #ff0043, #ff6a00);
width: 100%;
transition: width 0.5s cubic-bezier(.4,2,.6,1);
}
.health-text {
position: absolute;
right: 0;
font-size: 14px;
color: #fff;
min-width: 60px;
text-align: right;
}
.energy-display {
display: flex;
justify-content: flex-end;
align-items: center;
}
.energy-value {
font-size: 14px;
color: #ffcc00;
margin-right: 5px;
}
.energy-icon {
color: #ffcc00;
font-size: 16px;
}
/* 回合指示器 */
.turn-indicator {
position: absolute;
top: 80px;
left: 20px;
background-color: rgba(0, 0, 0, 0.7);
padding: 8px 20px;
border-radius: 20px;
z-index: 5;
font-size: 18px;
font-weight: bold;
border: 1px solid rgba(255, 255, 255, 0.3);
box-shadow: 0 0 10px rgba(0, 0, 0, 0.5);
}
/* 命令区域 - 水墨风格 */
.command-area {
position: absolute;
bottom: 30px;
left: 50%;
transform: translateX(-50%);
width: 90%;
max-width: 800px;
background-color: rgba(0, 0, 0, 0.7);
border-radius: 10px;
padding: 15px;
z-index: 10;
border: 1px solid rgba(255, 255, 255, 0.3);
box-shadow: 0 0 20px rgba(0, 0, 0, 0.6);
}
.command-label {
margin-bottom: 10px;
font-size: 24px;
color: #eee;
text-align: center;
font-family: 'Ma Shan Zheng', cursive;
text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
}
.command-buttons {
display: flex;
justify-content: space-around;
gap: 10px;
}
/* 指令按钮浮动样式 - 修复版本:始终紧贴左边缘 */
.command-buttons-floating {
position: absolute;
left: 0; /* 始终紧贴左边缘 */
bottom: 0;
display: flex;
flex-direction: row; /* 始终保持水平排列 */
gap: clamp(2px, 1vw, 12px); /* 自适应间距 */
padding: clamp(2px, 0.5vw, 8px) 0 0 clamp(2px, 0.5vw, 8px); /* 左边距很小 */
z-index: 10;
width: 50vw; /* 总宽度占页面50% */
min-width: 280px;
max-width: 50vw;
justify-content: space-between;
}
.command-btn {
flex: 1 1 0;
margin: 0;
/* 自适应内边距 */
padding: clamp(0.5vw, 1.2vw, 1.5vw) clamp(0.3vw, 0.8vw, 1vw);
/* 自适应高度 */
height: clamp(60px, 8vw, 120px);
border-radius: clamp(4px, 0.8vw, 8px);
background: #111 !important;
color: #fff !important;
border: 1px solid #333;
box-shadow: 1px 1px 4px rgba(0,0,0,0.15);
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
min-width: 0;
cursor: pointer;
transition: all 0.2s;
position: relative;
overflow: hidden;
}
.command-btn::before {
content: '';
position: absolute;
top: -2px;
left: -2px;
right: -2px;
bottom: -2px;
background: linear-gradient(45deg, transparent, rgba(255, 255, 255, 0.1), transparent);
z-index: -1;
border-radius: clamp(4px, 0.8vw, 8px);
}
.command-btn:hover:not(.disabled) {
background: #222 !important;
transform: translateY(-2px);
box-shadow: 0 6px 12px rgba(0, 0, 0, 0.4);
border-color: #666;
}
.command-btn:active:not(.disabled) {
background: #333 !important;
transform: translateY(0);
}
.command-btn.selected {
background: linear-gradient(135deg, #1a3a75, #0c1f3e) !important;
border-color: #3a6cbf;
box-shadow: 0 0 15px rgba(58, 108, 191, 0.6);
}
.command-btn.disabled {
opacity: 0.5;
cursor: not-allowed;
}
/* 键位提示自适应 */
.command-btn .key-hint {
position: absolute;
top: clamp(2px, 0.5vw, 6px);
left: clamp(2px, 0.5vw, 6px);
background-color: rgba(0, 0, 0, 0.7);
color: #fff;
font-size: clamp(0.7rem, 1.5vw, 1rem);
padding: clamp(1px, 0.3vw, 4px) clamp(3px, 0.6vw, 8px);
border-radius: clamp(2px, 0.4vw, 4px);
line-height: 1;
}
/* 按钮名称自适应 */
.command-btn .btn-name {
font-size: clamp(0.9rem, 2.2vw, 1.8rem);
font-weight: bold;
font-family: 'Ma Shan Zheng', cursive;
text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.5);
text-align: center;
line-height: 1.1;
margin-top: clamp(2px, 0.5vw, 8px);
}
/* 战斗日志 - 水墨风 */
.battle-log {
height: 80px;
background-color: rgba(0, 0, 0, 0.8);
border-top: 1px solid #444;
padding: 10px 20px;
overflow-y: auto;
font-size: 16px;
line-height: 1.5;
border-bottom: 1px solid rgba(255, 255, 255, 0.2);
position: relative;
z-index: 10;
}
/* 确认弹窗 - 水墨风 */
.modal {
display: none;
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
background-color: rgba(0, 0, 0, 0.7);
z-index: 100;
align-items: center;
justify-content: center;
}
.modal-content {
/* background: ... 由JS动态设置 */
width: 350px;
border-radius: 5px;
box-shadow: 0 0 20px rgba(0, 0, 0, 0.8);
color: #fff;
position: relative;
border: 2px solid #553c28;
overflow: hidden;
}
.modal-header {
padding: 15px;
background-color: rgba(0, 0, 0, 0.6);
font-size: 24px;
font-weight: bold;
text-align: center;
border-bottom: 1px solid rgba(255, 255, 255, 0.2);
font-family: 'Ma Shan Zheng', cursive;
}
.modal-body {
padding: 20px;
font-size: 18px;
text-align: center;
}
.modal-footer {
padding: 15px;
display: flex;
justify-content: space-around;
border-top: 1px solid rgba(255, 255, 255, 0.2);
}
.modal-footer button {
padding: 10px 20px;
border: none;
border-radius: 4px;
cursor: pointer;
font-size: 16px;
font-family: 'ZCOOL XiaoWei', sans-serif;
transition: all 0.3s;
}
#confirm-action {
background: linear-gradient(to bottom, #5c3b1c, #34210f);
color: white;
border: 1px solid #7c5a3d;
}
#confirm-action:hover {
background: linear-gradient(to bottom, #6c4a2b, #3e2914);
transform: translateY(-2px);
box-shadow: 0 2px 5px rgba(0, 0, 0, 0.3);
}
#cancel-action {
background: linear-gradient(to bottom, #444, #222);
color: #ddd;
border: 1px solid #666;
}
#cancel-action:hover {
background: linear-gradient(to bottom, #555, #333);
transform: translateY(-2px);
box-shadow: 0 2px 5px rgba(0, 0, 0, 0.3);
}
/* 动画效果 */
@keyframes attack {
0% { transform: translateX(0); }
25% { transform: translateX(40px); }
50% { transform: translateX(0); }
100% { transform: translateX(0); }
}
@keyframes enemy-attack {
0% { transform: translateX(0); }
25% { transform: translateX(-40px); }
50% { transform: translateX(0); }
100% { transform: translateX(0); }
}
@keyframes hit {
0% { filter: brightness(1); }
25% { filter: brightness(3) saturate(2); }
50% { filter: brightness(1); }
100% { filter: brightness(1); }
}
@keyframes defend {
0% { filter: brightness(1); }
50% { filter: brightness(1.5) hue-rotate(120deg); }
100% { filter: brightness(1); }
}
@keyframes special {
0% { filter: brightness(1); }
25% { filter: brightness(2) saturate(2) hue-rotate(270deg); }
50% { filter: brightness(1.5) saturate(1.5) hue-rotate(180deg); }
75% { filter: brightness(2) saturate(2) hue-rotate(90deg); }
100% { filter: brightness(1); }
}
.player-attack {
animation: attack 0.6s ease;
}
.enemy-attack {
animation: enemy-attack 0.6s ease;
}
.player-hit {
animation: hit 0.6s ease;
}
.enemy-hit {
animation: hit 0.6s ease;
}
.player-defend {
animation: defend 1s ease;
}
.enemy-defend {
animation: defend 1s ease;
}
.player-special {
animation: special 1s ease;
}
.enemy-special {
animation: special 1s ease;
}
/* 画面晃动动画 */
@keyframes shake {
0% { transform: translate(0, 0); }
20% { transform: translate(-10px, 0); }
40% { transform: translate(10px, 0); }
60% { transform: translate(-10px, 0); }
80% { transform: translate(10px, 0); }
100% { transform: translate(0, 0); }
}
.shake {
animation: shake 0.4s cubic-bezier(.36,.07,.19,.97) both;
}
/* 受击红色边缘高亮动画 */
@keyframes damage-flash {
0% { box-shadow: 0 0 0 0 rgba(255,0,0,0.7); }
30% { box-shadow: 0 0 0 20px rgba(255,0,0,0.5); }
60% { box-shadow: 0 0 0 40px rgba(255,0,0,0.2); }
100% { box-shadow: 0 0 0 0 rgba(255,0,0,0); }
}
.damage-flash {
animation: damage-flash 0.5s;
}
.npc-portrait-layer {
position: absolute;
left: 0; top: 0; right: 0; bottom: 0;
width: 100%;
height: 100%;
pointer-events: none;
z-index: 3;
background: none;
background-position: center center;
background-repeat: no-repeat;
background-size: cover;
transition: background-image 0.3s;
}
.npc-portrait-layer.shake {
animation: shake 0.4s cubic-bezier(.36,.07,.19,.97) both;
}
.screen-flash {
position: fixed;
left: 0; top: 0; right: 0; bottom: 0;
width: 100vw;
height: 100vh;
pointer-events: none;
z-index: 1000;
opacity: 0;
background: rgba(255,0,0,0.3);
box-shadow: 0 0 0 20px rgba(255,0,0,0.5), 0 0 60px 40px rgba(255,0,0,0.2) inset;
transition: opacity 0.2s;
}
.screen-flash.active {
opacity: 1;
transition: opacity 0.1s;
}
/* 移动端优化 - 始终保持紧贴左边缘的一排布局 */
@media (max-width: 900px) {
.battle-scene {
padding-bottom: 140px;
}
.command-buttons-floating {
width: 70vw; /* 在中等屏幕上稍微宽一点 */
min-width: 260px;
gap: clamp(2px, 0.8vw, 6px);
padding: clamp(2px, 0.4vw, 6px) 0 0 clamp(2px, 0.4vw, 6px);
/* 保持 left: 0,不要居中 */
}
.command-btn {
height: clamp(50px, 10vw, 80px);
}
.command-btn .btn-name {
font-size: clamp(0.8rem, 3vw, 1.2rem);
}
.command-btn .key-hint {
font-size: clamp(0.6rem, 2vw, 0.9rem);
}
.health-container {
min-width: 150px;
}
}
@media (max-width: 600px) {
.command-buttons-floating {
width: 85vw; /* 在小屏幕上占更多宽度 */
min-width: 240px;
/* 关键:不设置居中,保持 left: 0 */
gap: clamp(1px, 0.5vw, 4px);
padding: clamp(1px, 0.3vw, 4px) 0 0 clamp(1px, 0.3vw, 4px);
/* 确保 flex-direction 始终为 row */
flex-direction: row;
}
.command-btn {
height: clamp(40px, 12vw, 60px);
}
.command-btn .btn-name {
font-size: clamp(0.7rem, 3.5vw, 1rem);
}
.command-btn .key-hint {
font-size: clamp(0.5rem, 2.5vw, 0.8rem);
}
}
/* 超大屏幕优化 */
@media (min-width: 1400px) {
.command-buttons-floating {
width: 45vw; /* 在大屏幕上稍微收窄 */
max-width: 700px; /* 设置最大宽度避免过宽 */
}
.command-btn {
height: clamp(80px, 6vw, 100px);
}
.command-btn .btn-name {
font-size: clamp(1.2rem, 1.8vw, 1.6rem);
}
}
/* 超小屏幕优化 - 保持一排并紧贴左边缘 */
@media (max-width: 480px) {
.command-buttons-floating {
width: 95vw; /* 几乎占满整个宽度 */
min-width: 200px;
gap: clamp(1px, 0.2vw, 2px); /* 很小的间距 */
padding: 2px 0 0 2px; /* 很小的左边距 */
/* 确保始终水平排列 */
flex-direction: row;
}
.command-btn {
height: clamp(35px, 14vw, 50px);
padding: clamp(0.2vw, 0.8vw, 1vw) clamp(0.1vw, 0.4vw, 0.6vw);
}
.command-btn .btn-name {
font-size: clamp(0.6rem, 4vw, 0.9rem);
}
.command-btn .key-hint {
font-size: clamp(0.4rem, 3vw, 0.7rem);
padding: clamp(0.5px, 0.1vw, 2px) clamp(2px, 0.3vw, 4px);
}
}