/* =========================
   Toolbox Line + Brush
   ========================= */

:root {
    --toolboxLine-w: 55px;
    --toolboxLine-icon-size: 22px;
    --toolboxLine-gap: 16px;
    --toolboxLine-glass: rgba(20, 20, 20, 0.75);
    --gravin-stroke: #A8FF60;
    --bg-tool-bar: rgba(231, 227, 220, 0.92);
    --deepmoss: #7E8C76;
    --warmdarkergray: #59554f;
    --gv-bg: #f0f1f2;
    --gv-panel: #eaebec;
    --gv-key: #e2e3e5;
    --gv-key-del: #d8d9db;
    --gv-key-active: #4a5568;
    --gv-border: #d0d2d4;
    --gv-text-primary: #111214;
    --gv-text-label: #8a8f96;
    --gv-text-sub: #adb0b5;
    --gv-lime: #a8e63d;
    --gv-lime-dark: #7aaa2a;
    --gv-lime-tint: rgba(168, 230, 61, 0.08);

    /* Toolbox warm dark tokens */
    --tb-bg: rgba(52, 46, 38, 0.88);
    --tb-bg: rgba(46, 46, 46, 0.78);
    --tb-bg-hover: rgba(62, 56, 46, 0.95);
    --tb-border: rgba(255, 255, 255, 0.10);
    --tb-icon: rgba(248, 243, 235, 0.85);
    --tb-icon: rgba(248, 243, 235, 0.85);
    --tb-label: rgba(200, 190, 175, 0.70);
    --tb-radius: 14px;
    --gv-bar-icon: rgba(255, 255, 255, 0.8);
    --tb-item-h: min(20vw, 70px);
}

/* ── Wrapper ── */
#toolboxLine {
    position: fixed;
    top: 50%;
    left: 8px;
    transform: translateY(-50%);
    width: min(40vw, 140px);
    font-size: 18px;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 5px;
    z-index: 100;
    touch-action: none;
    user-select: none;
    -webkit-user-select: none;
    -webkit-tap-highlight-color: transparent;
    font-family: -apple-system, 'SF Pro Display', 'Google Sans', Roboto, sans-serif;
    display: none; 
}

#toolboxLine.show {
    display: flex;
}


/* ── Inner body ── */
#toolboxLineBody {
    width: auto;
    display: flex;
    justify-content: center;
}

/* ── Button row ── */
.toolboxLineBtnRow {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--toolboxLine-gap);
}

/* ── Item (btn + label) ── */
.toolboxLineItem {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 12px 14px;
    padding: 18px 10px;
    padding: 15px 8px;
    background: var(--tb-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 0.5px solid var(--tb-border);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.30);
    border-radius: var(--tb-radius);
    cursor: pointer;
    transition: background 0.12s ease, transform 0.12s ease;
    min-width: 56px;
}

/* ── Move Item – rund ── */ .toolboxLineItem:last-child {
    margin-top: 2px;
    padding-top: 10px;
    border-top: 1px solid rgba(255, 255, 255, 0.06);

    border-radius: 50%;
    min-width: 56px;
    width: 56px;
    height: 56px;
    padding: 0;
    margin-top: 8px;
    border-top: none;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 8px 8px;


}

.toolboxLineItem:active {
    background: rgba(168, 230, 61, 0.18);
        border-color: rgba(168, 230, 61, 0.45);
}

.toolboxLineItem.is-busy {
    color: #F4F2EE;
    background: rgba(168, 230, 61, 0.58);
            color: #F4F2EE;
}

.toolboxLineItem.is-busy>.toolboxLineLabel {
    color: #F4F2EE;
}

/* ── Buttons ── */
.toolboxLineBtn {
    width: 26px;
    height: 26px;
    border: none;
    background-color: var(--tb-icon);
    -webkit-mask-size: var(--toolboxLine-icon-size);
    mask-size: var(--toolboxLine-icon-size);
    -webkit-mask-repeat: no-repeat;
    mask-repeat: no-repeat;
    -webkit-mask-position: center;
    mask-position: center;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    transition: background-color 0.15s, transform 0.1s;
}

.toolboxLineBtn:active {
    transform: scale(0.92);
    background-color: var(--gv-lime);
}

