/* Import Orbitron font */
@import url('https://fonts.googleapis.com/css2?family=Orbitron:wght@400;700&display=swap');

/* Styles for the grid container */
.grid-container {
    display: grid;
    grid-template-columns: repeat(7, 1fr); /* 7 columns */
    grid-template-rows: repeat(3, 1fr); /* 3 rows */
    gap: 10px;
    width: 100%;
    max-width: 1344px; /* 7 * 180px + 6 * 10px + 2 * 12px */
    padding: 12px;
    background-color: #1e1e1e;
    border-radius: 8px;
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.3);
    animation: fadeIn 1s ease-in-out;
    position: relative;
    margin: 15px auto;
    will-change: transform; /* Optimize scrolling */
}

/* Styles for the close button of the grid square */
.grid-item-close {
    position: absolute;
    top: 20px;
    left: 5px;
    font-size: 18px;
    font-weight: bold;
    color: #d9534f;
    cursor: pointer;
    opacity: 0.7;
    transition: opacity 0.3s ease, transform 0.2s ease;
    z-index: 10;
}

.grid-item-close:hover {
    opacity: 1;
    transform: scale(1.2);
}

/* Styles for toasts */
.toast {
    position: fixed;
    top: 20px;
    right: 20px;
    max-width: 300px;
    overflow-wrap: break-word;
    word-break: break-word;
    padding: 10px 20px;
    border-radius: 5px;
    color: #ffffff;
    font-family: 'Orbitron', sans-serif;
    font-size: 0.9rem;
    z-index: 1000;
}

.toast.info {
    background-color: #26a69a;
}

.toast.error {
    background-color: #d9534f;
}

.toast.success {
    background-color: #5cb85c;
}

/* Styles for grid elements (squares) */
.grid-item {
    background-color: #2a2a2a;
    border-radius: 5px;
    transition: transform 0.3s ease, box-shadow 0.3s ease, opacity 0.3s ease, left 0.5s ease, top 0.5s ease;
    display: grid;
    grid-template-areas: 
        "logo info"
        "marketcap price"
        "liquidity price"
        "buttons candles";
    grid-template-columns: 1fr 1fr;
    grid-template-rows: auto auto auto auto;
    gap: 6px;
    padding: 8px;
    align-items: center;
    justify-items: center;
    position: relative;
    width: 180px; /* Fixed width of the square */
    min-height: 140px;
    box-sizing: border-box;
}

/* Class for movement animation */
.grid-item.moving {
    position: absolute;
    z-index: 100;
    transition: left 0.5s ease, top 0.5s ease, opacity 0.5s ease;
}

/* Hover effect */
.grid-item:hover {
    transform: scale(1.02);
    box-shadow: 0 3px 5px rgba(38, 166, 154, 0.3);
}

/* Square number */
.grid-item-number {
    position: absolute;
    top: 5px;
    left: 5px;
    font-family: 'Orbitron', sans-serif;
    font-size: 0.75rem;
    color: #26a69a;
    font-weight: bold;
}

/* Styles for square content */
.grid-token-logo {
    grid-area: logo;
    width: 36px;
    height: 36px;
    border-radius: 5px;
    object-fit: cover;
    position: relative;
}

/* Styles for copy icon */
.grid-token-copy {
    position: absolute;
    top: 2px;
    right: 2px;
    width: 12px;
    height: 12px;
    background-image: url('https://img.icons8.com/ios-filled/50/ffffff/copy.png');
    background-size: contain;
    background-repeat: no-repeat;
    cursor: pointer;
    z-index: 10;
    transition: opacity 0.3s ease, background-color 0.3s ease;
    opacity: 0.7;
}

.grid-token-copy:hover {
    opacity: 1;
}

.grid-token-copy.copied {
    background-color: #26a69a;
    opacity: 1;
}

/* Styles for tooltip message */
.copy-tooltip {
    position: absolute;
    background: #26a69a;
    color: #ffffff;
    padding: 2px 6px;
    border-radius: 3px;
    font-family: 'Orbitron', sans-serif;
    font-size: 0.6rem;
    z-index: 11;
    pointer-events: none;
    animation: fadeOut 1s ease forwards;
}

