/* CSS Variables */
:root {
    --color-primary: #2563eb;
    --color-primary-dark: #1e40af;
    --color-primary-light: #3b82f6;
    --color-bg: #ffffff;
    --color-bg-alt: #f9fafb;
    --color-text: #1f2937;
    --color-text-light: #6b7280;
    --color-border: #e5e7eb;
    --color-border-dark: #d1d5db;
    --color-success: #10b981;
    --color-warning: #f59e0b;
    --color-error: #ef4444;
    
    --color-code-bg:        #1e2a38;
    --color-code-bg-hover:  #273547;
    --color-code-header:    #273547;
    --color-code-border:    #324454;
    --color-code-text:      #cad6e0;
    --color-code-text-dim:  #8aaab8;
    --shadow-code:          0 4px 16px rgba(0, 0, 0, 0.22), 0 1px 3px rgba(0, 0, 0, 0.1);

    
    --font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', sans-serif;
    --font-mono: 'Courier New', 'Monaco', 'Menlo', monospace;
    
    --spacing-xs: 0.25rem;
    --spacing-sm: 0.5rem;
    --spacing-md: 1rem;
    --spacing-lg: 1.5rem;
    --spacing-xl: 2rem;
    --spacing-2xl: 3rem;
    
    --radius-sm: 0.25rem;
    --radius-md: 0.375rem;
    --radius-lg: 0.5rem;
    
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    
    --transition: all 0.2s ease;
}

/* Reset & Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-family);
    background-color: var(--color-bg);
    color: var(--color-text);
    line-height: 1.6;
    font-size: 16px;
}

a {
    color: var(--color-primary);
    text-decoration: none;
    transition: var(--transition);
}

a:hover {
    color: var(--color-primary-dark);
    text-decoration: underline;
}

/* ============================================
   HEADER & NAVIGATION
   ============================================ */

.header {
    background-color: var(--color-bg);
    border-bottom: 1px solid var(--color-border);
    position: sticky;
    top: 0;
    z-index: 1000;
    box-shadow: var(--shadow-sm);
}

.header-container {
    max-width: 1600px;
    margin: 0 auto;
    padding: 0 var(--spacing-lg);
    height: 70px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: var(--spacing-xl);
}

.logo {
    display: flex;
    align-items: baseline;
    gap: var(--spacing-xs);
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--color-text);
}

.logo-text { color: var(--color-primary); }
.logo-domain { color: var(--color-text-light); font-size: 1rem; }

.header-nav {
    height: 100%;
}

.nav-list {
    display: flex;
    list-style: none;
    gap: var(--spacing-xl);
    height: 100%;
}

.nav-item {
    position: relative;
    height: 100%;
    display: flex;
    align-items: center;
}

.nav-link {
    color: var(--color-text);
    font-weight: 500;
    padding: var(--spacing-sm) 0;
    border-bottom: 2px solid transparent;
    transition: var(--transition);
    display: flex;
    align-items: center;
    gap: 4px;
    white-space: nowrap;
}

.nav-link:hover {
    color: var(--color-primary);
    text-decoration: none;
}

.arrow {
    font-size: 0.7rem;
    transition: transform 0.2s;
}

/* ============================================
   МЕГА-МЕНЮ (3 уровня)
   ============================================ */

.dropdown-menu {
    position: absolute;
    top: 80%;
    left: 50%;
    transform: translateX(-50%);
    background-color: var(--color-bg);
    border: 2px solid var(--color-border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    display: none;
    padding: var(--spacing-xl);
    max-width: 80vw;
    z-index: 1001;
}

.dropdown:hover .dropdown-menu {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(calc(100% / 5 - var(--spacing-xl)), 1fr));
    justify-content: start;
    gap: var(--spacing-xl);
}

.dropdown:hover .arrow {
    transform: rotate(180deg);
}

/* Категория 2-го уровня (заголовок колонки) */
.dropdown-column {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-sm);
    min-width: 220px;
}

.dropdown-header {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--color-text);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: var(--spacing-md);
    border-bottom: 2px solid var(--color-primary);
    padding-bottom: var(--spacing-sm);
}

/* Ссылки 3-го уровня */
.dropdown-menu a {
    color: var(--color-text);
    font-size: 0.95rem;
    padding: var(--spacing-xs) 0;
    display: block;
    line-height: 1.6;
}

.dropdown-menu a:hover {
    color: var(--color-primary);
    text-decoration: none;
    padding-left: 4px;
}

/* ============================================
   LAYOUT WITH AD SIDEBARS
   ============================================ */

