/* style.css - 修复牌面显示和饮酒杯数问题 */

/* 基础样式 */
:root {
    --primary-color: #e91e63;
    --secondary-color: #9c27b0;
    --dark-color: #7b1fa2;
    --light-color: #f3e5f5;
    --success-color: #4caf50;
    --warning-color: #ff9800;
    --danger-color: #f44336;
    --info-color: #2196f3;
    --card-width: 70px;
    --card-height: 100px;
    --card-radius: 5px;
    --card-margin: 10px;
    --card-shadow: 0 3px 6px rgba(0,0,0,0.16), 0 3px 6px rgba(0,0,0,0.23);
    --transition: all 0.3s ease;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Arial Rounded MT Bold', 'Helvetica Rounded', Arial, sans-serif;
}

body {
    background: linear-gradient(135deg, #1a237e, #311b92);
    color: white;
    min-height: 100vh;
    padding: 20px;
}

.container {
    max-width: 800px;
    margin: 0 auto;
    text-align: center;
}

h1 {
    font-size: 42px;
    margin: 20px 0;
    color: var(--light-color);
    text-shadow: 0 0 10px rgba(233, 30, 99, 0.7);
}

/* 游戏卡片样式 - 修复牌面显示 */
.card {
    width: var(--card-width);
    height: var(--card-height);
    position: relative;
    background: white;
    border-radius: var(--card-radius);
    box-shadow: var(--card-shadow);
    color: black;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 5px;
    font-weight: bold;
    transition: transform 0.3s ease;
}

.card-top, .card-bottom {
    position: absolute;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    padding: 5px;
}

.card-top {
    top: 0;
    left: 0;
}

.card-bottom {
    bottom: 0;
    right: 0;
    transform: rotate(180deg);
}

.card-center {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 24px;
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
    height: 100%;
}

.card-value {
    font-size: 14px;
    line-height: 1;
}

.card-suit {
    font-size: 18px;
    text-align: center;
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
}

.card-red {
    color: #d32f2f;
}

.card-black {
    color: #212121;
}

/* 玩家状态指示器 */
.player-status-indicator {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    display: inline-block;
    margin-right: 5px;
}

.online {
    background-color: #4CAF50;
}

.offline {
    background-color: #f44336;
}

/* 玩家状态信息 */
.player-status {
    display: flex;
    gap: 10px;
    font-size: 14px;
    margin-top: 8px;
}

.player-status > div {
    background: rgba(255, 255, 255, 0.1);
    padding: 3px 8px;
    border-radius: 4px;
}

/* 牌堆背面样式 */
.card-back {
    background: linear-gradient(135deg, #f44336, #9c27b0);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    width: var(--card-width);
    height: var(--card-height);
    border-radius: var(--card-radius);
}

.undealt-cards {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-top: 10px;
}

.remaining-cards {
    font-size: 14px;
    margin-top: 5px;
}

/* 游戏容器样式 */
.game-intro {
    background: rgba(255, 255, 255, 0.1);
    padding: 15px;
    border-radius: 10px;
    margin: 20px 0;
}

.form-box {
    display: flex;
    gap: 30px;
    margin-top: 30px;
}

.form-box form {
    flex: 1;
    background: rgba(255, 255, 255, 0.1);
    padding: 20px;
    border-radius: 15px;
    border: 2px solid rgba(255, 255, 255, 0.2);
}

.form-box h2 {
    margin-bottom: 20px;
    color: #ffeb3b;
}

.input-group {
    margin: 15px 0;
    text-align: left;
}

.input-group label {
    display: block;
    margin-bottom: 5px;
    font-size: 16px;
}

.input-group input {
    width: 100%;
    padding: 12px;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.3);
    background: rgba(255, 255, 255, 0.2);
    color: white;
    font-size: 16px;
    transition: var(--transition);
}

.input-group input:focus {
    outline: none;
    border-color: var(--primary-color);
    background: rgba(255, 255, 255, 0.3);
}

button {
    background: linear-gradient(45deg, var(--primary-color), var(--secondary-color));
    color: white;
    border: none;
    padding: 12px 25px;
    font-size: 16px;
    border-radius: 50px;
    cursor: pointer;
    margin-top: 10px;
    transition: var(--transition);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
}

button:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 15px rgba(0, 0, 0, 0.3);
    background: linear-gradient(45deg, #d81b60, #8e24aa);
}

.btn {
    padding: 10px 20px;
    border-radius: 50px;
    cursor: pointer;
    transition: var(--transition);
    font-weight: bold;
}

.btn:hover {
    transform: translateY(-2px);
}

.btn-alt {
    background: var(--warning-color);
}

/* GAME PAGE STYLES */
.game-container {
    max-width: 900px;
    margin: 0 auto;
    height: 100vh;
    display: flex;
    flex-direction: column;
}

.game-header {
    display: flex;
    justify-content: space-between;
    padding: 15px;
    background: rgba(0, 0, 0, 0.4);
    border-radius: 10px;
    margin-bottom: 20px;
}

.player-turn {
    font-weight: bold;
    font-size: 18px;
    color: #ffeb3b;
    background: rgba(0, 0, 0, 0.3);
    padding: 5px 15px;
    border-radius: 20px;
}

.game-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 30px;
}

.piles-container {
    display: flex;
    justify-content: center;
    gap: 30px;
    margin-top: 20px;
    flex: 1;
}

.pile {
    width: var(--card-width);
    min-height: calc(var(--card-height) * 1.2);
    position: relative;
    background: rgba(255, 255, 255, 0.05);
    border-radius: var(--card-radius);
    border: 2px dashed rgba(255, 255, 255, 0.3);
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    flex-direction: column;
    align-items: center;
}

