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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Inter', system-ui, sans-serif;
    font-size: 15px;
    line-height: 1.5;
    background-color: #f5f7f9;
    min-height: 100vh;
    color: #1e2a3a;
}

img, svg {
    vertical-align: middle;
}

img {
    max-width: 100%;
    max-height: 100%;
}

.wrapper {
    max-width: 1280px;
    margin-left: auto;
    margin-right: auto;
    padding: 0 24px;
}

/* Header */
header {
    background-color: #ffffff;
    border-bottom: 1px solid #e2e8f0;
    position: sticky;
    top: 0;
    z-index: 100;
}

header .wrapper {
    position: relative;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 14px;
    padding-bottom: 14px;
}

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

.logo-link {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    font-weight: 600;
    font-size: 18px;
    color: #1e2a3a;
    letter-spacing: -0.3px;
}

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

.logo-text {
    font-weight: 600;
}

.header-content {
    display: flex;
    align-items: center;
    gap: 28px;
}

.quick-links-menu {
    display: flex;
    gap: 20px;
}

.quick-link-item {
    color: #4a5b6e;
    text-decoration: none;
    font-size: 13px;
    font-weight: 500;
    transition: color 0.2s ease;
}

.quick-link-item:hover {
    color: #0066cc;
}

/* Language Switcher */
.language-switcher {
    display: flex;
    gap: 2px;
    background: #f1f5f9;
    padding: 2px;
}

.lang-option {
    padding: 5px 12px;
    background: transparent;
    border: none;
    cursor: pointer;
    font-size: 12px;
    font-weight: 500;
    transition: all 0.2s ease;
    color: #4a5b6e;
}

.lang-option:hover {
    background: #e2e8f0;
}

.lang-option.active {
    background: #ffffff;
    color: #1e2a3a;
    box-shadow: 0 1px 2px rgba(0,0,0,0.05);
}

/* Main Content */
main {
    background-color: #ffffff;
    margin: 32px 0;
    border: 1px solid #e2e8f0;
    overflow-x: auto;
}

/* Meta Bar */
.meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 24px;
    border-bottom: 1px solid #eef2f6;
    background: #fafcfd;
}

#summary {
    display: flex;
    gap: 24px;
}

.meta-item {
    font-size: 13px;
    color: #5a6e85;
}

.meta-item b {
    color: #1e2a3a;
    font-weight: 600;
}

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

.layout {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 12px;
    background: transparent;
    border: 1px solid #e2e8f0;
    cursor: pointer;
    font-size: 12px;
    font-weight: 500;
    color: #5a6e85;
    text-decoration: none;
    transition: all 0.2s ease;
}

.layout:hover {
    background: #f1f5f9;
    border-color: #cbd5e1;
}

.layout.current {
    background: #1e2a3a;
    border-color: #1e2a3a;
    color: white;
}

.layout.current svg {
    color: white;
}

/* Filter Bar */
.filter-bar {
    padding: 16px 24px;
    border-bottom: 1px solid #eef2f6;
}

.filter-container {
    position: relative;
    display: inline-block;
}

#search-icon {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: #8a9bb0;
    pointer-events: none;
}

#filter {
    padding: 8px 12px 8px 36px;
    border: 1px solid #e2e8f0;
    font-family: inherit;
    font-size: 13px;
    width: 260px;
    background: white;
    color: #1e2a3a;
    transition: all 0.2s ease;
}

#filter:focus {
    outline: none;
    border-color: #0066cc;
}

/* Table Styles */
.listing {
    overflow-x: auto;
}

#file-listing {
    width: 100%;
    border-collapse: collapse;
}

#file-listing thead th {
    text-align: left;
    padding: 12px 16px;
    background: #fafcfd;
    font-weight: 600;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 1px solid #e2e8f0;
    color: #5a6e85;
}

#file-listing tbody td {
    padding: 11px 16px;
    border-bottom: 1px solid #eef2f6;
    vertical-align: middle;
}

#file-listing tbody tr:hover {
    background: #fafcfd;
}

#file-listing tbody tr.parent-dir {
    background: #f8fafc;
    font-weight: 500;
}

/* Column Widths */
.icon-column {
    width: 44px;
    text-align: center;
}

.name-column {
    width: auto;
}

.size-column {
    width: 100px;
}

.checksum-column {
    width: 140px;
}

.timestamp-column {
    width: 170px;
}

/* Icon Cell */
.icon-cell {
    text-align: center;
    padding: 11px 8px !important;
}

.icon-cell svg {
    width: 18px;
    height: 18px;
    opacity: 0.7;
}

