/* 全局样式 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Microsoft YaHei', 'PingFang SC', sans-serif;
    background: linear-gradient(135deg, #1a5f2a 0%, #0d3320 50%, #1a5f2a 100%);
    min-height: 100vh;
    color: #333;
    overflow-x: hidden;
}

/* 屏幕切换 */
.screen {
    min-height: 100vh;
    width: 100%;
}

.hidden {
    display: none !important;
}

/* 按钮样式 */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 20px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    background: linear-gradient(135deg, #f5a623 0%, #d48c1c 100%);
    color: white;
    box-shadow: 0 4px 15px rgba(245, 166, 35, 0.3);
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(245, 166, 35, 0.4);
}

.btn:active {
    transform: translateY(0);
}

.btn-primary {
    background: linear-gradient(135deg, #f5a623 0%, #d48c1c 100%);
}

.btn-small {
    padding: 6px 14px;
    font-size: 12px;
}

.btn-block {
    width: 100%;
    padding: 14px;
    font-size: 16px;
}

.btn-danger {
    background: linear-gradient(135deg, #e74c3c 0%, #c0392b 100%);
    box-shadow: 0 4px 15px rgba(231, 76, 60, 0.3);
}

.btn-action {
    padding: 12px 30px;
    font-size: 16px;
    margin: 0 8px;
}

/* 登录界面 */
#login-screen {
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #1e3c72 0%, #2a5298 100%);
}

.login-container {
    background: white;
    border-radius: 20px;
    padding: 40px;
    width: 90%;
    max-width: 400px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.game-logo {
    text-align: center;
    margin-bottom: 30px;
}

.game-logo h1 {
    font-size: 32px;
    color: #2a5298;
    margin-bottom: 8px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.1);
}

.game-logo p {
    color: #666;
    font-size: 14px;
}

.login-tabs {
    display: flex;
    margin-bottom: 20px;
    border-bottom: 2px solid #eee;
}

.tab-btn {
    flex: 1;
    padding: 12px;
    border: none;
    background: none;
    font-size: 16px;
    cursor: pointer;
    color: #666;
    transition: all 0.3s;
    position: relative;
}

.tab-btn.active {
    color: #2a5298;
    font-weight: bold;
}

.tab-btn.active::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 20%;
    width: 60%;
    height: 2px;
    background: #2a5298;
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

.form-group {
    margin-bottom: 16px;
}

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

.form-group input:focus {
    outline: none;
    border-color: #2a5298;
}

/* 主界面 */
#main-screen {
    display: flex;
    flex-direction: column;
}

.main-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    background: rgba(0, 0, 0, 0.3);
    backdrop-filter: blur(10px);
}

.user-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.avatar {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: linear-gradient(135deg, #f5a623 0%, #d48c1c 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    border: 3px solid rgba(255, 255, 255, 0.3);
}

.user-details {
    display: flex;
    flex-direction: column;
}

.nickname {
    color: white;
    font-weight: bold;
    font-size: 16px;
}

.coins {
    color: #f5a623;
    font-size: 14px;
    font-weight: 600;
}

.header-actions {
    display: flex;
    gap: 8px;
}

.main-content {
    flex: 1;
    padding: 30px 20px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.game-modes {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
    width: 100%;
    max-width: 600px;
}

.mode-card {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 16px;
    padding: 30px 20px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    border: 2px solid transparent;
}

.mode-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.2);
    border-color: #f5a623;
}

.mode-icon {
    font-size: 48px;
    margin-bottom: 12px;
}

.mode-card h3 {
    font-size: 18px;
    color: #333;
    margin-bottom: 8px;
}

.mode-card p {
    font-size: 13px;
    color: #666;
}

/* 游戏界面 */
#game-screen {
    display: flex;
    flex-direction: column;
    background: linear-gradient(135deg, #0d5c3b 0%, #1a7a4e 50%, #0d5c3b 100%);
}

.game-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 20px;
    background: rgba(0, 0, 0, 0.4);
    color: white;
}

.game-title {
    font-size: 18px;
    font-weight: bold;
}

.base-score {
    color: #f5a623;
    font-weight: 600;
}