.layout-wrapper {
    display: flex;
    max-width: 98%;
    margin: 0 auto;
    gap: var(--spacing-lg);
    padding: var(--spacing-xl) var(--spacing-lg);
}

.ad-sidebar {
    width: 180px;
    flex-shrink: 0;
}

.ad-sticky {
    position: sticky;
    top: 90px;
}

.ad-placeholder {
background-color: var(--color-bg-alt);
    border: 1px dashed var(--color-border-dark);
    border-radius: var(--radius-md);
    padding: var(--spacing-sm);
    text-align: center;
    min-height: 600px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

.ad-label {
    font-size: 0.7rem;
    color: var(--color-text-light);
    text-transform: uppercase;
    margin-bottom: var(--spacing-sm);
}

.ad-content {
    color: var(--color-border-dark);
    font-weight: 700;
}

/* ============================================
   HORIZONTAL AD BLOCKS
   ============================================ */

.ad-horizontal {
    background-color: var(--color-bg-alt);
    border: 1px dashed var(--color-border-dark);
    border-radius: var(--radius-md);
    padding: var(--spacing-sm);
    text-align: center;
    height: 120px; /* Фиксированная высота */
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    width: 100%;
}

.ad-horizontal.ad-sticky {
    position: sticky;
    top: 70px; /* Высота хедера */
    z-index: 999; /* Ниже хедера, но выше основного контента */
}

.ad-horizontal .ad-label {
    font-size: 0.7rem;
    color: var(--color-text-light);
    text-transform: uppercase;
    margin-bottom: var(--spacing-sm);
}

.ad-horizontal .ad-content {
    color: var(--color-border-dark);
    font-weight: 700;
}

@media (max-width: 768px) {
    .ad-horizontal {
        height: 90px; /* Меньшая высота на мобильных устройствах */
        margin: var(--spacing-lg) 0;
    }
    .ad-horizontal.ad-sticky {
        top: 0; /* Прилипает к верху экрана на мобильных устройствах */
    }
}

.container {
    flex: 1;
    min-width: 0;
}

.main-content {
    background-color: var(--color-bg);
    padding: 0rem 2rem;
}

/* ============================================
   ARTICLE & TOOLS
   ============================================ */

.article-title {
    font-weight: 700;
    margin-top: 0;
    margin-bottom: 0;
}

.article-meta {
    display: flex;
    gap: var(--spacing-lg);
    margin-bottom: var(--spacing-xl);
    color: var(--color-text-light);
    font-size: 0.9rem;
}

.tools-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: var(--spacing-lg);
    margin-top: var(--spacing-xl);
}

.tool-card {
    background-color: var(--color-bg-alt);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    padding: var(--spacing-lg);
    transition: var(--transition);
}

.tool-card:hover {
    border-color: var(--color-primary);
    box-shadow: var(--shadow-md);
}

/* ============================================
   FOOTER
   ============================================ */

.footer {
    border-top: 1px solid var(--color-border);
    padding: var(--spacing-xl) 0;
    margin-top: var(--spacing-2xl);
}

.footer-container {
    max-width: 1600px;
    margin: 0 auto;
    padding: 0 var(--spacing-lg);
    display: flex;
    justify-content: space-between;
    color: var(--color-text-light);
    font-size: 0.9rem;
}

.footer-links {
    display: flex;
    gap: var(--spacing-lg);
}

.footer-links ul {
    display: flex;
    gap: 16px; /* расстояние между ссылками */
    list-style: none; 
}

@media (max-width: 768px) {
    .footer-container { flex-direction: column; gap: var(--spacing-md); text-align: center; }
    .footer-links ul { display: grid; margin: auto; }
    .main-content { padding: 0; }
}


/* ============================================
   RESPONSIVE & MOBILE MENU
   ============================================ */

.mobile-menu-toggle {
    display: none;
    background: none;
    border: none;
    color: var(--color-text);
    cursor: pointer;
    padding: var(--spacing-sm);
    z-index: 1002;
}

.header-right-wrapper {
    display: flex;
    align-items: center;
    gap: var(--spacing-xl);
    height: 100%;
    flex: 2;
    justify-content: space-between;
}

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

    .dropdown-menu {
        min-width: 700px;
        max-width: 900px;
    }
}

