/* General styles */
body {
    font-family: Arial, sans-serif;
    margin: 0;
    padding: 0;
    background-color: #121212;
    color: #E0E0E0;
    transition: opacity 0.8s ease-in;
    opacity: 0;
    animation: fadeIn 1s forwards;
    height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    flex-direction: column;
}

/* Container */
.container {
    position: fixed;  /* or absolute if the container is inside another block */
    right: 1%;
    bottom: 15%;

    max-width: 500px; /* Reduce container size */
    width: 13%;
    padding: 20px;
    background: linear-gradient(135deg, rgba(240, 240, 240, 0.95), rgba(110, 110, 110, 0.95)); /* Dark gradient */
    border-radius: 8px;
    box-shadow: 0px 4px 10px rgba(0, 0, 0, 0.5); /* Enhanced shadow */
    color: #202020; /* Dark text */
    text-align: left;
    border: 1px solid #333; /* Dark border */
    word-wrap: break-word; /* Prevent wrapping */
}

/* Reduce font size to prevent text wrapping */
h1 {
    font-size: 20px;
    text-align: center;
    color: #040404;
    user-select: none;
}

/* Information */
.info {
    font-size: 14px; /* Reduce font size */
    margin: 10px 0;
}

/* Footer Links */
.footer a {
    color: white;
    text-decoration: none;
}
.footer a:hover {
    text-decoration: underline;
}

/* Fade-in animation for footer links and span */
.footer a,
.footer span {
    opacity: 0;
    animation: fadeInUp 0.5s ease forwards;
}

.footer a:nth-of-type(1) {
    animation-delay: 0.2s;
}
.footer a:nth-of-type(2) {
    animation-delay: 0.4s;
}
.footer a:nth-of-type(3) {
    animation-delay: 0.6s;
}
.footer a:nth-of-type(4) {
    animation-delay: 0.8s;
}
.footer-visits {
    opacity: 0;
    animation: fadeInUp 0.5s ease forwards;
    animation-delay: 0.8s;
}

/* Container fade-in animation (не вікористовується але залишимо) */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* Footer fade-in animation */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* News ticker */
.news-ticker {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    overflow: hidden;
    background: transparent;
    padding: 5px 0;
    z-index: 1000;
}

.news-ticker-content {
    display: inline-block;
    white-space: nowrap;
    /* Remove padding-left so content does not start far off-screen */
    /* padding-left: 100%; */
    animation: ticker linear infinite;
    font-size: 14px;
    font-weight: bold;
    color: #FFD700;
    /* animation-duration is dynamically set via JS */
}

.news-ticker-content a {
    color: #FFD700;
    text-decoration: none;
    margin-right: 10px;
}

.news-ticker-content .separator {
    display: inline;
    color: #FFD700;
    margin: 0 0px; /* Adjust margins if needed */
}

@keyframes flash {
    0%   { filter: brightness(1); }
    50%  { filter: brightness(1.5); }
    100% { filter: brightness(1); }
}
.flag-background.flash-effect {
    animation: flash 0.4s ease;
}

.flag-ua {
    color: blue;
    font-size: 11px; /* Adjustable size */
    vertical-align: middle;
}

@keyframes ticker {
    from { transform: translateX(0); }
    to { transform: translateX(-50%); }
}

/* AI-подменю з відкриттям вгору */
.context-menu .submenu,
.context-menu .submenu.open-upward {
    position: absolute;
    background: rgba(30, 30, 30, 0.95);  /* Той самий фон */
    color: #E0E0E0;                      /* Білий текст */
    border-radius: 8px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.5);
    list-style: none;
    padding: 0;
    margin: 0;
    z-index: 10001;
    min-width: 180px;
}

.context-menu .submenu.open-upward {
    bottom: 100%;
    left: 0;
    margin-bottom: 5px;
}


/* Обмеження для AI-підменю */
.context-menu .submenu.ai-scrollable {
    max-height: 80vh; /* залишаємо про всяк */
    overflow-y: auto;
    position: fixed;
    background: rgba(30, 30, 30, 0.95);
    color: #fff;
    right: auto;
    border-radius: 8px;
    padding: 5px 0;
    box-shadow: 0 4px 10px rgba(0,0,0,0.5);
    z-index: 10001;
    bottom: 10px;
    top: auto !important;    /* 💡 прибирає авто-встановлений top */
}

/* AI-елементи — посилання білого кольору */
#ai-submenu li a {
    color: #fff;
    text-decoration: none;
    padding: 5px 10px;
    display: block;
    white-space: nowrap;
}
#ai-submenu li a:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #FFD700;
}


