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

body {
    font-family: "Microsoft YaHei", sans-serif;
    background: linear-gradient(160deg, #90f397, #779978 55%, #1b5e20);
    min-height: 100vh;
    color: #fff;
}

/* ---------- 页面背景图 ---------- */
.bg-login, .bg-main {
    background-color: #a5d6a7;
}
.bg-register {
    background: #1b5e20 url("../img/register_bg.jpg") center / cover no-repeat fixed;
}

#app { max-width: 1100px; margin: 0 auto; padding: 12px; }

header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 8px 4px;
}
header h1 { font-size: 22px; letter-spacing: 2px; }
/* 在线人数(大厅标题旁) */
.online-count {
    font-size: 13px; font-weight: normal; letter-spacing: 0;
    color: #ffe082; background: rgba(0,0,0,.25);
    border-radius: 10px; padding: 2px 10px; margin-left: 6px;
    vertical-align: 3px;
}
.title-tag { height: 28px; vertical-align: -6px; margin-right: 8px; border-radius: 4px; }

/* ---------- 头像 ---------- */
.avatar-thumb {
    width: 32px; height: 32px; border-radius: 50%; object-fit: cover;
    border: 2px solid #f9a825; background: #fff;
}
/* 对局座位头像: 固定宽高, 任意上传尺寸均裁剪为圆形 */
.seat-avatar {
    display: block; width: 48px; height: 48px; border-radius: 50%;
    object-fit: cover; border: 2px solid #f9a825; background: #fff;
}
.crown { position: absolute; top: -10px; left: -6px; font-size: 18px; }.username-link {
    cursor: pointer; padding: 2px 6px; border-radius: 4px;
    transition: background .15s;
}
.username-link:hover { background: rgba(255,255,255,.18); text-decoration: underline; }
.user-box { display: flex; align-items: center; gap: 10px; }

