* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', 'Microsoft YaHei', sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    background-attachment: fixed;
    min-height: 100vh;
    padding: 20px;
    overflow-x: hidden;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
}

header {
    text-align: center;
    color: white;
    margin-bottom: 30px;
}

header h1 {
    font-size: 3em;
    margin-bottom: 10px;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
}

.subtitle {
    font-size: 1.2em;
    opacity: 0.9;
}

/* 屏幕切换 */
.screen {
    display: none;
}

.screen.active {
    display: block;
    animation: fadeIn 0.3s ease-in;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

/* 卡片样式 */
.card {
    background: rgba(255, 255, 255, 0.98);
    border-radius: 20px;
    padding: 40px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
    margin-bottom: 20px;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255,255,255,0.2);
}

.card h2 {
    color: #2c3e50;
    margin-bottom: 25px;
    text-align: center;
    font-size: 1.8em;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.rules-card {
    background: rgba(255,255,255,0.95);
    border-radius: 15px;
    padding: 25px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
}

.rules-card h3 {
    color: #667eea;
    margin-bottom: 15px;
}

.rules-card ul {
    list-style: none;
    padding: 0;
}

.rules-card li {
    padding: 8px 0;
    border-bottom: 1px solid #eee;
}

.rules-card li:last-child {
    border-bottom: none;
}

/* 输入框 */
.input-group {
    margin-bottom: 20px;
}

.input-group input {
    width: 100%;
    padding: 15px;
    border: 2px solid #e0e0e0;
    border-radius: 10px;
    font-size: 1em;
    transition: border-color 0.3s;
}

.input-group input:focus {
    outline: none;
    border-color: #667eea;
}

/* 按钮 */
.button-group {
    display: flex;
    gap: 15px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.btn {
    padding: 15px 30px;
    border: none;
    border-radius: 12px;
    font-size: 1em;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    flex: 1;
    position: relative;
    overflow: hidden;
    min-width: 120px;
}

.btn::before {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255,255,255,0.3);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.btn:active::before {
    width: 300px;
    height: 300px;
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
}

.btn-primary:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.6);
}