@media (max-width: 768px) {
    body.menu-open {
        overflow: hidden;
    }

    .header-container {
        height: 60px;
        padding: 0 var(--spacing-md);
        gap: var(--spacing-md);
    }

    .mobile-menu-toggle {
        display: block;
    }

    .header-right-wrapper {
        position: fixed;
        top: 60px;
        left: 0;
        width: 100%;
        height: calc(100vh - 60px);
        background-color: var(--color-bg);
        flex-direction: column;
        align-items: stretch;
        padding: var(--spacing-lg);
        gap: var(--spacing-lg);
        overflow-y: auto;
        transform: translateX(100%);
        transition: transform 0.3s ease-in-out;
        z-index: 1001;
        box-shadow: var(--shadow-lg);
        display: flex;
    }

    .header.menu-active .header-right-wrapper {
        transform: translateX(0);
    }

    .header-nav {
        height: auto;
        order: 1;
    }

    .nav-list {
        flex-direction: column;
        gap: 0;
        height: auto;
    }

    .nav-item {
        height: auto;
        width: 100%;
        flex-direction: column;
        align-items: stretch;
        border-bottom: 1px solid var(--color-border);
    }

    .nav-link {
        padding: var(--spacing-md) 0;
        justify-content: space-between;
        width: 100%;
    }

    /* Accordion Styles */
    .dropdown-menu {
        position: static;
        display: none;
        transform: none;
        min-width: 100%;
        max-width: 100%;
        box-shadow: none;
        border: none;
        padding: 0 0 var(--spacing-md) var(--spacing-md);
        grid-template-columns: 1fr;
        background-color: transparent;
    }

    .nav-item.active .dropdown-menu {
        display: block!Important;
    }

    .nav-item.active .arrow {
        transform: rotate(180deg);
    }

    .dropdown-column {
        gap: var(--spacing-xs);
        margin-bottom: var(--spacing-md);
    }

    .dropdown-header {
        margin-bottom: var(--spacing-xs);
        font-size: 0.8rem;
    }

    /* Theme & Lang & Feedback in Mobile */
    .theme-dropdown, 
    .lang-nav-item,
    .feedback-wrapper {
        order: 2;
        width: 100%;
    }

    .theme-dropdown-btn,
    .lang-nav-item .nav-link,
    .feedback-trigger-btn {
        width: 100%;
        justify-content: center;
        border: 1px solid var(--color-border);
        border-radius: var(--radius-md);
        padding: var(--spacing-sm);
        background-color: var(--color-bg-alt);
    }

    .lang-nav-item {
        border-bottom: none;
    }

    .lang-dropdown {
        position: static !important;
        min-width: 100% !important;
        max-width: 100% !important;
        transform: none !important;
        padding: var(--spacing-sm) 0 !important;
    }

    .theme-dropdown-content {
        position: static;
        width: 100%;
        box-shadow: none;
        border: 1px solid var(--color-border);
        margin-top: 4px;
    }

    .feedback-nav-item {
        height: auto;
        border-bottom: none;
    }

    .dropdown:hover .dropdown-menu {
        display: none;
    }
}

/* Rest of the styles from original file */
/* Контейнер для блока кода */
.code-block {
    position: relative;
    background-color: var(--color-code-bg);
    border: 1px solid var(--color-code-border);
    border-radius: 8px;
    margin-bottom: 1.5em;
    font-family: "Fira Code", "Courier New", Courier, monospace;
    font-size: 14px;
    line-height: 1.5;
    overflow: hidden;
    cursor: pointer;
    box-shadow: var(--shadow-code);
    transition: background-color 0.2s ease, box-shadow 0.2s ease;
    max-width: 800px;
}

.code-block:hover {
    background-color: var(--color-code-bg-hover);
    box-shadow: var(--shadow-code), 0 0 0 2px var(--color-primary-light);
}

.code-block-header {
    background-color: var(--color-code-header);
    color: var(--color-code-text-dim);
    padding: 2px 16px;
    font-size: 12px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--color-code-border);
}

.copy-icon {
    width: 16px;
    height: 16px;
    fill: var(--color-code-text-dim);
    cursor: pointer;
}

.code-block code {
    display: block;
    padding: 16px;
    color: var(--color-code-text);
    white-space: pre-wrap;
    word-wrap: break-word;
}

.highlighted-text {
    border: 1px solid var(--color-border-dark);
    border-radius: 8px;
    padding: 2px 8px;
    display: inline-block;
    cursor: pointer;
    transition: background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease;
    background-color: var(--color-bg-alt);
    color: var(--color-text);
}
.highlighted-text:hover {
    background-color: var(--color-border);
    border-color: var(--color-primary);
    color: var(--color-text);
}

