@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;
}
.top-icon-btn:hover {
    background: #374151;
    color: #38bdf8;
    transform: translateY(-1px);
}
.top-icon-btn.active-gizmo {
    background: #0c4a6e;
    border-color: #0284c7;
    color: #38bdf8;
    box-shadow: 0 0 10px rgba(2, 132, 199, 0.45);
}

/* Кнопки режимів 3D Гізмо фігури */
.gizmo-mode-btn {
    width: 26px;
    height: 26px;
    border-radius: 7px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #94a3b8;
    transition: all 0.15s;
    cursor: pointer;
}
.gizmo-mode-btn:hover {
    color: #c084fc;
    background: #1e293b;
}
.gizmo-mode-btn.active {
    background: #7e22ce;
    color: #ffffff;
    box-shadow: 0 0 10px rgba(168, 85, 247, 0.5);
}

/* Кнопки масштабування поля 1x..8x */
.field-scale-btn {
    padding: 3px 6px;
    border-radius: 7px;
    font-size: 10px;
    font-weight: 800;
    font-family: 'JetBrains Mono', monospace;
    background: #1e293b;
    border: 1px solid #334155;
    color: #94a3b8;
    cursor: pointer;
    transition: all 0.15s;
}
.field-scale-btn:hover {
    border-color: #38bdf8;
    color: #f8fafc;
}
.field-scale-btn.active {
    background: #0284c7;
    border-color: #38bdf8;
    color: #ffffff;
    box-shadow: 0 0 8px rgba(2, 132, 199, 0.45);
}

/* Швидка плаваюча панель над об'єктом */
.quick-tool-btn {
    padding: 4px 7px;
    border-radius: 7px;
    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;
}
.quick-tool-btn:hover {
    background: #334155;
    border-color: #38bdf8;
}

/* БОКОВІ ЯРЛИКИ (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);
}
.side-tab-btn .tab-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    background: #0284c7;
    color: #ffffff;
    font-size: 8px;
    font-weight: 800;
    font-family: 'JetBrains Mono', monospace;
    padding: 1px 4px;
    border-radius: 6px;
}

/* ВИСУВНІ ПАНЕЛІ (DRAWERS) */
.cad-drawer {
    position: absolute;
    right: 48px;
    top: 0;
    bottom: 0;
    transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.2s ease;
    transform: translateX(0);
    opacity: 1;
    padding-bottom: env(safe-area-inset-bottom, 0px);
}
.cad-drawer.drawer-closed {
    transform: translateX(110%);
    opacity: 0;
    pointer-events: none;
}

/* 3D VIEWCUBE */
.viewcube-wrapper {
    width: 56px;
    height: 56px;
    perspective: 240px;
    cursor: pointer;
}
.cube {
    width: 100%;
    height: 100%;
    position: relative;
    transform-style: preserve-3d;
    transform: rotateX(-25deg) rotateY(40deg);
    transition: transform 0.1s ease-out;
}
.face {
    position: absolute;
    width: 56px;
    height: 56px;
    background: rgba(17, 24, 39, 0.85);
    border: 1.5px solid #0284c7;
    color: #f8fafc;
    font-size: 8px;
    font-weight: 800;
    letter-spacing: 0.4px;
    display: flex;
    align-items: center;
    justify-content: center;
    backface-visibility: visible;
    transition: all 0.15s;
}
.face:hover {
    background: #0284c7;
    color: #ffffff;
}
.face.front  { transform: rotateY(0deg) translateZ(28px); }
.face.back   { transform: rotateY(180deg) translateZ(28px); }
.face.right  { transform: rotateY(90deg) translateZ(28px); }
.face.left   { transform: rotateY(-90deg) translateZ(28px); }
.face.top    { transform: rotateX(90deg) translateZ(28px); }
.face.bottom { transform: rotateX(-90deg) translateZ(28px); }

.cube-btn {
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    color: #94a3b8;
    transition: all 0.15s;
    cursor: pointer;
}
.cube-btn:hover {
    background: #1e293b;
    color: #38bdf8;
}

/* Кнопки вибору інструментів */
.tool-select-btn {
    background: #0f172a;
    border: 1px solid #1e293b;
    border-radius: 10px;
    padding: 8px 4px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    color: #94a3b8;
    transition: all 0.15s;
    cursor: pointer;
}
.tool-select-btn:hover {
    background: #1e293b;
    color: #38bdf8;
}
.tool-select-btn.active {
    background: #0c4a6e;
    border-color: #0284c7;
    color: #38bdf8;
    box-shadow: 0 0 10px rgba(2, 132, 199, 0.3);
}

/* Чіпи пресетів алгебри */
.preset-chip {
    font-size: 10px;
    font-family: 'JetBrains Mono', monospace;
    font-weight: 700;
    padding: 3px 7px;
    border-radius: 7px;
    background: #1e293b;
    border: 1px solid #334155;
    color: #94a3b8;
    cursor: pointer;
    transition: all 0.15s;
}
.preset-chip:hover {
    background: #0f2744;
    border-color: #38bdf8;
    color: #38bdf8;
}

/* Слайдери та чекбокси */
.cad-slider {
    accent-color: #0284c7;
    height: 5px;
    border-radius: 4px;
    background: #334155;
    outline: none;
}
.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: #f59e0b;
    background: #1e1b18;
    box-shadow: 0 0 12px rgba(245, 158, 11, 0.2);
}
.mission-card.completed {
    border-color: #10b981;
}

::-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;
}