/* ============================================
   安全演示靶场 - 主样式
   简洁企业级风格，SVG 图标，无表情
   ============================================ */

* { margin: 0; padding: 0; box-sizing: border-box; font-family: system-ui, -apple-system, sans-serif; }

body {
    max-width: 1200px;
    margin: 20px auto;
    padding: 0 15px;
    background: #f5f7fa;
    color: #222;
    line-height: 1.6;
}

h3 {
    margin: 12px 0 8px;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 16px;
    font-weight: 600;
}

h3 svg {
    width: 18px;
    height: 18px;
    color: #2563eb;
    flex-shrink: 0;
}

/* ---------- 顶部标题栏 ---------- */
.site-header {
    background: #fff;
    border: 1px solid #dde0e6;
    border-radius: 8px;
    padding: 14px 20px;
    margin-bottom: 18px;
    box-shadow: 0 1px 3px #0000000a;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 10px;
}

.site-header .logo {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 18px;
    font-weight: 700;
    color: #1a1d23;
}

.site-header .logo svg {
    width: 22px;
    height: 22px;
    color: #2563eb;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 13px;
    color: #6b7280;
}

.badge-secure {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 3px 10px;
    background: #dcfce7;
    color: #166534;
    border: 1px solid #bbf7d0;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
}

.badge-secure svg {
    width: 13px;
    height: 13px;
}

/* ---------- 卡片 ---------- */
.card {
    background: #fff;
    border: 1px solid #dde0e6;
    border-radius: 8px;
    padding: 16px;
    margin-bottom: 18px;
    box-shadow: 0 1px 3px #0000000a;
}

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
    flex-wrap: wrap;
    gap: 8px;
}

.card-header h3 {
    margin: 0;
}

.card-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 13px;
    color: #6b7280;
}

/* ---------- 演练区 ---------- */
.challenge-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.challenge-box {
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    padding: 14px;
    background: #fafafa;
}

.challenge-box .box-title {
    display: flex;
    align-items: center;
    gap: 6px;
    font-weight: 600;
    font-size: 14px;
    margin-bottom: 12px;
}

.challenge-box .box-title svg {
    width: 16px;
    height: 16px;
    color: #6b7280;
}

.tag {
    margin-left: auto;
    padding: 1px 7px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 500;
}

