*{
    margin: 0;
    padding: 0;
    box-sizing:border-box;
    font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
}
html, body{
    height: 100%;
    width: 100%;
}
:root{
    --bg: #0b0e12;
    --panel: #0f1418;
    --muted: #9aa3ad;
    --accent: #ffd54a;
}

body{
    background: var(--bg);
    color: #e6eef6
}
.container{
    height: 100vh;
    max-height: 100vh;
    display: grid;
    grid-template-columns: 250px 1fr 200px;
    grid-template-rows: auto 1fr;
    gap: 12px;
    padding:12px
}

.leftP {
    min-width: 180px;
}

.rightP {
    min-width: 180px;
}

.workspace {
    min-width: 240px;
    user-select: none;
    touch-action: none;
}

header{
    background: var(--panel);
    grid-column: 1/4;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 15px;
}
header .left{
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
}
.logo > img{
    max-height: 30px;
    max-width: 50px;
}
.features{
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 15px;
}
.features button{
    background: #111417;
    border: 1px solid #1f262a;
    color: var(--muted);
    padding: 8px 10px;
    border-radius: 6px;
    cursor: pointer;
}
.features button:hover{
    color: var(--accent);
}
.panel{
    background: var(--panel);
    padding: 10px;
    border-radius: 8px;
    overflow: auto
}
.leftP .tools{
    display: flex;
    justify-content: center;
    flex-direction: column;
    gap: 5px;
}
.leftP p{
    margin-bottom: 20px;
}
.tools .bottom{
    display: flex;
    align-items: center;
    gap: 10px;
    border-bottom: 1px solid #252c30;
    padding-bottom: 10px;
    margin-bottom: 10px;
}

#props label {
    display: grid;
    grid-template-columns: 110px 1fr 40px;
    align-items: center;
}

#props input {
    justify-self: center;
}

#props input {
    background: #111417;
    border: 1px solid #1f262a;
    color: #e6eef6;
    font-size: 12px;
    padding: 4px 6px;
    border-radius: 4px;
    width: 75px;
}
#props label {
    color: #9aa3ad;
    font-size: 12px;
}
#props label:hover{
    color: var(--accent);
}
#add-rect, #add-text{
    background: #111417;
    border: 1px solid #1f262a;
    color: var(--muted);
    padding: 8px 10px;
    border-radius: 6px;
    cursor: pointer
}
.rect{
    height: 20px;
    width: 30px;
    border: 1px solid white;
    pointer-events: none;
}
#add-rect:hover .rect{
    border-color: var(--accent);
}
#add-text:hover .text{
    color: var(--accent);
}
.text{
    height: 20px;
    width: 35px;
    border: 1px dashed white;
    display: flex;
    text-align: center;
    align-items: center;
    justify-content: center;
    padding: 5px;
    font-size: 10px;
    pointer-events: none;
}
.workspace{
    position: relative;
    background: linear-gradient(to right, #1f262a 1px, transparent 1px),
                linear-gradient(to bottom, #1f262a 1px, transparent 1px);
    background-size: 30px 30px;
}

.selected{
    outline: 2px solid #4da3ff;
    outline-offset: 2px;
    cursor: pointer;
}

.resize-handle {
    position: absolute;
    width: 8px;
    height: 8px;
    background: #4da3ff;
    z-index: 10;
}

.resize-top {
    top: -4px;
    left: 50%;
    transform: translateX(-50%);
    cursor: ns-resize;
}

.resize-right {
    right: -4px;
    top: 50%;
    transform: translateY(-50%);
    cursor: ew-resize;
}

.resize-bottom {
    bottom: -4px;
    left: 50%;
    transform: translateX(-50%);
    cursor: ns-resize;
}

.resize-left {
    left: -4px;
    top: 50%;
    transform: translateY(-50%);
    cursor: ew-resize;
}

#layers {
    margin-top: 20px;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.layer-item {
    position: relative;
    border: 1px solid #1f262a;
    border-radius: 8px;
    padding: 16px 10px 10px; /* top padding leaves space for label */
    background: var(--panel);
}

.layer-item.active {
    border-color: var(--accent);
}

.layer-label {
    position: absolute;
    top: -8px;
    left: 12px;

    background: var(--panel);
    padding: 0 6px;

    font-size: 12px;
    color: var(--muted);
    pointer-events: none;
}

.layer-content {
    display: flex;
    justify-content: center;
    gap: 8px;
}

.layer-btn {
    width: 30px;
    height: 30px;

    display: flex;
    align-items: center;
    justify-content: center;

    background: var(--bg);
    border: 1px solid #1f262a;
    border-radius: 6px;

    cursor: pointer;
}

.layer-btn i {
    font-size: 16px;
    color: var(--muted);
}

.layer-btn:hover i {
    color: var(--accent);
}

@media (max-width: 800px) {
    .container {
        grid-template-columns: 25% 50% 25%;
        grid-template-rows: auto 1fr;
        height: 100vh;
    }

    .panel {
        overflow-y: auto;
    }

    .workspace {
        overflow: hidden;
    }
}
@media (max-width: 580px) {
    .container {
        grid-template-columns: 1fr;
        grid-template-rows: auto auto 1fr auto;
    }

    header {
        grid-column: 1 / -1;
    }

    .leftP,
    .rightP {
        height: auto;
    }

    .workspace {
        min-height: 50vh;
    }
}
