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

body {
    font-family: 'Microsoft YaHei', 'PingFang SC', sans-serif;
    background: linear-gradient(135deg, #0a5c36 0%, #1a7a4c 30%, #0d6b3d 60%, #0a5c36 100%);
    min-height: 100vh;
    overflow: hidden;
    color: #fff;
    user-select: none;
}

/* ===== 登录界面 ===== */
.screen {
    width: 100vw;
    height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
}

.login-box {
    background: rgba(0,0,0,0.5);
    backdrop-filter: blur(20px);
    border-radius: 20px;
    padding: 50px 40px;
    text-align: center;
    border: 1px solid rgba(255,255,255,0.15);
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
    min-width: 360px;
    max-width: 420px;
}

.login-box h1 {
    font-size: 48px;
    margin-bottom: 10px;
}

.subtitle {
    color: rgba(255,255,255,0.6);
    margin-bottom: 25px;
    font-size: 16px;
}

/* 模式切换标签 */
.mode-tabs {
    display: flex;
    gap: 0;
    margin-bottom: 20px;
    background: rgba(255,255,255,0.08);
    border-radius: 10px;
    padding: 3px;
}

.mode-tab {
    flex: 1;
    padding: 10px 0;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 15px;
    font-weight: bold;
    color: rgba(255,255,255,0.5);
    background: transparent;
    transition: all 0.3s;
}

.mode-tab.active {
    background: rgba(255,255,255,0.15);
    color: #fff;
}

.mode-tab:hover:not(.active) {
    color: rgba(255,255,255,0.8);
}

#name-input, #room-id-input {
    display: block;
    width: 100%;
    padding: 14px 20px;
    border-radius: 12px;
    border: 1px solid rgba(255,255,255,0.3);
    background: rgba(255,255,255,0.1);
    color: #fff;
    font-size: 18px;
    outline: none;
    transition: border-color 0.3s;
    margin-bottom: 16px;
    text-align: center;
}

#room-id-input {
    letter-spacing: 8px;
    font-size: 28px;
    font-weight: bold;
}

#name-input:focus, #room-id-input:focus {
    border-color: #4caf50;
}

#name-input::placeholder, #room-id-input::placeholder {
    color: rgba(255,255,255,0.4);
}

