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

html,body{
    width: 100%;
    height: 100%;
    background-color: #000000;
    color: #ffffff;
    font-family: 'Courier New', Courier, monospace;
}

:root{
    --bg-main: #000000;
    --bg-surface: #0b1220;
    --bg-editor: #020617;

    --accent-blue: #1e40af;
    --accent-blue-light: #2563eb;

    --text-primary: #ffffff;
    --text-secondary: #94a3b8;

    --border-soft: #1e293b;
    --handle-bg: #ffffff;

    --box-width: 100px;
    --box-height: 100px;
}

.hidden{
    display: none !important;
}



.home-screen{
    position: fixed;
    inset: 0;
    background: radial-gradient(circle at top, #0b1220, #000000);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.home-center{
    text-align: center;
}

.home-logo{
    width: 72px;
    height: 72px;
    margin: 0 auto 22px;
    border-radius: 18px;
    background: var(--accent-blue-light);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 36px;
    font-weight: 700;
}

.home-center h1{
    font-size: 34px;
    margin-bottom: 6px;
}

.home-center p{
    font-size: 15px;
    color: var(--text-secondary);
    margin-bottom: 34px;
}

.home-center button{
    display: inline-flex;
    align-items: center;
    gap: 8px;
    height: 46px;
    padding: 0 26px;
    border-radius: 999px;
    border: none;
    background: var(--accent-blue-light);
    color: white;
    font-size: 15px;
    cursor: pointer;
}

.home-center button:active{
    transform: scale(0.96);
}


.editor-screen{
    width: 100%;
    height: 100%;
}

.studio{
    display: flex;
    flex-direction: column;
    height: 100%;
    background-color: var(--bg-main);
}

.studio-content{
    height: 100%;
    position: relative;
    overflow: hidden;
    background-color: var(--bg-editor);
    color: var(--text-primary);
    background-image:
        linear-gradient(rgba(255,255,255,0.04) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255,255,255,0.04) 1px, transparent 1px);
    background-size: 40px 40px;
}


.box{
    position: absolute;
    width: var(--box-width);
    height: var(--box-height);
    background-color: var(--accent-blue-light);
    cursor: grab;
    z-index: 1;
}

.box.selected{
    outline: 2px solid var(--accent-blue);
    outline-offset: 2px;
}

.box:active{
    cursor: grabbing;
}

.text-box{
    background: transparent;
    color: var(--text-primary);
    padding: 6px 8px;
    min-width: 60px;
    min-height: 28px;
    cursor: text;
}

.text-box[contenteditable="true"]{
    outline: 1px dashed var(--accent-blue-light);
}


.studio-tool{
    display: flex;
    gap: 12px;
    justify-content: center;
    align-items: center;
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    height: 44px;
    padding: 0 12px;
    background-color: var(--bg-surface);
    border-radius: 999px;
    border: 1px solid var(--border-soft);
    z-index: 10;
}

.studio-tool button{
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
}

.studio-tool button:active{
    transform: scale(0.9);
}

.studio-tool i{
    font-size: 18px;
    line-height: 1;
}

.color-panel{
    position: absolute;
    bottom: 80px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--bg-surface);
    border: 1px solid var(--border-soft);
    border-radius: 16px;
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    z-index: 20;
}

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

.color-grid span{
    width: 22px;
    height: 22px;
    border-radius: 50%;
    cursor: pointer;
    border: 2px solid rgba(255,255,255,0.15);
}

.color-grid span[data-color="#ffffff"]{
    border: 1px solid #64748b;
}

#color-picker{
    width: 100%;
    height: 28px;
    border-radius: 999px;
    border: none;
    background: transparent;
    cursor: pointer;
    padding: 0;
}



.resize-handle{
    position: absolute;
    width: 8px;
    height: 8px;
    background: var(--handle-bg);
    border: 1px solid var(--accent-blue-light);
    z-index: 2;
}

.resize-tl{ top: -4px; left: -4px; cursor: nwse-resize; }
.resize-tr{ top: -4px; right: -4px; cursor: nesw-resize; }
.resize-bl{ bottom: -4px; left: -4px; cursor: nesw-resize; }
.resize-br{ bottom: -4px; right: -4px; cursor: nwse-resize; }




.top-left-actions{
    position: fixed;
    top: 18px;
    left: 18px;
    z-index: 1000;
}

.top-right-actions{
    position: fixed;
    top: 18px;
    right: 18px;
    display: flex;
    align-items: center;
    gap: 12px;
    z-index: 1000;
}

.top-action-btn{
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: var(--bg-surface);
    border: 1px solid var(--border-soft);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-primary);
    cursor: pointer;
}

.top-action-btn:active{
    transform: scale(0.92);
}




.keybind-toggle{
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: var(--bg-surface);
    border: 1px solid var(--border-soft);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-primary);
    cursor: pointer;
}

.keybind-toggle i{
    font-size: 18px;
}

.keybind-panel{
    position: fixed;
    right: 18px;
    top: 64px;
    width: 265px;
    background: var(--bg-surface);
    color: var(--text-primary);
    padding: 12px;
    border-radius: 8px;
    font-size: 14px;
    display: none;
    border: 1px solid var(--border-soft);
    z-index: 1000;
}

.keybind-panel h4{
    margin-bottom: 8px;
    font-size: 15px;
}

.keybind-panel ul{
    list-style: none;
}

.keybind-panel li{
    margin-bottom: 6px;
    color: var(--text-secondary);
}


.color-grid span[data-color="#ffffff"]{ background:#ffffff; }
.color-grid span[data-color="#000000"]{ background:#000000; }
.color-grid span[data-color="#2563eb"]{ background:#2563eb; }
.color-grid span[data-color="#1e40af"]{ background:#1e40af; }
.color-grid span[data-color="#16a34a"]{ background:#16a34a; }
.color-grid span[data-color="#dc2626"]{ background:#dc2626; }
.color-grid span[data-color="#f59e0b"]{ background:#f59e0b; }
.color-grid span[data-color="#9333ea"]{ background:#9333ea; }