/* Name Cell */
.name-cell a {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    color: inherit;
}

.name-cell .name {
    font-size: 14px;
    font-weight: 500;
    color: #1e2a3a;
}

.name-cell a:hover .name {
    color: #0066cc;
}

/* Size Bar */
.sizebar {
    position: relative;
    padding: 3px 8px;
    display: inline-block;
    min-width: 75px;
    background: transparent;
}

.sizebar-bar {
    background-color: #e2e8f0;
    position: absolute;
    top: 0;
    left: 0;
    bottom: 0;
    height: 100%;
    transition: width 0.2s ease;
}

.sizebar-text {
    position: relative;
    z-index: 1;
    font-size: 12px;
    font-weight: 500;
    color: #1e2a3a;
}

/* SHA256 Hash */
.checksum-cell {
    font-family: 'SF Mono', 'Monaco', 'Cascadia Code', 'JetBrains Mono', monospace;
    font-size: 11px;
}

.sha256-hash {
    cursor: pointer;
    color: #0066cc;
    font-family: monospace;
    font-size: 10px;
    background: #f1f5f9;
    padding: 3px 8px;
    display: inline-block;
    transition: all 0.2s ease;
    letter-spacing: -0.2px;
}

.sha256-hash:hover {
    background: #0066cc;
    color: white;
}

/* Timestamp Cell */
.timestamp-cell {
    font-size: 12px;
    color: #8a9bb0;
}

/* Missing File Styles */
.file.missing {
    opacity: 0.85;
    background: #fffbf0;
}

.file.missing:hover {
    background: #fff8e5;
}

.missing-file {
    color: #d97706;
    text-decoration: line-through;
}

.missing-badge {
    display: inline-block;
    margin-left: 10px;
    padding: 2px 8px;
    background: #fef3c7;
    color: #92400e;
    font-size: 10px;
    font-weight: 600;
}

/* Grid View */
.listing.grid-view .grid-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
    gap: 1px;
    background: #e2e8f0;
    padding: 1px;
}

.listing.grid-view table {
    display: none;
}

.listing.list-view table {
    display: table;
}

.listing.list-view .grid-container {
    display: none;
}

.grid-container .grid-item {
    background: white;
    transition: background 0.2s ease;
}

.grid-container .grid-item:hover {
    background: #fafcfd;
}

.grid-container .grid-item a {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 24px 16px;
    text-decoration: none;
    color: inherit;
}

.grid-container .grid-item svg {
    width: 44px;
    height: 44px;
    margin-bottom: 12px;
    opacity: 0.6;
}

.grid-container .grid-item .name {
    font-weight: 500;
    word-break: break-word;
    margin-bottom: 8px;
    font-size: 13px;
    color: #1e2a3a;
}

.grid-item-size {
    font-size: 11px;
    color: #8a9bb0;
    margin-top: 4px;
}

.grid-item-checksum {
    font-size: 9px;
    color: #0066cc;
    margin-top: 8px;
    font-family: monospace;
    cursor: pointer;
    padding: 3px 8px;
    background: #f1f5f9;
    transition: all 0.2s ease;
}

.grid-item-checksum:hover {
    background: #0066cc;
    color: white;
}

.grid-item-date {
    font-size: 10px;
    color: #a0b0c5;
    margin-top: 4px;
}

.grid-item.missing {
    background: #fffbf0;
}

.grid-item.missing .name {
    color: #d97706;
    text-decoration: line-through;
}