/* ── Icons via mask ── */
#tbUndo::before {
    content: "";
    display: block;
    width: 24pt;
    /* Deine gewünschte Größe */
    height: 24pt;
    background-color: var(--tb-icon, #fff);
    /* Farbe des Icons */

    /* Die Maske wird nur hier angewendet */
    -webkit-mask: url(./assets/epoxy-mark-undo.svg) no-repeat center;
    mask: url(./assets/epoxy-mark-undo.svg) no-repeat center;
    -webkit-mask-size: contain;
    mask-size: contain;
}
#tbRedo::before {
    content: "";
    display: block;
    width: 24pt;
    height: 24pt;
    background-color: var(--tb-icon, #fff);
    -webkit-mask: url(./assets/epoxy-mark-redo.svg) no-repeat center;
    mask: url(./assets/epoxy-mark-redo.svg) no-repeat center;
    -webkit-mask-size: contain;
    mask-size: contain;
}

#toolboxBrushBtnAdd {
    -webkit-mask: url("./assets/brush.svg") no-repeat center;
    mask: url("./assets/brush.svg") no-repeat center;
    background: var(--tb-icon);
}

#toolboxLineBtnMove {
    -webkit-mask: url("./assets/move.svg") no-repeat center;
    mask: url("./assets/move.svg") no-repeat center;
    margin-top: 4px;
    opacity: 0.75;
    cursor: grab;
    background: var(--tb-icon);
}

#toolboxLineBtnMove:active {
    cursor: grabbing;
    opacity: 1;
}

#toolboxLineBtnMove.is-busy,
#toolboxLineBtnUndo.is-busy,
#toolboxBrushBtnUndo.is-busy {
    background: rgba(248, 243, 235, 0.55);
}

/* ── Active state ── */
.toolboxLineBtn.toolboxLineBtnActive {
    background-color: var(--gv-lime);
}

/* ── Label ── */
.toolboxLineLabel {
    font-size: 13px;
    font-weight: 100;
    color: var(--tb-label);
    letter-spacing: 0.3px;
    text-align: center;
}

/* ══════════════════════════════════════════
   Line / Brush Mode Switching
   ══════════════════════════════════════════ */

.toolboxBrushOnly {
    display: none !important;
}

.toolboxLineOnly {
    display: flex;
}

#toolboxLine.brushMode .toolboxBrushOnly {
    display: flex !important;
}

#toolboxLine.brushMode .toolboxLineOnly {
    display: none !important;
}

/* ══════════════════════════════════════════
   tb-* — New Toolbox Design System
   ══════════════════════════════════════════ */

/* Drag Handle */
.tb-handle {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    padding: 6px 0 4px;
    cursor: grab;
    background: rgba(26,26,26,0.9);
    border: 1px solid #2d2d2d;
    border-radius: 6px 6px 10px 10px;
}
.tb-handle span {
    display: block;
    width: 22px; height: 2px;
    background: #3a3a3a;
    border-radius: 1px;
    transition: background .15s;
}
.tb-handle:active span,
.tb-handle.dragging span { background: #8dff60; }

/* Volume + Intensity pair */
.tb-pair {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 5px;
    width: 100%;
    box-sizing: border-box;
}

/* Volume Card */
.tb-volume {
    background: rgba(26,26,26,0.92);
    border: 1px solid rgba(141,255,96,0.4);
    border-radius: 8px;
    padding: 8px 6px;
    height: auto;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1px;
}
.tb-vol-num {
    font-size: 30px;
    font-weight: 700;
    color: #8dff60;
    line-height: 1;
    margin-top: 2px;
}
.tb-vol-sub {
    display: flex;
    gap: 6px;
    color: rgba(255,255,255,0.8);
    font-size: 11pt;
    font-weight: 100;
    font-family: -apple-system, 'SF Pro Display', 'Google Sans', Roboto, sans-serif;
    margin-top: 2px;
}
.tb-vol-sub span {
    white-space: nowrap;
}
.tb-vol-header {
    font-size: 11px;
    font-weight: 400;
    color: rgba(255,255,255,0.75);
    font-family: -apple-system, 'SF Pro Text', 'SF Pro Display', sans-serif;
    white-space: nowrap;
}

/* Rows (Diameter, Intensity) — preset variant */
.tb-row {
    background: rgba(26,26,26,0.92);
    border: 1px solid #2d2d2d;
    border-radius: 8px;
    padding: 8px 8px;
    display: flex;
    align-items: center;
    gap: 6px;
}
.tb-row--preset {
    flex-direction: column;
    align-items: stretch;
    gap: 6px;
    padding: 8px 10px;
    justify-content: center;
    height: var(--tb-item-h);
    box-sizing: border-box;
}
.tb-row-label {
    font-size: 10px;
    font-weight: 400;
    letter-spacing: 0.2px;
    color: rgba(255,255,255,0.4);
    text-align: center;
    font-family: -apple-system, 'SF Pro Text', 'SF Pro Display', sans-serif;
}
.tb-preset-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 6px;
}

