:root {
    --primary: #6366f1;
    --bg-light: #f7f8fa;
    --bg-dark: #18181b;
    --text-light: #1f2937;
    --text-dark: #f3f4f6;
    --card-light: #ffffff;
    --card-dark: #242424;
    --link-light: #4f46e5;
    --link-dark: #a5b4fc;
    --bg-color: #f7f8fa;
    --text-color: #1f2937;
    --card-bg: #ffffff;
    --card-border: #6366f1;
    --code-bg: #1e293b;
    --code-color: #e2e8f0;
    --output-bg: #0f172a;
    --table-header: #f1f5f9;
    --table-border: #cbd5e1;
    --table-bg: #f8fafc;
    --highlight: #ede9fe;
    --highlight-border: #7c3aed;
    --copy-btn: #6366f1;
    --copy-btn-hover: #4f46e5;
    --footer-color: #666;
    --bg: #f9fafb;
    --text: #1f2937;
    --card: #ffffff;
    --code-text: #e2e8f0;
    --inline-code-bg: #e2e8f0;
    --inline-code-color: #1e293b;
    --section-bg: #ffffff;
    --section-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
}

.navbar-dark .navbar-nav .nav-link {
    color: #fff;
}

.navbar-light .navbar-nav .nav-link {
    color: #000;
}

.nav-item.active .nav-link {
    font-weight: bold;
    text-decoration: underline;
}

body {
    margin: 0;
    padding: 70px 16px 0 16px;
}

body.dark {
    --bg-color: #1c1d20;
    --card-bg: #2a2b2e;
    --card-border: #818cf8;
    --code-bg: #0f172a;
    --code-color: #e2e8f0;
    --output-bg: #020617;
    --table-header: #334155;
    --table-border: #475569;
    --highlight: #1e1b4b;
    --highlight-border: #818cf8;
    --copy-btn: #818cf8;
    --copy-btn-hover: #a5b4fc;
    --footer-color: #aaa;
    --card: #1e293b;
    --table-bg: #1e293b;
    --text-color: #f8fafc;
    --inline-code-bg: #334155;
    --inline-code-color: #e2e8f0;
    --section-bg: #1e293b;
    --section-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.3), 0 2px 4px -1px rgba(0, 0, 0, 0.2);
    --card-light: #242424;
    --border-light: #444;
    --text-light: #f3f4f6;
    --text-muted: #aaa;
}

body.dark .navbar-nav .nav-link {
    color: #f8f9fa !important;
}

body.dark .navbar-brand {
    color: #f8f9fa !important;
}

body.dark footer {
    background-color: #1c1c1e;
    color: #aaa;
    border-top: 1px solid #444 !important;
}

/* 激活项样式更明显 */
.nav-item.active .nav-link {
    font-weight: bold;
    text-decoration: underline;
}

table td,
table th {
    vertical-align: top;
    white-space: normal;
}

body.dark {
    background-color: var(--bg-dark);
    color: var(--text-dark);
}

body.dark .color-black {
    color: var(--text-dark);
}

body.dark table {
    color: var(--link-dark);
    background-color: var(--card-dark);
}

body.dark .table-hover tbody tr:hover {
    color: var(--link-dark);
}

body.dark .card {
    color: var(--link-dark);
    background-color: var(--card-dark);
}

button:focus {
    outline: none;
}

.command-example {
    background: var(--code-bg);
    color: var(--code-color);
    padding: 15px;
    border-radius: 10px;
    font-family: 'Courier New', monospace;
    position: relative;
    margin-bottom: 10px;
    border: 1px solid var(--table-border);
    transition: border-color 0.2s ease;
}

.command-example:hover {
    border-color: var(--primary);
}

.command-example::before {
    content: "$ ";
    color: #a5b4fc;
    font-weight: bold;
}

.output-example {
    background: var(--output-bg);
    color: var(--code-color);
    padding: 15px;
    border-radius: 10px;
    font-family: 'Courier New', monospace;
    white-space: pre-wrap;
    margin-bottom: 10px;
    border: 1px solid var(--table-border);
}