.highlighted-text .copy-button {
    background: none;
    border: none;
    color: rgb(150, 170, 190);
    font-size: 12px;
    cursor: pointer;
    margin-left: 8px;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.highlighted-text:hover .copy-button {
    opacity: 1;
}

.highlighted-text .copy-button:hover {
    color: rgb(220, 230, 240);
}

.highlighted-text .copy-button:active {
    color: rgb(100, 120, 140);
}

#toast {
    visibility: hidden;
    min-width: 250px;
    margin-left: -125px;
    background-color: rgb(60, 75, 90);
    color: #86e320; 
    text-align: center;
    border-radius: 8px;
    padding: 16px;
    position: fixed;
    z-index: 1005;
    left: 45%;
    bottom: 30px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

#toast.show {
    visibility: visible;
    -webkit-animation: fadein 0.5s, fadeout 0.5s 2s;
    animation: fadein 0.5s, fadeout 0.5s 2s;
}

@-webkit-keyframes fadein {
    from {bottom: 0; opacity: 0;}
    to {bottom: 30px; opacity: 1;}
}

@keyframes fadein {
    from {bottom: 0; opacity: 0;}
    to {bottom: 30px; opacity: 1;}
}

@-webkit-keyframes fadeout {
    from {bottom: 30px; opacity: 1;}
    to {bottom: 0; opacity: 0;}
}

@keyframes fadeout {
    from {bottom: 30px; opacity: 1;}
    to {bottom: 0; opacity: 0;}
}

h1 {
    font-size: 1.7rem;
    margin-top: 2.5rem;
    margin-bottom: 1rem;
    font-weight: 700;
    line-height: 1.3;
    border-left: 4px solid #3182ce;
    padding-left: 15px;
}

h2 {
    font-size: 1.4rem;
    margin-top: 2rem;
    margin-bottom: 1rem;
    font-weight: 700;
    line-height: 1.3;
    border-left: 4px solid #3182ce;
    padding-left: 15px;
}

h3 {
    font-size: 1.2rem;
    margin-top: 1.5rem;
    margin-bottom: 0.75rem;
    font-weight: 600;
}

ul, ol {
    margin-bottom: 1.5rem;
    padding-left: 1.5rem;
    line-height: 1.6;
}

ul li {
    margin-bottom: 0.5rem;
}

ul li::before {
    width: 1em;
    margin-left: -1em;
}

ol li {
    margin-bottom: 0.8rem;
    padding-left: 0.5rem;
}

@media (max-width: 768px) {
    h1 { font-size: 1.2rem; }
    h2 { font-size: 1.1rem; }
    h3 { font-size: 1rem; }
    ul, ol { padding-left: 1.2rem; }
}

.notification {
    margin-top: 1rem;
    padding: 0.75rem 1rem;
    background-color: #d1fae5;
    color: #065f46;
    border: 1px solid #a7f3d0;
    border-radius: 0.375rem;
    font-size: 0.9rem;
    text-align: center;
}

.tool-btn {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 0.375rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 0.95rem;
}

.tool-btn-primary {
    background-color: #2563eb;
    color: #ffffff;
}

.tool-btn-primary:hover {
    background-color: #1e40af;
}

.tool-btn-primary:active {
    transform: scale(0.98);
}

.tool-btn-secondary {
    background-color: #e5e7eb;
    color: #1f2937;
}

.tool-btn-secondary:hover {
    background-color: #d1d5db;
}

.tool-content {
    background-color: var(--color-bg-alt);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    padding: var(--spacing-lg);
    margin-bottom: var(--spacing-xl);
}

.converter-grid {
display: grid;
grid-template-columns: 1fr 1fr;
gap: var(--spacing-lg);
margin-bottom: var(--spacing-lg);
}

@media (max-width: 768px) {
     .tool-btn {
        width: 100%;
    }
    .converter-grid {
        grid-template-columns: 1fr;
    }
}

.converter-column {
    display: flex;
    flex-direction: column;
}

/* TEXTAREA */
.tool-textarea {
width: 100%;
padding: var(--spacing-md);
border: 1px solid var(--color-border-dark);
border-radius: var(--radius-md);
font-family: var(--font-mono);
font-size: 0.95rem;
background: var(--color-bg);
color: var(--color-text);
}
.tool-textarea:focus {
outline: none;
border-color: var(--color-primary);
box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.1);
}
.large-textarea {
height: 400px;
resize: none;
}
/* OUTPUT */
.output {
cursor: pointer;
}
/* CONTROLS */
.converter-controls {
    display: flex;
    justify-content: space-between;
    gap: var(--spacing-md);
    padding-top: var(--spacing-md);
    border-top: 1px solid var(--color-border);
    flex-wrap: wrap;
}
.controls-right {
    display: flex;
    gap: var(--spacing-sm);
    flex-wrap: wrap;
}
/* INPUT */
.tool-input {
    padding: 0.5rem;
    border: 1px solid var(--color-border-dark);
    border-radius: var(--radius-sm);
    background: var(--color-bg);
    color: var(--color-text);
}
.small-input {
    width: 90px;
    text-align: center;
}
.theme-dropdown,
.nav-item.dropdown:last-child {
    margin-left: auto; /* Отталкивает элемент вправо */
}
.theme-dropdown + .nav-item.dropdown,
.nav-item.dropdown + .theme-dropdown {
    margin-left: 0;
}
.ms-auto {
    margin-left: auto !important;
}
.fullscreen-mode {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 9999;
    background: inherit;
    padding: 20px;
    overflow: auto;
}

