/**
 * 掼蛋游戏v5样式
 * 移植自 guandan_v5
 */

/* 基础重置 */
#guandan-game-app {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

#guandan-game-app * {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

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

.screen.hidden {
    display: none !important;
}

/* ========== 登录界面 ========== */
#login-screen {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
    padding: 20px;
    position: relative;
    overflow: hidden;
}

/* 登录界面背景大楼图片 */
#login-screen::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image: url('../images/building.jpg');
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    animation: buildingZoom 20s ease-out forwards;
    z-index: 0;
}

/* 背景图片逐渐放大动画 */
@keyframes buildingZoom {
    0% {
        transform: scale(1.0);
    }
    100% {
        transform: scale(1.15);
    }
}

.login-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    width: 100%;
    position: relative;
    z-index: 1;
}

.login-box {
    background: rgba(255, 255, 255, 0.5);
    border-radius: 20px;
    padding: 40px;
    width: 100%;
    max-width: 350px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: fadeInUp 0.6s ease-out 0.5s both;
}

/* 登录框淡入动画 */
@keyframes fadeInUp {
    0% {
        opacity: 0;
        transform: translateY(30px);
    }
    100% {
        opacity: 1;
        transform: translateY(0);
    }
}

.game-title {
    text-align: center;
    font-size: 32px;
    color: #1a365d !important;
    margin-bottom: 10px;
    font-weight: 700;
}

.game-title img {
    display: inline-block;
    vertical-align: middle;
}

.login-subtitle {
    text-align: center;
    color: #7f8c8d;
    margin-bottom: 30px;
    font-size: 14px;
}

.login-form {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.input-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #2c3e50;
}

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

.input-group input:focus {
    outline: none;
    border-color: #e74c3c;
    box-shadow: 0 0 0 3px rgba(231, 76, 60, 0.1);
}

.input-hint {
    display: block;
    margin-top: 5px;
    font-size: 12px;
    color: #003366;
}

.avatar-selection label {
    display: block;
    margin-bottom: 12px;
    font-weight: 600;
    color: #2c3e50;
}

.avatar-list {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    justify-content: center;
    max-height: 300px;
    overflow-y: auto;
    padding: 15px;
    background: rgba(255,255,255,0.1);
    border-radius: 10px;
}

.avatar-item {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    border: 3px solid transparent;
    cursor: pointer;
    transition: all 0.3s;
    overflow: hidden;
    background: #f5f5f5;
    position: relative;
}

.avatar-item:hover {
    transform: scale(1.1);
}

.avatar-item.active {
    border-color: #e74c3c;
    box-shadow: 0 0 0 4px rgba(231, 76, 60, 0.2);
}

.avatar-item.active::after {
    content: "✓";
    position: absolute;
    bottom: 0;
    right: 0;
    background: #e74c3c;
    color: white;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: bold;
}

.avatar-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* 自定义头像上传 */
.avatar-item.avatar-upload {
    border: 2px dashed #ccc;
    background: #f9f9f9;
}

.avatar-item.avatar-upload:hover {
    border-color: #e74c3c;
    background: #fff5f5;
}

.avatar-item.avatar-upload img {
    opacity: 0.6;
}

.upload-plus {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 32px;
    color: #999;
    font-weight: 300;
}

.avatar-item.avatar-upload:hover .upload-plus {
    color: #e74c3c;
}

/* 自定义头像预览 */
.custom-avatar-preview {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
}

.btn-login {
    width: calc(100% - 20px);
    padding: 21px 16px;
    background: linear-gradient(135deg, #e74c3c 0%, #c0392b 100%);
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 18px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s;
    margin: 10px auto 0;
    display: block;
}

.btn-login:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(231, 76, 60, 0.3);
}

.login-footer {
    text-align: center;
    margin-top: 25px;
    padding-top: 20px;
    border-top: 1px solid #ecf0f1;
}

.login-footer p {
    color: #003366;
    font-size: 13px;
    margin: 5px 0;
}

/* ========== 大厅界面 ========== */
#hall-screen {
    background-image: url('../images/hall.jpg');
    background-size: cover;
    background-position: center;
    background-attachment: fixed;
    min-height: 100vh;
    padding: 20px;
    position: relative;
}

#hall-screen::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.4);
    z-index: 0;
}

#hall-screen .hall-container {
    position: relative;
    z-index: 1;
}

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

.hall-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    padding: 30px 25px;
    border-radius: 15px;
    margin-bottom: 20px;
}

.player-info {
    display: flex;
    align-items: center;
    gap: 5px;
    flex-direction: row;
    white-space: nowrap;
    position: relative;
}

#player-info-header {
    position: relative;
}

#hall-player-name {
    position: absolute;
    top: 10px;
    left: 120px;
}