/* Diameter size presets */
.tb-size-preset {
    flex: 1;
    background: none;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 4px 0;
    border-radius: 4px;
    transition: background .12s;
    -webkit-tap-highlight-color: transparent;
}
.tb-size-preset:active { background: rgba(141,255,96,0.12); }
.tb-size-dot {
    display: block;
    border-radius: 50%;
    border: 1.5px solid rgba(255,255,255,0.35);
    box-sizing: border-box;
    transition: border-color .12s;
}
.tb-size-dot--s { width: 8px;  height: 8px; }
.tb-size-dot--m { width: 14px; height: 14px; }
.tb-size-dot--l { width: 22px; height: 22px; }
.tb-size-preset[data-active="true"] .tb-size-dot { border-color: #8dff60; }

/* Intensity Swatches — half-moon icons */
.swatch {
    flex: 1;
    aspect-ratio: 1;
    border-radius: 50%;
    cursor: pointer;
    border: 1.5px solid transparent;
    transition: border-color .15s, transform .15s;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
}
.swatch svg {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    display: block;
    overflow: hidden;
}
.swatch[data-active="true"] {
    border-color: #8dff60;
    transform: scale(1.15);
}

/* Undo / Redo — quadratisch */
.tb-undoredo {
    background: rgba(26,26,26,0.92);
    border: 1px solid #2d2d2d;
    border-radius: 8px;
    display: flex;
    align-items: stretch;
    overflow: hidden;
}
.tb-btn {
    flex: 1;
    aspect-ratio: 1;
    background: none;
    border: none;
    color: #d0d0d0;
    font-size: 18px;
    padding: 0;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    transition: background .15s;
    border-radius: 0;
    font-weight: 300;
}
.tb-btn span {
    font-size: 14px;
    color: var(--gv-bar-icon);
}
.tb-btn:active,
.tb-btn.flash {
    background: rgba(141,255,96,0.20);
    color: #8dff60;
}
.tb-divider {
    width: 1px;
    height: 28px;
    background: rgba(255, 255, 255, 0.18);
    flex-shrink: 0;
}

/* Move Button */
.tb-move {
    background: rgba(26,26,26,0.92);
    border: 1px solid #2d2d2d;
    border-radius: 50%;
    width: 40px; height: 40px;
    color: #d0d0d0;
    font-size: 16px;
    cursor: grab;
    align-self: center;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background .15s, color .15s;
}
.tb-move:active {
    background: rgba(141,255,96,0.12);
    color: #8dff60;
}

/* ══════════════════════════════════════════
   Epoxy Volume – Info Block
   ══════════════════════════════════════════ */

.toolboxLineItemEpoxyVolumne {
    cursor: default;
    pointer-events: none;
    background: rgba(52, 46, 38, 0.70);
    border: 0.5px solid rgba(168, 230, 61, 0.35);
    box-shadow: none;
    padding: 10px 14px 8px;
    gap: 2px;
    position: relative;
    overflow: hidden;
    padding: 18px 10px;
}

/* lime top stripe */
.toolboxLineItemEpoxyVolumne::before {
    content: "";
    display: block;
    position: absolute;
    top: 4px;
    left: 8px;
    right: 8px;
    height: 2px;
    background: var(--gv-lime);
    border-radius: 2px;
    opacity: 0.75;
}

.toolboxLineItemEpoxyVolumne:active {
    transform: none;
    background: rgba(52, 46, 38, 0.70);
}

.toolboxBrushVolumeValue {
    font-size: 22px;
    font-weight: 700;
    color: var(--gv-lime);
    line-height: 1;
    text-align: center;
    letter-spacing: -0.5px;
    margin-top: 4px;
}

/* ══════════════════════════════════════════
   toolboxLine – Proposal (Brush Mode)
   ══════════════════════════════════════════ */

/* ── Proposal Header ── */
.toolboxLineItemHeader {
    cursor: default;
    pointer-events: none;
    background: transparent;
    border: none;
    box-shadow: none;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    padding: 2px 8px 4px;
    min-width: 0;
}

.toolboxProposalLabel {
    font-size: 9px;
    font-weight: 700;
    letter-spacing: 1.2px;
    color: var(--gv-lime);
    text-transform: uppercase;
    text-align: center;
}

/* ── Expand button ── */
.toolboxBrushExpandItem {
    padding: 8px 10px;
}

.toolboxLineBtnExpand {
    width: 26px;
    height: 26px;
    border: none;
    background: none;
    color: var(--tb-icon);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    border-radius: 6px;
    -webkit-tap-highlight-color: transparent;
    transition: color 0.15s;
}

.toolboxLineBtnExpand:active,
#toolboxLine.tbExpanded #toolboxBrushExpandBtn {
    color: var(--gv-lime);
}

