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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: #f8f9fa;
    color: #2d3748;
    line-height: 1.6;
}

.header {
    background: white;
    padding: 1rem 2rem;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    border: none;
    border-top: none;
    border-left: none;
    border-right: none;
}

.filters {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    align-items: center;
    max-width: 1200px;
    margin: 0 auto;
}

.btn {
    padding: 0.5rem 1rem;
    border: none;
    border-radius: 0.375rem;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
    display: inline-block;
}

.btn-secondary {
    background: #edf2f7;
    color: #2d3748;
}

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

.btn-icon {
    background: none;
    border: none;
    padding: 0;
    cursor: pointer;
    display: flex;
    align-items: center;
    text-decoration: none;
}

.btn-icon img {
    width: 24px;
    height: 24px;
    display: block;
}

.container {
    display: flex;
    max-width: 1400px;
    margin: 0 auto;
    padding: 2rem;
    gap: 2rem;
}

.main-content {
    flex: 1;
    min-width: 0;
}

.sidebar {
    width: 300px;
    flex-shrink: 0;
    position: sticky;
    top: 20px;
    height: calc(100vh - 40px);
}

.entry {
    background: white;
    border-radius: 0.5rem;
    padding: 1.25rem;
    margin-bottom: 1rem;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
    transition: transform 0.2s, box-shadow 0.2s;
}

.entry:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}

.entry h3 {
    font-size: 1.125rem;
    margin: 0 0 0.25rem 0;
}

.entry h3 a {
    color: #2b6cb0;
    text-decoration: none;
}

.entry h3 a:hover {
    text-decoration: underline;
}

.date {
    font-size: 0.75rem;
    color: #a0aec0;
    margin-bottom: 0.75rem;
}

.story-preview {
    cursor: pointer;
    padding: 0.75rem;
    background: #e8e8e8;
    border-radius: 0.375rem;
    margin: 0.5rem 0 0.75rem 0;
    font-size: 0.875rem;
    color: #2d3748;
    max-height: 8em;
    overflow: hidden;
    text-align: justify;
    position: relative;
    transition: background 0.2s;
    line-height: 1.6;
}

.story-preview p {
    margin: 0 0 0.5em 0;
}

.story-preview p:last-child {
    margin-bottom: 0;
}

.story-preview:hover {
    background: #d8d8d8;
}

.story-preview.no-preview {
    color: #a0aec0;
    font-style: italic;
    cursor: default;
}

.story-preview.no-preview:hover {
    background: #e8e8e8;
}

.tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 0.5rem;
}

.tag {
    display: inline-block;
    padding: 0;
    background: transparent;
    color: #718096;
    font-size: 0.75rem;
    border: none;
    cursor: default;
    user-select: none;
}

.no-results {
    text-align: center;
    padding: 3rem;
    color: #718096;
}

.no-results p {
    font-size: 1.125rem;
}

.preview-container {
    background: white;
    border-radius: 0.5rem;
    padding: 1rem;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
    height: 100%;
    display: flex;
    flex-direction: column;
}

.preview-header {
    font-size: 0.875rem;
    font-weight: 600;
    color: #4a5568;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid #e2e8f0;
    margin-bottom: 0.5rem;
}

.preview-content {
    flex: 1;
    overflow: hidden;
    border-radius: 0.375rem;
    background: #f7fafc;
    display: flex;
    align-items: flex-start;
    justify-content: flex-start;
    position: relative;
}

.preview-content iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: none;
    overflow: auto;
}

.preview-placeholder {
    color: #a0aec0;
    text-align: center;
    padding: 2rem;
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
}

.preview-placeholder svg {
    width: 48px;
    height: 48px;
    margin-bottom: 1rem;
    opacity: 0.5;
}

.hint {
    font-size: 0.75rem;
}

#previewText {
    padding: 1rem;
    overflow-y: auto;
    max-height: 100%;
    width: 100%;
    font-size: 0.875rem;
    line-height: 1.6;
    color: #2d3748;
    text-align: justify;
}

#previewText p {
    margin: 0 0 0.5em 0;
}

#previewText p:last-child {
    margin-bottom: 0;
}

/* Responsive */
@media (max-width: 768px) {
    .container {
        flex-direction: column;
        padding: 1rem;
    }
    
    .sidebar {
        width: 100%;
        height: 300px;
        position: relative;
        top: 0;
    }
    
    .filters {
        flex-direction: row;
        flex-wrap: wrap;
        gap: 0.5rem;
        align-items: center;
    }
    
    .filters input,
    .filters select {
        flex: 1 1 auto;
        min-width: 120px;
        width: auto;
    }
    
    .filters .btn,
    .filters .btn-secondary {
        flex: 0 0 auto;
    }
    
    .filters .btn-icon {
        flex: 0 0 auto;
    }
}