@font-face {
    font-family: 'Material Symbols Outlined';
    font-style: normal;
    font-weight: 100 700;
    font-display: swap;
    src: url('fonts/material-symbols-outlined.woff2') format('woff2');
}

@font-face {
    font-family: 'Plus Jakarta Sans';
    font-style: normal;
    font-weight: 300 800;
    font-display: swap;
    src: url('fonts/plus-jakarta-sans.woff2') format('woff2');
}

@font-face {
    font-family: 'Space Grotesk';
    font-style: normal;
    font-weight: 300 700;
    font-display: swap;
    src: url('fonts/space-grotesk.woff2') format('woff2');
}

@font-face {
    font-family: 'Material Icons';
    font-style: normal;
    font-weight: 400;
    font-display: swap;
    src: url('fonts/material-icons.woff2') format('woff2');
}

.material-icons {
    font-family: 'Material Icons';
    font-weight: normal;
    font-style: normal;
    font-size: 24px;
    line-height: 1;
    letter-spacing: normal;
    text-transform: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1em;
    height: 1em;
    overflow: hidden;
    white-space: nowrap;
    word-wrap: normal;
    direction: ltr;
    -webkit-font-feature-settings: 'liga';
    -webkit-font-smoothing: antialiased;
}

.material-symbols-outlined {
    font-family: 'Material Symbols Outlined';
    font-weight: normal;
    font-style: normal;
    font-size: 24px;
    line-height: 1;
    letter-spacing: normal;
    text-transform: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1em;
    height: 1em;
    overflow: hidden;
    white-space: nowrap;
    word-wrap: normal;
    direction: ltr;
    -webkit-font-feature-settings: 'liga';
    -webkit-font-smoothing: antialiased;
}


:root {
    --bg-white: #ffffff;
    --bg-black: #000000;
    --font-primary: 'Plus Jakarta Sans', sans-serif;
    --font-display: 'Space Grotesk', sans-serif;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    background-color: var(--bg-white);
    color: var(--bg-black);
    font-family: var(--font-primary);
    min-height: 100vh;
    display: flex;
}


.app-container {
    display: flex;
    width: 100vw;
    height: 100vh;
    overflow: hidden;
    background: var(--bg-white);
}


.sidebar {
    width: 400px;
    background: var(--bg-white);
    border-right: 1px solid var(--bg-black);
    display: flex;
    flex-direction: column;
    height: 100%;
    z-index: 10;
}