.game-table {
    flex: 1;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

/* 玩家位置 */
.player {
    position: absolute;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
}

.top-player {
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
}

.left-player {
    left: 20px;
    top: 50%;
    transform: translateY(-50%);
}

.right-player {
    right: 20px;
    top: 50%;
    transform: translateY(-50%);
}

.player-avatar {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    border: 3px solid rgba(255, 255, 255, 0.5);
}

.player-name {
    color: white;
    font-size: 12px;
    font-weight: 600;
}

.card-count {
    background: rgba(0, 0, 0, 0.6);
    color: white;
    padding: 2px 10px;
    border-radius: 10px;
    font-size: 12px;
}

/* 底牌 */
.bottom-cards {
    position: absolute;
    top: 80px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 5px;
}

/* 出牌区域 */
.play-area {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    min-width: 200px;
    min-height: 100px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.last-cards {
    display: flex;
    gap: 5px;
    flex-wrap: wrap;
    justify-content: center;
}

/* 游戏操作 */
.game-actions {
    position: absolute;
    bottom: 120px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 10px;
}

/* 手牌区域 */
.player-hand {
    height: 140px;
    background: rgba(0, 0, 0, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: -20px;
    padding: 10px 20px;
    overflow-x: auto;
}

/* 扑克牌 */
.card {
    width: 60px;
    height: 84px;
    background: white;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    font-weight: bold;
    border: 1px solid #ddd;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    cursor: pointer;
    transition: all 0.2s;
    user-select: none;
    margin-left: -25px;
}

.card:first-child {
    margin-left: 0;
}

.card:hover {
    transform: translateY(-15px);
    z-index: 10;
}

.card.selected {
    transform: translateY(-25px);
    border-color: #f5a623;
    box-shadow: 0 4px 15px rgba(245, 166, 35, 0.4);
    z-index: 10;
}

.card.back {
    background: linear-gradient(135deg, #2a5298 0%, #1e3c72 100%);
    color: white;
    font-size: 24px;
}

.card.red {
    color: #e74c3c;
}

.card.black {
    color: #2c3e50;
}

/* 房间界面 */
#room-screen {
    display: flex;
    flex-direction: column;
    background: linear-gradient(135deg, #1e3c72 0%, #2a5298 100%);
}

.room-header {
    display: flex;
    align-items: center;
    padding: 15px 20px;
    background: rgba(0, 0, 0, 0.3);
    gap: 15px;
}

.room-title {
    color: white;
    font-size: 18px;
    font-weight: bold;
    flex: 1;
    text-align: center;
}

.room-menu {
    flex: 1;
    padding: 20px;
}

.room-actions {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    justify-content: center;
}

.room-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-height: 60vh;
    overflow-y: auto;
}

.room-item {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 12px;
    padding: 15px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    transition: all 0.3s;
}

.room-item:hover {
    transform: translateX(5px);
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.2);
}

.room-info h4 {
    font-size: 16px;
    margin-bottom: 5px;
}

.room-info p {
    font-size: 13px;
    color: #666;
}

.room-status {
    display: flex;
    align-items: center;
    gap: 10px;
}

/* 房间内界面 */
#in-room-screen {
    display: flex;
    flex-direction: column;
    background: linear-gradient(135deg, #1e3c72 0%, #2a5298 100%);
}

.in-room-header {
    display: flex;
    align-items: center;
    padding: 15px 20px;
    background: rgba(0, 0, 0, 0.3);
    gap: 15px;
}

.room-id {
    color: white;
    font-size: 16px;
    flex: 1;
    text-align: center;
}

.room-players {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 20px;
    padding: 20px;
}

.room-player {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 16px;
    padding: 20px 40px;
    display: flex;
    align-items: center;
    gap: 15px;
    width: 90%;
    max-width: 400px;
}

.room-player.ready {
    border: 3px solid #48bb78;
}

.room-player.empty {
    opacity: 0.6;
    border: 2px dashed #ccc;
}

.room-player .player-avatar {
    width: 50px;
    height: 50px;
}

.player-status {
    margin-left: auto;
    padding: 5px 15px;
    border-radius: 15px;
    font-size: 12px;
    font-weight: 600;
}

.player-status.ready {
    background: #48bb78;
    color: white;
}

.player-status.waiting {
    background: #e2e8f0;
    color: #666;
}

.room-controls {
    display: flex;
    justify-content: center;
    gap: 15px;
    padding: 20px;
}

/* 聊天框 */
.chat-box {
    background: rgba(0, 0, 0, 0.3);
    padding: 15px;
    height: 200px;
    display: flex;
    flex-direction: column;
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    margin-bottom: 10px;
    padding: 10px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 8px;
}

.chat-message {
    margin-bottom: 8px;
    color: white;
    font-size: 13px;
}

.chat-message .sender {
    color: #f5a623;
    font-weight: 600;
}

.chat-input {
    display: flex;
    gap: 10px;
}

.chat-input input {
    flex: 1;
    padding: 10px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
}

/* 商店界面 */
#shop-screen {
    display: flex;
    flex-direction: column;
    background: linear-gradient(135deg, #1e3c72 0%, #2a5298 100%);
}

.shop-header {
    display: flex;
    align-items: center;
    padding: 15px 20px;
    background: rgba(0, 0, 0, 0.3);
    gap: 15px;
}

.shop-title {
    color: white;
    font-size: 18px;
    font-weight: bold;
    flex: 1;
    text-align: center;
}

.user-coins {
    color: #f5a623;
    font-weight: 600;
}

.shop-categories {
    display: flex;
    justify-content: center;
    gap: 10px;
    padding: 15px;
    background: rgba(0, 0, 0, 0.2);
}

.category-btn {
    padding: 8px 20px;
    border: none;
    border-radius: 20px;
    background: rgba(255, 255, 255, 0.2);
    color: white;
    cursor: pointer;
    transition: all 0.3s;
}

.category-btn.active {
    background: #f5a623;
}

.shop-items {
    flex: 1;
    padding: 20px;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 15px;
    overflow-y: auto;
}

.shop-item {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 16px;
    padding: 20px;
    text-align: center;
    transition: all 0.3s;
}

.shop-item:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
}

.item-icon {
    font-size: 48px;
    margin-bottom: 10px;
}

.item-name {
    font-size: 16px;
    font-weight: bold;
    margin-bottom: 5px;
}

.item-desc {
    font-size: 12px;
    color: #666;
    margin-bottom: 10px;
}

.item-price {
    color: #f5a623;
    font-size: 18px;
    font-weight: bold;
    margin-bottom: 10px;
}

/* 个人中心 */
#profile-screen {
    display: flex;
    flex-direction: column;
    background: linear-gradient(135deg, #1e3c72 0%, #2a5298 100%);
}

.profile-header {
    display: flex;
    align-items: center;
    padding: 15px 20px;
    background: rgba(0, 0, 0, 0.3);
    gap: 15px;
}

.profile-title {
    color: white;
    font-size: 18px;
    font-weight: bold;
    flex: 1;
    text-align: center;
}

.profile-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 40px 20px;
    gap: 20px;
}

