:root {
    /* BG */
    --bg-main: #050519;
    --bg-panel: #050519;
    --bg-input: #050519;

    /* --color-main: #ff34ff; */
    --color-main: #34baf4;
    /* --color-main-rgb: 255, 52, 255; */
    --color-main-rgb: 52, 186, 244;
    --color-secondary: #002dff;

    /* TEXT */
    --font-main: monospace;
    --text-primary: #ffffff;
    --text-accent: var(--color-main);
    --text-muted: #888da8;

    /* BORDERS & SHADOWS */
    --border-color: rgba(255, 255, 255, 0.3);
    --border-active: var(--color-main);

    --glow-shadow: 0 0 10px rgba(var(--color-main-rgb), 0.4), 0 0 5px rgba(var(--color-main-rgb), 0.8);
    --transition-fast: 0.2s ease;
    --transition-smooth: 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

body {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    margin: 0;
    overflow-x: hidden;
    background-color: var(--bg-main);
    color: var(--text-primary);
    font-family: var(--font-main);
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.5;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

.h1 {
    text-transform: uppercase;
    font-size: 2rem;
    line-height: 1.2;
    color: var(--text-primary);
    text-shadow: var(--glow-shadow);
}

.h2 {
    text-transform: uppercase;
    font-size: 1.25rem;
    line-height: 1.2;
    color: var(--text-accent);
    text-shadow: var(--glow-shadow);
}

p {
    line-height: 1.5;
    color: var(--text-primary);

}

.support-link {
    color: var(--color-main);
    text-decoration: underline;
    text-underline-offset: 4px;
    transition: var(--transition-fast);
}

.support-link:hover {
    text-shadow: var(--glow-shadow);
    text-decoration: underline;
}

.ua-flag {
    display: inline-block;
    width: 24px;
    height: 16px;
    vertical-align: middle;
    background: linear-gradient(to bottom, #0057B7 50%, #FFD700 50%);
}

/* BUTTON PRIMARY */
.btn-wrapper {
    position: relative;
    display: block;
    width: 100%;
    margin-top: 10px;
}

.btn-shadow {
    position: absolute;
    top: 4px;
    left: 4px;
    width: 100%;
    height: 42px;
    background-color: var(--color-main);
    z-index: 1;
}

.btn-base {
    position: relative;
    border-radius: 2px;
    z-index: 2;
    width: 100%;
    height: 42px;
    padding: 0 32px;
    font-family: var(--font-main);
    font-weight: 700;
    cursor: pointer;
    border: 1px solid #000;
    color: #000;
    font-size: 1.25rem;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;

    transform: translate(0px, 0px);
    backface-visibility: hidden;
    -webkit-font-smoothing: subpixel-antialiased;
}

.btn-secondary {
    background: #0a002b;
    border: 1px solid var(--border-color);
    color: #fff;
}

.btn-special {
    /* background: linear-gradient(110deg, #FF94F3 20%, #E2FF94 40%, #94FFEB 60%, #9B72FF 80%, #FF94F3 100%); */
    background: linear-gradient(110deg, #66d1ff 0%, #ffffff 20%, #66d1ff 40%, #ffffff 60%, #66d1ff 80%, #66d1ff 100%);
    background-size: 200% 100%;
    animation: holo-shift 6s linear infinite;
}

@keyframes holo-shift {
    0% {
        background-position: 0% 50%;
    }

    100% {
        background-position: 200% 50%;
    }
}

.btn-base:hover {
    transform: translate(-2px, -2px);
    filter: brightness(1.2);
}

.btn-base:active {
    transform: translate(4px, 4px);
    transition: transform 0.05s linear;
}



/* RIPPLE */
.ripple {
    position: absolute;
    background: rgba(0, 0, 0, 0.4);
    border-radius: 50%;
    pointer-events: none;
    z-index: 10;
    transform: scale(0);
    animation: ripple-animation 0.6s ease-out;
}

@keyframes ripple-animation {
    to {
        transform: scale(3);
        opacity: 0;
    }
}

.tooltip-text {
    visibility: hidden;
    width: 320px;
    background-color: var(--bg-panel);
    color: var(--text-primary);
    border: 1px solid var(--color-main);
    padding: 8px;
    position: absolute;
    z-index: 1001;
    bottom: 150%;
    left: 50%;
    transform: translateX(-50%);
    opacity: 0;
    transition: opacity var(--transition-fast);
    font-size: 13px;
    text-transform: none;
    box-shadow: var(--glow-shadow);
}

.tooltip-container:hover .tooltip-text {
    visibility: visible;
    opacity: 1;
}

.content-block {
    flex: 1 0 auto;
    display: flex;
    flex-direction: column;
    padding: 24px 32px;
    width: 100%;
    box-sizing: border-box;
    min-height: calc(100vh - 120px);
    height: calc(100vh - 120px);
    overflow-y: auto;
    position: relative;
    z-index: 1;
}

#myBackground {
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 100vw;
    height: 100%;
    z-index: -1;
    display: block;
    image-rendering: pixelated;
    backface-visibility: hidden;
}

.control-checkbox {
    display: flex;
    align-items: center;
    cursor: pointer;
    gap: 8px;
    color: #ffffff;
    user-select: none;
    margin: 10px 0;
    transition: opacity 0.2s;
}

.control-checkbox input {
    display: none;
}

.checkbox-box {
    width: 20px;
    height: 20px;
    border: 1px solid #ffffff;
    border-radius: 4px;
    position: relative;
    transition: all 0.2s ease;
    background: transparent;
}

.checkbox-box :hover {
    box-shadow: var(--glow-shadow);
}

.control-checkbox input:checked+.checkbox-box {
    background: var(--color-main);
    border: 1px solid var(--color-main);
}

.checkbox-box::after {
    content: '';
    position: absolute;
    display: none;
    left: 6px;
    top: 2px;
    width: 6px;
    height: 10px;
    border: solid white;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

.control-checkbox input:checked+.checkbox-box::after {
    display: block;
}

.checkbox-label {
    font-size: 1rem;
    line-height: 1.5;
    color: var(--text-primary);
    text-shadow: var(--glow-shadow);

}

/* DITHER_ENGINE */
.engine-wrapper {
    display: flex;
    flex: 1;
    gap: 24px;
    margin-top: 16px;
    min-height: 0;
    height: calc(100vh - 160px);
}

/* SIDEBAR */
.engine-sidebar {
    display: flex;
    flex-direction: column;
    background-color: var(--bg-panel);
    height: 100%;
    max-height: 100vh;
    overflow-y: auto;

    &::-webkit-scrollbar {
        display: none;
    }

    scrollbar-width: none;
    -ms-overflow-style: none;
}

.engine-sidebar::-webkit-scrollbar {
    display: none;
}

.group-title {
    font-size: 0.85rem;
    color: var(--color-main);
    text-transform: uppercase;
    letter-spacing: 0.25rem;
    margin: 0 0 8px 0;
}

.control-group {
    display: flex;
    flex-direction: column;
    margin-bottom: 24px;
}

.toggle-row {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.toggle-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
}

.slider-item {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 16px;
}

.slider-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: var(--text-primary);
}


.custom-select-container {
    position: relative;
    width: 100%;
    user-select: none;
    font-family: var(--font-main);
}

.select-trigger {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 48px;
    padding: 0 16px;
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    cursor: pointer;
    transition: var(--transition-fast);
}

.select-trigger:hover,
.custom-select-container.open .select-trigger {
    border-color: var(--color-main);
    color: var(--color-main);
}

.arrow {
    width: 0;
    height: 0;
    border-left: 6px solid transparent;
    border-right: 6px solid transparent;
    border-top: 6px solid var(--text-primary);
    transition: transform 0.3s ease;
}

.custom-select-container.open .arrow {
    transform: rotate(180deg);
    border-top-color: var(--color-main);
}

.select-options {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    background: var(--bg-main);
    border: 1px solid #ffffff;
    box-shadow: var(--glow-shadow);
    z-index: 100;
    display: none;
}

.custom-select-container.open .select-options {
    display: block;
}

.option {
    padding: 12px 16px;
    color: var(--text-primary);
    cursor: pointer;
    transition: background 0.2s ease;
}

.option:hover {
    background: rgba(var(--color-main-rgb), 0.5);
}

.option.active {
    background: var(--color-main);
    color: #000;
}

.ui-toggles {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
    margin-bottom: 8px;
}

.ui-toggle-btn {
    height: 36px;
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    font-family: var(--font-main);
    font-size: 11px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s ease;
}

.ui-toggle-btn:hover {
    border-color: rgba(var(--color-main-rgb), 0.5);
}

.ui-toggle-btn.active {
    background: var(--color-main);
    border-color: var(--color-main);
    color: #000;
    box-shadow: var(--glow-shadow);
}

.palette-customizer {
    display: flex;
    align-items: flex-start;
    gap: 8px;
}

.color-slot {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 6px;
    cursor: pointer;
}

.color-preview {
    height: 40px;
    width: 100%;
    border: 1px solid #ffffff;
    transition: transform 0.2s ease;
}

.color-slot:hover .color-preview {
    transform: scale(1.02);
    border-color: var(--color-main);
}

.color-slot span {
    font-size: 10px;
    color: var(--text-muted);
    letter-spacing: 1px;
    text-align: center;
}

.btn-swap {
    margin-top: 4px;
    align-self: flex-start;
    height: 32px;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-color);
    color: var(--color-main);
    border-radius: 4px;
    cursor: pointer;
    transition: 0.2s;
}

.btn-swap:hover {
    background: rgba(var(--color-main-rgb), 0.1);
    border-color: var(--color-main);
}

.size-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
}

.size-grid .ui-toggle-btn {
    font-size: 0.85rem;
    height: 40px;
}

/* SLIDER */

.slider-control {
    margin-bottom: 16px;
}

.slider-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0px;
}

