.texture-tool {
    --texture-ink: #172033;
    --texture-muted: #667085;
    --texture-soft: #f5f8fb;
    --texture-line: #d9e2ec;
    --texture-card: #ffffff;
    --texture-primary: #0f6fb5;
    --texture-primary-dark: #0a4f82;
    --texture-accent: #0d9488;
    --texture-warn: #b7791f;
    --texture-danger: #dc2626;
    --texture-shadow: 0 16px 38px rgba(30, 48, 80, .10);
    width: 100%;
    color: var(--texture-ink);
}
.texture-tool * {
    box-sizing: border-box;
}
.texture-tool button,
.texture-tool input,
.texture-tool select {
    font: inherit;
}
.texture-flow {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
    margin-bottom: 16px;
}
.texture-step {
    display: grid;
    grid-template-columns: auto 1fr;
    align-items: center;
    gap: 10px;
    min-height: 58px;
    border: 1px solid var(--texture-line);
    border-radius: 8px;
    background: #fff;
    color: #16324f;
    padding: 12px;
    cursor: pointer;
    text-align: left;
    transition: border-color .18s ease, box-shadow .18s ease, transform .18s ease, background .18s ease;
}
.texture-step:hover {
    border-color: rgba(15, 111, 181, .45);
    transform: translateY(-1px);
}
.texture-step span {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: #e8f2fb;
    color: var(--texture-primary-dark);
    font-weight: 900;
}
.texture-step b {
    color: #0f2945;
    font-size: 15px;
}
.texture-step.is-active {
    border-color: var(--texture-primary);
    background: linear-gradient(180deg, #fff, #eef7fc);
    box-shadow: 0 10px 24px rgba(15, 111, 181, .14);
}
.texture-step.is-active span {
    background: var(--texture-primary);
    color: #fff;
}
.texture-layout {
    display: grid;
    grid-template-columns: minmax(0, 1.05fr) minmax(360px, .95fr);
    gap: 16px;
    align-items: start;
}
.texture-panel,
.texture-preview-panel {
    background: var(--texture-card);
    border: 1px solid var(--texture-line);
    border-radius: 8px;
    box-shadow: var(--texture-shadow);
}
.texture-workspace {
    min-width: 0;
}
.texture-tab {
    display: none;
}
.texture-tab.is-active {
    display: grid;
    gap: 16px;
    padding: 18px;
}
.texture-panel-head,
.texture-preview-head,
.texture-result-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
}
.texture-panel-head {
    padding-bottom: 12px;
    border-bottom: 1px solid #edf1f6;
}
.texture-panel-head h3 {
    margin: 0 0 6px;
    font-size: 18px;
    line-height: 1.3;
}
.texture-panel-head p {
    margin: 0;
    color: var(--texture-muted);
    line-height: 1.65;
    font-size: 13px;
}
.texture-head-actions,
.texture-actions,
.texture-actions > div {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}
.texture-actions {
    justify-content: flex-end;
    align-items: center;
}
.texture-actions.split {
    justify-content: space-between;
}
.texture-btn {
    border: 1px solid #cfd8e6;
    background: #fff;
    color: #24364b;
    border-radius: 7px;
    padding: 9px 13px;
    min-height: 38px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    font-weight: 800;
    transition: border-color .18s ease, background .18s ease, color .18s ease, transform .18s ease;
}
.texture-btn:hover:not(:disabled) {
    border-color: var(--texture-primary);
    color: var(--texture-primary-dark);
}
.texture-btn.primary {
    border-color: var(--texture-primary);
    background: var(--texture-primary);
    color: #fff;
}
.texture-btn.primary:hover:not(:disabled) {
    background: var(--texture-primary-dark);
    color: #fff;
    transform: translateY(-1px);
}
.texture-btn.accent {
    border-color: var(--texture-accent);
    background: var(--texture-accent);
    color: #fff;
}
.texture-btn.download {
    border-color: #12926f;
    background: #12926f;
    color: #fff;
}
.texture-btn.ghost {
    background: #f8fafc;
}
.texture-btn.small {
    min-height: 32px;
    padding: 6px 10px;
    font-size: 12px;
}
.texture-btn:disabled {
    cursor: not-allowed;
    opacity: .48;
}
.texture-drop {
    border: 2px dashed #b9c7d8;
    background: #f8fbfd;
    border-radius: 8px;
    min-height: 178px;
    display: grid;
    place-items: center;
    gap: 8px;
    text-align: center;
    padding: 28px;
    cursor: pointer;
    transition: border-color .18s ease, background .18s ease;
}
.texture-drop input {
    display: none;
}
.texture-drop strong {
    font-size: 17px;
    color: #132f4c;
}
.texture-drop span,
.texture-empty,
.texture-result-head span,
.texture-preview-head span {
    color: var(--texture-muted);
    font-size: 13px;
    line-height: 1.55;
}
.texture-drop.is-dragover {
    border-color: var(--texture-primary);
    background: #eef7fc;
}
.texture-samples,
.texture-preset-grid,
.texture-run-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
}
.texture-preset-grid {
    grid-template-columns: repeat(5, minmax(0, 1fr));
}
.texture-sample,
.texture-preset {
    border: 1px solid var(--texture-line);
    border-radius: 8px;
    background: #fff;
    color: var(--texture-ink);
    cursor: pointer;
    text-align: left;
    padding: 13px;
}
.texture-sample:hover,
.texture-preset:hover,
.texture-preset.is-active {
    border-color: var(--texture-primary);
    background: #f0f8fc;
}
.texture-preset.is-active {
    box-shadow: 0 8px 18px rgba(15, 111, 181, .12);
}
.texture-sample b,
.texture-preset b {
    display: block;
    margin-bottom: 5px;
    font-size: 14px;
}
.texture-sample span,
.texture-preset span {
    color: var(--texture-muted);
    font-size: 12px;
    line-height: 1.45;
}
.texture-file-summary {
    border: 1px solid #e4eaf3;
    border-radius: 8px;
    background: #fff;
    padding: 14px;
    display: grid;
    gap: 10px;
}
.texture-summary-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}
.texture-summary-row span {
    color: var(--texture-muted);
    font-size: 12px;
}
.texture-file-list {
    display: grid;
    gap: 8px;
    max-height: 230px;
    overflow: auto;
}
.texture-file-item {
    display: grid;
    grid-template-columns: 1fr auto auto;
    align-items: center;
    gap: 10px;
    border: 1px solid #e8edf5;
    background: #fbfcff;
    border-radius: 7px;
    padding: 8px 10px;
    min-width: 0;
}
.texture-file-item b {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 13px;
}
.texture-file-item span {
    color: var(--texture-muted);
    font-size: 12px;
    white-space: nowrap;
}
.texture-remove {
    border: 1px solid #efb7b7;
    color: var(--texture-danger);
    background: #fff;
    border-radius: 6px;
    padding: 5px 8px;
    font-size: 12px;
    cursor: pointer;
}
.texture-controls,
.texture-output-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
}
.texture-output-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    border: 1px solid #e4eaf3;
    background: #fbfcff;
    border-radius: 8px;
    padding: 14px;
    align-items: end;
}
.texture-field {
    display: grid;
    gap: 7px;
}
.texture-field label {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    font-weight: 800;
    font-size: 13px;
    color: #344054;
}
.texture-field output {
    color: var(--texture-primary-dark);
}
.texture-field input[type="range"] {
    width: 100%;
    accent-color: var(--texture-primary);
}
.texture-field select {
    width: 100%;
    border: 1px solid #d7dfeb;
    border-radius: 7px;
    min-height: 40px;
    padding: 8px 10px;
    color: var(--texture-ink);
    background: #fff;
    outline: none;
}
.texture-field select:focus {
    border-color: var(--texture-primary);
    box-shadow: 0 0 0 3px rgba(15, 111, 181, .12);
}
.texture-check {
    border: 1px solid #dfe7f0;
    border-radius: 8px;
    background: #fff;
    min-height: 40px;
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 8px 10px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 800;
    color: #344054;
}
.texture-check input {
    accent-color: var(--texture-primary);
}
.texture-run-card {
    border: 1px solid #e4eaf3;
    border-radius: 8px;
    background: #fbfcff;
    padding: 14px;
    text-align: center;
}
.texture-run-card span {
    display: block;
    color: var(--texture-muted);
    font-size: 12px;
    margin-bottom: 5px;
}
.texture-run-card b {
    font-size: 18px;
}
.texture-progress {
    height: 8px;
    overflow: hidden;
    border-radius: 999px;
    background: #e9eef5;
}
.texture-progress div {
    width: 0;
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, var(--texture-primary), var(--texture-accent));
    transition: width .2s ease;
}
.texture-status {
    min-height: 24px;
    color: var(--texture-muted);
    font-size: 13px;
}
.texture-status.success {
    color: #12926f;
}
.texture-status.error {
    color: var(--texture-danger);
}
.texture-status.warn {
    color: var(--texture-warn);
}
.texture-preview-panel {
    overflow: hidden;
    position: sticky;
    top: 16px;
}
.texture-preview-head,
.texture-result-head {
    padding: 14px 16px;
    border-bottom: 1px solid #edf1f6;
    background: #f7f9fc;
}
.texture-preview-head > div,
.texture-result-head > div {
    display: grid;
    gap: 3px;
}
.texture-preview-head b,
.texture-result-head b {
    font-size: 16px;
}
.texture-compare {
    position: relative;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1px;
    background: #e5ebf3;
    min-height: 340px;
}
.texture-preview-box {
    background: #fff;
    min-height: 340px;
    padding: 14px;
    display: grid;
    grid-template-rows: auto 1fr;
    gap: 10px;
}
.texture-preview-box span {
    color: #344054;
    font-weight: 800;
    font-size: 13px;
}
.texture-preview-box canvas {
    width: 100%;
    max-width: 100%;
    height: auto;
    align-self: center;
    justify-self: center;
    border-radius: 7px;
    background:
        linear-gradient(45deg, #eef2f6 25%, transparent 25%),
        linear-gradient(-45deg, #eef2f6 25%, transparent 25%),
        linear-gradient(45deg, transparent 75%, #eef2f6 75%),
        linear-gradient(-45deg, transparent 75%, #eef2f6 75%);
    background-size: 18px 18px;
    background-position: 0 0, 0 9px, 9px -9px, -9px 0;
    box-shadow: 0 8px 22px rgba(16, 42, 67, .10);
}
.texture-empty-preview {
    position: absolute;
    inset: 16px;
    border: 1px dashed #c9d5e5;
    border-radius: 8px;
    background: linear-gradient(180deg, rgba(255, 255, 255, .94), rgba(246, 249, 252, .94));
    display: grid;
    place-items: center;
    text-align: center;
    padding: 20px;
}
.texture-empty-preview b {
    display: block;
    margin-bottom: 6px;
}
.texture-empty-preview.is-hidden {
    display: none;
}
.texture-result-panel {
    border-top: 1px solid #edf1f6;
}
.texture-results {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
    padding: 14px 16px 16px;
    max-height: 420px;
    overflow: auto;
}
.texture-result-item {
    border: 1px solid #e4eaf3;
    background: #fff;
    border-radius: 8px;
    padding: 10px;
    display: grid;
    gap: 8px;
}
.texture-result-item img {
    width: 100%;
    aspect-ratio: 4 / 3;
    object-fit: contain;
    background: #f3f6fa;
    border-radius: 6px;
}
.texture-result-name {
    font-size: 12px;
    font-weight: 800;
    color: #344054;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.texture-result-meta {
    color: var(--texture-muted);
    font-size: 12px;
}
.texture-result-item .texture-btn {
    width: 100%;
}
@media (max-width: 1180px) {
    .texture-layout {
        grid-template-columns: 1fr;
    }
    .texture-preview-panel {
        position: static;
    }
    .texture-preset-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}
@media (max-width: 780px) {
    .texture-flow,
    .texture-samples,
    .texture-preset-grid,
    .texture-controls,
    .texture-output-grid,
    .texture-run-grid {
        grid-template-columns: 1fr;
    }
    .texture-panel-head,
    .texture-actions.split {
        display: grid;
    }
    .texture-actions,
    .texture-actions > div {
        justify-content: stretch;
    }
    .texture-btn {
        width: 100%;
    }
    .texture-compare,
    .texture-results {
        grid-template-columns: 1fr;
    }
    .texture-tab.is-active {
        padding: 14px;
    }
}
@media (max-width: 520px) {
    .texture-step {
        min-height: 52px;
        padding: 10px;
    }
    .texture-file-item {
        grid-template-columns: 1fr auto;
    }
    .texture-file-item span {
        grid-column: 1 / -1;
    }
}