/* Fade-out animation */
@keyframes fadeOut {
    0% { opacity: 1; transform: translateY(0); }
    100% { opacity: 0; transform: translateY(-10px); }
}

/* Styles for token information */
.grid-token-info {
    grid-area: info;
    display: flex;
    flex-direction: column;
    align-items: center;
    font-family: 'Orbitron', sans-serif;
    color: #d1d4dc;
    overflow: hidden;
}

.grid-token-links {
    display: flex;
    gap: 4px;
    margin-bottom: 2px;
}

.grid-token-link {
    display: inline-block;
    width: 12px;
    height: 12px;
    background-size: contain;
    background-repeat: no-repeat;
    cursor: pointer;
    position: relative;
}

.grid-token-link.twitter {
    background-image: url('https://img.icons8.com/ios-filled/50/ffffff/twitter.png');
}

.grid-token-link.telegram {
    background-image: url('https://img.icons8.com/ios-filled/50/ffffff/telegram-app.png');
}

.grid-token-link.website {
    background-image: url('https://img.icons8.com/ios-filled/50/ffffff/globe.png');
}

.grid-token-link:hover::after {
    content: attr(data-tooltip);
    position: absolute;
    top: -20px;
    left: 50%;
    transform: translateX(-50%);
    background-color: #1e1e1e;
    color: #ffffff;
    padding: 1px 4px;
    border-radius: 2px;
    font-size: 0.5rem;
    white-space: nowrap;
    z-index: 10;
}

.grid-token-symbol {
    font-size: 0.85rem;
    font-weight: bold;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 80px;
}

.grid-token-name {
    font-size: 0.7rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 80px;
}

.grid-token-marketcap {
    grid-area: marketcap;
    font-family: 'Orbitron', sans-serif;
    font-size: 0.7rem;
    color: #d1d4dc;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
    min-height: 24px;
    min-width: 60px;
}

.grid-token-marketcap .value {
    color: #ffeb3b;
    font-size: 0.75rem;
    font-weight: bold;
    min-width: 45px;
    text-align: center;
}

.grid-token-liquidity {
    grid-area: liquidity;
    font-family: 'Orbitron', sans-serif;
    font-size: 0.7rem;
    color: #d1d4dc;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
    min-height: 24px;
    min-width: 60px;
}

.grid-token-liquidity .value {
    color: #26a69a;
    font-size: 0.75rem;
    font-weight: bold;
    min-width: 45px;
    text-align: center;
}

.grid-token-price {
    grid-area: price;
    font-family: 'Orbitron', sans-serif;
    font-size: 0.7rem;
    color: #d1d4dc;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
    min-height: 40px;
}

.grid-token-price .value {
    color: #ffffff;
    font-size: 0.75rem;
    font-weight: bold;
    transition: color 0.3s ease;
}

.grid-token-price .value.price-up {
    color: #26a69a;
}

.grid-token-price .value.price-down {
    color: #d9534f;
}

/* Styles for growth percentage */
.grid-token-growth {
    font-family: 'Orbitron', sans-serif;
    font-size: 0.6rem;
    font-weight: bold;
    margin-top: 2px;
}

.grid-token-growth.growth-up {
    color: #26a69a;
}

.grid-token-growth.growth-down {
    color: #d9534f;
}

/* Button container */
.grid-buttons {
    grid-area: buttons;
    display: flex;
    flex-direction: column;
    gap: 5px;
    width: 100%;
    align-items: center;
}