.fullscreen-mode textarea,
.fullscreen-mode .tool-area {
    height: calc(100vh - 100px);
}

.checkbox {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.9rem;
    color: var(--color-text);
    padding: 8px 12px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--color-border);
    background-color: var(--color-bg-alt);
    cursor: pointer;
    transition: var(--transition);
}

.checkbox:hover {
    background-color: var(--color-border);
}

.checkbox input {
    cursor: pointer;
}

.checkbox:has(input:checked) {
    background-color: rgba(37, 99, 235, 0.1);
    border-color: var(--color-primary);
}

.checkbox input:checked + span {
    font-weight: 500;
}

.lang-dropdown {
    min-width: 125px !important;
    max-width: 150px !important;
    padding: var(--spacing-sm) !important;
    right: 0;
}

.dropdown:hover .lang-dropdown {
    display: flex !important;
    flex-direction: column;
    gap: 0;
}

.lang-link {
    text-transform: uppercase;
    font-weight: 500;
    text-align: center;
}

.lang-current {
    font-weight: 700;
}

@media (prefers-color-scheme: dark) {
    :root {
        --color-primary: #60a5fa70;
        --color-primary-dark: #3b82f6;
        --color-primary-light: #93c5fd;
        --color-bg: #1a202c;
        --color-bg-alt: #2d3748;
        --color-text: #e2e8f0;
        --color-text-light: #a0aec0;
        --color-border: #4a5568;
        --color-border-dark: #2d3748;
        --color-success: #38a169;
        --color-warning: #d69e2e;
        --color-error: #e53e3e;
        
        --color-code-bg:        #111b27;
        --color-code-bg-hover:  #192433;
        --color-code-header:    #192433;
        --color-code-border:    #1f3040;
        --color-code-text:      #b8c8d4;
        --color-code-text-dim:  #7898aa;
        --shadow-code:          0 4px 20px rgba(0, 0, 0, 0.55);
    }
}

[data-theme='light'] {
    --color-primary: #2563eb;
    --color-primary-dark: #1e40af;
    --color-primary-light: #3b82f6;
    --color-bg: #ffffff;
    --color-bg-alt: #f9fafb;
    --color-bg-alt2: #e8e9eb;
    --color-text: #1f2937;
    --color-text-light: #6b7280;
    --color-border: #e5e7eb;
    --color-border-dark: #d1d5db;
    --color-success: #10b981;
    --color-warning: #f59e0b;
    --color-error: #ef4444;
    
    --color-code-bg:        #1e2a38;
    --color-code-bg-hover:  #273547;
    --color-code-header:    #273547;
    --color-code-border:    #324454;
    --color-code-text:      #cad6e0;
    --color-code-text-dim:  #8aaab8;
    --shadow-code:          0 4px 16px rgba(0, 0, 0, 0.22), 0 1px 3px rgba(0, 0, 0, 0.1);
}

[data-theme='dark'] {
    --color-primary: #83a4cb;
    --color-primary-dark: #1F4683;
    --color-primary-light: #447bbd;
    --color-bg: #1a202c;
    --color-text: #e2e8f0;
    --color-text-light: #a0aec0;
    --color-border: #4a5568;
    --color-success: #38a169;
    --color-warning: #d69e2e;
    --color-error: #e53e3e;
    
    --color-bg-alt: #232d3d;
    --color-bg-alt2: #2a3a53da;
    --color-border-dark: #334155;
    
    --color-code-bg:        #111b27;
    --color-code-bg-hover:  #192433;
    --color-code-header:    #192433;
    --color-code-border:    #1f3040;
    --color-code-text:      #b8c8d4;
    --color-code-text-dim:  #7898aa;
    --shadow-code:          0 4px 20px rgba(0, 0, 0, 0.55);
}

[data-theme='dark'] .highlighted-text {
    background-color: #2d3748;
    color: var(--color-success);
}

[data-theme='dark'] .highlighted-text:hover, code:hover {
    border-color: #38a169;
    background-color: rgba(56, 161, 105, 0.1);
}
[data-theme='dark'] code {
    background-color: #2d3748;
    color: var(--color-success);
}