/* ---------- 通用按钮 ---------- */
.btn {
    background: #f9a825; color: #4e342e; border: none; border-radius: 6px;
    padding: 10px 22px; font-size: 16px; font-weight: bold; cursor: pointer;
    transition: transform .1s, box-shadow .1s;
}
.btn:hover { transform: translateY(-2px); box-shadow: 0 4px 10px rgba(0,0,0,.3); }
.btn:disabled { background: #9e9e9e; cursor: not-allowed; transform: none; }
.btn.small { padding: 6px 14px; font-size: 14px; }
.btn.big { padding: 16px 46px; font-size: 20px; }
.btn.ghost { background: #fff3e0; }
.hidden { display: none !important; }

/* ---------- 登录/注册 ---------- */
.auth-body {
    display: flex; align-items: center; justify-content: center; min-height: 100vh;
}
.auth-card {
    background: rgba(0,0,0,.3); border-radius: 16px; padding: 36px 40px;
    width: 360px; text-align: center; box-shadow: 0 10px 30px rgba(0,0,0,.4);
}
.auth-card h1 { margin-bottom: 18px; font-size: 24px; }
.auth-card input {
    width: 100%; padding: 12px; margin: 8px 0; border-radius: 8px;
    border: 2px solid #a5d6a7; background: #fff; font-size: 15px; outline: none;
}
.auth-card input:focus { border-color: #f9a825; }
.auth-card .btn.wide { width: 100%; margin-top: 10px; }
.auth-msg { color: #ffcc80; min-height: 20px; font-size: 14px; }
.auth-links { margin-top: 16px; font-size: 14px; }
.auth-links a { color: #ffe082; }

/* ---------- 大厅 ---------- */
.lobby { text-align: center; padding-top: 30px; }
.stats { display: flex; justify-content: center; gap: 60px; margin: 26px 0; }
.stat { background: rgba(0,0,0,.25); border-radius: 14px; padding: 18px 42px; }
.stat .num { display: block; font-size: 34px; font-weight: bold; color: #ffe082; }
.stat .num.score { color: #ff8a80; }
.match-tip { margin-top: 18px; font-size: 16px; color: #ffe082; }
.dots::after { content: ''; animation: dots 1.5s steps(4) infinite; }
@keyframes dots { 0% { content: ''; } 25% { content: '.'; } 50% { content: '..'; } 75% { content: '...'; } }
#match-box { margin: 30px 0; }
#btn-cancel { margin-top: 14px; }
.rules {
    margin: 30px auto 0; max-width: 480px; text-align: left;
    background: rgba(0,0,0,.2); border-radius: 12px; padding: 18px 26px;
}
.rules h3 { margin-bottom: 10px; color: #ffe082; }
.rules ul { padding-left: 20px; line-height: 1.9; font-size: 14px; }

/* ---------- 对局 ---------- */
.seats { display: flex; justify-content: space-between; padding: 10px 30px; }
.seat {
    display: flex; align-items: center; gap: 10px;
    background: rgba(0,0,0,.25); border-radius: 12px; padding: 10px 16px;
    min-width: 170px;
}
.seat.active { outline: 3px solid #f9a825; }
.avatar { font-size: 34px; position: relative; }
.seat .name { font-weight: bold; }
.seat .count { font-size: 13px; opacity: .9; }
.role-tag {
    display: inline-block; margin-top: 3px; font-size: 12px;
    background: #c62828; border-radius: 4px; padding: 1px 8px;
}
.role-tag.farmer { background: #1565c0; }

.bottom-bar {
    display: flex; align-items: center; justify-content: center; gap: 10px;
    margin: 6px 0; min-height: 40px;
}
.bottom-label {
    font-size: 14px; font-weight: bold; color: #ffe082;
    background: rgba(0,0,0,.3); border-radius: 6px; padding: 3px 10px;
}
.bottom-cards { display: flex; }
.card.back {
    background: repeating-linear-gradient(45deg, #1565c0, #1565c0 6px, #0d47a1 6px, #0d47a1 12px);
    border-color: #90caf9;
}

.table {
    min-height: 150px; display: flex; align-items: center; justify-content: center;
    background: rgba(0,0,0,.18); border-radius: 14px; margin: 4px 0 10px;
    padding: 14px;
}
#last-play { display: flex; gap: 6px; flex-wrap: wrap; justify-content: center; }
.play-label { width: 100%; text-align: center; font-size: 13px; color: #ffe082; margin-bottom: 4px; }

.timer { text-align: center; margin-bottom: 4px; }
.timer-num {
    display: inline-block; min-width: 46px; font-size: 22px; font-weight: bold;
    color: #ffe082; background: rgba(0,0,0,.3); border-radius: 50%;
    padding: 6px 10px;
}
.timer-num.urgent { color: #ff5252; }
.timer-bar {
    width: 300px; height: 8px; background: rgba(0,0,0,.3);
    border-radius: 4px; margin: 6px auto 0; overflow: hidden;
}
#timer-fill {
    height: 100%; width: 100%; background: #f9a825; border-radius: 4px;
    transition: width .3s linear;
}

.message { text-align: center; min-height: 26px; font-size: 15px; color: #ffcc80; margin-bottom: 6px; }
.actions {
    display: flex; justify-content: center; gap: 12px; min-height: 48px;
    align-items: center; margin-bottom: 8px;
}
.my-info { text-align: center; margin: 4px 0; font-size: 14px; color: #ffe082; }

.my-hand {
    display: flex; justify-content: center; align-items: flex-end;
    flex-wrap: wrap; min-height: 130px; padding-bottom: 10px;
}

.card {
    width: 72px; height: 100px; border-radius: 8px;
    background: #fff; color: #212121;
    border: 2px solid #ccc; margin-left: -22px;
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    font-size: 22px; font-weight: bold; cursor: pointer;
    transition: transform .12s;
    box-shadow: 0 2px 6px rgba(0,0,0,.35);
}
.card:first-child { margin-left: 0; }
.card .suit { font-size: 18px; }
.card.red { color: #c62828; }
.card.joker { font-size: 18px; letter-spacing: 1px; }
.card.selected { transform: translateY(-24px); border-color: #f9a825; }
.card.small { width: 54px; height: 76px; font-size: 16px; margin-left: -16px; }
.card.small .suit { font-size: 14px; }
.card.small.joker { font-size: 13px; }
