:root {
    --bg: #f5f7fb;
    --bg-elevated: #eef1f7;
    --card: #ffffff;
    --card-hover: #f8f9fc;
    --border: #e2e6ef;
    --border-active: #c7cdd9;
    --accent: #4f6ef7;
    --accent-hover: #3b5de6;
    --accent-light: #eef1fe;
    --accent-glow: rgba(79, 110, 247, 0.08);
    --accent-glow-strong: rgba(79, 110, 247, 0.15);
    --text: #1e2433;
    --text-secondary: #4a5268;
    --text-muted: #8b93a8;
    --success: #22b573;
    --success-bg: rgba(34, 181, 115, 0.08);
    --error: #e54d4d;
    --error-bg: rgba(229, 77, 77, 0.06);
    --warning: #e5a118;
    --warning-bg: rgba(229, 161, 24, 0.06);
    --sidebar-bg: #ffffff;
    --sidebar-width: 260px;
    --radius: 12px;
    --radius-sm: 8px;
    --font-display: "Outfit", sans-serif;
    --font-mono: "JetBrains Mono", "Fira Code", "Consolas", monospace;
    --shadow:
        0 1px 3px rgba(30, 36, 51, 0.04), 0 1px 2px rgba(30, 36, 51, 0.03);
    --shadow-md:
        0 4px 12px rgba(30, 36, 51, 0.06), 0 2px 4px rgba(30, 36, 51, 0.04);
    --shadow-lg:
        0 12px 32px rgba(30, 36, 51, 0.08), 0 4px 8px rgba(30, 36, 51, 0.04);
    --transition: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

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

body {
    font-family: var(--font-display);
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    overflow-x: hidden;
    display: flex;
}

.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: var(--sidebar-width);
    background: var(--sidebar-bg);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    z-index: 100;
    overflow-y: auto;
    overflow-x: hidden;
    transition:
        transform 0.3s cubic-bezier(0.4, 0, 0.2, 1),
        box-shadow 0.3s ease;
}

.sidebar.collapsed {
    transform: translateX(-100%);
    box-shadow: none;
}

.sidebar::-webkit-scrollbar {
    width: 4px;
}
.sidebar::-webkit-scrollbar-track {
    background: transparent;
}
.sidebar::-webkit-scrollbar-thumb {
    background: var(--border-active);
    border-radius: 2px;
}

.sidebar-header {
    padding: 1.25rem 1.25rem 1rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}

.logo-icon {
    width: 38px;
    height: 38px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--accent) 0%, #7c5bf7 100%);
    border-radius: 10px;
    color: white;
    flex-shrink: 0;
    box-shadow: 0 3px 10px rgba(79, 110, 247, 0.25);
}

.logo-text {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.logo-text h1 {
    font-size: 1.1rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    color: var(--text);
}

.header-badge {
    font-size: 0.62rem;
    font-weight: 600;
    padding: 0.15rem 0.45rem;
    background: var(--accent-light);
    color: var(--accent);
    border-radius: 12px;
    letter-spacing: 0.03em;
}

.sidebar-nav {
    flex: 1;
    padding: 0.75rem 0;
    overflow-y: auto;
}

.sidebar-category {
    margin-bottom: 0.25rem;
}

.sidebar-category-title {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    padding: 0.5rem 1.25rem;
    font-size: 0.68rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    user-select: none;
}

.sidebar-category-icon {
    font-size: 0.85rem;
}

.sidebar-item {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    padding: 0.55rem 1.25rem;
    margin: 1px 0.6rem;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all var(--transition);
    color: var(--text-secondary);
    font-size: 0.88rem;
    font-weight: 500;
    position: relative;
    text-decoration: none;
}

.sidebar-item:hover {
    background: var(--bg);
    color: var(--text);
}

.sidebar-item.active {
    background: var(--accent-light);
    color: var(--accent);
    font-weight: 600;
}

.sidebar-item.active::before {
    content: "";
    position: absolute;
    left: -0.6rem;
    top: 50%;
    transform: translateY(-50%);
    width: 3px;
    height: 60%;
    background: var(--accent);
    border-radius: 0 3px 3px 0;
}

.sidebar-item-icon {
    font-size: 1.05rem;
    width: 22px;
    text-align: center;
    flex-shrink: 0;
}

.sidebar-item-name {
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar-footer {
    padding: 1rem 1.25rem;
    border-top: 1px solid var(--border);
    color: var(--text-muted);
    font-size: 0.72rem;
    text-align: center;
    letter-spacing: 0.03em;
    flex-shrink: 0;
}

.main-wrapper {
    margin-left: var(--sidebar-width);
    flex: 1;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    background: var(--bg);
    transition: margin-left 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.main-wrapper.sidebar-collapsed {
    margin-left: 0;
}

#main-header {
    background: var(--card);
    border-bottom: 1px solid var(--border);
    padding: 0 2rem;
    height: 56px;
    display: flex;
    align-items: center;
    flex-shrink: 0;
    position: sticky;
    top: 0;
    z-index: 50;
    box-shadow: var(--shadow);
    gap: 0.75rem;
}

.sidebar-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    background: transparent;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--transition);
    flex-shrink: 0;
}