.btn-primary {
    padding: 14px 40px;
    border: none;
    border-radius: 12px;
    font-size: 18px;
    font-weight: bold;
    cursor: pointer;
    background: linear-gradient(135deg, #f5af19, #f12711);
    color: #fff;
    transition: all 0.3s;
    box-shadow: 0 4px 15px rgba(241,39,17,0.4);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(241,39,17,0.6);
}

.btn-primary:disabled {
    background: #666;
    cursor: not-allowed;
    box-shadow: none;
    transform: none;
}

.btn-secondary {
    padding: 14px 30px;
    border: 2px solid rgba(255,255,255,0.5);
    border-radius: 12px;
    font-size: 18px;
    font-weight: bold;
    cursor: pointer;
    background: rgba(255,255,255,0.1);
    color: #fff;
    transition: all 0.3s;
}

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

.btn-hint {
    padding: 14px 24px;
    border: none;
    border-radius: 12px;
    font-size: 16px;
    cursor: pointer;
    background: rgba(255,255,255,0.15);
    color: #fff;
    transition: all 0.3s;
}

.btn-hint:hover {
    background: rgba(255,255,255,0.25);
}

.btn-small {
    padding: 8px 16px;
    border: 1px solid rgba(255,255,255,0.4);
    border-radius: 8px;
    font-size: 14px;
    cursor: pointer;
    background: rgba(255,255,255,0.1);
    color: #fff;
}

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

.status-text {
    margin-top: 15px;
    font-size: 14px;
    color: rgba(255,255,255,0.6);
}

/* ===== 等待室 ===== */
.waiting-box {
    background: rgba(0,0,0,0.5);
    backdrop-filter: blur(20px);
    border-radius: 20px;
    padding: 40px;
    text-align: center;
    border: 1px solid rgba(255,255,255,0.15);
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
    min-width: 380px;
    max-width: 440px;
}

.waiting-box h2 {
    font-size: 32px;
    margin-bottom: 20px;
}

.room-id-display {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin-bottom: 10px;
    padding: 12px 20px;
    background: rgba(255,255,255,0.08);
    border-radius: 12px;
}

.room-id-display .label {
    font-size: 14px;
    color: rgba(255,255,255,0.5);
}

.room-number {
    font-size: 36px;
    font-weight: bold;
    letter-spacing: 8px;
    color: #f5af19;
    font-family: 'Courier New', monospace;
}

.btn-copy {
    padding: 8px 14px;
    border: 1px solid rgba(255,255,255,0.3);
    border-radius: 8px;
    background: rgba(255,255,255,0.1);
    color: #fff;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.3s;
}

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

.share-hint {
    color: rgba(255,255,255,0.4);
    font-size: 13px;
    margin-bottom: 20px;
}

.waiting-players {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
}

.player-slot {
    flex: 1;
    padding: 16px 10px;
    background: rgba(255,255,255,0.06);
    border-radius: 12px;
    border: 2px dashed rgba(255,255,255,0.15);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
}

.player-slot.occupied {
    border: 2px solid rgba(76,175,80,0.4);
    background: rgba(76,175,80,0.08);
}

.slot-icon {
    font-size: 28px;
}

.slot-name {
    font-size: 14px;
    font-weight: bold;
    color: #fff;
}

.slot-role {
    font-size: 11px;
    color: rgba(255,255,255,0.4);
}

.btn-leave {
    margin-top: 15px;
    padding: 10px 24px;
    border: 1px solid rgba(255,255,255,0.2);
    border-radius: 10px;
    background: transparent;
    color: rgba(255,255,255,0.5);
    font-size: 14px;
    cursor: pointer;
    transition: all 0.3s;
}

.btn-leave:hover {
    background: rgba(255,0,0,0.15);
    color: #ff6b6b;
    border-color: rgba(255,0,0,0.3);
}

/* 在线状态点 */
.online-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #666;
    display: inline-block;
}

.online-dot.online {
    background: #4caf50;
    box-shadow: 0 0 6px rgba(76,175,80,0.6);
}

/* ===== 游戏界面 ===== */
#ddz-game-screen {
    flex-direction: column;
    height: 100vh;
    padding: 10px;
}

#top-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 20px;
    background: rgba(0,0,0,0.3);
    border-radius: 10px;
    margin-bottom: 5px;
    font-size: 14px;
}

/* ===== 游戏台面 ===== */
#game-table {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    position: relative;
}

.player-area {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 8px 20px;
}

.player-area.self {
    flex-direction: column;
    align-items: center;
}

.player-area.opponent {
    justify-content: center;
}

.player-info {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 120px;
}

.player-avatar {
    font-size: 28px;
}

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

.landlord-badge {
    background: linear-gradient(135deg, #f5af19, #f12711);
    padding: 2px 10px;
    border-radius: 10px;
    font-size: 12px;
    font-weight: bold;
    display: none;
}

.landlord-badge.show {
    display: inline-block;
}

.hand-count {
    background: rgba(0,0,0,0.4);
    padding: 4px 12px;
    border-radius: 10px;
    font-size: 14px;
}

/* ===== 中央区域 ===== */
#table-center {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex: 1;
}

#player-left {
    flex-direction: column;
    align-items: center;
    width: 160px;
}

#player-right {
    display: none;
}

#center-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
}

#bottom-cards-area {
    text-align: center;
}

#bottom-cards-area .label {
    font-size: 13px;
    color: rgba(255,255,255,0.6);
    display: block;
    margin-bottom: 5px;
}

.cards-row {
    display: flex;
    gap: 6px;
    justify-content: center;
}

/* ===== 出牌区域 ===== */
.played-cards {
    display: flex;
    gap: 4px;
    justify-content: center;
    min-height: 50px;
    align-items: center;
}

/* ===== 卡牌样式 ===== */
.card {
    width: 60px;
    height: 88px;
    background: #fff;
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 5px 7px;
    color: #333;
    font-weight: bold;
    box-shadow: 0 2px 8px rgba(0,0,0,0.3);
    cursor: pointer;
    transition: all 0.2s;
    position: relative;
}