.grid-buy-btn,
.grid-sell-btn {
    background-color: #26a69a;
    border: none;
    padding: 5px 8px;
    font-family: 'Inter', sans-serif;
    font-size: 0.7rem;
    border-radius: 2px;
    color: #ffffff;
    cursor: pointer;
    transition: background-color 0.3s ease, padding-right 0.3s ease, width 0.3s ease;
    width: 100%;
    text-align: center;
    position: relative;
    overflow: hidden;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.grid-sell-btn {
    background-color: #d9534f;
}

.grid-buy-btn:hover {
    background-color: #2cb9ac;
}

.grid-sell-btn:hover {
    background-color: #c9302c;
}

.grid-buy-btn.loading,
.grid-sell-btn.loading {
    padding-right: 25px;
    opacity: 0.8;
    cursor: not-allowed;
}

.grid-buy-btn .ld,
.grid-sell-btn .ld {
    display: none;
    width: 12px;
    height: 12px;
    border: 1.5px solid #ffffff;
    border-radius: 50%;
    border-top-color: transparent;
    animation: spin 0.8s linear infinite;
    position: absolute;
    right: 6px;
    top: 50%;
    transform: translateY(-50%);
}

.grid-buy-btn.loading .ld,
.grid-sell-btn.loading .ld {
    display: inline-block;
}

/* Line chart container */
.grid-candles {
    grid-area: candles;
    width: 100%;
    height: 50px;
    background-color: #1e1e1e;
    border-radius: 2px;
    overflow: hidden;
    position: relative;
    pointer-events: auto;
}

.grid-candles canvas {
    width: 100%;
    height: 100%;
    display: block;
    background-color: #1e1e1e;
}

/* Styles for Search New Token button */
.search-new-token-btn.btn-primary {
    position: absolute;
    top: -40px;
    right: 12px;
    background-color: #26a69a;
    border: none;
    padding: 6px 12px;
    font-family: 'Inter', sans-serif;
    font-size: 0.8rem;
    border-radius: 5px;
    color: #ffffff;
    cursor: pointer;
    transition: background-color 0.3s ease, transform 0.1s ease, padding-right 0.3s ease, width 0.3s ease;
    z-index: 10;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.search-new-token-btn.btn-primary:hover {
    background-color: #2cb9ac;
    box-shadow: 0 2px 8px rgba(38, 166, 154, 0.3);
}

.search-new-token-btn.btn-primary:active {
    transform: scale(0.98);
}

.search-new-token-btn.btn-primary.loading {
    padding-right: 30px;
    opacity: 0.8;
    cursor: not-allowed;
}

.search-new-token-btn.btn-primary .ld {
    display: none;
    width: 14px;
    height: 14px;
    border: 1.5px solid #ffffff;
    border-radius: 50%;
    border-top-color: transparent;
    animation: spin 0.8s linear infinite;
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
}

.search-new-token-btn.btn-primary.loading .ld {
    display: inline-block;
}

.search-new-token-btn.subscribed {
    background-color: #d9534f;
}

.search-new-token-btn.subscribed:hover {
    background-color: #c9302c;
}

/* Styles for scale feedback */
.scale-feedback {
    position: absolute;
    top: 3px;
    right: 3px;
    background: rgba(30, 30, 30, 0.8);
    color: #26a69a;
    padding: 2px 5px;
    border-radius: 2px;
    font-size: 0.6rem;
    font-family: 'Orbitron', sans-serif;
    z-index: 10;
    display: none;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

.scale-feedback.active {
    display: block;
}

/* Grid appearance animation */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(12px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Animated fiery border for grid-item with tok prerequisite */
.grid-item.fire-animation {
    box-shadow: inset 0 0 7px rgba(248, 248, 248, 0.8),
                inset 0 0 26px rgba(0, 52, 224, 0.6);
    animation: fireBorderGlow 1.5s ease-in-out infinite;
    background-color: #1d1d1d;
}

@keyframes fireBorderGlow {
    0% {
        box-shadow: inset 0 0 7px rgba(255, 255, 255, 0.8),
                    inset 0 0 12px rgba(0, 4, 255, 0.6);
    }
    50% {
        box-shadow: inset 0 0 9px rgb(0, 4, 255),
                    inset 0 0 14px rgba(255, 255, 255, 0.8);
    }
    100% {
        box-shadow: inset 0 0 7px rgba(255, 255, 255, 0.8),
                    inset 0 0 12px rgba(0, 26, 255, 0.6);
    }
}

.grid-item.fire-animation {
    box-sizing: border-box;
    overflow: hidden;
}

.grid-item.fire-animation > * {
    z-index: 1;
}

/* Styles for purchases list */
.purchases-list {
    margin-top: 10px;
    padding: 5px;
    background-color: #2a2a2a;
    border-radius: 5px;
}

/* Styles for purchase item */
.purchase-item {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    padding: 8px;
    margin-bottom: 5px;
    background-color: #1e1e1e;
    border-radius: 4px;
    font-family: 'Inter', sans-serif;
    font-size: 0.8rem;
    color: #d1d4dc;
    gap: 8px;
}

.purchase-item img {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    margin-right: 8px;
}

.purchase-item .token-details {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.purchase-item .token-details .symbol {
    font-weight: bold;
    color: #26a69a;
}

.purchase-item .token-details .amount,
.purchase-item .token-details .value {
    font-size: 0.7rem;
}

.purchase-item .purchase-buttons {
    display: flex;
    flex-direction: row;
    gap: 8px;
    width: 100%;
    justify-content: space-between;
}

.purchase-item .purchase-buy-btn,
.purchase-item .purchase-sell-btn {
    padding: 6px 12px;
    font-size: 0.7rem;
    border-radius: 3px;
    cursor: pointer;
    border: none;
    color: #ffffff;
    transition: background-color 0.3s ease, padding-right 0.3s ease, width 0.3s ease;
    position: relative;
    overflow: hidden;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 1;
}

.purchase-item .purchase-buy-btn {
    background-color: #26a69a;
}

.purchase-item .purchase-buy-btn:hover {
    background-color: #2cb9ac;
}

.purchase-item .purchase-sell-btn {
    background-color: #d9534f;
}

.purchase-item .purchase-sell-btn:hover {
    background-color: #c9302c;
}

.purchase-item .purchase-buy-btn.loading,
.purchase-item .purchase-sell-btn.loading {
    padding-right: 30px;
    opacity: 0.8;
    cursor: not-allowed;
}

.purchase-item .purchase-buy-btn .ld,
.purchase-item .purchase-sell-btn .ld {
    display: none;
    width: 12px;
    height: 12px;
    border: 1.5px solid #ffffff;
    border-radius: 50%;
    border-top-color: transparent;
    animation: spin 0.8s linear infinite;
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
}

.purchase-item .purchase-buy-btn.loading .ld,
.purchase-item .purchase-sell-btn.loading .ld {
    display: inline-block;
}

/* Styles for spinner in purchases list */
.token-spinner {
    display: inline-block;
    width: 12px;
    height: 12px;
    border: 2px solid #d1d4dc;
    border-radius: 50%;
    border-top-color: transparent;
    animation: spin 0.8s linear infinite;
    vertical-align: middle;
    margin-left: 5px;
    position: relative;
    top: 0;
}

/* Styles for .token-amount element with animation */
.token-amount {
    transition: opacity 0.3s ease;
    display: inline-flex;
    align-items: center;
    min-width: 100px;
}

/* Loading state for .token-amount */
.token-amount.loading {
    opacity: 0.5;
}

/* Spinner rotation animation */
@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* Styles for growth percentage in purchases list */
.purchase-item .token-details .growth-percent {
    font-family: 'Orbitron', sans-serif;
    font-size: 0.7rem;
    color: #d1d4dc;
    margin-top: 2px;
}

.purchase-item .token-details .growth-percent.positive {
    color: #26a69a;
}

.purchase-item .token-details .growth-percent.negative {
    color: #d9534f;
}

/* Styles for modal window */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7); /* Darkened background */
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    font-family: 'Inter', sans-serif;
}

.modal-content {
    background-color: #2a2a2a;
    padding: 20px;
    border-radius: 8px;
    width: 90%;
    max-width: 500px;
    position: relative;
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.3);
    color: #d1d4dc;
    text-align: center;
}

.modal-close {
    position: absolute;
    top: 10px;
    right: 15px;
    font-size: 24px;
    color: #d9534f;
    cursor: pointer;
    transition: color 0.3s ease;
}

.modal-close:hover {
    color: #c9302c;
}

.modal-content h2 {
    margin: 0 0 15px;
    font-family: 'Orbitron', sans-serif;
    font-size: 1.2rem;
    color: #26a69a;
}

.wallet-data p {
    margin: 10px 0;
    font-size: 0.9rem;
    word-break: break-all;
    text-align: left;
}

.wallet-data strong {
    color: #ffeb3b;
}

#download-wallet-btn {
    background-color: #26a69a;
    border: none;
    padding: 8px 16px;
    font-family: 'Inter', sans-serif;
    font-size: 0.9rem;
    border-radius: 4px;
    color: #ffffff;
    cursor: pointer;
    transition: background-color 0.3s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-top: 15px;
}

#download-wallet-btn:hover {
    background-color: #2cb9ac;
}

