/* ═══════════════════════════════════════════════════════════════
   ClapClap 2.0 房间列表页样式
   ═══════════════════════════════════════════════════════════════ */

:root {
    --bg: #f0f2f5;
    --card: #fff;
    --panel: #f8fafc;
    --text: #1f2937;
    --muted: #6b7280;
    --border: #e5e7eb;
    --blue: #2563eb;
    --blue-bg: #eff6ff;
    --danger: #dc2626;
}

body {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
}

.container {
    max-width: 820px;
    margin: 0 auto;
    padding: 28px 16px;
}

/* ── 顶部 ── */
.top-bar {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 24px;
    flex-wrap: wrap;
    gap: 8px;
}

.top-bar h1 {
    margin: 0;
    font-size: 26px;
    font-weight: 800;
    letter-spacing: -0.5px;
}

.subtitle {
    color: var(--muted);
    font-size: 13px;
    margin-top: 2px;
}

.top-actions { display: flex; gap: 6px; }

.btn-ghost {
    border: 1px solid var(--border);
    background: var(--card);
    border-radius: 10px;
    padding: 8px 14px;
    font-size: 13px;
    cursor: pointer;
    color: var(--text);
    text-decoration: none;
    font-weight: 500;
    transition: background 0.15s;
}

.btn-ghost:hover { background: var(--panel); }

/* ── 入口卡片 ── */
.entry-cards {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-bottom: 20px;
}

.entry-card {
    width: 100%;
    font: inherit;
    color: inherit;
    background: var(--card);
    border-radius: 16px;
    padding: 28px 24px;
    text-align: center;
    cursor: pointer;
    border: 2px solid transparent;
    box-shadow: 0 2px 8px rgba(0,0,0,0.04);
    transition: border-color 0.2s, box-shadow 0.2s, transform 0.15s;
}

.entry-card:focus-visible {
    outline: 3px solid rgba(37, 99, 235, 0.28);
    outline-offset: 3px;
}

.entry-card:hover {
    border-color: var(--blue);
    box-shadow: 0 4px 16px rgba(37,99,235,0.08);
    transform: translateY(-1px);
}

.entry-card.active {
    border-color: var(--blue);
    background: var(--blue-bg);
}

.entry-icon { font-size: 36px; margin-bottom: 10px; }
.entry-title { font-size: 18px; font-weight: 700; margin-bottom: 4px; }
.entry-desc { font-size: 13px; color: var(--muted); }

/* ── 面板 ── */
.panel {
    background: var(--card);
    border-radius: 16px;
    padding: 20px 24px;
    margin-bottom: 16px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.04);
    border: 1px solid var(--border);
    animation: panelIn 0.2s ease;
}

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

.panel h2 {
    margin: 0 0 16px 0;
    font-size: 18px;
}

/* ── 表单 ── */
.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
    margin-bottom: 12px;
}

.form-group { min-width: 0; }

.form-group label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: var(--muted);
    margin-bottom: 4px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.stepper {
    display: flex;
    align-items: center;
    gap: 8px;
}

.stepper button {
    width: 32px; height: 32px;
    border: 1px solid var(--border);
    background: var(--card);
    border-radius: 8px;
    font-size: 16px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s;
}

.stepper button:hover { background: var(--panel); }
.stepper span { font-size: 20px; font-weight: 700; min-width: 28px; text-align: center; }

select, input[type="text"] {
    width: 100%;
    padding: 8px 10px;
    border-radius: 8px;
    border: 1px solid var(--border);
    font-size: 14px;
    background: var(--card);
    box-sizing: border-box;
}

select:focus, input:focus {
    outline: none;
    border-color: var(--blue);
    box-shadow: 0 0 0 3px rgba(37,99,235,0.1);
}

.checkbox-label {
    display: flex !important;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    font-size: 13px !important;
    color: var(--text) !important;
    text-transform: none !important;
    font-weight: 400 !important;
}

.checkbox-label input { width: auto; }

/* ── 按钮 ── */
.btn-primary {
    border: none;
    border-radius: 10px;
    padding: 9px 18px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    background: var(--blue);
    color: #fff;
    transition: background 0.15s;
}