.sidebar-toggle:hover {
    background: var(--accent-light);
    border-color: var(--accent);
    color: var(--accent);
}

.header-breadcrumb {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.88rem;
}

.breadcrumb-item {
    color: var(--text-muted);
    font-weight: 500;
}

.breadcrumb-item.active {
    color: var(--text);
    font-weight: 600;
}

.breadcrumb-separator {
    color: var(--border-active);
    font-size: 0.75rem;
}

.content-area {
    flex: 1;
    padding: 2rem;
    animation: contentFadeIn 0.3s ease both;
}

/* ========== 站点底部 ========== */
.site-footer {
    flex-shrink: 0;
    border-top: 1px solid var(--border);
    background: var(--card);
    padding: 1rem 2rem;
}

.footer-inner {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0.5rem 1rem;
    font-size: 0.78rem;
    color: var(--text-muted);
}

.footer-inner a {
    color: var(--text-muted);
    text-decoration: none;
    transition: color var(--transition);
}

.footer-inner a:hover {
    color: var(--accent);
}

.footer-legal {
    display: flex;
    align-items: center;
    gap: 1rem;
}

@media (max-width: 480px) {
    .footer-inner {
        justify-content: center;
        text-align: center;
    }
}

@keyframes contentFadeIn {
    from {
        opacity: 0;
        transform: translateY(6px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.category-section {
    margin-bottom: 2rem;
}

.category-section:last-child {
    margin-bottom: 0;
}

.category-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
}

.category-icon {
    font-size: 1rem;
    width: 28px;
    height: 28px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--accent) 0%, #7c5bf7 100%);
    color: white;
    border-radius: 7px;
    font-size: 0.8rem;
}

.category-title {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-secondary);
    letter-spacing: 0.02em;
}

.category-divider {
    flex: 1;
    height: 1px;
    background: var(--border);
    margin-left: 0.5rem;
}

.tool-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 0.85rem;
}

.tool-card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.2rem;
    cursor: pointer;
    transition: all var(--transition);
    box-shadow: var(--shadow);
    display: flex;
    align-items: center;
    gap: 0.85rem;
    position: relative;
    overflow: hidden;
}

.tool-card::after {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: var(--radius);
    opacity: 0;
    transition: opacity var(--transition);
    box-shadow: var(--shadow-md);
    pointer-events: none;
}

.tool-card:hover {
    border-color: var(--accent);
    transform: translateY(-2px);
}

.tool-card:hover::after {
    opacity: 1;
}

.tool-card.active {
    border-color: var(--accent);
    background: var(--accent-light);
}

.tool-card-icon {
    width: 42px;
    height: 42px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--accent-light);
    color: var(--accent);
    border-radius: 10px;
    font-size: 1.15rem;
    flex-shrink: 0;
}

.tool-card-info {
    flex: 1;
    min-width: 0;
}

