.ws-app {
    --ws-bg: var(--color-bg, #f8fafc);
    --ws-panel: var(--color-surface, #ffffff);
    --ws-panel-soft: var(--color-surface2, #f6f8fb);
    --ws-text: var(--color-text-primary, #111827);
    --ws-muted: var(--color-muted, #64748b);
    --ws-border: var(--color-border, rgba(17, 24, 39, 0.1));
    --ws-accent: var(--color-primary, #0066ff);
    --ws-accent-strong: var(--color-primary-hover, #0052cc);
    --ws-accent-text: #ffffff;
    --ws-danger: #b91c1c;
    --ws-shadow: var(--shadow-lg, 0 30px 90px rgba(17, 24, 39, 0.12));
    --ws-soft-shadow: var(--shadow-sm, 0 8px 24px rgba(17, 24, 39, 0.08));
    --ws-radius: 16px;
    color: var(--ws-text);
    font: inherit;
    line-height: 1.5;
    min-height: calc(100vh - 24px);
    margin: 0;
    margin-left: 50%;
    padding: 8px;
    transform: translateX(-50%);
    width: calc(100vw - 16px);
}

.ws-app *,
.ws-app *::before,
.ws-app *::after {
    box-sizing: border-box;
}

.ws-shell {
    background:
        radial-gradient(circle at top right, rgba(var(--color-primary-rgb, 0, 102, 255), 0.08), transparent 30%),
        linear-gradient(180deg, var(--ws-bg), #ffffff);
    border: 1px solid var(--ws-border);
    border-radius: 20px;
    box-shadow: var(--ws-shadow);
    container-type: inline-size;
    display: flex;
    flex-direction: column;
    min-height: calc(100vh - 40px);
    padding: clamp(14px, 1.8vw, 22px);
}

.ws-header {
    align-items: center;
    display: flex;
    gap: 20px;
    justify-content: space-between;
    margin-bottom: 14px;
}

.ws-title,
.ws-subtitle,
.ws-status,
.ws-drop-title,
.ws-drop-meta,
.ws-file-list p,
.ws-panel-heading h3,
.ws-field label,
.ws-bottom-bar p,
.ws-trust-note {
    margin: 0;
}

.ws-title {
    color: var(--ws-text);
    font-size: clamp(24px, 2.1vw, 34px);
    font-weight: 850;
    letter-spacing: 0;
    line-height: 1.06;
}

.ws-subtitle {
    color: var(--ws-muted);
    font-size: 15px;
    margin-top: 8px;
}

.ws-trust-badges {
    align-items: center;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: flex-end;
}

.ws-header-actions {
    align-items: center;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: flex-end;
}

.ws-badge {
    align-items: center;
    background: var(--color-primary-subtle, #eef5ff);
    border: 1px solid var(--color-primary-200, #b9d7ff);
    border-radius: 999px;
    color: var(--color-primary-hover, #0052cc);
    display: inline-flex;
    flex: 0 0 auto;
    font-size: 13px;
    font-weight: 700;
    padding: 7px 11px;
}

.ws-help-link {
    align-items: center;
    background: #ffffff;
    border: 1px solid var(--ws-border);
    border-radius: 999px;
    color: var(--ws-text);
    display: inline-flex;
    font-size: 13px;
    font-weight: 800;
    line-height: 1;
    padding: 9px 13px;
    text-decoration: none;
}

.ws-help-link:hover {
    border-color: var(--ws-accent);
    color: var(--ws-accent-strong);
    text-decoration: none;
}

.ws-grid {
    align-items: stretch;
    display: grid;
    flex: 1 1 auto;
    gap: 18px;
    grid-template-columns: minmax(300px, 30%) minmax(0, 70%);
    min-height: 0;
}

.ws-controls {
    display: grid;
    gap: 14px;
    grid-auto-rows: max-content;
    min-height: 0;
    overflow: auto;
}

.ws-card {
    background: var(--ws-panel);
    border: 1px solid var(--ws-border);
    border-radius: var(--ws-radius);
    box-shadow: 0 10px 26px rgba(15, 23, 42, 0.06);
    padding: 16px;
}

.ws-upload-panel,
.ws-config-panel {
    border-color: rgba(226, 232, 240, 0.90);
    box-shadow: 0 6px 18px rgba(15, 23, 42, 0.035);
}

.ws-panel-heading {
    align-items: center;
    display: flex;
    justify-content: space-between;
    margin-bottom: 14px;
}

.ws-panel-heading h3 {
    color: var(--ws-text);
    font-size: 17px;
    font-weight: 800;
}

.ws-dropzone {
    align-items: center;
    background: linear-gradient(180deg, #ffffff, var(--ws-panel-soft));
    border: 1.5px dashed var(--ws-border);
    border-radius: 14px;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    gap: 8px;
    justify-content: center;
    min-height: 118px;
    padding: 16px 14px;
    text-align: center;
    transition: border-color 160ms ease, background 160ms ease, transform 160ms ease;
}

.ws-dropzone.ws-is-dragging {
    background: var(--color-primary-subtle, #eef5ff);
    border-color: var(--ws-accent);
    transform: translateY(-1px);
}

.ws-file-input {
    height: 1px;
    opacity: 0;
    overflow: hidden;
    position: absolute;
    width: 1px;
}

.ws-drop-icon {
    align-items: center;
    background: var(--ws-accent);
    border-radius: 999px;
    color: var(--ws-accent-text);
    display: inline-flex;
    box-shadow: 0 14px 42px rgba(var(--color-primary-rgb, 0, 102, 255), 0.24);
    font-size: 24px;
    height: 40px;
    justify-content: center;
    line-height: 1;
    width: 40px;
}

.ws-drop-title {
    color: var(--ws-text);
    font-size: 17px;
    font-weight: 800;
}

.ws-drop-meta,
.ws-status,
.ws-file-list,
.ws-trust-note,
.ws-bottom-bar p {
    color: var(--ws-muted);
    font-size: 13px;
}

.ws-trust-note {
    margin-top: 12px;
}

.ws-file-list {
    display: grid;
    gap: 8px;
    margin-top: 12px;
}

.ws-file-row {
    align-items: center;
    background: var(--ws-panel-soft);
    border: 1px solid var(--ws-border);
    border-radius: 12px;
    display: flex;
    gap: 10px;
    justify-content: space-between;
    padding: 9px 10px;
}

.ws-file-name {
    color: var(--ws-text);
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.ws-file-size {
    color: var(--ws-muted);
    flex: 0 0 auto;
    font-size: 12px;
}

.ws-config-panel {
    display: grid;
    gap: 14px;
}

.ws-field {
    display: grid;
    gap: 7px;
}

.ws-field label,
.ws-field-label {
    color: var(--ws-muted);
    font-size: 13px;
    font-weight: 700;
}

.ws-field input,
.ws-field select {
    background: #ffffff;
    border: 1px solid var(--ws-border);
    border-radius: 12px;
    color: var(--ws-text);
    font: inherit;
    min-height: 42px;
    padding: 9px 11px;
    width: 100%;
}

.ws-field input:focus,
.ws-field select:focus {
    border-color: var(--ws-accent);
    box-shadow: 0 0 0 3px rgba(var(--color-primary-rgb, 0, 102, 255), 0.14);
    outline: 0;
}

.ws-position-grid {
    display: grid;
    gap: 8px;
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.ws-position-choice {
    cursor: pointer;
    display: block;
    min-width: 0;
}

.ws-position-choice input {
    height: 1px;
    opacity: 0;
    overflow: hidden;
    position: absolute;
    width: 1px;
}

.ws-position-choice span {
    align-items: center;
    background: #ffffff;
    border: 1px solid var(--ws-border);
    border-radius: 12px;
    color: var(--ws-text);
    display: flex;
    font-size: 13px;
    font-weight: 800;
    justify-content: center;
    min-height: 40px;
    padding: 8px 10px;
    text-align: center;
    transition: background 160ms ease, border-color 160ms ease, box-shadow 160ms ease, color 160ms ease;
}

.ws-position-center {
    grid-column: 1 / -1;
}

.ws-position-choice input:checked + span {
    background: var(--color-primary-subtle, #eef5ff);
    border-color: rgba(var(--color-primary-rgb, 0, 102, 255), 0.35);
    box-shadow: 0 8px 20px rgba(var(--color-primary-rgb, 0, 102, 255), 0.12);
    color: var(--ws-accent-strong);
}

.ws-position-choice input:focus-visible + span {
    outline: 3px solid rgba(var(--color-primary-rgb, 0, 102, 255), 0.18);
}

.ws-field input[type="range"] {
    accent-color: var(--ws-accent);
    min-height: 32px;
    padding: 0;
}

.ws-field input[type="color"] {
    padding: 4px;
}

.ws-two-col {
    display: grid;
    gap: 12px;
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.ws-advanced {
    background: var(--ws-panel-soft);
    border: 1px solid var(--ws-border);
    border-radius: 14px;
    overflow: hidden;
}

.ws-advanced summary {
    color: var(--ws-text);
    cursor: pointer;
    font-weight: 800;
    list-style-position: inside;
    padding: 13px 14px;
}

.ws-advanced-body {
    border-top: 1px solid var(--ws-border);
    display: grid;
    gap: 13px;
    padding: 14px;
}

.ws-toggle {
    align-items: center;
    color: var(--ws-text);
    cursor: pointer;
    display: flex;
    font-size: 14px;
    font-weight: 700;
    gap: 10px;
}

.ws-toggle input {
    accent-color: var(--ws-accent);
    height: 18px;
    width: 18px;
}

.ws-button {
    align-items: center;
    background: var(--ws-accent);
    border: 0;
    border-radius: 14px;
    color: var(--ws-accent-text);
    cursor: pointer;
    display: inline-flex;
    font: inherit;
    font-weight: 800;
    justify-content: center;
    min-height: 48px;
    padding: 11px 18px;
    transition: background 160ms ease, transform 160ms ease, opacity 160ms ease;
    width: 100%;
}

.ws-button:hover:not(:disabled) {
    background: var(--ws-accent-strong);
    transform: translateY(-1px);
}

.ws-button:disabled {
    cursor: not-allowed;
    opacity: 0.55;
}

.ws-progress {
    background: #e5e7eb;
    border-radius: 999px;
    height: 8px;
    overflow: hidden;
}

.ws-progress-bar {
    background: linear-gradient(90deg, var(--ws-accent), var(--color-primary-400, #5599ff));
    height: 100%;
    transform: scaleX(0);
    transform-origin: left center;
    transition: transform 180ms ease;
}

.ws-status.ws-error {
    color: var(--ws-danger);
}

.ws-preview-panel {
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(248, 250, 252, 0.98));
    box-shadow: 0 24px 72px rgba(15, 23, 42, 0.12);
    display: grid;
    grid-template-rows: auto minmax(0, 1fr);
    min-height: 0;
    padding: 16px;
}

.ws-preview {
    align-items: center;
    background:
        radial-gradient(circle at 50% 8%, rgba(var(--color-primary-rgb, 0, 102, 255), 0.13), transparent 34%),
        linear-gradient(180deg, #eef4fb, #dce5ee);
    border: 1px solid #d5dee8;
    border-radius: 16px;
    color: var(--ws-muted);
    display: flex;
    justify-content: center;
    min-height: 0;
    overflow: auto;
    padding: clamp(28px, 4.4vw, 62px);
    position: relative;
    text-align: center;
}

.ws-preview::before {
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.54), transparent);
    content: "";
    height: 1px;
    left: 8%;
    position: absolute;
    right: 8%;
    top: 24px;
}

.ws-preview-frame {
    align-items: center;
    display: flex;
    justify-content: center;
    max-width: 100%;
}

.ws-preview-frame canvas {
    background: #ffffff;
    height: auto;
    max-width: 100%;
    transition: transform 180ms ease, box-shadow 180ms ease;
}

.ws-preview-paper canvas {
    border-radius: 4px;
    box-shadow:
        0 1px 0 rgba(15, 23, 42, 0.08),
        0 34px 90px rgba(15, 23, 42, 0.28);
    transform: scale(1.01);
}

.ws-preview-image {
    background: rgba(255, 255, 255, 0.72);
    border: 1px solid rgba(255, 255, 255, 0.86);
    border-radius: 16px;
    box-shadow: 0 28px 80px rgba(15, 23, 42, 0.22);
    padding: 14px;
}

.ws-preview-image canvas {
    border-radius: 10px;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.16);
}

.ws-bottom-bar {
    align-items: center;
    background: rgba(255, 255, 255, 0.92);
    border: 1px solid var(--ws-border);
    border-radius: 16px;
    box-shadow: var(--ws-soft-shadow);
    display: grid;
    gap: 16px;
    grid-template-columns: minmax(0, 1fr) minmax(220px, 320px);
    margin-top: 14px;
    flex: 0 0 auto;
    padding: 12px 14px;
    position: sticky;
    bottom: 10px;
    z-index: 2;
}

.ws-primary-action {
    background: linear-gradient(135deg, var(--ws-accent), var(--color-primary-400, #5599ff));
    box-shadow: 0 16px 36px rgba(var(--color-primary-rgb, 0, 102, 255), 0.22);
    min-height: 52px;
}

.ws-help-page {
    min-height: auto;
}

.ws-help-shell {
    background:
        radial-gradient(circle at top right, rgba(var(--color-primary-rgb, 0, 102, 255), 0.08), transparent 32%),
        linear-gradient(180deg, var(--ws-bg), #ffffff);
    border: 1px solid var(--ws-border);
    border-radius: 20px;
    box-shadow: var(--ws-shadow);
    display: grid;
    gap: 18px;
    margin: 0 auto;
    max-width: 1120px;
    padding: clamp(18px, 3vw, 34px);
    width: 100%;
}

.ws-help-hero {
    align-items: flex-start;
    display: flex;
    gap: 18px;
    justify-content: space-between;
}

.ws-help-hero h2,
.ws-help-hero p,
.ws-help-card h3,
.ws-help-card p,
.ws-help-info h3,
.ws-help-info p,
.ws-help-limits h3,
.ws-help-limits ul,
.ws-help-kicker {
    margin: 0;
}

.ws-help-kicker {
    color: var(--ws-accent-strong);
    font-size: 13px;
    font-weight: 850;
    margin-bottom: 10px;
}

.ws-help-hero h2 {
    color: var(--ws-text);
    font-size: clamp(30px, 4vw, 48px);
    font-weight: 880;
    letter-spacing: 0;
    line-height: 1.08;
}

.ws-help-hero p {
    color: var(--ws-muted);
    font-size: 16px;
    line-height: 1.7;
    margin-top: 12px;
    max-width: 760px;
}

.ws-help-cta {
    background: var(--ws-accent);
    border-radius: 999px;
    box-shadow: 0 16px 38px rgba(var(--color-primary-rgb, 0, 102, 255), 0.22);
    color: var(--ws-accent-text);
    flex: 0 0 auto;
    font-weight: 850;
    padding: 12px 18px;
    text-decoration: none;
}

.ws-help-cta:hover {
    background: var(--ws-accent-strong);
    color: var(--ws-accent-text);
    text-decoration: none;
}

.ws-help-grid,
.ws-help-info {
    display: grid;
    gap: 14px;
}

.ws-help-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.ws-help-info {
    grid-template-columns: repeat(4, minmax(0, 1fr));
}

.ws-help-card,
.ws-help-info article,
.ws-help-limits {
    background: var(--ws-panel);
    border: 1px solid var(--ws-border);
    border-radius: 16px;
    box-shadow: 0 10px 26px rgba(15, 23, 42, 0.055);
    padding: 18px;
}

.ws-help-step {
    align-items: center;
    background: var(--color-primary-subtle, #eef5ff);
    border-radius: 999px;
    color: var(--ws-accent-strong);
    display: inline-flex;
    font-size: 12px;
    font-weight: 900;
    height: 34px;
    justify-content: center;
    margin-bottom: 18px;
    width: 48px;
}

.ws-help-card h3,
.ws-help-info h3,
.ws-help-limits h3 {
    color: var(--ws-text);
    font-size: 17px;
    font-weight: 850;
    line-height: 1.25;
}

.ws-help-card p,
.ws-help-info p,
.ws-help-limits li {
    color: var(--ws-muted);
    font-size: 14px;
    line-height: 1.7;
    margin-top: 8px;
}

.ws-help-limits ul {
    display: grid;
    gap: 8px;
    padding-left: 20px;
}

@media (prefers-color-scheme: dark) {
    .ws-app {
        --ws-bg: #101828;
        --ws-panel: #111827;
        --ws-panel-soft: #1f2937;
        --ws-text: #f9fafb;
        --ws-muted: #cbd5e1;
        --ws-border: #344054;
        --ws-shadow: 0 18px 55px rgba(0, 0, 0, 0.26);
        --ws-soft-shadow: 0 10px 30px rgba(0, 0, 0, 0.20);
    }

    .ws-shell {
        background: linear-gradient(180deg, #101828, #111827);
    }

    .ws-field input,
    .ws-field select {
        background: #0f172a;
    }

    .ws-bottom-bar {
        background: rgba(17, 24, 39, 0.92);
    }

    .ws-help-link,
    .ws-help-shell {
        background: rgba(17, 24, 39, 0.92);
    }

}

@media (max-width: 980px) {
    .ws-grid {
        grid-template-columns: 1fr;
    }

    .ws-preview-panel {
        min-height: 70vh;
    }

    .ws-preview {
        min-height: 60vh;
    }

    .ws-help-grid,
    .ws-help-info {
        grid-template-columns: 1fr 1fr;
    }

}

@container (max-width: 760px) {
    .ws-grid {
        grid-template-columns: 1fr;
    }

    .ws-preview-panel {
        min-height: 70vh;
    }

    .ws-preview {
        min-height: 60vh;
    }

    .ws-header-actions,
    .ws-trust-badges {
        justify-content: flex-start;
    }

}

@media (max-width: 620px) {
    .ws-app {
        padding: 12px;
    }

    .ws-header,
    .ws-file-row,
    .ws-bottom-bar {
        align-items: stretch;
        grid-template-columns: 1fr;
    }

    .ws-header {
        flex-direction: column;
    }

    .ws-two-col {
        grid-template-columns: 1fr;
    }

    .ws-help-hero {
        display: grid;
    }

    .ws-help-grid,
    .ws-help-info {
        grid-template-columns: 1fr;
    }

}
