@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800;900&family=JetBrains+Mono:wght@500;700;800&display=swap');

* {
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: 'Inter', sans-serif;
    user-select: none;
    -webkit-user-select: none;
    touch-action: none;
}

.font-mono {
    font-family: 'JetBrains Mono', monospace;
}

/* Кнопки верхнього меню */
.top-icon-btn {
    width: 32px;
    height: 32px;
    border-radius: 9px;
    background: #1f2937;
    border: 1px solid #374151;
    color: #e5e7eb;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s ease;
    cursor: pointer;
    flex-shrink: 0;
}
.top-icon-btn:hover {
    background: #374151;
    color: #38bdf8;
    transform: translateY(-1px);
}
.top-icon-btn:active {
    transform: translateY(0);
}

/* Перемикач режимів */
.mode-switch-btn {
    padding: 5px 8px;
    border-radius: 8px;
    font-size: 11px;
    font-weight: 700;
    color: #94a3b8;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    transition: all 0.15s ease;
    cursor: pointer;
    border: 1px solid transparent;
    white-space: nowrap;
}
.mode-switch-btn:hover {
    color: #ffffff;
}
.mode-switch-btn.active-cyan {
    background: rgba(8, 145, 178, 0.22);
    color: #67e8f9;
    border-color: rgba(6, 182, 212, 0.45);
}
.mode-switch-btn.active-orange {
    background: rgba(234, 88, 12, 0.22);
    color: #fdba74;
    border-color: rgba(249, 115, 22, 0.45);
}
.mode-switch-btn.active-amber {
    background: rgba(217, 119, 6, 0.22);
    color: #fcd34d;
    border-color: rgba(245, 158, 11, 0.45);
}

@media (max-width: 420px) {
    .mode-switch-btn {
        padding: 4px 6px;
        font-size: 10px;
        gap: 4px;
    }
    .top-icon-btn {
        width: 30px;
        height: 30px;
    }
}

/* Кнопки HUD масштабування */
.hud-circle-btn {
    width: 30px;
    height: 30px;
    border-radius: 10px;
    background: #1f2937;
    color: #94a3b8;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s;
    cursor: pointer;
}
.hud-circle-btn:hover {
    background: #374151;
    color: #38bdf8;
}

/* Швидка плаваюча панель над фігурою */
.quick-tool-btn {
    padding: 6px 9px;
    border-radius: 8px;
    background: #1e293b;
    color: #f1f5f9;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 11px;
    font-weight: 700;
    transition: all 0.15s ease;
    cursor: pointer;
    border: 1px solid #334155;
    white-space: nowrap;
}
.quick-tool-btn:hover {
    background: #334155;
    border-color: #38bdf8;
}

.odd-shape-btn {
    padding: 7px 14px;
    border-radius: 9px;
    background: linear-gradient(135deg, #f59e0b, #ef4444);
    color: #ffffff;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    font-weight: 900;
    cursor: pointer;
    border: 1px solid rgba(255, 255, 255, 0.35);
    box-shadow: 0 4px 18px rgba(245, 158, 11, 0.45);
    transition: transform 0.12s ease, filter 0.15s ease;
    white-space: nowrap;
}
.odd-shape-btn:hover {
    filter: brightness(1.1);
    transform: scale(1.04);
}
.odd-shape-btn:active {
    transform: scale(0.97);
}

/* БОКОВІ ЯРЛИКИ (TABS) */
.side-tab-btn {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: #192233;
    border: 1px solid #334155;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    cursor: pointer;
    transition: all 0.15s cubic-bezier(0.4, 0, 0.2, 1);
}
.side-tab-btn:hover {
    background: #223049;
    border-color: #38bdf8;
    transform: scale(1.05);
}
.side-tab-btn.active {
    background: #0f2744;
    border-color: #0284c7;
    box-shadow: 0 0 12px rgba(2, 132, 199, 0.45);
}

/* ВИСУВНІ ПАНЕЛІ (DRAWERS) — АДАПТИВНА ШИРИНА */
.cad-drawer {
    position: absolute;
    right: 48px;
    top: 0;
    bottom: 0;
    width: min(calc(100vw - 48px), 320px);
    transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.2s ease;
    transform: translateX(0);
    opacity: 1;
}
.cad-drawer.drawer-closed {
    transform: translateX(110%);
    opacity: 0;
    pointer-events: none;
}

/* Фільтр-чіпи категорій */
.cat-chip {
    font-size: 10px;
    font-weight: 700;
    padding: 4px 8px;
    border-radius: 8px;
    background: #0f172a;
    border: 1px solid #1e293b;
    color: #94a3b8;
    cursor: pointer;
    transition: all 0.15s;
}
.cat-chip:hover {
    color: #e2e8f0;
    border-color: #334155;
}
.cat-chip.active {
    background: #0c4a6e;
    border-color: #0284c7;
    color: #38bdf8;
}

/* Рядки перемикачів */
.geo-toggle-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 6px 8px;
    border-radius: 9px;
    background: #0f172a;
    border: 1px solid #1e293b;
    font-size: 11px;
    color: #cbd5e1;
    cursor: pointer;
    transition: border-color 0.15s;
}
.geo-toggle-row:hover {
    border-color: #334155;
}
.cad-checkbox {
    accent-color: #06b6d4;
    width: 15px;
    height: 15px;
    cursor: pointer;
}

