html, body {
    margin: 0;
    padding: 0;
    width: 100%;
    height: 100%;
    background: #e9e9e6;
    overflow: hidden;
}

#myCanvas {
    width: 100%;
    height: 100%;
    display: block;
}

#controls {
    position: fixed;
    left: 50%;
    bottom: 14px;
    transform: translateX(-50%);
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 8px 12px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.92);
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.18);
    font: 12px/1 ui-monospace, SFMono-Regular, Menlo, monospace;
    user-select: none;
}

#controls .group {
    display: flex;
    gap: 4px;
    align-items: center;
}

#controls button,
#controls select {
    font: inherit;
    padding: 5px 8px;
    border: 1px solid #cfcfc9;
    border-radius: 5px;
    background: #fff;
    cursor: pointer;
}

#controls button:hover { background: #f2f2ee; }
#controls button.active { background: #1a1a1a; color: #fff; border-color: #1a1a1a; }

#readout {
    min-width: 20ch;
    letter-spacing: 0.02em;
}

#panel {
    position: fixed;
    top: 14px;
    left: 14px;
    padding: 10px 12px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.92);
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.18);
    font: 12px/1.4 ui-monospace, SFMono-Regular, Menlo, monospace;
    user-select: none;
}

#panel .toggles {
    display: flex;
    flex-direction: column;
    gap: 3px;
    padding-bottom: 8px;
    margin-bottom: 8px;
    border-bottom: 1px solid #e2e2dd;
}

#panel label {
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
}

#panel .panel-head {
    margin-bottom: 5px;
}

#panel .hint {
    color: #8a8a84;
}

.scale-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 2px;
}

#copy-values {
    width: 100%;
    margin-top: 8px;
    font: inherit;
    padding: 5px 8px;
    border: 1px solid #cfcfc9;
    border-radius: 5px;
    background: #fff;
    cursor: pointer;
}

#copy-values:hover { background: #f2f2ee; }
#copy-values.copied { background: #1a1a1a; color: #fff; border-color: #1a1a1a; }

.scale-row input {
    width: 4.5em;
    font: inherit;
    padding: 2px 4px;
    border: 1px solid #cfcfc9;
    border-radius: 4px;
    background: #fff;
    text-align: right;
}

#error {
    position: fixed;
    top: 14px;
    left: 50%;
    transform: translateX(-50%);
    max-width: 70ch;
    padding: 10px 14px;
    border-radius: 8px;
    background: #b3261e;
    color: #fff;
    font: 12px/1.5 ui-monospace, SFMono-Regular, Menlo, monospace;
    display: none;
}
