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

body {
    font-family: "Microsoft YaHei", "SimSun", sans-serif;
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    padding: 20px;
    min-height: 100vh;
}

.header {
    text-align: center;
    margin-bottom: 30px;
    padding: 20px;
    background: white;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.header h1 {
    font-size: 2.5em;
    color: #2c3e50;
    margin-bottom: 10px;
}

.header p {
    color: #7f8c8d;
    font-size: 1.1em;
}

.toolbar {
    background: white;
    border-radius: 10px;
    padding: 15px 20px;
    margin-bottom: 20px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
    align-items: center;
}

.toolbar-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.95em;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    gap: 5px;
}

.toolbar-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.toolbar-btn.secondary {
    background: #f8f9fa;
    color: #667eea;
    border: 1px solid #667eea;
}

.toolbar-btn.secondary:hover {
    background: #667eea;
    color: white;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
}

.section {
    background: white;
    margin-bottom: 20px;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    overflow: hidden;
}

.section-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 15px 20px;
    font-size: 1.3em;
    font-weight: bold;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.bookmark-section-btn {
    background: rgba(255,255,255,0.2);
    border: 1px solid rgba(255,255,255,0.5);
    color: white;
    padding: 5px 12px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 0.8em;
    transition: all 0.2s;
}

.bookmark-section-btn:hover {
    background: rgba(255,255,255,0.3);
}

.content-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0;
}

.original {
    padding: 20px;
    border-right: 2px solid #e0e0e0;
    background: #fafafa;
}

.translation {
    padding: 20px;
    background: #f0f8ff;
}

.label {
    display: inline-block;
    padding: 5px 15px;
    border-radius: 20px;
    font-size: 0.9em;
    font-weight: bold;
    margin-bottom: 15px;
}

.label-original {
    background: #e3f2fd;
    color: #1976d2;
}

.label-translation {
    background: #f3e5f5;
    color: #7b1fa2;
}

.text {
    line-height: 2;
    font-size: 1.05em;
    text-align: justify;
    cursor: text;
    user-select: text;
}

.original .text {
    color: #2c3e50;
    font-family: "SimSun", "KaiTi", serif;
}

.translation .text {
    color: #34495e;
}

