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

body {
    background: #0a0a0f;
    color: #e0e0e0;
    font-family: 'Segoe UI', -apple-system, sans-serif;
    overflow-x: hidden;
    height: 100vh;
    height: 100dvh;
}

/* ============================================================
   HEADER
   ============================================================ */
.header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    background: #111118;
    border-bottom: 1px solid #1e1e2e;
    min-height: 42px;
    flex-wrap: wrap;
}

.header h1 {
    font-size: 13px;
    font-weight: 600;
    color: #a0a0b0;
    letter-spacing: 0.5px;
    white-space: nowrap;
}

.selector-group {
    display: flex;
    gap: 3px;
    align-items: center;
    flex-wrap: wrap;
}

.selector-group .label {
    font-size: 10px;
    color: #555;
    margin-right: 2px;
    white-space: nowrap;
}

.coin-btn, .exchange-btn, .tf-btn, .gex-btn {
    background: #1a1a28;
    border: 1px solid #2a2a3a;
    color: #888;
    padding: 4px 10px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 11px;
    font-weight: 500;
    transition: all 0.15s;
    white-space: nowrap;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

.coin-btn:hover, .exchange-btn:hover, .tf-btn:hover {
    background: #252538;
    color: #ccc;
}

.coin-btn.active, .exchange-btn.active, .tf-btn.active {
    background: #2a2a48;
    border-color: #5555aa;
    color: #fff;
}

.gex-btn {
    background: #1a2a1a;
    border-color: #2a4a2a;
    color: #4ade80;
    font-weight: 600;
}

.gex-btn:hover {
    background: #2a3a2a;
}

.gex-btn:disabled {
    opacity: 0.5;
    cursor: wait;
}

/* ============================================================
   INFO BAR
   ============================================================ */
.info-bar {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 3px 12px;
    background: #0e0e16;
    border-bottom: 1px solid #1a1a28;
    font-size: 11px;
    min-height: 26px;
    flex-wrap: wrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.info-item {
    display: flex;
    align-items: center;
    gap: 4px;
    white-space: nowrap;
}

.info-label { color: #666; font-size: 10px; }

.info-value {
    font-weight: 600;
    font-family: 'SF Mono', 'Consolas', monospace;
    font-size: 11px;
}

.regime-positive { color: #4ade80; }
.regime-negative { color: #ef4444; }

.dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    display: inline-block;
    flex-shrink: 0;
}

.dot-green { background: #4ade80; }
.dot-red { background: #ef4444; }

.color-green { color: #4ade80; }
.color-red { color: #ef4444; }
.color-purple { color: #a855f7; }

/* ============================================================
   CHART
   ============================================================ */
#chart-container {
    width: 100%;
    height: calc(100vh - 100px);
    height: calc(100dvh - 100px);
    position: relative;
    min-height: 300px;
}

.watermark {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 36px;
    font-weight: bold;
    color: rgba(183, 182, 182, 0.302);
    pointer-events: none;
    z-index: 5;
    white-space: nowrap;
    user-select: none;
    /* Точная центровка */
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
}

/* ============================================================
   GEX MODAL
   ============================================================ */
.modal-overlay {
    display: none;
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0, 0, 0, 0.9);
    z-index: 100;
    align-items: center;
    justify-content: center;
    padding: 10px;
}

.modal-overlay.show {
    display: flex;
}

.modal-content {
    max-width: 95vw;
    max-height: 90vh;
    position: relative;
    overflow: visible;
}

.modal-content img {
    max-width: 100%;
    max-height: 85vh;
    border-radius: 6px;
    display: block;
}

.modal-close {
    position: absolute;
    top: -16px;
    right: -16px;
    background: #444;
    color: #fff;
    border: none;
    border-radius: 50%;
    width: 32px;
    height: 32px;
    cursor: pointer;
    font-size: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 110;
    -webkit-tap-highlight-color: transparent;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.5);
}

.modal-close:hover {
    background: #ef4444;
}

/* ============================================================
   DONATE BAR
   ============================================================ */
.donate-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 4px 12px;
    background: #0e0e14;
    border-top: 1px solid #1a1a28;
    font-size: 10px;
    min-height: 28px;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 50;
    flex-wrap: wrap;
}

.donate-bar .donate-label {
    color: #eab308;
    font-weight: 600;
    white-space: nowrap;
}

.donate-bar .donate-text {
    color: #666;
    white-space: nowrap;
}

.donate-bar .donate-address {
    color: #888;
    font-family: 'SF Mono', 'Consolas', monospace;
    font-size: 9px;
    cursor: pointer;
    padding: 2px 6px;
    background: #1a1a28;
    border-radius: 3px;
    border: 1px solid #2a2a3a;
    -webkit-tap-highlight-color: transparent;
    word-break: break-all;
}

.donate-bar .donate-address:hover {
    color: #eab308;
    border-color: #eab308;
}

.status {
    position: fixed;
    bottom: 32px;
    right: 8px;
    font-size: 10px;
    color: #333;
    z-index: 51;
}

/* ============================================================
   TOOLTIPS (desktop only)
   ============================================================ */
.exchange-btn, .coin-btn, .tf-btn, .gex-btn {
    position: relative;
}

@media (hover: hover) and (pointer: fine) {
    .exchange-btn[title]:hover::after {
        content: attr(title);
        position: absolute;
        top: 100%;
        left: 50%;
        transform: translateX(-50%);
        margin-top: 6px;
        padding: 8px 12px;
        background: #1a1a2e;
        border: 1px solid #333;
        border-radius: 6px;
        color: #ccc;
        font-size: 11px;
        font-weight: 400;
        white-space: normal;
        width: 220px;
        text-align: left;
        line-height: 1.4;
        z-index: 200;
        pointer-events: none;
        box-shadow: 0 4px 12px rgba(0,0,0,0.5);
    }
}

/* ============================================================
   MOBILE — до 768px
   ============================================================ */
@media (max-width: 768px) {
    .header {
        padding: 4px 8px;
        gap: 4px;
        min-height: 36px;
    }

    .header h1 {
        font-size: 11px;
        width: 100%;
    }

    .selector-group {
        gap: 2px;
    }

    .selector-group .label {
        font-size: 9px;
    }

    .coin-btn, .exchange-btn, .tf-btn, .gex-btn {
        padding: 4px 7px;
        font-size: 10px;
        border-radius: 3px;
    }

    .gex-btn {
        padding: 4px 8px;
        font-size: 10px;
    }

    .info-bar {
        gap: 6px;
        padding: 2px 8px;
        font-size: 10px;
        min-height: 22px;
        flex-wrap: nowrap;
        overflow-x: auto;
    }

    .info-item {
        gap: 3px;
    }

    .info-label {
        font-size: 9px;
    }

    .info-value {
        font-size: 10px;
    }

    #chart-container {
        height: calc(100vh - 90px);
        height: calc(100dvh - 90px);
        min-height: 250px;
    }

    .watermark {
        font-size: 24px;
    }

    .donate-bar {
        padding: 3px 8px;
        gap: 4px;
        font-size: 9px;
        min-height: 24px;
    }

    .donate-bar .donate-address {
        font-size: 8px;
        max-width: 180px;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .status {
        bottom: 28px;
        font-size: 9px;
    }

    .modal-content {
        max-width: 100vw;
    }

    .modal-content img {
        max-height: 80vh;
        border-radius: 4px;
    }

    .modal-close {
        width: 36px;
        height: 36px;
        font-size: 18px;
        top: -12px;
        right: -12px;
    }
}

/* ============================================================
   VERY SMALL PHONES — до 400px
   ============================================================ */
@media (max-width: 400px) {
    .header h1 {
        font-size: 10px;
    }

    .coin-btn, .exchange-btn, .tf-btn {
        padding: 3px 5px;
        font-size: 9px;
    }

    .gex-btn {
        padding: 3px 6px;
        font-size: 9px;
    }

    .info-bar {
        gap: 4px;
        padding: 2px 6px;
    }

    .info-label {
        font-size: 8px;
    }

    .info-value {
        font-size: 9px;
    }

    .donate-bar .donate-text:nth-child(2) {
        display: none;
    }

    .donate-bar .donate-address {
        max-width: 140px;
    }

    .watermark {
        font-size: 18px;
    }
}

/* ============================================================
   LANDSCAPE PHONE
   ============================================================ */
@media (max-height: 500px) and (orientation: landscape) {
    .header {
        min-height: 30px;
        padding: 2px 8px;
    }

    .info-bar {
        min-height: 20px;
        padding: 1px 8px;
    }

    #chart-container {
        height: calc(100vh - 74px);
        height: calc(100dvh - 74px);
    }

    .donate-bar {
        min-height: 20px;
        padding: 2px 8px;
    }
}

/* ============================================================
   HEADER LINKS (Telegram, FAQ)
   ============================================================ */
.header-link {
    background: #1a1a28;
    border: 1px solid #2a2a3a;
    color: #888;
    padding: 4px 10px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 11px;
    font-weight: 500;
    text-decoration: none;
    white-space: nowrap;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
    transition: all 0.15s;
    display: inline-flex;
    align-items: center;
    gap: 3px;
}

.tg-btn:hover {
    background: #1a2a3a;
    border-color: #2AABEE;
    color: #2AABEE;
}

.faq-btn:hover {
    background: #2a2a38;
    border-color: #eab308;
    color: #eab308;
}

/* ============================================================
   FAQ MODAL
   ============================================================ */
.faq-wrapper {
    position: relative;
    max-width: 640px;
    width: 95vw;
    max-height: 85vh;
}

.faq-content {
    background: #111118;
    border: 1px solid #2a2a3a;
    border-radius: 10px;
    width: 100%;
    max-height: 85vh;
    overflow-y: auto;
    padding: 28px 24px;
    color: #ccc;
    line-height: 1.6;
}

.faq-content h2 {
    font-size: 18px;
    font-weight: 700;
    color: #fff;
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 1px solid #2a2a3a;
}

.faq-item {
    margin-bottom: 16px;
    padding-bottom: 16px;
    border-bottom: 1px solid #1a1a28;
}

.faq-item:last-child {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}

.faq-item h3 {
    font-size: 13px;
    font-weight: 600;
    color: #e0e0e0;
    margin-bottom: 6px;
}

.faq-item p {
    font-size: 12px;
    color: #999;
    line-height: 1.7;
}

.faq-section-title {
    font-size: 14px;
    font-weight: 600;
    color: #eab308;
    margin-top: 20px;
    margin-bottom: 10px;
    padding-top: 10px;
    border-top: 1px solid #2a2a3a;
}

/* Скроллбар для FAQ */
.faq-content::-webkit-scrollbar {
    width: 6px;
}

.faq-content::-webkit-scrollbar-track {
    background: #111118;
}

.faq-content::-webkit-scrollbar-thumb {
    background: #333;
    border-radius: 3px;
}

.faq-content::-webkit-scrollbar-thumb:hover {
    background: #555;
}

/* ============================================================
   FAQ MOBILE
   ============================================================ */
@media (max-width: 768px) {
    .header-link {
        padding: 4px 7px;
        font-size: 10px;
    }

    .faq-content {
        padding: 20px 16px;
        max-height: 80vh;
    }

    .faq-content h2 {
        font-size: 16px;
    }

    .faq-item h3 {
        font-size: 12px;
    }

    .faq-item p {
        font-size: 11px;
    }
}

@media (max-width: 400px) {
    .header-link {
        padding: 3px 5px;
        font-size: 9px;
    }
}