[data-theme='dark'] code:hover {
    border-color: #38a169;
    background-color: rgba(56, 161, 105, 0.1);
}


[data-theme='book'] {
    --color-primary: #8b5e3c;
    --color-primary-dark: #6f4a30;
    --color-primary-light: #a67c52;
    --color-bg: #fdf6e3;
    --color-bg-alt: #eee8d5;
    --color-bg-alt2: #e4daba;
    --color-text: #5b4636;
    --color-text-light: #839496;
    --color-border: #d5ccb6;
    --color-border-dark: #b58900;
    --color-warning: #b58900;
    --color-error: #dc322f;
    
    --color-code-bg:        #261e13;
    --color-code-bg-hover:  #30261a;
    --color-code-header:    #30261a;
    --color-code-border:    #3d2f1e;
    --color-code-text:      #d4c9b0;
    --color-code-text-dim:  #9a8060;
    --shadow-code:          0 4px 16px rgba(80, 50, 20, 0.25),
                            0 1px 3px  rgba(80, 50, 20, 0.12);
    
    --font-family: 'Georgia', serif;
}

[data-theme='book'] h2 {
    border-left-color: var(--color-primary);
}

[data-theme='book'] .highlighted-text:hover, code:hover {
    border-color: var(--color-success);
    background-color: rgba(133, 153, 0, 0.1);
}


.theme-dropdown {
    position: relative;
    display: inline-block;
}

.theme-dropdown-btn {
    background-color: var(--color-bg);
    border: 2px solid var(--color-border);
    border-radius: var(--radius-md);
    padding: var(--spacing-sm) var(--spacing-md);
    color: var(--color-text);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 700;
    transition: var(--transition);
}

.theme-dropdown-btn:hover {
    border-color: var(--color-primary);
}

.theme-dropdown-content {
    display: none;
    position: absolute;
    right: 0;
    top: 100%;
    margin-top: 4px;
    background-color: var(--color-bg);
    min-width: 140px;
    box-shadow: var(--shadow-lg);
    border: 2px solid var(--color-border);
    border-radius: var(--radius-md);
    z-index: 1002;
    overflow: hidden;
}

.theme-dropdown.active .theme-dropdown-content {
    display: block;
}

.theme-option {
    padding: 10px 16px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.9rem;
    color: var(--color-text);
    transition: background-color 0.2s;
}

.theme-option:hover {
    background-color: var(--color-bg-alt);
}

.theme-option svg {
    width: 18px;
    height: 18px;
    fill: currentColor;
}

.theme-option.active {
    color: var(--color-primary);
    font-weight: 600;
    background-color: rgba(37, 99, 235, 0.05);
}

/* ============================================
    TABLE STYLES (GitHub Docs Style - Proportional)
    ============================================ */

table {
    width: 100%;
    max-width: 100%;
    margin-top: var(--spacing-lg);
    background-color: var(--color-bg);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    border-collapse: separate;
    border-spacing: 0;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
    table-layout: fixed;
}

thead th:nth-child(1), tbody tr:first-child td:nth-child(1) {
    width: 23%;
}

thead th:nth-child(2), tbody tr:first-child td:nth-child(2) {
    width: 23%;
}

thead th:nth-child(3):not(:last-child), tbody tr:first-child td:nth-child(3):not(:last-child) {
    width: 20%;
}

thead th:last-child, tbody tr:first-child td:last-child {
    width: auto;
}

th, td {
    padding: 7px 7px;
    text-align: left;
    border: 1px solid var(--color-border);
    vertical-align: middle;
    overflow: hidden;
    text-overflow: ellipsis;
}

td.category{
    text-align: center;
    font-size: 1.25rem!Important;
    padding: 8px 14px;
    font-weight: 600;
    letter-spacing: 1.5px;
    background: linear-gradient(to bottom, var(--color-bg-alt2), var(--color-bg-alt));
}

th {
    background: linear-gradient(to bottom, var(--color-bg-alt2), var(--color-bg-alt));
    font-weight: 600;
    font-size: 0.82rem;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    color: var(--color-text);
    border-bottom: 2px solid var(--color-primary-light);
    padding: 10px 14px;
    white-space: nowrap;
}

/* GitHub-style header row */
thead tr {
    border-bottom: 2px solid var(--color-primary-light);
}

/* Hover effect on rows - GitHub style */
tbody tr {
    transition: background-color 0.15s ease-in-out;
}

tbody tr:hover {
    background-color: rgba(37, 99, 235, 0.04);
}

/* Alternating rows with subtle difference */
.even-row {
    background-color: var(--color-bg-alt);
}