#download-wallet-btn.loading {
    padding-right: 30px;
    opacity: 0.8;
    cursor: not-allowed;
}

#download-wallet-btn .ld {
    display: none;
    width: 12px;
    height: 12px;
    border: 1.5px solid #ffffff;
    border-radius: 50%;
    border-top-color: transparent;
    animation: spin 0.8s linear infinite;
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
}

#download-wallet-btn.loading .ld {
    display: inline-block;
}

/* Container for the "How It Works?" and Telegram buttons */
.how-it-works-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 1001; /* Above token grid */
    display: flex;
    gap: 10px; /* Space between buttons */
    align-items: center;
}

/* Styles for the "How It Works?" button (bold white text, larger font) */
.how-it-works-btn {
    background: none;
    border: none;
    font-family: 'Orbitron', sans-serif;
    font-size: 1.25rem; /* Larger font size */
    font-weight: 700; /* Bold */
    color: #ffffff; /* White text */
    cursor: pointer;
    padding: 5px 10px;
    transition: color 0.3s ease, transform 0.2s ease;
}

.how-it-works-btn:hover {
    color: #26a69a; /* Accent color on hover */
    transform: scale(1.05);
}

.how-it-works-btn:focus {
    outline: none;
    color: #26a69a;
}

/* Styles for the Telegram button (icon only) */
.telegram-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    font-size: 1.5rem; /* Larger icon */
    color: #ffffff; /* White icon */
    text-decoration: none;
    transition: color 0.3s ease, transform 0.2s ease;
}

