/* === ОСНОВНЫЕ ПЕРЕМЕННЫЕ (единый стиль резюме) === */
:root {
    --index: calc(1vw + 1.2vh);
    --transition: 1.5s cubic-bezier(.05, .5, 0, 1);
    --glass-bg: rgba(0, 0, 0, 0.55);
    --glass-border: rgba(255, 255, 255, 0.15);
    --text-color: #ffffff;
    --accent: #a5d8ff;
    --accent2: #4dabf7;
    --dark-bg: #0d1117;
}

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

@font-face {
    font-family: 'kamerik-3d';
    src: url('../fonts/kamerik205-heavy.woff2') format('woff2');
    font-weight: 900;
}
@font-face {
    font-family: 'merriweather-italic';
    src: url('../fonts/merriweather-regular-italic.woff2') format('woff2');
}

body {
    background-color: #000;
    color: var(--text-color);
    font-family: 'merriweather-italic', serif;
    overflow-x: hidden;
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    padding: 1rem;
    -webkit-font-smoothing: antialiased;
}

/* === 3D СЦЕНА (ФОН) === */
.layers {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    z-index: -1;
    perspective: 1000px;
    overflow: hidden;
}
.layers__container {
    height: 100vh;
    transform-style: preserve-3d;
    transform: rotateX(var(--move-y, 0deg)) rotateY(var(--move-x, 0deg));
    will-change: transform;
    transition: transform var(--transition);
}
.layers__item {
    position: absolute;
    inset: -5vw;
    background-size: cover;
    background-position: center;
    display: flex;
    align-items: center;
    justify-content: center;
}
.layer-1 { transform: translateZ(-55px) scale(1.06); }
.layer-2 { transform: translateZ(80px) scale(0.88); }
.layer-4 { transform: translateZ(190px) scale(0.9); }
.layer-5 { transform: translateZ(300px) scale(0.9); }
.layer-6 { transform: translateZ(380px); }

canvas.rain {
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
}

/* === ОСНОВНОЙ КОНТЕЙНЕР === */
.main-content {
    width: 100%;
    max-width: 1600px;
    z-index: 1;
    margin-top: calc(var(--index) * 1);
}
.container {
    width: 100%;
}

/* Стеклянная карточка (общий класс) */
.glass-card {
    background: var(--glass-bg);
    backdrop-filter: blur(12px);
    border-radius: calc(var(--index) * 1.8);
    border: 1px solid var(--glass-border);
    padding: calc(var(--index) * 1.5);
    box-shadow: 0 20px 40px rgba(0,0,0,0.5);
    transition: transform 0.3s ease;
}

/* ========== КНОПКИ НАВИГАЦИИ (единый стиль) ========== */

/* Кнопка "К проектам" в хедере (index.html) */
.back-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    border: 1px solid var(--accent);
    color: var(--accent);
    padding: 0.6rem 1.8rem;
    border-radius: 30px;
    font-weight: bold;
    font-size: calc(var(--index) * 0.7);
    transition: 0.3s;
    text-decoration: none;
}
.back-btn:hover {
    background: var(--accent);
    color: #000;
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.4);
}

/* Кнопки "Назад к сканеру" и "Назад к списку" внутри #app */
.back-btn-script {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    border: 1px solid var(--accent);
    color: var(--accent);
    padding: 0.5rem 1.5rem;
    border-radius: 30px;
    font-weight: bold;
    font-size: calc(var(--index) * 0.7);
    transition: 0.3s;
    text-decoration: none;
    cursor: pointer;
    margin-bottom: 15px;
}
.back-btn-script:hover {
    background: var(--accent);
    color: #000;
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.4);
}

/* Мини-кнопка документации на странице монеты */
.docs-mini-btn {
    display: inline-block;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(8px);
    border: 1px solid var(--accent);
    color: var(--accent);
    padding: 0.4rem 1rem;
    border-radius: 30px;
    font-size: 0.9rem;
    font-weight: bold;
    text-decoration: none;
    transition: 0.3s;
}
.docs-mini-btn:hover {
    background: var(--accent);
    color: #000;
    transform: translateY(-2px);
}

/* Кнопка документации на главной */
.docs-btn {
    display: inline-block;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(10px);
    color: var(--accent);
    text-decoration: none;
    padding: 10px 24px;
    border-radius: 40px;
    font-size: calc(var(--index) * 0.8);
    border: 1px solid var(--accent);
    transition: all 0.2s;
    box-shadow: 0 4px 15px rgba(0,0,0,0.3);
    font-weight: bold;
}
.docs-btn:hover {
    background: var(--accent);
    color: #000;
    transform: translateY(-2px);
}

/* === ЗАГОЛОВКИ === */
h1 {
    font-family: 'kamerik-3d', sans-serif;
    color: var(--accent);
    font-size: calc(var(--index) * 2);
    margin: 0;
}