.brand {
    padding: 32px 24px;
    border-bottom: 1px solid var(--bg-black);
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.logo-icon {
    display: none;
}

.brand h1 {
    font-family: var(--font-display);
    font-size: 1.25rem;
    font-weight: 700;
    letter-spacing: -0.5px;
    text-transform: uppercase;
}

.brand .subtitle {
    font-size: 0.7rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 1px;
}


.control-sections-wrapper {
    flex: 1;
    overflow-y: auto;
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 32px;
}


.control-sections-wrapper::-webkit-scrollbar {
    width: 4px;
}

.control-sections-wrapper::-webkit-scrollbar-track {
    background: var(--bg-white);
}

.control-sections-wrapper::-webkit-scrollbar-thumb {
    background: var(--bg-black);
}

.section-card {
    background: var(--bg-white);
    padding: 0;
    border: none;
    box-shadow: none;
}

.section-title {
    font-family: var(--font-display);
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: var(--bg-black);
    margin-bottom: 20px;
    font-weight: 700;
    display: block;
}


.tab-buttons {
    display: flex;
    border-bottom: 1px solid var(--bg-black);
    margin-bottom: 24px;
}

.tab-btn {
    background: transparent;
    border: none;
    color: var(--bg-black);
    padding: 8px 12px;
    cursor: pointer;
    font-size: 0.75rem;
    font-weight: 700;
    transition: opacity 0.1s;
    font-family: var(--font-display);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    opacity: 0.4;
    display: flex;
    align-items: center;
    gap: 4px;
}

.tab-btn .material-icons {
    font-size: 1rem;
}

.tab-btn:hover {
    opacity: 0.8;
}

.tab-btn.active {
    opacity: 1;
    border-bottom: 2px solid var(--bg-black);
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}


.control-group {
    margin-bottom: 24px;
}

.control-group.mini {
    margin-bottom: 12px;
    margin-top: 12px;
}

.control-group:last-child {
    margin-bottom: 0;
}

label {
    display: block;
    font-size: 0.7rem;
    font-weight: 700;
    color: var(--bg-black);
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

input[type="text"] {
    width: 100%;
    background: var(--bg-white);
    border: 1px solid var(--bg-black);
    color: var(--bg-black);
    padding: 10px 0px;
    border-left: none;
    border-right: none;
    border-top: none;
    outline: none;
    font-family: var(--font-primary);
    font-size: 0.85rem;
    font-weight: 600;
}

select {
    width: 100%;
    background: var(--bg-white);
    border: 1px solid var(--bg-black);
    color: var(--bg-black);
    padding: 10px 0px;
    border-left: none;
    border-right: none;
    border-top: none;
    outline: none;
    font-family: var(--font-primary);
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
}


.search-input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.search-input-wrapper input {
    padding-left: 24px;
}

.search-icon {
    position: absolute;
    left: 0;
    color: var(--bg-black);
    pointer-events: none;
    font-size: 1rem;
}


.icon-grid-container {
    height: 150px;
    overflow-y: auto;
    overflow-x: hidden;
    border: 1px solid var(--bg-black);
    padding: 8px;
    margin-top: 12px;
}

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

.grid-icon-item {
    aspect-ratio: 1;
    background: var(--bg-white);
    border: 1px solid transparent;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--bg-black);
    transition: all 0.1s;
}

.grid-icon-item .material-icons,
.grid-icon-item .material-symbols-outlined {
    font-size: 1.2rem;
}

.grid-icon-item:hover {
    background: var(--bg-black);
    color: var(--bg-white);
}

.grid-icon-item.active {
    background: var(--bg-black);
    color: var(--bg-white);
}


.font-suggestions {
    display: flex;
    flex-direction: column;
    gap: 4px;
    max-height: 120px;
    overflow-y: auto;
    margin-top: 8px;
}

.font-item {
    padding: 6px 0;
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
    cursor: pointer;
    font-size: 0.75rem;
    font-weight: 600;
    transition: opacity 0.1s;
    display: flex;
    justify-content: space-between;
    align-items: center;
    opacity: 0.5;
}

.font-item:hover,
.font-item.active {
    opacity: 1;
}

.font-item.active {
    font-weight: 800;
    border-bottom-color: var(--bg-black);
}


.upload-area {
    border: 1px dashed var(--bg-black);
    padding: 24px;
    text-align: center;
    cursor: pointer;
    background: var(--bg-white);
    transition: background-color 0.1s;
}

.upload-area:hover {
    background: rgba(0, 0, 0, 0.03);
}

.upload-icon {
    font-size: 1.8rem;
    color: var(--bg-black);
    margin-bottom: 8px;
}

.upload-area p {
    font-size: 0.75rem;
    color: var(--bg-black);
    font-weight: 700;
    margin-bottom: 4px;
}

.upload-limits {
    font-size: 0.65rem;
    color: var(--bg-black);
    opacity: 0.6;
}

.image-preview-info {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 0;
    border-bottom: 1px solid var(--bg-black);
    margin-top: 12px;
}

.image-preview-info .material-icons {
    font-size: 1rem;
}

.image-preview-info .filename {
    flex: 1;
    font-size: 0.75rem;
    font-weight: 700;
}

.remove-btn {
    background: transparent;
    border: none;
    color: var(--bg-black);
    cursor: pointer;
    display: flex;
}


.control-row {
    display: flex;
    gap: 16px;
}

.pixel-tools {
    display: flex;
    gap: 8px;
    margin-bottom: 12px;
    margin-top: 8px;
}

.pixel-art-canvas-container {
    background: var(--bg-white);
    padding: 8px;
    display: flex;
    justify-content: center;
    border: 1px solid var(--bg-black);
    margin-top: 8px;
}

.pixel-grid {
    display: grid;
    gap: 1px;
    background: var(--bg-black);
    width: 140px;
    height: 140px;
    cursor: crosshair;
}

.pixel-cell {
    background: var(--bg-white);
}

.pixel-cell:hover {
    background: rgba(0, 0, 0, 0.1);
}


.color-picker-wrapper {
    display: flex;
    align-items: center;
    gap: 10px;
    background: var(--bg-white);
    border-bottom: 1px solid var(--bg-black);
    padding: 8px 0;
    width: 100%;
}

.color-picker-wrapper input[type="color"] {
    -webkit-appearance: none;
    border: none;
    width: 20px;
    height: 20px;
    border-radius: 0%;
    cursor: pointer;
    background: none;
}

.color-picker-wrapper input[type="color"]::-webkit-color-swatch-wrapper {
    padding: 0;
}

.color-picker-wrapper input[type="color"]::-webkit-color-swatch {
    border: 1px solid var(--bg-black);
}

.color-hex {
    font-family: monospace;
    font-size: 0.8rem;
    font-weight: 700;
}

.bg-mode-selector {
    display: flex;
    border-bottom: 1px solid var(--bg-black);
    margin-bottom: 12px;
}

.bg-mode-btn {
    flex: 1;
    background: transparent;
    border: none;
    color: var(--bg-black);
    padding: 6px;
    cursor: pointer;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    opacity: 0.4;
}

.bg-mode-btn.active {
    opacity: 1;
    border-bottom: 2px solid var(--bg-black);
}

.gradient-controls {
    margin-top: 10px;
}


input[type="range"] {
    -webkit-appearance: none;
    width: 100%;
    height: 1px;
    background: var(--bg-black);
    outline: none;
    margin: 12px 0;
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--bg-black);
    cursor: pointer;
}

