* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

:root {
    --primary-color: #6a11cb;
    --secondary-color: #2575fc;
    --bg-color: rgba(255, 255, 255, 0.5);
    --text-color: #333;
    --panel-bg: rgba(255, 255, 255, 0.7);
    --header-bg: rgba(25, 10, 45, 0.95);
    --border-color: #ddd;
    --success-color: #4facfe;
    --danger-color: #fa709a;
    --shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    --btn-bg: white;
    --btn-text: #333;
    --btn-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

body.dark-mode {
    --bg-color: rgba(30, 30, 40, 0.5);
    --text-color: #f0f0f0;
    --panel-bg: rgba(40, 40, 50, 0.7);
    --header-bg: rgba(15, 5, 25, 0.95);
    --border-color: #444;
    --btn-bg: #2a2a3a;
    --btn-text: #f0f0f0;
}

body {
    background: url('https://loxestar.cn/image/background.jpg') no-repeat center center fixed;
    background-size: cover;
    color: var(--text-color);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    transition: background-color 0.5s ease, color 0.5s ease;
    padding: 0;
}

.container {
    width: 100%;
    height: 100vh;
    margin: 0;
    background: var(--bg-color);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    backdrop-filter: blur(10px);
    transition: all 0.5s ease;
}

header {
    background: var(--header-bg);
    color: white;
    padding: 12px 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: all 0.5s ease;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
}

.logo {
    display: flex;
    align-items: center;
    gap: 10px;
}

.logo-icon {
    font-size: 24px;
}

h1 {
    font-size: 22px;
    font-weight: 600;
}

.controls {
    display: flex;
    gap: 8px;
}

.main-content {
    display: flex;
    flex: 1;
    overflow: hidden;
}

.editor-panel, .viewer-panel {
    flex: 1;
    padding: 15px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border-color);
}

h2 {
    font-size: 18px;
    color: var(--text-color);
    font-weight: 500;
}

.editor-container {
    flex: 1;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    overflow: hidden;
    position: relative;
    background: var(--panel-bg);
    transition: all 0.5s ease;
}

.code-editor {
    width: 100%;
    height: 100%;
    padding: 12px;
    font-family: 'Consolas', 'Monaco', monospace;
    font-size: 14px;
    line-height: 1.5;
    border: none;
    outline: none;
    resize: none;
    color: var(--text-color);
    background: transparent;
    overflow: auto;
    white-space: pre;
    tab-size: 4;
}

.json-key {
    color: #881391;
    font-weight: 600;
}

.json-string {
    color: #c41a16;
}

.json-number {
    color: #1c00cf;
}

.json-boolean {
    color: #0d22aa;
}

.json-null {
    color: #808080;
}

.json-bracket {
    color: #000000;
}

body.dark-mode .json-bracket {
    color: #ffffff;
}

.json-colon {
    color: #000000;
}

body.dark-mode .json-colon {
    color: #ffffff;
}

.tree-viewer {
    flex: 1;
    overflow-y: auto;
    padding: 12px;
    background: var(--panel-bg);
    border-radius: 8px;
    border: 1px solid var(--border-color);
    transition: all 0.5s ease;
}

.json-node {
    margin-left: 16px;
    position: relative;
    overflow: hidden;
}

.json-node:before {
    content: '';
    position: absolute;
    left: -12px;
    top: 0;
    bottom: 0;
    width: 1px;
    background: var(--border-color);
}

.json-header {
    display: flex;
    align-items: center;
    min-height: 24px;
}

