.formula-container {
    max-width: 1000px;
    margin: 0 auto;
    padding: 20px;
}

.formula-header {
    text-align: center;
    margin-bottom: 48px;
    padding: 40px 20px;
    background: linear-gradient(135deg, rgba(255, 215, 0, 0.1) 0%, rgba(0, 0, 0, 0) 100%);
    border-radius: 16px;
    border: 1px solid rgba(255, 215, 0, 0.2);
}

.formula-title {
    font-size: 42px;
    font-weight: 900;
    background: linear-gradient(135deg, #FFD700 0%, #FFC700 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 12px;
}

.formula-subtitle {
    color: #999;
    font-size: 18px;
    margin-bottom: 20px;
}

.formula-description {
    color: #666;
    font-size: 16px;
    max-width: 800px;
    margin: 0 auto;
    line-height: 1.6;
}

.formula-description-markdown {
    color: #e0e0e0;
    font-size: 16px;
    max-width: 800px;
    margin: 0 auto;
    line-height: 1.8;
}

.formula-description-markdown h1,
.formula-description-markdown h2,
.formula-description-markdown h3,
.formula-description-markdown h4,
.formula-description-markdown h5,
.formula-description-markdown h6 {
    color: #FFD700;
    margin-top: 24px;
    margin-bottom: 12px;
    font-weight: 700;
}

.formula-description-markdown h1 {
    font-size: 28px;
}

.formula-description-markdown h2 {
    font-size: 24px;
}

.formula-description-markdown h3 {
    font-size: 20px;
}

.formula-description-markdown p {
    margin-bottom: 16px;
    color: #e0e0e0;
}

.formula-description-markdown ul,
.formula-description-markdown ol {
    margin-bottom: 16px;
    padding-left: 24px;
    color: #e0e0e0;
}

.formula-description-markdown li {
    margin-bottom: 8px;
}

.formula-description-markdown code {
    background: rgba(255, 215, 0, 0.1);
    color: #FFD700;
    padding: 2px 6px;
    border-radius: 4px;
    font-family: 'Courier New', monospace;
    font-size: 14px;
}

.formula-description-markdown pre {
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 215, 0, 0.3);
    border-radius: 8px;
    padding: 16px;
    overflow-x: auto;
    margin-bottom: 16px;
}

.formula-description-markdown pre code {
    background: transparent;
    color: #e0e0e0;
    padding: 0;
}

.formula-description-markdown blockquote {
    border-left: 4px solid #FFD700;
    padding-left: 16px;
    margin-left: 0;
    margin-bottom: 16px;
    color: #999;
    font-style: italic;
}

.formula-description-markdown a {
    color: #4FC3F7;
    text-decoration: none;
    border-bottom: 1px solid rgba(79, 195, 247, 0.3);
    transition: all 0.3s ease;
}

.formula-description-markdown a:hover {
    color: #29B6F6;
    border-bottom-color: #29B6F6;
}

.formula-description-markdown table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 16px;
}

.formula-description-markdown table th,
.formula-description-markdown table td {
    border: 1px solid rgba(255, 215, 0, 0.3);
    padding: 12px;
    text-align: left;
}

.formula-description-markdown table th {
    background: rgba(255, 215, 0, 0.1);
    color: #FFD700;
    font-weight: 700;
}

.formula-description-markdown table td {
    color: #e0e0e0;
}

.formula-description-markdown hr {
    border: none;
    border-top: 2px solid rgba(255, 215, 0, 0.3);
    margin: 24px 0;
}

.formula-description-markdown strong {
    color: #FFD700;
    font-weight: 700;
}

.formula-description-markdown em {
    color: #999;
    font-style: italic;
}

.formula-description-markdown .math-block {
    margin: 16px 0;
    text-align: center;
    overflow-x: auto;
}

.formula-description-markdown .math-block .MathJax {
    display: inline-block !important;
}

/* Стили для KaTeX формул */
.formula-description-markdown .katex {
    font-size: 1.1em;
    color: #e0e0e0;
}

.formula-description-markdown .katex-display {
    margin: 16px 0;
    overflow-x: auto;
    overflow-y: hidden;
}

.formula-description-markdown .katex-display > .katex {
    text-align: left;
    max-width: 100%;
}

/* Инлайн формулы */
.formula-description-markdown .katex:not(.katex-display) {
    font-size: 1.05em;
    padding: 0 2px;
}