.slider-label {
    color: #ffffff;
    text-shadow: var(--glow-shadow);
    font-size: 1rem;
    font-weight: 700;
}

.slider-number {
    width: 54px;
    height: 32px;
    background: transparent;
    border: 1px solid #ffffff;
    color: #ffffff;
    text-align: center;
    font-family: var(--font-main);
    font-size: 0.85rem;
    outline: none;
    transition: 0.2s;
}

.slider-number:hover,
.slider-number:focus {
    border-color: var(--color-main);
    box-shadow: 0 0 10px rgba(var(--color-main-rgb), 0.3);
}

.slider-number::-webkit-inner-spin-button,
.slider-number::-webkit-outer-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.ui-range {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: 2px;
    background: #ffffff;
    outline: none;
}

.ui-range::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 14px;
    height: 14px;
    background: var(--color-main);
    cursor: pointer;
    border-radius: 0;
    transition: 0.2s;
}

.ui-range:active::-webkit-slider-thumb,
.ui-range::-webkit-slider-thumb:hover {
    filter: brightness(1.2);
    box-shadow: var(--glow-shadow);
    transform: scale(1.1);
}

.ui-range::-moz-range-thumb {
    width: 14px;
    height: 14px;
    background: var(--color-main);
    border: none;
    border-radius: 0;
    cursor: pointer;
    transition: 0.2s;
}