/* ── Collapsible sections ── */
.toolboxBrushCollapsible {
    display: none !important;
}

#toolboxLine.tbExpanded .toolboxBrushCollapsible {
    display: flex !important;
    flex-direction: column;
    gap: 8px;
    padding: 10px 12px;
}

/* ══════════════════════════════════════════
   brushMode – Uniform Width Layout
   ══════════════════════════════════════════ */

/* Container: fixed width driven by Diameter reference */
#toolboxLine.brushMode .toolboxLineBtnRow {
    width: 160px;
    align-items: stretch;
}

/* All items stretch to full width */
#toolboxLine.brushMode .toolboxLineItem {
    width: 100%;
    box-sizing: border-box;
    min-width: unset;
}

/* Move button: stays round, centered */
#toolboxLine.brushMode #toolboxMoveItem {
    width: 56px;
    align-self: center;
}

/* Epoxy: big number left, meta labels right */
#toolboxLine.brushMode #toolboxBrushVolume {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    padding: 12px 14px;
    gap: 8px;
}

#toolboxLine.brushMode .toolboxBrushVolumeValue {
    font-size: 28px;
    margin-top: 0;
}

.tbEpoxyMeta {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 1px;
}

/* Undo / Redo: icon + label side by side */
#toolboxLine.brushMode #toolboxBrushUndoItem,
#toolboxLine.brushMode #toolboxBrushRedoItem {
    flex-direction: row;
    align-items: center;
    justify-content: flex-start;
    padding: 12px 14px;
    gap: 12px;
}

/* ── Compact range slider ── */
.tbSlider {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: 4px;
    border-radius: 2px;
    background: rgba(255, 255, 255, 0.15);
    outline: none;
    cursor: pointer;
}

.tbSlider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: var(--gv-lime);
    cursor: pointer;
    box-shadow: 0 0 0 3px rgba(168, 230, 61, 0.22);
}

.tbSlider::-moz-range-thumb {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: var(--gv-lime);
    cursor: pointer;
    border: none;
}

/* ── Circle presets ── */
.tbCircleRow {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
}

.tbCirclePreset {
    background: none;
    border: none;
    padding: 0;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    -webkit-tap-highlight-color: transparent;
    transition: opacity 0.12s;
}

.tbCirclePreset:active {
    opacity: 0.6;
}

.tbCirclePreset.tbPresetActive .dmCircleIcon {
    border-color: var(--gv-lime);
}

/* ── Color swatches ── */
.tbSwatchRow {
    display: flex;
    gap: 2px;
    width: 100%;
}

.tbSwatch {
    flex: 1;
    height: 14px;
    border-radius: 3px;
    border: 1.5px solid transparent;
    cursor: pointer;
    padding: 0;
    -webkit-tap-highlight-color: transparent;
    transition: border-color 0.12s, transform 0.1s;
}

.tbSwatch:active {
    transform: scale(0.88);
}

.tbSwatch.tbSwatchActive {
    border-color: rgba(255, 255, 255, 0.8);
    transform: scaleY(1.2);
}

/* ══════════════════════════════════════════
   dockMarker – Brush Control Panel
   ══════════════════════════════════════════ */

#dockMarker {
    right: 16px;
    top: 50%;
    width: 130px;
    flex-direction: column;
    gap: 8px;
    padding: 12px 8px 16px;
    overflow: visible;
}

#dockMarker.show {
    display: flex !important;
}

.dmHeader {
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.6px;
    text-align: center;
    color: var(--gv-lime);
    text-transform: uppercase;
    padding-bottom: 6px;
    border-bottom: 0.5px solid rgba(168, 230, 61, 0.2);
}

