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

body {
    font-family: 'Microsoft YaHei', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: #f5f7fa;
    min-height: 100vh;
    color: #333;
}

header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 30px;
    border-bottom: 1px solid #e0e0e0;
    background: #fff;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

header h1 {
    font-size: 22px;
    color: #2c3e50;
    font-weight: 600;
}

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

.story-select {
    padding: 8px 15px;
    border: 1px solid #ddd;
    border-radius: 6px;
    background: #fff;
    color: #333;
    font-size: 13px;
    min-width: 180px;
}

.story-select option {
    background: #fff;
    color: #333;
}

.story-select:focus {
    outline: none;
    border-color: #4a90d9;
}

.container {
    display: flex;
    gap: 15px;
    padding: 15px;
    max-width: 1600px;
    margin: 0 auto;
}

.column {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.column-left,
.column-center,
.column-right {
    width: 33.33%;
}

.panel {
    background: #fff;
    border-radius: 8px;
    padding: 15px;
    border: 1px solid #e0e0e0;
    box-shadow: 0 1px 3px rgba(0,0,0,0.03);
}

.panel-action {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100px;
}

.panel h2 {
    font-size: 14px;
    color: #4a90d9;
    margin-bottom: 12px;
    font-weight: 600;
}

.empty-state {
    text-align: center;
    padding: 20px;
    color: #999;
    font-size: 13px;
}

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

.form-group label {
    display: block;
    margin-bottom: 5px;
    font-size: 12px;
    color: #666;
    font-weight: 500;
}

.form-input,
.form-textarea {
    width: 100%;
    padding: 8px 10px;
    border: 1px solid #ddd;
    border-radius: 6px;
    background: #fff;
    color: #333;
    font-size: 13px;
    resize: vertical;
    font-family: inherit;
}

.form-textarea {
    min-height: 200px;
}

.form-textarea.small {
    min-height: 300px;
}

.form-input:focus,
.form-textarea:focus {
    outline: none;
    border-color: #4a90d9;
    box-shadow: 0 0 0 2px rgba(74, 144, 217, 0.1);
}

.form-row {
    display: flex;
    gap: 8px;
    align-items: center;
}

.form-row .form-group {
    flex: 1;
}

.btn {
    padding: 8px 12px;
    border: none;
    border-radius: 6px;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s;
    font-weight: 500;
}

.btn-primary {
    background: #4a90d9;
    color: white;
}

.btn-primary:hover {
    background: #3d7bc6;
}

.btn-success {
    background: #5cb85c;
    color: white;
}

.btn-success:hover {
    background: #4cae4c;
}

.btn-danger {
    background: #fff;
    color: #d9534f;
    border: 1px solid #d9534f;
}

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

.btn-ai {
    background: #673ab7;
    color: white;
}

.btn-ai:hover {
    background: #563d7c;
}

.btn-export {
    background: #f0ad4e;
    color: white;
}

.btn-export:hover {
    background: #ec971f;
}

.btn-import {
    background: #5cb85c;
    color: white;
}

.btn-import:hover {
    background: #4cae4c;
}

.btn-ai:disabled {
    opacity: 0.7;
    cursor: not-allowed;
}

.btn-ai.loading {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.btn-spinner {
    width: 14px;
    height: 14px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

.generate-progress {
    margin-top: 12px;
    text-align: center;
}

.progress-bar {
    width: 100%;
    height: 6px;
    background: #e0e0e0;
    border-radius: 3px;
    overflow: hidden;
    margin-bottom: 8px;
}

.progress-fill {
    height: 100%;
    background: #4a90d9;
    border-radius: 3px;
    transition: width 0.3s ease;
}

.progress-text {
    font-size: 12px;
    color: #666;
}

.btn-large {
    padding: 12px 30px;
    font-size: 14px;
}

.story-card {
    background: #fafafa;
    border-radius: 8px;
    padding: 10px;
    margin-bottom: 8px;
    border: 1px solid #e0e0e0;
}

.story-card h3 {
    font-size: 14px;
    margin-bottom: 3px;
}

.story-meta {
    font-size: 11px;
    color: #999;
    margin-bottom: 8px;
}

.story-actions {
    display: flex;
    gap: 6px;
}

.story-actions .btn {
    flex: 1;
    font-size: 11px;
    padding: 6px;
}

.new-story {
    margin-top: 10px;
    display: flex;
    gap: 8px;
}

.new-story .form-input {
    flex: 1;
}

.character-card {
    background: #fafafa;
    border-radius: 8px;
    padding: 10px;
    margin-bottom: 8px;
    border: 1px solid #e0e0e0;
    cursor: grab;
    transition: all 0.2s ease;
}

.character-card:hover {
    border-color: #4a90d9;
    background: #f0f5ff;
}

.character-card.dragging {
    opacity: 0.5;
    transform: scale(1.02);
    cursor: grabbing;
}

.character-card.drag-over {
    border-color: #4a90d9;
    background: rgba(74, 144, 217, 0.1);
}

.drag-handle {
    display: inline-block;
    margin-right: 8px;
    color: #ccc;
    font-size: 16px;
    cursor: grab;
}

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

.char-name {
    font-size: 14px;
    font-weight: 500;
}

.char-desc {
    font-size: 12px;
    color: #666;
    line-height: 1.4;
}

.edit-btn,
.delete-btn {
    background: none;
    border: none;
    color: #999;
    cursor: pointer;
    font-size: 12px;
    padding: 4px;
}

.edit-btn:hover,
.delete-btn:hover {
    color: #4a90d9;
}

.add-character,
.add-timestamp {
    margin-top: 10px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.timestamp-item {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
    padding: 6px 8px;
    border-radius: 6px;
    cursor: grab;
    transition: all 0.2s ease;
    border: 1px solid #e0e0e0;
}

.timestamp-item:hover {
    background: #f5f7fa;
}

.timestamp-item.dragging {
    opacity: 0.5;
    cursor: grabbing;
}

.timestamp-item.drag-over {
    border: 1px solid #4a90d9;
    background: rgba(74, 144, 217, 0.1);
}

.ts-number {
    width: 20px;
    height: 20px;
    background: rgba(74, 144, 217, 0.1);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    color: #4a90d9;
}

.ts-input {
    flex: 1;
}

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

.modal.show {
    display: flex;
}

.modal-content {
    background: #fff;
    border-radius: 8px;
    padding: 20px;
    width: 400px;
    border: 1px solid #e0e0e0;
    box-shadow: 0 4px 20px rgba(0,0,0,0.1);
}

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

.modal-header h3 {
    color: #2c3e50;
    font-size: 16px;
}

.close-btn {
    background: none;
    border: none;
    color: #999;
    font-size: 20px;
    cursor: pointer;
}

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

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

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

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

.btn-cancel:hover {
    background: #e8eaed;
}

.btn-confirm {
    background: #4a90d9;
    color: white;
}

.btn-confirm:hover {
    background: #3d7bc6;
}
