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

body {
    font-family: 'Microsoft YaHei', 'PingFang SC', sans-serif;
    background-color: #f0f2f5;
    color: #333;
    line-height: 1.6;
}

.navbar {
    background: linear-gradient(135deg, #1890ff 0%, #096dd9 100%);
    color: white;
    padding: 15px 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.nav-brand {
    font-size: 20px;
    font-weight: bold;
}

.nav-links a {
    color: white;
    text-decoration: none;
    margin-left: 20px;
    padding: 8px 16px;
    border-radius: 4px;
    transition: background-color 0.3s;
}

.nav-links a:hover {
    background-color: rgba(255, 255, 255, 0.2);
}

.container {
    max-width: 1200px;
    margin: 30px auto;
    padding: 0 20px;
}

.welcome {
    text-align: center;
    padding: 60px 20px;
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.welcome h1 {
    font-size: 36px;
    margin-bottom: 20px;
    color: #1890ff;
}

.welcome p {
    font-size: 18px;
    color: #666;
    margin-bottom: 30px;
}

.entry-links {
    display: flex;
    justify-content: center;
    gap: 20px;
}

.btn {
    display: inline-block;
    padding: 10px 24px;
    border: none;
    border-radius: 4px;
    font-size: 14px;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.3s;
}

.btn-primary {
    background-color: #1890ff;
    color: white;
}

.btn-primary:hover {
    background-color: #40a9ff;
}

.btn-success {
    background-color: #52c41a;
    color: white;
}

.btn-success:hover {
    background-color: #73d13d;
}

.btn-warning {
    background-color: #faad14;
    color: white;
}

.btn-warning:hover {
    background-color: #ffc53d;
}

.btn-danger {
    background-color: #f5222d;
    color: white;
}

.btn-danger:hover {
    background-color: #ff4d4f;
}

.btn-lg {
    padding: 14px 32px;
    font-size: 16px;
}

.btn-sm {
    padding: 6px 12px;
    font-size: 12px;
}

.dashboard {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
    margin-top: 30px;
}

.card {
    background: white;
    padding: 30px;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    text-align: center;
}

.card h3 {
    margin-bottom: 15px;
    color: #1890ff;
}

.card p {
    color: #666;
    margin-bottom: 20px;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
}

.form-group input,
.form-group select {
    width: 100%;
    padding: 10px;
    border: 1px solid #d9d9d9;
    border-radius: 4px;
    font-size: 14px;
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: #1890ff;
    box-shadow: 0 0 0 2px rgba(24, 144, 255, 0.2);
}

.table {
    width: 100%;
    background: white;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    border-collapse: collapse;
}

.table th,
.table td {
    padding: 12px 16px;
    text-align: left;
    border-bottom: 1px solid #f0f0f0;
}

.table th {
    background-color: #fafafa;
    font-weight: 600;
    color: #333;
}

.table tr:hover {
    background-color: #fafafa;
}

.status-active {
    color: #52c41a;
    font-weight: 500;
}

.status-eliminated {
    color: #f5222d;
    font-weight: 500;
}

.status-offline {
    color: #8c8c8c;
    font-weight: 500;
    background-color: #f5f5f5;
}

.status-pending {
    color: #faad14;
    font-weight: 500;
}

.status-ongoing {
    color: #1890ff;
    font-weight: 500;
}

.status-finished {
    color: #8c8c8c;
    font-weight: 500;
}

.result-message {
    margin-top: 20px;
    padding: 15px;
    border-radius: 4px;
}

.result-message .success {
    background-color: #f6ffed;
    border: 1px solid #b7eb8f;
    color: #52c41a;
}

.result-message .error {
    background-color: #fff2f0;
    border: 1px solid #ffccc7;
    color: #f5222d;
}

.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 15px;
    margin-top: 20px;
}

.player-badge {
    display: inline-block;
    padding: 4px 8px;
    margin: 2px;
    border-radius: 4px;
    font-size: 12px;
    background-color: #f0f0f0;
}

.player-badge.player-active {
    background-color: #f6ffed;
    color: #52c41a;
}

.player-badge.player-eliminated {
    background-color: #fff2f0;
    color: #f5222d;
}

.footer {
    text-align: center;
    padding: 30px;
    color: #8c8c8c;
    margin-top: 50px;
}

.import-section,
.add-team-section,
.create-match-section {
    background: white;
    padding: 30px;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    margin-bottom: 30px;
}

.questions-list,
.teams-list,
.matches-list {
    background: white;
    padding: 30px;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.players-section {
    margin-top: 20px;
    padding: 20px;
    background-color: #fafafa;
    border-radius: 4px;
}

.players-section h3 {
    margin-bottom: 15px;
    color: #666;
}

/* ===== 公网主页 & 主机端 手机端布局（body.layout-mobile 作用域，自动检测，不改动原桌面样式） ===== */
/* 自动检测逻辑见各页面底部 <script>：窗口宽度 ≤768px 或触屏设备（pointer:coarse）即启用，实时随窗口变化 */

/* 顶部导航：手机端纵向堆叠、收紧内边距 */
body.layout-mobile .navbar {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
    padding: 12px 16px;
}
body.layout-mobile .nav-links {
    width: 100%;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}
body.layout-mobile .nav-links a {
    margin-left: 0;
}

/* 容器与欢迎区：收紧边距 */
body.layout-mobile .container {
    margin: 16px auto;
    padding: 0 12px;
}
body.layout-mobile .welcome {
    padding: 32px 16px;
}
body.layout-mobile .welcome h1 {
    font-size: 26px;
}
body.layout-mobile .welcome p {
    font-size: 15px;
}

/* 入口按钮：手机端纵向堆叠、整行铺满，确保三种颜色背景完整可见（修复窄屏橙色按钮背景被裁切） */
body.layout-mobile .entry-links {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
    padding: 0 4px;
}
body.layout-mobile .entry-links .btn {
    display: block;
    width: 100%;
    box-sizing: border-box;
    font-size: 16px;
    padding: 14px 20px;
    text-align: center;
}

/* 页脚：手机端字号收紧 */
body.layout-mobile .footer {
    padding: 16px 12px;
    font-size: 12px;
}

/* ════════════════════════════════════════════════════════════════
   建赛表单布局工具类（比赛配置页）
   ════════════════════════════════════════════════════════════════ */

/* 两列并排：两个字段各占一半；只有一个可见时自动占满整行
   （竞赛模式 / 晋级队伍数量按模式各自显隐，必须支持「单字段占满」）。
   窄屏改为堆叠，避免两个窄下拉挤在一行。 */
.form-row-2 {
    display: flex;
    flex-wrap: wrap;
    gap: 0 16px;
    align-items: flex-start;
}

.form-row-2 > .form-group {
    flex: 1 1 220px;
    min-width: 0;   /* 防止长文本把 flex item 撑破 */
}

@media (max-width: 640px) {
    .form-row-2 {
        display: block;
    }
}

/* 题库板块多选：每项宽度随文本长度自适应，禁止折行。
   特异性 0,2,1 高于 .form-group label(0,1,1)，不依赖声明顺序。 */
.plate-options {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 18px;
    margin-top: 6px;
}

.plate-options > label.checkbox-label {
    display: inline-flex;
    align-items: center;
    white-space: nowrap;
    flex: 0 0 auto;
    margin-bottom: 0;
    cursor: pointer;
}

/* 大兵团战四级目录树：参赛组织 / 兵团 / 队伍 / 队员 */
.corps-tree-title-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 8px 16px;
}
.corps-tree-title-row > label { margin-bottom: 8px; }
.corps-tree-add-school { display: inline-flex; gap: 8px; align-items: center; margin-bottom: 8px; }
.corps-tree-add-school input { width: 220px; max-width: 220px; }

.corps-tree {
    margin-top: 2px;
    padding: 10px 12px;
    border: 1px solid #d9d9d9;
    border-radius: 4px;
    background: #fafafa;
}

.corps-tree-l1 { margin-bottom: 8px; }
.corps-tree-l2-list, .corps-tree-children { margin-left: 22px; }
.corps-tree-l2 { margin: 4px 0; }
.corps-tree-children .corps-tree-children { margin-left: 20px; }

.corps-tree-row {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 4px 10px;
    min-height: 28px;
}

.corps-tree-toggle {
    flex: 0 0 22px;
    width: 22px;
    height: 22px;
    padding: 0;
    line-height: 20px;
    text-align: center;
    border: 1px solid #d9d9d9;
    border-radius: 3px;
    background: #fff;
    color: #595959;
    cursor: pointer;
}

.corps-tree-level {
    flex: 0 0 auto;
    padding: 1px 6px;
    font-size: 12px;
    color: #1890ff;
    border: 1px solid #91d5ff;
    border-radius: 3px;
    background: #e6f7ff;
}

.corps-tree-name { font-weight: 500; }

/* 兵团目录的增/删/改名提示（含「参赛组织「X」已删除」）：弱化为灰色次要信息 */
.corps-tree #corpsCatalogMsg { color: #8c8c8c; }

.corps-tree-select-all {
    padding: 0 6px;
    font-size: 12px;
    line-height: 20px;
}

.corps-tree-count {
    flex: 0 0 auto;
    font-size: 12px;
    color: #389e0d;
    background: #f6ffed;
    border: 1px solid #b7eb8f;
    border-radius: 3px;
    padding: 1px 6px;
}

.corps-tree-tag {
    font-size: 12px;
    color: #8c8c8c;
    background: #f0f0f0;
    border-radius: 3px;
    padding: 1px 6px;
}

.corps-tree-actions {
    display: inline-flex;
    gap: 4px;
    margin-left: auto;
}

.corps-tree-actions .btn {
    padding: 0 8px;
    font-size: 12px;
    line-height: 22px;
}

.corps-tree-row label.checkbox-label {
    display: inline-flex;
    align-items: center;
    white-space: nowrap;
    margin-bottom: 0;
}

.corps-tree-derived { color: #595959; font-size: 13px; }

.corps-add-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    margin-top: 8px;
    margin-left: 22px;
}

.corps-add-row input {
    max-width: 280px;
    width: 100%;
}
