/* ============================================
   干瞪眼 - 游戏样式
   ============================================ */

:root {
    --bg: #0a0e17;
    --card-bg: #1a1f2e;
    --accent: #e8b84b;
    --accent2: #c0392b;
    --text: #e0e0e0;
    --text-dim: #8890a0;
    --green: #27ae60;
    --red: #e74c3c;
    --blue: #3498db;
    --border: #2a3040;
}

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

body {
    font-family: -apple-system, "Microsoft YaHei", sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    overflow-x: hidden;
}

/* 背景装饰 */
body::before {
    content: '';
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: radial-gradient(ellipse at 50% 0%, rgba(232,184,75,0.08) 0%, transparent 60%),
                radial-gradient(ellipse at 80% 80%, rgba(52,152,219,0.05) 0%, transparent 60%);
    pointer-events: none;
    z-index: 0;
}

/* 容器 */
.container {
    max-width: 480px;
    margin: 0 auto;
    padding: 16px;
    position: relative;
    z-index: 1;
}

/* ===== 面板通用 ===== */
.panel {
    display: none;
    animation: fadeIn 0.3s ease;
}
.panel.active { display: block; }

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

/* ===== 标题 ===== */
.game-title {
    text-align: center;
    padding: 30px 0 20px;
}
.game-title h1 {
    font-size: 36px;
    color: var(--accent);
    letter-spacing: 4px;
    margin-bottom: 6px;
}
.game-title .subtitle {
    font-size: 14px;
    color: var(--text-dim);
}

/* ===== 登录面板 ===== */
.login-card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 30px 24px;
    text-align: center;
}
.login-card h2 {
    font-size: 20px;
    margin-bottom: 20px;
    color: var(--accent);
}
.input-group {
    display: flex;
    gap: 10px;
    margin-bottom: 12px;
}
.login-card input {
    flex: 1;
    padding: 12px 16px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--bg);
    color: var(--text);
    font-size: 16px;
    outline: none;
    transition: border-color 0.2s;
}
.login-card input:focus {
    border-color: var(--accent);
}

/* ===== 按钮 ===== */
.btn {
    padding: 10px 20px;
    border: none;
    border-radius: 10px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    color: #fff;
}
.btn:active { transform: scale(0.96); }
.btn-primary { background: var(--accent); color: #1a1a1a; }
.btn-success { background: var(--green); }
.btn-danger { background: var(--red); }
.btn-info { background: var(--blue); }
.btn-warning { background: #f39c12; }
.btn-block { display: block; width: 100%; }
.btn-sm { padding: 6px 14px; font-size: 14px; }
.btn:disabled { opacity: 0.5; pointer-events: none; }

/* ===== 大厅面板 ===== */
.lobby-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 0;
    margin-bottom: 16px;
}
.lobby-header .nickname {
    font-size: 18px;
    color: var(--accent);
    font-weight: 600;
}
.room-actions {
    display: flex;
    gap: 10px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}
.room-actions input {
    flex: 1;
    min-width: 120px;
    padding: 10px 14px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--bg);
    color: var(--text);
    font-size: 15px;
    text-transform: uppercase;
    letter-spacing: 2px;
}
.room-actions input::placeholder {
    text-transform: none;
    letter-spacing: 0;
    color: var(--text-dim);
}

/* ===== 房间面板 ===== */
.room-card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 20px;
    margin-top: 16px;
}
.room-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}
.room-id-display {
    font-size: 28px;
    color: var(--accent);
    letter-spacing: 4px;
    font-weight: 700;
}
.room-id-label {
    font-size: 12px;
    color: var(--text-dim);
}
.players-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    margin-bottom: 16px;
}
.player-slot {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 12px;
    text-align: center;
    min-height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
}
.player-slot .name {
    font-size: 15px;
    font-weight: 600;
}
.player-slot .seat-label {
    font-size: 11px;
    color: var(--text-dim);
    margin-top: 2px;
}
.player-slot.empty {
    color: var(--text-dim);
    font-size: 13px;
}