.odd-row {
    background-color: var(--color-bg);
}

tbody tr:hover.even-row {
    background-color: rgba(37, 99, 235, 0.06);
}

tbody tr:hover.odd-row {
    background-color: rgba(37, 99, 235, 0.08);
}

/* Column-specific styling */
tbody td:nth-child(1) {
    font-family: var(--font-mono);
    font-size: 0.85rem;
}

tbody td:nth-child(2) {
    font-size: 0.88rem;
}

tbody td:nth-child(3) {
    font-size: 0.88rem;
    line-height: 1.5;
}
    
tbody td:nth-child(4) {
    font-size: 0.88rem;
    line-height: 1.5;
}

/* Mobile adaptation for tables */
@media (max-width: 768px) {
    table {
        display: block;
        overflow-x: auto;
        white-space: nowrap;
    }
    
    th, td {
        padding: 8px 12px;
        font-size: 0.82rem;
    }
}

/* ============================================
    HIGHLIGHTED TEXT (GitHub-style with copy)
    ============================================ */

.highlighted-text, code {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    border-radius: 6px;
    font-family: var(--font-mono);
    font-size: 0.875rem;
    font-weight: 500;
    background-color: var(--color-bg-alt);
    border: 1px solid var(--color-border);
    color: var(--color-text);
    cursor: pointer;
    transition: all 0.2s ease;
    user-select: none;
}

.highlighted-text:hover, code:hover {
    border-color: var(--color-primary-light);
    background-color: var(--color-bg-alt2);
    box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.1);
}

/* Добавить после блока .highlighted-text, code { ... } */

code::after {
    content: '';
    display: inline-block;
    width: 14px;
    height: 14px;
    flex-shrink: 0;
    opacity: 0;
    transition: opacity 0.2s ease;
    background-color: var(--color-text-light);
    -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='9' y='9' width='13' height='13' rx='2'/%3E%3Cpath d='M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1'/%3E%3C/svg%3E") no-repeat center / contain;
    mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='9' y='9' width='13' height='13' rx='2'/%3E%3Cpath d='M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1'/%3E%3C/svg%3E") no-repeat center / contain;
}

code:hover::after {
    opacity: 1;
    background-color: var(--color-primary);
}

code.copied {
    border-color: var(--color-success);
    background-color: rgba(16, 185, 129, 0.1);
    color: var(--color-success);
}

code.copied::after {
    opacity: 1;
    background-color: var(--color-success);
}

/* Отключить псевдоэлемент у code внутри .code-block — там своя логика */
.code-block code::after {
    display: none;
}

/* Copy icon button */
.highlighted-text .copy-icon-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    opacity: 0;
    transition: opacity 0.2s ease;
    color: var(--color-text-light);
}

.highlighted-text:hover .copy-icon-btn {
    opacity: 1;
}

.highlighted-text .copy-icon-btn svg {
    width: 14px;
    height: 14px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.highlighted-text .copy-icon-btn:hover {
    color: var(--color-primary);
}

.highlighted-text.copied {
    border-color: var(--color-success);
    background-color: rgba(16, 185, 129, 0.1);
    color: var(--color-success);
}

.highlighted-text.copied .copy-icon-btn {
    opacity: 1;
    color: var(--color-success);
}

/* ============================================
   SCROLL TO TOP BUTTON
   ============================================ */

#scroll-to-top {
    position: fixed;
    bottom: var(--spacing-xl);
    right: var(--spacing-xl);
    width: 55px;
    height: 55px;
    background-color: var(--color-primary);
    border: 2px solid var(--color-primary);
    color: var(--color-text);
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: none;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease, border-color 0.2s ease, color 0.2s ease, transform 0.2s ease;
    z-index: 1003;
}

#scroll-to-top.visible {
    opacity: 1;
    visibility: visible;
}

#scroll-to-top:hover {
    background-color: var(--color-primary-dark);
    border-color: var(--color-primary-dark);
    transform: translateY(-2px);
}

#scroll-to-top:active {
    transform: scale(0.95);
}

#scroll-to-top svg {
    width: 24px;
    height: 24px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

@media (max-width: 768px) {
    #scroll-to-top {
        bottom: var(--spacing-lg);
        right: var(--spacing-md);
        width: 40px;
        height: 40px;
    }
}

/* ============================================
   TABLE OF CONTENTS (Оглавление - GitHub Compact)
   ============================================ */

.toc-container {
    background-color: var(--color-bg);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    padding: var(--spacing-lg);
    margin-bottom: var(--spacing-xl);
    box-shadow: none;
}

