:root {
    --bg: #fff;
    --fg: #222;
    --line: #ddd;
    --accent: #2a7ae2;
    --error: #c33;
    font: 14px/1.4 system-ui, sans-serif;
    color: var(--fg);
}
html, body, main { height: 100%; margin: 0; }
body { background: var(--bg); overflow: hidden; }
main { display: grid; grid-template-columns: 1fr 1fr; }
section { display: flex; flex-direction: column; min-width: 0; min-height: 0; }
#left { border-right: 1px solid var(--line); }
.bar {
    display: flex; align-items: center; gap: 6px; flex-wrap: wrap;
    padding: 6px 8px; border-bottom: 1px solid var(--line); min-height: 28px;
}
#canvas, #view { flex: 1; min-height: 0; width: 100%; display: block; }
#view { background: #f4f5f7; }
#view canvas { width: 100% !important; height: 100% !important; display: block; }
button {
    font: inherit; padding: 3px 10px; border: 1px solid var(--line); border-radius: 4px;
    background: #fafafa; color: var(--fg); cursor: pointer;
}
button:hover { border-color: var(--accent); }
button svg { display: block; width: 16px; height: 16px; fill: none; stroke: var(--fg); stroke-width: 1.5; }
#add-rect, #add-ellipse { padding: 4px 6px; }
/* Toolbar menus: a summary styled as a button, its content dropped below. */
.menu { position: relative; }
.menu summary {
    list-style: none; cursor: pointer; padding: 3px 10px; border: 1px solid var(--line);
    border-radius: 4px; background: #fafafa; display: inline-flex; align-items: center; min-height: 20px;
}
.menu summary::-webkit-details-marker { display: none; }
.menu summary:hover, .menu[open] summary { border-color: var(--accent); }
.menu summary svg { display: block; width: 16px; height: 16px; fill: none; stroke: var(--fg); stroke-width: 1.5; }
.popup {
    position: absolute; left: 0; top: calc(100% + 4px); z-index: 2; margin: 0;
    display: flex; flex-direction: column; align-items: stretch; gap: 6px; padding: 8px;
    background: var(--bg); border: 1px solid var(--line); border-radius: 4px; box-shadow: 0 2px 8px rgb(0 0 0 / 0.12);
}
.popup button { text-align: left; white-space: nowrap; }
#params label, #shape label { display: flex; align-items: center; gap: 4px; white-space: nowrap; }
/* One option per line: label, field and unit in aligned columns. */
#params { display: grid; grid-template-columns: auto auto auto; column-gap: 6px; row-gap: 8px; align-items: center; }
#params label { display: contents; }
#params input, #shape input { width: 3em; box-sizing: border-box; font: inherit; padding: 2px 4px; border: 1px solid var(--line); border-radius: 4px; }
.unit { color: #888; }
/* The shape toolbar floats over the canvas so showing it doesn't shift the drawing. */
#left { position: relative; }
#shape {
    position: absolute; left: 0; right: 0; top: var(--bar-height, 41px); z-index: 1; margin: 0;
    background: rgb(255 255 255 / 0.92);
}
#shape[hidden], #shape label[hidden] { display: none; }
#status, #notice { margin-left: auto; color: #777; }
#status.error { color: var(--error); }
#size { color: #777; margin-left: 12px; }
button:disabled { color: #aaa; border-color: var(--line); cursor: default; }
@media (max-width: 800px) {
    main { grid-template-rows: 1fr 1fr; grid-template-columns: 1fr; }
    #left { border-right: 0; border-bottom: 1px solid var(--line); }
}