.toggle {
    cursor: pointer;
    color: #666;
    margin-right: 5px;
    user-select: none;
    transition: transform 0.5s ease;
    width: 16px;
    height: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.toggle.expanded {
    transform: rotate(90deg);
}

.add-btn {
    cursor: pointer;
    color: #4CAF50;
    margin-right: 5px;
    user-select: none;
    width: 16px;
    height: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    opacity: 0.7;
    transition: all 0.3s ease;
}

.add-btn:hover {
    opacity: 1;
    transform: scale(1.2);
}

.add-group-btn {
    cursor: pointer;
    color: #2196F3;
    margin-right: 5px;
    user-select: none;
    width: 24px;
    height: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    opacity: 0.7;
    transition: all 0.3s ease;
    font-size: 12px;
}

.add-group-btn:hover {
    opacity: 1;
    transform: scale(1.2);
}

.json-children {
    transition: all 0.5s ease;
    overflow: hidden;
    opacity: 1;
    transform: translateY(0);
    max-height: 10000px;
}

.json-children.collapsed {
    max-height: 0;
    opacity: 0;
    transform: translateY(-10px);
}

.toolbar {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.btn {
    padding: 8px 12px;
    border: none;
    border-radius: 6px;
    background: var(--btn-bg);
    color: var(--btn-text);
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 6px;
    box-shadow: var(--btn-shadow);
    position: relative;
    overflow: hidden;
    font-size: 13px;
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.15);
}

.btn.secondary {
    background: var(--btn-bg);
    color: var(--btn-text);
}

.btn.success {
    background: var(--btn-bg);
    color: var(--btn-text);
}

.btn.danger {
    background: var(--btn-bg);
    color: var(--btn-text);
}

.btn .ripple {
    position: absolute;
    border-radius: 50%;
    background-color: rgba(255, 255, 255, 0.7);
    transform: scale(0);
    animation: ripple 0.6s linear;
    pointer-events: none;
}

body.dark-mode .btn .ripple {
    background-color: rgba(0, 0, 0, 0.3);
}

@keyframes ripple {
    to {
        transform: scale(4);
        opacity: 0;
    }
}

.status-bar {
    padding: 8px 15px;
    background: rgba(240, 240, 240, 0.7);
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    font-size: 13px;
    color: #666;
    transition: all 0.5s ease;
    position: relative;
}

body.dark-mode .status-bar {
    background: rgba(50, 50, 60, 0.7);
    color: #aaa;
}

.error-message {
    color: #e74c3c;
    font-weight: 500;
}

.success-message {
    color: #2ecc71;
    font-weight: 500;
}

.file-input {
    display: none;
}

.file-label {
    display: inline-block;
    padding: 8px 12px;
    border-radius: 6px;
    background: var(--btn-bg);
    color: var(--btn-text);
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: var(--btn-shadow);
    position: relative;
    overflow: hidden;
    font-size: 13px;
}

.file-label:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.15);
}

.file-label .ripple {
    position: absolute;
    border-radius: 50%;
    background-color: rgba(255, 255, 255, 0.7);
    transform: scale(0);
    animation: ripple 0.6s linear;
    pointer-events: none;
}

body.dark-mode .file-label .ripple {
    background-color: rgba(0, 0, 0, 0.3);
}

.json-placeholder {
    color: #888;
    font-style: italic;
    text-align: center;
    padding: 20px;
}

.json-editable {
    outline: none;
    border-bottom: 1px dashed #ccc;
    padding: 0 2px;
    transition: all 0.2s ease;
    min-width: 20px;
    display: inline-block;
}

.json-editable:focus {
    border-bottom: 1px solid #6a11cb;
    background: rgba(106, 17, 203, 0.1);
}

body.dark-mode .json-editable:focus {
    background: rgba(106, 17, 203, 0.3);
}

.json-key-editable {
    outline: none;
    border-bottom: 1px dashed #ccc;
    padding: 0 2px;
    transition: all 0.2s ease;
    min-width: 20px;
    display: inline-block;
}

.json-key-editable:focus {
    border-bottom: 1px solid #6a11cb;
    background: rgba(106, 17, 203, 0.1);
}

body.dark-mode .json-key-editable:focus {
    background: rgba(106, 17, 203, 0.3);
}

.delete-btn {
    cursor: pointer;
    color: #e74c3c;
    margin-left: 8px;
    user-select: none;
    width: 16px;
    height: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    opacity: 0.7;
    transition: all 0.3s ease;
    border-radius: 50%;
}

.delete-btn:hover {
    opacity: 1;
    background: rgba(231, 76, 60, 0.2);
}

.delete-btn:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

.delete-btn:disabled:hover {
    background: transparent;
    transform: none;
}

#brand {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    font-weight: 500;
}

@keyframes highlight {
    0% { background-color: rgba(106, 17, 203, 0.3); }
    100% { background-color: transparent; }
}

.json-node.highlight {
    animation: highlight 1s ease;
}

@media (max-width: 900px) {
    .main-content {
        flex-direction: column;
    }
    
    .editor-panel, .viewer-panel {
        min-height: 40vh;
    }
    
    #brand {
        display: none;
    }
}

@media (max-width: 600px) {
    header {
        padding: 8px 10px;
    }
    
    h1 {
        font-size: 18px;
    }
    
    .logo-icon {
        font-size: 20px;
    }
    
    .btn, .file-label {
        padding: 6px 10px;
        font-size: 12px;
        gap: 4px;
    }
    
    .controls, .toolbar {
        gap: 5px;
    }
    
    .editor-panel, .viewer-panel {
        padding: 10px;
        min-height: 35vh;
    }
    
    h2 {
        font-size: 16px;
    }
    
    .code-editor {
        font-size: 13px;
        padding: 10px;
    }
    
    .status-bar {
        padding: 6px 10px;
        font-size: 12px;
    }
    
    .json-node {
        margin-left: 12px;
    }
    
    .json-node:before {
        left: -9px;
    }
}