/* Sort Indicators */
.sort-name, .sort-size, .sort-date {
    cursor: pointer;
    text-decoration: none;
    color: inherit;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.sort-name:hover, .sort-size:hover, .sort-date:hover {
    color: #0066cc;
}

.sort-indicator {
    display: inline-block;
    font-size: 10px;
    opacity: 0.7;
}

/* Message Styles */
.message {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 14px 24px;
    margin: 0;
    border-left: 3px solid;
    background: #fafcfd;
    font-size: 13px;
}

.message-icon {
    font-size: 16px;
    flex-shrink: 0;
}

.message-content {
    flex: 1;
    line-height: 1.5;
}

.message-content p {
    margin: 0;
}

.message-content code {
    background: rgba(0, 0, 0, 0.04);
    padding: 2px 5px;
    font-family: monospace;
    font-size: 12px;
}

.message-notice { border-left-color: #3b82f6; background: #eff6ff; }
.message-info { border-left-color: #06b6d4; background: #ecfeff; }
.message-success { border-left-color: #10b981; background: #ecfdf5; }
.message-warning { border-left-color: #f59e0b; background: #fffbeb; }
.message-error { border-left-color: #ef4444; background: #fef2f2; }

/* ============================================
   ВЫДЕЛЕНИЕ БЛОКОВ header, footer, readme
   ============================================ */

/* Блок header.md - вверху страницы */
.markdown-content.header-content {
    background: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 100%);
    border-left: 4px solid #0284c7;
    border-right: none;
    border-top: none;
    border-bottom: 1px solid #bae6fd;
    margin: 0;
    padding: 24px 28px;
}

.markdown-content.header-content h1:first-child {
    margin-top: 0;
}

.markdown-content.header-content h1,
.markdown-content.header-content h2,
.markdown-content.header-content h3 {
    color: #0369a1;
}

/* Блок readme.md - перед списком файлов */
.markdown-content.readme-content {
    background: #f8fafc;
    border-left: 4px solid #64748b;
    border-right: none;
    border-top: 1px solid #e2e8f0;
    border-bottom: 1px solid #e2e8f0;
    margin: 0;
    padding: 24px 28px;
}

.markdown-content.readme-content h1:first-child {
    margin-top: 0;
}

/* Блок footer.md - внизу страницы */
.markdown-content.footer-content {
    background: linear-gradient(135deg, #f1f5f9 0%, #e2e8f0 100%);
    border-left: 4px solid #475569;
    border-right: none;
    border-top: 1px solid #cbd5e1;
    border-bottom: none;
    margin: 0;
    padding: 20px 28px;
    font-size: 14px;
    color: #334155;
}

.markdown-content.footer-content h1,
.markdown-content.footer-content h2,
.markdown-content.footer-content h3 {
    color: #1e293b;
    font-size: 1.2em;
}

/* Блок changelog */
.changelog-preview {
    background: #fffbeb;
    border-left: 4px solid #f59e0b;
    border-right: none;
    border-top: 1px solid #fde68a;
    border-bottom: 1px solid #fde68a;
    margin: 0;
    padding: 20px 28px;
}

.changelog-preview h2 {
    color: #b45309;
    font-size: 1.1em;
    margin-top: 0;
    margin-bottom: 16px;
}

/* Общие стили для markdown контента */
.markdown-content {
    line-height: 1.6;
}

.markdown-content h1 {
    font-size: 26px;
    margin-bottom: 20px;
    font-weight: 600;
}

.markdown-content h2 {
    font-size: 20px;
    margin: 28px 0 16px;
    font-weight: 600;
}

.markdown-content h3 {
    font-size: 17px;
    margin: 20px 0 12px;
    font-weight: 600;
}

.markdown-content p {
    margin-bottom: 16px;
}

.markdown-content code {
    background: rgba(0, 0, 0, 0.05);
    padding: 2px 6px;
    font-family: monospace;
    font-size: 13px;
}

.markdown-content pre {
    background: #f8fafc;
    padding: 16px;
    overflow-x: auto;
    margin: 20px 0;
    border: 1px solid #e2e8f0;
}

.markdown-content pre code {
    background: none;
    padding: 0;
}

.markdown-content blockquote {
    border-left: 3px solid #cbd5e1;
    margin: 20px 0;
    padding-left: 20px;
    color: #5a6e85;
}

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

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

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

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

.markdown-content th {
    background: #f8fafc;
    font-weight: 600;
}

/* Footer (сайта) */
footer {
    padding: 28px 24px;
    text-align: center;
    border-top: 1px solid #e2e8f0;
    margin-top: 32px;
    background: #fafcfd;
}

.footer-links {
    margin-bottom: 14px;
}

.footer-links a {
    color: #5a6e85;
    text-decoration: none;
    margin: 0 12px;
    font-size: 12px;
    transition: color 0.2s;
}

.footer-links a:hover {
    color: #0066cc;
}

.footer-links .separator {
    color: #cbd5e1;
    font-size: 11px;
}

.copyright {
    color: #8a9bb0;
    font-size: 11px;
}

/* Error State */
.error-state {
    text-align: center;
    padding: 80px 40px;
}

.error-icon {
    font-size: 56px;
    margin-bottom: 20px;
    opacity: 0.7;
}

.error-state h2 {
    font-size: 22px;
    margin-bottom: 16px;
    font-weight: 500;
    color: #1e2a3a;
}

.error-details {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    padding: 20px;
    margin: 24px auto;
    max-width: 500px;
    text-align: left;
}

.error-details code {
    background: #eef2f6;
    padding: 2px 6px;
    font-family: monospace;
    font-size: 12px;
}

.error-actions {
    display: flex;
    gap: 16px;
    justify-content: center;
    margin-top: 32px;
}

.error-btn {
    display: inline-block;
    padding: 9px 24px;
    background: #1e2a3a;
    color: white;
    text-decoration: none;
    border: none;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    transition: background 0.2s;
}

.error-btn:hover {
    background: #2d3a4a;
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 80px 40px;
    color: #8a9bb0;
}

.empty-state h2 {
    font-size: 20px;
    margin-bottom: 12px;
    font-weight: 500;
    color: #5a6e85;
}

.empty-state a {
    color: #0066cc;
    text-decoration: none;
}

/* Progress Overlay */
.progress-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    z-index: 9999;
    display: flex;
    justify-content: center;
    align-items: center;
}

.progress-container {
    background: white;
    padding: 36px 56px;
    min-width: 300px;
    text-align: center;
    border: 1px solid #e2e8f0;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 2px solid #e2e8f0;
    border-top: 2px solid #1e2a3a;
    animation: spin 0.8s linear infinite;
    margin: 0 auto 20px auto;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.progress-message {
    font-size: 14px;
    font-weight: 500;
    color: #1e2a3a;
    margin: 16px 0 8px;
}

.progress-status {
    font-size: 11px;
    color: #8a9bb0;
    font-family: monospace;
}

/* Responsive */
@media (max-width: 768px) {
    .wrapper {
        padding: 0 16px;
    }
    
    .hideable {
        display: none;
    }
    
    .checksum-column,
    .checksum-cell {
        display: none;
    }
    
    .size-column {
        width: 80px;
    }
    
    .timestamp-column {
        width: 130px;
    }
    
    .meta {
        flex-direction: column;
        gap: 12px;
        align-items: flex-start;
    }
    
    .header-content {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }
    
    .quick-links-menu {
        flex-wrap: wrap;
    }
    
    .language-switcher {
        position: static;
        margin-left: auto;
    }
    
    .filter-container {
        width: 100%;
    }
    
    #filter {
        width: 100%;
    }
    
    .markdown-content.header-content,
    .markdown-content.readme-content,
    .markdown-content.footer-content,
    .changelog-preview {
        padding: 16px 20px;
    }
}

@media (max-width: 600px) {
    .size-column,
    .size-cell {
        display: none;
    }
    
    .timestamp-column,
    .timestamp-cell {
        display: none;
    }
}

/* ============================================
   DARK THEME
   ============================================ */
@media (prefers-color-scheme: dark) {
    body {
        background-color: #0d1117;
        color: #c9d1d9;
    }
    
    header {
        background-color: #161b22;
        border-bottom-color: #21262d;
    }
    
    .logo-link {
        color: #c9d1d9;
    }
    
    .quick-link-item {
        color: #8b949e;
    }
    
    .quick-link-item:hover {
        color: #58a6ff;
    }
    
    .language-switcher {
        background: #21262d;
    }
    
    .lang-option {
        color: #8b949e;
    }
    
    .lang-option:hover {
        background: #30363d;
    }
    
    .lang-option.active {
        background: #0d1117;
        color: #c9d1d9;
        box-shadow: none;
    }
    
    main {
        background-color: #161b22;
        border-color: #21262d;
    }
    
    .meta {
        background: #0d1117;
        border-bottom-color: #21262d;
    }
    
    .meta-item {
        color: #8b949e;
    }
    
    .meta-item b {
        color: #c9d1d9;
    }
    
    .layout {
        border-color: #30363d;
        color: #8b949e;
    }
    
    .layout:hover {
        background: #21262d;
        border-color: #30363d;
    }
    
    .layout.current {
        background: #c9d1d9;
        border-color: #c9d1d9;
        color: #0d1117;
    }
    
    .filter-bar {
        border-bottom-color: #21262d;
    }
    
    #filter {
        background: #0d1117;
        border-color: #30363d;
        color: #c9d1d9;
    }
    
    #filter:focus {
        border-color: #58a6ff;
    }
    
    #search-icon {
        color: #8b949e;
    }
    
    #file-listing thead th {
        background: #0d1117;
        border-bottom-color: #21262d;
        color: #8b949e;
    }
    
    #file-listing tbody td {
        border-bottom-color: #21262d;
    }
    
    #file-listing tbody tr:hover {
        background: #0d1117;
    }
    
    #file-listing tbody tr.parent-dir {
        background: #0a0c10;
    }
    
    .name-cell .name {
        color: #c9d1d9;
    }
    
    .name-cell a:hover .name {
        color: #58a6ff;
    }
    
    .sizebar-bar {
        background-color: #30363d;
    }
    
    .sizebar-text {
        color: #c9d1d9;
    }
    
    .sha256-hash {
        background: #21262d;
        color: #58a6ff;
    }
    
    .sha256-hash:hover {
        background: #58a6ff;
        color: #0d1117;
    }
    
    .timestamp-cell {
        color: #8b949e;
    }
    
    .file.missing {
        background: #261b0a;
    }
    
    .file.missing:hover {
        background: #332511;
    }
    
    .missing-file {
        color: #f0883e;
    }
    
    .missing-badge {
        background: #332511;
        color: #f0883e;
    }
    
    .listing.grid-view .grid-container {
        background: #30363d;
    }
    
    .grid-container .grid-item {
        background: #161b22;
    }
    
    .grid-container .grid-item:hover {
        background: #0d1117;
    }
    
    .grid-container .grid-item .name {
        color: #c9d1d9;
    }
    
    .grid-item-size {
        color: #8b949e;
    }
    
    .grid-item-checksum {
        background: #21262d;
        color: #58a6ff;
    }
    
    .grid-item-checksum:hover {
        background: #58a6ff;
        color: #0d1117;
    }
    
    .grid-item-date {
        color: #6e7681;
    }
    
    .grid-item.missing {
        background: #261b0a;
    }
    
    .grid-item.missing .name {
        color: #f0883e;
    }
    
    .message-notice { background: #0a1a2a; border-left-color: #58a6ff; }
    .message-info { background: #0a2a2a; border-left-color: #79c0ff; }
    .message-success { background: #0a2a1a; border-left-color: #3fb950; }
    .message-warning { background: #2a1a0a; border-left-color: #f0883e; }
    .message-error { background: #2a0a0a; border-left-color: #f85149; }
    
    /* Dark theme для выделенных блоков */
    .markdown-content.header-content {
        background: linear-gradient(135deg, #0a1a2a 0%, #0f212e 100%);
        border-left-color: #0284c7;
        border-bottom-color: #1f3a4a;
    }
    
    .markdown-content.header-content h1,
    .markdown-content.header-content h2,
    .markdown-content.header-content h3 {
        color: #7dd3fc;
    }
    
    .markdown-content.readme-content {
        background: #0d1117;
        border-left-color: #8b949e;
        border-top-color: #21262d;
        border-bottom-color: #21262d;
    }
    
    .markdown-content.footer-content {
        background: linear-gradient(135deg, #0d1117 0%, #161b22 100%);
        border-left-color: #8b949e;
        border-top-color: #21262d;
        color: #c9d1d9;
    }
    
    .markdown-content.footer-content h1,
    .markdown-content.footer-content h2,
    .markdown-content.footer-content h3 {
        color: #e6edf3;
    }
    
    .changelog-preview {
        background: #1a1a0a;
        border-left-color: #f0883e;
        border-top-color: #3a3a1a;
        border-bottom-color: #3a3a1a;
    }
    
    .changelog-preview h2 {
        color: #f0883e;
    }
    
    .markdown-content code {
        background: #21262d;
        color: #c9d1d9;
    }
    
    .markdown-content pre {
        background: #0d1117;
        border-color: #21262d;
    }
    
    .markdown-content blockquote {
        border-left-color: #30363d;
        color: #8b949e;
    }
    
    .markdown-content th,
    .markdown-content td {
        border-color: #21262d;
    }
    
    .markdown-content th {
        background: #0d1117;
    }
    
    footer {
        background: #0d1117;
        border-top-color: #21262d;
    }
    
    .footer-links a {
        color: #8b949e;
    }
    
    .footer-links a:hover {
        color: #58a6ff;
    }
    
    .footer-links .separator {
        color: #30363d;
    }
    
    .copyright {
        color: #6e7681;
    }
    
    .error-state h2 {
        color: #c9d1d9;
    }
    
    .error-details {
        background: #0d1117;
        border-color: #21262d;
    }
    
    .error-details code {
        background: #21262d;
        color: #c9d1d9;
    }
    
    .error-btn {
        background: #c9d1d9;
        color: #0d1117;
    }
    
    .error-btn:hover {
        background: #f0f6fc;
    }
    
    .empty-state {
        color: #8b949e;
    }
    
    .empty-state h2 {
        color: #c9d1d9;
    }
    
    .empty-state a {
        color: #58a6ff;
    }
    
    .progress-container {
        background: #161b22;
        border-color: #21262d;
    }
    
    .progress-message {
        color: #c9d1d9;
    }
    
    .progress-status {
        color: #8b949e;
    }
    
    .spinner {
        border-color: #30363d;
        border-top-color: #c9d1d9;
    }
}