html, body {
    width: 100%;
    height: 100%;
    margin: 0;
    overflow: hidden; /* Prevents scrollbars */
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background-color: #f4f7f6;
    color: #333;
    text-align: center;
}

h1 {
    color: #2c3e50;
    margin-bottom: 5px;
}

p {
    margin-top: 0;
    margin-bottom: 15px;
}

#controls {
    margin-bottom: auto; /* Pushes the measurement display to the bottom */
    padding: 15px 20px;
    background-color: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(5px);
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    display: flex;
    gap: 20px;
    align-items: center;
    flex-wrap: wrap;
    justify-content: center;
}

#controls label {
    margin-right: 8px;
    font-weight: 500;
}

#unit, #length-input, #apply-length-btn, #remove-btn, #ppi {
    padding: 8px;
    border-radius: 4px;
    border: 1px solid #ccc;
    font-size: 1em;
}

#apply-length-btn {
    background-color: #3498db;
    color: white;
    border-color: #2980b9;
    cursor: pointer;
    transition: background-color 0.2s;
}

#apply-length-btn:hover:not(:disabled) {
    background-color: #2980b9;
}

#remove-btn {
    background-color: #e74c3c;
    color: white;
    border-color: #c0392b;
    cursor: pointer;
    transition: background-color 0.2s;
}

#remove-btn:hover:not(:disabled) {
    background-color: #c0392b;
}

#apply-length-btn:disabled, #remove-btn:disabled, #length-input:disabled {
    background-color: #bdc3c7;
    border-color: #a3a8ab;
    cursor: not-allowed;
}

#length-input {
    width: 80px;
}

#ppi {
    width: 80px;
}

#clone-btn {
    background-color: #27ae60;
    color: white;
    border-color: #219a52;
    cursor: pointer;
    transition: background-color 0.2s;
    padding: 8px;
    border-radius: 4px;
    border: 1px solid #ccc;
    font-size: 1em;
}

#clone-btn:hover:not(:disabled) {
    background-color: #219a52;
}

#clone-btn:disabled {
    background-color: #bdc3c7;
    border-color: #a3a8ab;
    cursor: not-allowed;
}

#drawing-canvas {
    display: block;
    border: 2px solid #bdc3c7;
    background-color: #ffffff;
    /* cursor is now set dynamically in JS */
    position: absolute;
    top: 0;
    left: 0;
    z-index: 1;
}

#ui-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 10;
    pointer-events: none; /* Allows clicks to pass through to the canvas */
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 20px;
    box-sizing: border-box;
}

#ui-container > * {
    pointer-events: auto; /* Re-enable pointer events for UI elements */
    text-align: center;
}

#measurement-display {
    margin-top: 20px;
    padding: 15px;
    background-color: rgba(44, 62, 80, 0.9);
    backdrop-filter: blur(5px);
    color: #ecf0f1;
    font-size: 1.2em;
    font-weight: bold;
    border-radius: 8px;
    min-width: 250px;
    text-align: center;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

#length {
    font-family: 'Courier New', Courier, monospace;
}