.btn-primary:hover { background: #1d4ed8; }
.btn-primary:disabled { opacity: 0.45; cursor: not-allowed; }

.btn-secondary {
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 9px 18px;
    font-size: 14px;
    cursor: pointer;
    background: var(--card);
    color: var(--text);
    font-weight: 500;
    transition: background 0.15s;
}

.btn-secondary:hover { background: var(--panel); }

.panel-actions {
    display: flex;
    gap: 8px;
    margin-top: 14px;
}

/* ── 加入行 ── */
.join-code-row {
    display: flex;
    gap: 8px;
    margin-bottom: 12px;
}

.join-code-row input {
    flex: 1;
    font-size: 16px;
    padding: 10px 14px;
    font-family: monospace;
    letter-spacing: 2px;
    text-transform: uppercase;
}

.section-divider {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 20px 0 12px;
    color: var(--muted);
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.section-divider::before,
.section-divider::after {
    content: "";
    flex: 1;
    height: 1px;
    background: var(--border);
}

/* ── 房间表格 ── */
.room-table-wrap {
    overflow-x: auto;
}

.room-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.room-table th {
    text-align: left;
    padding: 8px 10px;
    background: var(--panel);
    font-weight: 600;
    color: var(--muted);
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    border-bottom: 2px solid var(--border);
}

.room-table td {
    padding: 10px 10px;
    border-bottom: 1px solid var(--border);
}

.room-table tr:hover td { background: #f9fafb; }

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

.room-table .room-code {
    font-family: monospace;
    font-weight: 700;
    font-size: 14px;
    letter-spacing: 1px;
    color: var(--blue);
}

.status-badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 600;
}

.status-badge.lobby   { background: #ecfdf5; color: #166534; }
.status-badge.playing { background: #fffbeb; color: #92400e; }
.status-badge.finished { background: #f3f4f6; color: #6b7280; }

.people-count {
    font-weight: 600;
    font-size: 13px;
}

.btn-small {
    padding: 4px 12px;
    font-size: 12px;
    border-radius: 8px;
    border: none;
    cursor: pointer;
    font-weight: 600;
}

.btn-small.join { background: var(--blue); color: #fff; }
.btn-small.join:hover { background: #1d4ed8; }
.btn-small.full { background: #f3f4f6; color: #9ca3af; cursor: not-allowed; }
.btn-small.playing { background: #fef3c7; color: #92400e; cursor: not-allowed; }
.btn-small.spectate { background: #7c3aed; color: #fff; margin-left: 4px; }
.btn-small.spectate:hover { background: #6d28d9; }
.btn-small.nospectate { background: #f3f4f6; color: #6b7280; cursor: not-allowed; }

/* ── 筛选栏 ── */
.filter-bar {
    display: flex;
    gap: 8px;
    margin-bottom: 12px;
}
.filter-select {
    padding: 6px 10px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 13px;
    background: var(--card);
    color: var(--text);
    cursor: pointer;
}
.filter-select:focus {
    outline: none;
    border-color: var(--blue);
}

/* ── 观战数列 ── */
.spec-count {
    font-size: 12px;
    color: var(--muted);
}

/* ── 消息 ── */
.message {
    margin-top: 10px;
    min-height: 20px;
    padding: 10px 14px;
    border-radius: 10px;
    font-size: 13px;
    display: none;
}

.message:not(:empty) { display: block; }
.message.info    { background: #eff6ff; color: #1d4ed8; }
.message.success { background: #ecfdf5; color: #166534; }
.message.waiting { background: #fffbeb; color: #92400e; }
.message.error   { background: #fef2f2; color: #991b1b; }

.error-box {
    background: #fee2e2;
    color: #991b1b;
    padding: 14px 16px;
    border-radius: 12px;
    margin-bottom: 16px;
    font-size: 14px;
    font-weight: 500;
}

/* ── 响应式 ── */
@media (max-width: 640px) {
    .entry-cards { grid-template-columns: 1fr; }
    .form-row { grid-template-columns: 1fr; }
}