/* Картки загадок і завдань */
.mission-card {
    background: #0f172a;
    border: 1px solid #1e293b;
    border-radius: 12px;
    padding: 10px;
    cursor: pointer;
    transition: all 0.15s ease;
}
.mission-card:hover {
    background: #172236;
    border-color: #38bdf8;
    transform: translateY(-1px);
}
.mission-card.active {
    border-color: #38bdf8;
    background: #0f233a;
    box-shadow: 0 0 12px rgba(56, 189, 248, 0.22);
}
.mission-card.completed {
    border-color: #10b981;
}

/* Анімація лічильника зірок */
@keyframes starBadgePop {
    0% { transform: scale(1); }
    45% { transform: scale(1.28); filter: brightness(1.35); }
    100% { transform: scale(1); }
}
.star-badge-pop {
    animation: starBadgePop 0.36s cubic-bezier(0.22, 1, 0.36, 1);
}

/* Летючі зірочки */
.flying-star {
    position: fixed;
    z-index: 9999;
    pointer-events: none;
    color: #fbbf24;
    filter: drop-shadow(0 0 8px rgba(251, 191, 36, 0.9));
    will-change: transform, opacity;
}

/* Скролбар */
::-webkit-scrollbar {
    width: 5px;
    height: 5px;
}
::-webkit-scrollbar-track {
    background: #0b0f19;
}
::-webkit-scrollbar-thumb {
    background: #1f2937;
    border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover {
    background: #374151;
}

.select-text {
    user-select: text;
    -webkit-user-select: text;
}

/* Картки вибору режиму в боковому меню */
.mode-menu-card {
    background: #0f172a;
    border: 1px solid #1e293b;
    border-radius: 13px;
    padding: 11px 12px;
    cursor: pointer;
    transition: all 0.16s ease;
    display: flex;
    align-items: center;
    gap: 11px;
}
.mode-menu-card:hover {
    background: #172236;
    border-color: #38bdf8;
    transform: translateY(-1px);
}
.mode-menu-card.active {
    background: #0f233a;
    border-color: #38bdf8;
    box-shadow: 0 0 14px rgba(56, 189, 248, 0.24);
}

/* Кнопки відповідей у режимі Квіз-загадок */
.quiz-option-btn {
    min-width: 56px;
    padding: 8px 16px;
    border-radius: 12px;
    background: #1e293b;
    border: 1px solid #334155;
    color: #f8fafc;
    font-family: 'JetBrains Mono', monospace;
    font-size: 14px;
    font-weight: 800;
    cursor: pointer;
    transition: all 0.15s ease;
}
.quiz-option-btn:hover:not(:disabled) {
    background: #334155;
    border-color: #38bdf8;
    transform: translateY(-2px);
}
.quiz-option-btn.correct {
    background: rgba(16, 185, 129, 0.25);
    border-color: #10b981;
    color: #6ee7b7;
    box-shadow: 0 0 16px rgba(16, 185, 129, 0.45);
}
.quiz-option-btn.wrong {
    background: rgba(239, 68, 68, 0.25);
    border-color: #ef4444;
    color: #fca5a5;
}