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

/* ===== CodeMirror 错误/警告 gutter 标记 ===== */

.error-gutter {
    width: 24px;
    min-width: 24px;
}

.cm-gutter-marker {
    width: 24px;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    line-height: 1;
}

.cm-gutter-error {
    background-color: #ffebee;
    color: #d32f2f;
    font-weight: bold;
}

.cm-gutter-warning {
    background-color: #fff8e1;
    color: #f57c00;
    font-weight: bold;
}

html, body {
    font-family: 'Microsoft YaHei', Arial, sans-serif;
    background-color: #f5f5f5;
    color: #333;
    height: 100vh;
    overflow: hidden;
}

.container {
    width: 100%;
    height: 100vh;
    background-color: white;
    box-shadow: 0 0 10px rgba(0,0,0,0.1);
    display: flex;
    flex-direction: column;
}

.header {
    background-color: #6a1b9a;
    color: white;
    padding: 12px 16px;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.header h1 {
    font-size: 20px;
    margin: 0;
    display: inline;
}

.header h1 .version-badge {
    font-size: 11px;
    color: rgba(255, 255, 255, 0.6);
    margin-left: 8px;
    font-weight: normal;
    font-style: normal;
}

.version-badge {
    font-size: 11px;
    color: rgba(255, 255, 255, 0.6);
    margin-left: 4px;
    font-weight: normal;
}

.menu-toggle {
    display: none;
    background: none;
    border: none;
    color: white;
    font-size: 20px;
    cursor: pointer;
    padding: 8px;
    margin-left: -8px;
}

.toolbar {
    background-color: #f0f0f0;
    padding: 6px 8px;
    border-bottom: 1px solid #ddd;
    display: flex;
    gap: 2px;
    align-items: center;
    justify-content: space-around;
    flex-wrap: nowrap;
}

.toolbar button {
    padding: 6px;
    border: 1px solid #ddd;
    border-radius: 4px;
    background-color: white;
    cursor: pointer;
    font-size: 14px;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    flex-shrink: 0;
}

.toolbar button:hover {
    background-color: #f5f5f5;
    border-color: #6a1b9a;
}

.toolbar button.primary {
    background-color: #6a1b9a;
    color: white;
    border-color: #6a1b9a;
}

.toolbar button.primary:hover {
    background-color: #5e198b;
}

.menu-bar {
    display: flex;
    align-items: center;
    gap: 2px;
}

.menu-item {
    position: relative;
}

.menu-title {
    display: flex;
    align-items: center;
    padding: 6px 14px;
    cursor: pointer;
    border-radius: 4px;
    font-size: 13px;
    transition: background-color 0.2s;
    user-select: none;
}

.menu-title:hover {
    background-color: #e8e8e8;
}

.menu-item:hover .menu-dropdown,
.menu-item.active .menu-dropdown {
    display: block;
}

.menu-dropdown {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    min-width: 180px;
    background: white;
    border: 1px solid #ddd;
    border-radius: 6px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    z-index: 1000;
    padding: 6px 0;
}

.menu-option {
    padding: 8px 16px;
    cursor: pointer;
    font-size: 13px;
    transition: background-color 0.2s;
    display: flex;
    align-items: center;
    gap: 8px;
}

.menu-option:hover {
    background-color: #f0e6ff;
    color: #6a1b9a;
}

.menu-option.menu-option-warning {
    color: #c62828;
}

.menu-option.menu-option-warning:hover {
    background-color: #ffebee;
    color: #c62828;
}

.menu-divider {
    height: 1px;
    background-color: #e0e0e0;
    margin: 6px 0;
}

.menu-option.menu-has-submenu {
    position: relative;
    justify-content: space-between;
}

.menu-option.menu-has-submenu .submenu-arrow {
    font-size: 10px;
    color: #999;
    margin-left: 8px;
    transition: transform 0.15s;
}

.menu-option.menu-has-submenu:hover .submenu-arrow {
    color: #6a1b9a;
}

.menu-submenu {
    display: none;
    position: absolute;
    top: -6px;
    left: calc(100% + 2px);
    min-width: 150px;
    background: white;
    border: 1px solid #ddd;
    border-radius: 6px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    z-index: 1001;
    padding: 6px 0;
}

.menu-has-submenu:hover .menu-submenu {
    display: block;
}

.search-container {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-left: auto;
}

.search-box {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    background: white;
    border: 1px solid #ddd;
    border-radius: 20px;
    transition: all 0.3s ease;
}

.search-box:focus-within {
    border-color: #6a1b9a;
    box-shadow: 0 0 0 3px rgba(106, 27, 154, 0.1);
}

.search-icon {
    font-size: 14px;
    opacity: 0.6;
}

.search-box input {
    width: 140px;
    padding: 2px 4px;
    border: none;
    border-radius: 4px;
    font-size: 13px;
    background: transparent;
}

.search-box input:focus {
    outline: none;
}

.search-count {
    font-size: 11px;
    color: #6a1b9a;
    font-weight: 600;
    min-width: 36px;
    text-align: center;
    background: linear-gradient(135deg, #f0e6ff, #e8d5f5);
    padding: 2px 6px;
    border-radius: 10px;
}

.search-actions {
    display: flex;
    align-items: center;
    gap: 4px;
}

.search-container .search-btn {
    padding: 5px 10px;
    width: auto;
    height: auto;
    border: 1px solid #ddd;
    background: white;
    font-size: 12px;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.search-container .search-btn:hover {
    background: #f5f5f5;
    border-color: #ccc;
}

.search-container .search-btn.search-go {
    background: linear-gradient(135deg, #6a1b9a, #8e24aa);
    color: white;
    border-color: #6a1b9a;
    font-weight: 500;
}

.search-container .search-btn.search-go:hover {
    background: linear-gradient(135deg, #5e198b, #7b1fa2);
    box-shadow: 0 2px 8px rgba(106, 27, 154, 0.3);
}

.search-container .search-btn.clear-btn {
    color: #999;
}

.search-container .search-btn.clear-btn:hover {
    background: #ffebee;
    border-color: #ef5350;
    color: #d32f2f;
}

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

.sidebar {
    width: 250px;
    background-color: #f9f9f9;
    border-right: 1px solid #ddd;
    padding: 20px;
    overflow-y: auto;
    transition: transform 0.3s ease;
}

.sidebar.mobile-hidden {
    transform: translateX(-100%);
    position: absolute;
    z-index: 100;
    height: calc(100vh - 130px);
}

.tab-button {
    padding: 10px 15px;
    border: none;
    background: none;
    cursor: pointer;
    font-size: 14px;
    color: #666;
    border-bottom: 2px solid transparent;
    transition: all 0.3s ease;
}

.tab-button:hover {
    color: #6a1b9a;
}

.tab-button.active {
    color: #6a1b9a;
    border-bottom-color: #6a1b9a;
    font-weight: bold;
}

.sidebar h3 {
    font-size: 16px;
    margin-bottom: 15px;
    color: #6a1b9a;
}

.sidebar .category {
    margin-bottom: 16px;
}

.sidebar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 1px solid #e0e0e0;
}

.sidebar-select-wrapper {
    position: relative;
}

.sidebar-select-wrapper select {
    appearance: none;
    padding: 8px 32px 8px 12px;
    font-size: 14px;
    border: 1px solid #ddd;
    border-radius: 6px;
    background: white;
    color: #333;
    cursor: pointer;
    min-width: 120px;
    transition: all 0.2s;
}

.sidebar-select-wrapper select:focus {
    outline: none;
    border-color: #6a1b9a;
    box-shadow: 0 0 0 3px rgba(106, 27, 154, 0.1);
}

.sidebar-select-wrapper::after {
    content: '▼';
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 10px;
    color: #999;
    pointer-events: none;
}

.sidebar-content {
    overflow-y: auto;
}

.toggle-all-btn {
    padding: 4px 10px;
    font-size: 11px;
    border: 1px solid #ddd;
    border-radius: 4px;
    background: #f5f5f5;
    color: #666;
    cursor: pointer;
    transition: all 0.2s;
}

.toggle-all-btn:hover {
    background: #6a1b9a;
    color: white;
    border-color: #6a1b9a;
}

.category-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    background: linear-gradient(135deg, #f8f8f8, #f0f0f0);
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
    margin-bottom: 8px;
}

.category-header:hover {
    background: linear-gradient(135deg, #f0e6ff, #e8d5f5);
}

.category-toggle {
    font-size: 10px;
    color: #6a1b9a;
    transition: transform 0.2s;
}

.category-items {
    padding-left: 8px;
}

.sidebar .category h4 {
    font-size: 13px;
    margin: 0;
    color: #555;
    font-weight: 600;
}

.sidebar .snippet {
    padding: 12px;
    margin-bottom: 8px;
    background-color: white;
    border: 1px solid #ddd;
    border-radius: 6px;
    cursor: pointer;
    font-size: 12px;
    transition: all 0.3s ease;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
    display: flex;
    align-items: center;
}

.sidebar .snippet:hover {
    background-color: #f0e6ff;
    border-color: #6a1b9a;
    box-shadow: 0 4px 8px rgba(106, 27, 154, 0.1);
    transform: translateY(-1px);
}

.snippet-icon {
    width: 16px;
    height: 16px;
    margin-right: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
}

.command-desc {
    color: #888;
    font-size: 12px;
    font-style: italic;
    margin-left: 8px;
}

.shortcut-badge {
    display: inline-block;
    padding: 2px 6px;
    background: linear-gradient(135deg, #6a1b9a, #8e24aa);
    color: white;
    font-size: 10px;
    font-weight: 600;
    border-radius: 4px;
    margin-left: 8px;
    font-family: monospace;
    vertical-align: middle;
}

.sidebar .snippet {
    position: relative;
    flex-wrap: wrap;
}

.sidebar .snippet .shortcut-badge {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
}

.cookie-actions {
    display: flex;
    gap: 10px;
    padding: 10px 15px;
    background: #f5f5f5;
    border-top: 1px solid #ddd;
}

.cookie-actions button {
    padding: 8px 16px;
    border: 1px solid #6a1b9a;
    border-radius: 6px;
    background: white;
    color: #6a1b9a;
    cursor: pointer;
    font-size: 13px;
    transition: all 0.2s;
}

.cookie-actions button:hover {
    background: #6a1b9a;
    color: white;
}

.editor {
    flex: 1;
    min-height: 0;
    padding: 20px;
    display: flex;
    flex-direction: column;
}

.editor-tabs {
    display: flex;
    border-bottom: 1px solid #ddd;
    margin-bottom: 15px;
}

.editor-tab-content {
    flex: 1;
    min-height: 0;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.editor-wrapper {
    display: flex;
    flex: 1;
    min-height: 0;
    border: 1px solid #ddd;
    border-radius: 4px;
    overflow: hidden;
}

.CodeMirror,
.editor-highlight,
.editor textarea {
    font-family: 'Courier New', monospace;
    font-size: 14px;
    line-height: 1.5;
}

.CodeMirror {
    flex: 1;
    min-height: 0;
    height: auto;
    box-sizing: border-box;
}

.CodeMirror pre {
    padding: 15px;
}

.CodeMirror-scroll {
    padding: 0 !important;
    height: 100% !important;
}

.code-editor {
    flex: 1;
    min-width: 0;
    min-height: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.CodeMirror-sizer {
    min-height: 100% !important;
    box-sizing: border-box !important;
}

.line-numbers.hidden {
    display: none;
}

.highlight-container {
    position: relative;
    flex: 1;
    min-width: 0;
    overflow: hidden;
}

.editor-highlight {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    padding: 15px;
    overflow: hidden;
    white-space: pre-wrap;
    word-break: break-word;
    pointer-events: none;
    color: transparent;
}

.editor textarea {
    flex: 1;
    position: relative;
    width: 100%;
    height: 100%;
    padding: 15px;
    border: none;
    resize: none;
    overflow: auto;
    background: transparent;
    color: transparent;
    caret-color: #333;
    text-shadow: 0 0 0 #333;
}

.editor textarea::selection {
    background: rgba(100, 149, 237, 0.3);
}

.line-numbers {
    flex-shrink: 0;
    padding: 15px 5px;
    background-color: #f5f5f5;
    color: #999;
    text-align: right;
    font-family: 'Courier New', monospace;
    font-size: 14px;
    line-height: 1.5;
    user-select: none;
    overflow: hidden;
    min-width: 50px;
}

.line-numbers .line-number {
    display: block;
    padding: 0 5px;
}

.line-numbers .line-number.error-line {
    background-color: #ffebee;
    color: #d32f2f;
    font-weight: bold;
}

.line-numbers .line-number.warning-line {
    background-color: #fff8e1;
    color: #f57c00;
    font-weight: bold;
}

.editor-wrapper:focus-within {
    border-color: #6a1b9a;
    box-shadow: 0 0 0 2px rgba(106, 27, 154, 0.1);
}

.editor textarea.highlight {
    background: #fffde7;
}

.search-highlight {
    background-color: #ffeb3b;
    border-radius: 2px;
    padding: 0 2px;
    margin: 0 -2px;
}

.search-highlight.current {
    background-color: #ff9800;
    box-shadow: 0 0 0 2px #ff9800;
}

.parsed-script {
    height: 100%;
    overflow-y: auto;
    padding: 15px;
    background-color: #f9f9f9;
    border: 1px solid #ddd;
    border-radius: 4px;
}

.parsed-line {
    padding: 10px;
    margin-bottom: 8px;
    background-color: white;
    border: 1px solid #ddd;
    border-radius: 4px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.parsed-line.command {
    border-left: 4px solid #6a1b9a;
}

.parsed-line.dialogue {
    border-left: 4px solid #4caf50;
}

.parsed-line.narration {
    border-left: 4px solid #2196f3;
}

.parsed-line.comment {
    border-left: 4px solid #9e9e9e;
    background-color: #f5f5f5;
}

.parsed-line.comment .line-type {
    color: #9e9e9e;
}

.parsed-line .line-type {
    font-weight: bold;
    margin-right: 10px;
    color: #6a1b9a;
}

.parsed-line .line-content {
    color: #333;
    margin-left: 8px;
}

.reading-script {
    height: 100%;
    overflow-y: auto;
    padding: 24px 32px;
    background-color: #f5f0fa;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 16px;
    line-height: 1.8;
    text-align: left;
}

.reading-lines {
    max-width: 700px;
    margin: 0;
}

.reading-line {
    padding: 4px 0;
}

.reading-dialogue {
    margin: 6px 0;
}

.reading-narration {
    color: #555;
    font-style: italic;
    margin: 8px 0;
    padding-left: 4px;
    border-left: 3px solid #bbb;
}

.reading-script-info {
    color: #bbb;
    font-size: 13px;
    margin: 1px 0;
    padding: 1px 0 1px 8px;
    user-select: none;
    line-height: 1.3;
}

.reading-character {
    color: #6a1b9a;
    font-weight: bold;
    font-size: 17px;
}

.reading-quote {
    color: #8e44ad;
    font-weight: bold;
}

.reading-dialogue-text {
    color: #333;
}

.reading-spacer {
    height: 12px;
}

.footer {
    background-color: #f0f0f0;
    padding: 15px 20px;
    border-top: 1px solid #ddd;
    text-align: center;
    font-size: 12px;
    color: #666;
}

/* ===== 警告弹窗（自定义模糊背景 + 渐入动画） ===== */

.warning-overlay {
    display: none;
    position: fixed;
    z-index: 2000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.55);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    justify-content: center;
    align-items: center;
    animation: warningFadeIn 0.25s ease;
}

.warning-overlay.show {
    display: flex;
}

.warning-modal {
    background: white;
    border-radius: 12px;
    width: 90%;
    max-width: 520px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: warningSlideIn 0.3s ease;
    overflow: hidden;
}

.warning-header {
    background: linear-gradient(135deg, #c62828, #e53935);
    padding: 20px 24px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.warning-header .warning-icon {
    font-size: 28px;
    line-height: 1;
}

.warning-header .warning-title {
    color: white;
    font-size: 18px;
    font-weight: 700;
    margin: 0;
    text-shadow: 0 1px 2px rgba(0,0,0,0.2);
}

.warning-body {
    padding: 24px;
    color: #333;
    font-size: 14px;
    line-height: 1.7;
}

.warning-body .warning-desc {
    margin: 0 0 12px 0;
    font-weight: 600;
    color: #c62828;
}

.warning-body .warning-list {
    margin: 0 0 16px 0;
    padding-left: 20px;
}

.warning-body .warning-list li {
    margin-bottom: 4px;
    color: #555;
}

.warning-body .warning-hint {
    margin: 0;
    padding: 10px 14px;
    background: #fff3e0;
    border-left: 3px solid #ff9800;
    border-radius: 4px;
    font-size: 13px;
    color: #e65100;
}

.warning-footer {
    padding: 12px 24px 20px;
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

.warning-footer .wbtn {
    padding: 8px 24px;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s;
    font-weight: 600;
}

.warning-footer .wbtn-cancel {
    background: #e0e0e0;
    color: #333;
}

.warning-footer .wbtn-cancel:hover {
    background: #bdbdbd;
}

.warning-footer .wbtn-confirm {
    background: linear-gradient(135deg, #c62828, #e53935);
    color: white;
    box-shadow: 0 2px 8px rgba(198, 40, 40, 0.3);
}

.warning-footer .wbtn-confirm:hover {
    box-shadow: 0 4px 14px rgba(198, 40, 40, 0.4);
    transform: translateY(-1px);
}

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

@keyframes warningSlideIn {
    from {
        opacity: 0;
        transform: translateY(-30px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* ===== 原有 modal 样式 ===== */

.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.5);
    justify-content: center;
    align-items: center;
}

.modal.show {
    display: flex;
}

.modal-content {
    background-color: white;
    padding: 20px;
    border-radius: 8px;
    width: 80%;
    max-width: 600px;
    max-height: 80vh;
    overflow-y: auto;
}

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

.modal-header h3 {
    color: #6a1b9a;
}

.modal-header .close {
    font-size: 24px;
    cursor: pointer;
    color: #999;
}

.modal-body {
    margin-bottom: 20px;
}

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

.form-group label {
    display: block;
    margin-bottom: 5px;
    font-size: 14px;
    color: #555;
}

.form-group label .required {
    color: #ff0000;
    margin-left: 4px;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
}

.modal-description {
    padding: 10px;
    margin-bottom: 15px;
    background-color: #f0f0f0;
    border-left: 3px solid #6a1b9a;
    border-radius: 4px;
    color: #555;
    font-size: 13px;
    line-height: 1.6;
}

.modal-description img {
    max-width: 100%;
    height: auto;
    margin: 8px 0;
    border-radius: 4px;
}

.modal-description audio {
    width: 100%;
    margin: 8px 0;
}

.modal-description a {
    color: #6a1b9a;
    text-decoration: underline;
}

.modal-description a:hover {
    color: #8e24aa;
}

.modal-description b,
.modal-description strong {
    font-weight: 600;
}

.modal-description u {
    text-decoration: underline;
}

.form-group textarea {
    height: 100px;
    resize: vertical;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

.success-message {
    position: fixed;
    top: 20px;
    right: 20px;
    background-color: #4caf50;
    color: white;
    padding: 15px 20px;
    border-radius: 4px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
    display: none;
    z-index: 1001;
    opacity: 0;
    transform: translateY(-10px);
    transition: all 0.3s ease;
}

.success-message.show {
    opacity: 1;
    transform: translateY(0);
}

.error-message {
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background-color: #f44336;
    color: white;
    padding: 14px 28px;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(244, 67, 54, 0.4);
    display: none;
    z-index: 2000;
    font-size: 14px;
    font-weight: 500;
    opacity: 0;
    transition: all 0.3s ease;
    white-space: nowrap;
}

.error-message.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

.command-tooltip {
    position: fixed;
    background-color: #fff;
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 12px 14px;
    box-shadow: 0 6px 20px rgba(0,0,0,0.2);
    z-index: 1002;
    max-width: 480px;
    min-width: 280px;
    font-size: 13px;
    display: none;
}

.command-tooltip .tooltip-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
    padding-bottom: 8px;
    border-bottom: 2px solid #f0e6ff;
}

.command-tooltip .tooltip-title {
    font-weight: bold;
    color: #6a1b9a;
    font-size: 15px;
}

.command-tooltip .tooltip-overload-count {
    font-size: 11px;
    color: #8e44ad;
    background: #f3e8ff;
    padding: 1px 8px;
    border-radius: 10px;
    font-weight: 500;
    display: none;
}

.command-tooltip .tooltip-pin-btn {
    font-size: 11px;
    color: #aaa;
    background: transparent;
    padding: 1px 6px;
    border-radius: 4px;
    cursor: pointer;
    user-select: none;
    margin-left: auto;
    border: 1px solid #ddd;
    transition: all 0.2s ease;
    flex-shrink: 0;
    line-height: 1.4;
}

.command-tooltip .tooltip-pin-btn:hover {
    color: #666;
    border-color: #bbb;
    background: #f5f5f5;
}

.command-tooltip .tooltip-pin-btn.pinned {
    color: #fff;
    background: #6a1b9a;
    border-color: #6a1b9a;
    box-shadow: 0 0 8px rgba(106, 27, 154, 0.4);
}

.command-tooltip .tooltip-pin-btn.pinned:hover {
    background: #7b1fa2;
    border-color: #7b1fa2;
}

.command-tooltip .tooltip-content {
    color: #666;
    line-height: 1.5;
    max-height: 400px;
    overflow-y: auto;
}

.tooltip-overloads {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.tooltip-overload-item {
    border: 1px solid #eee;
    border-radius: 6px;
    overflow: hidden;
    transition: border-color 0.2s;
}

.tooltip-overload-item:hover {
    border-color: #d5b8e8;
}

.tooltip-overload-item.best-match {
    border-color: #6a1b9a;
    background: #faf5ff;
}

.tooltip-overload-header {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 8px;
    cursor: pointer;
    user-select: none;
    transition: background-color 0.15s;
}

.tooltip-overload-header:hover {
    background-color: #f5f0fa;
}

.tooltip-overload-toggle {
    font-size: 10px;
    color: #999;
    width: 12px;
    text-align: center;
    flex-shrink: 0;
}

.tooltip-overload-icon {
    font-size: 14px;
    flex-shrink: 0;
}

.tooltip-overload-name {
    font-weight: 500;
    color: #333;
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.tooltip-overload-category {
    font-size: 11px;
    color: #999;
    background: #f5f5f5;
    padding: 1px 6px;
    border-radius: 8px;
    flex-shrink: 0;
}

.tooltip-best-badge {
    font-size: 10px;
    color: #fff;
    background: #6a1b9a;
    padding: 1px 6px;
    border-radius: 8px;
    font-weight: 500;
    flex-shrink: 0;
}

.tooltip-overload-body {
    padding: 6px 8px 8px 26px;
    border-top: 1px solid #f0e6ff;
    background: #fcfaff;
}

.tooltip-overload-output {
    margin-bottom: 6px;
    font-size: 12px;
}

.tooltip-overload-output .tooltip-code {
    background: #f3e8ff;
    padding: 1px 6px;
    border-radius: 3px;
    font-size: 12px;
    color: #6a1b9a;
    word-break: break-all;
}

.tooltip-overload-params {
    margin-top: 4px;
}

.tooltip-label {
    font-size: 12px;
    color: #999;
    font-weight: 500;
}

.tooltip-required {
    font-size: 10px;
    color: #e74c3c;
    font-weight: normal;
}

.tooltip-no-params {
    font-size: 12px;
    color: #bbb;
    font-style: italic;
    padding: 2px 0;
}

.command-tooltip .tooltip-param {
    display: flex;
    gap: 8px;
    margin: 3px 0;
    font-size: 12px;
    align-items: baseline;
}

.command-tooltip .tooltip-param-name {
    color: #d35400;
    font-weight: 500;
    white-space: nowrap;
}

.command-tooltip .tooltip-param-desc {
    color: #888;
    font-size: 11px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.command-tooltip .tooltip-placeholder {
    font-size: 10px;
    color: #6a1b9a;
    background: #f3e8ff;
    padding: 0 4px;
    border-radius: 3px;
    font-weight: 600;
    margin-left: 2px;
    font-family: monospace;
}

.tooltip-overload-edit-btn {
    display: none;
    margin-top: 10px;
    padding: 4px 14px;
    font-size: 12px;
    background: #4a90d9;
    color: #fff;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: background 0.2s;
}

.tooltip-overload-edit-btn:hover {
    background: #357abd;
}

.command-tooltip.pinned .tooltip-overload-edit-btn {
    display: inline-block;
}

.cm-s-default .cm-bool {
    color: #d05;
}

.cm-s-default .cm-html-muted {
    color: #9e9e9e;
}

.cm-s-default .cm-atom {
    color: #1a7fb5;
}

.syntax-comment {
    color: #9e9e9e;
}

.syntax-at {
    color: #8e44ad;
    font-weight: bold;
}

.syntax-command-name {
    color: #6a1b9a;
    font-weight: bold;
}

.syntax-attr-key {
    color: #d35400;
}

.syntax-attr-operator {
    color: #333;
}

.syntax-string {
    color: #8e44ad;
}

.syntax-number {
    color: #2471a3;
}

.syntax-boolean {
    color: #16a085;
    font-weight: bold;
}

.syntax-identifier {
    color: #34495e;
}

.syntax-dialogue-character {
    color: #2e7d32;
    font-weight: 600;
}

.version-old {
    margin: 12px 0;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    overflow: hidden;
    background: #fafafa;
}

.version-old summary {
    padding: 10px 14px;
    cursor: pointer;
    background: #f0f0f0;
    user-select: none;
    list-style: none;
    display: flex;
    align-items: center;
    gap: 6px;
}

.version-old summary::-webkit-details-marker {
    display: none;
}

.version-old summary::before {
    content: '▶';
    font-size: 11px;
    color: #888;
    transition: transform 0.15s;
}

.version-old[open] summary::before {
    transform: rotate(90deg);
}

.version-old summary h2 {
    display: inline;
    font-size: 14px;
    margin: 0;
    padding: 0;
    border: none;
    color: #555;
}

.version-old summary:hover {
    background: #e8e8e8;
}

.version-old > :not(summary) {
    padding: 4px 14px 10px;
}

.syntax-dialogue-text {
    color: #1e88e5;
}

.syntax-operator {
    color: #555;
}

.syntax-narration {
    color: #2196f3;
}

.modal-btn {
    padding: 10px 20px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.2s;
    border: none;
    font-weight: 500;
}

.modal-btn-secondary {
    background-color: #f5f5f5;
    color: #333;
    border: 1px solid #ddd;
}

.modal-btn-secondary:hover {
    background-color: #e0e0e0;
    border-color: #ccc;
}

.modal-btn-primary {
    background: linear-gradient(135deg, #6a1b9a, #8e24aa);
    color: white;
    box-shadow: 0 4px 12px rgba(106, 27, 154, 0.3);
}

.modal-btn-primary:hover {
    background: linear-gradient(135deg, #5e198b, #7b1fa2);
    box-shadow: 0 6px 16px rgba(106, 27, 154, 0.4);
    transform: translateY(-1px);
}

.modal-btn-danger {
    background: linear-gradient(135deg, #f44336, #d32f2f);
    color: white;
    box-shadow: 0 4px 12px rgba(244, 67, 54, 0.3);
}

.modal-btn-danger:hover {
    background: linear-gradient(135deg, #d32f2f, #c62828);
    box-shadow: 0 6px 16px rgba(244, 67, 54, 0.4);
    transform: translateY(-1px);
}

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

.replace-info {
    margin-top: 12px;
    padding: 10px;
    background-color: #f5f5f5;
    border-radius: 4px;
    font-size: 13px;
    color: #666;
    text-align: center;
}

.replace-info .match-count {
    font-weight: bold;
    color: #6a1b9a;
}

.replace-info .no-match {
    color: #d32f2f;
}

.format-select {
    display: flex;
    gap: 20px;
    margin-top: 8px;
}

.radio-label {
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    padding: 8px 16px;
    border: 1px solid #ddd;
    border-radius: 6px;
    transition: all 0.2s;
}

.radio-label:hover {
    border-color: #6a1b9a;
    background: #f0e6ff;
}

.radio-label input[type="radio"] {
    width: 16px;
    height: 16px;
    accent-color: #6a1b9a;
}

.radio-label input[type="radio"]:checked + span {
    color: #6a1b9a;
    font-weight: 600;
}

.radio-label:has(input:checked) {
    border-color: #6a1b9a;
    background: linear-gradient(135deg, #f0e6ff, #e8d5f5);
}

.shift-hint {
    position: fixed;
    bottom: 60px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: linear-gradient(135deg, #ff9800, #f57c00);
    color: white;
    padding: 12px 24px;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(255, 152, 0, 0.4);
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 14px;
    font-weight: 500;
    z-index: 2000;
    opacity: 0;
    transition: all 0.3s ease;
    pointer-events: none;
}

.shift-hint.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

.shift-icon {
    font-size: 18px;
    animation: pulse 1s infinite;
}

@keyframes pulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.2);
    }
}

.modal-content-large {
    width: 90%;
    max-width: 900px;
    max-height: 85vh;
    overflow-y: hidden;
}

.modal-content-large .modal-body {
    max-height: 65vh;
    overflow-y: auto;
}

.markdown-content {
    line-height: 1.6;
    color: #333;
}

.markdown-content h1 {
    font-size: 24px;
    margin: 20px 0 12px;
    color: #6a1b9a;
    padding-bottom: 8px;
    border-bottom: 2px solid #6a1b9a;
}

.markdown-content h2 {
    font-size: 20px;
    margin: 18px 0 10px;
    color: #6a1b9a;
}

.markdown-content h3 {
    font-size: 17px;
    margin: 14px 0 8px;
    color: #5e198b;
}

.markdown-content p {
    margin: 8px 0;
}

.markdown-content ul, .markdown-content ol {
    margin: 8px 0;
    padding-left: 24px;
}

.markdown-content li {
    margin: 4px 0;
}

.markdown-content strong {
    color: #6a1b9a;
}

.markdown-content code {
    background: #f0e6ff;
    color: #6a1b9a;
    padding: 2px 6px;
    border-radius: 4px;
    font-family: 'Courier New', monospace;
}

.markdown-content table {
    width: 100%;
    border-collapse: collapse;
    margin: 12px 0;
}

.markdown-content th, .markdown-content td {
    border: 1px solid #ddd;
    padding: 8px 12px;
    text-align: left;
}

.markdown-content th {
    background: #f0e6ff;
    color: #6a1b9a;
    font-weight: 600;
}

.markdown-content blockquote {
    border-left: 4px solid #6a1b9a;
    padding-left: 16px;
    margin: 10px 0;
    color: #666;
    background: #faf5ff;
    padding: 12px 16px;
    border-radius: 0 6px 6px 0;
}

.markdown-content hr {
    border: none;
    border-top: 2px solid #e0d4f0;
    margin: 20px 0;
}

@media (max-width: 768px) {
    .menu-toggle {
        display: block;
    }

    .header {
        padding: 10px 12px;
    }

    .header h1 {
        font-size: 16px;
        margin-left: 8px;
    }

    .sidebar {
        position: absolute;
        z-index: 100;
        height: calc(100vh - 130px);
    }

    .sidebar.mobile-hidden {
        transform: translateX(-100%);
    }

    .toolbar {
        flex-wrap: wrap;
    }

    .menu-bar {
        flex-wrap: wrap;
    }

    .search-container {
        width: 100%;
        justify-content: center;
        margin-top: 8px;
    }

    .search-box input {
        width: 100px;
    }
}

.theme-select {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    margin-top: 8px;
}

.theme-option {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 12px;
    border: 2px solid #ddd;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
}

.theme-option:hover {
    border-color: #6a1b9a;
    background-color: #f0e6ff;
}

.theme-option input[type="radio"] {
    display: none;
}

.theme-option:has(input[type="radio"]:checked) {
    border-color: #6a1b9a;
    background: linear-gradient(135deg, #f0e6ff, #e8d5f5);
}

.theme-preview {
    width: 60px;
    height: 40px;
    border-radius: 4px;
    border: 1px solid #ccc;
}

.theme-preview-default {
    background: linear-gradient(135deg, #ffffff, #f5f5f5);
}

.theme-preview-eye-protection {
    background: linear-gradient(135deg, #C7EDCC, #E8F7EB);
}

.theme-preview-dark-blue {
    background: linear-gradient(135deg, #16213e, #0f3460);
}

.theme-preview-light-blue {
    background: linear-gradient(135deg, #ffffff, #e3f2fd);
}

.theme-name {
    font-size: 13px;
    font-weight: 500;
    color: #333;
}

input[type="color"] {
    width: 60px;
    height: 36px;
    padding: 0;
    border: 1px solid #ddd;
    border-radius: 4px;
    cursor: pointer;
}

input[type="color"]::-webkit-color-swatch-wrapper {
    padding: 2px;
}

input[type="color"]::-webkit-color-swatch {
    border: none;
    border-radius: 2px;
}

input[type="color"]::-moz-color-swatch {
    border: none;
    border-radius: 2px;
}

/* --- 分类快速输入样式 --- */

.cq-input {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 14px;
    transition: border-color 0.2s;
    box-sizing: border-box;
}

.cq-input:focus {
    outline: none;
    border-color: #6a1b9a;
    box-shadow: 0 0 0 3px rgba(106, 27, 154, 0.1);
}

.cq-btn {
    padding: 8px 16px;
    border: 1px solid #ddd;
    border-radius: 6px;
    background: white;
    color: #333;
    cursor: pointer;
    font-size: 13px;
    transition: all 0.2s;
    font-family: 'Microsoft YaHei', Arial, sans-serif;
}

.cq-btn:hover {
    background: #f5f5f5;
    border-color: #ccc;
}

.cq-btn-sm {
    padding: 3px 8px;
    font-size: 12px;
    border-radius: 4px;
}

.cq-btn-primary {
    background: linear-gradient(135deg, #6a1b9a, #8e24aa);
    color: white;
    border-color: #6a1b9a;
}

.cq-btn-primary:hover {
    background: linear-gradient(135deg, #5e198b, #7b1fa2);
    box-shadow: 0 2px 8px rgba(106, 27, 154, 0.3);
}

.cq-btn-danger {
    background: white;
    color: #d32f2f;
    border-color: #ef9a9a;
}

.cq-btn-danger:hover {
    background: #ffebee;
    border-color: #ef5350;
}

.cq-groups-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 12px;
}

.cq-group-card {
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    overflow: hidden;
    background: white;
    transition: box-shadow 0.2s;
}

.cq-group-card:hover {
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

.cq-group-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    background: linear-gradient(135deg, #faf5ff, #f5f0fa);
    cursor: pointer;
    user-select: none;
    transition: background 0.15s;
}

.cq-group-header:hover {
    background: linear-gradient(135deg, #f0e6ff, #e8d5f5);
}

.cq-group-toggle {
    font-size: 10px;
    color: #6a1b9a;
    width: 14px;
    text-align: center;
    flex-shrink: 0;
    transition: transform 0.15s;
}

.cq-group-prefix-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    background: linear-gradient(135deg, #6a1b9a, #8e24aa);
    color: white;
    font-weight: bold;
    font-size: 14px;
    border-radius: 6px;
    flex-shrink: 0;
    font-family: monospace;
}

.cq-group-name {
    font-weight: 600;
    font-size: 14px;
    color: #333;
    flex: 1;
}

.cq-group-count {
    font-size: 12px;
    color: #888;
    background: #f0f0f0;
    padding: 2px 10px;
    border-radius: 12px;
    flex-shrink: 0;
}

.cq-group-actions {
    display: flex;
    gap: 4px;
    flex-shrink: 0;
}

.cq-group-body {
    border-top: 1px solid #f0e6ff;
    padding: 12px 14px;
    background: #fcfaff;
}

.cq-items-container {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.cq-items-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 13px;
    color: #666;
}

.cq-items-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
    max-height: 200px;
    overflow-y: auto;
}

.cq-item-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 6px 10px;
    background: white;
    border: 1px solid #eee;
    border-radius: 4px;
    transition: background 0.15s;
}

.cq-item-row:hover {
    background: #faf5ff;
    border-color: #e0d4f0;
}

.cq-item-text {
    font-size: 13px;
    color: #333;
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.cq-item-adding {
    background: #fafffa;
    border-color: #c8e6c9;
    gap: 6px;
}

.cq-item-input {
    flex: 1;
    padding: 4px 8px;
    border: 1px solid #c8e6c9;
    border-radius: 4px;
    font-size: 13px;
    outline: none;
}

.cq-item-input:focus {
    border-color: #6a1b9a;
    box-shadow: 0 0 0 2px rgba(106, 27, 154, 0.1);
}

.cq-empty-hint {
    padding: 16px;
    text-align: center;
    color: #bbb;
    font-size: 13px;
    font-style: italic;
}

.cq-batch-add {
    margin-top: 4px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.cq-batch-textarea {
    width: 100%;
    height: 60px;
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 13px;
    resize: vertical;
    box-sizing: border-box;
    font-family: 'Microsoft YaHei', Arial, sans-serif;
}

.cq-batch-textarea:focus {
    outline: none;
    border-color: #6a1b9a;
    box-shadow: 0 0 0 3px rgba(106, 27, 154, 0.1);
}

.cq-actions-bar {
    display: flex;
    gap: 8px;
    padding-top: 8px;
    border-top: 1px solid #eee;
}

.qi-tab {
    flex: 1;
    padding: 8px 16px;
    border: none;
    background: transparent;
    color: #888;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    font-family: 'Microsoft YaHei', Arial, sans-serif;
}

.qi-tab:hover {
    color: #6a1b9a;
    background: #faf5ff;
}

.qi-tab.qi-tab-active {
    color: #6a1b9a;
    border-bottom-color: #6a1b9a;
    font-weight: 600;
}

.CodeMirror-hint-category-header {
    color: #6a1b9a !important;
    font-size: 12px !important;
    font-weight: 600 !important;
    background: #faf5ff !important;
    border-bottom: 1px solid #e0d4f0 !important;
    padding: 4px 8px !important;
    cursor: default !important;
    pointer-events: none !important;
}

.CodeMirror-hint-category-header:hover {
    background: #faf5ff !important;
    color: #6a1b9a !important;
}

.CodeMirror-hint-category-header.CodeMirror-hint-active {
    background: #faf5ff !important;
    color: #6a1b9a !important;
}

/* 补全窗口永远在最前面（高于命令悬浮窗 z-index:1002） */
.CodeMirror-hints {
    z-index: 2001 !important;
}