.pile:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: var(--primary-color);
}

.pile-label {
    font-size: 12px;
    margin-bottom: 5px;
    color: rgba(255, 255, 255, 0.6);
}

.orphaned-cards {
    position: relative;
    min-height: calc(var(--card-height) * 1.3);
    background: rgba(0, 0, 0, 0.3);
    border-radius: 10px;
    padding: 15px;
    margin: 0 20px;
}

.section-title {
    position: absolute;
    top: -10px;
    left: 20px;
    background: rgba(0, 0, 0, 0.6);
    padding: 0 10px;
    font-size: 14px;
    color: var(--light-color);
}

.action-bar {
    padding: 15px;
    background: rgba(0, 0, 0, 0.4);
    border-radius: 10px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.message-area {
    flex: 2;
    min-height: 60px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 8px;
    padding: 10px;
    display: flex;
    align-items: center;
}

.message {
    font-size: 18px;
    color: #ffeb3b;
}

.highlight {
    animation: highlight 1s;
}

@keyframes highlight {
    0% { background: rgba(255, 255, 255, 0); }
    50% { background: rgba(255, 235, 59, 0.3); }
    100% { background: rgba(255, 255, 255, 0); }
}

.drink-counter {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 10px;
    align-items: center;
}

.drink-stats {
    display: flex;
    gap: 10px;
    font-size: 14px;
}

.drink-controls {
    display: flex;
    gap: 10px;
    align-items: center;
}

.drink-btn {
    padding: 8px 15px;
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 5px;
}

.amount-selector {
    display: flex;
    align-items: center;
    gap: 5px;
}

.amount-btn {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: white;
    cursor: pointer;
    font-size: 16px;
}

.amount-btn:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* PLAYER STYLES */
.players-container {
    display: flex;
    gap: 20px;
    padding: 15px;
    overflow-x: auto;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 10px;
    margin: 0 20px;
}

.player {
    background: rgba(255, 255, 255, 0.1);
    padding: 10px;
    border-radius: 10px;
    min-width: 150px;
    position: relative;
}

.player-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
}

.player-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(45deg, var(--primary-color), var(--secondary-color));
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
}

.player-name {
    font-size: 16px;
    font-weight: bold;
}

.player-cups {
    font-size: 14px;
    color: #ffeb3b;
}

.card-container {
    width: var(--card-width);
    height: var(--card-height);
    position: relative;
}

.player-active {
    border: 2px solid var(--success-color);
    box-shadow: 0 0 10px rgba(76, 175, 80, 0.5);
}

.player-me .player-name::after {
    content: " (我)";
}

/* Modal */
.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;
    opacity: 0;
    visibility: hidden;
    transition: var(--transition);
}

.modal.show {
    opacity: 1;
    visibility: visible;
}

.modal-content {
    background: linear-gradient(135deg, #1a237e, #311b92);
    padding: 30px;
    border-radius: 15px;
    width: 90%;
    max-width: 500px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    border: 2px solid rgba(255, 255, 255, 0.1);
    transform: translateY(20px);
    transition: var(--transition);
}

.modal.show .modal-content {
    transform: translateY(0);
}

.modal h3 {
    margin-bottom: 20px;
    color: var(--light-color);
    text-align: center;
}

.confirm-info {
    margin-bottom: 30px;
    text-align: center;
}

.confirm-info p {
    margin: 10px 0;
}

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

/* 新增：饮酒确认模态框样式 */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.modal-overlay.show {
    opacity: 1;
    visibility: visible;
}

.modal-content {
    background: linear-gradient(135deg, #1a237e, #311b92);
    padding: 30px;
    border-radius: 15px;
    width: 90%;
    max-width: 400px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    border: 2px solid rgba(255, 255, 255, 0.2);
    transform: scale(0.9);
    transition: transform 0.3s ease;
}

.modal-overlay.show .modal-content {
    transform: scale(1);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
}

.modal-header h3 {
    margin: 0;
    color: #ffeb3b;
}

.modal-close {
    background: none;
    border: none;
    color: #fff;
    font-size: 24px;
    cursor: pointer;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.confirm-info p {
    margin: 10px 0;
    font-size: 16px;
}

.warning-text {
    color: #ff9800;
    font-weight: bold;
    text-align: center;
    margin: 20px 0;
}

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

.btn-success {
    background: linear-gradient(45deg, #4CAF50, #8BC34A);
}

.btn-danger {
    background: linear-gradient(45deg, #f44336, #d32f2f);
}

.hidden {
    display: none !important;
}

/* 加载器样式 */
.game-loader {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.game-loader-content {
    background: white;
    padding: 30px;
    border-radius: 10px;
    text-align: center;
    color: #333;
}

.game-spinner {
    width: 50px;
    height: 50px;
    border: 5px solid rgba(0, 0, 0, 0.1);
    border-left-color: #09f;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 20px auto;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* 响应式设计 */
@media (max-width: 768px) {
    .form-box {
        flex-direction: column;
    }
    
    .card {
        width: 55px;
        height: 80px;
    }
    
    .card-value {
        font-size: 12px;
    }
    
    .card-suit {
        font-size: 14px;
    }
    
    .players-container {
        flex-wrap: wrap;
    }
    
    .player {
        min-width: 120px;
    }
}

@media (max-width: 480px) {
    .game-area {
        padding: 5px;
    }
    
    .piles-container {
        gap: 10px;
    }
    
    .players-container {
        flex-direction: column;
    }
}