.card:hover {
    transform: translateY(-6px);
    box-shadow: 0 6px 16px rgba(0,0,0,0.4);
}

.card.selected {
    transform: translateY(-16px);
    box-shadow: 0 8px 20px rgba(241,39,17,0.5);
    border: 2px solid #f12711;
}

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

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

.card .card-center {
    font-size: 32px;
    text-align: center;
}

.card.face-down {
    background: linear-gradient(135deg, #1a3a5c, #2c5aa0);
    color: #fff;
}

.card.small {
    width: 45px;
    height: 66px;
    padding: 3px 5px;
}

.card.small .card-corner {
    font-size: 11px;
}

.card.small .card-center {
    font-size: 24px;
}

.card.mini {
    width: 36px;
    height: 52px;
    padding: 2px 4px;
}

.card.mini .card-corner {
    font-size: 9px;
}

.card.mini .card-center {
    font-size: 18px;
}

/* ===== 手牌区域 ===== */
#my-cards {
    display: flex;
    justify-content: center;
    gap: 0;
    padding: 10px 0;
    position: relative;
}

#my-cards .card {
    margin-left: -22px;
}

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

/* ===== 操作栏 ===== */
#action-bar {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 10px;
    gap: 10px;
    background: rgba(0,0,0,0.2);
    border-radius: 12px;
}

#action-buttons {
    display: flex;
    gap: 12px;
    align-items: center;
}

.btn-bid {
    padding: 12px 28px;
    border: 2px solid rgba(255,255,255,0.4);
    border-radius: 12px;
    font-size: 18px;
    font-weight: bold;
    cursor: pointer;
    background: rgba(255,255,255,0.1);
    color: #fff;
    transition: all 0.3s;
}

.btn-bid:hover {
    background: rgba(255,255,255,0.25);
}

/* ===== 游戏消息 ===== */
#ddz-game-message {
    padding: 8px 20px;
    background: rgba(0,0,0,0.4);
    border-radius: 8px;
    font-size: 15px;
    text-align: center;
    min-width: 200px;
}

#last-play-info {
    font-size: 13px;
    color: rgba(255,255,255,0.6);
    text-align: center;
}

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