.tool-card-name {
    font-weight: 600;
    font-size: 0.92rem;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.tool-card-desc {
    font-size: 0.78rem;
    color: var(--text-muted);
    margin-top: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.tabs {
    display: flex;
    gap: 0;
    border-radius: var(--radius) var(--radius) 0 0;
    overflow: hidden;
    border: 1px solid var(--border);
    border-bottom: none;
    margin-bottom: 0;
}

.tab {
    flex: 1;
    padding: 0.85rem 1rem;
    text-align: center;
    cursor: pointer;
    background: var(--card);
    color: var(--text-muted);
    font-weight: 600;
    transition: all var(--transition);
    border: none;
    font-size: 0.88rem;
    font-family: var(--font-display);
}

.tab.active {
    background: var(--accent);
    color: white;
    box-shadow: 0 2px 8px rgba(79, 110, 247, 0.2);
}

.tab:hover:not(.active) {
    background: var(--bg);
    color: var(--text-secondary);
}

.panel {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 0 0 var(--radius) var(--radius);
    padding: 1.75rem;
    min-height: 300px;
    box-shadow: var(--shadow-md);
}

label {
    display: block;
    font-weight: 600;
    margin-bottom: 0.45rem;
    color: var(--text-secondary);
    font-size: 0.82rem;
    letter-spacing: 0.02em;
}

input[type="text"],
input[type="number"],
textarea,
select {
    width: 100%;
    padding: 0.65rem 0.85rem;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text);
    font-size: 0.9rem;
    font-family: var(--font-display);
    margin-bottom: 0.85rem;
    transition: all var(--transition);
}

input:focus,
textarea:focus,
select:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-glow-strong);
}

textarea {
    resize: vertical;
    min-height: 120px;
    font-family: var(--font-mono);
    font-size: 0.85rem;
    line-height: 1.6;
}

select {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%238b93a8' viewBox='0 0 16 16'%3E%3Cpath d='M8 11L3 6h10l-5 5z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    padding-right: 2rem;
}

.row {
    display: flex;
    gap: 1rem;
}

.row > * {
    flex: 1;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.6rem 1.3rem;
    background: var(--accent);
    color: white;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    font-weight: 600;
    font-family: var(--font-display);
    cursor: pointer;
    transition: all var(--transition);
    box-shadow: 0 2px 6px rgba(79, 110, 247, 0.2);
}

.btn:hover {
    background: var(--accent-hover);
    box-shadow: 0 4px 12px rgba(79, 110, 247, 0.3);
    transform: translateY(-1px);
}

.btn:active {
    transform: translateY(0);
}
.btn:disabled {
    opacity: 0.45;
    cursor: not-allowed;
    transform: none;
}

.btn-outline {
    background: transparent;
    border: 1px solid var(--border-active);
    color: var(--text-secondary);
    box-shadow: none;
}

.btn-outline:hover {
    background: var(--accent-light);
    border-color: var(--accent);
    color: var(--accent);
    box-shadow: none;
}

.btn-sm {
    padding: 0.3rem 0.65rem;
    font-size: 0.75rem;
}

.btn-group {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    margin-bottom: 0.85rem;
}

.result-area {
    margin-top: 1.25rem;
    padding: 1.25rem;
    background: var(--bg);
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    min-height: 60px;
}

.result-area h4 {
    color: var(--text-muted);
    font-size: 0.72rem;
    margin-bottom: 0.45rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    font-weight: 600;
}

.result-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--border);
}

.result-row:last-child {
    border-bottom: none;
}

.result-value {
    font-family: var(--font-mono);
    font-size: 0.88rem;
    word-break: break-all;
    color: var(--accent);
}

.result-label {
    color: var(--text-muted);
    font-size: 0.82rem;
    min-width: 100px;
    font-weight: 500;
}

.copy-btn {
    margin-left: 0.5rem;
}

.code-block {
    font-family: var(--font-mono);
    font-size: 0.84rem;
    white-space: pre-wrap;
    word-break: break-all;
    line-height: 1.65;
    max-height: 400px;
    overflow: auto;
    padding: 1rem;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    margin-top: 0.5rem;
    color: var(--text-secondary);
}

.code-block::-webkit-scrollbar {
    width: 5px;
}
.code-block::-webkit-scrollbar-track {
    background: transparent;
}
.code-block::-webkit-scrollbar-thumb {
    background: var(--border-active);
    border-radius: 3px;
}

