/* 棋牌游戏平台 · 移动优先 */
:root {
    --bg: #0f172a;
    --panel: #1e293b;
    --panel2: #273549;
    --line: #334155;
    --text: #e2e8f0;
    --dim: #94a3b8;
    --gold: #fbbf24;
    --green: #10b981;
    --red: #ef4444;
    --blue: #3b82f6;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

body {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
    background: linear-gradient(160deg, #0b1220 0%, #101c33 60%, #0d1626 100%);
    color: var(--text);
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
}

a { color: var(--gold); text-decoration: none; }

/* ---------------- 顶栏 */
.topbar {
    position: sticky; top: 0; z-index: 50;
    display: flex; align-items: center; justify-content: space-between;
    padding: 12px 14px;
    background: rgba(15, 23, 42, .92);
    backdrop-filter: blur(8px);
    border-bottom: 1px solid var(--line);
}
.topbar .logo { font-size: 17px; font-weight: 700; letter-spacing: .5px; }
.topbar .logo span { color: var(--gold); }
.topbar .right { display: flex; align-items: center; gap: 10px; font-size: 13px; }
.topbar .coins { color: var(--gold); font-weight: 700; }
.topbar .who { color: var(--dim); }

/* ---------------- 容器 */
.wrap { padding: 14px; max-width: 980px; margin: 0 auto; }

/* ---------------- 卡片 */
.card {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 14px;
    padding: 14px;
    margin-bottom: 12px;
}
.card h3 { margin: 0 0 10px; font-size: 15px; font-weight: 600; }

/* ---------------- 表单 */
.form-row { margin-bottom: 12px; }
.form-row label { display: block; font-size: 13px; color: var(--dim); margin-bottom: 6px; }
.input {
    width: 100%; padding: 12px 14px;
    background: var(--panel2); border: 1px solid var(--line);
    border-radius: 10px; color: var(--text); font-size: 15px;
    outline: none;
}
.input:focus { border-color: var(--blue); }

.btn {
    display: inline-flex; align-items: center; justify-content: center;
    padding: 12px 18px; border-radius: 10px; border: 1px solid var(--line);
    background: var(--panel2); color: var(--text);
    font-size: 15px; font-weight: 600; cursor: pointer;
    transition: .15s;
}
.btn:active { transform: scale(.97); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn-block { width: 100%; }
.btn-gold { background: linear-gradient(135deg, #f59e0b, #fbbf24); border: none; color: #1f1300; }
.btn-green { background: linear-gradient(135deg, #059669, #10b981); border: none; color: #04140e; }
.btn-red { background: linear-gradient(135deg, #dc2626, #ef4444); border: none; color: #fff; }
.btn-blue { background: linear-gradient(135deg, #2563eb, #3b82f6); border: none; color: #fff; }
.btn-sm { padding: 8px 12px; font-size: 13px; }

/* ---------------- 登录页 */
.login-wrap {
    min-height: 100vh; display: flex; flex-direction: column;
    align-items: center; justify-content: center; padding: 24px;
}
.login-logo {
    font-size: 40px; margin-bottom: 8px;
    filter: drop-shadow(0 4px 14px rgba(251,191,36,.35));
}
.login-title { font-size: 22px; font-weight: 700; margin-bottom: 4px; }
.login-sub { color: var(--dim); font-size: 13px; margin-bottom: 26px; }
.login-card {
    width: 100%; max-width: 360px; background: var(--panel);
    border: 1px solid var(--line); border-radius: 18px; padding: 22px;
    box-shadow: 0 20px 50px rgba(0,0,0,.45);
}

/* ---------------- 游戏大厅 */
.game-grid { display: grid; grid-template-columns: 1fr; gap: 12px; }
.game-card {
    display: flex; align-items: center; gap: 14px;
    background: linear-gradient(135deg, #1e293b, #243449);
    border: 1px solid var(--line); border-radius: 16px;
    padding: 16px; cursor: pointer; transition: .18s;
}
.game-card:active { transform: scale(.985); }
.game-icon {
    width: 54px; height: 54px; border-radius: 14px;
    display: flex; align-items: center; justify-content: center;
    font-size: 28px; flex: 0 0 54px;
    background: rgba(251,191,36,.12);
}
.game-info { flex: 1; min-width: 0; }
.game-info .n { font-size: 16px; font-weight: 700; margin-bottom: 3px; }
.game-info .d { font-size: 12px; color: var(--dim); }
.game-arrow { color: var(--dim); font-size: 20px; }

/* ---------------- 牌桌 */
.table-area {
    background: radial-gradient(ellipse at center, #1a4d3a 0%, #0f3325 70%, #0a2419 100%);
    border: 2px solid #2d6f52; border-radius: 20px;
    padding: 16px; margin-bottom: 12px;
    min-height: 300px; position: relative;
}
.seat-row { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; }
.seat {
    flex: 1 1 46%; min-width: 130px;
    background: rgba(0,0,0,.32); border: 1px solid rgba(255,255,255,.12);
    border-radius: 12px; padding: 10px;
}
.seat.me { border-color: var(--gold); background: rgba(251,191,36,.12); }
.seat.turn { border-color: var(--green); box-shadow: 0 0 0 2px rgba(16,185,129,.35); }
.seat .pname { font-size: 13px; font-weight: 600; margin-bottom: 4px; }
.seat .pmeta { font-size: 11px; color: var(--dim); }
.seat .pcards { display: flex; gap: 3px; margin-top: 6px; flex-wrap: wrap; }

/* ---------------- 牌 */
.pcard {
    display: inline-flex; align-items: center; justify-content: center;
    min-width: 30px; height: 42px; padding: 0 4px;
    background: #fff; color: #1a1a1a; border-radius: 5px;
    font-size: 15px; font-weight: 700;
    box-shadow: 0 2px 4px rgba(0,0,0,.3);
}
.pcard.back {
    background: linear-gradient(135deg, #1e40af, #1e3a8a);
    color: transparent; min-width: 26px;
}
.pcard.red { color: #dc2626; }
.pcard.small { min-width: 24px; height: 34px; font-size: 13px; }

/* ---------------- 操作区 */
.actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.actions .btn { flex: 1 1 30%; }

/* ---------------- 提示 */
.toast {
    position: fixed; left: 50%; bottom: 90px; transform: translateX(-50%);
    background: rgba(0,0,0,.85); color: #fff; padding: 10px 18px;
    border-radius: 20px; font-size: 14px; z-index: 999;
    opacity: 0; transition: .25s; pointer-events: none; max-width: 90%;
}
.toast.show { opacity: 1; }
.toast.err { background: rgba(220,38,38,.92); }
.toast.ok { background: rgba(5,150,105,.92); }

/* ---------------- 日志 */
.log-box {
    max-height: 120px; overflow-y: auto;
    font-size: 12px; color: var(--dim); line-height: 1.8;
}
.log-box div { border-bottom: 1px dashed rgba(255,255,255,.06); padding: 2px 0; }

/* ---------------- 后台表格 */
.table-wrap { overflow-x: auto; }
table.tb { width: 100%; border-collapse: collapse; font-size: 13px; }
table.tb th, table.tb td {
    padding: 8px 10px; text-align: left;
    border-bottom: 1px solid var(--line); white-space: nowrap;
}
table.tb th { color: var(--dim); font-weight: 500; font-size: 12px; }

.badge {
    display: inline-block; padding: 2px 8px; border-radius: 20px;
    font-size: 11px; font-weight: 600;
}
.badge.gold { background: rgba(251,191,36,.18); color: var(--gold); }
.badge.green { background: rgba(16,185,129,.18); color: var(--green); }
.badge.red { background: rgba(239,68,68,.18); color: var(--red); }
.badge.gray { background: rgba(148,163,184,.18); color: var(--dim); }

.tabs { display: flex; gap: 8px; margin-bottom: 12px; }
.tabs a {
    flex: 1; text-align: center; padding: 9px; border-radius: 10px;
    background: var(--panel2); color: var(--dim); font-size: 14px;
}
.tabs a.on { background: var(--gold); color: #1f1300; font-weight: 700; }

.empty { text-align: center; color: var(--dim); padding: 30px; font-size: 14px; }

.err-box {
    background: rgba(239,68,68,.15); border: 1px solid rgba(239,68,68,.35);
    color: #fca5a5; padding: 10px 12px; border-radius: 10px;
    font-size: 13px; margin-bottom: 12px;
}
