Files
nanocode/happy-games/games/guandan/style.css
T
Ubuntu 32b43f85bd a
2026-07-03 16:58:28 +08:00

1023 lines
18 KiB
CSS

/* 掼蛋UI样式 - 四人升级 */
* {
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;
}
.game-container {
position: relative;
width: 100vw;
height: 100vh;
max-width: 1200px;
max-height: 900px;
margin: 0 auto;
}
/* ========== 游戏信息栏 ========== */
.game-info-bar {
position: absolute;
top: 5px;
left: 50%;
transform: translateX(-50%);
display: flex;
flex-direction: row;
align-items: center;
gap: 15px;
z-index: 100;
}
.level-info, .team-score {
background: rgba(0,0,0,0.6);
padding: 4px 12px;
border-radius: 15px;
}
.level-info {
display: flex;
align-items: center;
gap: 8px;
background: rgba(0,0,0,0.4);
padding: 5px 15px;
border-radius: 20px;
}
.level-label {
color: #ffd700;
font-size: 12px;
}
.level-card {
color: #e74c3c;
font-size: 18px;
font-weight: bold;
background: linear-gradient(135deg, #fff 0%, #f0f0f0 100%);
width: 28px;
height: 28px;
border-radius: 4px;
display: flex;
align-items: center;
justify-content: center;
box-shadow: 0 2px 4px rgba(0,0,0,0.3);
}
.team-score {
display: flex;
align-items: center;
gap: 15px;
background: rgba(0,0,0,0.4);
padding: 5px 15px;
border-radius: 20px;
}
.team {
display: flex;
flex-direction: column;
align-items: center;
}
.team-name {
color: #aaa;
font-size: 10px;
}
.team-level {
color: #ffd700;
font-size: 16px;
font-weight: bold;
}
.vs {
color: #666;
font-size: 12px;
font-weight: bold;
}
/* ========== 扑克牌样式 - 经典设计 ========== */
.card {
width: 70px;
height: 98px;
background: #fff;
border-radius: 8px;
border: 1px solid #bbb;
box-shadow:
0 1px 3px rgba(0,0,0,0.2),
inset 0 0 0 1px rgba(0,0,0,0.05);
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;
bottom: 0;
background:
repeating-linear-gradient(
0deg,
transparent,
transparent 2px,
rgba(0,0,0,0.02) 2px,
rgba(0,0,0,0.02) 4px
);
pointer-events: none;
}
.card:hover {
transform: translateY(-5px);
box-shadow:
0 4px 12px rgba(0,0,0,0.3),
inset 0 0 0 1px rgba(0,0,0,0.05);
}
.card.selected {
transform: translateY(-15px);
box-shadow:
0 6px 16px rgba(255,215,0,0.5),
inset 0 0 0 2px #ffd700;
border-color: #ffd700;
}
/* 牌背 */
.card.back {
background:
repeating-linear-gradient(
45deg,
#1a237e,
#1a237e 8px,
#283593 8px,
#283593 16px
);
border: 1px solid #3949ab;
}
.card.back::before {
content: '';
position: absolute;
top: 8px;
left: 8px;
right: 8px;
bottom: 8px;
border: 2px dashed rgba(255,255,255,0.3);
border-radius: 4px;
background: none;
}
.card-small {
width: 36px;
height: 50px;
border-radius: 4px;
}
/* 牌面内容 */
.card-top {
position: absolute;
top: 4px;
left: 5px;
display: flex;
flex-direction: column;
align-items: center;
gap: 1px;
}
.card-top .rank {
font-size: 14px;
font-weight: 800;
line-height: 1;
}
.card-top .suit {
font-size: 14px;
line-height: 1;
}
.card-center {
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
font-size: 38px;
line-height: 1;
}
/* 牌面只显示左上角和中央大图案,不显示右下角 */
.card-bottom .rank {
font-size: 14px;
font-weight: 800;
line-height: 1;
}
.card-bottom .suit {
font-size: 14px;
line-height: 1;
}
.red { color: #d32f2f; }
.black { color: #1a1a1a; }
/* 百搭牌标记 */
.card.wild {
border: 2px solid #ffd700;
background: linear-gradient(135deg, #fff 0%, #fffacd 100%);
}
.card.wild::after {
content: '百搭';
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
font-size: 12px;
color: #ffd700;
font-weight: bold;
text-shadow: 0 1px 2px rgba(0,0,0,0.3);
pointer-events: none;
}
/* ========== 玩家头像 ========== */
.avatar {
display: flex;
flex-direction: column;
align-items: center;
gap: 3px;
}
.avatar-img {
width: 55px;
height: 55px;
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: 16px;
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%);
}
.avatar-img.partner {
background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
}
.avatar-img.opponent {
background: linear-gradient(135deg, #fa709a 0%, #fee140 100%);
}
.player-name {
color: white;
font-size: 11px;
text-shadow: 0 1px 2px rgba(0,0,0,0.5);
}
.player-rank {
color: #ffd700;
font-size: 10px;
background: rgba(0,0,0,0.3);
padding: 2px 6px;
border-radius: 10px;
min-height: 16px;
}
/* ========== 顶部玩家 ========== */
.top-player {
position: absolute;
top: 100px;
left: 50%;
transform: translateX(-50%);
display: flex;
flex-direction: column;
align-items: center;
gap: 3px;
z-index: 20;
}
.top-player .card-count {
color: #ffd700;
font-size: 11px;
font-weight: bold;
background: rgba(0,0,0,0.4);
padding: 2px 8px;
border-radius: 10px;
margin-top: 3px;
}
.top-player .player-name {
font-size: 10px;
}
.top-player .cards-back {
margin-top: 5px;
}
/* ========== 左侧玩家 ========== */
.left-player {
position: absolute;
left: 15px;
top: 50%;
transform: translateY(-50%);
display: flex;
flex-direction: column;
align-items: center;
gap: 8px;
}
.left-player .card-count {
color: #ffd700;
font-size: 12px;
font-weight: bold;
}
/* ========== 右侧玩家 ========== */
.right-player {
position: absolute;
right: 15px;
top: 50%;
transform: translateY(-50%);
display: flex;
flex-direction: column;
align-items: center;
gap: 8px;
}
.right-player .card-count {
color: #ffd700;
font-size: 12px;
font-weight: bold;
}
/* ========== 牌背堆叠效果 ========== */
.card-stack {
position: relative;
width: 36px;
height: 50px;
}
.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: 45%;
left: 50%;
transform: translate(-50%, -50%);
width: 350px;
height: 150px;
display: flex;
flex-direction: column;
align-items: center;
justify-content: flex-start;
}
.last-played {
text-align: center;
margin-bottom: 10px;
}
.played-by {
color: #ffd700;
font-size: 13px;
font-weight: bold;
margin-bottom: 8px;
text-shadow: 0 2px 4px rgba(0,0,0,0.5);
background: rgba(0,0,0,0.5);
padding: 4px 12px;
border-radius: 12px;
display: inline-block;
white-space: nowrap;
}
.turn-text {
color: #4facfe;
}
.played-cards {
display: flex;
justify-content: center;
gap: 3px;
min-height: 70px;
flex-wrap: wrap;
max-width: 320px;
padding: 5px;
}
/* ========== 底部玩家自己 ========== */
.player-self {
position: absolute;
bottom: 15px;
left: 50%;
transform: translateX(-50%);
display: flex;
flex-direction: column;
align-items: center;
gap: 10px;
width: 100%;
max-width: 700px;
}
.self-info {
display: flex;
align-items: center;
gap: 15px;
}
#my-card-count {
color: #ffd700;
font-size: 12px;
font-weight: bold;
}
/* 手牌区 */
.hand-cards-container {
width: 100%;
display: flex;
justify-content: center;
padding: 0 10px;
}
.hand-cards {
display: flex;
justify-content: center;
padding: 15px 10px;
min-height: 120px;
}
.hand-cards {
display: flex;
justify-content: center;
padding: 10px 20px;
min-height: 120px;
}
.hand-cards .card {
margin-left: -45px;
transition: transform 0.2s;
cursor: pointer;
z-index: 1;
}
.hand-cards .card:first-child {
margin-left: 0;
}
.hand-cards .card.selected {
transform: translateY(-20px);
z-index: 20;
}
.hand-cards .card:hover {
z-index: 15;
transform: translateY(-5px);
}
.hand-cards .card.selected:hover {
transform: translateY(-20px);
}
/* ========== 按钮样式 ========== */
.action-buttons {
display: flex;
gap: 12px;
}
.btn {
padding: 10px 25px;
border: none;
border-radius: 25px;
font-size: 15px;
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;
bottom: 180px;
left: 50%;
transform: translateX(-50%);
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 15px;
border-radius: 15px;
white-space: nowrap;
}
/* ========== 开始界面 ========== */
.start-screen {
position: absolute;
top: 0;
left: 0;
right: 0;
bottom: 0;
background: rgba(0,0,0,0.8);
display: flex;
align-items: center;
justify-content: center;
z-index: 100;
}
.start-content {
text-align: center;
color: white;
}
.start-content h1 {
font-size: 48px;
margin-bottom: 10px;
text-shadow: 0 4px 8px rgba(0,0,0,0.5);
}
.start-content p {
font-size: 16px;
color: #aaa;
margin-bottom: 30px;
}
/* ========== 弹窗样式 ========== */
.game-over-modal, .tribute-modal, .rules-modal {
position: fixed;
top: 0;
left: 0;
width: 100vw;
height: 100vh;
background: rgba(0,0,0,0.7);
display: flex;
align-items: center;
justify-content: center;
z-index: 9999;
}
.modal-content {
background: linear-gradient(135deg, #1a3a5c 0%, #0d2847 100%);
padding: 25px 35px;
border-radius: 15px;
border: 2px solid #4a7ab8;
text-align: center;
max-width: 90%;
max-height: 90%;
overflow-y: auto;
}
.modal-content h2 {
color: #ffd700;
margin-bottom: 15px;
font-size: 24px;
}
.modal-content h3 {
color: white;
margin-bottom: 15px;
font-size: 20px;
}
.modal-content p {
color: #ccc;
margin-bottom: 10px;
}
.rank-list {
margin: 15px 0;
text-align: left;
}
.rank-item {
display: flex;
justify-content: space-between;
padding: 8px 15px;
margin: 5px 0;
background: rgba(255,255,255,0.1);
border-radius: 8px;
color: white;
}
.rank-item.first { border-left: 4px solid #ffd700; }
.rank-item.second { border-left: 4px solid #c0c0c0; }
.rank-item.third { border-left: 4px solid #cd7f32; }
.rank-item.fourth { border-left: 4px solid #666; }
.upgrade-info {
margin: 15px 0;
padding: 10px;
background: rgba(255,215,0,0.2);
border-radius: 8px;
color: #ffd700;
}
.tribute-cards {
display: flex;
justify-content: center;
gap: 15px;
margin: 20px 0;
flex-wrap: wrap;
}
.tribute-cards .card {
cursor: pointer;
}
.tribute-cards .card:hover {
transform: translateY(-10px);
}
.rules-content {
text-align: left;
color: #ccc;
margin: 15px 0;
}
.rules-content ul {
margin: 10px 0 10px 20px;
}
.rules-content li {
margin: 5px 0;
}
/* ========== 动画效果 ========== */
@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;
}
/* 出牌提示 - 已改为文字形式 */
/* ========== 响应式适配 ========== */
@media (max-width: 768px) {
.card {
width: 55px;
height: 77px;
}
.card-small {
width: 28px;
height: 39px;
}
.avatar-img {
width: 45px;
height: 45px;
font-size: 14px;
}
.hand-cards .card {
margin-left: -18px;
}
.btn {
padding: 8px 18px;
font-size: 13px;
}
.table-area {
width: 280px;
}
.played-cards {
max-width: 250px;
}
.played-cards .card {
transform: scale(0.8);
}
}
/* ========== 竖屏手机适配 ========== */
@media (max-width: 480px) and (orientation: portrait) {
.game-info-bar {
top: 5px;
gap: 5px;
}
.team-score {
gap: 10px;
padding: 3px 10px;
}
.team-level {
font-size: 14px;
}
/* 顶部玩家 */
.top-player {
top: 55px;
}
.top-player .avatar {
transform: scale(0.85);
}
/* 左右玩家 */
.left-player, .right-player {
top: 45%;
}
.left-player {
left: 5px;
}
.right-player {
right: 5px;
}
.left-player .avatar, .right-player .avatar {
transform: scale(0.8);
}
/* 中央区域 */
.table-area {
width: 200px;
height: 140px;
}
.played-by {
font-size: 12px;
padding: 4px 10px;
}
.played-cards {
min-height: 60px;
max-width: 180px;
}
.played-cards .card {
transform: scale(0.6);
}
/* 手牌区 */
.hand-cards {
padding: 10px 5px;
min-height: 90px;
overflow-x: auto;
-webkit-overflow-scrolling: touch;
}
.hand-cards .card {
margin-left: -32px;
transform: scale(0.75);
}
.hand-cards .card:first-child {
margin-left: 5px;
}
.hand-cards .card:last-child {
margin-right: 10px;
}
.hand-cards .card.selected {
transform: scale(0.75) translateY(-12px);
}
/* 按钮 */
.action-buttons {
gap: 8px;
}
.btn {
padding: 8px 16px;
font-size: 13px;
}
.game-status {
bottom: 150px;
font-size: 12px;
}
.player-self {
bottom: 10px;
}
.self-info {
transform: scale(0.9);
}
/* 弹窗 */
.modal-content {
padding: 20px;
width: 90%;
}
.modal-content h2 {
font-size: 20px;
}
.rank-item {
padding: 6px 10px;
font-size: 13px;
}
.start-content h1 {
font-size: 36px;
}
}
/* ========== 横屏手机适配 ========== */
@media (max-height: 500px) and (orientation: landscape) {
.game-info-bar {
top: 3px;
flex-direction: row;
gap: 15px;
}
.level-info, .team-score {
padding: 2px 10px;
}
/* 顶部玩家上移 */
.top-player {
top: 40px;
}
.top-player .avatar {
transform: scale(0.75);
}
/* 左右玩家 */
.left-player, .right-player {
top: 40%;
}
.avatar-img {
width: 40px;
height: 40px;
font-size: 12px;
}
.player-name {
font-size: 10px;
}
/* 中央区域 */
.table-area {
width: 250px;
height: 90px;
top: 42%;
}
.played-cards {
min-height: 45px;
max-width: 220px;
}
.played-cards .card {
transform: scale(0.45);
}
.played-by {
font-size: 10px;
margin-bottom: 3px;
padding: 3px 8px;
}
#turn-indicator {
font-size: 10px;
padding: 3px 8px;
}
/* 手牌区 */
.player-self {
bottom: 5px;
}
.self-info {
display: none;
}
.hand-cards {
padding: 5px;
min-height: 60px;
}
.hand-cards .card {
margin-left: -38px;
transform: scale(0.50);
}
.hand-cards .card.selected {
transform: scale(0.50) translateY(-8px);
}
/* 按钮 */
.action-buttons {
gap: 6px;
margin-top: 5px;
}
.btn {
padding: 5px 15px;
font-size: 12px;
}
.game-status {
bottom: 75px;
font-size: 11px;
}
}