/* Bash 标签通用样式 */
.bash-label {
    display: inline-block;
    font-size: 0.75em;
    color: var(--code-color);
    opacity: 0.75;
    margin-bottom: 6px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* 复制按钮通用增强 */
button.copy-btn {
    transition: all 0.2s ease;
}

button.copy-btn:hover {
    transform: translateY(-1px);
}

button.copy-btn:active {
    transform: translateY(0);
}

.btn-primary {
    background-color: #6366f1 !important;
    border-color: #6366f1 !important;
}

.btn-primary:hover,
.btn-primary:focus,
.btn-primary:active {
    background-color: #4f46e5 !important;
    border-color: #4f46e5 !important;
    box-shadow: 0 0 0 0.2rem rgba(99, 102, 241, 0.2) !important;
}

.btn-outline-secondary.correction-mini {
    color: #4f46e5 !important;
    border-color: rgba(99, 102, 241, 0.45) !important;
}

.btn-outline-secondary.correction-mini:hover,
.btn-outline-secondary.correction-mini:focus {
    background-color: rgba(99, 102, 241, 0.08) !important;
    color: #4338ca !important;
    border-color: #6366f1 !important;
}

body.dark .btn-outline-secondary.correction-mini {
    color: #a5b4fc !important;
    border-color: rgba(165, 180, 252, 0.45) !important;
}

body.dark .btn-outline-secondary.correction-mini:hover,
body.dark .btn-outline-secondary.correction-mini:focus {
    background-color: rgba(165, 180, 252, 0.12) !important;
    color: #c7d2fe !important;
    border-color: #a5b4fc !important;
}


.theme-toggle {
    position: fixed;
    top: 10px;
    right: 20px;
    font-size: 20px;
    background: none;
    border: none;
    cursor: pointer;
    color: inherit;
    z-index: 99999;
}

/* 悬浮主题按钮：避开右上角汉堡，放到左侧或下移一点 */
@media (max-width: 575.98px) {
    .theme-toggle {
        top: 55px;
    }

    /* 小屏再微调 */
}


.go-top {
    display: none;
    opacity: 0.6;
    z-index: 999999;
    position: fixed;
    bottom: 113px;
    left: 90%;
    margin-left: 40px;
    border: 1px solid #fff;
    width: 50px;
    height: 50px;
    background-color: #666;
    border-radius: 3px;
    cursor: pointer;
}

.go-top:hover {
    opacity: 1;
    filter: alpha(opacity=100);
}

.go-top .arrow {
    position: absolute;
    left: 15px;
    top: 2px;
    width: 0;
    height: 0;
    border: 9px solid transparent;
    border-bottom-color: #fff;
}

.go-top .stick {
    position: absolute;
    left: 20px;
    top: 15px;
    width: 8px;
    height: 20px;
    display: block;
    background-color: #fff;
    -webkit-border-radius: 1px;
    -moz-border-radius: 1px;
    border-radius: 1px;
}

.table-hover td,
.table-hover th {
    text-align: left;
    vertical-align: middle;
    padding: 0.75rem;
    word-break: break-word;
}

.table-hover {
    table-layout: fixed;
    width: 100%;
}

.text-1-2 {
    font-size: 1.2rem;
}

.text-1-1 {
    font-size: 1.1rem;
}

.text-1 {
    font-size: 1.0rem;
}

.text-0-8 {
    font-size: 0.8rem;
}

.text-0-5 {
    font-size: 0.5rem;
}

input.parsley-success,
select.parsley-success,
textarea.parsley-success {
    color: #468847;
    background-color: #DFF0D8;
    border: 1px solid #D6E9C6;
}

input.parsley-error,
select.parsley-error,
textarea.parsley-error {
    color: #B94A48;
    background-color: #F2DEDE;
    border: 1px solid #EED3D7;
}

.parsley-errors-list {
    margin: 2px 0 3px 10px;
    padding: 0 0 0 2px;
    list-style-type: none;
    font-size: 0.9em;
    line-height: 0.9em;
    opacity: 0;
    color: #B94A48;

    transition: all .3s ease-in;
    -o-transition: all .3s ease-in;
    -moz-transition: all .3s ease-in;
    -webkit-transition: all .3s ease-in;
}

.parsley-errors-list.filled {
    opacity: 1;
}

.logo {
    width: 70px;
    height: 40px;
    border-radius: 10px;
    background: linear-gradient(135deg, #4f46e5, #7c3aed);
    display: grid;
    place-items: center;
    color: #fff;
    font-weight: 600;
    box-shadow: 0 6px 16px rgba(99, 102, 241, 0.24);
}

.section {
    padding: 16px;
    border-radius: 10px;
    margin-bottom: 20px;
}

.changelog-item {
    margin-bottom: 18px;
    padding: 15px;
    background: var(--table-bg);
    border-radius: 8px;
    border-left: 4px solid var(--primary);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
}

.changelog-item h3 {
    margin-top: 0;
    font-size: 1em;
    color: var(--text-color);
}

.changelog-item ul {
    margin: 10px 0 0 18px;
    padding-left: 0;
    color: var(--text-color);
}

.main-content h1 {
    text-align: center;
    font-size: 2.4em;
    margin-bottom: 30px;
    background: linear-gradient(135deg, #4f46e5, #7c3aed);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.main-content .ip-display {
    background: linear-gradient(135deg, #4f46e5, #7c3aed);
    color: white;
    padding: 20px;
    border-radius: 15px;
    text-align: center;
    margin-bottom: 30px;
}

/* ================== SVG 图标样式 ================== */
.icon {
    width: 1em;
    height: 1em;
    vertical-align: -0.125em;
    fill: currentColor;
    display: inline-block;
}

.icon-lg {
    width: 1.2em;
    height: 1.2em;
}

.icon-title {
    width: 1.5em;
    height: 1.5em;
    vertical-align: -0.2em;
    margin-right: 0.3em;
}

/* 主题切换按钮 SVG */
.theme-toggle svg {
    width: 20px;
    height: 20px;
}

/* ================== IP 状态标签样式 ================== */
.ip-status-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 0.75em;
    padding: 2px 8px;
    border-radius: 12px;
    margin-left: 8px;
    font-weight: 500;
    white-space: nowrap;
}

.ip-status-badge .icon {
    width: 12px;
    height: 12px;
}

.ip-status-badge.direct {
    background: rgba(34, 197, 94, 0.15);
    color: #22c55e;
}

.ip-status-badge.proxy {
    background: rgba(239, 68, 68, 0.15);
    color: #ef4444;
}

.ip-status-badge.dual-stack {
    background: rgba(99, 102, 241, 0.15);
    color: #6366f1;
}

.ip-status-badge.loading {
    background: rgba(156, 163, 175, 0.15);
    color: #9ca3af;
}

body.dark .ip-status-badge.direct {
    background: rgba(34, 197, 94, 0.25);
    color: #4ade80;
}

body.dark .ip-status-badge.proxy {
    background: rgba(239, 68, 68, 0.25);
    color: #f87171;
}

body.dark .ip-status-badge.dual-stack {
    background: rgba(99, 102, 241, 0.25);
    color: #818cf8;
}

body.dark .ip-status-badge.loading {
    background: rgba(156, 163, 175, 0.25);
    color: #d1d5db;
}

/* 真实 IP 显示区域 */
.real-ip-row {
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px dashed rgba(99, 102, 241, 0.3);
}

.real-ip-label {
    font-size: 0.85em;
    color: #6b7280;
}

body.dark .real-ip-label {
    color: #9ca3af;
}

/* ================== 内联代码样式 ================== */
code {
    background: var(--inline-code-bg);
    color: var(--inline-code-color);
    padding: 2px 6px;
    border-radius: 4px;
    font-family: 'Courier New', Consolas, monospace;
    font-size: 0.9em;
}

/* ================== API 页面样式优化 ================== */
.usage-section {
    background: var(--section-bg);
    color: var(--text-color);
    padding: 30px;
    border-radius: 15px;
    margin-top: 30px;
    box-shadow: var(--section-shadow);
    border: 1px solid var(--table-border);
}

.usage-section h2,
.usage-section h3 {
    color: var(--text-color);
}

.usage-section p {
    color: var(--text-color);
}

.api-params {
    background: var(--table-bg);
    padding: 20px;
    border-radius: 10px;
    border-left: 4px solid #e53e3e;
    margin-bottom: 10px;
}

.param-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 10px;
}

.param-table th,
.param-table td {
    border: 1px solid var(--table-border);
    padding: 10px;
    color: var(--text-color);
}

.param-table th {
    background: var(--table-header);
}

.param-table td {
    background: var(--section-bg);
}

/* 代码块标题栏样式 */
.command-example {
    background: var(--code-bg);
    color: var(--code-color);
}

.command-example pre {
    color: inherit;
}

.command-example.code-example::before {
    content: none;
}

.command-example.code-example pre {
    display: block;
    margin-top: 8px;
    white-space: pre-wrap;
    word-break: break-all;
}

.output-example {
    background: var(--output-bg);
    color: var(--code-color);
}

/* ================== Promo Button (ResHub) ================== */
a.nav-promo-btn {
    display: inline-block;
    background: linear-gradient(135deg, #4f46e5, #7c3aed) !important;
    color: #ffffff !important;
    border-radius: 99px;
    padding: 5px 14px;
    font-size: 13.5px;
    font-weight: 600;
    white-space: nowrap;
    text-decoration: none;
    transition: .2s;
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.28);
}

a.nav-promo-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(99, 102, 241, 0.42);
    opacity: 0.95;
    color: #ffffff !important;
    text-decoration: none;
}

/* ================== Security Dashboard ================== */
.security-dashboard {
    margin-top: 30px;
    padding: 24px;
    border-radius: 12px;
    background: var(--card-light);
    border: 1px solid var(--border-light);
}

.sec-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.sec-title {
    font-size: 1.2em;
    font-weight: 700;
    margin: 0;
    color: var(--text-light);
}

.sec-subtitle {
    font-size: 0.85em;
    color: var(--text-muted);
    margin: 4px 0 0;
}

.security-score-circle {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1.2em;
    font-weight: 800;
    flex-shrink: 0;
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
    transition: background 0.4s, box-shadow 0.4s;
}

.score-high { background: linear-gradient(135deg, #10b981, #34d399) !important; box-shadow: 0 4px 12px rgba(16,185,129,0.3) !important; }
.score-mid  { background: linear-gradient(135deg, #f59e0b, #fbbf24) !important; box-shadow: 0 4px 12px rgba(245,158,11,0.3) !important; }
.score-low  { background: linear-gradient(135deg, #ef4444, #f87171) !important; box-shadow: 0 4px 12px rgba(239,68,68,0.3) !important; }

.sec-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
}

.sec-item {
    padding: 14px;
    border-radius: 10px;
    background: rgba(99, 102, 241, 0.03);
    border: 1px solid var(--border-light);
    transition: border-color 0.2s;
}

.sec-item:hover { border-color: var(--primary); }

.sec-item-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
    font-size: 0.9em;
    margin-bottom: 6px;
    color: var(--text-light);
}

.sec-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #d1d5db;
    flex-shrink: 0;
    transition: background 0.3s;
}

.dot-safe   { background: #10b981; }
.dot-warn   { background: #f59e0b; }
.dot-danger { background: #ef4444; }

.sec-item-value {
    font-size: 0.82em;
    color: var(--text-muted);
    line-height: 1.4;
}

.sec-safe    { color: #10b981; }
.sec-warn    { color: #f59e0b; }
.sec-danger  { color: #ef4444; }
.sec-neutral { color: var(--text-muted); }

/* Quick Tools */
.quick-tools-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
    margin-top: 20px;
}

.quick-tool-tile {
    display: block;
    padding: 14px 8px;
    background: var(--card-light);
    border: 1px solid var(--border-light);
    border-radius: 12px;
    text-align: center;
    text-decoration: none;
    color: var(--text-light);
    font-size: 0.85em;
    font-weight: 500;
    transition: all 0.2s;
}

.quick-tool-tile:hover {
    border-color: var(--primary);
    transform: translateY(-2px);
    text-decoration: none;
    color: var(--primary);
    box-shadow: 0 4px 8px rgba(99, 102, 241, 0.16);
}

.quick-tool-tile .tool-emoji {
    font-size: 1.5em;
    display: block;
    margin-bottom: 4px;
}

/* Dark mode */
body.dark .security-dashboard { background: var(--card-dark); border-color: var(--border-dark); }
body.dark .sec-title { color: var(--text-dark); }
body.dark .sec-item-label { color: var(--text-dark); }
body.dark .sec-item { background: rgba(255,255,255,0.04); border-color: var(--border-dark); }
body.dark .sec-item:hover { border-color: var(--primary); }
body.dark .quick-tool-tile { background: var(--card-dark); border-color: var(--border-dark); color: var(--text-dark); }
body.dark .quick-tool-tile:hover { border-color: var(--primary); color: var(--primary); }

@media (max-width: 600px) {
    .sec-grid { grid-template-columns: 1fr; }
    .quick-tools-grid { grid-template-columns: repeat(2, 1fr); }
}
/* ---- Dropdown Hover & Modern Styling Improvements ---- */
@media (min-width: 992px) {
    .nav-item.dropdown:hover .dropdown-menu {
        display: block;
        margin-top: 0;
        animation: dropFadeIn 0.2s cubic-bezier(0.16, 1, 0.3, 1);
    }
}

.dropdown-menu {
    border: none !important;
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1) !important;
    border-radius: 12px !important;
    padding: 8px !important;
    background: var(--card-bg) !important;
}

.dropdown-item {
    border-radius: 8px !important;
    padding: 10px 16px !important;
    font-weight: 500 !important;
    color: var(--text-color) !important;
    transition: all 0.25s ease !important;
    margin-bottom: 2px !important;
}

.dropdown-item:last-child {
    margin-bottom: 0 !important;
}

.dropdown-item:hover, .dropdown-item:focus {
    background-color: rgba(99, 102, 241, 0.08) !important;
    color: var(--primary) !important;
    transform: translateX(4px) !important;
}

body.dark .dropdown-menu {
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.5), 0 8px 10px -6px rgba(0, 0, 0, 0.5) !important;
    border: 1px solid rgba(255,255,255,0.05) !important;
}

body.dark .dropdown-item:hover, body.dark .dropdown-item:focus {
    background-color: rgba(165, 180, 252, 0.12) !important;
    color: var(--link-dark) !important;
}

@keyframes dropFadeIn {
    0% { opacity: 0; transform: scale(0.96) translateY(-4px); }
    100% { opacity: 1; transform: scale(1) translateY(0); }
}