/* ===== 游戏面板 ===== */
.game-table {
    position: relative;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

/* 其他玩家区域 */
.other-players-area {
    padding: 10px 0;
}
.other-player {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 12px 16px;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    transition: all 0.3s;
}
.other-player.current-turn {
    border-color: var(--accent);
    box-shadow: 0 0 12px rgba(232,184,75,0.2);
    animation: pulse 1.5s infinite;
}
@keyframes pulse {
    0%, 100% { box-shadow: 0 0 8px rgba(232,184,75,0.15); }
    50% { box-shadow: 0 0 20px rgba(232,184,75,0.3); }
}
.other-player.winner {
    border-color: var(--green);
    background: rgba(39,174,96,0.1);
}
.other-player .p-name {
    font-weight: 600;
    font-size: 15px;
}
.other-player .p-info {
    display: flex;
    align-items: center;
    gap: 12px;
}
.other-player .card-count {
    background: var(--accent);
    color: #1a1a1a;
    border-radius: 50%;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 13px;
}
.other-player .status-tag {
    font-size: 12px;
    padding: 3px 8px;
    border-radius: 6px;
}
.other-player .status-tag.passed {
    background: rgba(241,196,15,0.15);
    color: #f1c40f;
}

/* 桌面出牌区 */
.table-center {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}
.last-play-area {
    text-align: center;
}
.last-play-area .label {
    font-size: 12px;
    color: var(--text-dim);
    margin-bottom: 8px;
}
.last-play-area .cards-row {
    display: flex;
    gap: 6px;
    justify-content: center;
}
.last-play-area .empty-hint {
    color: var(--text-dim);
    font-size: 14px;
    padding: 20px;
}

/* ===== 牌面样式 ===== */
.card {
    width: 56px;
    height: 80px;
    border-radius: 6px;
    background: linear-gradient(145deg, #f5f5f5 0%, #e8e8e8 100%);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    position: relative;
    transition: transform 0.2s, box-shadow 0.2s;
    user-select: none;
    flex-shrink: 0;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}
.card:hover {
    transform: translateY(-4px);
    box-shadow: 0 6px 16px rgba(0,0,0,0.3);
}
.card.selected {
    transform: translateY(-12px);
    box-shadow: 0 8px 24px rgba(232,184,75,0.3);
    border: 2px solid var(--accent);
}
.card .rank {
    font-size: 18px;
    font-weight: 700;
    color: #1a1a1a;
}
.card .suit {
    font-size: 14px;
}
.card.red, .card .suit.red { color: #d63031; }
.card .suit.red { color: #d63031; }
.card.black, .card .suit.black { color: #1a1a1a; }
.card.joker {
    background: linear-gradient(145deg, #fff5e6 0%, #ffe0b2 100%);
}
.card.joker .rank {
    font-size: 12px;
    color: #e67e22;
}
.card.joker-small {
    border: 1px solid #82ccdd;
}
.card.joker-big {
    border: 1px solid #e55039;
}

.card-disabled {
    opacity: 0.5;
    pointer-events: none;
    filter: grayscale(30%);
}

/* 手牌区域 */
.my-hand-area {
    padding: 16px 0 20px;
    position: relative;
}
.my-hand-area .current-indicator {
    text-align: center;
    font-size: 14px;
    color: var(--accent);
    margin-bottom: 8px;
    font-weight: 600;
}
.my-hand-area .cards-row {
    display: flex;
    gap: 4px;
    justify-content: center;
    flex-wrap: wrap;
    padding: 4px 0;
}
.my-hand-area .cards-row .card {
    margin-left: -10px;
}
.my-hand-area .cards-row .card:first-child {
    margin-left: 0;
}
.action-buttons {
    display: flex;
    gap: 10px;
    justify-content: center;
    margin-top: 12px;
}

/* 桌面剩余牌堆 */
.deck-info {
    position: absolute;
    top: 10px;
    right: 16px;
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 8px 14px;
    font-size: 13px;
    color: var(--text-dim);
}
.deck-info span {
    color: var(--accent);
    font-weight: 600;
}

/* 游戏结束弹窗 */
.game-over-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
    animation: fadeIn 0.3s ease;
}
.game-over-box {
    background: var(--card-bg);
    border: 1px solid var(--accent);
    border-radius: 20px;
    padding: 36px 28px;
    text-align: center;
    max-width: 360px;
    width: 90%;
}
.game-over-box h2 {
    font-size: 28px;
    margin-bottom: 20px;
    color: var(--accent);
}
.game-over-box .result-item {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    border-bottom: 1px solid var(--border);
    font-size: 14px;
}
.game-over-box .result-item:last-child {
    font-weight: 700;
    font-size: 16px;
    color: var(--accent);
    border-bottom: none;
}

/* Toast 提示 */
.toast {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--card-bg);
    border: 1px solid var(--accent);
    padding: 10px 24px;
    border-radius: 10px;
    font-size: 14px;
    z-index: 200;
    animation: toastIn 0.3s ease;
}
@keyframes toastIn {
    from { opacity: 0; transform: translateX(-50%) translateY(-20px); }
    to { opacity: 1; transform: translateX(-50%) translateY(0); }
}

/* 响应式 */
@media (max-width: 380px) {
    .card { width: 46px; height: 66px; }
    .card .rank { font-size: 15px; }
    .card .suit { font-size: 11px; }
    .my-hand-area .cards-row .card { margin-left: -14px; }
}