.tag-sql { background: #fef3c7; color: #92400e; }
.tag-xss { background: #fee2e2; color: #991b1b; }

/* ---------- 表单 ---------- */
.form-box { margin: 10px 0; }

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

.form-group label {
    display: block;
    font-size: 13px;
    color: #4b5563;
    margin-bottom: 4px;
    font-weight: 500;
}

input[type="text"],
input[type="password"],
textarea {
    width: 100%;
    padding: 9px 12px;
    border: 1px solid #ccc;
    border-radius: 6px;
    font-size: 14px;
    font-family: inherit;
    color: #222;
    background: #fff;
    transition: border-color 0.2s;
}

input[type="text"]:focus,
input[type="password"]:focus,
textarea:focus {
    outline: none;
    border-color: #2563eb;
    box-shadow: 0 0 0 2px #dbeafe;
}

textarea {
    min-height: 90px;
    resize: vertical;
}

button {
    margin-top: 10px;
    padding: 9px 22px;
    background: #2563eb;
    color: #fff;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    font-family: inherit;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: background 0.2s;
}

button:hover { background: #1d4ed8; }

button svg {
    width: 15px;
    height: 15px;
}

.btn-sm {
    padding: 5px 12px;
    font-size: 12px;
    margin-top: 0;
}

.btn-ghost {
    background: transparent;
    color: #6b7280;
    border: 1px solid #d1d5db;
}

.btn-ghost:hover {
    background: #f3f4f6;
    color: #374151;
}

/* ---------- 消息提示 ---------- */
.msg-tip {
    padding: 10px;
    border-radius: 6px;
    margin-bottom: 15px;
    font-size: 13px;
    display: none;
}

.msg-tip.show { display: block; }

.success { background: #dcfce7; color: #166534; border: 1px solid #bbf7d0; }
.intercept { background: #fee2e2; color: #991b1b; border: 1px solid #fecdd3; }
.info { background: #dbeafe; color: #1e40af; border: 1px solid #bfdbfe; }

/* ---------- 战败榜 ---------- */
.fail-rank {
    max-height: 260px;
    overflow-y: auto;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
}

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

.rank-table th {
    text-align: left;
    padding: 8px 10px;
    background: #f3f4f6;
    color: #4b5563;
    font-weight: 600;
    font-size: 12px;
    border-bottom: 1px solid #e5e7eb;
    white-space: nowrap;
}

.rank-table td {
    padding: 8px 10px;
    border-bottom: 1px solid #eee;
}

.rank-table tbody tr:last-child td { border-bottom: none; }
.rank-table tbody tr:hover { background: #f9fafb; }

.rank-num {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    font-weight: 700;
    font-size: 12px;
}

.rank-1 { background: #fef3c7; color: #92400e; }
.rank-2 { background: #e5e7eb; color: #4b5563; }
.rank-3 { background: #fee2e2; color: #991b1b; }
.rank-default { background: #f3f4f6; color: #9ca3af; }

.col-center { text-align: center; }
.col-ip { font-family: monospace; font-size: 12px; color: #6b7280; }
.col-time { font-size: 12px; color: #9ca3af; white-space: nowrap; }

.my-rank {
    font-size: 13px;
    color: #2563eb;
    font-weight: 500;
}

.empty-row td {
    text-align: center;
    color: #9ca3af;
    padding: 24px;
}

/* ---------- 底部双栏 ---------- */
.bottom-wrap {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

@media (max-width: 768px) {
    .bottom-wrap { grid-template-columns: 1fr; }
    .challenge-grid { grid-template-columns: 1fr; }
}

.scroll-panel {
    max-height: 320px;
    overflow-y: auto;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    padding: 10px;
    background: #fafafa;
}

/* ---------- 操作日志 ---------- */
.item-row {
    padding: 8px 10px;
    border-bottom: 1px solid #eee;
    font-size: 14px;
    word-break: break-all;
}

.item-row:last-child { border: none; }

.log-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 5px;
    flex-wrap: wrap;
}

.log-type {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 1px 7px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
}

.log-type svg { width: 11px; height: 11px; }
.log-type.xss { background: #fee2e2; color: #991b1b; }
.log-type.sql { background: #fef3c7; color: #92400e; }
.log-type.normal { background: #dcfce7; color: #166534; }

.log-endpoint {
    font-family: monospace;
    font-size: 12px;
    color: #9ca3af;
}

.log-time {
    margin-left: auto;
    font-size: 12px;
    color: #9ca3af;
    white-space: nowrap;
}

.log-payload {
    font-family: monospace;
    font-size: 12px;
    color: #374151;
    background: #fff;
    padding: 6px 8px;
    border-radius: 4px;
    border-left: 3px solid #d1d5db;
    line-height: 1.5;
}

.item-row.blocked .log-payload { border-left-color: #ef4444; }
.item-row.normal-log .log-payload { border-left-color: #22c55e; }

.log-ip {
    font-size: 12px;
    color: #9ca3af;
    margin-top: 4px;
    font-family: monospace;
}

.log-stats {
    font-size: 12px;
    color: #6b7280;
    display: flex;
    gap: 12px;
}

.empty-tip {
    text-align: center;
    color: #9ca3af;
    padding: 24px;
    font-size: 13px;
}

/* ---------- 留言板 ---------- */
.message-form {
    margin-bottom: 12px;
    padding-bottom: 12px;
    border-bottom: 1px solid #e5e7eb;
}

.form-row { margin-bottom: 8px; }

.form-row-end {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.char-counter {
    font-size: 12px;
    color: #9ca3af;
    font-family: monospace;
}

.msg-item {
    padding: 10px;
    border-bottom: 1px solid #eee;
}

.msg-item:last-child { border-bottom: none; }

.msg-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 4px;
}

.msg-avatar {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: #dbeafe;
    color: #2563eb;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 12px;
    flex-shrink: 0;
}

.msg-nickname {
    font-weight: 600;
    font-size: 13px;
    color: #1f2937;
}

.msg-time {
    font-size: 12px;
    color: #9ca3af;
    margin-left: auto;
    white-space: nowrap;
}

.msg-content {
    font-size: 13px;
    color: #374151;
    line-height: 1.6;
    padding-left: 34px;
    word-break: break-word;
}

/* ---------- 底部 ---------- */
.site-footer {
    text-align: center;
    padding: 16px;
    font-size: 12px;
    color: #9ca3af;
    margin-top: 10px;
}

/* ---------- 滚动条 ---------- */
.fail-rank::-webkit-scrollbar,
.scroll-panel::-webkit-scrollbar {
    width: 5px;
}

.fail-rank::-webkit-scrollbar-thumb,
.scroll-panel::-webkit-scrollbar-thumb {
    background: #d1d5db;
    border-radius: 3px;
}

/* ---------- 图标通用 ---------- */
.fa { margin-right: 6px; }

/* ===== 公告栏 ===== */
.notice-bar {
    background: #f8fafc;
    border: 1px solid #dde0e6;
    border-radius: 8px;
    padding: 8px 18px;
    margin-bottom: 18px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}

.notice-inner {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 14px;
    flex-wrap: wrap;
    font-size: 13px;
    color: #4b5563;
}

.notice-tag {
    background: #dc3545;
    color: #fff;
    font-weight: 600;
    padding: 2px 12px;
    border-radius: 4px;
    font-size: 11px;
    letter-spacing: 0.3px;
}

.notice-tag i {
    margin-right: 4px;
    font-size: 11px;
}

.notice-text {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.notice-text strong {
    color: #1f2937;
    font-weight: 600;
}

.notice-divider {
    color: #d1d5db;
}

.notice-allow {
    color: #16a34a;
}

.notice-allow i {
    margin-right: 3px;
    font-size: 12px;
}

.notice-deny {
    color: #dc2626;
}

.notice-deny i {
    margin-right: 3px;
    font-size: 12px;
}

/* ===== 响应式 ===== */
@media (max-width: 640px) {
    .notice-bar {
        padding: 6px 12px;
    }
    .notice-inner {
        font-size: 11px;
        gap: 6px;
    }
    .notice-text {
        gap: 4px;
    }
    .notice-tag {
        font-size: 10px;
        padding: 1px 10px;
    }
    .notice-divider {
        display: none;
    }
}