/* ============ 正则可视化增强：rx-* ============ */

/* ---------- Hero ---------- */
.rx-hero {
    margin: 18px 0 26px;
    padding: 22px;
    background: linear-gradient(135deg, #f4f1ff 0%, #f0f8ff 55%, #f6fff9 100%);
    border: 1px solid #e4e6f7;
    border-radius: 18px;
}
.rx-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    flex-wrap: wrap;
    margin-bottom: 14px;
}
.rx-brand { display: flex; align-items: center; gap: 12px; min-width: 0; }
.rx-logo {
    width: 46px;
    height: 46px;
    flex: none;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    border-radius: 14px;
    background: #fff;
    box-shadow: 0 4px 14px rgba(90, 80, 200, .18);
}
.rx-title { font-size: 20px; font-weight: 800; color: #1f2b45; letter-spacing: .3px; }
.rx-tagline { font-size: 13px; color: #6b7a96; margin-top: 2px; }

/* ---------- 正则输入 ---------- */
.rx-line {
    display: flex;
    align-items: center;
    gap: 8px;
    background: #fff;
    border: 1px solid #c5d1e3;
    border-radius: 12px;
    padding: 10px 14px;
    transition: border-color .15s, box-shadow .15s;
}
.rx-line:focus-within { border-color: #2b62d9; box-shadow: 0 0 0 3px rgba(43, 98, 217, .12); }
.rx-slash { color: #8a94ab; font-size: 18px; font-family: ui-monospace, Consolas, monospace; }
.rx-pattern {
    flex: 1;
    min-width: 0;
    border: 0;
    outline: none;
    font-size: 16px;
    font-family: ui-monospace, Consolas, "Courier New", monospace;
    color: #1a2b4a;
    background: transparent;
}
.rx-flags { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-top: 10px; }
.rx-flag {
    border: 1px solid #dbe3f0;
    background: #fff;
    border-radius: 8px;
    padding: 5px 10px;
    font-size: 12.5px;
    color: #4a587a;
    cursor: pointer;
    font-family: ui-monospace, Consolas, monospace;
}
.rx-flag:hover { border-color: #2b62d9; color: #2b62d9; }
.rx-flag.active { background: #2b62d9; color: #fff; border-color: #2b62d9; font-weight: 600; }
.rx-flag-tip { color: #8a94ab; font-size: 12px; margin-left: 4px; }
.rx-line-actions { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; align-items: center; }

/* ---------- 两栏 ---------- */
.rx-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-top: 16px;
    align-items: start;
}
@media (max-width: 1024px) {
    .rx-grid { grid-template-columns: 1fr; }
}

/* ---------- 卡片 ---------- */
.rx-card {
    background: #fff;
    border: 1px solid #e3e8f1;
    border-radius: 12px;
    padding: 14px;
    margin-bottom: 14px;
}
.rx-card-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 10px;
    flex-wrap: wrap;
}
.rx-card-head b { font-size: 14px; color: #1a2b4a; }
.rx-card-info { color: #6b7a96; font-size: 12px; font-variant-numeric: tabular-nums; }
.rx-label { display: block; color: #4a587a; font-size: 13px; margin-bottom: 6px; font-weight: 500; }
.rx-note { color: #6b7a96; font-size: 12px; margin: 6px 0 0; line-height: 1.7; }

.rx-textarea {
    width: 100%;
    min-height: 180px;
    border: 1px solid #c5d1e3;
    border-radius: 10px;
    padding: 10px 12px;
    font-size: 13.5px;
    line-height: 1.8;
    color: #1a2b4a;
    font-family: ui-monospace, Consolas, "Courier New", monospace;
    resize: vertical;
    outline: none;
}
.rx-textarea:focus { border-color: #2b62d9; box-shadow: 0 0 0 3px rgba(43, 98, 217, .12); }
.rx-input {
    width: 100%;
    border: 1px solid #c5d1e3;
    border-radius: 9px;
    padding: 8px 10px;
    font-size: 13.5px;
    color: #1a2b4a;
    font-family: ui-monospace, Consolas, monospace;
    outline: none;
}
.rx-input:focus { border-color: #2b62d9; }
.rx-out {
    margin-top: 8px;
    padding: 10px 12px;
    background: #f7faff;
    border: 1px solid #e3e8f1;
    border-radius: 9px;
    font-size: 13px;
    line-height: 1.8;
    color: #1a2b4a;
    white-space: pre-wrap;
    word-break: break-all;
    font-family: ui-monospace, Consolas, monospace;
    max-height: 200px;
    overflow: auto;
}

/* ---------- Tab ---------- */
.rx-tabs { display: flex; gap: 4px; background: #eef3fc; border-radius: 10px; padding: 4px; margin-bottom: 12px; }
.rx-tab {
    flex: 1;
    border: 0;
    background: transparent;
    padding: 7px 6px;
    font-size: 13px;
    color: #4a587a;
    border-radius: 7px;
    cursor: pointer;
    font-weight: 500;
}
.rx-tab:hover { color: #1a2b4a; }
.rx-tab.active { background: #fff; color: #1a2b4a; font-weight: 600; box-shadow: 0 1px 3px rgba(0, 0, 0, .08); }

.rx-pane { min-height: 180px; max-height: 460px; overflow: auto; }
.rx-hl-text {
    font-size: 14px;
    line-height: 2;
    color: #1a2b4a;
    white-space: pre-wrap;
    word-break: break-all;
    font-family: ui-monospace, Consolas, "Courier New", monospace;
}
.rx-empty, .rx-empty-inline {
    color: #b9c6dc;
    font-size: 13px;
    text-align: center;
    padding: 24px 10px;
}
.rx-empty-inline { padding: 8px 4px; text-align: left; }
.rx-err {
    color: #c0392b;
    background: #fdf0ee;
    border: 1px solid #f3d4cd;
    border-radius: 8px;
    padding: 10px 12px;
    font-size: 13px;
    line-height: 1.7;
    word-break: break-all;
}

/* ---------- 高亮配色 ---------- */
.rx-m { border-radius: 3px; padding: 1px 0; }
.rx-m.even { background: #fff2b8; box-shadow: 0 0 0 1px #f5e08a; }
.rx-m.odd { background: #ffd9b3; box-shadow: 0 0 0 1px #f2bf85; }
.rx-m.is-flash { animation: rxFlash 1s ease; }
@keyframes rxFlash {
    0%, 100% { box-shadow: 0 0 0 1px #f2bf85; }
    30%, 70% { box-shadow: 0 0 0 3px #2b62d9; }
}
.rx-g { border-radius: 3px; padding: 0 1px; }
.rx-g.g1 { background: #d6e8ff; box-shadow: inset 0 -2px #7cb0ff; }
.rx-g.g2 { background: #d8f5e0; box-shadow: inset 0 -2px #6fcf97; }
.rx-g.g3 { background: #ffe4cc; box-shadow: inset 0 -2px #f5a623; }
.rx-g.g4 { background: #e8dcff; box-shadow: inset 0 -2px #a98bff; }
.rx-g.g5 { background: #ccf2f7; box-shadow: inset 0 -2px #56ccd6; }
.rx-g.g6 { background: #ffd9e8; box-shadow: inset 0 -2px #f77ab0; }
.rx-g.g7 { background: #fdf3c7; box-shadow: inset 0 -2px #e3c34a; }
.rx-g.g8 { background: #d9e4ff; box-shadow: inset 0 -2px #7c8cff; }
.rx-g.g9 { background: #e2e6ea; box-shadow: inset 0 -2px #98a2ad; }

/* ---------- 匹配明细 ---------- */
.rx-item {
    border: 1px solid #e3e8f1;
    border-radius: 9px;
    padding: 8px 10px;
    margin-bottom: 8px;
    cursor: pointer;
    transition: border-color .15s, background .15s;
}
.rx-item:hover { border-color: #2b62d9; background: #f7faff; }
.rx-item-head { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; }
.rx-item-head b { color: #2b62d9; font-size: 12.5px; }
.rx-pos { color: #8a94ab; font-size: 11.5px; font-variant-numeric: tabular-nums; }
.rx-item-val {
    font-size: 13px;
    color: #1a2b4a;
    word-break: break-all;
    font-family: ui-monospace, Consolas, monospace;
    line-height: 1.6;
}
.rx-item-groups { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 6px; }
.rx-pill {
    font-size: 11.5px;
    padding: 2px 7px;
    border-radius: 999px;
    color: #1a2b4a;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.rx-pill.g1 { background: #d6e8ff; }
.rx-pill.g2 { background: #d8f5e0; }
.rx-pill.g3 { background: #ffe4cc; }
.rx-pill.g4 { background: #e8dcff; }
.rx-pill.g5 { background: #ccf2f7; }
.rx-pill.g6 { background: #ffd9e8; }
.rx-pill.g7 { background: #fdf3c7; }
.rx-pill.g8 { background: #d9e4ff; }
.rx-pill.g9 { background: #e2e6ea; }
.rx-more { color: #8a94ab; font-size: 12px; text-align: center; padding: 8px; }

/* ---------- 结构树 ---------- */
.rx-tree-body { padding-left: 10px; border-left: 2px solid #e3e8f1; margin-left: 4px; }
.rx-node {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    padding: 5px 8px;
    margin-bottom: 4px;
    background: #f7faff;
    border: 1px solid #e3e8f1;
    border-radius: 7px;
    font-size: 12.5px;
}
.rx-node code {
    font-family: ui-monospace, Consolas, monospace;
    background: #fff;
    border: 1px solid #e3e8f1;
    border-radius: 4px;
    padding: 1px 5px;
    color: #1a2b4a;
}
.rx-node-desc { color: #6b7a96; }
.rx-q {
    color: #b45309;
    background: #fff7ed;
    border: 1px solid #fed7aa;
    border-radius: 4px;
    padding: 1px 6px;
    font-size: 11.5px;
}
.rx-n-group { background: #f2f7ff; border-color: #cfe0fb; }
.rx-n-alt { background: #fdf2f8; border-color: #fbcfe8; }
.rx-n-err { background: #fdf0ee; border-color: #f3d4cd; }
.rx-n-anchor, .rx-n-dot { background: #f0fdf4; border-color: #bbf7d0; }
.rx-node-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; width: 100%; }

/* ---------- 常用库 / 历史 ---------- */
.rx-lib-tools { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 10px; }
.rx-lib-search {
    flex: 1;
    min-width: 160px;
    border: 1px solid #c5d1e3;
    border-radius: 9px;
    padding: 7px 10px;
    font-size: 13px;
    outline: none;
}
.rx-lib-search:focus { border-color: #2b62d9; }
.rx-cats { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.rx-cat {
    border: 1px solid #dbe3f0;
    background: #fff;
    border-radius: 999px;
    padding: 4px 12px;
    font-size: 12.5px;
    color: #4a587a;
    cursor: pointer;
}
.rx-cat:hover { border-color: #2b62d9; color: #2b62d9; }
.rx-cat.active { background: #2b62d9; color: #fff; border-color: #2b62d9; }
.rx-lib-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
    gap: 8px;
    max-height: 380px;
    overflow-y: auto;
}
.rx-lib-item {
    text-align: left;
    border: 1px solid #e3e8f1;
    background: #fff;
    border-radius: 9px;
    padding: 8px 10px;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    gap: 3px;
    transition: border-color .15s, background .15s;
}
.rx-lib-item:hover { border-color: #2b62d9; background: #f7faff; }
.rx-lib-item b { font-size: 13px; color: #1a2b4a; }
.rx-lib-item code {
    font-size: 11.5px;
    color: #2b62d9;
    font-family: ui-monospace, Consolas, monospace;
    word-break: break-all;
}
.rx-lib-item span { font-size: 11.5px; color: #8a94ab; }

.rx-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.rx-chip {
    border: 1px solid #dbe3f0;
    background: #fff;
    border-radius: 8px;
    padding: 4px 9px;
    cursor: pointer;
    max-width: 100%;
}
.rx-chip:hover { border-color: #2b62d9; }
.rx-chip code {
    font-size: 11.5px;
    color: #4a587a;
    font-family: ui-monospace, Consolas, monospace;
}

/* ---------- 按钮 / 状态 ---------- */
.rx-btn {
    border: 1px solid #c5d1e3;
    background: #fff;
    color: #1a2b4a;
    padding: 7px 14px;
    border-radius: 9px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
}
.rx-btn:hover { background: #f7faff; border-color: #2b62d9; }
.rx-btn.primary { background: #2b62d9; color: #fff; border-color: #2b62d9; }
.rx-btn.primary:hover { background: #1e4cb8; border-color: #1e4cb8; }
.rx-status { color: #4a587a; font-size: 13px; margin-top: 8px; }
.rx-status.is-ok { color: #2b62d9; }
.rx-status.is-warn { color: #c0392b; }

/* ---------- 简介块 / 免责 ---------- */
.rx-info-block { margin-bottom: 26px; }
.rx-info-block .detail-icon {
    --icon-bg: linear-gradient(135deg, #6366f1, #22d3ee);
    --icon-shadow: rgba(99, 102, 241, .3);
}
.rx-disclaim {
    margin: 16px 0 0;
    padding: 12px 16px;
    border-radius: 12px;
    background: #fff8ea;
    border: 1px solid #f3e2b8;
    font-size: 12.5px;
    line-height: 1.8;
    color: #8a6516;
}
