.toolbar {
    height: var(--toolbar-height);
    background-color: var(--bg-panel);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    padding: 0 16px;
    font-size: 0.75rem;
    gap: 10px;
    font-family: var(--font-ui);
    letter-spacing: 0.06em;
    position: relative;
}

.toolbar::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 16px;
    right: 16px;
    height: 1px;
    background: linear-gradient(to right, transparent, var(--border-strong), transparent);
}

.tool-group {
    display: flex;
    align-items: center;
    gap: 5px;
    color: var(--text-secondary);
}

.toolbox-grid {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 10px 0;
}

.tool-btn {
    width: 36px;
    height: 36px;
    border-radius: 3px;
    background-color: transparent;
    border: 1px solid transparent;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    transition: all 0.15s ease;
    position: relative;
}

.tool-btn img {
    filter: invert(1) sepia(0.3) brightness(0.85);
    pointer-events: none;
    transition: filter 0.15s ease;
}

.tool-btn:hover {
    background-color: rgba(var(--accent-rgb), 0.12);
    border-color: var(--accent-dim);
}

.tool-btn:hover img {
    filter: invert(1) sepia(0.1) brightness(1);
}

.tool-btn.active,
.text-style-btn.active,
.text-align-btn.active {
    background-color: rgba(var(--accent-rgb), 0.2);
    border-color: var(--accent-color);
    box-shadow: inset 0 0 8px rgba(var(--accent-rgb), 0.15), 0 0 6px rgba(var(--accent-rgb), 0.2);
}

.tool-btn.active img {
    filter: invert(0.85) sepia(0.5) saturate(2) hue-rotate(-10deg) brightness(1.1);
}

.value-slider {
    position: relative;
    width: 180px;
    height: 26px;
    border-radius: 2px;
    background-color: var(--ink-dark);
    border: 1px solid var(--border-strong);
    overflow: hidden;
}

.value-slider::before {
    content: '';
    position: absolute;
    inset: 0;
    background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='2' height='2'%3E%3Crect width='2' height='2' fill='transparent'/%3E%3Ccircle cx='1' cy='1' r='0.4' fill='%23ffffff' opacity='0.015'/%3E%3C/svg%3E");
    pointer-events: none;
    z-index: 3;
}

.tool-slider {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: 100%;
    margin: 0;
    background: transparent;
    outline: none;
    position: absolute;
    top: 0;
    left: 0;
    z-index: 1;
    cursor: ew-resize;
}

.tool-slider::-webkit-slider-runnable-track {
    width: 100%;
    height: 100%;
    background: linear-gradient(to right, var(--accent-color) var(--slider-fill, 0%), transparent var(--slider-fill, 0%));
}

.tool-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 0;
    height: 100%;
}

.tool-slider::-moz-range-track {
    width: 100%;
    height: 100%;
    background-color: transparent;
}

.tool-slider::-moz-range-progress {
    background-color: var(--accent-color);
    height: 100%;
}

.tool-slider::-moz-range-thumb {
    width: 0;
    height: 100%;
    border: none;
}

.value-slider-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 8px;
    z-index: 2;
    pointer-events: none;
    color: var(--text-primary);
    font-size: 0.72rem;
    font-weight: 600;
    font-family: var(--font-ui);
    letter-spacing: 0.08em;
    text-transform: uppercase;
    text-shadow: 0px 1px 3px rgba(0, 0, 0, 1);
}

.value-slider-inputs {
    display: flex;
    align-items: center;
    pointer-events: auto;
}

.value-slider-inputs input[type="number"] {
    background: transparent;
    border: none;
    color: var(--text-primary);
    font-family: var(--font-mono);
    font-size: 0.78rem;
    font-weight: bold;
    width: 40px;
    text-align: right;
    padding: 2px 3px;
    text-shadow: 0px 1px 3px rgba(0, 0, 0, 1);
    outline: none;
    appearance: textfield;
    -moz-appearance: textfield;
    transition: background 0.1s ease;
}

