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

#container {
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    transform-origin: center center;
    will-change: transform;
}

svg {
    width: min(100vw, 100vh);
    height: min(100vw, 100vh);
    display: block;
}

#controls {
    position: fixed;
    top: 12px;
    left: 12px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    background: #000;
    padding: 10px;
    border: 1px solid #fff;
}

#controls label {
    color: #fff;
    font: 11px/1 monospace;
    display: flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
}

#controls .num-wrap {
    position: relative;
    display: inline-flex;
    align-items: center;
}

#controls .num-wrap input[type="number"] {
    width: 50px;
    background: #000;
    color: #fff;
    border: 1px solid #fff;
    font: 11px/1 monospace;
    padding: 2px 16px 2px 4px;
    outline: none;
    -moz-appearance: textfield;
    appearance: textfield;
}

#controls .num-wrap input[type="number"]::-webkit-inner-spin-button,
#controls .num-wrap input[type="number"]::-webkit-outer-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

#controls .num-wrap .num-arrows {
    position: absolute;
    right: 1px;
    top: 1px;
    bottom: 1px;
    display: flex;
    flex-direction: column;
    width: 12px;
}

#controls .num-wrap .num-arr {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    background: none;
    border: none;
    padding: 0;
    color: #666;
}

#controls .num-wrap .num-arr:hover {
    color: #fff;
}

#controls .num-wrap .num-arr svg {
    width: 8px;
    height: 5px;
}

#controls input[type="color"] {
    -webkit-appearance: none;
    appearance: none;
    width: 24px;
    height: 16px;
    border: 1px solid #fff;
    background: none;
    padding: 0;
    cursor: pointer;
}

#controls input[type="color"]::-webkit-color-swatch-wrapper {
    padding: 0;
}

#controls input[type="color"]::-webkit-color-swatch {
    border: none;
}

#controls .btn-row {
    display: flex;
    gap: 4px;
    margin-top: 4px;
}

#controls button {
    background: none;
    color: #fff;
    border: 1px solid #fff;
    padding: 2px 8px;
    font: 11px/1 monospace;
    cursor: pointer;
    flex: 1;
}

#controls button:hover {
    background: #fff;
    color: #000;
}

#controls button.active {
    background: #fff;
    color: #000;
}

/* Render-mode-specific control visibility */
#controls.mode-render2 .render1-only {
    display: none;
}
#controls:not(.mode-render2) .render2-only {
    display: none;
}

#dent-angle-controls {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

#dent-angle-controls label {
    color: #fff;
    font: 11px/1 monospace;
    display: flex;
    align-items: center;
    gap: 4px;
    white-space: nowrap;
}

#dent-angle-controls .apply-all-btn {
    background: none;
    border: 1px solid #fff;
    padding: 2px;
    cursor: pointer;
    flex: none;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 14px;
}

#dent-angle-controls .apply-all-btn svg {
    width: 12px;
    height: 10px;
}

#dent-angle-controls .apply-all-btn:hover {
    background: #fff;
}

#dent-angle-controls .apply-all-btn:hover svg {
    stroke: #000;
}

/* Code panel */
#code-panel {
    position: fixed;
    top: 0;
    right: 0;
    width: 260px;
    height: 100%;
    overflow-y: auto;
    background: rgba(0, 0, 0, 0.85);
    border-left: 1px solid #555;
    padding: 10px;
    box-sizing: border-box;
    font: 12px/1.6 monospace;
    color: #888;
    white-space: pre-wrap;
    word-break: break-all;
    outline: none;
    cursor: text;
}

#code-panel .bf-char {
    color: #ccc;
    cursor: pointer;
    border-radius: 1px;
}

#code-panel .bf-char.highlight {
    color: #fff;
    background: var(--hl-bg, rgba(255, 220, 50, 0.3));
}

/* SVG highlight */
svg .highlight:not(.hit-area) {
    stroke: var(--hl-color, #ffdc32) !important;
    filter: drop-shadow(0 0 3px var(--hl-glow, rgba(255, 220, 50, 0.8)));
}

svg circle.highlight[fill]:not([fill="none"]):not(.hit-area) {
    fill: var(--hl-color, #ffdc32) !important;
}