/* Статус */
.status {
    text-align: center;
    margin-bottom: 1rem;
    padding: 0.8rem;
    background: rgba(0,0,0,0.3);
    border-radius: 30px;
    backdrop-filter: blur(5px);
    border: 1px solid rgba(255,255,255,0.1);
}
.dot {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    margin-right: 5px;
    animation: pulse 1.5s infinite;
}
@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* Сетка монет */
.coins-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
    gap: 12px;
    margin-top: 20px;
}
.coin-card {
    background: rgba(22, 27, 34, 0.8);
    backdrop-filter: blur(8px);
    border-radius: 16px;
    padding: 12px;
    text-align: center;
    cursor: pointer;
    transition: 0.2s;
    border: 1px solid rgba(255,255,255,0.1);
}
.coin-card:hover {
    border-color: var(--accent);
    transform: translateY(-3px);
}
.coin-card img {
    width: 40px;
    height: 40px;
    margin-bottom: 8px;
}
.coin-card .name {
    font-weight: bold;
    font-size: 0.85rem;
}
.coin-card .symbol {
    color: #8b949e;
    font-size: 0.7rem;
}
.fallback-icon {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: #1c2430;
    color: #c9d1d9;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 16px;
    margin: 0 auto 8px;
}

/* Сводка по слоям */
.layers-summary { margin: 15px 0; }
.layers-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
}
.layer-card {
    background: rgba(22, 27, 34, 0.7);
    backdrop-filter: blur(8px);
    border-radius: 16px;
    padding: 12px;
    text-align: center;
    border: 1px solid rgba(255,255,255,0.1);
}
.layer-title {
    font-size: 0.7rem;
    color: #8b949e;
    margin-bottom: 6px;
}
.layer-score {
    font-size: 1.4rem;
    font-weight: bold;
}
.layer-desc {
    font-size: 0.7rem;
    margin-top: 4px;
}

/* Детальный анализ */
.analysis-details { margin: 15px 0; }
.analysis-card {
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(12px);
    border-radius: 16px;
    overflow: hidden;
    border: 1px solid rgba(255,255,255,0.15);
    box-shadow: 0 10px 25px rgba(0,0,0,0.4);
}
.analysis-card details {
    padding: 12px;
    color: #f0f4ff;
}
.analysis-card summary {
    cursor: pointer;
    font-weight: bold;
    color: var(--accent);
    font-size: calc(var(--index) * 0.9);
    padding: 8px 12px;
    background: rgba(0,0,0,0.3);
    border-radius: 12px;
    margin: -12px -12px 12px -12px;
    transition: background 0.2s;
}
.analysis-card summary:hover {
    background: rgba(165,216,255,0.1);
}
.analysis-content {
    margin-top: 12px;
    padding: 12px;
    background: rgba(0,0,0,0.4);
    border-radius: 12px;
    color: #e2e8f0;
}
.analysis-section { margin-bottom: 12px; }
.analysis-section h4 {
    font-size: 0.8rem;
    color: #cbd5e1;
    margin-bottom: 6px;
    font-weight: bold;
}
.analysis-section ul {
    list-style: none;
    padding-left: 0;
}
.analysis-section li {
    font-size: 0.75rem;
    padding: 4px 0;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    color: #e2e8f0;
}
.loading-text {
    text-align: center;
    padding: 20px;
    color: #f0f4ff;
    font-size: calc(var(--index) * 0.8);
    opacity: 1;
    text-shadow: 0 1px 3px rgba(0,0,0,0.6);
}

/* Таблица */
.table-wrapper {
    width: 100%;
    overflow-x: auto;
    margin-top: 15px;
}
table {
    width: 100%;
    border-collapse: collapse;
    background: rgba(22, 27, 34, 0.7);
    backdrop-filter: blur(8px);
    border-radius: 16px;
    overflow: hidden;
    font-size: 0.85rem;
    color: #c9d1d9;
}
th, td {
    padding: 10px 8px;
    text-align: left;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}
th {
    background: rgba(28, 36, 48, 0.8);
    color: #8b949e;
    font-weight: 600;
}
.price {
    color: #7ee787;
    font-weight: bold;
}

/* График */
#chart-container {
    width: 100%;
    height: 400px;
    margin: 15px 0;
    border-radius: 16px;
    overflow: hidden;
    background: rgba(22, 27, 34, 0.6);
    backdrop-filter: blur(8px);
}