/* Footer */
.footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px;
    background: #181818;
    border-top: 2px solid #444;
    position: fixed;
    bottom: 0;
    width: 100%;
    text-align: center;
    box-sizing: border-box;
}

.footer span {
    opacity: 0;
    transform: translateY(10px);
    animation: fadeInUp 1s ease-in-out forwards;
}

.email-button {
    position: fixed;
    bottom: 70px;
    right: 15px;
    width: 32px;
    height: 32px;
    line-height: 32px;
    text-align: center;
    font-size: 20px;
    font-weight: bold;
    color: #ffffff;
    background-color: #444;
    border-radius: 50%;
    text-decoration: none;
    transition: background-color 0.3s, transform 0.2s;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
}

.email-button:hover {
    background-color: #666;
    transform: scale(1.1);
}

.telegram-button {
    position: fixed;
    bottom: 70px;
    right: 55px; /* відступ лівіше поштової */
    width: 32px;
    height: 32px;
    line-height: 32px;
    text-align: center;
    font-size: 20px;
    font-weight: bold;
    color: #ffffff;
    background-color: #444;
    border-radius: 50%;
    text-decoration: none;
    opacity: 0;
    animation: fadeInUp 0.5s ease forwards;
    animation-delay: 0.75s;
}

.telegram-button:hover {
    background-color: #666;
}


/* Mobile version */
@media (max-width: 720px) {
    body {
        padding: 5px;
        text-align: center;
    }

    .container {
        position: fixed;
        right: 0.1%;
        bottom: 7%;

        width: 70%;  /* Reduce container size */
        max-width: 160px; /* Make it really small */
        padding: 3px; /* Reduce inner padding */
        font-size: 3px; /* Reduce text size */
        transform: scale(0.65); /* Scale down proportionally */
    }

    .footer {
        font-size: 10px;
    }

    h1 {
        font-size: 16px;
    }

    .footer span {
        margin-bottom: 5px;
    }
}

/* Flag */
.flag-background {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    background: linear-gradient(to bottom, #0032a0 50%, #ffd700 50%);
    z-index: -1;
    animation: wave 3s ease-in-out infinite alternate;
}

@keyframes wave {
    0% { transform: translateY(0px) rotate(0deg) scaleX(1); }
    25% { transform: translateY(-15px) rotate(1.5deg) scaleX(1.05); }
    50% { transform: translateY(10px) rotate(-1.5deg) scaleX(1.02); }
    75% { transform: translateY(-5px) rotate(1.2deg) scaleX(1.04); }
    100% { transform: translateY(-1px) rotate(0.2deg) scaleX(1.1); }
}

#news-ticker {
    display: inline-block;
    white-space: nowrap;
}

#news-ticker a {
    display: inline;
    margin-right: 10px;
    color: #FFD700;
    text-decoration: none;
}

#news-ticker .separator {
    display: inline;
    color: #FFD700;
    margin-right: 10px;
}
/* Меню інструментів (спочатку приховане) */
#tool-menu {
    position: fixed;
    bottom: 20%;
    right: 2%;
    background: rgba(30, 30, 30, 0.95);
    border-radius: 10px;
    padding: 15px;
    width: 250px;
    box-shadow: 0px 4px 10px rgba(0, 0, 0, 0.5);
    display: none;
    flex-direction: column;
}

/* Заголовки категорій */
.menu-category h3 {
    color: #FFD700;
    margin-bottom: 5px;
    font-size: 16px;
}

/* Список інструментів */
.menu-category ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.menu-category ul li {
    margin: 5px 0;
}

.menu-category ul li a {
    color: #E0E0E0;
    text-decoration: none;
    font-size: 14px;
    transition: 0.3s;
}

.menu-category ul li a:hover {
    color: #FFD700;
}

/* Анімація появи */
.show {
    display: flex !important;
    animation: fadeInUp 0.3s ease-in-out;
}

/* Анімація */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* 🔥 Контекстне меню інструментів */
.context-menu {
    position: absolute;
    background: rgba(30, 30, 30, 0.95); /* Темный фон */
    color: #E0E0E0; /* Світлий текст */
    border-radius: 8px;
    padding: 10px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.5);
    display: none;
    z-index: 1000;
    min-width: 220px;
}

/* Заголовки категорій у меню */
.context-menu .menu-category {
    font-weight: bold;
    font-size: 14px;
    color: #FFD700;
    margin-bottom: 5px;
    border-bottom: 1px solid #FFD700;
    padding-bottom: 5px;
}

/* Список інструментів */
.context-menu ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.context-menu ul li {
    padding: 8px 12px;
    cursor: pointer;
    transition: background 0.3s;
}

.context-menu ul li:hover {
    background: rgba(255, 215, 0, 0.2);
}