.validation-indicator {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    font-size: 0.75rem;
    font-weight: 600;
    padding: 0.15rem 0.55rem;
    border-radius: 20px;
    letter-spacing: 0.02em;
}

.validation-indicator.valid {
    color: var(--success);
    background: var(--success-bg);
}

.validation-indicator.invalid {
    color: var(--error);
    background: var(--error-bg);
}

.toast-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(30, 36, 51, 0.35);
    z-index: 1100;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: toastOverlayIn 0.3s ease forwards;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

@keyframes toastOverlayIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes toastOverlayOut {
    from {
        opacity: 1;
    }
    to {
        opacity: 0;
    }
}

.toast {
    border-radius: 16px;
    overflow: hidden;
    animation: toastPopIn 0.4s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
    box-shadow:
        0 24px 80px rgba(30, 36, 51, 0.18),
        0 8px 24px rgba(30, 36, 51, 0.1),
        inset 0 1px 0 rgba(255, 255, 255, 0.6);
    width: 360px;
    max-width: 90vw;
    background: var(--card);
    border: 1px solid rgba(0, 0, 0, 0.06);
}

.toast-top-bar {
    height: 4px;
    width: 100%;
}

.toast.success .toast-top-bar {
    background: linear-gradient(90deg, #22b573, #34d399);
}
.toast.error .toast-top-bar {
    background: linear-gradient(90deg, #e54d4d, #f87171);
}
.toast.warning .toast-top-bar {
    background: linear-gradient(90deg, #e5a118, #fbbf24);
}

.toast-content {
    padding: 1.75rem 1.75rem 1.25rem;
    text-align: center;
}

.toast-icon-wrap {
    width: 52px;
    height: 52px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
    font-weight: 700;
    color: white;
    margin: 0 auto 1rem;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.12);
}

.toast.success .toast-icon-wrap {
    background: linear-gradient(135deg, #1aab6e, #34d399);
}
.toast.error .toast-icon-wrap {
    background: linear-gradient(135deg, #d43d3d, #f87171);
}
.toast.warning .toast-icon-wrap {
    background: linear-gradient(135deg, #d49115, #fbbf24);
}

.toast-title {
    font-family: var(--font-display);
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 0.35rem;
    letter-spacing: -0.01em;
}

.toast-body {
    font-family: var(--font-display);
    font-size: 0.88rem;
    color: var(--text-muted);
    line-height: 1.55;
}

.toast-footer {
    padding: 0 1.75rem 1.5rem;
    display: flex;
    justify-content: center;
    gap: 0.6rem;
}

.toast-btn {
    padding: 0.55rem 2.2rem;
    border: none;
    border-radius: 10px;
    font-family: var(--font-display);
    font-size: 0.88rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    color: white;
    letter-spacing: 0.02em;
}

.toast.success .toast-btn {
    background: linear-gradient(135deg, #1aab6e, #22b573);
    box-shadow: 0 3px 10px rgba(34, 181, 115, 0.25);
}
.toast.error .toast-btn {
    background: linear-gradient(135deg, #d43d3d, #e54d4d);
    box-shadow: 0 3px 10px rgba(229, 77, 77, 0.25);
}
.toast.warning .toast-btn {
    background: linear-gradient(135deg, #d49115, #e5a118);
    box-shadow: 0 3px 10px rgba(229, 161, 24, 0.25);
}

.toast-btn:hover {
    transform: translateY(-1px);
    filter: brightness(1.08);
}
.toast-btn:active {
    transform: translateY(0);
}

@keyframes toastPopIn {
    from {
        transform: scale(0.7) translateY(20px);
        opacity: 0;
    }
    to {
        transform: scale(1) translateY(0);
        opacity: 1;
    }
}

@keyframes toastPopOut {
    from {
        transform: scale(1);
        opacity: 1;
    }
    to {
        transform: scale(0.85) translateY(8px);
        opacity: 0;
    }
}

.noscript-warning {
    text-align: center;
    padding: 3rem;
    color: var(--error);
    font-size: 1.2rem;
}

.json-layout {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.25rem;
    align-items: stretch;
    min-height: 520px;
}

.json-input-panel {
    min-width: 0;
    display: flex;
}

.json-output-panel {
    min-width: 0;
    display: flex;
}

.json-card {
    flex: 1;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.json-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.85rem 1.15rem;
    border-bottom: 1px solid var(--border);
    background: var(--bg);
    flex-shrink: 0;
}

.json-card-title {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 600;
    font-size: 0.88rem;
    color: var(--text-secondary);
}

.json-card-title svg {
    color: var(--accent);
}

.json-card textarea {
    flex: 1;
    border: none;
    border-radius: 0;
    margin-bottom: 0;
    background: var(--card);
    padding: 1rem 1.15rem;
    resize: none;
    min-height: 280px;
}

.json-card textarea:focus {
    box-shadow: none;
    border-color: transparent;
}

.json-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 1.15rem;
    border-top: 1px solid var(--border);
    background: var(--bg);
    gap: 0.75rem;
    flex-shrink: 0;
}

.json-actions {
    display: flex;
    gap: 0.45rem;
    flex-wrap: wrap;
}

.json-output-body {
    flex: 1;
    padding: 0;
    overflow: auto;
    min-height: 200px;
}

.json-output-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 3rem 1rem;
    color: var(--text-muted);
    gap: 0.75rem;
    flex: 1;
}

.json-output-placeholder p {
    font-size: 0.88rem;
    color: var(--text-muted);
}

.json-output-panel .result-area {
    margin: 0;
    border: none;
    border-radius: 0;
    min-height: unset;
    padding: 1rem 1.15rem;
    background: var(--card);
}

.tree-header {
    padding: 0.65rem 1.15rem;
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    border-bottom: 1px solid var(--border);
}

#json-tree .tree-view {
    margin: 0;
    padding: 1rem 1.15rem;
}

@media (max-width: 768px) {
    .json-layout {
        grid-template-columns: 1fr;
        min-height: unset;
    }

    .json-card textarea {
        min-height: 180px;
    }
}

.indent-selector {
    display: inline-flex;
    gap: 0;
    border: 1px solid var(--border);
    border-radius: 6px;
    overflow: hidden;
}

.indent-option {
    padding: 0.35rem 0.7rem;
    background: var(--card);
    color: var(--text-muted);
    border: none;
    cursor: pointer;
    font-size: 0.78rem;
    font-family: var(--font-display);
    transition: all var(--transition);
}

.indent-option.active {
    background: var(--accent);
    color: white;
}

.indent-option:hover:not(.active) {
    background: var(--bg);
}

.tree-view {
    margin-top: 1rem;
    font-family: var(--font-mono);
    font-size: 0.82rem;
}

.tree-node {
    padding-left: 1.2rem;
    position: relative;
}

.tree-toggle {
    cursor: pointer;
    user-select: none;
    padding: 2px 0;
    border-radius: 3px;
    transition: background var(--transition);
}

.tree-toggle:hover {
    background: var(--accent-glow-strong);
}

.tree-key {
    color: #2563eb;
}
.tree-colon {
    color: var(--text-muted);
}
.tree-value-string {
    color: var(--success);
}
.tree-value-number {
    color: #2563eb;
}
.tree-value-boolean {
    color: var(--warning);
}
.tree-value-null {
    color: var(--text-muted);
}
.tree-bracket {
    color: var(--text-muted);
}

.tree-type-badge {
    font-size: 0.65rem;
    padding: 1px 5px;
    border-radius: 3px;
    margin-left: 0.4rem;
    font-weight: 600;
    text-transform: uppercase;
}

.badge-object {
    background: rgba(124, 91, 247, 0.1);
    color: #7c5bf7;
}
.badge-array {
    background: rgba(124, 91, 247, 0.1);
    color: #7c5bf7;
}
.badge-string {
    background: var(--success-bg);
    color: var(--success);
}
.badge-number {
    background: rgba(37, 99, 235, 0.1);
    color: #2563eb;
}
.badge-boolean {
    background: var(--warning-bg);
    color: var(--warning);
}
.badge-null {
    background: rgba(139, 147, 168, 0.1);
    color: var(--text-muted);
}

.error-message {
    color: var(--error);
    font-size: 0.85rem;
    margin-top: 0.5rem;
    padding: 0.65rem 0.85rem;
    background: var(--error-bg);
    border-radius: var(--radius-sm);
    border-left: 3px solid var(--error);
}

/* 模块脚本按需加载时的占位提示 */
.loading-placeholder {
    padding: 3rem 1rem;
    text-align: center;
    opacity: 0.7;
}

.section-divider {
    border: none;
    border-top: 1px solid var(--border);
    margin: 1.5rem 0;
}

.drop-zone {
    border: 2px dashed var(--border-active);
    border-radius: var(--radius-sm);
    padding: 2rem;
    text-align: center;
    cursor: pointer;
    transition: all var(--transition);
    margin-bottom: 0.85rem;
    background: var(--bg);
}

.drop-zone:hover,
.drop-zone.dragover {
    border-color: var(--accent);
    background: var(--accent-light);
}

.drop-zone p {
    color: var(--text-muted);
    font-size: 0.88rem;
}

.camera-container {
    position: relative;
    border-radius: var(--radius-sm);
    overflow: hidden;
    background: var(--bg-elevated);
    margin-bottom: 0.85rem;
    border: 1px solid var(--border);
}

.camera-container video {
    width: 100%;
    display: block;
}
.camera-container canvas {
    display: none;
}

.camera-controls {
    display: flex;
    gap: 0.5rem;
    justify-content: center;
    margin-bottom: 0.85rem;
}

.loading {
    display: inline-block;
    width: 18px;
    height: 18px;
    border: 2px solid rgba(79, 110, 247, 0.15);
    border-radius: 50%;
    border-top-color: var(--accent);
    animation: spin 0.7s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.download-link {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    margin-top: 0.85rem;
    color: var(--accent);
    text-decoration: none;
    font-weight: 600;
    font-size: 0.88rem;
    transition: color var(--transition);
}

.download-link:hover {
    color: var(--accent-hover);
    text-decoration: underline;
}

.preview-img {
    max-width: 200px;
    border-radius: var(--radius-sm);
    margin-bottom: 0.85rem;
    border: 1px solid var(--border);
}

.qr-result-img {
    max-width: 300px;
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-md);
}

.decoded-content {
    background: var(--bg);
    padding: 1rem;
    border-radius: var(--radius-sm);
    word-break: break-all;
    text-align: left;
    font-family: var(--font-mono);
    font-size: 0.88rem;
    border: 1px solid var(--border);
    color: var(--text-secondary);
}

.back-btn {
    display: none;
}

.welcome-section {
    text-align: center;
    padding: 3rem 1rem;
}

.welcome-section h2 {
    font-size: 1.6rem;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 0.5rem;
}

.welcome-section p {
    color: var(--text-muted);
    font-size: 0.95rem;
    max-width: 420px;
    margin: 0 auto;
}

@media (max-width: 900px) {
    .sidebar {
        transform: translateX(-100%);
        transition: transform 0.3s ease;
        box-shadow: var(--shadow-lg);
    }

    .sidebar.open {
        transform: translateX(0);
    }

    .main-wrapper {
        margin-left: 0;
    }

    .mobile-toggle {
        display: flex !important;
    }
}

@media (max-width: 768px) {
    .content-area {
        padding: 1.25rem;
    }
    .panel {
        padding: 1.25rem;
    }
    .row {
        flex-direction: column;
    }
    .tabs {
        flex-wrap: wrap;
    }
    .tab {
        font-size: 0.82rem;
        padding: 0.7rem;
    }
    .tool-grid {
        grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    }
}

@media (max-width: 480px) {
    .btn {
        padding: 0.55rem 0.9rem;
        font-size: 0.82rem;
    }
    .tool-grid {
        grid-template-columns: 1fr;
    }
}

/* URL 编解码工具样式 */
.url-layout {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    gap: 1rem;
    align-items: stretch;
}

.url-actions-vertical {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 0.75rem;
    padding: 0 0.5rem;
}

.url-actions-vertical .btn {
    min-width: 80px;
}

.url-card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
}

.url-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.85rem 1.15rem;
    border-bottom: 1px solid var(--border);
    background: var(--bg);
}

.url-card-title {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 600;
    font-size: 0.88rem;
    color: var(--text-secondary);
}

.url-card-title svg {
    color: var(--accent);
}

.url-card textarea {
    width: 100%;
    border: none;
    border-radius: 0;
    margin-bottom: 0;
    background: var(--card);
    padding: 1rem 1.15rem;
    resize: vertical;
    min-height: 180px;
}

.url-card textarea:focus {
    box-shadow: none;
    border-color: transparent;
}

.url-card textarea[readonly] {
    background: var(--bg);
    color: var(--text-secondary);
}

.url-actions {
    display: flex;
    gap: 0.5rem;
    padding: 0.75rem 1.15rem;
    border-top: 1px solid var(--border);
    background: var(--bg);
}

.url-info {
    padding: 0.6rem 1.15rem;
    font-size: 0.78rem;
    color: var(--text-muted);
    background: var(--bg-elevated);
    border-top: 1px solid var(--border);
}

.url-reference {
    margin-top: 1.5rem;
    padding: 1.25rem;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.url-reference h3 {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 1rem;
}

.url-ref-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 0.75rem;
}

.url-ref-item {
    padding: 0.75rem 1rem;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
}

.ref-label {
    display: block;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-muted);
    margin-bottom: 0.35rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.url-ref-item code {
    font-family: var(--font-mono);
    font-size: 0.82rem;
    color: var(--accent);
    word-break: break-all;
}

@media (max-width: 768px) {
    .url-layout {
        grid-template-columns: 1fr;
    }
    .url-actions-vertical {
        flex-direction: row;
        justify-content: center;
        padding: 0.5rem 0;
    }
}

/* ========== Random Generator ========== */
.rg-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    align-items: start;
}

.rg-section {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 1rem 1.15rem;
}

.rg-section-title {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 0.75rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--border);
}

.rg-inline {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: center;
}

.rg-field {
    flex: 1 1 80px;
    min-width: 60px;
}

.rg-field label {
    display: block;
    font-size: 0.72rem;
    font-weight: 500;
    color: var(--text-muted);
    margin-bottom: 0.2rem;
    white-space: nowrap;
}

.rg-field-tiny {
    flex: 0 0 65px;
    min-width: 55px;
}

.rg-field-btn {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
}

.rg-field-btn .btn {
    white-space: nowrap;
    padding: 0.45rem 0.75rem;
    font-size: 0.8rem;
}

.rg-input {
    width: 100%;
    padding: 0.38rem 0.55rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-family: var(--font-mono);
    font-size: 0.82rem;
    color: var(--text);
    background: var(--card);
    outline: none;
    transition:
        border-color var(--transition),
        box-shadow var(--transition);
}

.rg-input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-glow);
}