.slider-label-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.reset-icon-btn {
    background: transparent;
    border: none;
    color: var(--bg-black);
    cursor: pointer;
    display: flex;
    opacity: 0.6;
}

.reset-icon-btn:hover {
    opacity: 1;
}


.preview-workspace {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: var(--bg-white);
    height: 100%;
    overflow: hidden;
}

.workspace-header {
    padding: 32px 40px;
    border-bottom: 1px solid var(--bg-black);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.workspace-header h2 {
    font-family: var(--font-display);
    font-size: 1.1rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.badge {
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.preview-stage {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    padding: 40px;
    background-color: var(--bg-white);
}


.icon-canvas-wrapper {
    position: relative;
    width: 320px;
    height: 320px;
    background: var(--bg-white);
    border: 1px solid var(--bg-black);
    display: flex;
    align-items: center;
    justify-content: center;
}


.adaptive-icon-container {
    width: 300px;
    height: 300px;
    position: relative;
    overflow: hidden;
    clip-path: none;
    border: 1px solid var(--bg-black);
}

.layer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

.background-layer {
    background-color: #1a73e8;
    z-index: 1;
}

.foreground-layer {
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
    transform: translate(0px, 0px) scale(0.6);
    transform-origin: center center;
}


.safe-zone-overlay {
    position: absolute;
    width: 198px;
    height: 198px;
    border: 1px dashed var(--bg-black);
    border-radius: 50%;
    z-index: 3;
    pointer-events: none;
    box-shadow: 0 0 0 1000px rgba(255, 255, 255, 0.5);
    transition: opacity 0.2s ease;
}

.grid-overlay {
    position: absolute;
    width: 300px;
    height: 300px;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    grid-template-rows: repeat(3, 1fr);
    pointer-events: none;
    z-index: 4;
    transition: opacity 0.2s ease;
    box-sizing: border-box;
}

.grid-cell {
    border-right: 1px dashed rgba(255, 255, 255, 0.45);
    border-bottom: 1px dashed rgba(255, 255, 255, 0.45);
    box-shadow: -1px -1px 0 rgba(0, 0, 0, 0.3) inset;
    box-sizing: border-box;
}

.grid-cell:nth-child(3n) {
    border-right: none;
    box-shadow: 0 -1px 0 rgba(0, 0, 0, 0.3) inset;
}

.grid-cell:nth-child(n+7) {
    border-bottom: none;
    box-shadow: -1px 0 0 rgba(0, 0, 0, 0.3) inset;
}

.grid-cell:nth-child(9) {
    box-shadow: none;
}


.mask-circle {
    clip-path: circle(50% at 50% 50%);
}

.mask-squircle {
    clip-path: url(#squircle-clip);
}

.mask-rounded-square {
    clip-path: inset(5% round 18% 18% 18% 18%);
}

.mask-teardrop {
    clip-path: url(#teardrop-clip);
}

.mask-none {
    clip-path: none !important;
}


.workspace-footer {
    padding: 32px 40px;
    border-top: 1px solid var(--bg-black);
    background: var(--bg-white);
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.mask-options {
    display: flex;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
}

.mask-options .label {
    font-size: 0.7rem;
    font-weight: 700;
    color: var(--bg-black);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.mask-buttons {
    display: flex;
    gap: 4px;
}

.mask-btn {
    background: var(--bg-white);
    border: 1px solid var(--bg-black);
    color: var(--bg-black);
    padding: 6px 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    transition: background 0.1s, color 0.1s;
}

.mask-btn:hover {
    background: var(--bg-black);
    color: var(--bg-white);
}

.mask-btn.active {
    background: var(--bg-black);
    color: var(--bg-white);
}

.mask-shape {
    width: 10px;
    height: 10px;
    border: 1px solid currentColor;
    display: inline-block;
}

.mask-shape.circle {
    border-radius: 50%;
}

.mask-shape.squircle {
    border-radius: 35%;
}

.mask-shape.rounded-square {
    border-radius: 20%;
}

.mask-shape.teardrop {
    border-radius: 50% 50% 50% 5%;
    transform: rotate(-45deg);
}

.mask-shape.none {
    border: 1px dashed currentColor;
}


.preview-toggles {
    display: flex;
    gap: 20px;
}

.toggle-switch {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
}

.toggle-switch input {
    display: none;
}

.slider-toggle {
    width: 32px;
    height: 16px;
    background: var(--bg-white);
    border-radius: 8px;
    position: relative;
    border: 1px solid var(--bg-black);
    transition: all 0.2s;
}

.slider-toggle::before {
    content: '';
    position: absolute;
    width: 10px;
    height: 10px;
    background: var(--bg-black);
    border-radius: 50%;
    top: 2px;
    left: 2px;
    transition: all 0.2s;
}

.toggle-switch input:checked+.slider-toggle {
    background: var(--bg-black);
}

.toggle-switch input:checked+.slider-toggle::before {
    transform: translateX(16px);
    background: var(--bg-white);
}

.toggle-label {
    font-size: 0.7rem;
    font-weight: 700;
    color: var(--bg-black);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}


.btn {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    padding: 10px 16px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    outline: none;
    height: 40px;
    border: 1px solid var(--bg-black);
    transition: background 0.1s, color 0.1s;
}

.btn-primary {
    background: var(--bg-black);
    color: var(--bg-white);
}

.btn-primary:hover {
    background: var(--bg-white);
    color: var(--bg-black);
}

.btn-secondary {
    background: var(--bg-white);
    color: var(--bg-black);
}

.btn-secondary:hover {
    background: var(--bg-black);
    color: var(--bg-white);
}

.btn-secondary.active {
    background: var(--bg-black);
    color: var(--bg-white);
}

.export-actions {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}


.fg-render-text {
    font-size: 140px;
    font-weight: 700;
    color: #fff;
    user-select: none;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
}

.fg-render-icon {
    font-size: 180px;
    color: #fff;
    user-select: none;
}

.fg-render-img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.fg-render-pixel-canvas {
    width: 100%;
    height: 100%;
    image-rendering: pixelated;
}


@media (max-width: 1024px) {
    body {
        min-height: auto;
        display: block;
    }

    .app-container {
        flex-direction: column;
        overflow-y: visible;
        height: auto;
        width: 100%;
    }

    .sidebar {
        width: 100%;
        height: auto;
        border-right: none;
        border-bottom: 1px solid var(--bg-black);
    }

    .preview-workspace {
        height: auto;
        min-height: auto;
    }
}

@media (max-width: 768px) {
    .brand {
        padding: 20px 16px;
    }

    .control-sections-wrapper {
        padding: 16px;
        gap: 20px;
    }

    .preview-stage {
        padding: 24px 16px;
        min-height: 400px;
    }

    .workspace-footer {
        padding: 24px 16px;
        gap: 16px;
    }

    .export-actions {
        gap: 8px;
    }

    .export-actions .btn {
        flex: 1;
        min-width: 140px;
        font-size: 0.65rem;
    }

    .mask-buttons {
        flex-wrap: wrap;
    }

    .preview-toggles {
        flex-wrap: wrap;
        gap: 12px;
    }

    .source-code-btn {
        top: 8px !important;
        right: 8px !important;
        font-size: 0.65rem !important;
        padding: 6px 12px !important;
        height: 32px !important;
    }
}

.layers-container {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 8px;
    max-height: 200px;
    overflow-y: auto;
    border: 1px solid var(--bg-black);
    padding: 8px;
    border-radius: 4px;
}

.layer-item {
    position: relative;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 12px;
    border: 1px solid rgba(0, 0, 0, 0.1);
    background: var(--bg-white);
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 0.75rem;
    font-weight: 600;
    user-select: none;
    border-radius: 4px;
}

.layer-item:hover {
    border-color: var(--bg-black);
    background: rgba(0, 0, 0, 0.02);
}

.layer-item.active {
    background: var(--bg-black);
    color: var(--bg-white);
    border-color: var(--bg-black);
}

.layer-item-preview {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    background: rgba(0, 0, 0, 0.05);
    border-radius: 4px;
}

.layer-item.active .layer-item-preview {
    background: rgba(255, 255, 255, 0.2);
}

.layer-item-preview .material-icons,
.layer-item-preview .material-symbols-outlined {
    font-size: 1rem;
}

.layer-item-title {
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.layer-delete-btn {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    background: #ff4d4d;
    color: white;
    border: none;
    border-radius: 4px;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.layer-delete-btn .material-icons {
    font-size: 0.9rem;
}

.layer-item:hover .layer-delete-btn {
    opacity: 1;
}

.layer-delete-btn:hover {
    background: #ff1a1a;
}

.layer-item.dragging {
    opacity: 0.4;
    border: 1px dashed var(--bg-black);
}

.layer-item.drag-over {
    border-top: 2px solid var(--bg-black);
    background: rgba(0, 0, 0, 0.05);
}