.telegram-btn:hover {
    color: #26a69a; /* Accent color on hover */
    transform: scale(1.1);
}

.telegram-btn:focus {
    outline: none;
    color: #26a69a;
}

/* Instructions panel */
.instructions-panel {
    position: fixed;
    bottom: -100%; /* Fully hidden by default */
    left: 0;
    width: 100%;
    max-height: 80vh; /* Limit height to avoid overflow */
    background: #1e1e1e;
    box-shadow: 0 -4px 12px rgba(0, 0, 0, 0.4);
    z-index: 1000;
    transition: bottom 0.3s ease;
    overflow-y: auto; /* Allow scrolling if content overflows */
}

/* Active state for instructions panel (slide up) */
.instructions-panel.active {
    bottom: 0;
}

/* Instructions content */
.instructions-content {
    max-width: 800px;
    margin: 0 auto;
    padding: 20px;
    color: #d1d4dc;
    font-family: 'Inter', sans-serif;
}

/* Close button for instructions panel */
.instructions-close {
    position: absolute;
    top: 10px;
    right: 10px;
    background: none;
    border: none;
    color: #d9534f;
    font-size: 1.2rem;
    cursor: pointer;
    transition: color 0.3s ease;
}

.instructions-close:hover {
    color: #c9302c;
}

/* Headings in instructions panel */
.instructions-content h2 {
    font-family: 'Orbitron', sans-serif;
    font-size: 1.5rem;
    color: #26a69a;
    margin-bottom: 15px;
}

.instructions-content h3 {
    font-family: 'Orbitron', sans-serif;
    font-size: 1.2rem;
    color: #26a69a;
    margin: 20px 0 10px;
}

/* Text and lists in instructions panel */
.instructions-content p {
    font-size: 0.9rem;
    line-height: 1.5;
    margin-bottom: 15px;
}

.instructions-content ol {
    padding-left: 20px;
    margin-bottom: 20px;
}

.instructions-content li {
    font-size: 0.9rem;
    margin-bottom: 10px;
    line-height: 1.5;
}

/* Icons in instructions panel */
.instructions-content i {
    color: #26a69a;
    margin-right: 5px;
}