/* Іконки в меню */
.context-menu ul li::before {
    margin-right: 8px;
    font-weight: bold;
}

// Улучшенный CSS (добавь в `style.css`)

.result-box {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: #333;
    color: #fff;
    padding: 15px;
    border-radius: 8px;
    box-shadow: 0px 0px 10px rgba(0, 0, 0, 0.3);
    text-align: center;
    z-index: 1000;
    min-width: 300px;
}

.result-content {
    font-size: 18px;
    font-family: monospace;
    background: #222;
    padding: 8px;
    border-radius: 5px;
    display: inline-block;
    margin-top: 5px;
    word-break: break-word;
}

.result-box button {
    margin-top: 10px;
    padding: 5px 10px;
    background: #ff4d4d;
    border: none;
    color: white;
    border-radius: 5px;
    cursor: pointer;
}

.result-box button:hover {
    background: #cc0000;
}


.result-box code {
    font-family: monospace;
    background: #222;
    padding: 4px 8px;
    border-radius: 4px;
    display: inline-block;
    word-break: break-word;
    font-size: 18px;
}

.face1, .face2, .face3, .face4, .face5, .face6 {
    backface-visibility: visible;
}

.dice-container {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    perspective: 1000px;
    z-index: 10000;
}

.dice {
    width: 100px;
    height: 100px;
    position: relative;
    transform-style: preserve-3d;
    transform-origin: center;
    transition: transform 1s ease-out;
    cursor: pointer;
}

.dice > div {
    position: absolute;
    width: 100px;
    height: 100px;
    background: radial-gradient(#fff, #ddd);
    border: 2px solid #aaa;
    border-radius: 12px;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 48px;
    font-weight: bold;
    box-shadow: inset 0 0 10px rgba(0,0,0,0.2);
}

/* ⬇️ ПРАВИЛЬНА ОРІЄНТАЦІЯ ГРАНЕЙ (3D-кубик) ⬇️ */

.dice .face1 { transform: rotateY(0deg) translateZ(50px); }
.dice .face2 { transform: rotateY(90deg) translateZ(50px); }
.dice .face3 { transform: rotateY(180deg) translateZ(50px); }
.dice .face4 { transform: rotateY(-90deg) translateZ(50px); }
.dice .face5 { transform: rotateX(90deg) translateZ(50px); }
.dice .face6 { transform: rotateX(-90deg) translateZ(50px); }

.dice .dot {
    width: 20px;
    height: 20px;
    background-color: #222;
    border-radius: 50%;
    position: absolute;
    transform: translate(-50%, -50%);
}

/* Центр */
.face1 .dot {
    top: 50%;
    left: 50%;
}

/* Дві точки (по діагоналі) */
.face2 .dot:nth-child(1) {
    top: 30%;
    left: 30%;
}
.face2 .dot:nth-child(2) {
    top: 70%;
    left: 70%;
}

/* Три точки (діагональ + центр) */
.face3 .dot:nth-child(1) {
    top: 25%;
    left: 25%;
}
.face3 .dot:nth-child(2) {
    top: 50%;
    left: 50%;
}
.face3 .dot:nth-child(3) {
    top: 75%;
    left: 75%;
}

/* Чотири точки (по кутах) */
.face4 .dot:nth-child(1) {
    top: 25%;
    left: 25%;
}
.face4 .dot:nth-child(2) {
    top: 25%;
    left: 75%;
}
.face4 .dot:nth-child(3) {
    top: 75%;
    left: 25%;
}
.face4 .dot:nth-child(4) {
    top: 75%;
    left: 75%;
}

/* П’ять точок (чотири кути + центр) */
.face5 .dot:nth-child(1) {
    top: 25%;
    left: 25%;
}
.face5 .dot:nth-child(2) {
    top: 25%;
    left: 75%;
}
.face5 .dot:nth-child(3) {
    top: 50%;
    left: 50%;
}
.face5 .dot:nth-child(4) {
    top: 75%;
    left: 25%;
}
.face5 .dot:nth-child(5) {
    top: 75%;
    left: 75%;
}

/* Шість точок (два вертикальні ряди) */
.face6 .dot:nth-child(1) {
    top: 25%;
    left: 30%;
}
.face6 .dot:nth-child(2) {
    top: 25%;
    left: 70%;
}
.face6 .dot:nth-child(3) {
    top: 50%;
    left: 30%;
}
.face6 .dot:nth-child(4) {
    top: 50%;
    left: 70%;
}
.face6 .dot:nth-child(5) {
    top: 75%;
    left: 30%;
}
.face6 .dot:nth-child(6) {
    top: 75%;
    left: 70%;
}