.dmCard {
    background: rgba(30, 30, 30, 0.8);
    border-radius: 10px;
    border: 0.5px solid rgba(255, 255, 255, 0.08);
    padding: 10px 8px;
}

.dmEpoxyCard {
    border-color: rgba(168, 230, 61, 0.35);
    text-align: center;
    cursor: default;
    pointer-events: none;
}

.dmLabel {
    font-size: 11px;
    color: var(--tb-label);
    text-align: center;
}

.dmEpoxyValue {
    font-size: 22px;
    font-weight: 700;
    color: var(--gv-lime);
    line-height: 1.1;
    letter-spacing: -0.5px;
    margin: 3px 0 2px;
}

.dmItem {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 10px 8px;
    background: rgba(30, 30, 30, 0.8);
    border-radius: 10px;
    border: 0.5px solid rgba(255, 255, 255, 0.08);
    cursor: pointer;
    transition: background 0.12s;
}

.dmItem:active {
    background: rgba(168, 230, 61, 0.15);
}

.dmBtn {
    width: 26px;
    height: 26px;
    border: none;
    background-color: var(--tb-icon);
    -webkit-mask-size: 22px;
    mask-size: 22px;
    -webkit-mask-repeat: no-repeat;
    mask-repeat: no-repeat;
    -webkit-mask-position: center;
    mask-position: center;
    cursor: pointer;
    transition: background-color 0.15s, transform 0.1s;
}

.dmBtn:active {
    transform: scale(0.92);
    background-color: var(--gv-lime);
}

.dmBtnUndo {
    -webkit-mask: url("./assets/epoxy-mark-undo.svg") no-repeat center;
    mask: url("./assets/epoxy-mark-undo.svg") no-repeat center;
}

.dmBtnRedo {
    -webkit-mask: url("./assets/epoxy-mark-redo.svg") no-repeat center;
    mask: url("./assets/epoxy-mark-redo.svg") no-repeat center;
}

.dmSection {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.dmSectionLabel {
    font-size: 11px;
    color: var(--tb-label);
}

.dmSectionValue {
    font-size: 13px;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.88);
    text-align: center;
    background: rgba(0, 0, 0, 0.4);
    border-radius: 6px;
    padding: 4px 0;
}

.dmSlider {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: 4px;
    border-radius: 2px;
    background: rgba(255, 255, 255, 0.15);
    outline: none;
    cursor: pointer;
}

.dmSlider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--gv-lime);
    cursor: pointer;
    box-shadow: 0 0 0 3px rgba(168, 230, 61, 0.25);
}

.dmSlider::-moz-range-thumb {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--gv-lime);
    cursor: pointer;
    border: none;
}

.dmCircleRow {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 2px 0;
}

.dmCirclePreset {
    background: none;
    border: none;
    padding: 4px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    transition: background 0.12s;
}

.dmCirclePreset:active {
    background: rgba(168, 230, 61, 0.15);
}

.dmCircleIcon {
    display: block;
    width: var(--cw, 14px);
    height: var(--cw, 14px);
    border-radius: 50%;
    border: var(--cbw, 2px) solid rgba(255, 255, 255, 0.45);
    box-sizing: border-box;
    transition: border-color 0.12s;
}

.dmCirclePreset.dmPresetActive .dmCircleIcon {
    border-color: var(--gv-lime);
}

.dmSwatchRow {
    display: flex;
    gap: 4px;
    justify-content: space-between;
}

.dmSwatch {
    flex: 1;
    height: 18px;
    border-radius: 4px;
    border: 1.5px solid transparent;
    cursor: pointer;
    transition: border-color 0.12s, transform 0.1s;
}

.dmSwatch:active {
    transform: scale(0.9);
}

.dmSwatch.dmSwatchActive {
    border-color: rgba(255, 255, 255, 0.75);
    transform: scaleY(1.2);
}

.dmItemAdd {
    padding: 0;
    background: none;
    border: none;
    box-shadow: none;
    align-items: center;
}

.dmBtnAdd {
    width: 46px;
    height: 46px;
    border-radius: 50%;
    background: rgba(30, 30, 30, 0.9);
    border: 0.5px solid rgba(255, 255, 255, 0.12);
    color: rgba(255, 255, 255, 0.85);
    font-size: 24px;
    font-weight: 300;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s;
}

.dmBtnAdd:active {
    background: rgba(168, 230, 61, 0.2);
    color: var(--gv-lime);
}