.value-slider-inputs input[type="number"]:focus {
    background-color: rgba(0, 0, 0, 0.7);
    border-radius: 2px;
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.8);
}

.value-slider-inputs input[type="number"]::-webkit-inner-spin-button,
.value-slider-inputs input[type="number"]::-webkit-outer-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.value-slider-inputs span {
    color: var(--text-secondary);
    font-size: 0.68rem;
    margin-left: 1px;
}

.status-bar {
    height: var(--statusbar-height);
    background-color: var(--ink-dark);
    border-top: 2px solid var(--accent-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 16px;
    font-size: 0.68rem;
    color: var(--text-secondary);
    font-family: var(--font-mono);
    letter-spacing: 0.06em;
}

.status-right {
    display: flex;
    gap: 18px;
}

.status-right span {
    position: relative;
}

.status-right span:not(:last-child)::after {
    content: '|';
    position: absolute;
    right: -10px;
    color: var(--border-strong);
}

.toolbar-control--hidden {
    display: none;
}

.toolbox-separator {
    height: 1px;
    background: var(--border-color);
    width: 70%;
    margin: 4px 0;
}

.toolbox-label {
    text-align: center;
    font-size: 0.6rem;
    padding: 6px 4px;
}

.text-size-slider {
    width: 120px;
}

.text-leading-slider {
    width: 115px;
}

.text-spacing-slider {
    width: 120px;
}

.text-size-slider,
.text-leading-slider,
.text-spacing-slider {
    margin-left: 8px;
}

.text-size-slider {
    margin-left: 16px;
}

.text-font-slider {
    width: 130px;
    position: relative;
}

.text-font-select {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    background: transparent;
    border: none;
    outline: none;
    color: transparent;
    cursor: pointer;
    z-index: 2;
    appearance: none;
    -webkit-appearance: none;
    font-size: 0;
}

.text-font-select option {
    background-color: var(--bg-panel);
    color: var(--text-primary);
    font-size: 0.8rem;
}

.text-font-label {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    text-align: left;
    font-size: 0.72rem;
    font-weight: 600;
    font-family: var(--font-ui);
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-primary);
    text-shadow: 0px 1px 3px rgba(0, 0, 0, 1);
    pointer-events: none;
}

.text-style-group,
.text-align-group {
    gap: 3px;
}

.text-style-btn {
    width: 28px;
    height: 28px;
}

.text-style-btn span {
    font-size: 0.85rem;
    font-family: serif;
    color: var(--text-secondary);
    transition: color 0.15s;
    line-height: 1;
}

#btn-text-bold span {
    font-weight: 700;
}

#btn-text-italic span {
    font-style: italic;
}

#btn-text-underline span {
    text-decoration: underline;
}

.text-style-btn:hover span {
    color: var(--text-primary);
}

.text-style-btn.active span {
    color: var(--accent-color);
}

.text-align-btn {
    width: 28px;
    height: 28px;
    color: var(--text-secondary);
    fill: var(--text-secondary);
}

.text-align-btn svg {
    color: inherit;
    fill: inherit;
    transition: color 0.15s, fill 0.15s;
}

.text-align-btn:hover {
    color: var(--text-primary);
    fill: var(--text-primary);
}

.text-align-btn.active {
    color: var(--accent-color);
    fill: var(--accent-color);
}

.text-color-wrap {
    position: relative;
    width: 26px;
    height: 26px;
    flex-shrink: 0;
    cursor: pointer;
}

.text-color-swatch {
    width: 26px;
    height: 26px;
    border-radius: 2px;
    border: 1px solid var(--border-strong);
    box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.4);
    transition: border-color 0.15s;
    pointer-events: none;
    background-color: #000000;
}

.text-color-wrap:hover .text-color-swatch {
    border-color: var(--accent-color);
    box-shadow: 0 0 6px rgba(var(--accent-rgb), 0.35);
}

.text-color-wrap input[type="color"] {
    display: none;
}