.profile-avatar {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    background: linear-gradient(135deg, #f5a623 0%, #d48c1c 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 48px;
    border: 4px solid rgba(255, 255, 255, 0.3);
}

.profile-info {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 16px;
    padding: 25px 40px;
    width: 90%;
    max-width: 400px;
}

.info-item {
    display: flex;
    justify-content: space-between;
    padding: 12px 0;
    border-bottom: 1px solid #eee;
}

.info-item:last-child {
    border-bottom: none;
}

.info-item label {
    color: #666;
    font-weight: 600;
}

.info-item span {
    color: #333;
    font-weight: bold;
}

.profile-actions {
    display: flex;
    gap: 15px;
}

/* 消息提示 */
.toast {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 15px 30px;
    border-radius: 10px;
    font-size: 14px;
    z-index: 1000;
    animation: fadeInOut 2s ease;
}

@keyframes fadeInOut {
    0% { opacity: 0; transform: translate(-50%, -50%) scale(0.8); }
    20% { opacity: 1; transform: translate(-50%, -50%) scale(1); }
    80% { opacity: 1; transform: translate(-50%, -50%) scale(1); }
    100% { opacity: 0; transform: translate(-50%, -50%) scale(0.8); }
}

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

.modal-content {
    background: white;
    border-radius: 16px;
    padding: 30px;
    width: 90%;
    max-width: 400px;
    text-align: center;
}

.modal-content h3 {
    margin-bottom: 15px;
    font-size: 20px;
}

.modal-content p {
    color: #666;
    margin-bottom: 25px;
}

.modal-actions {
    display: flex;
    gap: 15px;
    justify-content: center;
}

/* 响应式 */
@media (max-width: 600px) {
    .game-modes {
        grid-template-columns: 1fr;
    }
    
    .card {
        width: 50px;
        height: 70px;
        font-size: 14px;
        margin-left: -20px;
    }
    
    .player-hand {
        height: 110px;
    }
    
    .shop-items {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* 滚动条美化 */
::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.1);
}

::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.3);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.5);
}
