* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: Arial, Helvetica, sans-serif;
    user-select: none;
}

html, body {
    width: 100%;
    height: 100%;
    overflow: hidden;
    background: #222;
}

#app {
    width: 100vw;
    height: 100vh;
    display: flex;
    background: #222;
}

#toolbar {
    width: 120px;
    background: #333;
    padding: 10px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    overflow-y: auto;
    flex-shrink: 0;
    z-index: 10;
}

#toolbar button {
    height: 38px;
    border: none;
    border-radius: 4px;
    background: #555;
    color: #fff;
    cursor: pointer;
    font-size: 13px;
    transition: background 0.15s;
}
#toolbar button:hover {
    background: #777;
}
#toolbar button.active {
    background: #2196f3;
}

#workspace {
    flex: 1;
    position: relative;
    background: #ffffff;
    overflow: hidden;
}

#canvas {
    width: 100%;
    height: 100%;
    display: block;
    touch-action: none;
    cursor: default;
}

#panel {
    width: 300px;
    background: #eee;
    padding: 12px;
    overflow-y: auto;
    flex-shrink: 0;
    z-index: 5;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

#panel h3 {
    font-size: 14px;
    color: #222;
    margin: 0 0 4px 0;
}

#panel hr {
    border: 0;
    border-top: 1px solid #ccc;
    margin: 6px 0;
}

#panel select {
    width: 100%;
    padding: 6px;
    border-radius: 4px;
    border: 1px solid #aaa;
    background: #fff;
    font-size: 14px;
}

#panel button {
    padding: 8px 12px;
    border: none;
    border-radius: 4px;
    background: #555;
    color: #fff;
    cursor: pointer;
    font-size: 14px;
    transition: background 0.15s;
}
#panel button:hover {
    background: #777;
}
#panel button#analyzeBtn {
    background: #2196f3;
    font-weight: bold;
}
#panel button#analyzeBtn:hover {
    background: #1976d2;
}

#properties {
    background: #f8f8f8;
    border-radius: 6px;
    padding: 10px;
    font-size: 14px;
    color: #333;
    min-height: 100px;
}
#properties label {
    display: block;
    margin-top: 6px;
    font-size: 13px;
    color: #555;
}
#properties input[type="number"] {
    width: 100%;
    height: 30px;
    margin: 2px 0 6px 0;
    padding: 4px 8px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 14px;
}
#properties button {
    padding: 4px 12px;
    margin: 4px 4px 0 0;
    border: none;
    border-radius: 4px;
    background: #555;
    color: #fff;
    cursor: pointer;
    font-size: 12px;
}
#properties button:hover {
    background: #777;
}

#results {
    background: #f8f8f8;
    border-radius: 6px;
    padding: 10px;
    font-size: 13px;
    color: #333;
    line-height: 1.6;
    min-height: 80px;
    max-height: 300px;
    overflow-y: auto;
}
#results div {
    margin-bottom: 4px;
}
#results hr {
    margin: 6px 0;
    border: 0;
    border-top: 1px solid #ddd;
}

@media (max-width: 900px) {
    #toolbar {
        width: 90px;
    }
    #panel {
        width: 220px;
    }
    #toolbar button {
        font-size: 11px;
    }
}

@media (max-width: 600px) {
    #app {
        flex-direction: column;
    }
    #toolbar {
        width: 100%;
        height: 70px;
        flex-direction: row;
        overflow-x: auto;
        padding: 6px;
        gap: 4px;
    }
    #toolbar button {
        min-width: 60px;
        height: 34px;
        font-size: 11px;
        flex-shrink: 0;
    }
    #workspace {
        height: calc(100vh - 160px);
    }
    #panel {
        position: absolute;
        bottom: 0;
        left: 0;
        width: 100%;
        height: 160px;
        z-index: 20;
        padding: 8px;
        overflow-y: auto;
    }
    #properties {
        min-height: 50px;
    }
    #results {
        min-height: 50px;
        max-height: 80px;
    }
}