Files
Ubuntu 32b43f85bd a
2026-07-03 16:58:28 +08:00

867 lines
16 KiB
CSS

/* 斗地主UI样式 - 参考QQ斗地主 */
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
body {
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
background: linear-gradient(135deg, #0d2847 0%, #1a3a5c 50%, #0d2847 100%);
min-height: 100vh;
overflow: hidden;
}
/* ========== 顶部分数栏 ========== */
.score-bar {
position: fixed;
top: 10px;
right: 10px;
display: flex;
align-items: center;
gap: 15px;
background: rgba(0, 0, 0, 0.4);
backdrop-filter: blur(10px);
padding: 8px 16px;
border-radius: 20px;
border: 1px solid rgba(255, 215, 0, 0.2);
z-index: 1000;
}
.score-info {
display: flex;
align-items: center;
gap: 6px;
}
.score-label {
font-size: 12px;
color: rgba(255, 255, 255, 0.6);
}
.score-value {
font-size: 16px;
font-weight: bold;
color: #ffd700;
text-shadow: 0 0 10px rgba(255, 215, 0, 0.5);
}
.score-bar .user-name {
font-size: 13px;
color: rgba(255, 255, 255, 0.8);
padding-left: 12px;
border-left: 1px solid rgba(255, 255, 255, 0.2);
}
.game-container {
position: relative;
width: 100vw;
height: 100vh;
max-width: 1200px;
max-height: 900px;
margin: 0 auto;
}
/* ========== 牌桌背景纹理 ========== */
.game-container::before {
content: '';
position: absolute;
top: 0;
left: 0;
right: 0;
bottom: 0;
background-image:
radial-gradient(circle at 20% 50%, rgba(255,255,255,0.03) 0%, transparent 50%),
radial-gradient(circle at 80% 50%, rgba(255,255,255,0.03) 0%, transparent 50%);
pointer-events: none;
}
/* ========== 顶部底牌区 ========== */
.deck-area {
position: absolute;
top: 10px;
left: 10px;
display: flex;
flex-direction: column;
align-items: center;
gap: 5px;
z-index: 50;
}
.deck-label {
color: #ffd700;
font-size: 14px;
font-weight: bold;
text-shadow: 0 1px 2px rgba(0,0,0,0.5);
}
.deck-cards {
display: flex;
gap: -15px;
}
.deck-cards .card {
width: 50px;
height: 70px;
margin-left: -15px;
}
.deck-cards .card:first-child {
margin-left: 0;
}
/* ========== 扑克牌样式 ========== */
.card {
width: 80px;
height: 112px;
background: white;
border-radius: 8px;
border: 1px solid #ccc;
display: flex;
flex-direction: column;
justify-content: space-between;
padding: 6px;
box-shadow: 0 2px 8px rgba(0,0,0,0.3);
cursor: pointer;
transition: transform 0.2s, box-shadow 0.2s;
user-select: none;
position: relative;
overflow: hidden;
}
/* 扑克牌角标 */
.card::before {
content: '';
position: absolute;
top: 0;
left: 0;
right: 0;
height: 4px;
background: linear-gradient(90deg, transparent, rgba(0,0,0,0.1), transparent);
}
.card:hover {
transform: translateY(-5px);
box-shadow: 0 4px 12px rgba(0,0,0,0.4);
}
.card.selected {
transform: translateY(-15px);
box-shadow: 0 6px 16px rgba(255,215,0,0.4);
border-color: #ffd700;
}
.card.back {
background: linear-gradient(135deg, #1e3a5f 0%, #2d5a8f 50%, #1e3a5f 100%);
border: 2px solid #4a7ab8;
}
.card.back::after {
content: '♠';
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
font-size: 24px;
color: rgba(255,255,255,0.3);
}
.card-small {
width: 40px;
height: 56px;
border-radius: 4px;
}
/* 牌面内容 */
.card-top {
font-size: 16px;
font-weight: bold;
line-height: 1;
}
.card-center {
font-size: 36px;
text-align: center;
line-height: 1;
}
.card-bottom {
font-size: 16px;
font-weight: bold;
line-height: 1;
transform: rotate(180deg);
}
.red { color: #e74c3c; }
.black { color: #2c3e50; }
/* ========== 玩家头像 ========== */
.avatar {
display: flex;
flex-direction: column;
align-items: center;
gap: 4px;
}
.avatar-img {
width: 60px;
height: 60px;
border-radius: 50%;
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
display: flex;
align-items: center;
justify-content: center;
color: white;
font-weight: bold;
font-size: 18px;
border: 3px solid rgba(255,255,255,0.3);
box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}
.avatar-img.me {
background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
}
.player-name {
color: white;
font-size: 12px;
text-shadow: 0 1px 2px rgba(0,0,0,0.5);
}
.player-role {
color: #ffd700;
font-size: 11px;
background: rgba(0,0,0,0.3);
padding: 2px 8px;
border-radius: 10px;
}
/* ========== 左侧玩家 ========== */
.left-player {
position: absolute;
left: 20px;
top: 50%;
transform: translateY(-50%);
display: flex;
flex-direction: column;
align-items: center;
gap: 10px;
}
.left-player .card-count {
color: #ffd700;
font-size: 14px;
font-weight: bold;
}
/* ========== 右侧玩家 ========== */
.right-player {
position: absolute;
right: 20px;
top: 50%;
transform: translateY(-50%);
display: flex;
flex-direction: column;
align-items: center;
gap: 10px;
}
.right-player .card-count {
color: #ffd700;
font-size: 14px;
font-weight: bold;
}
/* ========== 牌背堆叠效果 ========== */
.card-stack {
position: relative;
width: 40px;
height: 56px;
}
.card-stack .card-small {
position: absolute;
top: 0;
left: 0;
}
.card-stack .card-small:nth-child(1) { transform: translate(0, 0); }
.card-stack .card-small:nth-child(2) { transform: translate(2px, -2px); }
.card-stack .card-small:nth-child(3) { transform: translate(4px, -4px); }
/* ========== 中央桌面区 ========== */
.table-area {
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
width: 400px;
height: 200px;
display: flex;
align-items: center;
justify-content: center;
}
.last-played {
text-align: center;
}
.played-by {
color: #ffd700;
font-size: 16px;
font-weight: bold;
margin-bottom: 15px;
text-shadow: 0 2px 4px rgba(0,0,0,0.5);
background: rgba(0,0,0,0.3);
padding: 5px 15px;
border-radius: 15px;
display: inline-block;
}
.played-cards {
display: flex;
justify-content: center;
gap: 5px;
min-height: 112px;
}
/* ========== 底部玩家自己 ========== */
.player-self {
position: absolute;
bottom: 20px;
left: 50%;
transform: translateX(-50%);
display: flex;
flex-direction: column;
align-items: center;
gap: 15px;
width: 100%;
max-width: 800px;
}
.self-info {
display: flex;
align-items: center;
gap: 15px;
}
/* 手牌区 */
.hand-cards {
display: flex;
justify-content: center;
gap: -30px;
padding: 20px;
min-height: 140px;
}
.hand-cards .card {
margin-left: -30px;
}
.hand-cards .card:first-child {
margin-left: 0;
}
/* ========== 按钮样式 ========== */
.action-buttons {
display: flex;
gap: 15px;
}
.btn {
padding: 10px 30px;
border: none;
border-radius: 25px;
font-size: 16px;
font-weight: bold;
cursor: pointer;
transition: all 0.2s;
box-shadow: 0 4px 8px rgba(0,0,0,0.3);
}
.btn:hover {
transform: translateY(-2px);
box-shadow: 0 6px 12px rgba(0,0,0,0.4);
}
.btn:active {
transform: translateY(0);
}
.btn:disabled {
opacity: 0.5;
cursor: not-allowed;
}
.btn-primary {
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
color: white;
}
.btn-secondary {
background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
color: white;
}
.btn-hint {
background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
color: white;
}
/* 开始按钮 */
.btn-start {
padding: 15px 50px;
font-size: 20px;
background: linear-gradient(135deg, #ffd700 0%, #ff8c00 100%);
color: #333;
border: none;
border-radius: 30px;
font-weight: bold;
cursor: pointer;
box-shadow: 0 4px 15px rgba(255,215,0,0.4);
transition: all 0.2s;
}
.btn-start:hover {
transform: scale(1.05);
box-shadow: 0 6px 20px rgba(255,215,0,0.6);
}
/* ========== 游戏状态提示 ========== */
.game-status {
position: absolute;
top: 10px;
right: 10px;
color: #ffd700;
font-size: 14px;
font-weight: bold;
text-shadow: 0 2px 4px rgba(0,0,0,0.5);
pointer-events: none;
background: rgba(0,0,0,0.4);
padding: 5px 12px;
border-radius: 15px;
white-space: nowrap;
}
/* ========== 开始界面 ========== */
.start-screen {
position: absolute;
top: 0;
left: 0;
right: 0;
bottom: 0;
background: rgba(0,0,0,0.7);
display: flex;
align-items: center;
justify-content: center;
z-index: 100;
}
/* ========== 弹窗样式 ========== */
.call-lord-modal {
position: fixed;
top: 0;
left: 0;
width: 100vw;
height: 100vh;
background: rgba(0,0,0,0.6);
display: flex;
align-items: center;
justify-content: center;
z-index: 9999;
}
.modal-content {
background: linear-gradient(135deg, #1a3a5c 0%, #0d2847 100%);
padding: 30px 50px;
border-radius: 15px;
border: 2px solid #4a7ab8;
text-align: center;
}
.modal-content h3 {
color: white;
margin-bottom: 20px;
font-size: 20px;
}
.modal-buttons {
display: flex;
gap: 20px;
justify-content: center;
}
/* ========== 动画效果 ========== */
@keyframes dealCard {
0% {
opacity: 0;
transform: translateY(-100px) scale(0.5);
}
50% {
opacity: 1;
}
100% {
opacity: 1;
transform: translateY(0) scale(1);
}
}
@keyframes playCard {
0% {
transform: scale(1);
}
50% {
transform: scale(1.1) translateY(-20px);
}
100% {
transform: scale(1);
}
}
@keyframes bombShake {
0%, 100% { transform: translateX(0); }
10%, 30%, 50%, 70%, 90% { transform: translateX(-5px); }
20%, 40%, 60%, 80% { transform: translateX(5px); }
}
.dealing .card {
animation: dealCard 0.3s ease-out;
}
.playing .card {
animation: playCard 0.3s ease-out;
}
.bomb-effect {
animation: bombShake 0.5s ease-in-out;
}
/* 出牌提示 */
.turn-indicator {
position: absolute;
width: 70px;
height: 70px;
border-radius: 50%;
border: 3px solid #ffd700;
box-shadow: 0 0 20px rgba(255, 215, 0, 0.5);
animation: pulse 1.5s infinite;
pointer-events: none;
}
@keyframes pulse {
0%, 100% { transform: scale(1); opacity: 1; }
50% { transform: scale(1.1); opacity: 0.7; }
}
/* ========== 计时器 ========== */
.timer {
position: absolute;
width: 40px;
height: 40px;
border-radius: 50%;
background: linear-gradient(135deg, #ff6b6b 0%, #ee5a5a 100%);
display: flex;
align-items: center;
justify-content: center;
color: white;
font-weight: bold;
font-size: 16px;
box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}
/* ========== 聊天/提示气泡 ========== */
.chat-bubble {
position: absolute;
background: white;
padding: 8px 12px;
border-radius: 10px;
font-size: 14px;
color: #333;
box-shadow: 0 2px 8px rgba(0,0,0,0.2);
white-space: nowrap;
}
.chat-bubble::after {
content: '';
position: absolute;
bottom: -8px;
left: 50%;
transform: translateX(-50%);
border: 8px solid transparent;
border-top-color: white;
}
/* ========== 响应式适配 ========== */
@media (max-width: 768px) {
.card {
width: 60px;
height: 84px;
}
.card-small {
width: 30px;
height: 42px;
}
.avatar-img {
width: 50px;
height: 50px;
font-size: 14px;
}
.hand-cards .card {
margin-left: -20px;
}
.btn {
padding: 8px 20px;
font-size: 14px;
}
}
/* ========== 竖屏手机适配 ========== */
@media (max-width: 480px) and (orientation: portrait) {
.game-table {
min-width: 100vw;
min-height: 100vh;
}
/* 手牌区 - 更紧凑 */
.hand-cards {
padding: 10px 5px;
min-height: 100px;
max-width: 100vw;
overflow-x: auto;
-webkit-overflow-scrolling: touch;
}
.hand-cards .card {
margin-left: -35px;
transform: scale(0.85);
}
.hand-cards .card:first-child {
margin-left: 5px;
}
.hand-cards .card:last-child {
margin-right: 10px;
}
/* 牌选中效果调整 */
.hand-cards .card.selected {
transform: scale(0.85) translateY(-15px);
}
/* 左右玩家位置调整 */
.left-player {
left: 5px;
}
.right-player {
right: 5px;
}
.left-player .avatar,
.right-player .avatar {
transform: scale(0.8);
}
/* 中央区域调整 */
.table-area {
width: 200px;
height: 150px;
}
.played-cards {
min-height: 80px;
}
.played-cards .card {
transform: scale(0.7);
}
/* 按钮调整 */
.action-buttons {
gap: 8px;
padding: 0 10px;
}
.btn {
padding: 8px 15px;
font-size: 13px;
border-radius: 20px;
}
/* 底牌区域调整 */
.deck-area {
top: 80px;
}
.deck-cards {
gap: 3px;
}
.deck-cards .card {
transform: scale(0.6);
}
/* 叫地主弹窗调整 */
.call-lord-modal .modal-content {
padding: 30px 20px;
width: 85%;
}
.call-lord-modal h2 {
font-size: 20px;
}
.call-lord-buttons {
gap: 15px;
}
.call-lord-buttons .btn {
padding: 12px 30px;
font-size: 16px;
}
}
/* ========== 横屏手机适配 ========== */
@media (max-height: 500px) and (orientation: landscape) {
.game-table {
min-height: 100vh;
transform: scale(0.9);
transform-origin: center top;
}
/* 顶部底牌区上移 */
.deck-area {
top: 5px;
}
.deck-cards .card {
transform: scale(0.5);
}
/* 左右玩家位置上移 */
.left-player, .right-player {
top: 30%;
}
.avatar-img {
width: 40px;
height: 40px;
font-size: 12px;
}
.player-name {
font-size: 10px;
}
.player-role {
font-size: 9px;
padding: 1px 5px;
}
/* 手牌区 - 整体下移 */
.player-self {
bottom: 35px;
max-width: 98%;
}
.self-info {
display: none;
}
.hand-cards {
padding: 2px;
min-height: 60px;
margin-bottom: 0;
}
/* 按钮下移,与牌保持间距 */
.action-buttons {
position: absolute;
bottom: -5px;
left: 50%;
transform: translateX(-50%);
gap: 10px;
margin: 0;
}
.hand-cards .card {
margin-left: -40px;
transform: scale(0.44);
}
.hand-cards .card.selected {
transform: scale(0.44) translateY(-6px);
}
/* 按钮 */
.action-buttons {
gap: 8px;
margin-top: 5px;
}
.btn {
padding: 5px 15px;
font-size: 12px;
}
/* 中央区域 - 居中显示 */
.table-area {
width: 200px;
height: 100px;
top: 50%;
transform: translate(-50%, -50%);
}
.played-cards {
min-height: 50px;
}
.played-cards .card {
transform: scale(0.5);
}
.played-by {
font-size: 11px;
margin-bottom: 5px;
padding: 4px 12px;
}
.last-played {
margin-top: 10px;
}
.game-status {
font-size: 11px;
top: 5px;
left: 50%;
transform: translateX(-50%);
padding: 3px 8px;
}
/* 叫地主弹窗 */
.call-lord-modal {
align-items: center;
}
/* 底牌区域居中偏上 */
.deck-area {
top: 35px;
left: 50%;
transform: translateX(-50%);
}
.deck-label {
font-size: 9px;
}
.deck-cards .card {
transform: scale(0.4);
}
}