.toc-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--color-text);
    margin-bottom: var(--spacing-md);
    border-bottom: 1px solid var(--color-border);
    display: flex;
    align-items: center;
    gap: var(--spacing-xs);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-top: 0;
}

.toc-title svg {
    width: 16px;
    height: 16px;
    fill: none;
    stroke: var(--color-primary);
    stroke-width: 2;
}

.toc-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.toc-list-parent {
    margin-bottom: 2px;
}

.toc-list-parent:last-child {
    margin-bottom: 0;
}

.toc-list-header {
    font-weight: 600;
    font-size: 0.88rem;
    color: var(--color-text);
    display: block;
}

.toc-list-header a {
    color: var(--color-primary);
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 4px 8px;
    border-radius: var(--radius-sm);
    transition: var(--transition);
    font-size: 0.88rem;
}

.toc-list-header a:hover {
    background-color: rgba(37, 99, 235, 0.06);
    color: var(--color-primary-dark);
    text-decoration: none;
}

.toc-list-header a::before {
    content: none;
}

.toc-list-header a::before {
    content: "›";
    color: var(--color-primary-light);
    font-size: 1.1rem;
    font-weight: bold;
    line-height: 1;
}

.toc-sublist {
    list-style: none;
    padding: 2px 0 2px 1.2rem;
    margin: 0;
    border-left: none;
}

.toc-sublist li {
    margin-bottom: 0;
}

.toc-sublist a {
    color: var(--color-text-light);
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 3px 8px;
    border-radius: var(--radius-sm);
    font-size: 0.82rem;
    transition: var(--transition);
    font-weight: 400;
}

.toc-sublist a:hover {
    background-color: rgba(37, 99, 235, 0.05);
    color: var(--color-primary);
    text-decoration: none;
}

.toc-sublist a::before {
    content: "–";
    color: var(--color-border-dark);
    font-size: 0.9rem;
    font-weight: normal;
    line-height: 1;
}

/* Collapsible TOC */
.toc-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    cursor: pointer;
    background: none;
    border: none;
    padding: 0;
}

.toc-toggle svg {
    width: 16px;
    height: 16px;
    fill: none;
    stroke: var(--color-primary);
    stroke-width: 2;
    transition: transform 0.3s ease;
}

.toc-container.collapsed .toc-list {
    display: none;
}

.toc-container.collapsed .toc-toggle svg:last-child {
    transform: rotate(-90deg);
}

/* Responsive */
@media (max-width: 768px) {
    .toc-container {
        padding: var(--spacing-md);
    }
    
    .toc-title {
        font-size: 0.88rem;
    }
    
    .toc-list-header a {
        font-size: 0.85rem;
        padding: 3px 6px;
    }
    
    .toc-sublist a {
        font-size: 0.8rem;
        padding: 2px 6px;
    }
}


/* ============================================
   KBD — KEYBOARD SHORTCUT KEYS (JetBrains style)
   ============================================ */

kbd {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 1.6em;
    padding: 2px 7px;
    font-family: var(--font-mono);
    font-size: 0.9rem;
    line-height: 1.6;
    color: var(--color-text);
    background: linear-gradient(to bottom, #f8f9fa 0%, #eaecee 100%);
    border: 1px solid #b0b7be;
    border-bottom-width: 2px;
    border-radius: 4px;
    box-shadow: inset 0 -1px 0 #b0b7be;
    white-space: nowrap;
    user-select: none;
    vertical-align: middle;
}

[data-theme='dark'] kbd {
    color: var(--color-text);
    background: linear-gradient(to bottom, #2d3748 0%, #232d3d 100%);
    border-color: #4a5568;
    box-shadow: inset 0 -1px 0 #1a202c;
}

[data-theme='book'] kbd {
    background: linear-gradient(to bottom, #f5f0e8 0%, #e8e0cc 100%);
    border-color: #c8b89a;
    box-shadow: inset 0 -1px 0 #c8b89a;
}

@media (prefers-color-scheme: dark) {
    :root:not([data-theme]) kbd {
        color: var(--color-text);
        background: linear-gradient(to bottom, #2d3748 0%, #232d3d 100%);
        border-color: #4a5568;
        box-shadow: inset 0 -1px 0 #1a202c;
    }
}

/* --- Keystroke: иконка + подпись --- */
kbd.keystroke {
    gap: 4px;
    padding: 2px 8px;
}

kbd.keystroke .keystroke__icon {
    font-size: 1.05em;
    line-height: 1;
    font-style: normal;
    display: inline-block;
}

/* --- Стрелки: только символ, чуть крупнее --- */
kbd.keystroke .keystroke__arrow {
    font-size: 1.1rem;
    line-height: 1.2;
}