.btn-primary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.btn-secondary {
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    color: #2c3e50;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.btn-secondary:hover {
    background: linear-gradient(135deg, #e0e5ec 0%, #b8c6db 100%);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15);
}

.btn-small {
    padding: 10px 20px;
    font-size: 0.9em;
}

.hidden {
    display: none !important;
}

/* 房间信息 */
.room-info {
    text-align: center;
    margin: 20px 0;
}

.room-code {
    font-size: 2em;
    font-weight: bold;
    color: #667eea;
    letter-spacing: 3px;
}

.player-list {
    background: #f8f9fa;
    border-radius: 10px;
    padding: 20px;
    margin: 20px 0;
    min-height: 100px;
}

.player-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px;
    margin: 5px 0;
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

.player-item.host::before {
    content: "👑 ";
}

.info-text {
    text-align: center;
    color: #666;
    margin: 15px 0;
    font-size: 0.9em;
}

/* 游戏界面 */
.game-container {
    background: white;
    border-radius: 20px;
    padding: 30px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}

.game-info {
    display: flex;
    justify-content: space-around;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 10px;
    margin-bottom: 20px;
}

.info-item {
    text-align: center;
}

.info-item span {
    display: block;
    margin: 5px 0;
}

.highlight {
    font-size: 1.5em;
    font-weight: bold;
    color: #667eea;
}

.other-players {
    display: flex;
    gap: 15px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.other-player {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    padding: 15px;
    border-radius: 12px;
    flex: 1;
    min-width: 150px;
    border: 2px solid transparent;
    transition: all 0.3s;
}

.other-player:hover {
    border-color: #667eea;
    transform: translateY(-3px);
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.3);
}

.other-player-name {
    font-weight: bold;
    margin-bottom: 8px;
    color: #2c3e50;
}

.other-player-score {
    color: #667eea;
    font-size: 1.3em;
    font-weight: bold;
    text-shadow: 0 2px 4px rgba(102, 126, 234, 0.2);
}

/* 场地区域 */
.field-area {
    margin: 30px 0;
}

.field-area h3 {
    color: #333;
    margin-bottom: 15px;
}

.field {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(60px, 1fr));
    gap: 10px;
    padding: 20px;
    background: linear-gradient(135deg, #e9ecef 0%, #dee2e6 100%);
    border-radius: 15px;
    min-height: 200px;
    box-shadow: inset 0 2px 10px rgba(0,0,0,0.1);
}

.field .tile {
    animation: fadeInScale 0.4s ease-out;
}

@keyframes fadeInScale {
    from {
        opacity: 0;
        transform: scale(0.8);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* 牌的样式 */
.tile {
    width: 60px;
    height: 90px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
    transform-style: preserve-3d;
}

.tile:hover {
    transform: translateY(-8px) scale(1.05);
    box-shadow: 0 8px 20px rgba(0,0,0,0.3);
    z-index: 10;
}

.tile:active {
    transform: translateY(-4px) scale(1.02);
}

.tile.back {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: 2px solid rgba(255,255,255,0.3);
    display: flex;
    align-items: center;
    justify-content: center;
}

.tile.back::before {
    content: "🎴";
    font-size: 2em;
    opacity: 0.8;
}

.tile.front {
    background: linear-gradient(to bottom, #ffffff 0%, #f8f9fa 100%);
    border: 3px solid #2c3e50;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.tile-top, .tile-bottom {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5em;
    font-weight: bold;
    position: relative;
}

.tile-top {
    border-bottom: 2px solid #2c3e50;
    background: rgba(0,0,0,0.03);
    color: #2c3e50;
}

/* 花朵图案 */
.tile-bottom {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    padding: 3px;
    gap: 2px;
}

.tile-bottom .flower {
    font-size: 0.7em;
    line-height: 1;
}

.tile.red .flower {
    color: #e74c3c;
    text-shadow: 0 1px 2px rgba(231, 76, 60, 0.3);
}

.tile.blue .flower {
    color: #3498db;
    text-shadow: 0 1px 2px rgba(52, 152, 219, 0.3);
}

.tile.green .flower {
    color: #2ecc71;
    text-shadow: 0 1px 2px rgba(46, 204, 113, 0.3);
}

.tile.shine::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(45deg,
        transparent 30%,
        rgba(255, 215, 0, 0.1) 50%,
        transparent 70%);
    pointer-events: none;
    animation: shimmer 3s infinite;
}

.tile.shine::after {
    content: "★";
    position: absolute;
    top: 4px;
    right: 4px;
    color: #ffd700;
    font-size: 1em;
    text-shadow: 0 0 10px rgba(255, 215, 0, 0.8),
                 0 0 20px rgba(255, 215, 0, 0.5);
    animation: sparkle 2s infinite;
    z-index: 1;
}

@keyframes shimmer {
    0%, 100% { opacity: 0.5; }
    50% { opacity: 1; }
}

@keyframes sparkle {
    0%, 100% { transform: scale(1) rotate(0deg); }
    50% { transform: scale(1.2) rotate(180deg); }
}

/* 手牌区域 */
.hand-area {
    margin: 30px 0;
}

.hand-area h3 {
    color: #333;
    margin-bottom: 15px;
}

.hand {
    display: flex;
    gap: 15px;
    padding: 20px;
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border-radius: 15px;
    min-height: 120px;
    justify-content: center;
    box-shadow: inset 0 2px 10px rgba(0,0,0,0.1);
}

.hand .tile {
    width: 70px;
    height: 105px;
    animation: slideIn 0.5s ease-out;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.action-buttons {
    display: flex;
    gap: 15px;
    margin-top: 20px;
}

/* 结算界面 */
.result-content {
    padding: 20px;
}

.result-player {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    padding: 20px;
    margin: 10px 0;
    border-radius: 15px;
    animation: bounceIn 0.6s ease-out;
}

.result-player.winner {
    background: linear-gradient(135deg, #ffeaa7 0%, #fdcb6e 100%);
    border: 3px solid #f39c12;
    box-shadow: 0 10px 30px rgba(243, 156, 18, 0.4);
    animation: winnerPulse 1s ease-in-out infinite;
}

@keyframes bounceIn {
    0% {
        opacity: 0;
        transform: scale(0.3);
    }
    50% {
        opacity: 1;
        transform: scale(1.05);
    }
    70% {
        transform: scale(0.9);
    }
    100% {
        transform: scale(1);
    }
}

@keyframes winnerPulse {
    0%, 100% {
        box-shadow: 0 10px 30px rgba(243, 156, 18, 0.4);
    }
    50% {
        box-shadow: 0 10px 40px rgba(243, 156, 18, 0.7);
    }
}

.result-yaku {
    font-size: 1.3em;
    font-weight: bold;
    color: #667eea;
    margin: 15px 0;
    text-shadow: 0 2px 4px rgba(102, 126, 234, 0.2);
}

.final-scores {
    padding: 20px;
}

.final-player {
    display: flex;
    justify-content: space-between;
    padding: 20px;
    margin: 15px 0;
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border-radius: 15px;
    font-size: 1.2em;
    transition: all 0.3s;
    animation: slideInRight 0.5s ease-out;
}

.final-player:hover {
    transform: translateX(5px);
    box-shadow: 0 5px 15px rgba(0,0,0,0.2);
}

.final-player.winner {
    background: linear-gradient(135deg, #ffeaa7 0%, #fdcb6e 100%);
    border: 3px solid #f39c12;
    font-size: 1.4em;
    box-shadow: 0 10px 30px rgba(243, 156, 18, 0.5);
    animation: slideInRight 0.5s ease-out, winnerGlow 2s ease-in-out infinite;
}

@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(-50px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes winnerGlow {
    0%, 100% {
        box-shadow: 0 10px 30px rgba(243, 156, 18, 0.5);
    }
    50% {
        box-shadow: 0 15px 40px rgba(243, 156, 18, 0.8);
    }
}

/* 弹窗 */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal-content {
    background: white;
    padding: 40px;
    border-radius: 20px;
    max-width: 600px;
    max-height: 80vh;
    overflow-y: auto;
    position: relative;
}

.close {
    position: absolute;
    top: 15px;
    right: 20px;
    font-size: 2em;
    cursor: pointer;
    color: #999;
}

.close:hover {
    color: #333;
}

.yaku-list {
    margin-top: 20px;
}

.yaku-item {
    padding: 15px;
    margin: 15px 0;
    background: #f8f9fa;
    border-radius: 10px;
    border-left: 4px solid #667eea;
}

.yaku-item h3 {
    color: #667eea;
    margin-bottom: 10px;
}

.yaku-item p {
    color: #666;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .card {
        padding: 25px;
    }

    header h1 {
        font-size: 2em;
    }

    .field {
        grid-template-columns: repeat(auto-fill, minmax(50px, 1fr));
        gap: 8px;
    }

    .tile {
        width: 50px;
        height: 75px;
    }

    .hand .tile {
        width: 60px;
        height: 90px;
    }

    .game-info {
        flex-direction: column;
        gap: 10px;
    }
}

/* 通知动画 */
@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(100px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes slideOutRight {
    from {
        opacity: 1;
        transform: translateX(0);
    }
    to {
        opacity: 0;
        transform: translateX(100px);
    }
}