/* Цвета сигналов */
.positive { color: #7ee787; }
.negative { color: #f85149; }
.neutral { color: #8b949e; }

/* ========== ДОКУМЕНТАЦИЯ ========== */
.docs-container {
    max-width: 900px;
    margin: 0 auto;
    padding: 0 10px;
}
.docs-container h1 {
    text-align: center;
    margin-bottom: 10px;
    font-size: calc(var(--index) * 3);
    color: #ffffff;
    text-shadow: 0 0 15px rgba(165, 216, 255, 0.6), 0 2px 4px rgba(0, 0, 0, 0.8);
}
.docs-subtitle {
    text-align: center;
    color: #f0f4ff;
    margin-bottom: 30px;
    font-size: calc(var(--index) * 0.95);
    font-weight: 500;
    opacity: 1;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.7);
    letter-spacing: 0.02em;
}
.docs-section {
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(12px);
    border-radius: 20px;
    padding: 25px;
    margin-bottom: 20px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 10px 30px rgba(0,0,0,0.3);
}
.docs-section h2 {
    font-family: 'kamerik-3d', sans-serif;
    color: var(--accent);
    font-size: calc(var(--index) * 1.3);
    margin-bottom: 12px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    padding-bottom: 8px;
}
.docs-section p {
    color: #e2e8f0;
    line-height: 1.6;
    margin-bottom: 12px;
    font-size: calc(var(--index) * 0.7);
}
.docs-section ul {
    padding-left: 20px;
    margin-bottom: 12px;
}
.docs-section li {
    color: #cbd5e1;
    margin-bottom: 6px;
    line-height: 1.4;
    font-size: calc(var(--index) * 0.65);
}
.docs-section strong {
    color: #facc15;
}
.docs-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 10px;
    background: rgba(0,0,0,0.3);
    border-radius: 12px;
    overflow: hidden;
}
.docs-table th, .docs-table td {
    padding: 10px;
    text-align: left;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    color: #e2e8f0;
    font-size: calc(var(--index) * 0.65);
}
.docs-table th {
    background: rgba(0,0,0,0.5);
    color: #facc15;
    font-weight: bold;
}
.signal-strong-buy { color: #00ff00; font-weight: bold; }
.signal-buy { color: #7ee787; font-weight: bold; }
.signal-neutral { color: #8b949e; }
.signal-sell { color: #f85149; font-weight: bold; }
.signal-strong-sell { color: #ff0000; font-weight: bold; }

/* ========== АДАПТИВНОСТЬ ========== */
@media (max-width: 768px) {
    :root {
        --index: calc(0.9vw + 0.9vh);
    }
    body {
        padding: 0.5rem;
    }
    .glass-card {
        padding: calc(var(--index) * 1.5);
    }
    h1 {
        font-size: clamp(16px, calc(var(--index) * 2.5), 32px);
    }
    .main-content header {
        flex-direction: column;
        align-items: stretch;
    }
    .back-btn {
        width: 100%;
        justify-content: center;
        font-size: clamp(12px, calc(var(--index) * 0.7), 18px);
    }
    .coins-grid {
        grid-template-columns: repeat(auto-fill, minmax(85px, 1fr));
        gap: 8px;
    }
    .coin-card {
        padding: 8px;
    }
    .coin-card img {
        width: 32px; height: 32px;
    }
    .coin-card .name {
        font-size: clamp(12px, 0.75rem, 16px);
    }
    .coin-card .symbol {
        font-size: clamp(12px, 0.7rem, 14px);
    }
    .layers-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 8px;
    }
    .layer-card {
        padding: 8px;
    }
    .layer-title { font-size: clamp(12px, 0.65rem, 14px); }
    .layer-score { font-size: clamp(14px, 1.1rem, 22px); }
    .layer-desc { font-size: clamp(12px, 0.6rem, 14px); }
    #chart-container {
        height: 280px;
    }
    .table-wrapper {
        overflow-x: auto;
    }
    table {
        font-size: clamp(12px, 0.7rem, 16px);
    }
    th, td {
        padding: 6px 4px;
    }
    .docs-container h1 {
        font-size: clamp(18px, calc(var(--index) * 3.5), 42px);
    }
    .docs-subtitle {
        font-size: clamp(12px, calc(var(--index) * 0.9), 20px);
    }
    .docs-section {
        padding: 15px;
    }
    .docs-section h2 {
        font-size: clamp(14px, calc(var(--index) * 1.4), 24px);
    }
    .docs-section p {
        font-size: clamp(12px, calc(var(--index) * 0.7), 18px);
    }
    .docs-section li {
        font-size: clamp(12px, calc(var(--index) * 0.65), 16px);
    }
    .docs-table th, .docs-table td {
        font-size: clamp(12px, calc(var(--index) * 0.65), 16px);
    }
    .signal-strong-buy, .signal-buy, .signal-strong-sell, .signal-sell, .signal-neutral {
        font-size: inherit;
    }
}

@media (max-width: 480px) {
    :root {
        --index: calc(1vw + 1.5vh);
    }
    .coins-grid {
        grid-template-columns: repeat(3, 1fr);
    }
    .layers-grid {
        grid-template-columns: 1fr 1fr;
    }
    #chart-container {
        height: 240px;
    }
}