.player-avatar-small {
    width: 96px;
    height: 96px;
    border-radius: 50%;
    background: #fff;
    border: 3px solid #e74c3c;
    cursor: pointer;
    transition: all 0.3s ease;
    object-fit: cover;
}

.player-avatar-small:hover {
    transform: scale(1.1);
    box-shadow: 0 0 15px rgba(231, 76, 60, 0.6);
    border-color: #ff6b6b;
}

.player-name {
    color: #fff;
    font-weight: 600;
    font-size: 20px;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.5);
}

.player-name {
    color: #fff;
    font-weight: 500;
}

/* ========== 余额显示 ========== */
.player-balance {
    display: flex;
    gap: 12px;
    align-items: center;
    margin-left: 15px;
    padding-left: 15px;
    border-left: 1px solid rgba(255, 255, 255, 0.2);
}

.balance-gold {
    color: #ffd700;
    font-weight: 600;
    font-size: 14px;
    white-space: nowrap;
}

.balance-diamond {
    color: #64d8ff;
    font-weight: 600;
    font-size: 14px;
    white-space: nowrap;
}

/* ========== 签到按钮 ========== */
.btn-checkin {
    background: linear-gradient(135deg, #f39c12 0%, #e67e22 100%);
    color: white;
    font-weight: bold;
    animation: checkinPulse 2s ease-in-out infinite;
}

.btn-checkin:hover {
    background: linear-gradient(135deg, #e67e22 0%, #d35400 100%);
}

.btn-checkin.checked {
    background: rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.5);
    animation: none;
    cursor: default;
}

@keyframes checkinPulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(243, 156, 18, 0.4); }
    50% { box-shadow: 0 0 0 8px rgba(243, 156, 18, 0); }
}

.hall-actions {
    display: flex;
    gap: 10px;
}

.btn {
    padding: 10px 20px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.3s;
}

.btn-primary {
    background: linear-gradient(135deg, #e74c3c 0%, #c0392b 100%);
    color: white;
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.1);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.3);
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
}

.hall-content {
    display: grid;
    grid-template-columns: 1fr 350px;
    gap: 20px;
}

@media (max-width: 900px) {
    .hall-content {
        grid-template-columns: 1fr;
    }
}