.highlight-yellow { background: #fff3cd; }
.highlight-green { background: #d4edda; }
.highlight-blue { background: #cce5ff; }
.highlight-pink { background: #f8d7da; }
.highlight-purple { background: #e2d4f0; }

.annotation-mark {
    border-bottom: 2px dashed #667eea;
    cursor: pointer;
    position: relative;
}

.annotation-tooltip {
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: #333;
    color: white;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 0.85em;
    white-space: nowrap;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.2s;
    margin-bottom: 5px;
}

.annotation-mark:hover .annotation-tooltip {
    opacity: 1;
    visibility: visible;
}

.annotation-tooltip::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 5px solid transparent;
    border-top-color: #333;
}

@media (max-width: 768px) {
    .content-row {
        grid-template-columns: 1fr;
    }
    
    .original {
        border-right: none;
        border-bottom: 2px solid #e0e0e0;
    }
    
    .header h1 {
        font-size: 1.8em;
    }
    
    .toolbar {
        justify-content: center;
    }
}

.scroll-top {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 50px;
    height: 50px;
    background: #667eea;
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 2px 10px rgba(0,0,0,0.2);
    transition: all 0.3s;
    font-size: 1.5em;
    z-index: 100;
}

.scroll-top:hover {
    background: #764ba2;
    transform: translateY(-3px);
}

.chapter-selector {
    background: white;
    border-radius: 10px;
    padding: 15px 20px;
    margin-bottom: 20px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    display: flex;
    align-items: center;
    gap: 15px;
}

.chapter-selector label {
    font-weight: bold;
    color: #2c3e50;
    font-size: 1.1em;
}

.chapter-selector select {
    flex: 1;
    padding: 10px 15px;
    border: 2px solid #667eea;
    border-radius: 6px;
    font-size: 1em;
    color: #2c3e50;
    background: white;
    cursor: pointer;
    max-width: 400px;
}

.chapter-selector select:focus {
    outline: none;
    border-color: #764ba2;
}

.chapter-content {
    display: none;
}

.chapter-content.active {
    display: block;
}

.nav-menu {
    position: fixed;
    right: 20px;
    top: 50%;
    transform: translateY(-50%);
    background: white;
    border-radius: 10px;
    padding: 10px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    max-height: 70vh;
    overflow-y: auto;
    z-index: 100;
}

.nav-menu a {
    display: block;
    padding: 8px 12px;
    color: #667eea;
    text-decoration: none;
    border-radius: 5px;
    margin-bottom: 5px;
    font-size: 0.9em;
    transition: all 0.2s;
}

.nav-menu a:hover {
    background: #667eea;
    color: white;
}

@media (max-width: 1200px) {
    .nav-menu {
        display: none;
    }
}

.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s;
}

.modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.modal {
    background: white;
    border-radius: 12px;
    padding: 30px;
    max-width: 500px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
    transform: scale(0.9);
    transition: all 0.3s;
}

.modal-overlay.active .modal {
    transform: scale(1);
}

.modal h2 {
    color: #2c3e50;
    margin-bottom: 20px;
    font-size: 1.5em;
}

.modal-close {
    position: absolute;
    top: 15px;
    right: 15px;
    background: none;
    border: none;
    font-size: 1.5em;
    cursor: pointer;
    color: #999;
}

.modal-close:hover {
    color: #333;
}

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

.form-group label {
    display: block;
    margin-bottom: 8px;
    color: #555;
    font-weight: bold;
}

.form-group input,
.form-group textarea,
.form-group select {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 1em;
    font-family: inherit;
}

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

.color-options {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.color-option {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    border: 3px solid transparent;
    transition: all 0.2s;
}

.color-option:hover,
.color-option.selected {
    border-color: #333;
    transform: scale(1.1);
}

.modal-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    margin-top: 20px;
}

.btn {
    padding: 10px 20px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.95em;
    transition: all 0.2s;
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.btn-primary:hover {
    opacity: 0.9;
}

.btn-secondary {
    background: #f8f9fa;
    color: #666;
    border: 1px solid #ddd;
}

.btn-secondary:hover {
    background: #e9ecef;
}

.btn-danger {
    background: #dc3545;
    color: white;
}

.btn-danger:hover {
    background: #c82333;
}

.list-item {
    background: #f8f9fa;
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 10px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: all 0.2s;
}

.list-item:hover {
    background: #e9ecef;
}

.list-item-content {
    flex: 1;
}

.list-item-title {
    font-weight: bold;
    color: #2c3e50;
    margin-bottom: 5px;
}

.list-item-desc {
    color: #666;
    font-size: 0.9em;
}

.list-item-actions {
    display: flex;
    gap: 5px;
}

.list-item-btn {
    padding: 5px 10px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.85em;
    transition: all 0.2s;
}

.list-item-btn:hover {
    opacity: 0.8;
}

.empty-state {
    text-align: center;
    padding: 40px;
    color: #999;
}

.empty-state-icon {
    font-size: 3em;
    margin-bottom: 15px;
}

.context-menu {
    position: fixed;
    background: white;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.15);
    padding: 8px 0;
    z-index: 3000;
    min-width: 180px;
    display: none;
}

.context-menu-item {
    padding: 10px 16px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.2s;
}

.context-menu-item:hover {
    background: #f8f9fa;
}

.context-menu-separator {
    height: 1px;
    background: #e0e0e0;
    margin: 5px 0;
}

.selected-text-preview {
    background: #f8f9fa;
    padding: 10px;
    border-radius: 6px;
    margin-bottom: 15px;
    font-style: italic;
    color: #666;
    border-left: 3px solid #667eea;
}

@keyframes slideDown {
    from {
        transform: translate(-50%, -100%);
        opacity: 0;
    }
    to {
        transform: translate(-50%, 0);
        opacity: 1;
    }
}