.ui-range:active::-moz-range-thumb,
.ui-range::-moz-range-thumb:hover {
    filter: brightness(1.2);
    box-shadow: var(--glow-shadow);
}

.btn-download {
    margin-top: auto;
    padding: 16px;
    background: linear-gradient(90deg, var(--color-main), var(--color-secondary));
    border: none;
    color: #000;
    font-weight: 900;
    text-transform: uppercase;
    cursor: pointer;
    box-shadow: var(--glow-shadow);
}

.engine-viewport {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
    height: 100%;
}

.canvas-container {
    flex: 1;
    width: 100%;
    position: relative;
    background: rgba(0, 0, 0, 0.2);
    border: 2px dashed var(--border-color);
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

.canvas-container:hover {
    border: 2px dashed var(--color-main);
    cursor: pointer;
}

.canvas-placeholder {
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 2px;
}

.canvas-container.drag-over {
    border-color: var(--color-main);
    background: rgba(var(--color-main-rgb), 0.05);
    box-shadow: var(--glow-shadow);
}

.upload-prompt {
    text-align: center;
    pointer-events: none;
}

.upload-prompt .h1 {
    margin-bottom: 8px;
    pointer-events: none;
}

#main-canvas {
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: auto;
    object-fit: contain;
}



@media (max-width: 900px) {
    .engine-wrapper {
        flex-direction: column;
        display: block;
    }

    .engine-viewport {
        width: 100%;
        height: 60vh;
        margin-bottom: 80px;
    }

    .engine-sidebar {
        position: fixed;
        bottom: 0;
        left: 0;
        width: 100%;
        max-height: 70vh;
        background-color: #0a002b;
        border-top: 3px solid var(--color-main);
        border-radius: 20px 20px 0 0;
        padding: 15px 20px 40px 20px;
        z-index: 20000;
        overflow-y: auto;
        box-shadow: 0 -10px 30px rgba(0, 0, 0, 0.5);
        height: 30vh;
        max-height: 85vh;
        touch-action: none;
    }

    .drag-handle {
        width: 50px;
        height: 6px;
        background: rgba(0, 0, 0, 0.3);
        border-radius: 3px;
        margin: 0 auto 15px;
        cursor: grab;
    }

    .engine-sidebar::before {
        content: "";
        display: block;
        width: 40px;
        height: 5px;
        background: rgba(0, 0, 0, 0.2);
        border-radius: 10px;
        margin: 0 auto 15px auto;
    }
}

.error-container {
    padding: 24px;
    border: 1px solid var(--border-color);
    border-radius: 2px;
    background-color: rgba(5, 5, 25, 0.3);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(10px);
}

/* PORTFOLIO CASES STYLES */
.case-container {
    width: 80%;
    max-width: 1120px;
    margin: 24px auto;
    display: flex;
    flex-direction: column;
    gap: 0;
    line-height: 0;
}

.case-img,
.video-wrapper {
    width: 100%;
    height: auto;
    display: block;
}

.video-wrapper {
    position: relative;
    width: 100%;
    max-width: 1400px;
    margin: 0 auto;
    aspect-ratio: 16 / 9;
    background-color: #000;
}

.video-wrapper iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: none;
}

.figma-wrapper {
    display: block;
    width: 100%;
    max-width: 1000px;
    height: 800px;
    margin: 40px auto;
    border: none;
}

.figma-wrapper iframe {
    width: 100%;
    height: 100%;
    border: 1px solid var(--border-color);
    border-radius: 8px;
}


@media (max-width: 768px) {
    .case-container {
        width: 100%;
    }
}

@media (max-width: 900px) {
    .content-block {
        padding: 24px 8px;
        height: auto;
        overflow-y: visible;
    }
}

@media (max-width: 700px) {
    div.hero-buttons {
        gap: 4px;
    }
}