/* Responsiveness for tablets */
@media (max-width: 768px) {
    /* Grid container */
    .grid-container {
        display: flex;
        flex-direction: column; /* Вертикальное расположение */
        align-items: center;
        gap: 10px;
        width: 100%;
        max-width: 600px;
        padding: 15px;
        margin: 20px auto;
        background-color: transparent;
        overflow-y: auto; /* Вертикальная прокрутка */
        overflow-x: hidden; /* Запрет горизонтальной прокрутки */
        box-sizing: border-box;
        border-radius: 8px;
    }

    /* Grid item */
    .grid-item {
        width: 100%;
        max-width: 360px;
        min-height: 140px;
        padding: 10px;
        gap: 6px;
        display: grid;
        grid-template-areas: 
            "logo info"
            "marketcap price"
            "liquidity price"
            "buttons candles";
        grid-template-columns: 1fr 1fr;
        grid-template-rows: auto auto auto auto;
        align-items: center;
        justify-items: center;
        box-sizing: border-box;
        background-color: #2a2a2a;
        border-radius: 5px;
        transition: transform 0.3s ease, box-shadow 0.3s ease;
    }

    .grid-item.moving {
        width: 360px;
        min-height: 140px;
    }

    /* Grid item number */
    .grid-item-number {
        font-size: 0.7rem;
        top: 5px;
        left: 5px;
    }

    /* Close button */
    .grid-item-close {
        font-size: 16px;
        top: 18px;
        left: 5px;
        opacity: 0.7;
    }

    .grid-item-close:hover {
        opacity: 1;
        transform: scale(1.2);
    }

    /* Token logo */
    .grid-token-logo {
        width: 32px;
        height: 32px;
        border-radius: 4px;
    }

    /* Copy icon */
    .grid-token-copy {
        width: 10px;
        height: 10px;
        top: 1px;
        right: 1px;
        opacity: 0.7;
    }

    .grid-token-copy:hover {
        opacity: 1;
    }

    .copy-tooltip {
        font-size: 0.6rem;
        padding: 2px 5px;
    }

    /* Token info */
    .grid-token-info {
        align-items: center;
    }

    .grid-token-links {
        gap: 3px;
        margin-bottom: 1px;
    }

    .grid-token-link {
        width: 10px;
        height: 10px;
    }

    .grid-token-link:hover::after {
        font-size: 0.5rem;
        top: -18px;
        padding: 2px 4px;
    }

    /* Token symbol and name */
    .grid-token-symbol {
        font-size: 0.8rem;
        max-width: 80px;
    }

    .grid-token-name {
        font-size: 0.7rem;
        max-width: 80px;
    }

    /* Token growth */
    .grid-token-growth {
        font-size: 0.6rem;
    }

    /* Market cap, liquidity, price */
    .grid-token-marketcap,
    .grid-token-liquidity,
    .grid-token-price {
        font-size: 0.7rem;
        min-height: 20px;
        min-width: 60px;
        text-align: center;
    }

    .grid-token-marketcap .value,
    .grid-token-liquidity .value,
    .grid-token-price .value {
        font-size: 0.75rem;
        min-width: 50px;
    }

    /* Buttons */
    .grid-buttons {
        flex-direction: column;
        gap: 5px;
        width: 100%;
    }

    .grid-buy-btn,
    .grid-sell-btn {
        font-size: 0.6rem;
        padding: 4px 8px;
        width: 100%;
    }

    .grid-buy-btn.loading,
    .grid-sell-btn.loading {
        padding-right: 25px;
    }

    .grid-buy-btn .ld,
    .grid-sell-btn .ld {
        width: 10px;
        height: 10px;
        border: 1.5px solid #ffffff;
        border-top-color: transparent;
        right: 5px;
    }

    /* Candles chart */
    .grid-candles {
        height: 50px;
        min-width: 80px;
    }

    /* Search new token button */
    .search-new-token-btn.btn-primary {
        position: relative;
        top: 0;
        right: 0;
        padding: 8px 15px;
        font-size: 0.7rem;
        width: 100%;
        max-width: 300px;
        margin: 15px auto;
        display: block;
    }

    .search-new-token-btn.btn-primary.loading {
        padding-right: 25px;
    }

    .search-new-token-btn.btn-primary .ld {
        width: 12px;
        height: 12px;
        right: 6px;
    }

    /* Scale feedback */
    .scale-feedback {
        font-size: 0.6rem;
        padding: 2px 5px;
        top: 3px;
        right: 3px;
    }

    /* Toast */
    .toast {
        max-width: 250px;
        font-size: 0.8rem;
        padding: 8px 15px;
    }

    /* How it works container */
    .how-it-works-container {
        position: relative; /* Follow document flow */
        top: 0;
        right: 0;
        width: 100%;
        max-width: 300px;
        margin: 10px auto; /* Center */
        display: flex;
        justify-content: center; /* Align buttons */
        gap: 10px;
        z-index: 1001;
    }

    .how-it-works-btn {
        font-size: 1rem;
        padding: 5px 10px;
    }

    .telegram-btn {
        width: 28px;
        height: 28px;
        font-size: 1.25rem;
    }

    /* Instructions panel */
    .instructions-panel {
        bottom: -100%; /* Ensure fully hidden */
        max-height: 70vh; /* Limit height */
        overflow-y: auto;
    }

    .instructions-content {
        padding: 15px;
    }

    .instructions-content h2 {
        font-size: 1.3rem;
    }

    .instructions-content h3 {
        font-size: 1.1rem;
    }

    .instructions-content p,
    .instructions-content li {
        font-size: 0.85rem;
    }

    .instructions-close {
        font-size: 1.1rem;
    }

    /* Modal */
    .modal-content {
        width: 90%;
        max-width: 400px;
        padding: 15px;
    }

    .modal-content h2 {
        font-size: 1.1rem;
    }

    .wallet-data p {
        font-size: 0.85rem;
    }

    #download-wallet-btn {
        font-size: 0.85rem;
        padding: 8px 15px;
    }

    /* Purchases list */
    .purchases-list {
        max-height: 150px;
    }

    .purchase-item {
        font-size: 0.7rem;
        padding: 6px;
    }

    .purchase-item img {
        width: 20px;
        height: 20px;
    }

    .purchase-item .token-details .symbol {
        font-size: 0.65rem;
    }

    .purchase-item .token-details .amount,
    .purchase-item .token-details .value,
    .purchase-item .token-details .growth-percent {
        font-size: 0.6rem;
    }

    .purchase-item .purchase-buy-btn,
    .purchase-item .purchase-sell-btn {
        font-size: 0.65rem;
        padding: 5px 10px;
    }

    .purchase-item .purchase-buy-btn.loading,
    .purchase-item .purchase-sell-btn.loading {
        padding-right: 25px;
    }

    .purchase-item .purchase-buy-btn .ld,
    .purchase-item .purchase-sell-btn .ld {
        width: 10px;
        height: 10px;
        right: 6px;
        border: 1.5px solid #ffffff;
        border-top-color: transparent;
    }

    .token-spinner {
        width: 10px;
        height: 10px;
        border: 1.5px solid #d1d4dc;
        border-top-color: transparent;
    }
}