.formula-section {
    background: linear-gradient(135deg, #1a1a1a 0%, #0d0d0d 100%);
    border: 2px solid rgba(255, 215, 0, 0.3);
    border-radius: 16px;
    padding: 32px;
    margin-bottom: 32px;
}

.section-title {
    color: #FFD700;
    font-size: 24px;
    font-weight: 700;
    margin-bottom: 24px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.formula-expression {
    background: rgba(0, 0, 0, 0.3);
    border: 2px solid rgba(255, 215, 0, 0.3);
    border-radius: 12px;
    padding: 24px;
    font-family: 'Courier New', monospace;
    font-size: 18px;
    color: #e0e0e0;
    text-align: left;
    word-break: break-word;
    overflow-x: auto;
    margin-bottom: 24px;
    white-space: pre-wrap;
    line-height: 1.8;
}

.formula-math-container {
    background: rgba(0, 0, 0, 0.3);
    border: 2px solid rgba(255, 215, 0, 0.3);
    border-radius: 12px;
    padding: 32px;
    margin-bottom: 24px;
    text-align: center;
    overflow-x: auto;
}

.formula-math-container .MathJax {
    font-size: 1.2em !important;
    color: #e0e0e0 !important;
}

.formula-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
    border-bottom: 2px solid rgba(255, 215, 0, 0.3);
}

.formula-tab {
    padding: 12px 24px;
    background: rgba(255, 255, 255, 0.05);
    border: none;
    border-bottom: 3px solid transparent;
    color: #999;
    cursor: pointer;
    font-size: 16px;
    font-weight: 600;
    transition: all 0.3s ease;
}

.formula-tab:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #e0e0e0;
}

.formula-tab.active {
    color: #FFD700;
    border-bottom-color: #FFD700;
    background: rgba(255, 215, 0, 0.1);
}

.formula-view {
    display: none;
}

.formula-view.active {
    display: block;
}

.formula-expression .param {
    color: #FFD700;
    font-weight: 700;
    background: rgba(255, 215, 0, 0.1);
    padding: 2px 6px;
    border-radius: 4px;
}

.formula-expression .function {
    color: #4FC3F7;
    font-weight: 700;
    background: rgba(79, 195, 247, 0.1);
    padding: 2px 6px;
    border-radius: 4px;
}

.formula-expression .number {
    color: #81C784;
    font-weight: 600;
}

.formula-expression .operator {
    color: #FFB74D;
    font-weight: 700;
}

.formula-math {
    background: rgba(0, 0, 0, 0.3);
    border: 2px solid rgba(255, 215, 0, 0.3);
    border-radius: 12px;
    padding: 24px;
    margin-bottom: 24px;
    text-align: center;
    overflow-x: auto;
}

.formula-math .MathJax {
    color: #e0e0e0 !important;
}

.params-list {
    display: grid;
    gap: 16px;
}

.functions-list {
    display: grid;
    gap: 16px;
}

.function-item {
    background: rgba(79, 195, 247, 0.05);
    border-left: 4px solid #4FC3F7;
    border-radius: 8px;
    padding: 20px;
    transition: all 0.3s ease;
}

.function-item:hover {
    background: rgba(79, 195, 247, 0.1);
    border-left-color: #29B6F6;
}

.function-name {
    color: #4FC3F7;
    font-size: 18px;
    font-weight: 700;
    font-family: 'Courier New', monospace;
    margin-bottom: 8px;
}

.function-description {
    color: #999;
    font-size: 14px;
    line-height: 1.5;
}

.param-item {
    background: rgba(255, 255, 255, 0.03);
    border-left: 4px solid #FFD700;
    border-radius: 8px;
    padding: 20px;
    transition: all 0.3s ease;
}

.param-item:hover {
    background: rgba(255, 255, 255, 0.05);
    border-left-color: #FFC700;
}

.param-name {
    color: #FFD700;
    font-size: 18px;
    font-weight: 700;
    font-family: 'Courier New', monospace;
    margin-bottom: 8px;
}

.param-label {
    color: #e0e0e0;
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 6px;
}

.param-description {
    color: #999;
    font-size: 14px;
    line-height: 1.5;
}

.info-box {
    background: rgba(255, 215, 0, 0.1);
    border-left: 4px solid #FFD700;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 24px;
    color: #e0e0e0;
    font-size: 14px;
    line-height: 1.6;
}

.no-params {
    text-align: center;
    padding: 40px 20px;
    color: #666;
    font-size: 16px;
}