.rooms-section {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 15px;
    padding: 20px;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.section-title {
    color: #fff;
    font-size: 20px;
    font-weight: 600;
}

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

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

.room-item:hover {
    background: rgba(255, 255, 255, 0.15);
    transform: translateX(5px);
}

.room-info-text h4 {
    color: #fff;
    margin-bottom: 5px;
}

.room-info-text p {
    color: rgba(255, 255, 255, 0.7);
    font-size: 13px;
}

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

.status-badge {
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
}

.status-waiting {
    background: #27ae60;
    color: white;
}

.status-playing {
    background: #e74c3c;
    color: white;
}

.btn-join {
    background: linear-gradient(135deg, #3498db 0%, #2980b9 100%);
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.3s;
}

.btn-join:hover {
    transform: scale(1.05);
}

/* 观战按钮样式 */
.btn-watch {
    background: linear-gradient(135deg, #9b59b6 0%, #8e44ad 100%);
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.3s;
}

.btn-watch:hover {
    transform: scale(1.05);
    background: linear-gradient(135deg, #8e44ad 0%, #9b59b6 100%);
}

/* 游戏中房间项样式 */
.room-playing {
    background: rgba(231, 76, 60, 0.1);
    border-left: 3px solid #e74c3c;
}

/* 玩家数量显示 */
.player-count {
    font-size: 14px;
    color: rgba(255, 255, 255, 0.8);
    font-weight: 500;
}

.empty-rooms {
    text-align: center;
    color: rgba(255, 255, 255, 0.5);
    padding: 40px;
}

.create-room-section {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 15px;
    padding: 20px;
    height: fit-content;
}

.create-room-form {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.form-group label {
    display: block;
    color: rgba(255, 255, 255, 0.9);
    margin-bottom: 8px;
    font-size: 14px;
}

.form-group input,
.form-group select {
    width: 100%;
    padding: 12px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
    font-size: 14px;
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: #e74c3c;
}

.form-group input::placeholder {
    color: rgba(255, 255, 255, 0.4);
}

.form-group option {
    background: #16213e;
    color: #fff;
}

/* ========== Toast提示 ========== */
#toast-container {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 2000;
    display: flex;
    flex-direction: column;
    gap: 10px;
    pointer-events: none;
}

.toast {
    padding: 12px 24px;
    border-radius: 8px;
    color: white;
    font-weight: 500;
    animation: slideDown 0.3s ease, fadeOut 0.3s ease 2.7s;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.toast.success {
    background: #27ae60;
}

.toast.error {
    background: #e74c3c;
}

.toast.info {
    background: #3498db;
}

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

@keyframes fadeOut {
    from {
        opacity: 1;
    }
    to {
        opacity: 0;
    }
}

/* 玩家详细信息模态框 */
.player-detail-modal {
    position: fixed;
    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: 9999;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.player-detail-modal.active {
    opacity: 1;
    visibility: visible;
}

.player-detail-content {
    background: linear-gradient(135deg, #2c3e50 0%, #1a1a2e 100%);
    border-radius: 20px;
    padding: 40px;
    max-width: 400px;
    width: 90%;
    text-align: center;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    border: 2px solid rgba(231, 76, 60, 0.5);
    transform: scale(0.9);
    transition: transform 0.3s ease;
}

.player-detail-modal.active .player-detail-content {
    transform: scale(1);
}

.player-detail-avatar {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    border: 4px solid #e74c3c;
    margin-bottom: 20px;
    background: #fff;
    object-fit: cover;
}

.player-detail-name {
    font-size: 24px;
    color: #fff;
    font-weight: 600;
    margin-bottom: 10px;
}

.player-detail-balance {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    margin: 15px 0;
    padding: 15px;
    background: rgba(255, 215, 0, 0.1);
    border-radius: 10px;
    border: 1px solid rgba(255, 215, 0, 0.3);
}

.balance-item {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
}

.balance-icon {
    font-size: 18px;
}

.balance-value {
    font-size: 16px;
    color: #f39c12;
    font-weight: 600;
}

.player-detail-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 15px;
    margin: 25px 0;
}

.stat-item {
    background: rgba(255, 255, 255, 0.1);
    padding: 15px;
    border-radius: 10px;
}

.stat-value {
    font-size: 24px;
    color: #e74c3c;
    font-weight: 700;
}

.stat-label {
    font-size: 12px;
    color: #95a5a6;
    margin-top: 5px;
}

.player-detail-close {
    background: linear-gradient(135deg, #e74c3c 0%, #c0392b 100%);
    color: white;
    border: none;
    padding: 12px 40px;
    border-radius: 25px;
    font-size: 16px;
    cursor: pointer;
    transition: all 0.3s;
}

.player-detail-close:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 20px rgba(231, 76, 60, 0.4);
}

/* 模态框头像更换区域 */
.avatar-change-section {
    margin: 25px 0;
    padding-top: 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.avatar-change-label {
    color: rgba(255, 255, 255, 0.8);
    font-size: 14px;
    margin-bottom: 15px;
}

.avatar-list-small {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    justify-content: center;
    max-height: 150px;
    overflow-y: auto;
    padding: 10px;
}

.avatar-item-small {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    border: 2px solid transparent;
    cursor: pointer;
    transition: all 0.3s;
    overflow: hidden;
    background: rgba(255, 255, 255, 0.1);
    position: relative;
}

.avatar-item-small:hover {
    transform: scale(1.15);
}

.avatar-item-small.active {
    border-color: #e74c3c;
    box-shadow: 0 0 0 3px rgba(231, 76, 60, 0.2);
}

.avatar-item-small.active::after {
    content: "✓";
    position: absolute;
    bottom: 0;
    right: 0;
    background: #e74c3c;
    color: white;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    font-weight: bold;
}

.avatar-item-small img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* 模态框自定义上传按钮 */
.avatar-upload-small {
    border: 2px dashed rgba(255, 255, 255, 0.3);
    background: rgba(255, 255, 255, 0.05);
}

.avatar-upload-small:hover {
    border-color: #e74c3c;
    background: rgba(231, 76, 60, 0.1);
}

.avatar-upload-small img {
    opacity: 0.5;
}

.upload-plus-small {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 20px;
    color: rgba(255, 255, 255, 0.5);
    font-weight: 300;
}

.avatar-upload-small:hover .upload-plus-small {
    color: #e74c3c;
}

/* 响应式 */
@media (max-width: 768px) {
    .hall-content {
        grid-template-columns: 1fr;
    }
}

/* ========== 房间玩家头像 ========== */
.room-players-avatars {
    display: flex;
    gap: 8px;
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.room-player-avatar {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    min-width: 40px;
}

.room-player-avatar img {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, 0.3);
    background: rgba(255, 255, 255, 0.1);
    object-fit: cover;
}

.room-player-avatar span {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.7);
    max-width: 64px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    text-align: center;
}

.room-player-avatar.is-ai img {
    border-color: rgba(52, 152, 219, 0.5);
}

.room-player-avatar.is-ai span {
    color: rgba(52, 152, 219, 0.8);
}

.room-player-avatar.empty .avatar-placeholder {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 2px dashed rgba(255, 255, 255, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    color: rgba(255, 255, 255, 0.3);
    background: rgba(255, 255, 255, 0.05);
}

.room-player-avatar.empty span {
    color: rgba(255, 255, 255, 0.3);
}