/* Responsiveness for mobile devices */
@media (max-width: 480px) {
    /* Grid container */
    .grid-container {
        display: flex;
        flex-direction: column; /* Вертикальное расположение */
        align-items: center;
        gap: 8px;
        width: 100%;
        max-width: 360px;
        padding: 10px;
        margin: 15px auto;
        background-color: transparent;
        overflow-y: auto;
        overflow-x: hidden;
        box-sizing: border-box;
    }

    /* Grid item */
    .grid-item {
        width: 100%;
        max-width: 280px;
        min-height: 120px;
        padding: 8px;
        gap: 5px;
        grid-template-columns: 1fr 1fr;
        grid-template-rows: auto auto auto auto;
    }

    .grid-item.moving {
        width: 280px;
        min-height: 120px;
    }

    /* Grid item number */
    .grid-item-number {
        font-size: 0.6rem;
        top: 4px;
        left: 4px;
    }

    /* Close button */
    .grid-item-close {
        font-size: 14px;
        top: 16px;
    }

    /* Token logo */
    .grid-token-logo {
        width: 24px;
        height: 24px;
    }

    /* Copy icon */
    .grid-token-copy {
        width: 8px;
        height: 8px;
        top: 1px;
        right: 1px;
    }

    .copy-tooltip {
        font-size: 0.5rem;
        padding: 1px 4px;
    }

    /* Token links */
    .grid-token-links {
        gap: 2px;
        margin-bottom: 0;
    }

    .grid-token-link {
        width: 8px;
        height: 8px;
    }

    .grid-token-link:hover::after {
        font-size: 0.4rem;
        top: -16px;
        padding: 1px 3px;
    }

    /* Token symbol and name */
    .grid-token-symbol {
        font-size: 0.65rem;
        max-width: 60px;
    }

    .grid-token-name {
        font-size: 0.55rem;
        max-width: 60px;
    }

    /* Token growth */
    .grid-token-growth {
        font-size: 0.5rem;
    }

    /* Market cap, liquidity, price */
    .grid-token-marketcap,
    .grid-token-liquidity,
    .grid-token-price {
        font-size: 0.55rem;
        min-height: 18px;
        min-width: 50px;
    }

    .grid-token-marketcap .value,
    .grid-token-liquidity .value,
    .grid-token-price .value {
        font-size: 0.6rem;
        min-width: 40px;
    }

    /* Buttons */
    .grid-buy-btn,
    .grid-sell-btn {
        font-size: 0.5rem;
        padding: 3px 6px;
    }

    .grid-buy-btn.loading,
    .grid-sell-btn.loading {
        padding-right: 20px;
    }

    .grid-buy-btn .ld,
    .grid-sell-btn .ld {
        width: 8px;
        height: 8px;
        border: 1px solid #ffffff;
        border-top-color: transparent;
        right: 4px;
    }

    /* Candles chart */
    .grid-candles {
        height: 40px;
        min-width: 60px;
    }

    /* Search new token button */
    .search-new-token-btn.btn-primary {
        padding: 6px 10px;
        font-size: 0.6rem;
        max-width: 240px;
        margin: 10px auto;
    }

    .search-new-token-btn.btn-primary.loading {
        padding-right: 20px;
    }

    .search-new-token-btn.btn-primary .ld {
        width: 10px;
        height: 10px;
        right: 5px;
    }

    /* Scale feedback */
    .scale-feedback {
        font-size: 0.5rem;
        padding: 2px 4px;
        top: 2px;
        right: 2px;
    }

    /* Toast */
    .toast {
        max-width: 200px;
        font-size: 0.7rem;
        padding: 6px 12px;
    }

    /* How it works container */
    .how-it-works-container {
        max-width: 240px;
        margin: 8px auto;
        gap: 6px;
    }

    .how-it-works-btn {
        font-size: 0.875rem;
        padding: 4px 8px;
    }

    .telegram-btn {
        width: 24px;
        height: 24px;
        font-size: 1rem;
    }

    /* Instructions panel */
    .instructions-panel {
        bottom: -100%; /* Ensure fully hidden */
        max-height: 60vh; /* Smaller height for smaller screens */
        overflow-y: auto;
    }

    .instructions-content {
        padding: 10px;
    }

    .instructions-content h2 {
        font-size: 1.1rem;
    }

    .instructions-content h3 {
        font-size: 1rem;
    }

    .instructions-content p,
    .instructions-content li {
        font-size: 0.8rem;
    }

    .instructions-close {
        font-size: 1rem;
    }

    /* Modal */
    .modal-content {
        width: 95%;
        max-width: 320px;
        padding: 12px;
    }

    .modal-content h2 {
        font-size: 1rem;
    }

    .wallet-data p {
        font-size: 0.8rem;
    }

    #download-wallet-btn {
        font-size: 0.8rem;
        padding: 6px 12px;
    }

    /* Purchases list */
    .purchases-list {
        max-height: 120px;
        max-width: 240px;
    }

    .purchase-item {
        font-size: 0.6rem;
        padding: 5px;
    }

    .purchase-item img {
        width: 18px;
        height: 18px;
    }

    .purchase-item .token-details .symbol {
        font-size: 0.6rem;
    }

    .purchase-item .token-details .amount,
    .purchase-item .token-details .value,
    .purchase-item .token-details .growth-percent {
        font-size: 0.55rem;
    }

    .purchase-item .purchase-buy-btn,
    .purchase-item .purchase-sell-btn {
        font-size: 0.6rem;
        padding: 4px 8px;
    }

    .purchase-item .purchase-buy-btn.loading,
    .purchase-item .purchase-sell-btn.loading {
        padding-right: 20px;
    }

    .purchase-item .purchase-buy-btn .ld,
    .purchase-item .purchase-sell-btn .ld {
        width: 8px;
        height: 8px;
        right: 5px;
        border: 1px solid #ffffff;
        border-top-color: transparent;
    }

    .token-spinner {
        width: 8px;
        height: 8px;
        border: 1px solid #d1d4dc;
        border-top-color: transparent;
    }
}