.modal-content {
    background: linear-gradient(135deg, #1a3a5c, #2c5aa0);
    border-radius: 20px;
    padding: 40px 50px;
    text-align: center;
    box-shadow: 0 20px 60px rgba(0,0,0,0.5);
}

.modal-content h2 {
    font-size: 36px;
    margin-bottom: 15px;
}

.modal-content p {
    font-size: 18px;
    margin-bottom: 25px;
    color: rgba(255,255,255,0.8);
}

/* ===== 响应式 ===== */
@media (max-width: 768px) {
    .card {
        width: 46px;
        height: 68px;
        padding: 3px 5px;
    }
    .card .card-corner { font-size: 11px; }
    .card .card-center { font-size: 24px; }
    #my-cards .card { margin-left: -28px; }
}

/* ===== 游戏大厅 ===== */
.lobby-screen {
    flex-direction: column;
    padding: 20px;
}

.lobby-container {
    max-width: 900px;
    width: 100%;
    text-align: center;
}

.lobby-title {
    font-size: 52px;
    margin-bottom: 8px;
    background: linear-gradient(135deg, #f5af19, #f12711, #4caf50);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.lobby-subtitle {
    color: rgba(255,255,255,0.5);
    font-size: 16px;
    margin-bottom: 40px;
}

.game-cards {
    display: flex;
    gap: 24px;
    justify-content: center;
    flex-wrap: wrap;
}

.game-card {
    width: 240px;
    height: 300px;
    background: rgba(255,255,255,0.08);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255,255,255,0.12);
    border-radius: 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.game-card:hover {
    transform: translateY(-8px);
    border-color: rgba(245,175,25,0.5);
    box-shadow: 0 12px 40px rgba(245,175,25,0.2);
    background: rgba(255,255,255,0.12);
}

.game-card.coming-soon {
    opacity: 0.4;
    cursor: not-allowed;
}

.game-card.coming-soon:hover {
    transform: none;
    box-shadow: none;
}

.game-card-icon {
    font-size: 56px;
    line-height: 1;
}

.game-card-name {
    font-size: 24px;
    font-weight: bold;
}

.game-card-desc {
    font-size: 13px;
    color: rgba(255,255,255,0.5);
    text-align: center;
    padding: 0 16px;
}

.game-card-badge {
    position: absolute;
    top: 14px;
    right: 14px;
    background: rgba(76,175,80,0.3);
    border: 1px solid rgba(76,175,80,0.5);
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: bold;
    color: #4caf50;
}

.lobby-footer {
    margin-top: 40px;
    font-size: 14px;
    color: rgba(255,255,255,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.lobby-status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #666;
    display: inline-block;
    transition: background 0.3s;
}

.lobby-status-dot.online {
    background: #4caf50;
    box-shadow: 0 0 8px rgba(76,175,80,0.6);
}

.lobby-status-dot.offline {
    background: #e74c3c;
}

/* ===== 返回按钮 ===== */
.login-back {
    margin-bottom: 20px;
}

.btn-back {
    padding: 6px 16px;
    border: 1px solid rgba(255,255,255,0.3);
    border-radius: 8px;
    background: rgba(255,255,255,0.08);
    color: rgba(255,255,255,0.7);
    font-size: 14px;
    cursor: pointer;
    transition: all 0.3s;
}

.btn-back:hover {
    background: rgba(255,255,255,0.15);
    color: #fff;
}

/* ===== 五子棋界面 ===== */
#gomoku-game-screen {
    flex-direction: column;
    height: 100vh;
    padding: 10px;
    align-items: center;
}

#gomoku-top-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 20px;
    background: rgba(0,0,0,0.3);
    border-radius: 10px;
    margin-bottom: 10px;
    font-size: 14px;
    width: 100%;
    max-width: 650px;
    gap: 12px;
}

#gomoku-top-bar button {
    flex-shrink: 0;
}

#gomoku-players {
    display: flex;
    align-items: center;
    gap: 20px;
    margin-bottom: 15px;
}

.gomoku-player {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 20px;
    background: rgba(255,255,255,0.06);
    border-radius: 12px;
    border: 2px solid transparent;
    transition: all 0.3s;
}

.gomoku-player.active {
    border-color: rgba(245,175,25,0.6);
    background: rgba(245,175,25,0.1);
    box-shadow: 0 0 15px rgba(245,175,25,0.2);
}

.gomoku-stone-icon {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    flex-shrink: 0;
}

.gomoku-stone-icon.black-stone {
    background: radial-gradient(circle at 30% 30%, #555, #111);
    border: 1px solid #000;
}

.gomoku-stone-icon.white-stone {
    background: radial-gradient(circle at 30% 30%, #fff, #ddd);
    border: 1px solid #999;
}

.gomoku-player-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

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

.gomoku-player-tag {
    font-size: 12px;
    color: rgba(255,255,255,0.5);
}

#gomoku-vs {
    font-size: 20px;
    font-weight: bold;
    color: rgba(245,175,25,0.8);
}

#gomoku-board-container {
    background: rgba(0,0,0,0.2);
    border-radius: 12px;
    padding: 10px;
    box-shadow: 0 8px 30px rgba(0,0,0,0.3);
}

#gomoku-canvas {
    display: block;
    border-radius: 8px;
    max-width: 100%;
    height: auto;
    cursor: crosshair;
}

.gomoku-message {
    margin-top: 12px;
    padding: 8px 24px;
    background: rgba(0,0,0,0.4);
    border-radius: 8px;
    font-size: 15px;
    text-align: center;
    min-height: 34px;
    min-width: 200px;
    color: #fff;
}

/* ===== 弹窗额外按钮 ===== */
.modal-content .btn-secondary {
    margin-left: 10px;
}

/* ===== 等待室适配2人 ===== */
.waiting-players.two-players .player-slot {
    flex: 1;
}