.rg-checkbox-group {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem 0.8rem;
    margin-top: 0.5rem;
}

.rg-checkbox {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    cursor: pointer;
    font-size: 0.8rem;
    color: var(--text-secondary);
    user-select: none;
}

.rg-checkbox input[type="checkbox"] {
    width: 14px;
    height: 14px;
    accent-color: var(--accent);
    cursor: pointer;
}

.rg-result {
    margin-top: 0.6rem;
}

.rg-output {
    margin-top: 0.4rem;
    padding: 0.6rem 0.85rem;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-family: var(--font-mono);
    font-size: 0.8rem;
    color: var(--text);
    line-height: 1.5;
    overflow-x: auto;
    white-space: pre-wrap;
    word-break: break-all;
    max-height: 160px;
    overflow-y: auto;
}

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

/* ========== 图片格式转换 ========== */
.imgc-toolbar {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    margin-bottom: 0.85rem;
}

.imgc-toolbar input[type="text"] {
    flex: 1;
    margin-bottom: 0;
}

.imgc-paste-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.85rem;
}

.imgc-paste-hint {
    font-size: 0.78rem;
    color: var(--text-muted);
}

.imgc-meta {
    font-family: var(--font-mono);
    font-size: 0.78rem;
    color: var(--text-muted);
    margin-bottom: 0.85rem;
    word-break: break-all;
}

.imgc-meta:empty {
    margin-bottom: 0;
}

input[type="range"] {
    width: 100%;
    accent-color: var(--accent);
    margin: 0.65rem 0 0.85rem;
}