@media (max-width: 768px) {
    .formula-container {
        padding: 12px;
    }
    
    .formula-header {
        padding: 24px 16px;
        margin-bottom: 24px;
    }
    
    .formula-title {
        font-size: 28px;
    }
    
    .formula-subtitle {
        font-size: 16px;
    }
    
    .formula-description-markdown {
        font-size: 14px;
        line-height: 1.6;
        padding: 0 8px;
    }
    
    .formula-description-markdown h1 {
        font-size: 22px;
        margin-top: 20px;
        margin-bottom: 10px;
    }
    
    .formula-description-markdown h2 {
        font-size: 20px;
        margin-top: 18px;
        margin-bottom: 10px;
    }
    
    .formula-description-markdown h3 {
        font-size: 18px;
        margin-top: 16px;
        margin-bottom: 8px;
    }
    
    .formula-description-markdown h4,
    .formula-description-markdown h5,
    .formula-description-markdown h6 {
        font-size: 16px;
        margin-top: 14px;
        margin-bottom: 8px;
    }
    
    .formula-description-markdown p {
        margin-bottom: 12px;
        font-size: 14px;
    }
    
    .formula-description-markdown ul,
    .formula-description-markdown ol {
        margin-bottom: 12px;
        padding-left: 20px;
    }
    
    .formula-description-markdown li {
        margin-bottom: 6px;
        font-size: 14px;
    }
    
    .formula-description-markdown code {
        font-size: 12px;
        padding: 2px 4px;
    }
    
    .formula-description-markdown pre {
        padding: 12px;
        margin-bottom: 12px;
        border-radius: 6px;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    .formula-description-markdown pre code {
        font-size: 12px;
    }
    
    .formula-description-markdown blockquote {
        padding-left: 12px;
        margin-left: 0;
        margin-bottom: 12px;
        font-size: 14px;
    }
    
    .formula-description-markdown table {
        display: block;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        margin-bottom: 12px;
        font-size: 12px;
    }
    
    .formula-description-markdown table th,
    .formula-description-markdown table td {
        padding: 8px;
        white-space: nowrap;
    }
    
    .formula-description-markdown hr {
        margin: 20px 0;
    }
    
    .formula-description-markdown .math-block {
        margin: 12px 0;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    /* KaTeX формулы должны быть адаптивными */
    .formula-description-markdown .katex {
        font-size: 1em !important;
        max-width: 100%;
        overflow-x: auto;
        overflow-y: hidden;
    }
    
    .formula-description-markdown .katex-display {
        overflow-x: auto;
        overflow-y: hidden;
        -webkit-overflow-scrolling: touch;
        margin: 12px 0;
    }
    
    .formula-description-markdown .katex-display > .katex {
        max-width: 100%;
        text-align: left;
        padding-right: 8px;
    }
    
    .formula-expression {
        font-size: 14px;
        padding: 16px;
    }
    
    .formula-section {
        padding: 16px;
        margin-bottom: 20px;
        border-radius: 12px;
    }
    
    .section-title {
        font-size: 20px;
        margin-bottom: 16px;
    }
    
    .function-item,
    .param-item {
        padding: 16px;
    }
    
    .function-name,
    .param-name {
        font-size: 16px;
    }
    
    .function-description,
    .param-description {
        font-size: 13px;
    }
    
    .param-label {
        font-size: 14px;
    }
    
    .formula-math-container {
        padding: 16px;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
}

@media (max-width: 480px) {
    .formula-container {
        padding: 8px;
    }
    
    .formula-header {
        padding: 20px 12px;
        margin-bottom: 20px;
    }
    
    .formula-title {
        font-size: 24px;
    }
    
    .formula-subtitle {
        font-size: 14px;
    }
    
    .formula-description-markdown {
        font-size: 13px;
        padding: 0 4px;
    }
    
    .formula-description-markdown h1 {
        font-size: 20px;
    }
    
    .formula-description-markdown h2 {
        font-size: 18px;
    }
    
    .formula-description-markdown h3 {
        font-size: 16px;
    }
    
    .formula-description-markdown h4,
    .formula-description-markdown h5,
    .formula-description-markdown h6 {
        font-size: 15px;
    }
    
    .formula-description-markdown ul,
    .formula-description-markdown ol {
        padding-left: 16px;
    }
    
    .formula-description-markdown table {
        font-size: 11px;
    }
    
    .formula-description-markdown table th,
    .formula-description-markdown table td {
        padding: 6px;
    }
    
    .formula-section {
        padding: 12px;
        border-radius: 8px;
    }
    
    .section-title {
        font-size: 18px;
        margin-bottom: 12px;
    }
    
    .function-item,
    .param-item {
        padding: 12px;
    }
    
    .function-name,
    .param-name {
        font-size: 14px;
    }
    
    .function-description,
    .param-description {
        font-size: 12px;
    }
}

